all repos — openbox @ b8ba1cff1fdd5447984e83708865f8ba6c7f223a

openbox fork - make it a bit more like ryudo

perhaps fix problems of being left in menus without being able to control openbox
Dana Jansens danakj@orodu.net
commit

b8ba1cff1fdd5447984e83708865f8ba6c7f223a

parent

ff04a81e62cc9337f89fc913feb29f5295c84217

2 files changed, 22 insertions(+), 12 deletions(-)

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

@@ -50,11 +50,13 @@ {

gboolean ret = FALSE; if (grab) { - if (kgrabs++ == 0) + if (kgrabs++ == 0) { ret = XGrabKeyboard(ob_display, RootWindow(ob_display, ob_screen), FALSE, GrabModeAsync, GrabModeAsync, event_lasttime) == Success; - else + if (!ret) + --kgrabs; + } else ret = TRUE; } else if (kgrabs > 0) { if (--kgrabs == 0)

@@ -70,12 +72,14 @@ {

gboolean ret = FALSE; if (grab) { - if (pgrabs++ == 0) + if (pgrabs++ == 0) { ret = XGrabPointer(ob_display, screen_support_win, False, GRAB_PTR_MASK, GrabModeAsync, GrabModeAsync, FALSE, ob_cursor(cur), event_lasttime) == Success; - else + if (!ret) + --pgrabs; + } else ret = TRUE; } else if (pgrabs > 0) { if (--pgrabs == 0) {

@@ -91,12 +95,14 @@ {

gboolean ret = FALSE; if (grab) { - if (pgrabs++ == 0) + if (pgrabs++ == 0) { ret = XGrabPointer(ob_display, win, False, GRAB_PTR_MASK, GrabModeAsync, GrabModeAsync, TRUE, ob_cursor(cur), event_lasttime) == Success; - else + if (!ret) + --pgrabs; + } else ret = TRUE; } else if (pgrabs > 0) { if (--pgrabs == 0) {
M openbox/menuframe.copenbox/menuframe.c

@@ -591,18 +591,22 @@

if (g_list_find(menu_frame_visible, self)) return; + if (menu_frame_visible == NULL) { + /* no menus shown yet */ + if (!grab_pointer(TRUE, OB_CURSOR_NONE)) + return; + if (!grab_keyboard(TRUE)) { + grab_pointer(FALSE, OB_CURSOR_NONE); + return; + } + } + if (parent) { if (parent->child) menu_frame_hide(parent->child); parent->child = self; } self->parent = parent; - - if (menu_frame_visible == NULL) { - /* no menus shown yet */ - grab_pointer(TRUE, OB_CURSOR_NONE); - grab_keyboard(TRUE); - } /* determine if the underlying menu is already visible */ for (it = menu_frame_visible; it; it = g_list_next(it)) {