]> git.mdlowis.com Git - proto/anvil.git/commitdiff
tweaked mouse handling to have close operation require ModKey press as well. This...
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 2 Apr 2020 11:10:34 +0000 (07:10 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 2 Apr 2020 11:10:34 +0000 (07:10 -0400)
anvil.h
keys.c
mouse.c

diff --git a/anvil.h b/anvil.h
index d9553148fdb8e4b06b6783729e87a8e893a93620..e32152e40ec057290fafa8c018588f14f98559be 100644 (file)
--- a/anvil.h
+++ b/anvil.h
@@ -109,6 +109,11 @@ typedef struct {
 #define MIN_HEIGHT    (TITLE_HEIGHT+BORDER_WIDTH)
 #define MIN_COL_FACT  0.20
 #define FONT_NAME     "-*-lucida-bold-r-normal-sans-14-*-*-*-p-*-iso10646-1"
+#ifdef __APPLE__
+#define MODKEY Mod1Mask
+#else
+#define MODKEY Mod4Mask
+#endif
 
 /* anvil.c */
 extern XConf X;
diff --git a/keys.c b/keys.c
index 72bd1e88fdc2126b82a8083d41288a1d190fe75d..5dabd8bcbcf9f065baa23771ea9c47e2fadb902e 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -50,12 +50,6 @@ static void colsplit(Arg *arg)
     mons_colsplit();
 }
 
-#ifdef __APPLE__
-#define MODKEY Mod1Mask
-#else
-#define MODKEY Mod4Mask
-#endif
-
 static char* pickexec[]  = { "pickexec", NULL };
 static char* terminal[]  = { "xterm", NULL };
 static char* locker[]  = { "slock", NULL };
diff --git a/mouse.c b/mouse.c
index 7a6a29463ec762680d22e11050867163d5e49396..f2d9611ca5330f1f2dd6da7c8914a0e8cff33ca7 100644 (file)
--- a/mouse.c
+++ b/mouse.c
@@ -17,7 +17,18 @@ static void float_click(XButtonEvent* ev, Location* loc)
     }
     else if (ev->button == Button2)
     {
-        client_close(loc->client);
+        if (ev->state & MODKEY)
+        {
+            client_close(loc->client);
+        }
+        else if (ev->state & (MODKEY|ShiftMask))
+        {
+            puts("to tile mode");
+        }
+        else
+        {
+            puts("undefined");
+        }
     }
     else if (ev->button == Button3)
     {
@@ -41,7 +52,18 @@ static void monocled_click(XButtonEvent* ev, Location* loc)
     }
     else if (ev->button == Button2)
     {
-        client_close(loc->client);
+        if (ev->state & MODKEY)
+        {
+            client_close(loc->client);
+        }
+        else if (ev->state & (MODKEY|ShiftMask))
+        {
+            puts("to float mode");
+        }
+        else
+        {
+            puts("expand client");
+        }
     }
     else if (ev->button == Button3)
     {
@@ -66,20 +88,23 @@ static void stacked_click(XButtonEvent* ev, Location* loc)
     }
     else if (ev->button == Button2)
     {
-        client_close(loc->client);
-    }
-    else if (ev->button == Button3)
-    {
-        if (PRESSED(ev->state, Button1))
+        if (ev->state & MODKEY)
         {
-            /* TODO: implement expand in place */
-            puts("expand in place");
+            client_close(loc->client);
+        }
+        else if (ev->state & (MODKEY|ShiftMask))
+        {
+            puts("to float mode");
         }
         else
         {
-            monocled_set(loc->monitor, loc->column, loc->client);
+            puts("expand in place");
         }
     }
+    else if (ev->button == Button3)
+    {
+        monocled_set(loc->monitor, loc->column, loc->client);
+    }
 }
 
 void mouse_down(XButtonEvent* ev, Location* loc)
@@ -124,35 +149,18 @@ void mouse_up(XButtonEvent* ev, Location* loc)
     {
         mons_coladjust(loc->monitor, loc->column, ev->x_root - X.start_x);
     }
-    else if (loc->column)
+    else
     {
+        /* nothing to do here */
     }
     X.mode = M_IDLE;
 }
 
-static void monocled_drag(XMotionEvent* ev, Location* loc)
-{
-    (void)ev, (void)loc;
-}
-
-static void stacked_drag(XMotionEvent* ev, Location* loc)
-{
-    (void)ev, (void)loc;
-}
-
 void mouse_drag(XMotionEvent* ev, Location* loc)
 {
     if (!loc->column)
     {
         float_drag(ev, loc);
     }
-    else if (loc->column->focused)
-    {
-        monocled_drag(ev, loc);
-    }
-    else
-    {
-        stacked_drag(ev, loc);
-    }
 }