X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=1df411e2090fae1c3a5303d2f1f1236b30ff0bac;hb=d447dc0f59619d26073699d9f81d7de77c200be4;hp=278ee38edf35491efa119aaed4844731eab298fa;hpb=92bea590c0eff5f56f70093dfa1edef2f65b113f;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 278ee38e..1df411e2 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -132,7 +132,6 @@ void client_manage_all() w = client_startup_stack_order[i-1]; c = g_hash_table_lookup(client_map, &w); - g_message("0x%lx %d %d", c->window, c->iconic, c->shaded); if (c) stacking_lower(c); } g_free(client_startup_stack_order); @@ -706,7 +705,7 @@ void client_update_normal_hints(Client *self) /* get the hints from the window */ if (XGetWMNormalHints(ob_display, self->window, &size, &ret)) { - self->positioned = (size.flags & (PPosition|USPosition)); + self->positioned = !!(size.flags & (PPosition|USPosition)); if (size.flags & PWinGravity) { self->gravity = size.win_gravity; @@ -747,7 +746,8 @@ void client_setup_decor_and_functions(Client *self) { /* start with everything (cept fullscreen) */ self->decorations = Decor_Titlebar | Decor_Handle | Decor_Border | - Decor_Icon | Decor_AllDesktops | Decor_Iconify | Decor_Maximize; + Decor_Icon | Decor_AllDesktops | Decor_Iconify | Decor_Maximize | + Decor_Shade; self->functions = Func_Resize | Func_Move | Func_Iconify | Func_Maximize | Func_Shade; if (self->delete_window) { @@ -842,6 +842,8 @@ void client_setup_decor_and_functions(Client *self) self->decorations &= ~Decor_Maximize; if (self->disabled_decorations & Decor_AllDesktops) self->decorations &= ~Decor_AllDesktops; + if (self->disabled_decorations & Decor_Shade) + self->decorations &= ~Decor_Shade; if (self->disabled_decorations & Decor_Close) self->decorations &= ~Decor_Close; @@ -1316,6 +1318,11 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h, { gboolean moved = FALSE, resized = FALSE; + /* gets the frame's position */ + frame_client_gravity(self->frame, &x, &y); + + /* these positions are frame positions, not client positions */ + /* set the size and position if fullscreen */ if (self->fullscreen) { x = 0; @@ -1335,6 +1342,9 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h, } } + /* gets the client's position */ + frame_frame_gravity(self->frame, &x, &y); + /* these override the above states! if you cant move you can't move! */ if (user) { if (!(self->functions & Func_Move)) { @@ -1605,13 +1615,6 @@ void client_maximize(Client *self, gboolean max, int dir, gboolean savearea) PROP_SET32A(self->window, openbox_premax, cardinal, dimensions, 4); } - - /* pass the client's current position info. the client_configure - will move/size stuff as appropriate for a maximized window */ - x = self->area.x; - y = self->area.y; - w = self->area.width; - h = self->area.height; } else { long *dimensions; @@ -1658,7 +1661,7 @@ void client_maximize(Client *self, gboolean max, int dir, gboolean savearea) void client_shade(Client *self, gboolean shade) { - if (!(self->functions & Func_Shade) || /* can't */ + if ((!(self->functions & Func_Shade) && shade) || /* can't shade */ self->shaded == shade) return; /* already done */ /* when we're iconic, don't change the wmstate */ @@ -1721,7 +1724,9 @@ void client_set_desktop(Client *self, guint target, gboolean donthide) /* 'move' the window to the new desktop */ if (!donthide) client_showhide(self); - stacking_raise(self); + /* raise if it was not already on the desktop */ + if (old != DESKTOP_ALL) + stacking_raise(self); screen_update_struts(); /* update the focus lists */ @@ -1730,19 +1735,20 @@ void client_set_desktop(Client *self, guint target, gboolean donthide) if (old == DESKTOP_ALL) { for (i = 0; i < screen_num_desktops; ++i) focus_order[i] = g_list_remove(focus_order[i], self); + } else + focus_order[old] = g_list_remove(focus_order[old], self); + if (target == DESKTOP_ALL) { + for (i = 0; i < screen_num_desktops; ++i) { + if (focus_new.bool) + focus_order[i] = g_list_prepend(focus_order[i], self); + else + focus_order[i] = g_list_append(focus_order[i], self); + } + } else { if (focus_new.bool) focus_order[target] = g_list_prepend(focus_order[target], self); else focus_order[target] = g_list_append(focus_order[target], self); - } else { - focus_order[old] = g_list_remove(focus_order[old], self); - if (target == DESKTOP_ALL) - for (i = 0; i < screen_num_desktops; ++i) { - if (focus_new.bool) - focus_order[i] = g_list_prepend(focus_order[i], self); - else - focus_order[i] = g_list_append(focus_order[i], self); - } } dispatch_client(Event_Client_Desktop, self, target, old); @@ -1955,9 +1961,10 @@ gboolean client_focus(Client *self) } if (self->can_focus) - /* RevertToNone is used so that windows dont get focused inadvertantly - by having the pointer in them, and then FocusIn events go missing */ - XSetInputFocus(ob_display, self->window, RevertToNone, + /* RevertToPointerRoot causes much more headache than TevertToNone, so + I choose to use it always, hopefully to find errors quicker, if any + are left. (I hate X. I hate focus events.) */ + XSetInputFocus(ob_display, self->window, RevertToPointerRoot, event_lasttime); if (self->focus_notify) {