+static void client_move_onscreen(Client *self)
+{
+ Rect *a;
+ int x = self->frame->area.x, y = self->frame->area.y;
+
+ a = screen_area(self->desktop);
+ if (x >= a->x + a->width - 1)
+ x = a->x + a->width - self->frame->area.width;
+ if (y >= a->y + a->height - 1)
+ y = a->y + a->height - self->frame->area.height;
+ if (x + self->frame->area.width - 1 < a->x)
+ x = a->x;
+ if (y + self->frame->area.height - 1< a->y)
+ y = a->y;
+
+ frame_frame_gravity(self->frame, &x, &y); /* get where the client
+ should be */
+ client_configure(self , Corner_TopLeft, x, y,
+ self->area.width, self->area.height,
+ TRUE, TRUE);
+}
+