woa.. let you do mouse actions while in an interactive keyboard action, and let you do keyboard actions while move/resizing. yay. also you can click in windows at the same time..

This commit is contained in:
Dana Jansens 2007-05-05 00:50:53 +00:00
parent 0c15af505f
commit 9a9e3f6bf6
4 changed files with 42 additions and 29 deletions

View file

@ -546,14 +546,16 @@ static void event_process(const XEvent *ec, gpointer data)
}
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,

View file

@ -199,10 +199,8 @@ static void keyboard_interactive_end(guint state, gboolean cancel, Time time,
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)
@ -217,11 +215,8 @@ gboolean keyboard_interactive_grab(guint state, ObClient *client,
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);
}
@ -241,23 +236,26 @@ gboolean keyboard_process_interactive_grab(const XEvent *e, ObClient **client)
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;
}

View file

@ -395,8 +395,10 @@ static void calc_resize(gboolean resist)
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) {
@ -405,10 +407,12 @@ void moveresize_event(XEvent *e)
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;
@ -459,12 +463,19 @@ void moveresize_event(XEvent *e)
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;
@ -474,10 +485,8 @@ void moveresize_event(XEvent *e)
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;
@ -497,6 +506,8 @@ void moveresize_event(XEvent *e)
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;
@ -507,10 +518,8 @@ void moveresize_event(XEvent *e)
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;
@ -532,6 +541,8 @@ void moveresize_event(XEvent *e)
actually is */
start_x += (px - opx) - (cur_x - ox);
start_y += (py - opy) - (cur_y - oy);
used = TRUE;
}
}
}
@ -540,6 +551,8 @@ void moveresize_event(XEvent *e)
{
waiting_for_sync = FALSE; /* we got our sync... */
do_resize(); /* ...so try resize if there is more change pending */
used = TRUE;
}
#endif
return used;
}

View file

@ -40,6 +40,6 @@ void moveresize_start(struct _ObClient *c,
gint x, gint y, guint button, guint32 corner);
void moveresize_end(gboolean cancel);
void moveresize_event(XEvent *e);
gboolean moveresize_event(XEvent *e);
#endif