mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
display: Get the backend from the context
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
This commit is contained in:
parent
dd6afb28ff
commit
36de8baf55
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 =
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user