X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=71be0f94656baf078a48cfb25405da2e75e75b13;hb=809619497d73598a9f3c2bd2e4b8968297af6bfd;hp=c6945d231c89216bbf8ff2ae74b29504d59e180a;hpb=8f2e3f5fe16aeb0324aa5ee2b2c30a83ec724ad0;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index c6945d23..71be0f94 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -398,21 +398,27 @@ void client_manage(Window window) client_normal(self) && !self->session))) { - /* make a copy to modify */ - Rect a = *screen_area_monitor(self->desktop, client_monitor(self)); + Rect placer; + + RECT_SET(placer, placex, placey, placew, placeh); + frame_rect_to_frame(self->frame, &placer); + + Rect *a = screen_area_monitor(self->desktop, client_monitor(self), + &placer); /* 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; + 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 */ - if (placew > a.width || self->area.height > a.height) { - placew = MIN(self->area.width, a.width); - placeh = MIN(self->area.height, a.height); + if (placew > a->width || self->area.height > a->height) { + placew = MIN(self->area.width, a->width); + placeh = MIN(self->area.height, a->height); ob_debug("setting window size to %dx%d\n", self->area.width, self->area.height); } + g_free(a); } @@ -924,8 +930,11 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h, Rect desired; RECT_SET(desired, *x, *y, w, h); - all_a = screen_area(self->desktop); - mon_a = screen_area_monitor(self->desktop, screen_find_monitor(&desired)); + frame_rect_to_frame(self->frame, &desired); + + all_a = screen_area(self->desktop, &desired); + mon_a = screen_area_monitor(self->desktop, screen_find_monitor(&desired), + &desired); /* get where the frame would be */ frame_client_gravity(self->frame, x, y, w, h); @@ -1011,6 +1020,9 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h, /* get where the client should be */ frame_frame_gravity(self->frame, x, y, w, h); + g_free(all_a); + g_free(mon_a); + return ox != *x || oy != *y; } @@ -1968,7 +1980,7 @@ void client_update_strut(ObClient *self) if (!got && PROP_GETA32(self->window, net_wm_strut, cardinal, &data, &num)) { if (num == 4) { - const Rect *a; + Rect *a; got = TRUE; @@ -1981,6 +1993,7 @@ void client_update_strut(ObClient *self) a->x, a->x + a->width - 1, a->y, a->y + a->height - 1, a->x, a->x + a->width - 1); + g_free(a); } g_free(data); } @@ -2381,6 +2394,9 @@ gboolean client_has_parent(ObClient *self) static ObStackingLayer calc_layer(ObClient *self) { ObStackingLayer l; + Rect *monitor; + + monitor = screen_physical_area_monitor(client_monitor(self)); if (self->type == OB_CLIENT_TYPE_DESKTOP) l = OB_STACKING_LAYER_DESKTOP; @@ -2394,15 +2410,15 @@ static ObStackingLayer calc_layer(ObClient *self) */ (self->decorations == 0 && !(self->max_horz && self->max_vert) && - RECT_EQUAL(self->area, - *screen_physical_area_monitor - (client_monitor(self))))) && + RECT_EQUAL(self->area, *monitor))) && (client_focused(self) || client_search_focus_tree(self))) l = OB_STACKING_LAYER_FULLSCREEN; else if (self->above) l = OB_STACKING_LAYER_ABOVE; else if (self->below) l = OB_STACKING_LAYER_BELOW; else l = OB_STACKING_LAYER_NORMAL; + g_free(monitor); + return l; } @@ -2680,7 +2696,8 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, gint *logicalw, gint *logicalh, gboolean user) { - Rect desired_area = {*x, *y, *w, *h}; + Rect desired = {*x, *y, *w, *h}; + frame_rect_to_frame(self->frame, &desired); /* make the frame recalculate its dimentions n shit without changing anything visible for real, this way the constraints below can work with @@ -2697,7 +2714,7 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, Rect *a; guint i; - i = screen_find_monitor(&desired_area); + i = screen_find_monitor(&desired); a = screen_physical_area_monitor(i); *x = a->x; @@ -2707,12 +2724,14 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, user = FALSE; /* ignore if the client can't be moved/resized when it is fullscreening */ + + g_free(a); } else if (self->max_horz || self->max_vert) { Rect *a; guint i; - i = screen_find_monitor(&desired_area); - a = screen_area_monitor(self->desktop, i); + i = screen_find_monitor(&desired); + a = screen_area_monitor(self->desktop, i, &desired); /* set the size and position if maximized */ if (self->max_horz) { @@ -2726,6 +2745,8 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, user = FALSE; /* ignore if the client can't be moved/resized when it is maximizing */ + + g_free(a); } /* gets the client's position */ @@ -2734,7 +2755,8 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, /* work within the prefered sizes given by the window */ if (!(*w == self->area.width && *h == self->area.height)) { gint basew, baseh, minw, minh; - gint incw, inch, minratio, maxratio; + gint incw, inch; + gfloat minratio, maxratio; incw = self->fullscreen || self->max_horz ? 1 : self->size_inc.width; inch = self->fullscreen || self->max_vert ? 1 : self->size_inc.height; @@ -3856,8 +3878,9 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang) if(!client_list) return -1; - a = screen_area(c->desktop); - monitor = screen_area_monitor(c->desktop, client_monitor(c)); + a = screen_area(c->desktop, &c->frame->area); + monitor = screen_area_monitor(c->desktop, client_monitor(c), + &c->frame->area); switch(dir) { case OB_DIRECTION_NORTH: @@ -4004,6 +4027,9 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang) g_assert_not_reached(); dest = 0; /* suppress warning */ } + + g_free(a); + g_free(monitor); return dest; }