[gnome-remote-desktop] session: Require stream for absolute pointer motion events
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] session: Require stream for absolute pointer motion events
- Date: Tue, 15 Feb 2022 10:08:11 +0000 (UTC)
commit 5fbf2b547786f1b999faeaae8dd202775be24a01
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Sun Dec 5 12:13:59 2021 +0100
session: Require stream for absolute pointer motion events
When dealing with multi-monitor setups in the future, and
gnome-remote-desktop gets an absolute pointer motion event, it needs to
somehow identify the stream.
The session class won't be able to choose the correct stream in
multi-monitor setups, the respective backend (RDP or VNC), however,
can.
So, require the stream instance to be submitted for each absolute
pointer motion event.
src/grd-rdp-event-queue.c | 6 +++++-
src/grd-rdp-event-queue.h | 1 +
src/grd-session-rdp.c | 6 +++++-
src/grd-session-vnc.c | 6 +++++-
src/grd-session.c | 5 +++--
src/grd-session.h | 1 +
6 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/grd-rdp-event-queue.c b/src/grd-rdp-event-queue.c
index fb89bb29..90ea969b 100644
--- a/src/grd-rdp-event-queue.c
+++ b/src/grd-rdp-event-queue.c
@@ -54,6 +54,7 @@ typedef struct _RdpEvent
/* RDP_EVENT_TYPE_INPUT_PTR_MOTION_ABS */
struct
{
+ GrdStream *stream;
double x;
double y;
} input_ptr_motion_abs;
@@ -142,6 +143,7 @@ grd_rdp_event_queue_add_input_event_keyboard_keysym (GrdRdpEventQueue *rdp_event
void
grd_rdp_event_queue_add_input_event_pointer_motion_abs (GrdRdpEventQueue *rdp_event_queue,
+ GrdStream *stream,
double x,
double y)
{
@@ -149,6 +151,7 @@ grd_rdp_event_queue_add_input_event_pointer_motion_abs (GrdRdpEventQueue *rdp_ev
rdp_event = g_malloc0 (sizeof (RdpEvent));
rdp_event->type = RDP_EVENT_TYPE_INPUT_PTR_MOTION_ABS;
+ rdp_event->input_ptr_motion_abs.stream = stream;
rdp_event->input_ptr_motion_abs.x = x;
rdp_event->input_ptr_motion_abs.y = y;
@@ -297,7 +300,8 @@ process_rdp_events (GrdRdpEventQueue *rdp_event_queue)
break;
case RDP_EVENT_TYPE_INPUT_PTR_MOTION_ABS:
grd_session_notify_pointer_motion_absolute (
- session, rdp_event->input_ptr_motion_abs.x,
+ session, rdp_event->input_ptr_motion_abs.stream,
+ rdp_event->input_ptr_motion_abs.x,
rdp_event->input_ptr_motion_abs.y);
break;
case RDP_EVENT_TYPE_INPUT_PTR_BUTTON:
diff --git a/src/grd-rdp-event-queue.h b/src/grd-rdp-event-queue.h
index 51d67b56..187a8ee4 100644
--- a/src/grd-rdp-event-queue.h
+++ b/src/grd-rdp-event-queue.h
@@ -41,6 +41,7 @@ void grd_rdp_event_queue_add_input_event_keyboard_keysym (GrdRdpEventQueue *rdp_
GrdKeyState state);
void grd_rdp_event_queue_add_input_event_pointer_motion_abs (GrdRdpEventQueue *rdp_event_queue,
+ GrdStream *stream,
double x,
double y);
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index bc0474b8..c58be259 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -158,6 +158,7 @@ struct _GrdSessionRdp
unsigned int close_session_idle_id;
GrdRdpPipeWireStream *pipewire_stream;
+ GrdStream *stream;
};
G_DEFINE_TYPE (GrdSessionRdp, grd_session_rdp, GRD_TYPE_SESSION)
@@ -1278,8 +1279,10 @@ rdp_input_mouse_event (rdpInput *rdp_input,
if (flags & PTR_FLAGS_MOVE)
{
+ GrdStream *stream = session_rdp->stream;
+
grd_rdp_event_queue_add_input_event_pointer_motion_abs (rdp_event_queue,
- x, y);
+ stream, x, y);
}
button_state = flags & PTR_FLAGS_DOWN ? GRD_BUTTON_STATE_PRESSED
@@ -2140,6 +2143,7 @@ grd_session_rdp_stream_ready (GrdSession *session,
return;
}
+ session_rdp->stream = stream;
g_signal_connect (session_rdp->pipewire_stream, "closed",
G_CALLBACK (on_pipewire_stream_closed),
session_rdp);
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
index dfce5e4d..f6b541ed 100644
--- a/src/grd-session-vnc.c
+++ b/src/grd-session-vnc.c
@@ -62,6 +62,7 @@ struct _GrdSessionVnc
GCancellable *prompt_cancellable;
GrdVncPipeWireStream *pipewire_stream;
+ GrdStream *stream;
int prev_x;
int prev_y;
@@ -444,7 +445,9 @@ handle_pointer_event (int button_mask,
if (x != session_vnc->prev_x || y != session_vnc->prev_y)
{
- grd_session_notify_pointer_motion_absolute (session, x, y);
+ GrdStream *stream = session_vnc->stream;
+
+ grd_session_notify_pointer_motion_absolute (session, stream, x, y);
session_vnc->prev_x = x;
session_vnc->prev_y = y;
@@ -745,6 +748,7 @@ grd_session_vnc_stream_ready (GrdSession *session,
return;
}
+ session_vnc->stream = stream;
g_signal_connect (session_vnc->pipewire_stream, "closed",
G_CALLBACK (on_pipewire_stream_closed),
session_vnc);
diff --git a/src/grd-session.c b/src/grd-session.c
index 74c20d6d..c09aded7 100644
--- a/src/grd-session.c
+++ b/src/grd-session.c
@@ -420,16 +420,17 @@ grd_session_notify_pointer_axis_discrete (GrdSession *session,
void
grd_session_notify_pointer_motion_absolute (GrdSession *session,
+ GrdStream *stream,
double x,
double y)
{
GrdSessionPrivate *priv = grd_session_get_instance_private (session);
const char *stream_path;
- if (!priv->stream)
+ if (!stream)
return;
- stream_path = grd_stream_get_object_path (priv->stream);
+ stream_path = grd_stream_get_object_path (stream);
grd_dbus_remote_desktop_session_call_notify_pointer_motion_absolute (
priv->remote_desktop_session, stream_path, x, y, NULL, NULL, NULL);
diff --git a/src/grd-session.h b/src/grd-session.h
index 519deee5..aa8e0b7a 100644
--- a/src/grd-session.h
+++ b/src/grd-session.h
@@ -114,6 +114,7 @@ void grd_session_notify_pointer_axis_discrete (GrdSession *session,
int steps);
void grd_session_notify_pointer_motion_absolute (GrdSession *session,
+ GrdStream *stream,
double x,
double y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]