backend: Initialize cursor renderer position too
This means initializing the pointer position in MetaSeatImpl synchronously too, otherwise it's not guaranteed querying the seat state will result in the expected position. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3071>
This commit is contained in:
parent
0b0f863428
commit
63767df59a
@ -271,6 +271,7 @@ init_pointer_position (MetaBackend *backend)
|
|||||||
{
|
{
|
||||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||||
MetaMonitorManager *monitor_manager = priv->monitor_manager;
|
MetaMonitorManager *monitor_manager = priv->monitor_manager;
|
||||||
|
MetaCursorRenderer *cursor_renderer;
|
||||||
ClutterSeat *seat = priv->default_seat;
|
ClutterSeat *seat = priv->default_seat;
|
||||||
MetaLogicalMonitor *primary;
|
MetaLogicalMonitor *primary;
|
||||||
|
|
||||||
@ -282,6 +283,9 @@ init_pointer_position (MetaBackend *backend)
|
|||||||
clutter_seat_init_pointer_position (seat,
|
clutter_seat_init_pointer_position (seat,
|
||||||
primary->rect.x + primary->rect.width * 0.9,
|
primary->rect.x + primary->rect.width * 0.9,
|
||||||
primary->rect.y + primary->rect.height * 0.9);
|
primary->rect.y + primary->rect.height * 0.9);
|
||||||
|
|
||||||
|
cursor_renderer = meta_backend_get_cursor_renderer (backend);
|
||||||
|
meta_cursor_renderer_update_position (cursor_renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -3165,21 +3165,33 @@ meta_seat_impl_warp_pointer (MetaSeatImpl *seat_impl,
|
|||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
graphene_point_t position;
|
||||||
|
gboolean done;
|
||||||
|
GMutex mutex;
|
||||||
|
GCond cond;
|
||||||
|
} InitPointerPositionData;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
init_pointer_position_in_impl (GTask *task)
|
init_pointer_position_in_impl (GTask *task)
|
||||||
{
|
{
|
||||||
MetaSeatImpl *seat_impl = g_task_get_source_object (task);
|
MetaSeatImpl *seat_impl = g_task_get_source_object (task);
|
||||||
|
InitPointerPositionData *data = g_task_get_task_data (task);
|
||||||
MetaInputDeviceNative *core_pointer =
|
MetaInputDeviceNative *core_pointer =
|
||||||
META_INPUT_DEVICE_NATIVE (seat_impl->core_pointer);
|
META_INPUT_DEVICE_NATIVE (seat_impl->core_pointer);
|
||||||
graphene_point_t *point;
|
|
||||||
|
|
||||||
point = g_task_get_task_data (task);
|
seat_impl->pointer_x = data->position.x;
|
||||||
seat_impl->pointer_x = point->x;
|
seat_impl->pointer_y = data->position.y;
|
||||||
seat_impl->pointer_y = point->y;
|
core_pointer->pointer_x = data->position.x;
|
||||||
core_pointer->pointer_x = point->x;
|
core_pointer->pointer_y = data->position.y;
|
||||||
core_pointer->pointer_y = point->y;
|
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
|
|
||||||
|
g_mutex_lock (&data->mutex);
|
||||||
|
data->done = TRUE;
|
||||||
|
g_cond_signal (&data->cond);
|
||||||
|
g_mutex_unlock (&data->mutex);
|
||||||
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3188,17 +3200,26 @@ meta_seat_impl_init_pointer_position (MetaSeatImpl *seat_impl,
|
|||||||
float x,
|
float x,
|
||||||
float y)
|
float y)
|
||||||
{
|
{
|
||||||
graphene_point_t *point;
|
InitPointerPositionData data = {};
|
||||||
g_autoptr (GTask) task = NULL;
|
g_autoptr (GTask) task = NULL;
|
||||||
|
|
||||||
point = graphene_point_alloc ();
|
data.position.x = x;
|
||||||
point->x = x;
|
data.position.y = y;
|
||||||
point->y = y;
|
g_mutex_init (&data.mutex);
|
||||||
|
g_cond_init (&data.cond);
|
||||||
|
|
||||||
task = g_task_new (seat_impl, NULL, NULL, NULL);
|
task = g_task_new (seat_impl, NULL, NULL, NULL);
|
||||||
g_task_set_task_data (task, point, (GDestroyNotify) graphene_point_free);
|
g_task_set_task_data (task, &data, NULL);
|
||||||
meta_seat_impl_run_input_task (seat_impl, task,
|
meta_seat_impl_run_input_task (seat_impl, task,
|
||||||
(GSourceFunc) init_pointer_position_in_impl);
|
(GSourceFunc) init_pointer_position_in_impl);
|
||||||
|
|
||||||
|
g_mutex_lock (&data.mutex);
|
||||||
|
while (!data.done)
|
||||||
|
g_cond_wait (&data.cond, &data.mutex);
|
||||||
|
g_mutex_unlock (&data.mutex);
|
||||||
|
|
||||||
|
g_mutex_clear (&data.mutex);
|
||||||
|
g_cond_clear (&data.cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user