Commit 7154f46e authored by Giovanni Panozzo's avatar Giovanni Panozzo

Implementation of dynamic resolution update for RDP

parent b37c2080
......@@ -35,6 +35,7 @@
#include "rdp_plugin.h"
#include "rdp_cliprdr.h"
#include "rdp_channels.h"
#include "rdp_event.h"
#include <freerdp/freerdp.h>
#include <freerdp/channels/channels.h>
......@@ -78,9 +79,19 @@ void remmina_rdp_OnChannelConnectedEventHandler(rdpContext* context, ChannelConn
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xf_encomsp_init(xfc, (EncomspClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, DISP_DVC_CHANNEL_NAME) == 0)
{
// "disp" channel connected, save its context pointer
rfi->dispcontext = (DispClientContext*)e->pInterface;
// Notify remmina_connection_window to unlock dynres capability
remmina_plugin_service->protocol_plugin_emit_signal(rfi->protocol_widget, "unlock-dynres");
// Send monitor layout message here to ask for resize of remote desktop now
if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES) {
remmina_rdp_event_send_delayed_monitor_layout(rfi->protocol_widget);
}
}
}
void remmina_rdp_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e)
{
}
......@@ -38,6 +38,7 @@
#include "rdp_plugin.h"
#include "rdp_event.h"
#include "rdp_cliprdr.h"
#include "rdp_settings.h"
#include <gdk/gdkkeysyms.h>
#include <cairo/cairo-xlib.h>
#include <freerdp/locale/keyboard.h>
......@@ -233,7 +234,7 @@ void remmina_rdp_event_update_region(RemminaProtocolWidget* gp, RemminaPluginRdp
w = ui->region.width;
h = ui->region.height;
if (remmina_plugin_service->protocol_plugin_get_scale(gp))
if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED)
remmina_rdp_event_scale_area(gp, &x, &y, &w, &h);
gtk_widget_queue_draw_area(rfi->drawing_area, x, y, w, h);
......@@ -244,7 +245,7 @@ void remmina_rdp_event_update_rect(RemminaProtocolWidget* gp, gint x, gint y, gi
TRACE_CALL("remmina_rdp_event_update_rect");
rfContext* rfi = GET_PLUGIN_DATA(gp);
if (remmina_plugin_service->protocol_plugin_get_scale(gp))
if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED)
remmina_rdp_event_scale_area(gp, &x, &y, &w, &h);
gtk_widget_queue_draw_area(rfi->drawing_area, x, y, w, h);
......@@ -254,7 +255,6 @@ static void remmina_rdp_event_update_scale_factor(RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_rdp_event_update_scale_factor");
GtkAllocation a;
gboolean scale;
gint rdwidth, rdheight;
gint gpwidth, gpheight;
RemminaFile* remminafile;
......@@ -265,9 +265,8 @@ static void remmina_rdp_event_update_scale_factor(RemminaProtocolWidget* gp)
gtk_widget_get_allocation(GTK_WIDGET(gp), &a);
gpwidth = a.width;
gpheight = a.height;
scale = remmina_plugin_service->protocol_plugin_get_scale(gp);
if (scale)
if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED)
{
if ((gpwidth > 1) && (gpheight > 1))
{
......@@ -294,7 +293,6 @@ static void remmina_rdp_event_update_scale_factor(RemminaProtocolWidget* gp)
static gboolean remmina_rdp_event_on_draw(GtkWidget* widget, cairo_t* context, RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_rdp_event_on_draw");
gboolean scale;
rfContext* rfi = GET_PLUGIN_DATA(gp);
guint width, height;
gchar *msg;
......@@ -334,9 +332,7 @@ static gboolean remmina_rdp_event_on_draw(GtkWidget* widget, cairo_t* context, R
GtkAllocation a;
gtk_widget_get_allocation(GTK_WIDGET(gp), &a);
scale = remmina_plugin_service->protocol_plugin_get_scale(gp);
if (scale)
if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED)
cairo_scale(context, rfi->scale_x, rfi->scale_y);
cairo_set_source_surface(context, rfi->surface, 0, 0);
......@@ -348,16 +344,84 @@ static gboolean remmina_rdp_event_on_draw(GtkWidget* widget, cairo_t* context, R
return TRUE;
}
static gboolean remmina_rdp_event_delayed_monitor_layout(RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_rdp_event_delayed_monitor_layout");
rfContext* rfi = GET_PLUGIN_DATA(gp);
RemminaPluginRdpEvent rdp_event = { 0 };
GtkAllocation a;
RemminaFile* remminafile;
gint desktopOrientation, desktopScaleFactor, deviceScaleFactor;
if (!rfi || !rfi->connected || rfi->is_reconnecting)
return FALSE;
if (rfi->scale != REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES)
return FALSE;
rfi->delayed_monitor_layout_handler = 0;
gint gpwidth, gpheight, prevwidth, prevheight;
if (rfi->dispcontext && rfi->dispcontext->SendMonitorLayout) {
remmina_rdp_settings_get_orientation_scale_prefs(&desktopOrientation, &desktopScaleFactor, &deviceScaleFactor);
gtk_widget_get_allocation(GTK_WIDGET(gp), &a);
gpwidth = a.width;
gpheight = a.height;
prevwidth = remmina_plugin_service->protocol_plugin_get_width(gp);
prevheight = remmina_plugin_service->protocol_plugin_get_height(gp);
remminafile = remmina_plugin_service->protocol_plugin_get_file(gp);
if ((gpwidth != prevwidth || gpheight != prevheight) &&
gpwidth >= 200 && gpwidth < 8192 &&
gpheight >= 200 && gpheight < 8192
) {
rdp_event.type = REMMINA_RDP_EVENT_TYPE_SEND_MONITOR_LAYOUT;
rdp_event.monitor_layout.width = gpwidth;
rdp_event.monitor_layout.height = gpheight;
rdp_event.monitor_layout.desktopOrientation = desktopOrientation;
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);
}
}
return FALSE;
}
void remmina_rdp_event_send_delayed_monitor_layout(RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_rdp_event_send_delayed_monitor_layout");
rfContext* rfi = GET_PLUGIN_DATA(gp);
if (!rfi || !rfi->connected || rfi->is_reconnecting)
return;
if (rfi->delayed_monitor_layout_handler) {
g_source_remove(rfi->delayed_monitor_layout_handler);
rfi->delayed_monitor_layout_handler = 0;
}
if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES) {
rfi->delayed_monitor_layout_handler = g_timeout_add(500, (GSourceFunc) remmina_rdp_event_delayed_monitor_layout, gp);
}
}
static gboolean remmina_rdp_event_on_configure(GtkWidget* widget, GdkEventConfigure* event, RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_rdp_event_on_configure");
rfContext* rfi = GET_PLUGIN_DATA(gp);
/* Called when gp changes its size or position */
rfContext* rfi = GET_PLUGIN_DATA(gp);
if (!rfi || !rfi->connected || rfi->is_reconnecting)
return FALSE;
remmina_rdp_event_update_scale_factor(gp);
/* If the scaler is not active, schedule a delayed remote resolution change */
remmina_rdp_event_send_delayed_monitor_layout(gp);
return FALSE;
}
......@@ -374,7 +438,7 @@ static void remmina_rdp_event_translate_pos(RemminaProtocolWidget* gp, int ix, i
if (!rfi || !rfi->connected || rfi->is_reconnecting)
return;
if ((rfi->scale) && (rfi->scale_width >= 1) && (rfi->scale_height >= 1))
if ((rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED) && (rfi->scale_width >= 1) && (rfi->scale_height >= 1))
{
*ox = (UINT16) (ix * remmina_plugin_service->protocol_plugin_get_width(gp) / rfi->scale_width);
*oy = (UINT16) (iy * remmina_plugin_service->protocol_plugin_get_height(gp) / rfi->scale_height);
......@@ -399,7 +463,7 @@ static void remmina_rdp_event_reverse_translate_pos_reverse(RemminaProtocolWidge
if (!rfi || !rfi->connected || rfi->is_reconnecting)
return;
if ((rfi->scale) && (rfi->scale_width >= 1) && (rfi->scale_height >= 1))
if ((rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED) && (rfi->scale_width >= 1) && (rfi->scale_height >= 1))
{
*ox = (ix * rfi->scale_width) / remmina_plugin_service->protocol_plugin_get_width(gp);
*oy = (iy * rfi->scale_height) / remmina_plugin_service->protocol_plugin_get_height(gp);
......@@ -759,10 +823,10 @@ void remmina_rdp_event_uninit(RemminaProtocolWidget* gp)
g_signal_handler_disconnect(G_OBJECT(gtk_widget_get_clipboard(rfi->drawing_area, GDK_SELECTION_CLIPBOARD)), rfi->clipboard.clipboard_handler);
rfi->clipboard.clipboard_handler = 0;
}
if (rfi->scale_handler)
if (rfi->delayed_monitor_layout_handler)
{
g_source_remove(rfi->scale_handler);
rfi->scale_handler = 0;
g_source_remove(rfi->delayed_monitor_layout_handler);
rfi->delayed_monitor_layout_handler = 0;
}
if (rfi->ui_handler)
{
......@@ -818,10 +882,11 @@ void remmina_rdp_event_update_scale(RemminaProtocolWidget* gp)
rfContext* rfi = GET_PLUGIN_DATA(gp);
remminafile = remmina_plugin_service->protocol_plugin_get_file(gp);
width = remmina_plugin_service->protocol_plugin_get_width(gp);
height = remmina_plugin_service->protocol_plugin_get_height(gp);
rfi->scale = remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp);
/* See if we also must rellocate rfi->surface with different width and height,
* this usually happens after a DesktopResize RDP event*/
if ( rfi->surface && (width != cairo_image_surface_get_width(rfi->surface) ||
......@@ -842,9 +907,9 @@ void remmina_rdp_event_update_scale(RemminaProtocolWidget* gp)
remmina_rdp_event_update_scale_factor(gp);
if (rfi->scale)
if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED || rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES)
{
/* In scaled mode, drawing_area will get its dimensions from its parent */
/* In scaled mode and autores mode, drawing_area will get its dimensions from its parent */
gtk_widget_set_size_request(rfi->drawing_area, -1, -1 );
}
else
......
......@@ -42,6 +42,7 @@ void remmina_rdp_event_init(RemminaProtocolWidget* gp);
void remmina_rdp_event_uninit(RemminaProtocolWidget* gp);
void remmina_rdp_event_update_scale(RemminaProtocolWidget* gp);
void remmina_rdp_event_unfocus(RemminaProtocolWidget* gp);
void remmina_rdp_event_send_delayed_monitor_layout(RemminaProtocolWidget* gp);
void remmina_rdp_event_update_rect(RemminaProtocolWidget* gp, gint x, gint y, gint w, gint h);
void remmina_rdp_event_queue_ui_async(RemminaProtocolWidget* gp, RemminaPluginRdpUiObject* ui);
int remmina_rdp_event_queue_ui_sync_retint(RemminaProtocolWidget* gp, RemminaPluginRdpUiObject* ui);
......
......@@ -57,6 +57,7 @@
#define REMMINA_RDP_FEATURE_SCALE 2
#define REMMINA_RDP_FEATURE_UNFOCUS 3
#define REMMINA_RDP_FEATURE_TOOL_SENDCTRLALTDEL 4
#define REMMINA_RDP_FEATURE_DYNRESUPDATE 5
/* Some string settings of freerdp are preallocated buffers of N bytes */
#define FREERDP_CLIENTHOSTNAME_LEN 32
......@@ -71,7 +72,7 @@ static BOOL rf_process_event_queue(RemminaProtocolWidget* gp)
rdpInput* input;
rfContext* rfi = GET_PLUGIN_DATA(gp);
RemminaPluginRdpEvent* event;
DISPLAY_CONTROL_MONITOR_LAYOUT* dcml;
if (rfi->event_queue == NULL)
return True;
......@@ -122,6 +123,19 @@ static BOOL rf_process_event_queue(RemminaProtocolWidget* gp)
free(event->clipboard_formatdatarequest.pFormatDataRequest);
break;
case REMMINA_RDP_EVENT_TYPE_SEND_MONITOR_LAYOUT:
dcml = g_malloc0(sizeof(DISPLAY_CONTROL_MONITOR_LAYOUT));
if (dcml) {
dcml->Flags = DISPLAY_CONTROL_MONITOR_PRIMARY;
dcml->Width = event->monitor_layout.width;
dcml->Height = event->monitor_layout.height;
dcml->Orientation = event->monitor_layout.desktopOrientation;
dcml->DesktopScaleFactor = event->monitor_layout.desktopScaleFactor;
dcml->DeviceScaleFactor = event->monitor_layout.deviceScaleFactor;
rfi->dispcontext->SendMonitorLayout(rfi->dispcontext, 1, dcml);
g_free(dcml);
}
break;
}
g_free(event);
......@@ -716,6 +730,7 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
gchar *gateway_host;
gint gateway_port;
gint desktopOrientation, desktopScaleFactor, deviceScaleFactor;
gint dynresw, dynresh;
remminafile = remmina_plugin_service->protocol_plugin_get_file(gp);
......@@ -738,6 +753,13 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
rfi->settings->DesktopWidth = remmina_plugin_service->file_get_int(remminafile, "resolution_width", 1024);
rfi->settings->DesktopHeight = remmina_plugin_service->file_get_int(remminafile, "resolution_height", 768);
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);
......@@ -918,6 +940,11 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
rfi->settings->DeviceScaleFactor = deviceScaleFactor;
}
/* Try to enable "Display Control Virtual Channel Extension", needed to
* dynamically resize remote desktop. This will automatically open
* the "disp" dynamic channel, if available */
rfi->settings->SupportDisplayControl = TRUE;
cs = remmina_plugin_service->file_get_string(remminafile, "sound");
if (g_strcmp0(cs, "remote") == 0)
......@@ -1137,7 +1164,7 @@ static gboolean remmina_rdp_open_connection(RemminaProtocolWidget* gp)
TRACE_CALL("remmina_rdp_open_connection");
rfContext* rfi = GET_PLUGIN_DATA(gp);
rfi->scale = remmina_plugin_service->protocol_plugin_get_scale(gp);
rfi->scale = remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp);
if (pthread_create(&rfi->thread, NULL, remmina_rdp_main_thread, gp))
{
......@@ -1246,10 +1273,13 @@ static void remmina_rdp_call_feature(RemminaProtocolWidget* gp, const RemminaPro
break;
case REMMINA_RDP_FEATURE_SCALE:
rfi->scale = remmina_plugin_service->file_get_int(remminafile, "scale", FALSE);
rfi->scale = remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp);
remmina_rdp_event_update_scale(gp);
break;
case REMMINA_RDP_FEATURE_DYNRESUPDATE:
break;
case REMMINA_RDP_FEATURE_TOOL_REFRESH:
gtk_widget_queue_draw_area(rfi->drawing_area, 0, 0,
remmina_plugin_service->protocol_plugin_get_width(gp),
......@@ -1421,6 +1451,7 @@ static const RemminaProtocolFeature remmina_rdp_features[] =
{
{ REMMINA_PROTOCOL_FEATURE_TYPE_TOOL, REMMINA_RDP_FEATURE_TOOL_REFRESH, N_("Refresh"), NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_SCALE, REMMINA_RDP_FEATURE_SCALE, NULL, NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_DYNRESUPDATE, REMMINA_RDP_FEATURE_DYNRESUPDATE, NULL, NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_TOOL, REMMINA_RDP_FEATURE_TOOL_SENDCTRLALTDEL, N_("Send Ctrl+Alt+Delete"), NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS, REMMINA_RDP_FEATURE_UNFOCUS, NULL, NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_END, 0, NULL, NULL, NULL }
......
......@@ -46,6 +46,7 @@
#include <freerdp/gdi/dc.h>
#include <freerdp/gdi/region.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/disp.h>
#include <gdk/gdkx.h>
#include <winpr/clipboard.h>
......@@ -113,7 +114,8 @@ typedef enum
REMMINA_RDP_EVENT_TYPE_MOUSE,
REMMINA_RDP_EVENT_TYPE_CLIPBOARD_SEND_CLIENT_FORMAT_LIST,
REMMINA_RDP_EVENT_TYPE_CLIPBOARD_SEND_CLIENT_FORMAT_DATA_RESPONSE,
REMMINA_RDP_EVENT_TYPE_CLIPBOARD_SEND_CLIENT_FORMAT_DATA_REQUEST
REMMINA_RDP_EVENT_TYPE_CLIPBOARD_SEND_CLIENT_FORMAT_DATA_REQUEST,
REMMINA_RDP_EVENT_TYPE_SEND_MONITOR_LAYOUT
} RemminaPluginRdpEventType;
struct remmina_plugin_rdp_event
......@@ -147,6 +149,13 @@ struct remmina_plugin_rdp_event
{
CLIPRDR_FORMAT_DATA_REQUEST* pFormatDataRequest;
} clipboard_formatdatarequest;
struct {
gint width;
gint height;
gint desktopOrientation;
gint desktopScaleFactor;
gint deviceScaleFactor;
} monitor_layout;
};
};
typedef struct remmina_plugin_rdp_event RemminaPluginRdpEvent;
......@@ -256,11 +265,12 @@ struct rf_context
freerdp* instance;
pthread_t thread;
gboolean scale;
RemminaScaleMode scale;
gboolean user_cancelled;
gboolean thread_cancelled;
CliprdrClientContext* cliprdr;
DispClientContext* dispcontext;
RDP_PLUGIN_DATA rdpdr_data[5];
RDP_PLUGIN_DATA drdynvc_data[5];
......@@ -279,7 +289,7 @@ struct rf_context
gint scale_height;
gdouble scale_x;
gdouble scale_y;
guint scale_handler;
guint delayed_monitor_layout_handler;
gboolean use_client_keymap;
HGDI_DC hdc;
......
......@@ -307,7 +307,7 @@ static void remmina_plugin_spice_display_ready_cb(GObject *display, GParamSpec *
gp);
g_object_set(display,
"scaling", remmina_plugin_service->protocol_plugin_get_scale(gp),
"scaling", (remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp) != REMMINA_PROTOCOL_WIDGET_SCALE_MODE_NONE),
"resize-guest", remmina_plugin_service->file_get_int(remminafile, "resizeguest", FALSE),
NULL);
gtk_container_add(GTK_CONTAINER(gp), GTK_WIDGET(display));
......
......@@ -595,7 +595,7 @@ static rfbBool remmina_plugin_vnc_rfb_allocfb(rfbClient *cl)
if (old_surface)
cairo_surface_destroy(old_surface);
scale = remmina_plugin_service->protocol_plugin_get_scale(gp);
scale = (remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp) != REMMINA_PROTOCOL_WIDGET_SCALE_MODE_NONE);
remmina_plugin_vnc_update_scale(gp, scale);
/* Notify window of change so that scroll border can be hidden or shown if needed */
......@@ -792,7 +792,7 @@ static void remmina_plugin_vnc_rfb_updatefb(rfbClient* cl, int x, int y, int w,
cairo_surface_mark_dirty(gpdata->rgb_buffer);
}
if (remmina_plugin_service->protocol_plugin_get_scale(gp))
if ((remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp) != REMMINA_PROTOCOL_WIDGET_SCALE_MODE_NONE))
{
remmina_plugin_vnc_scale_area(gp, &x, &y, &w, &h);
}
......@@ -1414,7 +1414,7 @@ static RemminaPluginVncCoordinates remmina_plugin_vnc_scale_coordinates(GtkWidge
GtkAllocation widget_allocation;
RemminaPluginVncCoordinates result;
if (remmina_plugin_service->protocol_plugin_get_scale(gp))
if ((remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp) != REMMINA_PROTOCOL_WIDGET_SCALE_MODE_NONE))
{
gtk_widget_get_allocation(widget, &widget_allocation);
result.x = x * remmina_plugin_service->protocol_plugin_get_width(gp) / widget_allocation.width;
......@@ -1895,7 +1895,7 @@ static gboolean remmina_plugin_vnc_on_draw(GtkWidget *widget, cairo_t *context,
width = remmina_plugin_service->protocol_plugin_get_width(gp);
height = remmina_plugin_service->protocol_plugin_get_height(gp);
if(remmina_plugin_service->protocol_plugin_get_scale(gp)) {
if((remmina_plugin_service->remmina_protocol_widget_get_current_scale_mode(gp) != REMMINA_PROTOCOL_WIDGET_SCALE_MODE_NONE)) {
gtk_widget_get_allocation(widget, &widget_allocation);
cairo_scale(context,
(double) widget_allocation.width / width,
......
......@@ -39,6 +39,7 @@ set(APPICON22_EMBLEMS_DIR "${REMMINA_DATADIR}/icons/hicolor/22x22/emblems")
set(APPICON16_ACTIONS_DATA
16x16/actions/remmina-fit-window.png
16x16/actions/remmina-scale.png
16x16/actions/remmina-dynres.png
16x16/actions/remmina-fullscreen.png
16x16/actions/remmina-switch-page.png
16x16/actions/remmina-pin-up.png
......@@ -52,6 +53,7 @@ set(APPICON16_EMBLEMS_DATA
set(APPICON22_ACTIONS_DATA
22x22/actions/remmina-fit-window.png
22x22/actions/remmina-scale.png
22x22/actions/remmina-dynres.png
22x22/actions/remmina-fullscreen.png
22x22/actions/remmina-switch-page.png
)
......
......@@ -158,7 +158,7 @@ typedef struct _RemminaPluginService
void (* protocol_plugin_set_width) (RemminaProtocolWidget *gp, gint width);
gint (* protocol_plugin_get_height) (RemminaProtocolWidget *gp);
void (* protocol_plugin_set_height) (RemminaProtocolWidget *gp, gint height);
gboolean (* protocol_plugin_get_scale) (RemminaProtocolWidget *gp);
RemminaScaleMode (* remmina_protocol_widget_get_current_scale_mode) (RemminaProtocolWidget *gp);
gboolean (* protocol_plugin_get_expand) (RemminaProtocolWidget *gp);
void (* protocol_plugin_set_expand) (RemminaProtocolWidget *gp, gboolean expand);
gboolean (* protocol_plugin_has_error) (RemminaProtocolWidget *gp);
......
......@@ -46,7 +46,8 @@ typedef enum
REMMINA_PROTOCOL_FEATURE_TYPE_PREF,
REMMINA_PROTOCOL_FEATURE_TYPE_TOOL,
REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS,
REMMINA_PROTOCOL_FEATURE_TYPE_SCALE
REMMINA_PROTOCOL_FEATURE_TYPE_SCALE,
REMMINA_PROTOCOL_FEATURE_TYPE_DYNRESUPDATE
} RemminaProtocolFeatureType;
#define REMMINA_PROTOCOL_FEATURE_PREF_RADIO 1
......@@ -119,6 +120,12 @@ typedef enum
REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY
} RemminaAuthpwdType;
typedef enum {
REMMINA_PROTOCOL_WIDGET_SCALE_MODE_NONE = 0,
REMMINA_PROTOCOL_WIDGET_SCALE_MODE_SCALED = 1,
REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES = 2
} RemminaScaleMode;
G_END_DECLS
#endif /* __REMMINA_TYPES_H__ */
......
This diff is collapsed.
......@@ -465,6 +465,13 @@ void remmina_file_save(RemminaFile *remminafile)
}
}
/* Merge resolution_width and resolution_height into resolution */
s = g_strdup_printf("%dx%d", remmina_file_get_int(remminafile, "resolution_width", 800), remmina_file_get_int(remminafile, "resolution_height", 600));
g_key_file_set_string(gkeyfile, "remmina", "resolution", s);
g_free(s);
g_key_file_remove_key(gkeyfile, "remmina", "resolution_width", NULL);
g_key_file_remove_key(gkeyfile, "remmina", "resolution_height", NULL);
/* Store gkeyfile to disk (password are already sent to keyring) */
content = g_key_file_to_data(gkeyfile, &length, NULL);
g_file_set_contents(remminafile->filename, content, length, NULL);
......
......@@ -111,6 +111,7 @@ static gboolean remmina_gtksocket_available()
}
RemminaPluginService remmina_plugin_manager_service =
{
remmina_plugin_manager_register_plugin,
......@@ -118,7 +119,7 @@ RemminaPluginService remmina_plugin_manager_service =
remmina_protocol_widget_set_width,
remmina_protocol_widget_get_height,
remmina_protocol_widget_set_height,
remmina_protocol_widget_get_scale,
remmina_protocol_widget_get_current_scale_mode,
remmina_protocol_widget_get_expand,
remmina_protocol_widget_set_expand,
remmina_protocol_widget_has_error,
......
......@@ -127,6 +127,7 @@ typedef struct _RemminaPref
guint shortcutkey_autofit;
guint shortcutkey_prevtab;
guint shortcutkey_nexttab;
guint shortcutkey_dynres;
guint shortcutkey_scale;
guint shortcutkey_grab;
guint shortcutkey_screenshot;
......
......@@ -65,7 +65,7 @@ struct _RemminaProtocolWidgetPriv
gint width;
gint height;
gboolean scale;
RemminaScaleMode scalemode;
gboolean scaler_expand;
gboolean has_error;
......@@ -89,6 +89,7 @@ enum
DISCONNECT_SIGNAL,
DESKTOP_RESIZE_SIGNAL,
UPDATE_ALIGN_SIGNAL,
UNLOCK_DYNRES_SIGNAL,
LAST_SIGNAL
};
......@@ -116,6 +117,9 @@ static void remmina_protocol_widget_class_init(RemminaProtocolWidgetClass *klass
remmina_protocol_widget_signals[UPDATE_ALIGN_SIGNAL] = g_signal_new("update-align", G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, update_align), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
remmina_protocol_widget_signals[UNLOCK_DYNRES_SIGNAL] = g_signal_new("unlock-dynres", G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, unlock_dynres), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
static void remmina_protocol_widget_init_cancel(RemminaInitDialog *dialog, gint response_id, RemminaProtocolWidget* gp)
......@@ -287,7 +291,7 @@ void remmina_protocol_widget_open_connection(RemminaProtocolWidget* gp, RemminaF
{
TRACE_CALL("remmina_protocol_widget_open_connection");
gp->priv->remmina_file = remminafile;
gp->priv->scale = remmina_file_get_int(remminafile, "scale", FALSE);
gp->priv->scalemode = remmina_file_get_int(remminafile, "scale", FALSE);
gp->priv->scaler_expand = remmina_file_get_int(remminafile, "scaler_expand", FALSE);
remmina_protocol_widget_show_init_dialog(gp, remmina_file_get_string(remminafile, "name"));
......@@ -917,16 +921,16 @@ void remmina_protocol_widget_set_height(RemminaProtocolWidget* gp, gint height)
gp->priv->height = height;
}
gboolean remmina_protocol_widget_get_scale(RemminaProtocolWidget* gp)
RemminaScaleMode remmina_protocol_widget_get_current_scale_mode(RemminaProtocolWidget *gp)
{
TRACE_CALL("remmina_protocol_widget_get_scale");
return gp->priv->scale;
TRACE_CALL("remmina_protocol_widget_get_current_scale_mode");
return gp->priv->scalemode;
}
void remmina_protocol_widget_set_scale(RemminaProtocolWidget* gp, gboolean scale)
void remmina_protocol_widget_set_current_scale_mode(RemminaProtocolWidget *gp, RemminaScaleMode scalemode)
{
TRACE_CALL("remmina_protocol_widget_set_scale");
gp->priv->scale = scale;
TRACE_CALL("remmina_protocol_widget_set_current_scale_mode");
gp->priv->scalemode = scalemode;
}
gboolean remmina_protocol_widget_get_expand(RemminaProtocolWidget* gp)
......
......@@ -69,6 +69,7 @@ struct _RemminaProtocolWidgetClass
void (*disconnect)(RemminaProtocolWidget *gp);
void (*desktop_resize)(RemminaProtocolWidget *gp);
void (*update_align)(RemminaProtocolWidget *gp);
void (*unlock_dynres)(RemminaProtocolWidget *gp);
};
GType remmina_protocol_widget_get_type(void)
......@@ -82,8 +83,8 @@ gint remmina_protocol_widget_get_width(RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_width(RemminaProtocolWidget *gp, gint width);
gint remmina_protocol_widget_get_height(RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_height(RemminaProtocolWidget *gp, gint height);
gboolean remmina_protocol_widget_get_scale(RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_scale(RemminaProtocolWidget *gp, gboolean scale);
RemminaScaleMode remmina_protocol_widget_get_current_scale_mode(RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_current_scale_mode(RemminaProtocolWidget *gp, RemminaScaleMode scalemode);
gboolean remmina_protocol_widget_get_expand(RemminaProtocolWidget *gp);
void remmina_protocol_widget_set_expand(RemminaProtocolWidget *gp, gboolean expand);
gboolean remmina_protocol_widget_has_error(RemminaProtocolWidget *gp);
......
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