summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-23 01:15:07 +0000
committerDana Jansens <danakj@orodu.net>2007-05-23 01:15:07 +0000
commit6fb3e62a31ad0312383bae1a0e9c28ace041da4c (patch)
treeb6ed1942a40abb1d5506ee3bd8f203062b8210eb
parent89c7b236b580a78ea529c4c65bc5944c0a52bdf5 (diff)
when a window is being kept on screen (espcially from mapping more or less) and the position didnt come from the user (USPosition) then force the top left corner of the app on screen so it doesnt hide behind panels or whatever and you cant get at the titlebar
-rw-r--r--openbox/client.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/openbox/client.c b/openbox/client.c
index b35f9e3f..3fac34f7 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -962,16 +962,13 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h,
* xterm -geometry resolution-width/2 will work fine. Trying to
* place it completely offscreen will be handled in the above code.
* Sorry for this confused comment, i am tired. */
- if (fw <= mon_a->width) {
- if (rudel && !self->strut.left && *x < mon_a->x) *x = mon_a->x;
- if (ruder && !self->strut.right && *x + fw > mon_a->x + mon_a->width)
- *x = mon_a->x + mon_a->width - fw;
- }
- if (fh <= mon_a->height) {
- if (rudet && !self->strut.top && *y < mon_a->y) *y = mon_a->y;
- if (rudeb && !self->strut.bottom && *y + fh > mon_a->y + mon_a->height)
- *y = mon_a->y + mon_a->height - fh;
- }
+ if (rudel && !self->strut.left && *x < mon_a->x) *x = mon_a->x;
+ if (ruder && !self->strut.right && *x + fw > mon_a->x + mon_a->width)
+ *x = mon_a->x + MAX(0, mon_a->width - fw);
+
+ if (rudet && !self->strut.top && *y < mon_a->y) *y = mon_a->y;
+ if (rudeb && !self->strut.bottom && *y + fh > mon_a->y + mon_a->height)
+ *y = mon_a->y + MAX(0, mon_a->height - fh);
/* get where the client should be */
frame_frame_gravity(self->frame, x, y, w, h);