all repos — openbox @ 0ec2282e2ca6b80fa8c85dc366596cd009acc8a9

openbox fork - make it a bit more like ryudo

make sure the ungrab happens after the grab. fracking X server doesn't have a monatomic clock..
Dana Jansens danakj@orodu.net
commit

0ec2282e2ca6b80fa8c85dc366596cd009acc8a9

parent

35c8d482fcc5fb5b83e11d8f2adef8ca39878156

1 files changed, 20 insertions(+), 2 deletions(-)

jump to
M openbox/grab.copenbox/grab.c

@@ -35,6 +35,8 @@ /*! A list of all possible combinations of keyboard lock masks */

static guint mask_list[MASK_LIST_SIZE]; static guint kgrabs = 0; static guint pgrabs = 0; +/*! The time at which the last grab was made */ +static Time grab_time = CurrentTime; gboolean grab_on_keyboard() {

@@ -57,11 +59,17 @@ FALSE, GrabModeAsync, GrabModeAsync,

event_curtime) == Success; if (!ret) --kgrabs; + else + grab_time = event_curtime; } else ret = TRUE; } else if (kgrabs > 0) { - if (--kgrabs == 0) - XUngrabKeyboard(ob_display, event_curtime); + if (--kgrabs == 0) { + Time t = event_curtime; + if (t != 0 && t < grab_time) + t = grab_time; + XUngrabKeyboard(ob_display, t); + } ret = TRUE; }

@@ -80,10 +88,15 @@ GrabModeAsync, None,

ob_cursor(cur), event_curtime) == Success; if (!ret) --pgrabs; + else + grab_time = event_curtime; } else ret = TRUE; } else if (pgrabs > 0) { if (--pgrabs == 0) { + Time t = event_curtime; + if (t != 0 && t < grab_time) + t = grab_time; XUngrabPointer(ob_display, event_curtime); } ret = TRUE;

@@ -103,10 +116,15 @@ ob_cursor(cur),

event_curtime) == Success; if (!ret) --pgrabs; + else + grab_time = event_curtime; } else ret = TRUE; } else if (pgrabs > 0) { if (--pgrabs == 0) { + Time t = event_curtime; + if (t != 0 && t < grab_time) + t = grab_time; XUngrabPointer(ob_display, event_curtime); } ret = TRUE;