backends: Move function definitions

These will be made private and called from different places. At the
moment there is no functional change here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
This commit is contained in:
Carlos Garnacho 2022-01-13 13:56:29 +01:00 committed by Marge Bot
parent 3ab59175c8
commit ecafc489c1

View File

@ -353,6 +353,58 @@ meta_backend_monitors_changed (MetaBackend *backend)
update_cursors (backend);
}
static gboolean
update_last_device (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaCursorTracker *cursor_tracker = priv->cursor_tracker;
ClutterInputDeviceType device_type;
priv->device_update_idle_id = 0;
device_type = clutter_input_device_get_device_type (priv->current_device);
g_signal_emit (backend, signals[LAST_DEVICE_CHANGED], 0,
priv->current_device);
switch (device_type)
{
case CLUTTER_KEYBOARD_DEVICE:
break;
case CLUTTER_TOUCHSCREEN_DEVICE:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
break;
default:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, TRUE);
break;
}
return G_SOURCE_REMOVE;
}
void
meta_backend_update_last_device (MetaBackend *backend,
ClutterInputDevice *device)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
if (priv->current_device == device)
return;
if (!device ||
clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_LOGICAL)
return;
g_set_object (&priv->current_device, device);
if (priv->device_update_idle_id == 0)
{
priv->device_update_idle_id =
g_idle_add ((GSourceFunc) update_last_device, backend);
g_source_set_name_by_id (priv->device_update_idle_id,
"[mutter] update_last_device");
}
}
static inline gboolean
determine_hotplug_pointer_visibility (ClutterSeat *seat)
{
@ -1410,58 +1462,6 @@ meta_backend_get_default_seat (MetaBackend *backend)
return priv->default_seat;
}
static gboolean
update_last_device (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaCursorTracker *cursor_tracker = priv->cursor_tracker;
ClutterInputDeviceType device_type;
priv->device_update_idle_id = 0;
device_type = clutter_input_device_get_device_type (priv->current_device);
g_signal_emit (backend, signals[LAST_DEVICE_CHANGED], 0,
priv->current_device);
switch (device_type)
{
case CLUTTER_KEYBOARD_DEVICE:
break;
case CLUTTER_TOUCHSCREEN_DEVICE:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
break;
default:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, TRUE);
break;
}
return G_SOURCE_REMOVE;
}
void
meta_backend_update_last_device (MetaBackend *backend,
ClutterInputDevice *device)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
if (priv->current_device == device)
return;
if (!device ||
clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_LOGICAL)
return;
g_set_object (&priv->current_device, device);
if (priv->device_update_idle_id == 0)
{
priv->device_update_idle_id =
g_idle_add ((GSourceFunc) update_last_device, backend);
g_source_set_name_by_id (priv->device_update_idle_id,
"[mutter] update_last_device");
}
}
MetaPointerConstraint *
meta_backend_get_client_pointer_constraint (MetaBackend *backend)
{