/* focus the new window? */
if (ob_state() != OB_STATE_STARTING &&
(!self->session || self->session->focused) &&
- !self->iconic &&
/* this means focus=true for window is same as config_focus_new=true */
((config_focus_new || (settings && settings->focus == 1)) ||
client_search_focus_tree_full(self)) &&
/* this checks for focus=false for the window */
(!settings || settings->focus != 0) &&
- /* note the check against type Normal/Dialog/Utility,
- not client_normal(self), which would also include other types.
- in this case we want more strict rules for focus */
- (self->type == OB_CLIENT_TYPE_NORMAL ||
- self->type == OB_CLIENT_TYPE_UTILITY ||
- self->type == OB_CLIENT_TYPE_DIALOG))
+ focus_valid_target(self, FALSE, TRUE, FALSE, FALSE))
{
- /* XXX use focus_cycle_valid_target instead... */
activate = TRUE;
}
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);
}
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);
/* 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;
}
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);
}
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;
*/
(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;
}
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
Rect *a;
guint i;
- i = screen_find_monitor(&desired_area);
+ i = screen_find_monitor(&desired);
a = screen_physical_area_monitor(i);
*x = a->x;
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) {
user = FALSE; /* ignore if the client can't be moved/resized when it
is maximizing */
+
+ g_free(a);
}
/* gets the client's position */
/* 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;
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:
g_assert_not_reached();
dest = 0; /* suppress warning */
}
+
+ g_free(a);
+ g_free(monitor);
return dest;
}