diff options
author | Antenore Gatta <antenore@simbiosi.org> | 2021-04-23 16:10:01 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2021-04-23 16:10:01 +0300 |
commit | 995159119f005aaff7db93781d3ee5bb98533055 (patch) | |
tree | abee2e632427b142fe5dc6ece528f423498df87e /src | |
parent | d82102f2ef222973ff517f31fd91e5c7b4def03a (diff) |
Fixing RemminaConnectionWindow map/unmap events
The remmina connection windows in fullscreen is a different object
than when is in scrolled mode, therefore the old logic to map and unmap
the windows from the plugin it was notr working.
Now the events are managed directly from the RCW object and the
RemminaProtocolWidget, with an API that can be used by any plugins.
When in multi monitor and fullscreen, this mechanism doesn't work,
Therefore, in the plugin itself I catch when we are in multi monitor fullscreen mode
And I ignore the event.
This last behaviour should be managed directly in the Remmina Protocol Widget (TODO).
Fixes #2475
Signed-off-by: Antenore Gatta <antenore@simbiosi.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/remmina/plugin.h | 2 | ||||
-rw-r--r-- | src/rcw.c | 46 | ||||
-rw-r--r-- | src/remmina_protocol_widget.c | 24 | ||||
-rw-r--r-- | src/remmina_protocol_widget.h | 3 | ||||
-rw-r--r-- | src/remmina_sftp_plugin.c | 4 | ||||
-rw-r--r-- | src/remmina_ssh_plugin.c | 4 |
6 files changed, 80 insertions, 3 deletions
diff --git a/src/include/remmina/plugin.h b/src/include/remmina/plugin.h index 2e25cb5ab..b889ecb92 100644 --- a/src/include/remmina/plugin.h +++ b/src/include/remmina/plugin.h @@ -81,6 +81,8 @@ typedef struct _RemminaProtocolPlugin { void (*call_feature)(RemminaProtocolWidget *gp, const RemminaProtocolFeature *feature); void (*send_keystrokes)(RemminaProtocolWidget *gp, const guint keystrokes[], const gint keylen); gboolean (*get_plugin_screenshot)(RemminaProtocolWidget *gp, RemminaPluginScreenshotData *rpsd); + gboolean (*map_event)(RemminaProtocolWidget *gp); + gboolean (*unmap_event)(RemminaProtocolWidget *gp); } RemminaProtocolPlugin; typedef struct _RemminaEntryPlugin { @@ -355,6 +355,7 @@ static void rcw_class_init(RemminaConnectionWindowClass *klass) rcw_signals[TOOLBARPLACE_SIGNAL] = g_signal_new("toolbar-place", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaConnectionWindowClass, toolbar_place), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + } static RemminaConnectionObject *rcw_get_cnnobj_at_page(RemminaConnectionWindow *cnnwin, gint npage) @@ -3081,13 +3082,49 @@ static gboolean rcw_state_event(GtkWidget *widget, GdkEventWindowState *event, g return FALSE; } +static gboolean rcw_map_event(GtkWidget *widget, GdkEvent *event, gpointer data) +{ + TRACE_CALL(__func__); + + RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow*)widget; + RemminaConnectionObject *cnnobj; + RemminaProtocolWidget *gp; + if (cnnwin->priv->toolbar_is_reconfiguring) return FALSE; + if (!(cnnobj = rcw_get_visible_cnnobj(cnnwin))) return FALSE; + + gp = REMMINA_PROTOCOL_WIDGET(cnnobj->proto); + REMMINA_DEBUG ("Mapping: %s", gtk_widget_get_name(widget)); + if (remmina_protocol_widget_map_event(gp)) { + REMMINA_DEBUG ("Called plugin mapping function"); + } + return FALSE; +} + +static gboolean rcw_unmap_event(GtkWidget *widget, GdkEvent *event, gpointer data) +{ + TRACE_CALL(__func__); + + RemminaConnectionWindow *cnnwin = (RemminaConnectionWindow*)widget; + RemminaConnectionObject *cnnobj; + RemminaProtocolWidget *gp; + if (cnnwin->priv->toolbar_is_reconfiguring) return FALSE; + if (!(cnnobj = rcw_get_visible_cnnobj(cnnwin))) return FALSE; + + gp = REMMINA_PROTOCOL_WIDGET(cnnobj->proto); + REMMINA_DEBUG ("Unmapping: %s", gtk_widget_get_name(widget)); + if (remmina_protocol_widget_unmap_event(gp)) { + REMMINA_DEBUG ("Called plugin mapping function"); + } + return FALSE; +} + static gboolean rcw_map_event_fullscreen(GtkWidget *widget, GdkEvent *event, gpointer data) { TRACE_CALL(__func__); RemminaConnectionObject *cnnobj; gint target_monitor; - REMMINA_DEBUG ("Mapping Remmina connection window"); + REMMINA_DEBUG ("Mapping: %s", gtk_widget_get_name(widget)); if (!REMMINA_IS_CONNECTION_WINDOW(widget)) { REMMINA_DEBUG ("Remmina Connection Window undefined, cannot go fullscreen"); @@ -3133,6 +3170,10 @@ static gboolean rcw_map_event_fullscreen(GtkWidget *widget, GdkEvent *event, gpo gtk_window_fullscreen(GTK_WINDOW(widget)); #endif + if (remmina_protocol_widget_map_event(gp)) { + REMMINA_DEBUG ("Called plugin mapping function"); + } + return FALSE; } @@ -3148,6 +3189,9 @@ rcw_new(gboolean fullscreen, int full_screen_target_monitor) if (fullscreen) /* Put the window in fullscreen after it is mapped to have it appear on the same monitor */ g_signal_connect(G_OBJECT(cnnwin), "map-event", G_CALLBACK(rcw_map_event_fullscreen), GINT_TO_POINTER(full_screen_target_monitor)); + else + g_signal_connect(G_OBJECT(cnnwin), "map-event", G_CALLBACK(rcw_map_event), NULL); + g_signal_connect(G_OBJECT(cnnwin), "unmap-event", G_CALLBACK(rcw_unmap_event), NULL); gtk_container_set_border_width(GTK_CONTAINER(cnnwin), 0); g_signal_connect(G_OBJECT(cnnwin), "toolbar-place", G_CALLBACK(rcw_toolbar_place_signal), NULL); diff --git a/src/remmina_protocol_widget.c b/src/remmina_protocol_widget.c index 06bf9aedd..09eb0bfae 100644 --- a/src/remmina_protocol_widget.c +++ b/src/remmina_protocol_widget.c @@ -700,6 +700,30 @@ gboolean remmina_protocol_widget_plugin_screenshot(RemminaProtocolWidget *gp, Re return gp->priv->plugin->get_plugin_screenshot(gp, rpsd); } +gboolean remmina_protocol_widget_map_event(RemminaProtocolWidget *gp) +{ + TRACE_CALL(__func__); + if (!gp->priv->plugin->map_event) { + REMMINA_DEBUG("Map plugin function not implemented"); + return FALSE; + } + + REMMINA_DEBUG ("Calling plugin mapping function"); + return gp->priv->plugin->map_event(gp); +} + +gboolean remmina_protocol_widget_unmap_event(RemminaProtocolWidget *gp) +{ + TRACE_CALL(__func__); + if (!gp->priv->plugin->get_plugin_screenshot) { + REMMINA_DEBUG("Unmap plugin function not implemented"); + return FALSE; + } + + REMMINA_DEBUG ("Calling plugin unmapping function"); + return gp->priv->plugin->unmap_event(gp); +} + void remmina_protocol_widget_emit_signal(RemminaProtocolWidget *gp, const gchar *signal_name) { TRACE_CALL(__func__); diff --git a/src/remmina_protocol_widget.h b/src/remmina_protocol_widget.h index 9ad92c5fc..86c8f5c71 100644 --- a/src/remmina_protocol_widget.h +++ b/src/remmina_protocol_widget.h @@ -172,6 +172,9 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget *gp, GtkMenuI void remmina_protocol_widget_send_clipboard(RemminaProtocolWidget *gp, GtkMenuItem *widget); /* Take screenshot of plugin */ gboolean remmina_protocol_widget_plugin_screenshot(RemminaProtocolWidget *gp, RemminaPluginScreenshotData *rpsd); +/* Deal with the remimna connection window map/unmap events */ +gboolean remmina_protocol_widget_map_event(RemminaProtocolWidget *gp); +gboolean remmina_protocol_widget_unmap_event(RemminaProtocolWidget *gp); void remmina_protocol_widget_update_remote_resolution(RemminaProtocolWidget *gp); diff --git a/src/remmina_sftp_plugin.c b/src/remmina_sftp_plugin.c index c68143529..6379cd989 100644 --- a/src/remmina_sftp_plugin.c +++ b/src/remmina_sftp_plugin.c @@ -371,7 +371,9 @@ static RemminaProtocolPlugin remmina_plugin_sftp = remmina_plugin_sftp_query_feature, // Query for available features remmina_plugin_sftp_call_feature, // Call a feature NULL, // Send a keystroke - NULL // Screenshot support unavailable + NULL, // Screenshot support unavailable + NULL, // RCW map event + NULL // RCW unmap event }; void diff --git a/src/remmina_ssh_plugin.c b/src/remmina_ssh_plugin.c index 15d15e32b..25c5100ca 100644 --- a/src/remmina_ssh_plugin.c +++ b/src/remmina_ssh_plugin.c @@ -1482,7 +1482,9 @@ static RemminaProtocolPlugin remmina_plugin_ssh = remmina_plugin_ssh_query_feature, /**< Query for available features */ remmina_plugin_ssh_call_feature, /**< Call a feature */ remmina_ssh_keystroke, /**< Send a keystroke */ - NULL /**< No screenshot support available */ + NULL, /**< No screenshot support available */ + NULL, /**< RCW map event */ + NULL /**< RCW unmap event */ }; |