events: Handle move/resize grab ops as a first special case

This commit is contained in:
Jasper St. Pierre 2014-04-21 11:21:19 -04:00
parent 7c0a3dfeb8
commit 813206393a
3 changed files with 20 additions and 33 deletions

View File

@ -1941,6 +1941,17 @@ meta_display_handle_event (MetaDisplay *display,
} }
} }
if (display->grab_window == window &&
meta_grab_op_is_moving_or_resizing (display->grab_op))
{
if (meta_window_handle_mouse_grab_op_event (window, event))
{
bypass_clutter = TRUE;
bypass_wayland = TRUE;
goto out;
}
}
switch (event->type) switch (event->type)
{ {
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
@ -1949,14 +1960,6 @@ meta_display_handle_event (MetaDisplay *display,
display->overlay_key_only_pressed = FALSE; display->overlay_key_only_pressed = FALSE;
if (display->grab_window == window &&
meta_grab_op_is_moving_or_resizing (display->grab_op))
{
meta_window_handle_mouse_grab_op_event (window, event);
bypass_clutter = TRUE;
bypass_wayland = TRUE;
}
if (window && display->grab_op == META_GRAB_OP_NONE) if (window && display->grab_op == META_GRAB_OP_NONE)
{ {
ClutterModifierType grab_mask; ClutterModifierType grab_mask;
@ -2111,26 +2114,9 @@ meta_display_handle_event (MetaDisplay *display,
break; break;
display->overlay_key_only_pressed = FALSE; display->overlay_key_only_pressed = FALSE;
if (display->grab_window == window &&
meta_grab_op_is_moving_or_resizing (display->grab_op))
{
meta_window_handle_mouse_grab_op_event (window, event);
bypass_clutter = TRUE;
bypass_wayland = TRUE;
}
break; break;
case CLUTTER_MOTION:
if (grab_op_should_block_mouse_events (display->grab_op))
break;
if (display->grab_window == window && case CLUTTER_MOTION:
meta_grab_op_is_moving_or_resizing (display->grab_op))
{
meta_window_handle_mouse_grab_op_event (window, event);
bypass_clutter = TRUE;
bypass_wayland = TRUE;
}
break; break;
case CLUTTER_KEY_PRESS: case CLUTTER_KEY_PRESS:
@ -2152,6 +2138,7 @@ meta_display_handle_event (MetaDisplay *display,
break; break;
} }
out:
/* If the compositor has a grab, don't pass that through to Wayland */ /* If the compositor has a grab, don't pass that through to Wayland */
if (display->grab_op == META_GRAB_OP_COMPOSITOR) if (display->grab_op == META_GRAB_OP_COMPOSITOR)
bypass_wayland = TRUE; bypass_wayland = TRUE;

View File

@ -643,8 +643,8 @@ void meta_window_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value); gint64 new_counter_value);
#endif /* HAVE_XSYNC */ #endif /* HAVE_XSYNC */
void meta_window_handle_mouse_grab_op_event (MetaWindow *window, gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
const ClutterEvent *event); const ClutterEvent *event);
GList* meta_window_get_workspaces (MetaWindow *window); GList* meta_window_get_workspaces (MetaWindow *window);

View File

@ -7564,7 +7564,7 @@ end_grab_op (MetaWindow *window,
meta_display_end_grab_op (window->display, event->any.time); meta_display_end_grab_op (window->display, event->any.time);
} }
void gboolean
meta_window_handle_mouse_grab_op_event (MetaWindow *window, meta_window_handle_mouse_grab_op_event (MetaWindow *window,
const ClutterEvent *event) const ClutterEvent *event)
{ {
@ -7582,7 +7582,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
{ {
end_grab_op (window, event); end_grab_op (window, event);
} }
break; return TRUE;
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
if (event->button.button == 1 || if (event->button.button == 1 ||
@ -7590,7 +7590,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
{ {
end_grab_op (window, event); end_grab_op (window, event);
} }
break; return TRUE;
case CLUTTER_MOTION: case CLUTTER_MOTION:
meta_display_check_threshold_reached (window->display, meta_display_check_threshold_reached (window->display,
@ -7611,10 +7611,10 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
event->motion.y, event->motion.y,
FALSE); FALSE);
} }
break; return TRUE;
default: default:
break; return FALSE;
} }
} }