X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=a80159786b8ca9c9f957e2b04dd28e9cedf3ad54;hb=cc2237bb4f1ff3f32b58e8714f7ba72538df0d91;hp=146b0bf588b50f2e1f4d3b627012430492419884;hpb=cace930f8c66fd255aea4a10a3e67965c933ebb9;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 146b0bf5..a8015978 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -277,7 +277,7 @@ void client_manage(Window window) XFree(wmhint); } - ob_debug("Managing window: %lx\n", window); + ob_debug("Managing window: 0x%lx\n", window); /* choose the events we want to receive on the CLIENT window */ attrib_set.event_mask = CLIENT_EVENTMASK; @@ -427,8 +427,7 @@ void client_manage(Window window) it is up to the placement routines to avoid the xinerama divides) */ transient || - (((self->positioned & PPosition) && - !(self->positioned & USPosition)) && + (!(self->positioned & USPosition) && client_normal(self) && !self->session)); } @@ -442,7 +441,6 @@ void client_manage(Window window) /* do this after the window is placed, so the premax/prefullscreen numbers won't be all wacko!! - also, this moves the window to the position where it has been placed */ client_apply_startup_state(self); @@ -499,7 +497,7 @@ void client_manage(Window window) is ambiguous (either the current focus target doesn't have a timestamp, or they are the same (we probably inherited it from them) */ - else if (self->transient_for != NULL && + else if (client_has_parent(self) && (!last_time || self->user_time == last_time)) { activate = FALSE; @@ -1110,8 +1108,8 @@ static void client_get_area(ObClient *self) POINT_SET(self->root_pos, wattrib.x, wattrib.y); self->border_width = wattrib.border_width; - ob_debug("client area: %d %d %d %d\n", wattrib.x, wattrib.y, - wattrib.width, wattrib.height); + ob_debug("client area: %d %d %d %d bw %d\n", wattrib.x, wattrib.y, + wattrib.width, wattrib.height, wattrib.border_width); } static void client_get_desktop(ObClient *self) @@ -1123,13 +1121,16 @@ static void client_get_desktop(ObClient *self) self->desktop = screen_num_desktops - 1; else self->desktop = d; + ob_debug("client requested desktop 0x%x\n", self->desktop); } else { gboolean trdesk = FALSE; if (self->transient_for) { if (self->transient_for != OB_TRAN_GROUP) { - self->desktop = self->transient_for->desktop; - trdesk = TRUE; + if (self->transient_for->desktop != DESKTOP_ALL) { + self->desktop = self->transient_for->desktop; + trdesk = TRUE; + } } else { /* if all the group is on one desktop, then open it on the same desktop */ @@ -1535,7 +1536,16 @@ void client_get_colormap(ObClient *self) void client_update_colormap(ObClient *self, Colormap colormap) { - self->colormap = colormap; + if (colormap == self->colormap) return; + + ob_debug("Setting client %s colormap: 0x%x\n", self->title, colormap); + + if (client_focused(self)) { + screen_install_colormap(self, FALSE); /* uninstall old one */ + self->colormap = colormap; + screen_install_colormap(self, FALSE); /* install new one */ + } else + self->colormap = colormap; } void client_update_normal_hints(ObClient *self) @@ -2344,27 +2354,44 @@ ObClient *client_search_focus_tree_full(ObClient *self) return client_search_focus_tree_full(self->transient_for); } else { GSList *it; - gboolean recursed = FALSE; - for (it = self->group->members; it; it = g_slist_next(it)) - if (!((ObClient*)it->data)->transient_for) { - ObClient *c; - if ((c = client_search_focus_tree_full(it->data))) - return c; - recursed = TRUE; + for (it = self->group->members; it; it = g_slist_next(it)) { + if (it->data != self) { + ObClient *c = it->data; + + if (client_focused(c)) return c; + if ((c = client_search_focus_tree(it->data))) return c; } - if (recursed) - return NULL; + } } } - /* this function checks the whole tree, the client_search_focus_tree~ + /* this function checks the whole tree, the client_search_focus_tree does not, so we need to check this window */ if (client_focused(self)) return self; return client_search_focus_tree(self); } +gboolean client_has_parent(ObClient *self) +{ + if (self->transient_for) { + if (self->transient_for != OB_TRAN_GROUP) { + if (client_normal(self->transient_for)) + return TRUE; + } + else if (self->group) { + GSList *it; + + for (it = self->group->members; it; it = g_slist_next(it)) { + if (it->data != self && client_normal(it->data)) + return TRUE; + } + } + } + return FALSE; +} + static ObStackingLayer calc_layer(ObClient *self) { ObStackingLayer l; @@ -2872,7 +2899,7 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b, event.xconfigure.width = w; event.xconfigure.height = h; event.xconfigure.border_width = self->border_width; - event.xconfigure.above = self->frame->plate; + event.xconfigure.above = None; event.xconfigure.override_redirect = FALSE; XSendEvent(event.xconfigure.display, event.xconfigure.window, FALSE, StructureNotifyMask, &event); @@ -3452,6 +3479,10 @@ gboolean client_can_focus(ObClient *self) gboolean client_focus(ObClient *self) { + /* we might not focus this window, so if we have modal children which would + be focused instead, bring them to this desktop */ + client_bring_modal_windows(self); + /* choose the correct target */ self = client_focus_target(self); @@ -3464,8 +3495,8 @@ gboolean client_focus(ObClient *self) } ob_debug_type(OB_DEBUG_FOCUS, - "Focusing client \"%s\" at time %u\n", - self->title, event_curtime); + "Focusing client \"%s\" (0x%x) at time %u\n", + self->title, self->window, event_curtime); /* if there is a grab going on, then we need to cancel it. if we move focus during the grab, applications will get NotifyWhileGrabbed events @@ -3503,6 +3534,7 @@ gboolean client_focus(ObClient *self) xerror_set_ignore(FALSE); + ob_debug_type(OB_DEBUG_FOCUS, "Error focusing? %d\n", xerror_occured); return !xerror_occured; } @@ -3570,15 +3602,18 @@ void client_activate(ObClient *self, gboolean here, gboolean user) client_hilite(self, TRUE); } -static void client_bring_helper_windows_recursive(ObClient *self, - guint desktop) +static void client_bring_windows_recursive(ObClient *self, + guint desktop, + gboolean helpers, + gboolean modals) { GSList *it; for (it = self->transients; it; it = g_slist_next(it)) - client_bring_helper_windows_recursive(it->data, desktop); + client_bring_windows_recursive(it->data, desktop, helpers, modals); - if (client_helper(self) && + if (((helpers && client_helper(self)) || + (modals && self->modal))&& self->desktop != desktop && self->desktop != DESKTOP_ALL) { client_set_desktop(self, desktop, FALSE); @@ -3587,7 +3622,12 @@ static void client_bring_helper_windows_recursive(ObClient *self, void client_bring_helper_windows(ObClient *self) { - client_bring_helper_windows_recursive(self, self->desktop); + client_bring_windows_recursive(self, self->desktop, TRUE, FALSE); +} + +void client_bring_modal_windows(ObClient *self) +{ + client_bring_windows_recursive(self, self->desktop, FALSE, TRUE); } gboolean client_focused(ObClient *self)