diff --git a/rdesktop.c b/rdesktop.c index 848ac38..6010531 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -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; diff --git a/xwin.c b/xwin.c index 1baba68..f91cc37 100644 --- a/xwin.c +++ b/xwin.c @@ -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);