all repos — openbox @ 64adc0eeba598cb1469b2140777fba30e3053f0e

openbox fork - make it a bit more like ryudo

add a function client_is_oldfullscreen() that determines if a window is an "oldschool fullscreen window" or not.  use this throughout.  and allow oldschool fullscreen windows to move to 0,0 even with a strut there.
Dana Jansens danakj@orodu.net
commit

64adc0eeba598cb1469b2140777fba30e3053f0e

parent

28df6162a9fbca4544e8f384d3fdae70870f531a

5 files changed, 42 insertions(+), 38 deletions(-)

jump to
M openbox/client.copenbox/client.c

@@ -203,7 +203,6 @@ gboolean activate = FALSE;

ObAppSettings *settings; gboolean transient = FALSE; Rect place; - Rect const *monitor, *allmonitors; Time launch_time, map_time; guint32 user_time; gboolean obplaced;

@@ -312,8 +311,6 @@ frame_adjust_client_area(self->frame);

/* where the frame was placed is where the window was originally */ place = self->area; - monitor = screen_physical_area_monitor(screen_find_monitor(&place)); - allmonitors = screen_physical_area_all_monitors(); /* figure out placement for the window if the window is new */ if (ob_state() == OB_STATE_RUNNING) {

@@ -339,8 +336,7 @@ /* watch for buggy apps that ask to be placed at (0,0) when there is

a strut there */ if (!obplaced && place.x == 0 && place.y == 0 && /* oldschool fullscreen windows are allowed */ - !(self->decorations == 0 && (RECT_EQUAL(place, *monitor) || - RECT_EQUAL(place, *allmonitors)))) + !client_is_oldfullscreen(self, &place)) { Rect *r;

@@ -382,9 +378,7 @@ /* don't move oldschool fullscreen windows to

fit inside the struts (fixes Acroread, which makes its fullscreen window fit the screen but it is not USSize'd or USPosition'd) */ - !(self->decorations == 0 && - (RECT_EQUAL(place, *monitor) || - RECT_EQUAL(place, *allmonitors)))))); + !client_is_oldfullscreen(self, &place)))); } /* if the window isn't user-sized, then make it fit inside

@@ -404,8 +398,7 @@ !self->session &&

/* don't shrink oldschool fullscreen windows to fit inside the struts (fixes Acroread, which makes its fullscreen window fit the screen but it is not USSize'd or USPosition'd) */ - !(self->decorations == 0 && (RECT_EQUAL(place, *monitor) || - RECT_EQUAL(place, *allmonitors)))))) + !client_is_oldfullscreen(self, &place)))) { Rect *a = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR, &place);

@@ -442,9 +435,6 @@ this also places the window

*/ client_apply_startup_state(self, place.x, place.y, place.width, place.height); - - monitor = NULL; - allmonitors = NULL; ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s", activate ? "yes" : "no");

@@ -2475,6 +2465,24 @@ {

return self->parents != NULL; } +gboolean client_is_oldfullscreen(const ObClient const *self, + const Rect const *area) +{ + Rect const *monitor, *allmonitors; + + /* No decorations and fills the monitor = oldskool fullscreen. + But not for maximized windows. + */ + + if (self->decorations || self->max_horz || self->max_vert) return FALSE; + + monitor = screen_physical_area_monitor(screen_find_monitor(area)); + allmonitors = screen_physical_area_all_monitors(); + + return (RECT_EQUAL(*area, *monitor) || + RECT_EQUAL(*area, *allmonitors)); +} + static ObStackingLayer calc_layer(ObClient *self) { ObStackingLayer l;

@@ -2490,13 +2498,7 @@ if (self->below) l = OB_STACKING_LAYER_NORMAL;

else l = OB_STACKING_LAYER_ABOVE; } else if ((self->fullscreen || - /* No decorations and fills the monitor = oldskool fullscreen. - But not for maximized windows. - */ - (self->decorations == 0 && - !(self->max_horz && self->max_vert) && - (RECT_EQUAL(self->area, *monitor) || - RECT_EQUAL(self->area, *allmonitors)))) && + client_is_oldfullscreen(self, &self->area)) && /* you are fullscreen while you or your children are focused.. */ (client_focused(self) || client_search_focus_tree(self) || /* you can be fullscreen if you're on another desktop */

@@ -2990,8 +2992,7 @@

void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gboolean user, gboolean final, gboolean force_reply) { - Rect oldframe; - gint oldw, oldh; + Rect oldframe, oldclient; gboolean send_resize_client; gboolean moved = FALSE, resized = FALSE, rootmoved = FALSE; gboolean fmoved, fresized;

@@ -3011,9 +3012,8 @@ /* figure out if we moved or resized or what */

moved = (x != self->area.x || y != self->area.y); resized = (w != self->area.width || h != self->area.height); - oldw = self->area.width; - oldh = self->area.height; oldframe = self->frame->area; + oldclient = self->area; RECT_SET(self->area, x, y, w, h); /* for app-requested resizes, always resize if 'resized' is true.

@@ -3024,10 +3024,10 @@ (user && (final ||

(resized && config_resize_redraw)))); /* if the client is enlarging, then resize the client before the frame */ - if (send_resize_client && (w > oldw || h > oldh)) { + if (send_resize_client && (w > oldclient.width || h > oldclient.height)) { XMoveResizeWindow(obt_display, self->window, self->frame->size.left, self->frame->size.top, - MAX(w, oldw), MAX(h, oldh)); + MAX(w, oldclient.width), MAX(h, oldclient.height)); frame_adjust_client_area(self->frame); }

@@ -3115,7 +3115,8 @@

both of these resize sections may run, because the top one only resizes in the direction that is growing */ - if (send_resize_client && (w <= oldw || h <= oldh)) { + if (send_resize_client && (w <= oldclient.width || h <= oldclient.height)) + { frame_adjust_client_area(self->frame); XMoveResizeWindow(obt_display, self->window, self->frame->size.left, self->frame->size.top, w, h);

@@ -3124,9 +3125,13 @@

XFlush(obt_display); /* if it moved between monitors, then this can affect the stacking - layer of this window or others - for fullscreen windows */ + layer of this window or others - for fullscreen windows. + also if it changed to/from oldschool fullscreen then its layer may + change */ if (screen_find_monitor(&self->frame->area) != - screen_find_monitor(&oldframe)) + screen_find_monitor(&oldframe) || + (final && (client_is_oldfullscreen(self, &oldclient) != + client_is_oldfullscreen(self, &self->area)))) { client_calc_layer(self); }
M openbox/client.hopenbox/client.h

@@ -490,6 +490,11 @@ be returned to normal state.

*/ void client_fullscreen(ObClient *self, gboolean fs); +/*! Determine if the window, using the given client-area, would be considered + as an "oldschool fullscreen" window, that is, if it is filling a whole + monitor. */ +gboolean client_is_oldfullscreen(const ObClient const *self, const Rect *area); + /*! Iconifies or uniconifies the client window @param iconic true if the window should be iconified; false if it should be restored.
M openbox/event.copenbox/event.c

@@ -1256,15 +1256,9 @@ */

g_print("x %d y %d grav %d %d\n", x, y, client->gravity, NorthWestGravity); if (x == 0 && y == 0 && client->gravity == NorthWestGravity) { const Rect to = { x, y, w, h }; - Rect const *monitor, *allmonitors; - monitor = screen_physical_area_monitor(client_monitor(client)); - allmonitors = screen_physical_area_all_monitors(); /* oldschool fullscreen windows are allowed */ - if (!(client->decorations == 0 && - (RECT_EQUAL(to, *monitor) || - RECT_EQUAL(to, *allmonitors)))) - { + if (!client_is_oldfullscreen(client, &to)) { Rect *r; r = screen_area(client->desktop, SCREEN_AREA_ALL_MONITORS,
M openbox/screen.copenbox/screen.c

@@ -1617,7 +1617,7 @@ a->height = b - t + 1;

return a; } -guint screen_find_monitor(Rect *search) +guint screen_find_monitor(const Rect const *search) { guint i; guint most = screen_num_monitors;
M openbox/screen.hopenbox/screen.h

@@ -148,7 +148,7 @@ /*! Determines which physical monitor a rectangle is on by calculating the

area of the part of the rectable on each monitor. The number of the monitor containing the greatest area of the rectangle is returned. */ -guint screen_find_monitor(Rect *search); +guint screen_find_monitor(const Rect const *search); /*! Finds the monitor which contains the point @x, @y */ guint screen_find_monitor_point(guint x, guint y);