X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmouse.c;h=b2893cee6814afd151b35d807f9f85e36eaeb6ac;hb=0dc7eca4cdfff6425e19a0bace0f9ae8834d04e8;hp=5a9fe170b8c018d9108f80468c91b72526f91325;hpb=6c8acc079a9cbb40245e5df4b50b3f8b9c17cf83;p=chaz%2Fopenbox diff --git a/openbox/mouse.c b/openbox/mouse.c index 5a9fe170..b2893cee 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -22,7 +22,6 @@ #include "actions.h" #include "event.h" #include "client.h" -#include "prop.h" #include "grab.h" #include "frame.h" #include "translate.h" @@ -225,6 +224,17 @@ void mouse_event(ObClient *client, XEvent *e) button = e->xbutton.button; state = e->xbutton.state; + /* if the binding was in a client context, then we need to call + XAllowEvents with ReplayPointer at some point, to send the event + through to the client. when this happens though depends. if + windows are going to be moved on screen, then the click will end + up going somewhere wrong, so have the action system perform the + ReplayPointer for us if that is the case. */ + if (CLIENT_CONTEXT(context, client)) + actions_set_need_pointer_replay_before_move(TRUE); + else + actions_set_need_pointer_replay_before_move(FALSE); + fire_binding(OB_MOUSE_ACTION_PRESS, context, client, e->xbutton.state, e->xbutton.button, @@ -235,11 +245,14 @@ void mouse_event(ObClient *client, XEvent *e) if (grab_on_pointer()) button = 0; - if (CLIENT_CONTEXT(context, client)) { - /* Replay the event, so it goes to the client*/ - XAllowEvents(ob_display, ReplayPointer, event_curtime); - /* Fall through to the release case! */ - } else + /* replay the pointer event if it hasn't been replayed yet (i.e. no + windows were moved) */ + if (actions_get_need_pointer_replay_before_move()) + XAllowEvents(obt_display, ReplayPointer, event_curtime); + + /* in the client context, we won't get a button release because of the + way it is grabbed, so just fake one */ + if (!CLIENT_CONTEXT(context, client)) break; case ButtonRelease: @@ -258,7 +271,7 @@ void mouse_event(ObClient *client, XEvent *e) guint ujunk, b, w, h; /* this can cause errors to occur when the window closes */ obt_display_ignore_errors(TRUE); - junk1 = XGetGeometry(ob_display, e->xbutton.window, + junk1 = XGetGeometry(obt_display, e->xbutton.window, &wjunk, &junk1, &junk2, &w, &h, &b, &ujunk); obt_display_ignore_errors(FALSE); if (junk1) {