Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroyuki Tanaka <myheroyuki@outlook.com>2023-03-27 14:56:35 +0300
committerHiroyuki Tanaka <myheroyuki@outlook.com>2023-03-27 14:56:35 +0300
commitd4601f01bb8d70d5d5f632f335b9de294e8ddf9f (patch)
tree57662a71c46a7962c5c218d5cd6396c28d3002ed
parent99bf07aab064c0d232dc2ad948d28936995ee044 (diff)
parent57b2afff172e49c9d269c96690a0ab33cee09b28 (diff)
Merge branch 'REM-1987' into 'master'
[REM-1987] allow for dynamic resolution updates for vnc connections See merge request Remmina/Remmina!2476
-rw-r--r--cmake/FindLIBVNCSERVER.cmake10
-rw-r--r--plugins/rdp/rdp_plugin.h2
-rw-r--r--plugins/vnc/vnc_plugin.c34
-rw-r--r--plugins/vnc/vnc_plugin.h6
4 files changed, 48 insertions, 4 deletions
diff --git a/cmake/FindLIBVNCSERVER.cmake b/cmake/FindLIBVNCSERVER.cmake
index e6dd17daf..3918e1a80 100644
--- a/cmake/FindLIBVNCSERVER.cmake
+++ b/cmake/FindLIBVNCSERVER.cmake
@@ -32,6 +32,16 @@ find_library(LIBVNCCLIENT_LIBRARY NAMES vncclient
include(FindPackageHandleStandardArgs)
+#libvnc defines their version as a string, not an int, so we parse it here to allow
+#for proper c preprocessing to work
+string(REPLACE "." ";" VERSION_LIST ${PC_LIBVNCSERVER_VERSION})
+list(GET VERSION_LIST 0 MY_PROGRAM_VERSION_MAJOR)
+list(GET VERSION_LIST 1 MY_PROGRAM_VERSION_MINOR)
+list(GET VERSION_LIST 2 MY_PROGRAM_VERSION_PATCH)
+
+add_compile_definitions(LIBVNC_INT_MAJOR=${MY_PROGRAM_VERSION_MAJOR})
+add_compile_definitions(LIBVNC_INT_MINOR=${MY_PROGRAM_VERSION_MINOR})
+add_compile_definitions(LIBVNC_INT_PATCH=${MY_PROGRAM_VERSION_PATCH})
find_package_handle_standard_args(LIBVNCSERVER DEFAULT_MSG LIBVNCSERVER_LIBRARY LIBVNCSERVER_INCLUDE_DIR)
set(LIBVNCSERVER_LIBRARIES ${LIBVNCSERVER_LIBRARY} ${LIBVNCCLIENT_LIBRARY})
diff --git a/plugins/rdp/rdp_plugin.h b/plugins/rdp/rdp_plugin.h
index b6265aef5..19b0a609c 100644
--- a/plugins/rdp/rdp_plugin.h
+++ b/plugins/rdp/rdp_plugin.h
@@ -66,7 +66,7 @@
*
* Returns: %TRUE if FREERDP headers are new enough
*/
-#define FREERDP_CHECK_VERSION(major,minor,revision) \
+#define FREERDP_CHECK_VERSION(major,minor,revision) \
(FREERDP_VERSION_MAJOR > (major) || \
(FREERDP_VERSION_MAJOR == (major) && FREERDP_VERSION_MINOR > (minor)) || \
(FREERDP_VERSION_MAJOR == (major) && FREERDP_VERSION_MINOR == (minor) && \
diff --git a/plugins/vnc/vnc_plugin.c b/plugins/vnc/vnc_plugin.c
index ea9157723..4fa7b627b 100644
--- a/plugins/vnc/vnc_plugin.c
+++ b/plugins/vnc/vnc_plugin.c
@@ -48,6 +48,7 @@
#define REMMINA_PLUGIN_VNC_FEATURE_UNFOCUS 7
#define REMMINA_PLUGIN_VNC_FEATURE_TOOL_SENDCTRLALTDEL 8
#define REMMINA_PLUGIN_VNC_FEATURE_PREF_COLOR 9
+#define REMMINA_PLUGIN_VNC_FEATURE_DYNRESUPDATE 10
#define VNC_DEFAULT_PORT 5900
@@ -231,7 +232,7 @@ static void remmina_plugin_vnc_update_scale(RemminaProtocolWidget *gp, gboolean
RemminaPluginVncData *gpdata;
gint width, height;
-
+
if (!remmina_plugin_service->is_main_thread()) {
struct onMainThread_cb_data *d;
d = (struct onMainThread_cb_data *)g_malloc(sizeof(struct onMainThread_cb_data));
@@ -1725,6 +1726,9 @@ static gboolean remmina_plugin_vnc_open_connection(RemminaProtocolWidget *gp)
REMMINA_PLUGIN_AUDIT(_("Connected to %s:%d via VNC"), server, port);
g_free(server), server = NULL;
}
+#if LIBVNCSERVER_CHECK_VERSION_VERSION(0, 9, 14)
+ remmina_plugin_service->protocol_plugin_unlock_dynres(gp);
+#endif
return TRUE;
}
@@ -1820,7 +1824,6 @@ static gboolean remmina_plugin_vnc_query_feature(RemminaProtocolWidget *gp, cons
{
TRACE_CALL(__func__);
RemminaPluginVncData *gpdata = GET_PLUGIN_DATA(gp);
-
switch (feature->id) {
case REMMINA_PLUGIN_VNC_FEATURE_PREF_DISABLESERVERINPUT:
return SupportsClient2Server((rfbClient *)(gpdata->client), rfbSetServerInput) ? TRUE : FALSE;
@@ -1900,6 +1903,26 @@ static void remmina_plugin_vnc_keystroke(RemminaProtocolWidget *gp, const guint
return;
}
+#if LIBVNCSERVER_CHECK_VERSION_VERSION(0, 9, 14)
+static gboolean remmina_plugin_vnc_on_size_allocate(GtkWidget *widget, GtkAllocation *alloc, RemminaProtocolWidget *gp)
+{
+ TRACE_CALL(__func__);
+ RemminaScaleMode scale_mode = remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp);
+ RemminaPluginVncData *gpdata = GET_PLUGIN_DATA(gp);
+
+ if (scale_mode == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES){
+ char str[1024];
+ sprintf(str, "DEBUG: %d x %d", alloc->width, alloc->height);
+ TRACE_CALL(str);
+ if (gpdata->client){
+ rfbClient *cl;
+ SendExtDesktopSize(gpdata->client, alloc->width, alloc->height);
+ }
+ }
+ return TRUE;
+}
+#endif
+
static gboolean remmina_plugin_vnc_on_draw(GtkWidget *widget, cairo_t *context, RemminaProtocolWidget *gp)
{
TRACE_CALL(__func__);
@@ -1968,7 +1991,9 @@ static void remmina_plugin_vnc_init(RemminaProtocolWidget *gp)
g_signal_connect(G_OBJECT(gpdata->drawing_area), "draw", G_CALLBACK(remmina_plugin_vnc_on_draw), gp);
-
+#if LIBVNCSERVER_CHECK_VERSION_VERSION(0, 9, 14)
+ g_signal_connect(G_OBJECT(gpdata->drawing_area), "size-allocate", G_CALLBACK(remmina_plugin_vnc_on_size_allocate), gp);
+#endif
gpdata->auth_first = TRUE;
gpdata->clipboard_timer = g_date_time_new_now_utc();
gpdata->listen_sock = -1;
@@ -2111,6 +2136,9 @@ static const RemminaProtocolFeature remmina_plugin_vnc_features[] =
{ REMMINA_PROTOCOL_FEATURE_TYPE_TOOL, REMMINA_PLUGIN_VNC_FEATURE_TOOL_SENDCTRLALTDEL, N_("Send Ctrl+Alt+Delete"), NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_SCALE, REMMINA_PLUGIN_VNC_FEATURE_SCALE, NULL, NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS, REMMINA_PLUGIN_VNC_FEATURE_UNFOCUS, NULL, NULL, NULL },
+#if LIBVNCSERVER_CHECK_VERSION_VERSION(0, 9, 14)
+ { REMMINA_PROTOCOL_FEATURE_TYPE_DYNRESUPDATE, REMMINA_PLUGIN_VNC_FEATURE_DYNRESUPDATE, NULL, NULL, NULL },
+#endif
{ REMMINA_PROTOCOL_FEATURE_TYPE_END, 0, NULL, NULL, NULL }
};
diff --git a/plugins/vnc/vnc_plugin.h b/plugins/vnc/vnc_plugin.h
index 5e8319fcb..a0a1732d9 100644
--- a/plugins/vnc/vnc_plugin.h
+++ b/plugins/vnc/vnc_plugin.h
@@ -71,6 +71,12 @@
#define REMMINA_PLUGIN_AUDIT(fmt, ...) \
remmina_plugin_service->_remmina_audit(__func__, fmt, ##__VA_ARGS__)
+#define LIBVNCSERVER_CHECK_VERSION_VERSION(major,minor,patchlevel) \
+ (LIBVNC_INT_MAJOR > (major) || \
+ (LIBVNC_INT_MAJOR == (major) && LIBVNC_INT_MINOR > (minor)) || \
+ (LIBVNC_INT_MAJOR == (major) && LIBVNC_INT_MINOR == (minor) && \
+ LIBVNC_INT_PATCH >= (patchlevel)))
+
typedef struct _RemminaPluginVncData {
/* Whether the user requests to connect/disconnect */
gboolean connected;