]> git.lizzy.rs Git - bspwm.git/commitdiff
Add an event for pointer actions
authorThilo Wischmeyer <thwischm@gmail.com>
Wed, 21 Sep 2016 20:39:15 +0000 (22:39 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Fri, 30 Sep 2016 19:39:06 +0000 (21:39 +0200)
Fixes #536.

doc/bspwm.1
doc/bspwm.1.asciidoc
parse.c
pointer.c
subscribe.h

index 54c69b06fa02b66cd88f60f4167a2d5deed42f17..7fb4cbb8a0d4d0099c5ceece2f613b98b26b8915 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 09/22/2016
+.\"      Date: 09/30/2016
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.1-95-g70b477d
+.\"    Source: Bspwm 0.9.1-102-ge2d5e26
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "09/22/2016" "Bspwm 0\&.9\&.1\-95\-g70b477d" "Bspwm Manual"
+.TH "BSPWM" "1" "09/30/2016" "Bspwm 0\&.9\&.1\-102\-ge2d5e26" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1330,6 +1330,11 @@ One of the flags of a node changed\&.
 .RS 4
 The layer of a window changed\&.
 .RE
+.PP
+\fIpointer_action <monitor_id> <desktop_id> <node_id> move|resize_corner|resize_side begin|end\fR
+.RS 4
+A pointer action occured\&.
+.RE
 .sp
 Please note that \fBbspwm\fR initializes monitors before it reads messages on its socket, therefore the initial monitor events can\(cqt be received\&.
 .SH "REPORT FORMAT"
index 0c538e19365f755f86789111f1976a035b1922a2..f3a5c2cd07815a55bd2b2a0c01e38b8d3ffd8505 100644 (file)
@@ -796,6 +796,9 @@ Events
 'node_layer <monitor_id> <desktop_id> <node_id> below|normal|above'::
        The layer of a window changed.
 
+'pointer_action <monitor_id> <desktop_id> <node_id> move|resize_corner|resize_side begin|end'::
+       A pointer action occured.
+
 Please note that *bspwm* initializes monitors before it reads messages on its socket, therefore the initial monitor events can't be received.
 
 Report Format
diff --git a/parse.c b/parse.c
index 2ee1a2d7deffeb643bcaa02448d040c9ebd3bb96..c5328e8ee47566966dbb83852c08791daaf84d6d 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -320,6 +320,8 @@ bool parse_subscriber_mask(char *s, subscriber_mask_t *mask)
                *mask = SBSC_MASK_DESKTOP;
        } else if (streq("monitor", s)) {
                *mask = SBSC_MASK_MONITOR;
+       } else if (streq("pointer_action", s)) {
+               *mask = SBSC_MASK_POINTER_ACTION;
        } else if (streq("node_manage", s)) {
                *mask = SBSC_MASK_NODE_MANAGE;
        } else if (streq("node_unmanage", s)) {
index 2446f3fd4e2afe2cf9d5e590f820a85c9fe6beaf..b0a690d12d4404bd15b4f034e7051cbeec01d854 100644 (file)
--- a/pointer.c
+++ b/pointer.c
@@ -217,6 +217,14 @@ void grab_pointer(pointer_action_t pac)
        }
        free(reply);
 
+       if (pac == ACTION_MOVE) {
+               put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X move begin\n", loc.monitor->id, loc.desktop->id, loc.node->id);
+       } else if (pac == ACTION_RESIZE_CORNER) {
+               put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X resize_corner begin\n", loc.monitor->id, loc.desktop->id, loc.node->id);
+       } else if (pac == ACTION_RESIZE_SIDE) {
+               put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X resize_side begin\n", loc.monitor->id, loc.desktop->id, loc.node->id);
+       }
+
        track_pointer(loc, pac, pos);
 }
 
@@ -271,6 +279,14 @@ void track_pointer(coordinates_t loc, pointer_action_t pac, xcb_point_t pos)
                return;
        }
 
+       if (pac == ACTION_MOVE) {
+               put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X move end\n", loc.monitor->id, loc.desktop->id, n->id);
+       } else if (pac == ACTION_RESIZE_CORNER) {
+               put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X resize_corner end\n", loc.monitor->id, loc.desktop->id, n->id);
+       } else if (pac == ACTION_RESIZE_SIDE) {
+               put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X resize_side end\n", loc.monitor->id, loc.desktop->id, n->id);
+       }
+
        xcb_rectangle_t r = get_rectangle(NULL, n);
 
        put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", loc.monitor->id, loc.desktop->id, loc.node->id, r.width, r.height, r.x, r.y);
index 2f52750546c2d94bc9ec212d87af514b8be30b10..496ce8dfb698ba3d782b4772cd957cedc3bf95da 100644 (file)
@@ -53,10 +53,11 @@ typedef enum {
        SBSC_MASK_NODE_STATE = 1 << 24,
        SBSC_MASK_NODE_FLAG = 1 << 25,
        SBSC_MASK_NODE_LAYER = 1 << 26,
+       SBSC_MASK_POINTER_ACTION = 1 << 27,
        SBSC_MASK_MONITOR = (1 << 7) - (1 << 1),
        SBSC_MASK_DESKTOP = (1 << 15) - (1 << 7),
-       SBSC_MASK_NODE = (1 << 27) - (1 << 15),
-       SBSC_MASK_ALL = (1 << 27) - 1
+       SBSC_MASK_NODE = (1 << 28) - (1 << 15),
+       SBSC_MASK_ALL = (1 << 28) - 1
 } subscriber_mask_t;
 
 subscriber_list_t *make_subscriber_list(FILE *stream, int field);