[mutter] display: Get the backend from the context
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] display: Get the backend from the context
- Date: Fri, 29 Apr 2022 19:27:34 +0000 (UTC)
commit 36de8baf5540333dab84cad856f85d7d253f1e20
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Apr 27 12:12:33 2022 +0200
display: Get the backend from the context
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
.../clutter/clutter-input-pointer-a11y-private.h | 3 ++-
clutter/clutter/clutter-input-pointer-a11y.c | 6 +++--
clutter/clutter/clutter-main.c | 1 -
src/core/display.c | 2 +-
src/core/events.c | 30 +++++++++++++++-------
5 files changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/clutter/clutter/clutter-input-pointer-a11y-private.h
b/clutter/clutter/clutter-input-pointer-a11y-private.h
index a66ddeac9d..d7f4655012 100644
--- a/clutter/clutter/clutter-input-pointer-a11y-private.h
+++ b/clutter/clutter/clutter-input-pointer-a11y-private.h
@@ -43,7 +43,8 @@ CLUTTER_EXPORT
gboolean _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device);
CLUTTER_EXPORT
-void _clutter_input_pointer_a11y_maybe_handle_event (ClutterEvent *event);
+void clutter_input_pointer_a11y_update (ClutterInputDevice *device,
+ const ClutterEvent *event);
G_END_DECLS
diff --git a/clutter/clutter/clutter-input-pointer-a11y.c b/clutter/clutter/clutter-input-pointer-a11y.c
index cfee58e55f..a74aa4cc22 100644
--- a/clutter/clutter/clutter-input-pointer-a11y.c
+++ b/clutter/clutter/clutter-input-pointer-a11y.c
@@ -730,13 +730,15 @@ _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device)
}
void
-_clutter_input_pointer_a11y_maybe_handle_event (ClutterEvent *event)
+clutter_input_pointer_a11y_update (ClutterInputDevice *device,
+ const ClutterEvent *event)
{
- ClutterInputDevice *device = clutter_event_get_device (event);
ClutterMainContext *clutter_context;
ClutterBackend *backend;
+ g_return_if_fail (clutter_event_get_device (event) == device);
+
if (!_clutter_is_input_pointer_a11y_enabled (device))
return;
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index a2ee338b66..5b01783e5e 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -802,7 +802,6 @@ clutter_do_event (ClutterEvent *event)
context->current_event = g_slist_prepend (context->current_event, event);
- _clutter_input_pointer_a11y_maybe_handle_event (event);
if (_clutter_event_process_filters (event, event_actor))
{
context->current_event =
diff --git a/src/core/display.c b/src/core/display.c
index a1c5c2d912..058d09f2a5 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -829,12 +829,12 @@ MetaDisplay *
meta_display_new (MetaContext *context,
GError **error)
{
+ MetaBackend *backend = meta_context_get_backend (context);
MetaDisplay *display;
MetaDisplayPrivate *priv;
int i;
guint32 timestamp;
Window old_active_xwindow = None;
- MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager;
MetaSettings *settings;
diff --git a/src/core/events.c b/src/core/events.c
index 0dc3a73222..d5a9a93da3 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -61,9 +61,10 @@ typedef enum
} EventsUnfreezeMethod;
static gboolean
-stage_has_key_focus (void)
+stage_has_key_focus (MetaDisplay *display)
{
- MetaBackend *backend = meta_get_backend ();
+ MetaContext *context = meta_display_get_context (display);
+ MetaBackend *backend = meta_context_get_backend (context);
ClutterActor *stage = meta_backend_get_stage (backend);
return clutter_stage_get_key_focus (CLUTTER_STAGE (stage)) == stage;
@@ -92,7 +93,10 @@ get_window_for_event (MetaDisplay *display,
/* Always use the key focused window for key events. */
if (IS_KEY_EVENT (event))
- return stage_has_key_focus () ? display->focus_window : NULL;
+ {
+ return stage_has_key_focus (display) ? display->focus_window
+ : NULL;
+ }
window_actor = meta_window_actor_from_actor (event_actor);
if (window_actor)
@@ -112,9 +116,11 @@ get_window_for_event (MetaDisplay *display,
}
static void
-handle_idletime_for_event (const ClutterEvent *event)
+handle_idletime_for_event (MetaDisplay *display,
+ const ClutterEvent *event)
{
- MetaBackend *backend = meta_get_backend ();
+ MetaContext *context = meta_display_get_context (display);
+ MetaBackend *backend = meta_context_get_backend (context);
MetaIdleManager *idle_manager;
if (clutter_event_get_device (event) == NULL)
@@ -144,7 +150,8 @@ sequence_is_pointer_emulated (MetaDisplay *display,
return TRUE;
#ifdef HAVE_NATIVE_BACKEND
- MetaBackend *backend = meta_get_backend ();
+ MetaContext *context = meta_display_get_context (display);
+ MetaBackend *backend = meta_context_get_backend (context);
/* When using Clutter's native input backend there is no concept of
* pointer emulating sequence, we still must make up our own to be
@@ -213,7 +220,9 @@ meta_display_handle_event (MetaDisplay *display,
const ClutterEvent *event,
ClutterActor *event_actor)
{
- MetaBackend *backend = meta_get_backend ();
+ MetaContext *context = meta_display_get_context (display);
+ MetaBackend *backend = meta_context_get_backend (context);
+ ClutterInputDevice *device;
MetaWindow *window = NULL;
gboolean bypass_clutter = FALSE;
G_GNUC_UNUSED gboolean bypass_wayland = FALSE;
@@ -251,6 +260,9 @@ meta_display_handle_event (MetaDisplay *display,
}
}
+ device = clutter_event_get_device (event);
+ clutter_input_pointer_a11y_update (device, event);
+
sequence = clutter_event_get_event_sequence (event);
/* Set the pointer emulating sequence on touch begin, if eligible */
@@ -312,7 +324,7 @@ meta_display_handle_event (MetaDisplay *display,
if (event->type != CLUTTER_DEVICE_ADDED &&
event->type != CLUTTER_DEVICE_REMOVED)
- handle_idletime_for_event (event);
+ handle_idletime_for_event (display, event);
#ifdef HAVE_WAYLAND
if (wayland_compositor && event->type == CLUTTER_MOTION)
@@ -398,7 +410,7 @@ meta_display_handle_event (MetaDisplay *display,
*/
if (display->event_route == META_EVENT_ROUTE_NORMAL)
{
- if (IS_KEY_EVENT (event) && !stage_has_key_focus ())
+ if (IS_KEY_EVENT (event) && !stage_has_key_focus (display))
{
bypass_wayland = TRUE;
goto out;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]