From a836faf3edef8793ad73d129e00ce71a972b3ccd Mon Sep 17 00:00:00 2001 From: Anthony Tong Date: Tue, 1 Nov 2011 18:53:49 -0500 Subject: [PATCH] xfreerdp: handle -g X% --- client/X11/xf_monitor.c | 5 +++++ include/freerdp/settings.h | 1 + libfreerdp-utils/args.c | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/client/X11/xf_monitor.c b/client/X11/xf_monitor.c index 2e5ee31ca..c4a1e1ad9 100644 --- a/client/X11/xf_monitor.c +++ b/client/X11/xf_monitor.c @@ -56,6 +56,11 @@ boolean xf_detect_monitors(xfInfo* xfi, rdpSettings* settings) settings->width = xfi->workArea.width; settings->height = xfi->workArea.height; } + else if (settings->percent_screen) + { + settings->width = (xfi->workArea.width * settings->percent_screen) / 100; + settings->height = (xfi->workArea.height * settings->percent_screen) / 100; + } if (settings->fullscreen != True && settings->workarea != True) return True; diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 24f754328..4b7157270 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -186,6 +186,7 @@ struct rdp_settings uint16 width; uint16 height; + uint16 percent_screen; boolean sw_gdi; boolean workarea; boolean fullscreen; diff --git a/libfreerdp-utils/args.c b/libfreerdp-utils/args.c index 8730cd0b5..e17265108 100644 --- a/libfreerdp-utils/args.c +++ b/libfreerdp-utils/args.c @@ -184,6 +184,15 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, { settings->height = (uint16) strtol(p + 1, &p, 10); } + if (*p == '%') + { + settings->percent_screen = settings->width; + if (settings->percent_screen <= 0 || settings->percent_screen > 100) + { + printf("invalid geometry percentage\n"); + return -1; + } + } else { if (ui_callback != NULL)