Commit 30fa9fb4 authored by Giovanni Panozzo's avatar Giovanni Panozzo

Deprecates dynamic_resolution_width and height cfg params

parent f0328dab
......@@ -364,8 +364,6 @@ static gboolean remmina_rdp_event_delayed_monitor_layout(RemminaProtocolWidget*
rdp_event.monitor_layout.desktopScaleFactor = desktopScaleFactor;
rdp_event.monitor_layout.deviceScaleFactor = deviceScaleFactor;
remmina_rdp_event_event_push(gp, &rdp_event);
remmina_plugin_service->file_set_int(remminafile, "dynamic_resolution_width", gpwidth);
remmina_plugin_service->file_set_int(remminafile, "dynamic_resolution_height", gpheight);
}
}
......
......@@ -833,13 +833,6 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
rfi->settings->DesktopWidth = remmina_plugin_service->get_profile_remote_width(gp);
rfi->settings->DesktopHeight = remmina_plugin_service->get_profile_remote_height(gp);
dynresw = remmina_plugin_service->file_get_int(remminafile, "dynamic_resolution_width", 0);
dynresh = remmina_plugin_service->file_get_int(remminafile, "dynamic_resolution_height", 0);
if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES && dynresh != 0 && dynresw != 0) {
rfi->settings->DesktopWidth = dynresw;
rfi->settings->DesktopHeight = dynresh;
}
remmina_plugin_service->protocol_plugin_set_width(gp, rfi->settings->DesktopWidth);
remmina_plugin_service->protocol_plugin_set_height(gp, rfi->settings->DesktopHeight);
......
......@@ -1114,6 +1114,7 @@ static void remmina_protocol_widget_update_alignment(RemminaConnectionObject* cn
gboolean scaledexpandedmode;
int rdwidth, rdheight;
gfloat aratio;
RemminaProtocolWidgetResolutionMode res_mode;
if (!cnnobj->plugin_can_scale) {
/* If we have a plugin that cannot scale,
......@@ -1165,6 +1166,8 @@ static void remmina_protocol_widget_update_alignment(RemminaConnectionObject* cn
}
}
res_mode = remmina_file_get_int(cnnobj->remmina_file, "resolution_mode", RES_INVALID);
if (scalemode == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED || scalemode == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES) {
/* We have a plugin that can be scaled, and the scale button
* has been pressed. Give it the correct WxH maintaining aspect
......@@ -1460,11 +1463,6 @@ static void remmina_connection_holder_change_scalemode(RemminaConnectionHolder*
else
scalemode = REMMINA_PROTOCOL_WIDGET_SCALE_MODE_NONE;
if (scalemode != REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES) {
remmina_file_set_int(cnnobj->remmina_file, "dynamic_resolution_width", 0);
remmina_file_set_int(cnnobj->remmina_file, "dynamic_resolution_height", 0);
}
remmina_protocol_widget_set_current_scale_mode(REMMINA_PROTOCOL_WIDGET(cnnobj->proto), scalemode);
remmina_file_set_int(cnnobj->remmina_file, "scale", scalemode);
gtk_widget_set_sensitive(GTK_WIDGET(priv->scaler_option_button), scalemode == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED);
......@@ -3929,12 +3927,13 @@ static void rpw_size_allocated_on_connection(GtkWidget *w, GdkRectangle *allocat
g_signal_handler_disconnect(w, gp->cnnobj->deferred_open_size_allocate_handler);
/* Schedule a connection ASAP */
if (remmina_file_get_int(gp->cnnobj->remmina_file, "resolution_mode", RES_INVALID) == RES_USE_INITIAL_WINDOW_SIZE) {
if (remmina_file_get_int(gp->cnnobj->remmina_file, "resolution_mode", RES_INVALID) == RES_USE_INITIAL_WINDOW_SIZE ||
remmina_protocol_widget_get_current_scale_mode(gp) == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES) {
/* Allow the WM to decide the real size of our windows before reading current window
* size and connecting: some WM, i.e. GnomeShell/mutter with edge-tiling,
* will resize our window after creating it, so we must wait to be in a stable state
* before reading the window internal widgets allocated size for RES_USE_INTERNAL_WINDOW_SIZE */
g_timeout_add(200, open_connection_last_stage, gp);
g_timeout_add(400, open_connection_last_stage, gp);
}
else
g_idle_add(open_connection_last_stage, gp);
......@@ -4026,6 +4025,10 @@ GtkWidget* remmina_connection_window_open_from_file_full(RemminaFile* remminafil
gtk_notebook_set_current_page(GTK_NOTEBOOK(cnnwin->priv->notebook), i);
}
// Do not call remmina_protocol_widget_update_alignment(cnnobj); here or cnnobj->proto will not fill its parent size
// and remmina_protocol_widget_update_remote_resolution() cannot autodetect available space
gtk_widget_show(cnnobj->proto);
g_signal_connect(G_OBJECT(cnnobj->proto), "connect", G_CALLBACK(remmina_connection_object_on_connect), cnnobj);
if (disconnect_cb) {
......@@ -4076,12 +4079,13 @@ GtkWidget* remmina_connection_window_open_from_file_full(RemminaFile* remminafil
/* GTK window setup is done here, and we are almost ready to call remmina_protocol_widget_open_connection().
* But size has not yet been allocated by GTK
* to the widgets. If we are in RES_USE_INITIAL_WINDOW_SIZE resolution mode,
* to the widgets. If we are in RES_USE_INITIAL_WINDOW_SIZE resolution mode or scale is REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES,
* we should wait for a size allocation from GTK for cnnobj->proto
* before connecting */
defer_connection_after_size_allocation = FALSE;
if (remmina_file_get_int(remminafile, "resolution_mode", RES_INVALID) == RES_USE_INITIAL_WINDOW_SIZE) {
if (remmina_file_get_int(remminafile, "resolution_mode", RES_INVALID) == RES_USE_INITIAL_WINDOW_SIZE ||
remmina_protocol_widget_get_current_scale_mode(cnnobj->proto) == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES) {
GtkAllocation al;
gtk_widget_get_allocation(cnnobj->proto, &al);
if (al.width < 10 || al.height < 10) {
......
......@@ -1598,8 +1598,10 @@ void remmina_protocol_widget_update_remote_resolution(RemminaProtocolWidget* gp)
gint w, h;
gint wfile, hfile;
RemminaProtocolWidgetResolutionMode res_mode;
RemminaScaleMode scalemode;
res_mode = remmina_file_get_int(gp->priv->remmina_file, "resolution_mode", RES_INVALID);
scalemode = remmina_file_get_int(gp->priv->remmina_file, "scale", REMMINA_PROTOCOL_WIDGET_SCALE_MODE_NONE);
wfile = remmina_file_get_int(gp->priv->remmina_file, "resolution_width", -1);
hfile = remmina_file_get_int(gp->priv->remmina_file, "resolution_height", -1);
......@@ -1612,7 +1614,23 @@ void remmina_protocol_widget_update_remote_resolution(RemminaProtocolWidget* gp)
res_mode = RES_USE_CUSTOM;
}
if (res_mode == RES_USE_CLIENT) {
if (res_mode == RES_USE_INITIAL_WINDOW_SIZE || scalemode == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES) {
/* Use internal window size as remote desktop size */
GtkAllocation al;
gtk_widget_get_allocation(GTK_WIDGET(gp), &al);
w = al.width;
h = al.height;
if (w < 10) {
printf("REMMINA WARNING: %s RemminaProtocolWidget w=%d h=%d are too small, adjusting to 640x480\n", __func__, w, h);
w = 640;
h = 480;
}
/* Workaround for FreeRDP issue 5119. This will make our horizontal resolution
* an even value, but it will add a vertical black 1 pixel line on the
* right of the desktop */
if ( (w & 1) != 0)
w -= 1;
} else if (res_mode == RES_USE_CLIENT) {
display = gdk_display_get_default();
/* gdk_display_get_device_manager deprecated since 3.20, Use gdk_display_get_default_seat */
#if GTK_CHECK_VERSION(3, 20, 0)
......@@ -1632,22 +1650,6 @@ void remmina_protocol_widget_update_remote_resolution(RemminaProtocolWidget* gp)
#endif
w = rect.width;
h = rect.height;
} else if (res_mode == RES_USE_INITIAL_WINDOW_SIZE) {
GtkAllocation al;
gtk_widget_get_allocation(gp, &al);
w = al.width;
h = al.height;
if (w < 10) {
printf("REMMINA WARNING: %s RemminaProtocolWidget w=%d h=%d are too small, adjusting to 640x480\n", __func__, w, h);
w = 640;
h = 480;
}
/* Workaround for FreeRDP issue 5119. This will make our horizontal resolution
* an even value, but it will add a vertical black 1 pixel line on the
* right of the desktop */
if ( w & 1 != 0)
w -= 1;
} else {
w = wfile;
h = hfile;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment