X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=4b65b0d02a439b78f52fe509d43588c592823c04;hb=580795fe6a4b5d070f01065b309f1789cf0d0dbb;hp=cf447a88afbec615d6bb0ffec51959c68073b183;hpb=a5bd2babc813d990df494832feef55c7b0f17195;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index cf447a88..4b65b0d0 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -3,7 +3,6 @@ #include "prop.h" #include "extensions.h" #include "frame.h" -#include "engine.h" #include "event.h" #include "grab.h" #include "focus.h" @@ -206,9 +205,9 @@ void client_manage(Window window) XChangeSaveSet(ob_display, window, SetModeInsert); /* create the decoration frame for the client window */ - self->frame = engine_frame_new(); + self->frame = frame_new(); - engine_frame_grab_client(self->frame, self); + frame_grab_client(self->frame, self); client_apply_startup_state(self); @@ -239,7 +238,7 @@ void client_manage(Window window) dispatch_client(Event_Client_Mapped, self, 0, 0); /* focus the new window? */ - if (ob_state != State_Starting) { + if (ob_state != State_Starting && client_normal(self)) { if (config_focus_new) client_focus(self); else if (self->transient_for) { @@ -290,7 +289,7 @@ void client_unmanage(Client *self) /* we dont want events no more */ XSelectInput(ob_display, self->window, NoEventMask); - engine_frame_hide(self->frame); + frame_hide(self->frame); client_list = g_list_remove(client_list, self); stacking_list = g_list_remove(stacking_list, self); @@ -347,7 +346,7 @@ void client_unmanage(Client *self) client_toggle_border(self, TRUE); /* reparent the window out of the frame, and free the frame */ - engine_frame_release_client(self->frame, self); + frame_release_client(self->frame, self); self->frame = NULL; if (ob_state != State_Exiting) { @@ -846,14 +845,14 @@ void client_setup_decor_and_functions(Client *self) break; case Type_Dialog: - /* dialogs cannot be maximized */ + case Type_Utility: + /* these windows cannot be maximized */ self->decorations &= ~Decor_Maximize; self->functions &= ~Func_Maximize; break; case Type_Menu: case Type_Toolbar: - case Type_Utility: /* these windows get less functionality */ self->decorations &= ~(Decor_Iconify | Decor_Handle); self->functions &= ~(Func_Iconify | Func_Resize); @@ -928,12 +927,18 @@ void client_setup_decor_and_functions(Client *self) if (!(self->decorations & Decor_Titlebar)) self->functions &= ~Func_Shade; + /* now we need to check against rules for the client's current state */ + if (self->fullscreen) { + self->functions &= (Func_Close | Func_Fullscreen | Func_Iconify); + self->decorations = 0; + } + client_change_allowed_actions(self); if (self->frame) { /* change the decors on the frame, and with more/less decorations, we may also need to be repositioned */ - engine_frame_adjust_area(self->frame, TRUE, TRUE); + frame_adjust_area(self->frame, TRUE, TRUE); /* with new decor, the window's maximized size may change */ client_remaximize(self); } @@ -1051,7 +1056,7 @@ void client_update_wmhints(Client *self) self->pixmap_icon_mask = None; if (self->frame) - engine_frame_adjust_icon(self->frame); + frame_adjust_icon(self->frame); } } @@ -1100,7 +1105,7 @@ void client_update_title(Client *self) self->title = data; if (self->frame) - engine_frame_adjust_title(self->frame); + frame_adjust_title(self->frame); } void client_update_icon_title(Client *self) @@ -1224,7 +1229,7 @@ void client_update_icons(Client *self) } if (self->frame) - engine_frame_adjust_icon(self->frame); + frame_adjust_icon(self->frame); } void client_update_kwm_icon(Client *self) @@ -1239,7 +1244,7 @@ void client_update_kwm_icon(Client *self) self->pixmap_icon = self->pixmap_icon_mask = None; } if (self->frame) - engine_frame_adjust_icon(self->frame); + frame_adjust_icon(self->frame); } static void client_change_state(Client *self) @@ -1278,7 +1283,7 @@ static void client_change_state(Client *self) client_calc_layer(self); if (self->frame) - engine_frame_adjust_state(self->frame); + frame_adjust_state(self->frame); } static Client *search_focus_tree(Client *node, Client *skip) @@ -1298,27 +1303,10 @@ static Client *search_focus_tree(Client *node, Client *skip) void client_calc_layer(Client *self) { StackLayer l; - gboolean fs; - Client *c; - - /* are we fullscreen, or do we have a fullscreen transient parent? */ - c = self; - fs = FALSE; - while (c && c != TRAN_GROUP) { /* XXX do smthng with the TRAN_GROUP case?*/ - if (c->fullscreen) { - fs = TRUE; - break; - } - c = c->transient_for; - } - if (!fs && self->fullscreen) { - /* is one of our transients focused? */ - c = search_focus_tree(self, self); - if (c != NULL) fs = TRUE; - } - + if (self->iconic) l = Layer_Icon; - else if (fs) l = Layer_Fullscreen; + /* fullscreen windows are only in the fullscreen layer while focused */ + else if (self->fullscreen && focus_client == self) l = Layer_Fullscreen; else if (self->type == Type_Desktop) l = Layer_Desktop; else if (self->type == Type_Dock) { if (!self->below) l = Layer_Top; @@ -1349,9 +1337,9 @@ static void client_showhide(Client *self) { if (client_should_show(self)) - engine_frame_show(self->frame); + frame_show(self->frame); else - engine_frame_hide(self->frame); + frame_hide(self->frame); } gboolean client_normal(Client *self) { @@ -1414,6 +1402,7 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h, y = 0; w = screen_physical_size.width; h = screen_physical_size.height; + user = FALSE; /* ignore that increment etc shit when in fullscreen */ } else { /* set the size and position if maximized */ if (self->max_horz) { @@ -1524,7 +1513,7 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h, /* move/resize the frame to match the request */ if (self->frame) { if (moved || resized) - engine_frame_adjust_area(self->frame, moved, resized); + frame_adjust_area(self->frame, moved, resized); if (!user || final) { XEvent event; @@ -1561,13 +1550,6 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea) client_change_state(self); /* change the state hints on the client */ if (fs) { - /* save the functions and remove them */ - self->pre_fs_func = self->functions; - self->functions &= (Func_Close | Func_Fullscreen | - Func_Iconify); - /* save the decorations and remove them */ - self->pre_fs_decor = self->decorations; - self->decorations = 0; if (savearea) { long dimensions[4]; dimensions[0] = self->area.x; @@ -1585,9 +1567,6 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea) } else { long *dimensions; - self->functions = self->pre_fs_func; - self->decorations = self->pre_fs_decor; - if (PROP_GET32A(self->window, openbox_premax, cardinal, dimensions, 4)) { x = dimensions[0]; @@ -1606,11 +1585,9 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea) } } - client_change_allowed_actions(self); /* based on the new _functions */ + client_setup_decor_and_functions(self); - /* when fullscreening, don't obey things like increments, fill the - screen */ - client_configure(self, Corner_TopLeft, x, y, w, h, !fs, TRUE); + client_configure(self, Corner_TopLeft, x, y, w, h, TRUE, TRUE); /* raise (back) into our stacking layer */ stacking_raise(self); @@ -1621,6 +1598,8 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea) void client_iconify(Client *self, gboolean iconic, gboolean curdesk) { + GSList *it; + /* move up the transient chain as far as possible first if deiconifying */ if (!iconic) while (self->transient_for) { @@ -1638,8 +1617,7 @@ void client_iconify(Client *self, gboolean iconic, gboolean curdesk) Client *c = it->data; if (c != self && c->transient_for->iconic != iconic && - (c->transient_for != TRAN_GROUP || - c->group != self->group)) { + c->transient_for != TRAN_GROUP) { self = it->data; break; } @@ -1675,12 +1653,8 @@ void client_iconify(Client *self, gboolean iconic, gboolean curdesk) self, 0, 0); /* iconify all transients */ - if (self->transients) { - GSList *it; - - for (it = self->transients; it != NULL; it = it->next) - if (it->data != self) client_iconify(it->data, iconic, curdesk); - } + for (it = self->transients; it != NULL; it = it->next) + if (it->data != self) client_iconify(it->data, iconic, curdesk); } void client_maximize(Client *self, gboolean max, int dir, gboolean savearea) @@ -1790,7 +1764,7 @@ void client_shade(Client *self, gboolean shade) self->shaded = shade; client_change_state(self); /* resize the frame to just the titlebar */ - engine_frame_adjust_area(self->frame, FALSE, FALSE); + frame_adjust_area(self->frame, FALSE, FALSE); } void client_close(Client *self) @@ -1839,7 +1813,7 @@ void client_set_desktop(Client *self, guint target, gboolean donthide) self->desktop = target; PROP_SET32(self->window, net_wm_desktop, cardinal, target); /* the frame can display the current desktop state */ - engine_frame_adjust_state(self->frame); + frame_adjust_state(self->frame); /* 'move' the window to the new desktop */ if (!donthide) client_showhide(self); @@ -2125,7 +2099,9 @@ gboolean client_focus(Client *self) void client_unfocus(Client *self) { g_assert(focus_client == self); +#ifndef DEBUG_FOCUS g_message("client_unfocus"); +#endif focus_fallback(Fallback_Unfocusing); }