mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
remote-desktop/session: Handle unable to transform coordinate gracefully
There may be a race between the ability to turn stream relative input coordinates and turning them into screen coordinates, due to the future scenario where the entity backing a stream is created and managed ad-hoc depending on PipeWire stream negotiations. When an input event is sent during this time, drop it. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
parent
9b1b4eb843
commit
688280f82d
@ -678,11 +678,17 @@ handle_notify_pointer_motion_absolute (MetaDBusRemoteDesktopSession *skeleton,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y);
|
||||
|
||||
clutter_virtual_input_device_notify_absolute_motion (session->virtual_pointer,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
abs_x, abs_y);
|
||||
if (meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y))
|
||||
{
|
||||
clutter_virtual_input_device_notify_absolute_motion (session->virtual_pointer,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
abs_x, abs_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
||||
"Dropping early absolute pointer motion (%f, %f)", x, y);
|
||||
}
|
||||
|
||||
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_absolute (skeleton,
|
||||
invocation);
|
||||
@ -731,12 +737,18 @@ handle_notify_touch_down (MetaDBusRemoteDesktopSession *skeleton,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y);
|
||||
|
||||
clutter_virtual_input_device_notify_touch_down (session->virtual_touchscreen,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
slot,
|
||||
abs_x, abs_y);
|
||||
if (meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y))
|
||||
{
|
||||
clutter_virtual_input_device_notify_touch_down (session->virtual_touchscreen,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
slot,
|
||||
abs_x, abs_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
||||
"Dropping early touch down (%f, %f)", x, y);
|
||||
}
|
||||
|
||||
meta_dbus_remote_desktop_session_complete_notify_touch_down (skeleton,
|
||||
invocation);
|
||||
@ -786,12 +798,18 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y);
|
||||
|
||||
clutter_virtual_input_device_notify_touch_motion (session->virtual_touchscreen,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
slot,
|
||||
abs_x, abs_y);
|
||||
if (meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y))
|
||||
{
|
||||
clutter_virtual_input_device_notify_touch_motion (session->virtual_touchscreen,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
slot,
|
||||
abs_x, abs_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
||||
"Dropping early touch motion (%f, %f)", x, y);
|
||||
}
|
||||
|
||||
meta_dbus_remote_desktop_session_complete_notify_touch_motion (skeleton,
|
||||
invocation);
|
||||
|
@ -148,7 +148,7 @@ meta_screen_cast_area_stream_set_parameters (MetaScreenCastStream *stream,
|
||||
area_stream->area.height));
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
meta_screen_cast_area_stream_transform_position (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
@ -160,6 +160,8 @@ meta_screen_cast_area_stream_transform_position (MetaScreenCastStream *stream,
|
||||
|
||||
*x = area_stream->area.x + (int) roundf (stream_x / area_stream->scale);
|
||||
*y = area_stream->area.y + (int) roundf (stream_y / area_stream->scale);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -184,7 +184,7 @@ meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream,
|
||||
logical_monitor_layout.height));
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
meta_screen_cast_monitor_stream_transform_position (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
@ -200,6 +200,8 @@ meta_screen_cast_monitor_stream_transform_position (MetaScreenCastStream *stream
|
||||
|
||||
*x = logical_monitor_layout.x + stream_x;
|
||||
*y = logical_monitor_layout.y + stream_y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -177,18 +177,16 @@ meta_screen_cast_stream_get_src (MetaScreenCastStream *stream)
|
||||
return priv->src;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
meta_screen_cast_stream_transform_position (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
META_SCREEN_CAST_STREAM_GET_CLASS (stream)->transform_position (stream,
|
||||
stream_x,
|
||||
stream_y,
|
||||
x,
|
||||
y);
|
||||
MetaScreenCastStreamClass *klass = META_SCREEN_CAST_STREAM_GET_CLASS (stream);
|
||||
|
||||
return klass->transform_position (stream, stream_x, stream_y, x, y);
|
||||
}
|
||||
|
||||
MetaScreenCastCursorMode
|
||||
|
@ -43,11 +43,11 @@ struct _MetaScreenCastStreamClass
|
||||
GError **error);
|
||||
void (* set_parameters) (MetaScreenCastStream *stream,
|
||||
GVariantBuilder *parameters_builder);
|
||||
void (* transform_position) (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
double *x,
|
||||
double *y);
|
||||
gboolean (* transform_position) (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
double *x,
|
||||
double *y);
|
||||
};
|
||||
|
||||
MetaScreenCastSession * meta_screen_cast_stream_get_session (MetaScreenCastStream *stream);
|
||||
@ -61,11 +61,11 @@ char * meta_screen_cast_stream_get_object_path (MetaScreenCastStream *stream);
|
||||
|
||||
MetaScreenCastStreamSrc * meta_screen_cast_stream_get_src (MetaScreenCastStream *stream);
|
||||
|
||||
void meta_screen_cast_stream_transform_position (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
double *x,
|
||||
double *y);
|
||||
gboolean meta_screen_cast_stream_transform_position (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
double *x,
|
||||
double *y);
|
||||
|
||||
MetaScreenCastCursorMode meta_screen_cast_stream_get_cursor_mode (MetaScreenCastStream *stream);
|
||||
|
||||
|
@ -128,7 +128,7 @@ meta_screen_cast_window_stream_set_parameters (MetaScreenCastStream *stream,
|
||||
window_stream->logical_height));
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
meta_screen_cast_window_stream_transform_position (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
@ -145,6 +145,7 @@ meta_screen_cast_window_stream_transform_position (MetaScreenCastStream *stream,
|
||||
stream_y,
|
||||
x,
|
||||
y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user