diff options
author | Gary Wong <gtw@gnu.org> | 2009-09-06 20:37:30 -0600 |
---|---|---|
committer | Gary Wong <gtw@gnu.org> | 2009-09-06 20:37:30 -0600 |
commit | af2604695a882e308eb454900dd8b6115d3a3be3 (patch) | |
tree | be3b8d284e126e1991c42539e27ae4258c8af6a7 | |
parent | 273f014b05bdb206718bf5488bde7971cdbd1ce7 (diff) |
Add various EWMH properties to the root and fake windows.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gwm.c | 89 | ||||
-rw-r--r-- | gwm.h | 7 |
3 files changed, 78 insertions, 24 deletions
@@ -1,5 +1,10 @@ 2009-09-06 Gary Wong <gtw@gnu.org> + * gwm.c (setup_display): Add various EWMH properties to the root + and fake windows. + +2009-09-06 Gary Wong <gtw@gnu.org> + * decorate-core.c (core_replace_icons): New function. * decorate-render.c (render_picture, assemble_image) (render_replace_icons): New functions. @@ -8,6 +13,7 @@ * gwm.c (start_managing_window): Initialise icons. (unmanage_window): Deallocate icons. (setup_display): Add _NET_WM_ICON property. + * managed.c (handle_managed_get_property, async_get_property): Use the window resource ID instead of a pointer to identify the window, to detect if it disappears asynchronously. @@ -82,20 +82,19 @@ 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 *const atom_names[ NUM_ATOMS ] = { "COMPOUND_TEXT", "MANAGER", "_MOTIF_WM_HINTS", + "_NET_CURRENT_DESKTOP", + "_NET_DESKTOP_GEOMETRY", + "_NET_DESKTOP_VIEWPORT", + "_NET_NUMBER_OF_DESKTOPS", + "_NET_SUPPORTED", + "_NET_SUPPORTING_WM_CHECK", "_NET_WM_ICON", "_NET_WM_NAME", + "_NET_WORKAREA", "UTF8_STRING", "VERSION", "WM_CHANGE_STATE", @@ -1590,7 +1589,7 @@ static void setup_display( void ) { const xcb_setup_t *setup; xcb_screen_iterator_t iter; xcb_intern_atom_cookie_t *screen_atom_cookies; - uint32_t n; + uint32_t n, values[ 4 ]; xcb_get_selection_owner_cookie_t *screen_owner_cookies; xcb_window_t *screen_owners; xcb_client_message_event_t msg; @@ -1653,20 +1652,6 @@ static void setup_display( void ) { ; } - fake_window = add_window( xcb_generate_id( c ) ); - fake_window->screen = 0; - fake_window->type = WINDOW_FAKE; - - n = XCB_EVENT_MASK_PROPERTY_CHANGE; - xcb_create_window( c, 0, fake_window->w, screens[ 0 ]->root, 0, 0, 1, 1, 0, - XCB_WINDOW_CLASS_INPUT_ONLY, screens[ 0 ]->root_visual, - XCB_CW_EVENT_MASK, &n ); - - /* Obtain a timestamp we can use for our selection acquiry time - (ICCCM 2.0, section 2.1). */ - xcb_change_property( c, XCB_PROP_MODE_APPEND, fake_window->w, WM_HINTS, - WM_HINTS, 32, 0, NULL ); - xcb_flush( c ); /* BLOCK */ for( i = 0; i < NUM_EXTENSIONS; i++ ) { @@ -1715,6 +1700,21 @@ static void setup_display( void ) { free( r ); } + fake_window = add_window( xcb_generate_id( c ) ); + fake_window->screen = 0; + fake_window->type = WINDOW_FAKE; + + n = XCB_EVENT_MASK_PROPERTY_CHANGE; + xcb_create_window( c, 0, fake_window->w, screens[ 0 ]->root, 0, 0, 1, 1, 0, + XCB_WINDOW_CLASS_INPUT_ONLY, screens[ 0 ]->root_visual, + XCB_CW_EVENT_MASK, &n ); + + /* Obtain a timestamp we can use for our selection acquiry time + (ICCCM 2.0, section 2.1). */ + xcb_change_property( c, XCB_PROP_MODE_REPLACE, fake_window->w, + atoms[ ATOM__NET_WM_NAME ], atoms[ ATOM_UTF8_STRING ], + 8, strlen( PACKAGE_STRING ), PACKAGE_STRING ); + #if USE_RENDER if( have_extension[ EXT_RENDER ] && ( have_extension[ EXT_RENDER ] == !decorate_render_init() ) ) { @@ -1747,7 +1747,7 @@ static void setup_display( void ) { (xcb_property_notify_event_t *) ev; if( not->window != fake_window->w || - not->atom != WM_HINTS || + not->atom != atoms[ ATOM__NET_WM_NAME ] || not->state != XCB_PROPERTY_NEW_VALUE ) { warning( "unexpected property notification" ); @@ -1981,6 +1981,47 @@ static void setup_display( void ) { xcb_change_window_attributes_checked( c, screens[ i ]->root, XCB_CW_EVENT_MASK, &n ); + values[ 0 ] = 0; + xcb_change_property( c, XCB_PROP_MODE_REPLACE, screens[ i ]->root, + atoms[ ATOM__NET_CURRENT_DESKTOP ], CARDINAL, 32, + 1, values ); + + values[ 0 ] = screens[ i ]->width_in_pixels; + values[ 1 ] = screens[ i ]->height_in_pixels; + xcb_change_property( c, XCB_PROP_MODE_REPLACE, screens[ i ]->root, + atoms[ ATOM__NET_DESKTOP_GEOMETRY ], CARDINAL, 32, + 2, values ); + + values[ 0 ] = 0; + values[ 1 ] = 0; + xcb_change_property( c, XCB_PROP_MODE_REPLACE, screens[ i ]->root, + atoms[ ATOM__NET_DESKTOP_VIEWPORT ], CARDINAL, 32, + 2, values ); + + values[ 0 ] = 1; + xcb_change_property( c, XCB_PROP_MODE_REPLACE, screens[ i ]->root, + atoms[ ATOM__NET_NUMBER_OF_DESKTOPS ], CARDINAL, + 32, 1, values ); + + values[ 0 ] = atoms[ ATOM__NET_WM_ICON ]; + values[ 1 ] = atoms[ ATOM__NET_WM_NAME ]; + xcb_change_property( c, XCB_PROP_MODE_REPLACE, screens[ i ]->root, + atoms[ ATOM__NET_SUPPORTED ], CARDINAL, 32, + w, values ); + + values[ 0 ] = fake_window->w; + xcb_change_property( c, XCB_PROP_MODE_REPLACE, screens[ i ]->root, + atoms[ ATOM__NET_SUPPORTING_WM_CHECK ], WINDOW, + 32, 1, values ); + + values[ 0 ] = 0; + values[ 1 ] = 0; + values[ 2 ] = screens[ i ]->width_in_pixels; + values[ 3 ] = screens[ i ]->height_in_pixels; + xcb_change_property( c, XCB_PROP_MODE_REPLACE, screens[ i ]->root, + atoms[ ATOM__NET_WORKAREA ], CARDINAL, 32, + 4, values ); + tree_cookies[ i ] = xcb_query_tree( c, screens[ i ]->root ); } @@ -68,8 +68,15 @@ enum gwm_atom { ATOM_COMPOUND_TEXT, ATOM_MANAGER, ATOM__MOTIF_WM_HINTS, + ATOM__NET_CURRENT_DESKTOP, + ATOM__NET_DESKTOP_GEOMETRY, + ATOM__NET_DESKTOP_VIEWPORT, + ATOM__NET_NUMBER_OF_DESKTOPS, + ATOM__NET_SUPPORTED, + ATOM__NET_SUPPORTING_WM_CHECK, ATOM__NET_WM_ICON, ATOM__NET_WM_NAME, + ATOM__NET_WORKAREA, ATOM_UTF8_STRING, ATOM_VERSION, ATOM_WM_CHANGE_STATE, |