Don't activate seamless mode until we have a working connection with the
remote server (i.e. when we get a HELLO). Also change g_seamless_rdp to mean that -A was specified on the command line. g_seamless_active now indicates if we're in seamless or "normal" mode. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1148 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
7b5cd1c963
commit
905e228417
1
proto.h
1
proto.h
@ -272,6 +272,7 @@ void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy);
|
||||
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy);
|
||||
void ui_begin_update(void);
|
||||
void ui_end_update(void);
|
||||
void ui_seamless_begin(void);
|
||||
void ui_seamless_toggle(void);
|
||||
void ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long flags);
|
||||
void ui_seamless_destroy_window(unsigned long id, unsigned long flags);
|
||||
|
23
seamless.c
23
seamless.c
@ -69,9 +69,6 @@ seamless_process_line(const char *line, void *data)
|
||||
|
||||
DEBUG_SEAMLESS(("seamlessrdp got:%s\n", p));
|
||||
|
||||
if (!g_seamless_rdp)
|
||||
return True;
|
||||
|
||||
tok1 = seamless_get_token(&p);
|
||||
tok2 = seamless_get_token(&p);
|
||||
tok3 = seamless_get_token(&p);
|
||||
@ -218,6 +215,17 @@ seamless_process_line(const char *line, void *data)
|
||||
|
||||
/* do nothing, currently */
|
||||
}
|
||||
else if (!strcmp("HELLO", tok1))
|
||||
{
|
||||
if (!tok2)
|
||||
return False;
|
||||
|
||||
flags = strtoul(tok2, &endptr, 0);
|
||||
if (*endptr)
|
||||
return False;
|
||||
|
||||
ui_seamless_begin();
|
||||
}
|
||||
|
||||
|
||||
xfree(l);
|
||||
@ -261,6 +269,9 @@ seamless_process(STREAM s)
|
||||
BOOL
|
||||
seamless_init(void)
|
||||
{
|
||||
if (!g_seamless_rdp)
|
||||
return False;
|
||||
|
||||
seamless_channel =
|
||||
channel_register("seamrdp", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,
|
||||
seamless_process);
|
||||
@ -297,6 +308,9 @@ seamless_send(const char *format, ...)
|
||||
void
|
||||
seamless_send_sync()
|
||||
{
|
||||
if (!g_seamless_rdp)
|
||||
return;
|
||||
|
||||
seamless_send("SYNC\n");
|
||||
}
|
||||
|
||||
@ -304,5 +318,8 @@ seamless_send_sync()
|
||||
void
|
||||
seamless_send_state(unsigned long id, unsigned int state, unsigned long flags)
|
||||
{
|
||||
if (!g_seamless_rdp)
|
||||
return;
|
||||
|
||||
seamless_send("STATE,0x%08lx,0x%x,0x%lx\n", id, state, flags);
|
||||
}
|
||||
|
65
xwin.c
65
xwin.c
@ -62,6 +62,8 @@ typedef struct _seamless_window
|
||||
struct _seamless_window *next;
|
||||
} seamless_window;
|
||||
static seamless_window *g_seamless_windows = NULL;
|
||||
static BOOL g_seamless_started = False; /* Server end is up and running */
|
||||
static BOOL g_seamless_active = False; /* We are currently in seamless mode */
|
||||
extern BOOL g_seamless_rdp;
|
||||
|
||||
extern uint32 g_embed_wnd;
|
||||
@ -1565,8 +1567,7 @@ ui_create_window(void)
|
||||
}
|
||||
|
||||
XSelectInput(g_display, g_wnd, input_mask);
|
||||
if (!g_seamless_rdp)
|
||||
{
|
||||
|
||||
XMapWindow(g_display, g_wnd);
|
||||
/* wait for VisibilityNotify */
|
||||
do
|
||||
@ -1575,7 +1576,6 @@ ui_create_window(void)
|
||||
}
|
||||
while (xevent.type != VisibilityNotify);
|
||||
g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured;
|
||||
}
|
||||
|
||||
g_focused = False;
|
||||
g_mouse_in_wnd = False;
|
||||
@ -1639,7 +1639,7 @@ xwin_toggle_fullscreen(void)
|
||||
{
|
||||
Pixmap contents = 0;
|
||||
|
||||
if (g_seamless_rdp)
|
||||
if (g_seamless_active)
|
||||
/* Turn off SeamlessRDP mode */
|
||||
ui_seamless_toggle();
|
||||
|
||||
@ -1988,11 +1988,11 @@ xwin_process_events(void)
|
||||
|
||||
break;
|
||||
case MapNotify:
|
||||
if (!g_seamless_rdp)
|
||||
if (!g_seamless_active)
|
||||
rdp_send_client_window_status(1);
|
||||
break;
|
||||
case UnmapNotify:
|
||||
if (!g_seamless_rdp)
|
||||
if (!g_seamless_active)
|
||||
rdp_send_client_window_status(0);
|
||||
break;
|
||||
}
|
||||
@ -3005,10 +3005,30 @@ ui_end_update(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ui_seamless_begin()
|
||||
{
|
||||
if (!g_seamless_rdp)
|
||||
return;
|
||||
|
||||
if (g_seamless_started)
|
||||
return;
|
||||
|
||||
g_seamless_started = True;
|
||||
|
||||
ui_seamless_toggle();
|
||||
}
|
||||
|
||||
void
|
||||
ui_seamless_toggle()
|
||||
{
|
||||
if (g_seamless_rdp)
|
||||
if (!g_seamless_rdp)
|
||||
return;
|
||||
|
||||
if (!g_seamless_started)
|
||||
return;
|
||||
|
||||
if (g_seamless_active)
|
||||
{
|
||||
/* Deactivate */
|
||||
while (g_seamless_windows)
|
||||
@ -3021,22 +3041,11 @@ ui_seamless_toggle()
|
||||
else
|
||||
{
|
||||
/* Activate */
|
||||
if (g_win_button_size)
|
||||
{
|
||||
error("SeamlessRDP mode cannot be activated when using single application mode\n");
|
||||
return;
|
||||
}
|
||||
if (!g_using_full_workarea)
|
||||
{
|
||||
error("SeamlessRDP mode requires a session that covers the whole screen");
|
||||
return;
|
||||
}
|
||||
|
||||
XUnmapWindow(g_display, g_wnd);
|
||||
seamless_send_sync();
|
||||
}
|
||||
|
||||
g_seamless_rdp = !g_seamless_rdp;
|
||||
g_seamless_active = !g_seamless_active;
|
||||
}
|
||||
|
||||
void
|
||||
@ -3049,6 +3058,9 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long
|
||||
long input_mask;
|
||||
seamless_window *sw, *sw_parent;
|
||||
|
||||
if (!g_seamless_active)
|
||||
return;
|
||||
|
||||
/* Ignore CREATEs for existing windows */
|
||||
sw = seamless_get_window_by_id(id);
|
||||
if (sw)
|
||||
@ -3128,6 +3140,9 @@ ui_seamless_destroy_window(unsigned long id, unsigned long flags)
|
||||
{
|
||||
seamless_window *sw;
|
||||
|
||||
if (!g_seamless_active)
|
||||
return;
|
||||
|
||||
sw = seamless_get_window_by_id(id);
|
||||
if (!sw)
|
||||
{
|
||||
@ -3145,6 +3160,9 @@ ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, u
|
||||
{
|
||||
seamless_window *sw;
|
||||
|
||||
if (!g_seamless_active)
|
||||
return;
|
||||
|
||||
sw = seamless_get_window_by_id(id);
|
||||
if (!sw)
|
||||
{
|
||||
@ -3186,6 +3204,9 @@ ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags)
|
||||
{
|
||||
seamless_window *sw;
|
||||
|
||||
if (!g_seamless_active)
|
||||
return;
|
||||
|
||||
sw = seamless_get_window_by_id(id);
|
||||
if (!sw)
|
||||
{
|
||||
@ -3204,6 +3225,9 @@ ui_seamless_setstate(unsigned long id, unsigned int state, unsigned long flags)
|
||||
{
|
||||
seamless_window *sw;
|
||||
|
||||
if (!g_seamless_active)
|
||||
return;
|
||||
|
||||
sw = seamless_get_window_by_id(id);
|
||||
if (!sw)
|
||||
{
|
||||
@ -3253,6 +3277,9 @@ ui_seamless_setstate(unsigned long id, unsigned int state, unsigned long flags)
|
||||
void
|
||||
ui_seamless_syncbegin(unsigned long flags)
|
||||
{
|
||||
if (!g_seamless_active)
|
||||
return;
|
||||
|
||||
/* Destroy all seamless windows */
|
||||
while (g_seamless_windows)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user