fix up support for moveresize. make keyboard grabs Async so that i can hit escape to cancel a moveresize process.

This commit is contained in:
Dana Jansens 2003-04-17 07:00:13 +00:00
parent de70d9ffc5
commit c4af950903
6 changed files with 12 additions and 9 deletions

View file

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

View file

@ -6,6 +6,7 @@
#include <X11/Xlib.h>
#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);

View file

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

View file

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

View file

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

View file

@ -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 ==