[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] snap to screen borders doesn't take into account the statusbar



Hi all.

With latest awesome from git, window snapping borders doesn't take into
account the statusbar height, thus snapping windows to the edge of the
screen as opposed to the edge of the statusbar. The attached diff fixes
this issue:

--- patch-event.c begins here ---
diff --git a/event.c b/event.c
index ca61eef..8d20499 100644
--- a/event.c
+++ b/event.c
@@ -85,14 +85,22 @@ movemouse(Client * c, awesome_config *awesomeconf)
             XSync(c->display, False);
             nx = ocx + (ev.xmotion.x - x1);
             ny = ocy + (ev.xmotion.y - y1);
+
             if(abs(nx) < awesomeconf->snap + si[c->screen].x_org && nx > si[c->screen].x_org)
                 nx = si[c->screen].x_org;
             else if(abs((si[c->screen].x_org + si[c->screen].width) - (nx + c->w + 2 * c->border)) < awesomeconf->snap)
                 nx = si[c->screen].x_org + si[c->screen].width - c->w - 2 * c->border;
-            if(abs(ny) < awesomeconf->snap + si[c->screen].y_org && ny > si[c->screen].y_org)
-                ny = si[c->screen].y_org;
-            else if(abs((si[c->screen].y_org + si[c->screen].height) - (ny + c->h + 2 * c->border)) < awesomeconf->snap)
-                ny = si[c->screen].y_org + si[c->screen].height - c->h - 2 * c->border;
+
+            int upper_sb_offset = 0, lower_sb_offset = 0;
+            if (awesomeconf->statusbar_default_position == BarTop)
+               upper_sb_offset = awesomeconf->statusbar.height;
+            else if (awesomeconf->statusbar_default_position == BarBot)
+               lower_sb_offset = awesomeconf->statusbar.height;
+
+            if(abs(ny) < (awesomeconf->snap + si[c->screen].y_org + upper_sb_offset) && ny > si[c->screen].y_org)
+                ny = si[c->screen].y_org + upper_sb_offset;
+            else if(abs((si[c->screen].y_org + si[c->screen].height - lower_sb_offset) - (ny + c->h + 2 * c->border)) < awesomeconf->snap)
+                ny = si[c->screen].y_org + si[c->screen].height - c->h - 2 * c->border - lower_sb_offset;
             resize(c, nx, ny, c->w, c->h, awesomeconf, False);
             break;
         }
--- patch-event.c ends here ---

Cheers...

\n\n

P.S.: You got to love the xft+unicode support in awesome. Plain awesome... :)


-- 
To unsubscribe, send mail to awesome-unsubscribe@xxxxxxxxxxxxx