summaryrefslogtreecommitdiff
path: root/gwm.c
diff options
context:
space:
mode:
authorGary Wong <gtw@gnu.org>2009-08-31 15:26:01 -0600
committerGary Wong <gtw@gnu.org>2009-08-31 15:26:01 -0600
commit69b03632ad36228490e30e79852f8b922fb22c74 (patch)
treeaf4e2529c470e812db3a0f3be86a0a8703fb9a1e /gwm.c
parent49b9141e117ff21451619399cee6b18d653c619c (diff)
Make frame decorations optional (selected by _MOTIF_WM_HINTS property).
Diffstat (limited to 'gwm.c')
-rw-r--r--gwm.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/gwm.c b/gwm.c
index 4d9cbf0..2a3585b 100644
--- a/gwm.c
+++ b/gwm.c
@@ -89,6 +89,7 @@ xcb_atom_t atoms[ NUM_ATOMS ];
static const char *atom_names[ NUM_ATOMS ] = {
"COMPOUND_TEXT",
"MANAGER",
+ "_MOTIF_WM_HINTS",
"_NET_WM_NAME",
"UTF8_STRING",
"VERSION",
@@ -137,7 +138,7 @@ xcb_render_directformat_t dfmt_rgba8, dfmt_a8;
xcb_cursor_t cursors[ NUM_CURSORS ];
-struct gwm_window *fake_window, *focus_frame;
+struct gwm_window *fake_window;
const char *argv0;
static int flag_replace, flag_force;
@@ -1063,14 +1064,19 @@ static void start_managing_window( struct gwm_window *window,
window->u.managed.name = NULL;
window->u.managed.net_wm_name = 0;
window->u.managed.state = STATE_WITHDRAWN;
+#if USE_SHAPE
+ window->u.managed.shaped = have_extension[ EXT_SHAPE ] && shape &&
+ shape->bounding_shaped;
+#endif
frame->screen = window->screen;
frame->type = WINDOW_FRAME;
frame->u.frame.child = window;
frame->u.frame.button = button;
+ frame->u.frame.decoration = DEC_DEFAULT;
button->screen = window->screen;
button->type = WINDOW_BUTTON;
button->u.button.frame = frame;
-
+
for( i = 0; i < NUM_PROPS; i++ )
managed_property_change( window, i, props[ i ] );
@@ -1121,8 +1127,9 @@ static void start_managing_window( struct gwm_window *window,
xcb_create_window( c, XCB_COPY_FROM_PARENT, frame->w, geom->root,
frame->u.frame.x, frame->u.frame.y,
- frame->u.frame.width, frame->u.frame.height, 1,
- XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT,
+ frame->u.frame.width, frame->u.frame.height,
+ frame_xb( frame ), XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ XCB_COPY_FROM_PARENT,
XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL |
XCB_CW_BIT_GRAVITY | XCB_CW_OVERRIDE_REDIRECT |
XCB_CW_EVENT_MASK, values );
@@ -1145,8 +1152,9 @@ static void start_managing_window( struct gwm_window *window,
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_NONE,
XCB_NONE, XCB_BUTTON_INDEX_ANY, 0x8000 );
-
- xcb_map_window( c, button->w );
+
+ if( frame->u.frame.decoration & DEC_TITLE )
+ xcb_map_window( c, button->w );
xcb_change_save_set( c, XCB_SET_MODE_INSERT, w );
@@ -1163,6 +1171,7 @@ static void start_managing_window( struct gwm_window *window,
xcb_reparent_window( c, w, frame->w, frame_l( frame, FALSE ),
frame_t( frame, FALSE ) );
+
if( !map_request ) {
values[ 0 ] = XCB_EVENT_MASK_STRUCTURE_NOTIFY |
XCB_EVENT_MASK_PROPERTY_CHANGE |
@@ -1178,8 +1187,8 @@ static void start_managing_window( struct gwm_window *window,
}
#if USE_SHAPE
- if( have_extension[ EXT_SHAPE ] && shape && shape->bounding_shaped )
- match_managed_shape( window, TRUE );
+ if( window->u.managed.shaped )
+ match_managed_shape( window );
#endif
/* Tell the client we've relocated their window with respect to the
@@ -1415,20 +1424,6 @@ extern void iconic_to_normal( struct gwm_window *window ) {
xcb_map_window( c, window->u.managed.frame->w );
}
-extern void deactivate_focus_frame( void ) {
-
- uint32_t n;
-
- if( !focus_frame )
- return;
-
- n = gwm_screens[ focus_frame->screen ].pixels[ COL_FRAME_INACTIVE ];
- xcb_change_window_attributes( c, focus_frame->w, XCB_CW_BACK_PIXEL, &n );
-
- queue_window_update( focus_frame, 0, 0, focus_frame->u.frame.width,
- focus_frame->u.frame.height, FALSE );
-}
-
extern void generic_expose( struct gwm_window *window,
xcb_expose_event_t *ev ) {
@@ -1683,11 +1678,8 @@ 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. */
+ /* FIXME Also monitor _NET_WM_ICON and set _NET_FRAME_EXTENTS. */
+ prop_atoms[ PROP__MOTIF_WM_HINTS ] = atoms[ ATOM__MOTIF_WM_HINTS ];
prop_atoms[ PROP__NET_WM_NAME ] = atoms[ ATOM__NET_WM_NAME ];
prop_atoms[ PROP_WM_COLORMAP_WINDOWS ] = atoms[ ATOM_WM_COLORMAP_WINDOWS ];
prop_atoms[ PROP_WM_HINTS ] = WM_HINTS;
@@ -1695,6 +1687,7 @@ static void setup_display( void ) {
prop_atoms[ PROP_WM_NORMAL_HINTS ] = WM_NORMAL_HINTS;
prop_atoms[ PROP_WM_PROTOCOLS ] = atoms[ ATOM_WM_PROTOCOLS ];
+ prop_types[ PROP__MOTIF_WM_HINTS ] = atoms[ ATOM__MOTIF_WM_HINTS ];
prop_types[ PROP__NET_WM_NAME ] = atoms[ ATOM_UTF8_STRING ];
prop_types[ PROP_WM_COLORMAP_WINDOWS ] = WINDOW;
prop_types[ PROP_WM_HINTS ] = WM_HINTS;