[hackers] [wmii] Allow dragging floating clients from anywhere in their titlebars. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Tue, 13 Oct 2009 01:10:43 +0000 (UTC)

changeset: 2535:ce3414261da6
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Oct 12 21:10:34 2009 -0400
files: cmd/wmii/layout.c cmd/wmii/mouse.c
description:
Allow dragging floating clients from anywhere in their titlebars.

diff -r b3a95c393cc0 -r ce3414261da6 cmd/wmii/layout.c
--- a/cmd/wmii/layout.c Mon Oct 12 18:02:58 2009 -0400
+++ b/cmd/wmii/layout.c Mon Oct 12 21:10:34 2009 -0400
@@ -254,12 +254,13 @@
  * like the idea.
  */
 static void
-trampoline(int fn, Frame *f) {
+trampoline(int fn, Frame *f, bool grabbox) {
 
         while(fn > 0) {
                 resizing = fn != TFloat;
                 view_update(f->view);
- warppointer(grabboxcenter(f));
+ if(grabbox)
+ warppointer(grabboxcenter(f));
                 //f->collapsed = false;
                 fn = tramp[fn](f);
         }
@@ -285,9 +286,9 @@
         }
 
         if(f->area->floating)
- trampoline(TFloat, f);
+ trampoline(TFloat, f, !grabmod);
         else
- trampoline(THCol, f);
+ trampoline(THCol, f, true);
 
         if(grabmod)
                 warppointer(addpt(f->r.min, Pt(x * Dx(f->r),
@@ -562,7 +563,8 @@
         frect = f->r;
 
         pt = querypointer(&scr.root);
- pt1 = grabboxcenter(f);
+ /* pt1 = grabboxcenter(f); */
+ pt1 = pt;
         goto case_motion;
 
 shut_up_ken:
diff -r b3a95c393cc0 -r ce3414261da6 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Mon Oct 12 18:02:58 2009 -0400
+++ b/cmd/wmii/mouse.c Mon Oct 12 21:10:34 2009 -0400
@@ -601,6 +601,8 @@
                         cur = quad_cursor(q);
                         if(exec) mouse_resize(f->client, q, false);
                 }
+ else if(exec && rect_haspoint_p(p, f->titlebar))
+ mouse_movegrabbox(f->client, true);
         }else {
                 if(f->aprev && p.y <= 2
                 || f->anext && r.max.y - p.y <= 2) {
Received on Tue Oct 13 2009 - 01:10:43 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 13 2009 - 01:12:06 UTC