From c2f108a3aeb0f40cf442c94ac5f7a2df06b0e29d Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Mon, 6 Feb 2012 16:15:12 +0100 Subject: [PATCH] Arrange surface position with screen edge --- src/status.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/status.c b/src/status.c index d85a17d..d7d9a65 100644 --- a/src/status.c +++ b/src/status.c @@ -545,6 +545,7 @@ static void status_surface(int w, int h, Color bg, char *status) { struct barwin *b; + struct screen *s; struct status_ctx ctx; int d, x, y; @@ -552,6 +553,12 @@ status_surface(int w, int h, Color bg, char *status) return; XQueryPointer(W->dpy, W->root, (Window*)&d, (Window*)&d, &x, &y, &d, &d, (unsigned int *)&d); + s = screen_gb_geo(x, y); + + if(x + w > s->geo.x + s->geo.w) + x -= w; + if(y + h > s->geo.y + s->geo.h) + y -= h; b = barwin_new(W->root, x, y, w, h, 0, bg, false); barwin_map(b);