- a = screen_area(self->desktop);
- if (!self->strut.right &&
- *x + self->frame->area.width/10 >= a->x + a->width - 1)
- *x = a->x + a->width - self->frame->area.width/10;
- if (!self->strut.bottom &&
- *y + self->frame->area.height/10 >= a->y + a->height - 1)
- *y = a->y + a->height - self->frame->area.height/10;
- if (!self->strut.left && *x + self->frame->area.width*9/10 - 1 < a->x)
- *x = a->x - self->frame->area.width*9/10;
- if (!self->strut.top && *y + self->frame->area.height*9/10 - 1 < a->y)
- *y = a->y - self->frame->area.width*9/10;
- }
-
- /* This here doesn't let windows even a pixel outside the screen,
- * when called from client_manage, programs placing themselves are
+ if (!self->strut.right && *x + fw/10 >= all_a->x + all_a->width - 1)
+ *x = all_a->x + all_a->width - fw/10;
+ if (!self->strut.bottom && *y + fh/10 >= all_a->y + all_a->height - 1)
+ *y = all_a->y + all_a->height - fh/10;
+ if (!self->strut.left && *x + fw*9/10 - 1 < all_a->x)
+ *x = all_a->x - fw*9/10;
+ if (!self->strut.top && *y + fh*9/10 - 1 < all_a->y)
+ *y = all_a->y - fw*9/10;
+ }
+
+ /* If rudeness wasn't requested, then figure out of the client is currently
+ entirely on the screen. If it is, and the position isn't changing by
+ request, and it is enlarging, then be rude even though it wasn't
+ requested */
+ if (!rude) {
+ 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