all repos — openbox @ 9a9e3f6bf6be75094636e37d54fb16e4456b43be

openbox fork - make it a bit more like ryudo

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..
Dana Jansens danakj@orodu.net
commit

9a9e3f6bf6be75094636e37d54fb16e4456b43be

parent

0c15af505fb5bcd5e906e0146f82038b51f73307

4 files changed, 42 insertions(+), 29 deletions(-)

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

@@ -546,14 +546,16 @@ useevent = FALSE;

} 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,
M openbox/keyboard.copenbox/keyboard.c

@@ -199,10 +199,8 @@ g_slist_free(alist);

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

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 done = 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; }
M openbox/moveresize.copenbox/moveresize.c

@@ -395,8 +395,10 @@ cur_y -= moveresize_client->frame->size.top +

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 @@ start_x = e->xbutton.x_root;

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

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 @@ else if (e->xkey.keycode == ob_keycode(OB_KEY_LEFT))

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 @@ thinks it started so that it keeps up with where the window

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 @@ else if (e->xkey.keycode == ob_keycode(OB_KEY_LEFT))

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 @@ thinks it started so that it keeps up with where the window

actually is */ start_x += (px - opx) - (cur_x - ox); start_y += (py - opy) - (cur_y - oy); + + used = TRUE; } } }

@@ -540,6 +551,8 @@ else if (e->type == extensions_sync_event_basep + XSyncAlarmNotify)

{ waiting_for_sync = FALSE; /* we got our sync... */ do_resize(); /* ...so try resize if there is more change pending */ + used = TRUE; } #endif + return used; }
M openbox/moveresize.hopenbox/moveresize.h

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