mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
pointer: Sync the focus surface instead of calling set_focus directly
set_focus is really meant to be an internal function, and sync_focus_surface should be able to be called at any time and get things right.
This commit is contained in:
parent
a0e038f34b
commit
c5033616e9
@ -65,6 +65,36 @@ unbind_resource (struct wl_resource *resource)
|
||||
wl_list_remove (wl_resource_get_link (resource));
|
||||
}
|
||||
|
||||
static void
|
||||
sync_focus_surface (MetaWaylandPointer *pointer)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
|
||||
switch (display->event_route)
|
||||
{
|
||||
case META_EVENT_ROUTE_WINDOW_OP:
|
||||
/* Don't update the focus surface while we're grabbing a window. */
|
||||
return;
|
||||
|
||||
case META_EVENT_ROUTE_COMPOSITOR_GRAB:
|
||||
/* The compositor has a grab, so remove our focus... */
|
||||
meta_wayland_pointer_set_focus (pointer, NULL);
|
||||
break;
|
||||
|
||||
case META_EVENT_ROUTE_NORMAL:
|
||||
case META_EVENT_ROUTE_WAYLAND_POPUP:
|
||||
{
|
||||
const MetaWaylandPointerGrabInterface *interface = pointer->grab->interface;
|
||||
interface->focus (pointer->grab, pointer->current);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
set_cursor_surface (MetaWaylandPointer *pointer,
|
||||
MetaWaylandSurface *surface)
|
||||
@ -179,7 +209,7 @@ default_grab_button (MetaWaylandPointerGrab *grab,
|
||||
}
|
||||
|
||||
if (pointer->button_count == 0 && event_type == CLUTTER_BUTTON_RELEASE)
|
||||
meta_wayland_pointer_set_focus (pointer, pointer->current);
|
||||
sync_focus_surface (pointer);
|
||||
}
|
||||
|
||||
static const MetaWaylandPointerGrabInterface default_pointer_grab_interface = {
|
||||
@ -247,36 +277,6 @@ count_buttons (const ClutterEvent *event)
|
||||
return count;
|
||||
}
|
||||
|
||||
static void
|
||||
sync_focus_surface (MetaWaylandPointer *pointer)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
|
||||
switch (display->event_route)
|
||||
{
|
||||
case META_EVENT_ROUTE_WINDOW_OP:
|
||||
/* Don't update the focus surface while we're grabbing a window. */
|
||||
return;
|
||||
|
||||
case META_EVENT_ROUTE_COMPOSITOR_GRAB:
|
||||
/* The compositor has a grab, so remove our focus... */
|
||||
meta_wayland_pointer_set_focus (pointer, NULL);
|
||||
break;
|
||||
|
||||
case META_EVENT_ROUTE_NORMAL:
|
||||
case META_EVENT_ROUTE_WAYLAND_POPUP:
|
||||
{
|
||||
const MetaWaylandPointerGrabInterface *interface = pointer->grab->interface;
|
||||
interface->focus (pointer->grab, pointer->current);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
repick_for_event (MetaWaylandPointer *pointer,
|
||||
const ClutterEvent *for_event)
|
||||
|
Loading…
Reference in New Issue
Block a user