Add check if we can use dynamic session resize
When the server does not comply with our initial session size request, we disable the dynamic session resize feature. Co-authored-by: Henrik Andersson <hean01@cendio.com> Co-authored-by: Karl Mikaelsson <derfian@cendio.se>
This commit is contained in:
parent
9d163423eb
commit
8bc2cea80f
1
proto.h
1
proto.h
@ -264,6 +264,7 @@ void ui_deinit(void);
|
|||||||
RD_BOOL ui_create_window(uint32 width, uint32 height);
|
RD_BOOL ui_create_window(uint32 width, uint32 height);
|
||||||
void ui_resize_window(uint32 width, uint32 height);
|
void ui_resize_window(uint32 width, uint32 height);
|
||||||
void ui_destroy_window(void);
|
void ui_destroy_window(void);
|
||||||
|
void ui_update_window_sizehints(uint32 width, uint32 height);
|
||||||
RD_BOOL ui_have_window(void);
|
RD_BOOL ui_have_window(void);
|
||||||
void xwin_toggle_fullscreen(void);
|
void xwin_toggle_fullscreen(void);
|
||||||
void ui_select(int rdp_socket);
|
void ui_select(int rdp_socket);
|
||||||
|
23
rdp.c
23
rdp.c
@ -54,6 +54,8 @@ extern struct timeval g_pending_resize_defer_timer;
|
|||||||
extern RD_BOOL g_network_error;
|
extern RD_BOOL g_network_error;
|
||||||
extern time_t g_wait_for_deactivate_ts;
|
extern time_t g_wait_for_deactivate_ts;
|
||||||
|
|
||||||
|
extern RD_BOOL g_dynamic_session_resize;
|
||||||
|
|
||||||
RD_BOOL g_exit_mainloop = False;
|
RD_BOOL g_exit_mainloop = False;
|
||||||
|
|
||||||
uint8 *g_next_packet;
|
uint8 *g_next_packet;
|
||||||
@ -1102,10 +1104,13 @@ rdp_process_general_caps(STREAM s)
|
|||||||
g_rdp_version = RDP_V4;
|
g_rdp_version = RDP_V4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RD_BOOL g_first_bitmap_caps = True;
|
||||||
|
|
||||||
/* Process a bitmap capability set */
|
/* Process a bitmap capability set */
|
||||||
static void
|
static void
|
||||||
rdp_process_bitmap_caps(STREAM s)
|
rdp_process_bitmap_caps(STREAM s)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint16 depth;
|
uint16 depth;
|
||||||
|
|
||||||
logger(Protocol, Debug, "%s()", __func__);
|
logger(Protocol, Debug, "%s()", __func__);
|
||||||
@ -1120,6 +1125,15 @@ rdp_process_bitmap_caps(STREAM s)
|
|||||||
"rdp_process_bitmap_caps(), setting desktop size and depth to: %dx%dx%d",
|
"rdp_process_bitmap_caps(), setting desktop size and depth to: %dx%dx%d",
|
||||||
g_session_width, g_session_height, depth);
|
g_session_width, g_session_height, depth);
|
||||||
|
|
||||||
|
/* Detect if we can have dynamic session resize enabled, only once. */
|
||||||
|
if (g_first_bitmap_caps == True && !(g_session_width == g_requested_session_width
|
||||||
|
&& g_session_height == g_requested_session_height))
|
||||||
|
{
|
||||||
|
logger(Core, Notice, "Disabling dynamic session resize");
|
||||||
|
g_dynamic_session_resize = False;
|
||||||
|
}
|
||||||
|
g_first_bitmap_caps = False;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The server may limit depth and change the size of the desktop (for
|
* The server may limit depth and change the size of the desktop (for
|
||||||
* example when shadowing another session).
|
* example when shadowing another session).
|
||||||
@ -1139,6 +1153,14 @@ rdp_process_bitmap_caps(STREAM s)
|
|||||||
if (g_fullscreen == True)
|
if (g_fullscreen == True)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* If dynamic session resize is disabled, set window size hints to
|
||||||
|
fixed session size */
|
||||||
|
if (g_dynamic_session_resize == False)
|
||||||
|
{
|
||||||
|
ui_update_window_sizehints(g_session_width, g_session_height);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ui_resize_window(g_session_width, g_session_height);
|
ui_resize_window(g_session_width, g_session_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1974,6 +1996,7 @@ rdp_reset_state(void)
|
|||||||
g_next_packet = NULL; /* reset the packet information */
|
g_next_packet = NULL; /* reset the packet information */
|
||||||
g_rdp_shareid = 0;
|
g_rdp_shareid = 0;
|
||||||
g_exit_mainloop = False;
|
g_exit_mainloop = False;
|
||||||
|
g_first_bitmap_caps = True;
|
||||||
sec_reset_state();
|
sec_reset_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
xwin.c
19
xwin.c
@ -77,6 +77,8 @@ static int g_x_socket;
|
|||||||
static Screen *g_screen;
|
static Screen *g_screen;
|
||||||
Window g_wnd;
|
Window g_wnd;
|
||||||
|
|
||||||
|
RD_BOOL g_dynamic_session_resize = True;
|
||||||
|
|
||||||
/* These are the last known window sizes. They are updated whenever the window size is changed. */
|
/* These are the last known window sizes. They are updated whenever the window size is changed. */
|
||||||
static uint32 g_window_width;
|
static uint32 g_window_width;
|
||||||
static uint32 g_window_height;
|
static uint32 g_window_height;
|
||||||
@ -2076,7 +2078,7 @@ get_sizehints(XSizeHints *sizehints, uint32 width, uint32 height)
|
|||||||
sizehints->width_inc = 2; /* session width must be divisible by two */
|
sizehints->width_inc = 2; /* session width must be divisible by two */
|
||||||
sizehints->height_inc = 1;
|
sizehints->height_inc = 1;
|
||||||
|
|
||||||
if (g_seamless_rdp)
|
if (g_seamless_rdp || !g_dynamic_session_resize)
|
||||||
{
|
{
|
||||||
/* disable dynamic session resize based on window size for
|
/* disable dynamic session resize based on window size for
|
||||||
rdesktop main window when seamless is enabled */
|
rdesktop main window when seamless is enabled */
|
||||||
@ -2086,6 +2088,19 @@ get_sizehints(XSizeHints *sizehints, uint32 width, uint32 height)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_update_window_sizehints(uint32 width, uint32 height)
|
||||||
|
{
|
||||||
|
XSizeHints *sizehints;
|
||||||
|
sizehints = XAllocSizeHints();
|
||||||
|
if (sizehints)
|
||||||
|
{
|
||||||
|
get_sizehints(sizehints, width, height);
|
||||||
|
XSetWMNormalHints(g_display, g_wnd, sizehints);
|
||||||
|
XFree(sizehints);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RD_BOOL
|
RD_BOOL
|
||||||
ui_create_window(uint32 width, uint32 height)
|
ui_create_window(uint32 width, uint32 height)
|
||||||
{
|
{
|
||||||
@ -3124,7 +3139,7 @@ ui_select(int rdp_socket)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pending_resize == True)
|
if (g_pending_resize == True && g_dynamic_session_resize)
|
||||||
{
|
{
|
||||||
/* returns True on disconnect-reconnect resize */
|
/* returns True on disconnect-reconnect resize */
|
||||||
if (process_pending_resize() == True)
|
if (process_pending_resize() == True)
|
||||||
|
Loading…
Reference in New Issue
Block a user