This patch is a re-work of patch r1538. One one hand, the plain old
behaviour of setting the session size in ui_init is not going to work, due to xrandr, as pointed out in r1538. However, the approach implemented in this revision doesn't work either: When the window is created before the connection, this means that as soon as X11 events are recieved, this is going to trigger RDP transmissions. For example, a call to reset_modifiers_keys. But if the RDP connection is not ready, the WTS is not prepared to handle such data. We must wait with, for example, keyboard input until the connection is READY. OTOH, we can't just ignore those X11 events; that might lead to that we are not sending information that we need to send. So, it is actually better to wait with creating the window until we have been connected. An additional advantage of this is that for the load balancing / session directory case, there's no risk of confusion of which RDP connection we are actually sending data to. The previous behaviour of creating the window after we have been connected has been restored. Since we still need to set connection data (currently screen size) on a per connection basis, we need to create a new UI function for this. Non-X11 backends need to implement this new function. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1545 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
f284a915ad
commit
ea2bdbc96b
1
proto.h
1
proto.h
@ -231,6 +231,7 @@ void rdp_send_scancode(uint32 time, uint16 flags, uint8 scancode);
|
|||||||
/* xwin.c */
|
/* xwin.c */
|
||||||
RD_BOOL get_key_state(unsigned int state, uint32 keysym);
|
RD_BOOL get_key_state(unsigned int state, uint32 keysym);
|
||||||
RD_BOOL ui_init(void);
|
RD_BOOL ui_init(void);
|
||||||
|
void ui_init_connection(void);
|
||||||
void ui_deinit(void);
|
void ui_deinit(void);
|
||||||
RD_BOOL ui_create_window(void);
|
RD_BOOL ui_create_window(void);
|
||||||
void ui_resize_window(void);
|
void ui_resize_window(void);
|
||||||
|
@ -965,9 +965,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (run_count < 2 && continue_connect) /* add support for Session Directory; only reconnect once */
|
while (run_count < 2 && continue_connect) /* add support for Session Directory; only reconnect once */
|
||||||
{
|
{
|
||||||
if (run_count == 0)
|
ui_init_connection();
|
||||||
if (!ui_create_window())
|
|
||||||
return EX_OSERR;
|
|
||||||
|
|
||||||
if (run_count == 0)
|
if (run_count == 0)
|
||||||
{
|
{
|
||||||
@ -986,6 +984,10 @@ main(int argc, char *argv[])
|
|||||||
DEBUG(("Connection successful.\n"));
|
DEBUG(("Connection successful.\n"));
|
||||||
memset(password, 0, sizeof(password));
|
memset(password, 0, sizeof(password));
|
||||||
|
|
||||||
|
if (run_count == 0)
|
||||||
|
if (!ui_create_window())
|
||||||
|
return EX_OSERR;
|
||||||
|
|
||||||
if (continue_connect)
|
if (continue_connect)
|
||||||
rdp_main_loop(&deactivated, &ext_disc_reason);
|
rdp_main_loop(&deactivated, &ext_disc_reason);
|
||||||
|
|
||||||
|
86
xwin.c
86
xwin.c
@ -1818,6 +1818,7 @@ error_handler(Display * dpy, XErrorEvent * eev)
|
|||||||
return g_old_error_handler(dpy, eev);
|
return g_old_error_handler(dpy, eev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialize the UI. This is done once per process. */
|
||||||
RD_BOOL
|
RD_BOOL
|
||||||
ui_init(void)
|
ui_init(void)
|
||||||
{
|
{
|
||||||
@ -1894,6 +1895,53 @@ ui_init(void)
|
|||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Initialize connection specific data, such as session size.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ui_init_connection(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ui_deinit(void)
|
ui_deinit(void)
|
||||||
{
|
{
|
||||||
@ -1961,44 +2009,6 @@ ui_create_window(void)
|
|||||||
long input_mask, ic_input_mask;
|
long input_mask, ic_input_mask;
|
||||||
XEvent xevent;
|
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;
|
wndwidth = g_fullscreen ? WidthOfScreen(g_screen) : g_width;
|
||||||
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height;
|
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user