X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmouse.c;h=601c4f1bf5c16e3cdf84720c50b73a42c94c41b3;hb=bb44e8d047b662db15ef8d181cb925e1135d326d;hp=58dc07c952aef5fb2c983086e543a74e82b86f47;hpb=d59508ae910dc095e207910cbba301d79c4f5ef0;p=chaz%2Fopenbox diff --git a/openbox/mouse.c b/openbox/mouse.c index 58dc07c9..601c4f1b 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -18,8 +18,10 @@ typedef struct { GSList *actions[OB_MOUSE_NUM_ACTIONS]; /* lists of Action pointers */ } ObMouseBinding; +#define FRAME_CONTEXT(co, cl) ((cl && cl->type != OB_CLIENT_TYPE_DESKTOP) ? \ + co == OB_FRAME_CONTEXT_FRAME : FALSE) #define CLIENT_CONTEXT(co, cl) ((cl && cl->type == OB_CLIENT_TYPE_DESKTOP) ? \ - co == OB_FRAME_CONTEXT_ROOT : \ + co == OB_FRAME_CONTEXT_DESKTOP : \ co == OB_FRAME_CONTEXT_CLIENT) /* Array of GSList*s of PointerBinding*s. */ @@ -38,7 +40,7 @@ void mouse_grab_for_client(ObClient *client, gboolean grab) int mode; unsigned int mask; - if (i == OB_FRAME_CONTEXT_FRAME) { + if (FRAME_CONTEXT(i, client)) { win = client->frame->window; mode = GrabModeAsync; mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; @@ -51,7 +53,8 @@ void mouse_grab_for_client(ObClient *client, gboolean grab) } else continue; if (grab) - grab_button_full(b->button, b->state, win, mask, mode, None); + grab_button_full(b->button, b->state, win, mask, mode, + OB_CURSOR_NONE); else ungrab_button(b->button, b->state, win); } @@ -85,6 +88,7 @@ static void clearall() g_free(b); } g_slist_free(bound_contexts[i]); + bound_contexts[i] = NULL; } } @@ -115,21 +119,9 @@ static gboolean fire_button(ObMouseAction a, ObFrameContext context, act->data.showmenu.y = y; } - if (act->func == action_desktop_dir) - { - act->data.desktopdir.final = FALSE; - act->data.desktopdir.cancel = FALSE; - } - if (act->func == action_send_to_desktop_dir) - { - act->data.sendtodir.final = FALSE; - act->data.sendtodir.cancel = FALSE; - } - - if (config_desktop_popup && - (act->func == action_desktop_dir || - act->func == action_send_to_desktop_dir)) - { + if (act->data.any.interactive) { + act->data.inter.cancel = FALSE; + act->data.inter.final = FALSE; keyboard_interactive_grab(state, c, context, act); } @@ -356,7 +348,12 @@ gboolean mouse_bind(char *buttonstr, char *contextstr, ObMouseAction mact, } } - grab_all_clients(FALSE); + /* when there are no modifiers in the binding, then the action cannot + be interactive */ + if (!state && action->data.any.interactive) { + action->data.any.interactive = FALSE; + action->data.inter.final = TRUE; + } /* add the binding */ b = g_new0(ObMouseBinding, 1); @@ -365,16 +362,15 @@ gboolean mouse_bind(char *buttonstr, char *contextstr, ObMouseAction mact, b->actions[mact] = g_slist_append(NULL, action); bound_contexts[context] = g_slist_append(bound_contexts[context], b); - grab_all_clients(TRUE); - return TRUE; } -void mouse_startup() +void mouse_startup(gboolean reconfig) { + grab_all_clients(TRUE); } -void mouse_shutdown() +void mouse_shutdown(gboolean reconfig) { grab_all_clients(FALSE); clearall();