mirror of
https://github.com/brl/mutter.git
synced 2025-08-06 08:34:41 +00:00
display: Establish a separate state variable for routing events
We've long used a switch statement on the grab operation to determine where events should go. The issue with MetaGrabOp is that it's a mixture of a few different things, including event routing, state management, and the behavior to choose during operations. This leads to poorly defined event routing and hard-to-follow logic, since it's sometimes unclear what should point where, and our utility methods for determining grab operations apart can be poorly named. To fix this, establish the concept of a "event route", which describes where events should be routed to.
This commit is contained in:
@@ -246,14 +246,20 @@ sync_focus_surface (MetaWaylandPointer *pointer)
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaWaylandSurface *focus_surface;
|
||||
|
||||
/* Don't update the focus surface while we have a move/resize grab. */
|
||||
if (meta_grab_op_is_moving_or_resizing (display->grab_op))
|
||||
return;
|
||||
switch (display->event_route)
|
||||
{
|
||||
case META_EVENT_ROUTE_WINDOW_OP:
|
||||
/* Don't update the focus surface while we're grabbing a window. */
|
||||
return;
|
||||
|
||||
if (!meta_grab_op_windows_are_interactable (display->grab_op))
|
||||
focus_surface = NULL;
|
||||
else
|
||||
focus_surface = pointer->current;
|
||||
case META_EVENT_ROUTE_COMPOSITOR_GRAB:
|
||||
/* The compositor has focus, so remove our focus... */
|
||||
focus_surface = NULL;
|
||||
|
||||
case META_EVENT_ROUTE_NORMAL:
|
||||
case META_EVENT_ROUTE_WAYLAND_POPUP:
|
||||
focus_surface = pointer->current;
|
||||
}
|
||||
|
||||
if (focus_surface != pointer->focus_surface)
|
||||
{
|
||||
|
Reference in New Issue
Block a user