mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 21:02:14 +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);
|
gboolean _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -730,13 +730,15 @@ _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
ClutterMainContext *clutter_context;
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
|
|
||||||
|
g_return_if_fail (clutter_event_get_device (event) == device);
|
||||||
|
|
||||||
if (!_clutter_is_input_pointer_a11y_enabled (device))
|
if (!_clutter_is_input_pointer_a11y_enabled (device))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -802,7 +802,6 @@ clutter_do_event (ClutterEvent *event)
|
|||||||
|
|
||||||
context->current_event = g_slist_prepend (context->current_event, 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))
|
if (_clutter_event_process_filters (event, event_actor))
|
||||||
{
|
{
|
||||||
context->current_event =
|
context->current_event =
|
||||||
|
@ -829,12 +829,12 @@ MetaDisplay *
|
|||||||
meta_display_new (MetaContext *context,
|
meta_display_new (MetaContext *context,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
MetaBackend *backend = meta_context_get_backend (context);
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
MetaDisplayPrivate *priv;
|
MetaDisplayPrivate *priv;
|
||||||
int i;
|
int i;
|
||||||
guint32 timestamp;
|
guint32 timestamp;
|
||||||
Window old_active_xwindow = None;
|
Window old_active_xwindow = None;
|
||||||
MetaBackend *backend = meta_get_backend ();
|
|
||||||
MetaMonitorManager *monitor_manager;
|
MetaMonitorManager *monitor_manager;
|
||||||
MetaSettings *settings;
|
MetaSettings *settings;
|
||||||
|
|
||||||
|
@ -61,9 +61,10 @@ typedef enum
|
|||||||
} EventsUnfreezeMethod;
|
} EventsUnfreezeMethod;
|
||||||
|
|
||||||
static gboolean
|
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);
|
ClutterActor *stage = meta_backend_get_stage (backend);
|
||||||
|
|
||||||
return clutter_stage_get_key_focus (CLUTTER_STAGE (stage)) == stage;
|
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. */
|
/* Always use the key focused window for key events. */
|
||||||
if (IS_KEY_EVENT (event))
|
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);
|
window_actor = meta_window_actor_from_actor (event_actor);
|
||||||
if (window_actor)
|
if (window_actor)
|
||||||
@ -112,9 +116,11 @@ get_window_for_event (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
MetaIdleManager *idle_manager;
|
||||||
|
|
||||||
if (clutter_event_get_device (event) == NULL)
|
if (clutter_event_get_device (event) == NULL)
|
||||||
@ -144,7 +150,8 @@ sequence_is_pointer_emulated (MetaDisplay *display,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
#ifdef HAVE_NATIVE_BACKEND
|
#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
|
/* When using Clutter's native input backend there is no concept of
|
||||||
* pointer emulating sequence, we still must make up our own to be
|
* 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,
|
const ClutterEvent *event,
|
||||||
ClutterActor *event_actor)
|
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;
|
MetaWindow *window = NULL;
|
||||||
gboolean bypass_clutter = FALSE;
|
gboolean bypass_clutter = FALSE;
|
||||||
G_GNUC_UNUSED gboolean bypass_wayland = 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);
|
sequence = clutter_event_get_event_sequence (event);
|
||||||
|
|
||||||
/* Set the pointer emulating sequence on touch begin, if eligible */
|
/* 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 &&
|
if (event->type != CLUTTER_DEVICE_ADDED &&
|
||||||
event->type != CLUTTER_DEVICE_REMOVED)
|
event->type != CLUTTER_DEVICE_REMOVED)
|
||||||
handle_idletime_for_event (event);
|
handle_idletime_for_event (display, event);
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
if (wayland_compositor && event->type == CLUTTER_MOTION)
|
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 (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;
|
bypass_wayland = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
|
Loading…
Reference in New Issue
Block a user