- a = screen_area_monitor(self->desktop, client_monitor(self));
- if (RECT_CONTAINS_RECT(*a, self->area))
- rude = TRUE;
- }
-
- /* This here doesn't let windows even a pixel outside the screen,
- * when called from client_manage, programs placing themselves are
+ Point oldtl, oldtr, oldbl, oldbr;
+ Point newtl, newtr, newbl, newbr;
+ gboolean stationary;
+
+ POINT_SET(oldtl, self->frame->area.x, self->frame->area.y);
+ POINT_SET(oldbr, self->frame->area.x + self->frame->area.width - 1,
+ self->frame->area.y + self->frame->area.height - 1);
+ POINT_SET(oldtr, oldbr.x, oldtl.y);
+ POINT_SET(oldbl, oldtl.x, oldbr.y);
+
+ POINT_SET(newtl, *x, *y);
+ POINT_SET(newbr, *x + fw - 1, *y + fh - 1);
+ POINT_SET(newtr, newbr.x, newtl.y);
+ POINT_SET(newbl, newtl.x, newbr.y);
+
+ /* is it moving or just resizing from some corner? */
+ stationary = (POINT_EQUAL(oldtl, newtl) || POINT_EQUAL(oldtr, newtr) ||
+ POINT_EQUAL(oldbl, newbl) || POINT_EQUAL(oldbr, newbr));
+
+ /* if left edge is growing */
+ if (stationary && newtl.x < oldtl.x)
+ rudel = TRUE;
+ /* if right edge is growing */
+ if (stationary && newtr.x > oldtr.x)
+ ruder = TRUE;
+ /* if top edge is growing */
+ if (stationary && newtl.y < oldtl.y)
+ rudet = TRUE;
+ /* if bottom edge is growing */
+ if (stationary && newbl.y > oldbl.y)
+ rudeb = TRUE;
+ }
+
+ /* This here doesn't let windows even a pixel outside the struts/screen.
+ * When called from client_manage, programs placing themselves are