From 8fe0cb8989c1fe12b30b9030b446345f25340d35 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 9 Sep 2003 07:16:38 +0000 Subject: [PATCH] no more interactive mouse actions, they are evil etc. actions now "feel" much more solid. if move/resizing a window while changing workspaces, it will follow. --- openbox/action.c | 3 +-- openbox/action.h | 12 +++++------- openbox/event.c | 11 ++++------- openbox/keyboard.c | 14 ++++++-------- openbox/keyboard.h | 5 +---- openbox/mouse.c | 9 ++++++--- openbox/mouse.h | 2 +- openbox/screen.c | 4 ++++ 8 files changed, 28 insertions(+), 32 deletions(-) diff --git a/openbox/action.c b/openbox/action.c index e16e177a..efc7f1ef 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -767,7 +767,6 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, } void action_run_full(ObAction *a, struct _ObClient *c, - ObFrameContext context, guint state, guint button, gint x, gint y, gboolean cancel, gboolean done) { @@ -784,7 +783,7 @@ void action_run_full(ObAction *a, struct _ObClient *c, a->data.inter.cancel = cancel; a->data.inter.final = done; if (!(cancel || done)) - keyboard_interactive_grab(state, c, context, a); + keyboard_interactive_grab(state, c, a); } a->func(&a->data); diff --git a/openbox/action.h b/openbox/action.h index 18525072..debae8eb 100644 --- a/openbox/action.h +++ b/openbox/action.h @@ -153,7 +153,6 @@ void action_free(ObAction *a); /*! Executes an action. @param c The client associated with the action. Can be NULL. - @param context The context in which the user action occured. @param state The keyboard modifiers state at the time the user action occured @param button The mouse button used to execute the action. @param x The x coord at which the user action occured. @@ -164,21 +163,20 @@ void action_free(ObAction *a); affects interactive actions, but should generally always be FALSE. */ void action_run_full(ObAction *a, struct _ObClient *c, - ObFrameContext context, guint state, guint button, gint x, gint y, gboolean cancel, gboolean done); -#define action_run_mouse(a, c, t, s, b, x, y) \ - action_run_full(a, c, t, s, b, x, y, FALSE, FALSE) +#define action_run_mouse(a, c, s, b, x, y) \ + action_run_full(a, c, s, b, x, y, FALSE, FALSE) #define action_run_interactive(a, c, s, n, d) \ - action_run_full(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, n, d) + action_run_full(a, c, s, 0, -1, -1, n, d) #define action_run_key(a, c, s, x, y) \ - action_run_full(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, FALSE,FALSE) + action_run_full(a, c, s, 0, x, y, FALSE,FALSE) #define action_run(a, c, s) \ - action_run_full(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, FALSE,FALSE) + action_run_full(a, c, s, 0, -1, -1, FALSE,FALSE) /* Execute */ void action_execute(union ActionData *data); diff --git a/openbox/event.c b/openbox/event.c index c744e3ab..79d35077 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -487,17 +487,14 @@ static void event_process(const XEvent *ec, gpointer data) { if (menu_frame_visible) event_handle_menu(e); - else if (moveresize_in_progress) - moveresize_event(e); else { - ObFrameContext context; + if (!keyboard_process_interactive_grab(e)) { + if (moveresize_in_progress) + moveresize_event(e); - context = frame_context(client, e->xany.window); - - if (!keyboard_process_interactive_grab(e, &client, &context)) { if (e->type == ButtonPress || e->type == ButtonRelease || e->type == MotionNotify) - mouse_event(client, context, e); + mouse_event(client, e); else if (e->type == KeyPress) /* when in the middle of a focus cycling action, this causes the window which appears to be focused to be diff --git a/openbox/keyboard.c b/openbox/keyboard.c index 65d2f2e0..fe13c97b 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -12,6 +12,7 @@ #include "keytree.h" #include "keyboard.h" #include "translate.h" +#include "moveresize.h" #include @@ -129,12 +130,15 @@ gboolean keyboard_bind(GList *keylist, ObAction *action) } void keyboard_interactive_grab(guint state, ObClient *client, - ObFrameContext context, ObAction *action) + ObAction *action) { ObInteractiveState *s; g_assert(action->data.any.interactive); + if (moveresize_in_progress) + moveresize_end(FALSE); + if (!interactive_states) { if (!grab_keyboard(TRUE)) return; @@ -149,14 +153,11 @@ void keyboard_interactive_grab(guint state, ObClient *client, s->state = state; s->client = client; s->action = action; - s->context = context; interactive_states = g_slist_append(interactive_states, s); } -gboolean keyboard_process_interactive_grab(const XEvent *e, - ObClient **client, - ObFrameContext *context) +gboolean keyboard_process_interactive_grab(const XEvent *e) { GSList *it, *next; gboolean handled = FALSE; @@ -168,9 +169,6 @@ gboolean keyboard_process_interactive_grab(const XEvent *e, next = g_slist_next(it); - *client = s->client; - *context = s->context; - if ((e->type == KeyRelease && !(s->state & e->xkey.state))) done = TRUE; diff --git a/openbox/keyboard.h b/openbox/keyboard.h index ec51fade..61fe19e0 100644 --- a/openbox/keyboard.h +++ b/openbox/keyboard.h @@ -21,11 +21,8 @@ void keyboard_event(struct _ObClient *client, const XEvent *e); void keyboard_reset_chains(); void keyboard_interactive_grab(guint state, struct _ObClient *client, - ObFrameContext context, struct _ObAction *action); -gboolean keyboard_process_interactive_grab(const XEvent *e, - struct _ObClient **client, - ObFrameContext *context); +gboolean keyboard_process_interactive_grab(const XEvent *e); void keyboard_grab_for_client(struct _ObClient *c, gboolean grab); diff --git a/openbox/mouse.c b/openbox/mouse.c index 25068401..ab628ff3 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -107,20 +107,23 @@ static gboolean fire_binding(ObMouseAction a, ObFrameContext context, if (it == NULL) return FALSE; for (it = b->actions[a]; it; it = it->next) - action_run_mouse(it->data, c, context, state, button, x, y); + action_run_mouse(it->data, c, state, button, x, y); return TRUE; } -void mouse_event(ObClient *client, ObFrameContext context, XEvent *e) +void mouse_event(ObClient *client, XEvent *e) { static Time ltime; static guint button = 0, state = 0, lbutton = 0; - static Window lwindow = None; static int px, py; + + ObFrameContext context; gboolean click = FALSE; gboolean dclick = FALSE; + context = frame_context(client, e->xany.window); + switch (e->type) { case ButtonPress: px = e->xbutton.x_root; diff --git a/openbox/mouse.h b/openbox/mouse.h index 31ce40fe..deba7ed2 100644 --- a/openbox/mouse.h +++ b/openbox/mouse.h @@ -13,7 +13,7 @@ void mouse_shutdown(gboolean reconfig); gboolean mouse_bind(char *buttonstr, char *contextstr, ObMouseAction mact, ObAction *action); -void mouse_event(struct _ObClient *client, ObFrameContext context, XEvent *e); +void mouse_event(struct _ObClient *client, XEvent *e); void mouse_grab_for_client(struct _ObClient *client, gboolean grab); diff --git a/openbox/screen.c b/openbox/screen.c index 656206bf..f109bab2 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -5,6 +5,7 @@ #include "prop.h" #include "grab.h" #include "startupnotify.h" +#include "moveresize.h" #include "config.h" #include "screen.h" #include "client.h" @@ -410,6 +411,9 @@ void screen_set_desktop(guint num) ob_debug("Moving to desktop %d\n", num+1); + if (moveresize_client) + client_set_desktop(moveresize_client, num, TRUE); + /* show windows before hiding the rest to lessen the enter/leave events */ /* show windows from top to bottom */ -- 2.39.2