diff --git a/rdesktop.c b/rdesktop.c index a3aba01..f7c3e90 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -960,6 +960,10 @@ main(int argc, char *argv[]) while (run_count < 2 && continue_connect) /* add support for Session Directory; only reconnect once */ { + if (run_count == 0) + if (!ui_create_window()) + return EX_OSERR; + if (run_count == 0) { if (!rdp_connect(server, flags, domain, password, shell, directory, False)) @@ -977,10 +981,6 @@ main(int argc, char *argv[]) DEBUG(("Connection successful.\n")); memset(password, 0, sizeof(password)); - if (run_count == 0) - if (!ui_create_window()) - continue_connect = False; - if (continue_connect) rdp_main_loop(&deactivated, &ext_disc_reason); diff --git a/xwin.c b/xwin.c index 2c7deaa..369bf60 100644 --- a/xwin.c +++ b/xwin.c @@ -1874,44 +1874,6 @@ ui_init(void) g_ownbackstore = True; } - /* - * Determine desktop size - */ - if (g_fullscreen) - { - g_width = WidthOfScreen(g_screen); - g_height = HeightOfScreen(g_screen); - g_using_full_workarea = True; - } - else if (g_width < 0) - { - /* Percent of screen */ - if (-g_width >= 100) - g_using_full_workarea = True; - 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; - if (get_current_workarea(&x, &y, &cx, &cy) == 0) - { - g_width = cx; - g_height = cy; - g_using_full_workarea = True; - } - else - { - warning("Failed to get workarea: probably your window manager does not support extended hints\n"); - g_width = WidthOfScreen(g_screen); - g_height = HeightOfScreen(g_screen); - } - } - - /* make sure width is a multiple of 4 */ - g_width = (g_width + 3) & ~3; - g_mod_map = XGetModifierMapping(g_display); xwin_refresh_pointer_map(); @@ -1999,6 +1961,44 @@ ui_create_window(void) long input_mask, ic_input_mask; XEvent xevent; + /* + * Determine desktop size + */ + if (g_fullscreen) + { + g_width = WidthOfScreen(g_screen); + g_height = HeightOfScreen(g_screen); + g_using_full_workarea = True; + } + else if (g_width < 0) + { + /* Percent of screen */ + if (-g_width >= 100) + g_using_full_workarea = True; + 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; + if (get_current_workarea(&x, &y, &cx, &cy) == 0) + { + g_width = cx; + g_height = cy; + g_using_full_workarea = True; + } + else + { + warning("Failed to get workarea: probably your window manager does not support extended hints\n"); + g_width = WidthOfScreen(g_screen); + g_height = HeightOfScreen(g_screen); + } + } + + /* make sure width is a multiple of 4 */ + g_width = (g_width + 3) & ~3; + wndwidth = g_fullscreen ? WidthOfScreen(g_screen) : g_width; wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height;