From c4af950903820221bc8617de81231de32eef4f07 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 17 Apr 2003 07:00:13 +0000 Subject: [PATCH] fix up support for moveresize. make keyboard grabs Async so that i can hit escape to cancel a moveresize process. --- openbox/event.c | 8 ++++++-- openbox/grab.c | 5 +++-- openbox/grab.h | 2 +- openbox/moveresize.c | 2 +- openbox/moveresize.h | 2 +- plugins/mouse/mouseparse.c | 2 -- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/openbox/event.c b/openbox/event.c index f02f2506..6cc8b1f0 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -689,9 +689,13 @@ static void event_handle_client(Client *client, XEvent *e) (Atom)e->xclient.data.l[2] == prop_atoms.net_wm_moveresize_move_keyboard) { + g_message("client %lx x %d y %d button %d corner %d", + client, e->xclient.data.l[0], + e->xclient.data.l[1], e->xclient.data.l[3], + e->xclient.data.l[2]); moveresize_start(client, e->xclient.data.l[0], - e->xclient.data.l[1], e->xclient.data.l[2], - e->xclient.data.l[3]); + e->xclient.data.l[1], e->xclient.data.l[3], + e->xclient.data.l[2]); } } else if (msgtype == prop_atoms.net_moveresize_window) { int oldg = client->gravity; diff --git a/openbox/grab.c b/openbox/grab.c index b2426b9d..6af21eb2 100644 --- a/openbox/grab.c +++ b/openbox/grab.c @@ -6,6 +6,7 @@ #include #define GRAB_PTR_MASK (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask) +#define GRAB_KEY_MASK (KeyPressMask | KeyReleaseMask) #define MASK_LIST_SIZE 8 @@ -17,8 +18,8 @@ int grab_keyboard(gboolean grab) static guint kgrabs = 0; if (grab) { if (kgrabs++ == 0) - XGrabKeyboard(ob_display, ob_root, 0, GrabModeAsync, GrabModeSync, - event_lasttime); + XGrabKeyboard(ob_display, ob_root, FALSE, GrabModeAsync, + GrabModeAsync, event_lasttime); } else if (kgrabs > 0) { if (--kgrabs == 0) XUngrabKeyboard(ob_display, event_lasttime); diff --git a/openbox/grab.h b/openbox/grab.h index 2ba4ed51..9e1c55d2 100644 --- a/openbox/grab.h +++ b/openbox/grab.h @@ -7,7 +7,7 @@ void grab_startup(); void grab_shutdown(); -void grab_keyboard(gboolean grab); +int grab_keyboard(gboolean grab); void grab_pointer(gboolean grab, Cursor cur); void grab_pointer_window(gboolean grab, Cursor cur, Window win); void grab_server(gboolean grab); diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 7af3fa3e..77311804 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -117,8 +117,8 @@ void moveresize_start(Client *c, int x, int y, guint b, guint32 cnr) else g_assert_not_reached(); - grab_keyboard(TRUE); grab_pointer(TRUE, cur); + grab_keyboard(TRUE); } static void end_moveresize(gboolean cancel) diff --git a/openbox/moveresize.h b/openbox/moveresize.h index 3b8b3c6a..5fc8efde 100644 --- a/openbox/moveresize.h +++ b/openbox/moveresize.h @@ -9,7 +9,7 @@ extern gboolean moveresize_in_progress; void moveresize_startup(); -void moveresize_start(Client *c, int x, int y, guint b, guint32 corner); +void moveresize_start(Client *c, int x, int y, guint button, guint32 corner); void moveresize_event(XEvent *e); diff --git a/plugins/mouse/mouseparse.c b/plugins/mouse/mouseparse.c index f9f5f2f6..2c94fb19 100644 --- a/plugins/mouse/mouseparse.c +++ b/plugins/mouse/mouseparse.c @@ -69,8 +69,6 @@ void mouseparse(ParseToken *token) action = action_from_string(token->data.identifier); /* check for valid actions for motion events */ - if (action->func == action_moveresize) - g_message("%d", action->data.moveresize.corner); if (event == MouseAction_Motion) { if (action && (action->func != action_moveresize || action->data.moveresize.corner == -- 2.44.0