Bläddra i källkod

Arrange surface position with screen edge

Martin Duquesnoy 12 år sedan
förälder
incheckning
c2f108a3ae
1 ändrade filer med 7 tillägg och 0 borttagningar
  1. 7 0
      src/status.c

+ 7 - 0
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);