X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=0ff67ac51fc2c970f64c29280378dbca3d3f0b1d;hb=d2f7ad9a2480c2810dee5def13cbdee36bd71e5e;hp=08d316c49d67da9448ccc4e10105b33b57b1470a;hpb=3a91527fdfdb6e48eee933357edc13177bd6ce17;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 08d316c4..0ff67ac5 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -49,7 +49,8 @@ #include /*! The event mask to grab on client windows */ -#define CLIENT_EVENTMASK (PropertyChangeMask | StructureNotifyMask) +#define CLIENT_EVENTMASK (PropertyChangeMask | StructureNotifyMask | \ + ColormapChangeMask) #define CLIENT_NOPROPAGATEMASK (ButtonPressMask | ButtonReleaseMask | \ ButtonMotionMask) @@ -75,6 +76,7 @@ static void client_get_shaped(ObClient *self); static void client_get_mwm_hints(ObClient *self); static void client_get_gravity(ObClient *self); static void client_get_client_machine(ObClient *self); +static void client_get_colormap(ObClient *self); static void client_change_allowed_actions(ObClient *self); static void client_change_state(ObClient *self); static void client_change_wm_state(ObClient *self); @@ -533,6 +535,9 @@ void client_unmanage(ObClient *self) /* update the focus lists */ focus_order_remove(self); + /* don't leave an invalid focus_client */ + if (self == focus_client) + focus_client = NULL; client_list = g_list_remove(client_list, self); stacking_remove(self); @@ -678,7 +683,7 @@ static ObAppSettings *client_get_settings_state(ObClient *self) if (settings->max_vert != -1) self->max_vert = !!settings->max_vert; if (settings->max_horz != -1) - self->max_vert = !!settings->max_horz; + self->max_horz = !!settings->max_horz; if (settings->fullscreen != -1) self->fullscreen = !!settings->fullscreen; @@ -938,7 +943,11 @@ static void client_get_all(ObClient *self) (min/max sizes), so we're ready to set up the decorations/functions */ client_setup_decor_and_functions(self); +#ifdef SYNC + client_update_sync_request_counter(self); +#endif client_get_client_machine(self); + client_get_colormap(self); client_update_title(self); client_update_class(self); client_update_sm_client_id(self); @@ -1010,10 +1019,6 @@ static void client_get_desktop(ObClient *self) self->desktop = screen_desktop; } } - if (self->desktop != d) { - /* set the desktop hint, to make sure that it always exists */ - PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop); - } } static void client_get_layer(ObClient *self) @@ -1288,18 +1293,37 @@ void client_update_protocols(ObClient *self) if (PROP_GETA32(self->window, wm_protocols, atom, &proto, &num_return)) { for (i = 0; i < num_return; ++i) { - if (proto[i] == prop_atoms.wm_delete_window) { + if (proto[i] == prop_atoms.wm_delete_window) /* this means we can request the window to close */ self->delete_window = TRUE; - } else if (proto[i] == prop_atoms.wm_take_focus) + else if (proto[i] == prop_atoms.wm_take_focus) /* if this protocol is requested, then the window will be notified whenever we want it to receive focus */ self->focus_notify = TRUE; +#ifdef SYNC + else if (proto[i] == prop_atoms.net_wm_sync_request) + /* if this protocol is requested, then resizing the + window will be synchronized between the frame and the + client */ + self->sync_request = TRUE; +#endif } g_free(proto); } } +#ifdef SYNC +void client_update_sync_request_counter(ObClient *self) +{ + guint32 i; + + if (PROP_GET32(self->window, net_wm_sync_request_counter, cardinal, &i)) { + self->sync_counter = i; + } else + self->sync_counter = None; +} +#endif + static void client_get_gravity(ObClient *self) { XWindowAttributes wattrib; @@ -1310,6 +1334,19 @@ static void client_get_gravity(ObClient *self) self->gravity = wattrib.win_gravity; } +void client_get_colormap(ObClient *self) +{ + XWindowAttributes wa; + + if (XGetWindowAttributes(ob_display, self->window, &wa)) + client_update_colormap(self, wa.colormap); +} + +void client_update_colormap(ObClient *self, Colormap colormap) +{ + self->colormap = colormap; +} + void client_update_normal_hints(ObClient *self) { XSizeHints size; @@ -2132,6 +2169,9 @@ static void client_apply_startup_state(ObClient *self, gint x, gint y) self->area.x = x; self->area.y = y; + /* set the desktop hint, to make sure that it always exists */ + PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop); + /* these are in a carefully crafted order.. */ if (self->iconic) { @@ -3081,10 +3121,11 @@ void client_activate(ObClient *self, gboolean here, gboolean user) to activate it or not (a parent or group member is currently active)? */ - ob_debug("Want to activate window 0x%x with time %u (last time %u), " - "source=%s\n", - self->window, event_curtime, last_time, - (user ? "user" : "application")); + ob_debug_type(OB_DEBUG_FOCUS, + "Want to activate window 0x%x with time %u (last time %u), " + "source=%s\n", + self->window, event_curtime, last_time, + (user ? "user" : "application")); if (!user && event_curtime && last_time && !event_time_after(event_curtime, last_time))