From 38bef0a38bf907a54c193ab063b4830788398edc Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 9 Feb 2008 18:48:56 -0500 Subject: Make a pending ReplayPointer happen before moving/showing/hiding a window in an action. Commit c907f5af4ad16b1 broke kdesktop again, so we have to fix it at an even finer level. --- openbox/mouse.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'openbox/mouse.c') diff --git a/openbox/mouse.c b/openbox/mouse.c index 711317ec..6d532518 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -46,6 +46,9 @@ typedef struct { /* Array of GSList*s of ObMouseBinding*s. */ static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS]; +/* TRUE when we have a grab on the pointer and need to reply the pointer event + to send it to other applications */ +static gboolean replay_pointer_needed; ObFrameContext mouse_button_frame_context(ObFrameContext context, guint button, @@ -200,6 +203,15 @@ static gboolean fire_binding(ObMouseAction a, ObFrameContext context, return TRUE; } +void mouse_replay_pointer() +{ + if (replay_pointer_needed) { + /* replay the pointer event before any windows move */ + XAllowEvents(ob_display, ReplayPointer, event_curtime); + replay_pointer_needed = FALSE; + } +} + void mouse_event(ObClient *client, XEvent *e) { static Time ltime; @@ -229,12 +241,17 @@ void mouse_event(ObClient *client, XEvent *e) 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. */ + up going somewhere wrong, set that we need it, and if nothing + else causes the replay pointer to be run, then we will do it + after all the actions are finished. + + (We do it after all the actions because FocusIn interrupts + dragging for kdesktop, so if we send the button event now, and + then they get a focus event after, it breaks. Instead, wait to send + the button press until after the actions when possible.) + */ if (CLIENT_CONTEXT(context, client)) - actions_set_need_pointer_replay_before_move(TRUE); - else - actions_set_need_pointer_replay_before_move(FALSE); + replay_pointer_needed = TRUE; fire_binding(OB_MOUSE_ACTION_PRESS, context, client, e->xbutton.state, @@ -248,8 +265,7 @@ void mouse_event(ObClient *client, XEvent *e) /* 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(ob_display, ReplayPointer, event_curtime); + mouse_replay_pointer(); /* in the client context, we won't get a button release because of the way it is grabbed, so just fake one */ -- cgit v1.2.3 From 83c739df9117cde1982a1fec4487ea1a3eb6ebf0 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sun, 10 Feb 2008 07:54:21 +0100 Subject: typo in comment --- openbox/mouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbox/mouse.c') diff --git a/openbox/mouse.c b/openbox/mouse.c index 6d532518..f2e13cdf 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -46,7 +46,7 @@ typedef struct { /* Array of GSList*s of ObMouseBinding*s. */ static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS]; -/* TRUE when we have a grab on the pointer and need to reply the pointer event +/* TRUE when we have a grab on the pointer and need to replay the pointer event to send it to other applications */ static gboolean replay_pointer_needed; -- cgit v1.2.3