Window-placement patch by <gregmhughes@comcast.net>

small modifications by me, to only set the PPosition sizehint, if the
position was specified on the command-line


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@866 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2005-03-23 12:25:54 +00:00
parent 81ff5d29b9
commit 5a0fa7b5ab
2 changed files with 19 additions and 0 deletions

View File

@ -60,6 +60,10 @@ int g_width = 800; /* width is special: If 0, the
int g_height = 600;
int g_xpos = 0;
int g_ypos = 0;
int g_pos = 0; /* 0 position unspecified,
1 specified,
2 xpos neg,
4 ypos neg */
extern int g_tcp_port_rdp;
int g_server_bpp = 8;
int g_win_button_size = 0; /* If zero, disable single app mode */
@ -481,10 +485,16 @@ main(int argc, char *argv[])
}
if (*p == '+' || *p == '-')
{
g_pos |= (*p == '-') ? 2 : 1;
g_xpos = strtol(p, &p, 10);
}
if (*p == '+' || *p == '-')
{
g_pos |= (*p == '-') ? 4 : 1;
g_ypos = strtol(p, NULL, 10);
}
break;

9
xwin.c
View File

@ -32,6 +32,7 @@ extern int g_width;
extern int g_height;
extern int g_xpos;
extern int g_ypos;
extern int g_pos;
extern BOOL g_sendmotion;
extern BOOL g_fullscreen;
extern BOOL g_grab_keyboard;
@ -1163,6 +1164,12 @@ ui_create_window(void)
wndwidth = g_fullscreen ? WidthOfScreen(g_screen) : g_width;
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height;
/* Handle -x-y portion of geometry string */
if (g_xpos < 0 || (g_xpos == 0 && (g_pos & 2)))
g_xpos = WidthOfScreen(g_screen) + g_xpos - g_width;
if (g_ypos < 0 || (g_ypos == 0 && (g_pos & 4)))
g_ypos = HeightOfScreen(g_screen) + g_ypos - g_height;
attribs.background_pixel = BlackPixelOfScreen(g_screen);
attribs.border_pixel = WhitePixelOfScreen(g_screen);
attribs.backing_store = g_ownbackstore ? NotUseful : Always;
@ -1206,6 +1213,8 @@ ui_create_window(void)
if (sizehints)
{
sizehints->flags = PMinSize | PMaxSize;
if (g_pos)
sizehints->flags |= PPosition;
sizehints->min_width = sizehints->max_width = g_width;
sizehints->min_height = sizehints->max_height = g_height;
XSetWMNormalHints(g_display, g_wnd, sizehints);