X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=fab5328d2b712a40fd85354974d5f40db920c5e8;hb=055aa5cd7411c4563956e376523219afc6198ce1;hp=cc438b0f26f6ee81ae6f5da8530dba3570032d74;hpb=c8678108eb876bbe78649569dabb3b3ee5e595aa;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index cc438b0f..fab5328d 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -346,7 +346,11 @@ void client_manage(Window window) client_find_onscreen(self, &x, &y, self->frame->area.width, self->frame->area.height, - client_normal(self)); + /* non-normal clients has less rules, and + windows that are being restored from a session + do also. we can assume you want it back where + you saved it */ + client_normal(self) && !self->session); if (x != ox || y != oy) client_move(self, x, y); @@ -533,12 +537,14 @@ static void client_restore_session_state(ObClient *self) self->session = it->data; - RECT_SET(self->area, self->session->x, self->session->y, - self->session->w, self->session->h); + RECT_SET_POINT(self->area, self->session->x, self->session->y); self->positioned = TRUE; - if (self->session->w > 0 && self->session->h > 0) - XResizeWindow(ob_display, self->window, - self->session->w, self->session->h); + if (self->session->w > 0) + self->area.width = self->session->w; + if (self->session->h > 0) + self->area.height = self->session->h; + XResizeWindow(ob_display, self->window, + self->area.width, self->area.height); self->desktop = (self->session->desktop == DESKTOP_ALL ? self->session->desktop : @@ -1737,7 +1743,6 @@ static void client_calc_layer_recursive(ObClient *self, ObClient *orig, if (!raised && l != old) if (orig->frame) { /* only restack if the original window is managed */ - /* XXX add_non_intrusive ever? */ stacking_remove(CLIENT_AS_WINDOW(self)); stacking_add(CLIENT_AS_WINDOW(self)); } @@ -2435,6 +2440,7 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2) gboolean undecorated = self->undecorated; gboolean max_horz = self->max_horz; gboolean max_vert = self->max_vert; + gboolean modal = self->modal; int i; if (!(action == prop_atoms.net_wm_state_add || @@ -2451,7 +2457,7 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2) /* if toggling, then pick whether we're adding or removing */ if (action == prop_atoms.net_wm_state_toggle) { if (state == prop_atoms.net_wm_state_modal) - action = self->modal ? prop_atoms.net_wm_state_remove : + action = modal ? prop_atoms.net_wm_state_remove : prop_atoms.net_wm_state_add; else if (state == prop_atoms.net_wm_state_maximized_vert) action = self->max_vert ? prop_atoms.net_wm_state_remove : @@ -2487,8 +2493,7 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2) if (action == prop_atoms.net_wm_state_add) { if (state == prop_atoms.net_wm_state_modal) { - /* XXX raise here or something? */ - self->modal = TRUE; + modal = TRUE; } else if (state == prop_atoms.net_wm_state_maximized_vert) { max_vert = TRUE; } else if (state == prop_atoms.net_wm_state_maximized_horz) { @@ -2511,7 +2516,7 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2) } else { /* action == prop_atoms.net_wm_state_remove */ if (state == prop_atoms.net_wm_state_modal) { - self->modal = FALSE; + modal = FALSE; } else if (state == prop_atoms.net_wm_state_maximized_vert) { max_vert = FALSE; } else if (state == prop_atoms.net_wm_state_maximized_horz) { @@ -2558,6 +2563,12 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2) client_shade(self, shaded); if (undecorated != self->undecorated) client_set_undecorated(self, undecorated); + if (modal != self->modal) { + self->modal = modal; + /* when a window changes modality, then its stacking order with its + transients needs to change */ + client_raise(self); + } client_calc_layer(self); client_change_state(self); /* change the hint to reflect these changes */ } @@ -2895,15 +2906,25 @@ void client_set_undecorated(ObClient *self, gboolean undecorated) guint client_monitor(ObClient *self) { guint i; + guint most = 0; + guint mostv = 0; for (i = 0; i < screen_num_monitors; ++i) { Rect *area = screen_physical_area_monitor(i); - if (RECT_INTERSECTS_RECT(*area, self->frame->area)) - break; + if (RECT_INTERSECTS_RECT(*area, self->frame->area)) { + Rect r; + guint v; + + RECT_SET_INTERSECTION(r, *area, self->frame->area); + v = r.width * r.height; + + if (v > mostv) { + mostv = v; + most = i; + } + } } - if (i == screen_num_monitors) i = 0; - g_assert(i < screen_num_monitors); - return i; + return most; } ObClient *client_search_top_transient(ObClient *self)