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);
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 :
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));
}
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 ||
/* 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 :
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) {
} 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) {
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 */
}
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)