summaryrefslogtreecommitdiff
path: root/openbox/client.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-24 20:29:30 +0000
committerDana Jansens <danakj@orodu.net>2007-05-24 20:29:30 +0000
commit081c7c0cfe2e9808433ba35f33172e8b633ba0fe (patch)
treec46d8d89a4279ae4100a69421f5c55572df5c57e /openbox/client.c
parent689157e8691330704f1071bc1e23238b56a0b565 (diff)
experimental change. when apps map, make them fit inside the struts and the screen and stuff, unless they are user-positioned
Diffstat (limited to 'openbox/client.c')
-rw-r--r--openbox/client.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/openbox/client.c b/openbox/client.c
index bcd51005..c8f26dcc 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -369,7 +369,7 @@ void client_manage(Window window)
placex = self->area.x;
placey = self->area.y;
- /* figure out placement for the window */
+ /* figure out placement for the window if the window is new */
if (ob_state() == OB_STATE_RUNNING) {
gboolean transient;
@@ -381,6 +381,27 @@ void client_manage(Window window)
transient = place_client(self, &placex, &placey, settings);
+ /* if the window isn't user-positioned, then make it fit inside
+ the visible screen area on its monitor.
+
+ the monitor is chosen by place_client! */
+ if (!(self->positioned & USPosition)) {
+ /* make a copy to modify */
+ Rect a = *screen_area_monitor(self->desktop, client_monitor(self));
+
+ /* shrink by the frame's area */
+ a.width -= self->frame->size.left + self->frame->size.right;
+ a.height -= self->frame->size.top + self->frame->size.bottom;
+
+ /* fit the window inside the area */
+ self->area.width = MIN(self->area.width, a.width);
+ self->area.height = MIN(self->area.height, a.height);
+
+ /* adjust the frame to the client's new size */
+ frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
+ frame_adjust_client_area(self->frame);
+ }
+
/* make sure the window is visible. */
client_find_onscreen(self, &placex, &placey,
self->area.width, self->area.height,