sxhkd-rc

[fork] simple X hotkey daemon (but for the rc shell)
Log | Files | Refs | README | LICENSE

commit ed8c8806e2b212cfb1368fd9451a94580301fece
parent 6cc582a9b5ff623c7f8f6986d08adf9c852586e1
Author: Bastien Dejean <nihilhill@gmail.com>
Date:   Wed,  9 Jan 2013 13:04:54 +0100

Fix infinite loop in motion notify

If the button index was > 5, the loop in motion_notify wouldn't end.

Diffstat:
MREADME.md | 2+-
Msxhkd.1 | 3++-
Msxhkd.c | 2+-
3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -30,7 +30,7 @@ Where `MODIFIER` is one of the following names: `super`, `hyper`, `meta`, `alt`, If `@` is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events. -If `!` is added at the beginning of the keysym, the command will be run on motion notify events and must contain two integer conversion specifications which will be replaced by the *x* and *y* coordinates of the pointer relative to the root window referential. +If `!` is added at the beginning of the keysym, the command will be run on motion notify events and must contain two integer conversion specifications which will be replaced by the *x* and *y* coordinates of the pointer relative to the root window referential (the only valid button keysyms for this type of hotkeys are: `button1`, ..., `button5`). The keysym names are those your will get from `xev` (minus the prefix if any). diff --git a/sxhkd.1 b/sxhkd.1 @@ -51,7 +51,8 @@ If .I ! is added at the beginning of the keysym, the command will be run on motion notify events and must contain two integer conversion specifications which will be replaced by the .BR x " and " y -coordinates of the pointer relative to the root window referential. +coordinates of the pointer relative to the root window referential (the only valid button keysyms for this type of hotkeys are: +.BR button1 ",…, " button5 ). .PP The keysym names are those your will get from .BR xev (1) diff --git a/sxhkd.c b/sxhkd.c @@ -180,7 +180,7 @@ void motion_notify(xcb_generic_event_t *evt, uint8_t event_type) uint16_t buttonfield = e->state >> 8; uint16_t modfield = e->state & ~lockfield & MOD_STATE_FIELD; xcb_button_t button = 1; - while (~buttonfield & 1) { + while (~buttonfield & 1 && button < 5) { buttonfield = buttonfield >> 1; button++; }