From fffece9125e8b208b63f3dbc888c1b3e16b2b598 Mon Sep 17 00:00:00 2001 From: Gary Wong Date: Sat, 22 Aug 2009 23:24:11 -0600 Subject: [PATCH] Add notes and placeholders for future modifications. --- configure.ac | 16 +++++++++++-- decorate-core.c | 5 ++-- frame.c | 7 ++++++ gwm.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ gwm.h | 16 ++++++++++--- keyboard.c | 2 +- managed.c | 1 + root.c | 2 +- window-table.c | 2 ++ 9 files changed, 115 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index d209b9c..389fc34 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,13 @@ -AC_INIT(gwm-basic, 1.0, gtw@gnu.org) +AC_INIT(gwm, 0.0, gtw@gnu.org) AC_CONFIG_SRCDIR(gwm.c) AM_INIT_AUTOMAKE AC_CONFIG_FILES(Makefile) AC_CONFIG_HEADERS(config.h) +if test -f config.options; then + . ./config.options +fi + AC_DEFINE(_GNU_SOURCE,1,Enable GNU extensions on systems that have them.) # Checks for programs: @@ -14,11 +18,19 @@ PKG_PROG_PKG_CONFIG # pkg-config packages which must be present: packages="xcb" # pkg-config xcb- packages which can optionally be used: -optional_xcb_packages="shape" +optional_xcb_packages="composite damage render shape xfixes" +AC_ARG_WITH(composite,[ --with-composite use the X Composite extension.]) +AC_ARG_WITH(damage, [ --with-damage use the X DAMAGE extension.]) +AC_ARG_WITH(render, [ --with-render use the X RENDER extension.]) AC_ARG_WITH(shape, [ --with-shape use the X SHAPE extension.]) +AC_ARG_WITH(xfixes, [ --with-xfixes use the XFIXES extension.]) +AH_TEMPLATE(USE_COMPOSITE,[Use the X Composite extension.]) +AH_TEMPLATE(USE_DAMAGE,[Use the X DAMAGE extension.]) +AH_TEMPLATE(USE_RENDER,[Use the X RENDER extension.]) AH_TEMPLATE(USE_SHAPE,[Use the X SHAPE extension.]) +AH_TEMPLATE(USE_XFIXES,[Use the XFIXES extension.]) for i in $optional_xcb_packages; do AC_MSG_CHECKING([for $i]) diff --git a/decorate-core.c b/decorate-core.c index a9914b5..6976537 100644 --- a/decorate-core.c +++ b/decorate-core.c @@ -124,6 +124,7 @@ static xcb_void_cookie_t core_text( xcb_drawable_t drawable, int screen, extern void core_update_window( struct gwm_window *window ) { + /* FIXME SetClipRectangles? */ if( !window->cleared ) xcb_clear_area( c, FALSE, window->w, window->update.x, window->update.y, window->update.width, window->update.height ); @@ -131,6 +132,7 @@ extern void core_update_window( struct gwm_window *window ) { if( window->type == WINDOW_FRAME ) { char *name = window->u.frame.child->u.managed.name; + /* FIXME Define constants for position. */ core_text( window->w, window->screen, window == focus_frame ? COL_TITLE_ACTIVE : COL_TITLE_INACTIVE, 18, 12, name ? name : "(Untitled)" ); @@ -314,9 +316,8 @@ extern void decorate_core_init( void ) { int i; uint32_t n; - /* This font should be configurable, of course. */ const char *font_name = "-*-lucida-bold-r-normal-sans-12-" - "*-*-*-p-*-iso10646-1", + "*-*-*-p-*-iso10646-1", /* FIXME allow font selection */ *cursor_font_name = "cursor"; xcb_char2b_t c2; union callback_param p; diff --git a/frame.c b/frame.c index 174184c..1ec3c6b 100644 --- a/frame.c +++ b/frame.c @@ -147,6 +147,8 @@ static void recalc_size( struct gwm_window *window, int x, int y, values[ 0 ] = new_width - ( FRAME_BORDER_WIDTH << 1 ); values[ 1 ] = new_height - FRAME_TITLE_HEIGHT - FRAME_BORDER_WIDTH; + /* FIXME See _NET_WM_SYNC_REQUEST in the EWMH to avoid resizing the + window faster than the client can redraw it. */ xcb_configure_window( c, window->u.frame.child->w, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values ); @@ -239,6 +241,8 @@ static void frame_motion_notify( struct gwm_window *window, if( !ev->same_screen ) return; + /* FIXME Detect and account for window and screen edges. */ + switch( window_op ) { case OP_MOVE: values[ 0 ] = ev->root_x - dx; @@ -301,6 +305,9 @@ static void frame_enter_notify( struct gwm_window *window, queue_window_update( window, 0, 0, window->u.frame.width, window->u.frame.height, FALSE ); + /* FIXME Defer all this focus stuff in case of multiple enter/leave + notifies. */ + if( window->u.frame.child->u.managed.hints & HINT_INPUT ) /* Give the client the focus (ICCCM 2.0, section 4.1.7). */ /* Ignore Window errors (which can occur if the client destroys diff --git a/gwm.c b/gwm.c index b5a0d75..2e83bc2 100644 --- a/gwm.c +++ b/gwm.c @@ -40,11 +40,24 @@ #include #endif #include +#if USE_COMPOSITE +#include +#endif +#if USE_DAMAGE +#include +#endif +#include +#if USE_RENDER +#include +#endif #if USE_SHAPE #include #endif #include #include +#if USE_XFIXES +#include +#endif #include "gwm.h" @@ -62,6 +75,14 @@ xcb_timestamp_t latest_timestamp; xcb_atom_t atoms[ NUM_ATOMS ]; + /* FIXME add: + _NET_SUPPORTED, + _NET_NUMBER_OF_DESKTOPS (1), + _NET_DESKTOP_GEOMETRY, + _NET_DESKTOP_VIEWPORT (0,0), + _NET_CURRENT_DESKTOP (0), + _NET_WORKAREA, + _NET_SUPPORTING_WM_CHECK properties to root windows. */ static const char *atom_names[ NUM_ATOMS ] = { "COMPOUND_TEXT", "MANAGER", @@ -80,9 +101,21 @@ xcb_atom_t prop_atoms[ NUM_PROPS ]; xcb_atom_t prop_types[ NUM_PROPS ]; static const xcb_extension_t *extensions[ EXTENSIONS_SIZE ] = { +#if USE_COMPOSITE + &xcb_composite_id, +#endif +#if USE_DAMAGE + &xcb_damage_id, +#endif +#if USE_RENDER + &xcb_render_id, +#endif #if USE_SHAPE &xcb_shape_id, #endif +#if USE_XFIXES + &xcb_xfixes_id +#endif }; int have_extension[ EXTENSIONS_SIZE ]; @@ -441,6 +474,8 @@ static void show_event( xcb_generic_event_t *generic ) { int type = generic->response_type & 0x7F; int i; + /* FIXME handle extensions */ + if( !( generic->response_type & ~SEND_EVENT_MASK ) ) { show_error( (xcb_generic_error_t *) generic ); @@ -1787,6 +1822,10 @@ static void setup_display( void ) { decorate_core_init(); update_window = core_update_window; + /* FIXME For each extension we have, query if its version is recent + enough if neccesary. (SHAPE is OK -- version 1.0 is enough, and + it's the only extension we bother with so far.) */ + for( i = 0; i < NUM_ATOMS; i++ ) { xcb_intern_atom_reply_t *r = xcb_intern_atom_reply( c, atom_cookies[ i ], NULL ); @@ -1795,6 +1834,11 @@ static void setup_display( void ) { free( r ); } + /* FIXME Also monitor EWMH client window properties: + _MOTIF_WM_HINTS, to see what decoration clients want + _NET_WM_NAME, UTF-8 in preference to WM_NAME + _NET_WM_ICON, ARGB icon(s) + and set _NET_FRAME_EXTENTS. */ prop_atoms[ PROP_WM_COLORMAP_WINDOWS ] = atoms[ ATOM_WM_COLORMAP_WINDOWS ]; prop_atoms[ PROP_WM_HINTS ] = WM_HINTS; prop_atoms[ PROP_WM_NAME ] = WM_NAME; @@ -2174,12 +2218,23 @@ static void handle_client_message( xcb_client_message_event_t *ev ) { focus_frame->u.frame.child : NULL, ev->data.data32[ 0 ] ); } + + /* FIXME and all the EWMH client messages: + _NET_CLOSE_WINDOW + _NET_MOVE_RESIZE_WINDOW + _NET_WM_MOVERESIZE + _NET_RESTACK_WINDOW + _NET_REQUEST_FRAME_EXTENTS */ } static void handle_events( void ) { xcb_generic_event_t *ev; + /* FIXME Should read as many events as possible (loop on + xcb_poll_for_event), and queue them... might be able to + elide some event processing that way if later events + supercede earlier ones. */ while( ( ev = wait_for_event() ) ) { int event_type = ev->response_type; int event_base_type = event_type & 0x7F; @@ -2388,6 +2443,20 @@ static void handle_events( void ) { break; } + /* FIXME other features: + - make override-redirect windows translucent + - desktop menu & other key/pointer bindings + - when in the window menu, turn all windows translucent + except for the selected item (temporarily raise that one?) + - root background/cursor? (no; xsetroot for non composite case) + - standard colourmaps? (no; xstdcmap does that) + - DPMS + - add debugging structure to detect memory leaks, and maybe even + correlating X protocol errors to request call sites + - other extensions... XINERAMA? RANDR? RandR should send + ConfigureNotify to the root when resolution changes, so don't + need the extension... test it. */ + free( ev ); } } @@ -2414,6 +2483,8 @@ retry: for( i = 0; i < windows.used; i++ ) if( windows.values[ i ]->type == WINDOW_MANAGED ) { unmanage_window( windows.values[ i ] ); + /* FIXME Try to stack the windows in the same order the frames + were... what a pain. */ goto retry; } @@ -2599,3 +2670,5 @@ extern int main( int argc, char *argv[] ) { return 0; } + +/* FIXME xv moves when changing files (or pressing "n")... investigate. */ diff --git a/gwm.h b/gwm.h index fd970fd..5f63b9d 100644 --- a/gwm.h +++ b/gwm.h @@ -93,11 +93,21 @@ enum gwm_property_type { extern xcb_atom_t prop_atoms[ NUM_PROPS ]; extern xcb_atom_t prop_types[ NUM_PROPS ]; -/* The only extension used is SHAPE (if present), but let's structure - things to make it simple to take advantage of others, too. */ enum gwm_extension { +#if USE_COMPOSITE + EXT_COMPOSITE, +#endif +#if USE_DAMAGE + EXT_DAMAGE, +#endif +#if USE_RENDER + EXT_RENDER, +#endif #if USE_SHAPE - EXT_SHAPE, + EXT_SHAPE, /* any version */ +#endif +#if USE_XFIXES + EXT_XFIXES, /* requires version 2 */ #endif NUM_EXTENSIONS }; diff --git a/keyboard.c b/keyboard.c index cf34cde..f9193de 100644 --- a/keyboard.c +++ b/keyboard.c @@ -67,7 +67,7 @@ xcb_keysym_t keyboard_map[ 0x100 ][ 4 ]; xcb_keycode_t *modifier_map[ 8 ]; const struct key_action key_actions[ NUM_KEY_ACTIONS ] = { - /* This table should be configurable, of course. */ + /* FIXME This table should be configurable, of course. */ { KEYSYM_TAB, XCB_MOD_MASK_1, action_raise_lowest }, { KEYSYM_F5, XCB_MOD_MASK_1, action_stack_opposite } }; diff --git a/managed.c b/managed.c index eff9598..2abc12a 100644 --- a/managed.c +++ b/managed.c @@ -336,6 +336,7 @@ extern void managed_property_change( struct gwm_window *window, int prop, case PROP_WM_PROTOCOLS: /* WM_PROTOCOLS property (see ICCCM 2.0, section 4.1.2.7). */ + /* FIXME Look for _NET_WM_SYNC_REQUEST. */ window->u.managed.protocols = 0; if( p->format == 32 ) { diff --git a/root.c b/root.c index 9964bef..a3d865d 100644 --- a/root.c +++ b/root.c @@ -52,7 +52,7 @@ static const struct button_action { xcb_mod_mask_t modifiers; void ( *handler )( struct gwm_window *window, xcb_generic_event_t *ev ); } button_actions[] = { - /* This table should be configurable, of course. */ + /* FIXME This table should be configurable, of course. */ { 1, 0, action_map_all_icons }, { 3, 0, action_start_xterm } }; diff --git a/window-table.c b/window-table.c index 76ba933..047161e 100644 --- a/window-table.c +++ b/window-table.c @@ -242,6 +242,8 @@ extern void queue_window_update( struct gwm_window *window, int x, int y, int width, int height, int cleared ) { + /* FIXME Consider computing the region instead of the bounding box. */ + if( x < window->update.x ) { window->update.width += window->update.x - x; window->update.x = x; -- 2.11.4.GIT