eis: Rebuild absolute pointers when any viewport changes
This fixes remote desktop client side resize via changing virtual monitor stream sizes. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
This commit is contained in:
parent
1a1a16324b
commit
15a3c47df5
@ -20,11 +20,26 @@
|
||||
|
||||
#include "backends/meta-eis-viewport.h"
|
||||
|
||||
enum
|
||||
{
|
||||
VIEWPORT_CHANGED,
|
||||
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
static guint signals[N_SIGNALS];
|
||||
|
||||
G_DEFINE_INTERFACE (MetaEisViewport, meta_eis_viewport, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
meta_eis_viewport_default_init (MetaEisViewportInterface *iface)
|
||||
{
|
||||
signals[VIEWPORT_CHANGED] =
|
||||
g_signal_new ("viewport-changed",
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -78,3 +93,9 @@ meta_eis_viewport_transform_coordinate (MetaEisViewport *viewport,
|
||||
out_x,
|
||||
out_y);
|
||||
}
|
||||
|
||||
void
|
||||
meta_eis_viewport_notify_changed (MetaEisViewport *viewport)
|
||||
{
|
||||
g_signal_emit (viewport, signals[VIEWPORT_CHANGED], 0);
|
||||
}
|
||||
|
@ -68,3 +68,5 @@ gboolean meta_eis_viewport_transform_coordinate (MetaEisViewport *viewport,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y);
|
||||
|
||||
void meta_eis_viewport_notify_changed (MetaEisViewport *viewport);
|
||||
|
@ -315,18 +315,29 @@ meta_eis_get_device_types (MetaEis *eis)
|
||||
return eis->device_types;
|
||||
}
|
||||
|
||||
static void
|
||||
on_viewport_changed (MetaEisViewport *viewport,
|
||||
MetaEis *eis)
|
||||
{
|
||||
g_signal_emit (eis, signals[VIEWPORTS_CHANGED], 0);
|
||||
}
|
||||
|
||||
void
|
||||
meta_eis_add_viewport (MetaEis *eis,
|
||||
MetaEisViewport *viewport)
|
||||
{
|
||||
eis->viewports = g_list_append (eis->viewports, viewport);
|
||||
g_signal_emit (eis, signals[VIEWPORTS_CHANGED], 0);
|
||||
|
||||
g_signal_connect (viewport, "viewport-changed",
|
||||
G_CALLBACK (on_viewport_changed), eis);
|
||||
}
|
||||
|
||||
void
|
||||
meta_eis_remove_viewport (MetaEis *eis,
|
||||
MetaEisViewport *viewport)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (viewport, on_viewport_changed, eis);
|
||||
eis->viewports = g_list_remove (eis->viewports, viewport);
|
||||
g_signal_emit (eis, signals[VIEWPORTS_CHANGED], 0);
|
||||
}
|
||||
@ -335,6 +346,16 @@ void
|
||||
meta_eis_take_viewports (MetaEis *eis,
|
||||
GList *viewports)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = viewports; l; l = l->next)
|
||||
{
|
||||
MetaEisViewport *viewport = l->data;
|
||||
|
||||
g_signal_connect (viewport, "viewport-changed",
|
||||
G_CALLBACK (on_viewport_changed), eis);
|
||||
}
|
||||
|
||||
eis->viewports = g_list_concat (eis->viewports, viewports);
|
||||
g_signal_emit (eis, signals[VIEWPORTS_CHANGED], 0);
|
||||
}
|
||||
@ -342,6 +363,15 @@ meta_eis_take_viewports (MetaEis *eis,
|
||||
void
|
||||
meta_eis_remove_all_viewports (MetaEis *eis)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = eis->viewports; l; l = l->next)
|
||||
{
|
||||
MetaEisViewport *viewport = l->data;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (viewport, on_viewport_changed, eis);
|
||||
}
|
||||
|
||||
g_clear_pointer (&eis->viewports, g_list_free);
|
||||
g_signal_emit (eis, signals[VIEWPORTS_CHANGED], 0);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "backends/meta-crtc-mode.h"
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
#include "backends/meta-eis-viewport.h"
|
||||
#include "backends/meta-monitor.h"
|
||||
#include "backends/meta-output.h"
|
||||
#include "backends/meta-screen-cast-session.h"
|
||||
@ -243,10 +244,13 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
|
||||
{
|
||||
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (virtual_src);
|
||||
MetaStage *stage = META_STAGE (stage_from_src (src));
|
||||
MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
|
||||
|
||||
meta_stage_remove_watch (stage, virtual_src->watch);
|
||||
virtual_src->watch = NULL;
|
||||
add_watch (virtual_src);
|
||||
|
||||
meta_eis_viewport_notify_changed (META_EIS_VIEWPORT (stream));
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user