From 8524a3fcf203fa20587dc1c916a8cc350402a2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Fri, 7 Mar 2008 11:27:12 +0000 Subject: [PATCH] Applied patch: [ 1715358 ] seamlessrdp window close git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1446 423420c4-83ab-492f-b58f-81f9feb106b5 --- doc/seamlessrdp-channel.txt | 8 ++++++-- proto.h | 1 + seamless.c | 7 +++++++ xwin.c | 16 +++++++++++----- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/doc/seamlessrdp-channel.txt b/doc/seamlessrdp-channel.txt index c926404..72a358e 100644 --- a/doc/seamlessrdp-channel.txt +++ b/doc/seamlessrdp-channel.txt @@ -324,6 +324,11 @@ Syntax: Changes which window that will recieve the keyboard events. Note that this might cause the window to change z order. +DESTROY +------- + +Identical to the command sent from server to client. + Test Cases ========== @@ -390,5 +395,4 @@ Test Cases * Test X11 window close: Start Notepad and open the Help Browser. Close the Help Browser window on the X11 side using your window manager. Verify that rdesktop still runs and that the Notepad - application window still exists. (currently fails, see patch - 1715358) + application window still exists. diff --git a/proto.h b/proto.h index 7fed515..c277b49 100644 --- a/proto.h +++ b/proto.h @@ -309,6 +309,7 @@ unsigned int seamless_send_position(unsigned long id, int x, int y, int width, i void seamless_select_timeout(struct timeval *tv); unsigned int seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags); unsigned int seamless_send_focus(unsigned long id, unsigned long flags); +unsigned int seamless_send_destroy(unsigned long id); /* scard.c */ void scard_lock(int lock); void scard_unlock(int lock); diff --git a/seamless.c b/seamless.c index 3dddf16..42b7685 100644 --- a/seamless.c +++ b/seamless.c @@ -509,3 +509,10 @@ seamless_send_focus(unsigned long id, unsigned long flags) return seamless_send("FOCUS", "0x%08lx,0x%lx", id, flags); } + +/* Send client-to-server message to destroy process on the server. */ +unsigned int +seamless_send_destroy(unsigned long id) +{ + return seamless_send("DESTROY", "0x%08lx", id); +} diff --git a/xwin.c b/xwin.c index b5d54fe..edf51fb 100644 --- a/xwin.c +++ b/xwin.c @@ -2028,8 +2028,16 @@ xwin_process_events(void) /* the window manager told us to quit */ if ((xevent.xclient.message_type == g_protocol_atom) && ((Atom) xevent.xclient.data.l[0] == g_kill_atom)) - /* Quit */ - return 0; + { + /* When killing a seamless window, close the window on the + serverside instead of terminating rdesktop */ + sw = sw_get_window_by_wnd(xevent.xclient.window); + if (!sw) + /* Otherwise, quit */ + return 0; + /* send seamless destroy process message */ + seamless_send_destroy(sw->id); + } break; case KeyPress: @@ -3465,9 +3473,7 @@ ui_seamless_create_window(unsigned long id, unsigned long group, unsigned long p XSelectInput(g_display, wnd, input_mask); - /* handle the WM_DELETE_WINDOW protocol. FIXME: When killing a - seamless window, we could try to close the window on the - serverside, instead of terminating rdesktop */ + /* handle the WM_DELETE_WINDOW protocol. */ XSetWMProtocols(g_display, wnd, &g_kill_atom, 1); sw = xmalloc(sizeof(seamless_window));