Fix reconnect-loop going from initial fullscreen on Unity

Moving responsibility for actual resize to process_pending_resize()
Cleaning up duplicated calculation of session size
Removing handling of percentage of screen for now

Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
This commit is contained in:
Cendio 2018-01-30 16:29:44 +01:00
parent 58d8f78eea
commit 81c030a887

52
xwin.c
View File

@ -2332,40 +2332,46 @@ xwin_toggle_fullscreen(void)
g_fullscreen = !g_fullscreen; g_fullscreen = !g_fullscreen;
/* What size should the new window have? */
if (g_fullscreen) if (g_fullscreen)
{ {
/* Since we need to create a fullscreen window we need to know screen size */
x = 0; x = 0;
y = 0, y = 0;
width = WidthOfScreen(g_screen); width = WidthOfScreen(g_screen);
height = HeightOfScreen(g_screen); height = HeightOfScreen(g_screen);
} }
else else
{ {
/* Restore "old" window size */
x = windowed_x; x = windowed_x;
y = windowed_y; y = windowed_y;
width = windowed_width; width = windowed_width;
height = windowed_height; height = windowed_height;
} }
/* Resize rdesktop window using new size and window attributes */ logger(GUI, Debug, "xwin_toggle_fullscreen(), new window: %dx%d+%d+%d, last window: %dx%d",
width, height, x, y, windowed_width, windowed_height);
/* Re-create the rdesktop window using new size and window
attributes. */
g_xpos = x; g_xpos = x;
g_ypos = y; g_ypos = y;
ui_destroy_window(); ui_destroy_window();
ui_create_window(width, height); ui_create_window(width, height);
/* Change session size to match new window size */ /* If the window manager overrides our window size request, we trust
if (rdpedisp_is_available() == False) the normal window resize mechanism to take care of resizing the
session. When window is configured as override-redirect
(i.e. fullscreen), this disables the normal window resize
mechanism. In that case, we have to take care of the resize
ourselves setting g_pending_resize. */
if (g_fullscreen)
{ {
/* Change session size using disconnect / reconnect mechanism */
g_pending_resize = True; g_pending_resize = True;
g_window_width = width; g_window_width = width;
g_window_height = height; g_window_height = height;
return;
}
else
{
/* Change session size using DisplayControl extension (RDPEDISP) */
rdpedisp_set_session_size(width, height);
} }
XDefineCursor(g_display, g_wnd, g_current_cursor); XDefineCursor(g_display, g_wnd, g_current_cursor);
@ -3039,10 +3045,8 @@ process_pending_resize ()
if (g_pending_resize_defer == True) if (g_pending_resize_defer == True)
return False; return False;
/* only for fullscreen or x%-of-screen-sized windows */ /* Set up width and height for new session */
if (g_window_size_type == PercentageOfScreen if (g_fullscreen || g_seamless_rdp)
|| g_window_size_type == Fullscreen
|| g_fullscreen)
{ {
/* follow root window size */ /* follow root window size */
width = WidthOfScreen(g_screen); width = WidthOfScreen(g_screen);
@ -3060,12 +3064,12 @@ process_pending_resize ()
} }
/* carry out a resize to desired size */ /* Carry out a resize to desired size */
if (rdpedisp_is_available() == False) if (rdpedisp_is_available() == False)
{ {
/* resize session using disconnect reconnect /* resize session using disconnect reconnect
* sequence if RDPEDISP is not support by * sequence when RDPEDISP is not supported by
* server. * server by returning to outer loop.
*/ */
g_requested_session_width = width; g_requested_session_width = width;
@ -3083,18 +3087,6 @@ process_pending_resize ()
if (now_ts - g_wait_for_deactivate_ts <= 5) if (now_ts - g_wait_for_deactivate_ts <= 5)
return False; return False;
/* size of current window */
width = g_window_width;
height = g_window_height;
/* resize session using RDPEDISP */
if (g_fullscreen || g_seamless_rdp)
{
/* size of screen */
width = WidthOfScreen(g_screen);
height = HeightOfScreen(g_screen);
}
logger(GUI, Verbose, "Window resize detected, requesting matching session size %dx%d", logger(GUI, Verbose, "Window resize detected, requesting matching session size %dx%d",
width, height); width, height);