Support for specifying geometry in terms of percent of whole screen

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@499 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2003-10-15 14:32:43 +00:00
parent 3a323bbcc1
commit c60d7c4f3f
3 changed files with 33 additions and 10 deletions

View File

@ -54,7 +54,8 @@ en-us, en-gb, de, fr, sv, etc. The default is en-us (a US keyboard).
.BR "-g <geometry>"
Desktop geometry (WxH). If geometry is the special word "workarea", the geometry
will be fetched from the extended window manager hints property _NET_WORKAREA, from
the root window.
the root window. The geometry can also be specified in terms of percent of the whole
screen, like "-g 80%".
.TP
.BR "-f"
Enable fullscreen mode. This overrides the window manager and causes the

View File

@ -45,8 +45,12 @@ char g_username[64];
char hostname[16];
char keymapname[16];
int keylayout = 0x409; /* Defaults to US keyboard layout */
int g_width = 800; /* If width or height are reset to zero, the geometry will
be fetched from _NET_WORKAREA */
int g_width = 800; /* width is special: If 0, the
geometry will be fetched from
_NET_WORKAREA. If negative,
absolute value specifies the
percent of the whole screen. */
int g_height = 600;
int tcp_port_rdp = TCP_PORT_RDP;
int g_server_bpp = 8;
@ -304,14 +308,24 @@ main(int argc, char *argv[])
}
g_width = strtol(optarg, &p, 10);
if (*p == 'x')
g_height = strtol(p + 1, NULL, 10);
if ((g_width == 0) || (g_height == 0))
if (g_width <= 0)
{
error("invalid geometry\n");
return 1;
}
if (*p == 'x')
g_height = strtol(p + 1, NULL, 10);
if (g_height <= 0)
{
error("invalid geometry\n");
return 1;
}
if (*p == '%')
g_width = -g_width;
break;
case 'f':

14
xwin.c
View File

@ -719,7 +719,16 @@ ui_init(void)
g_host_be = !(BOOL) (*(uint8 *) (&test));
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);
if ((g_width == 0) || (g_height == 0))
/*
* Determine desktop size
*/
if (g_width < 0)
{
/* Percent of screen */
g_height = HeightOfScreen(g_screen) * (-g_width) / 100;
g_width = WidthOfScreen(g_screen) * (-g_width) / 100;
}
else if (g_width == 0)
{
/* Fetch geometry from _NET_WORKAREA */
uint32 x, y, cx, cy;
@ -736,8 +745,7 @@ ui_init(void)
g_height = 600;
}
}
if (g_fullscreen)
else if (g_fullscreen)
{
g_width = WidthOfScreen(g_screen);
g_height = HeightOfScreen(g_screen);