Add an event for pointer actions

Fixes #536.
This commit is contained in:
Thilo Wischmeyer 2016-09-21 22:39:15 +02:00 committed by Bastien Dejean
parent 9efe76b8b0
commit 8664c007e4
5 changed files with 32 additions and 5 deletions

View 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"

View 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

View file

@ -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)) {

View file

@ -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);

View 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);