}
if (useevent) {
- if (!keyboard_process_interactive_grab(e, &client)) {
- if (moveresize_in_progress) {
- moveresize_event(e);
-
+ /* if the keyboard interactive action uses the event then dont
+ use it for bindings. likewise is moveresize uses the event. */
+ if (!keyboard_process_interactive_grab(e, &client) &&
+ !(moveresize_in_progress && moveresize_event(e)))
+ {
+ if (moveresize_in_progress)
/* make further actions work on the client being
moved/resized */
client = moveresize_client;
- }
+
menu_can_hide = FALSE;
ob_main_loop_timeout_add(ob_main_loop,
istate.active = FALSE;
- if (ungrab) {
+ if (ungrab)
grab_keyboard(FALSE);
- grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
- }
}
static void keyboard_interactive_end_client(ObClient *client, gpointer data)
g_assert(action->data.any.interactive);
if (!istate.active) {
- grab_pointer(TRUE, FALSE, OB_CURSOR_POINTER);
- if (!grab_keyboard(TRUE)) {
- grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
+ if (!grab_keyboard(TRUE))
return FALSE;
- }
} else if (action->func != istate.action->func) {
keyboard_interactive_end(state, FALSE, action->data.any.time, FALSE);
}
gboolean cancel = FALSE;
if (istate.active) {
- if ((e->type == KeyRelease && !(istate.state & e->xkey.state)))
+ if ((e->type == KeyRelease && !(istate.state & e->xkey.state))) {
done = TRUE;
- else if (e->type == KeyPress) {
+ handled = TRUE;
+ } else if (e->type == KeyPress) {
/*if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN))
done = TRUE;
- else */if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
+ else */if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE)) {
cancel = done = TRUE;
+ handled = TRUE;
+ }
} else if (e->type == ButtonPress) {
cancel = FALSE;
done = TRUE;
+ handled = FALSE;
}
- if (done) {
+ if (done)
keyboard_interactive_end(e->xkey.state, cancel, e->xkey.time,TRUE);
- handled = TRUE;
- } else
+ if (handled)
*client = istate.client;
}
moveresize_client->frame->size.bottom;
}
-void moveresize_event(XEvent *e)
+gboolean moveresize_event(XEvent *e)
{
+ gboolean used = FALSE;
+
g_assert(moveresize_in_progress);
if (e->type == ButtonPress) {
start_y = e->xbutton.y_root;
button = e->xbutton.button; /* this will end it now */
}
+ used = TRUE;
} else if (e->type == ButtonRelease) {
if (!button || e->xbutton.button == button) {
moveresize_end(FALSE);
}
+ used = TRUE;
} else if (e->type == MotionNotify) {
if (moving) {
cur_x = start_cx + e->xmotion.x_root - start_x;
calc_resize(TRUE);
do_resize();
}
+ used = TRUE;
} else if (e->type == KeyPress) {
- if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
+ if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE)) {
moveresize_end(TRUE);
- else if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN))
+ used = TRUE;
+ } else if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN)) {
moveresize_end(FALSE);
- else {
+ used = TRUE;
+ } else if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT) ||
+ e->xkey.keycode == ob_keycode(OB_KEY_LEFT) ||
+ e->xkey.keycode == ob_keycode(OB_KEY_DOWN) ||
+ e->xkey.keycode == ob_keycode(OB_KEY_UP))
+ {
if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
gint dx = 0, dy = 0, ox = cur_x, oy = cur_y;
dx = -MAX(4, moveresize_client->size_inc.width);
else if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN))
dy = MAX(4, moveresize_client->size_inc.height);
- else if (e->xkey.keycode == ob_keycode(OB_KEY_UP))
+ else /* if (e->xkey.keycode == ob_keycode(OB_KEY_UP)) */
dy = -MAX(4, moveresize_client->size_inc.height);
- else
- return;
cur_x += dx;
cur_y += dy;
actually is */
start_x += dx - (cur_x - ox);
start_y += dy - (cur_y - oy);
+
+ used = TRUE;
} else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) {
gint dx = 0, dy = 0, ox = cur_x, oy = cur_y;
gint opx, px, opy, py;
dx = -4;
else if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN))
dy = 4;
- else if (e->xkey.keycode == ob_keycode(OB_KEY_UP))
+ else /* if (e->xkey.keycode == ob_keycode(OB_KEY_UP)) */
dy = -4;
- else
- return;
cur_x += dx;
cur_y += dy;
actually is */
start_x += (px - opx) - (cur_x - ox);
start_y += (py - opy) - (cur_y - oy);
+
+ used = TRUE;
}
}
}
{
waiting_for_sync = FALSE; /* we got our sync... */
do_resize(); /* ...so try resize if there is more change pending */
+ used = TRUE;
}
#endif
+ return used;
}