mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 05:12:15 +00:00
events: Only get MetaWaylandCompositor once
We get the MetaWaylandCompositor a bunch of times, but we can do with getting it only once and then also replace the is_wayland_compositor() checks with a if (wayland_compositor). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2308>
This commit is contained in:
parent
a84d9b08bf
commit
8a11069dca
@ -220,6 +220,12 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
ClutterEventSequence *sequence;
|
ClutterEventSequence *sequence;
|
||||||
gboolean has_grab;
|
gboolean has_grab;
|
||||||
|
|
||||||
|
#ifdef HAVE_WAYLAND
|
||||||
|
MetaWaylandCompositor *wayland_compositor = NULL;
|
||||||
|
if (meta_is_wayland_compositor ())
|
||||||
|
wayland_compositor = meta_wayland_compositor_get_default ();
|
||||||
|
#endif
|
||||||
|
|
||||||
has_grab = stage_has_grab (display);
|
has_grab = stage_has_grab (display);
|
||||||
|
|
||||||
if (display->grabbed_in_clutter != has_grab)
|
if (display->grabbed_in_clutter != has_grab)
|
||||||
@ -227,7 +233,7 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
MetaCompositor *compositor = meta_display_get_compositor (display);
|
MetaCompositor *compositor = meta_display_get_compositor (display);
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
if (meta_is_wayland_compositor ())
|
if (wayland_compositor)
|
||||||
meta_display_sync_wayland_input_focus (display);
|
meta_display_sync_wayland_input_focus (display);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -268,12 +274,8 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
MetaWaylandCompositor *compositor = NULL;
|
if (wayland_compositor)
|
||||||
if (meta_is_wayland_compositor ())
|
meta_wayland_compositor_update (wayland_compositor, event);
|
||||||
{
|
|
||||||
compositor = meta_wayland_compositor_get_default ();
|
|
||||||
meta_wayland_compositor_update (compositor, event);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (event->type == CLUTTER_PAD_BUTTON_PRESS ||
|
if (event->type == CLUTTER_PAD_BUTTON_PRESS ||
|
||||||
@ -312,7 +314,7 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
handle_idletime_for_event (event);
|
handle_idletime_for_event (event);
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION)
|
if (wayland_compositor && event->type == CLUTTER_MOTION)
|
||||||
{
|
{
|
||||||
MetaCursorRenderer *cursor_renderer;
|
MetaCursorRenderer *cursor_renderer;
|
||||||
ClutterInputDevice *device;
|
ClutterInputDevice *device;
|
||||||
@ -513,13 +515,13 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
bypass_clutter = !bypass_wayland;
|
bypass_clutter = !bypass_wayland;
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
if (compositor && !bypass_wayland)
|
if (wayland_compositor && !bypass_wayland)
|
||||||
{
|
{
|
||||||
if (window && event->type == CLUTTER_MOTION &&
|
if (window && event->type == CLUTTER_MOTION &&
|
||||||
event->any.time != CLUTTER_CURRENT_TIME)
|
event->any.time != CLUTTER_CURRENT_TIME)
|
||||||
meta_window_check_alive_on_event (window, event->any.time);
|
meta_window_check_alive_on_event (window, event->any.time);
|
||||||
|
|
||||||
if (meta_wayland_compositor_handle_event (compositor, event))
|
if (meta_wayland_compositor_handle_event (wayland_compositor, event))
|
||||||
bypass_clutter = TRUE;
|
bypass_clutter = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user