From 5fb42a20e345d0e0be9e767fc8c03076f33426bc Mon Sep 17 00:00:00 2001 From: Brent Collins Date: Fri, 4 May 2012 13:00:28 -0500 Subject: [PATCH 1/2] Moved the call order around such that the XReparentWindow call will work as intended. (cherry picked from commit 70ccbd1926ee7b1c25a5f76c9e2c0f456f1806db) --- client/X11/xf_window.c | 12 ++++++++++++ client/X11/xfreerdp.c | 10 ---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index a159c6b8a..0850a78e5 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -261,6 +261,7 @@ void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_st xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, boolean decorations) { xfWindow* window; + XEvent xevent; window = (xfWindow*) xzalloc(sizeof(xfWindow)); @@ -306,8 +307,19 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_ICON, XA_CARDINAL, 32, PropModeReplace, (uint8*) xf_icon_prop, sizeof(xf_icon_prop) / sizeof(long)); + if (xfi->parent_window) + XReparentWindow(xfi->display, window->handle, xfi->parent_window, 0, 0); + XSelectInput(xfi->display, window->handle, input_mask); XMapWindow(xfi->display, window->handle); + + //NOTE: This must be done here to handle reparenting the window, so that we dont miss the event and hang waiting for the next one + /* wait for VisibilityNotify */ + do + { + XMaskEvent(xfi->display, VisibilityChangeMask, &xevent); + } + while (xevent.type != VisibilityNotify); } XStoreName(xfi->display, window->handle, name); diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index 18ec3b789..0d1b3bf78 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -309,19 +309,9 @@ void xf_create_window(xfInfo* xfi) xfi->window = xf_CreateDesktopWindow(xfi, win_title, width, height, xfi->decorations); xfree(win_title); - if (xfi->parent_window) - XReparentWindow(xfi->display, xfi->window->handle, xfi->parent_window, 0, 0); - if (xfi->fullscreen) xf_SetWindowFullscreen(xfi, xfi->window, xfi->fullscreen); - /* wait for VisibilityNotify */ - do - { - XMaskEvent(xfi->display, VisibilityChangeMask, &xevent); - } - while (xevent.type != VisibilityNotify); - xfi->unobscured = (xevent.xvisibility.state == VisibilityUnobscured); XSetWMProtocols(xfi->display, xfi->window->handle, &(xfi->WM_DELETE_WINDOW), 1); From 05f5009b0a7257db7219f448ba00e4bfe72154a8 Mon Sep 17 00:00:00 2001 From: Brent Collins Date: Fri, 4 May 2012 13:47:54 -0500 Subject: [PATCH 2/2] Make the XReparent Window parameter a little more flexible to support both base 16 "with 0x prefix" or decimal window numbers. (cherry picked from commit 138f115d7335e94bdc0744cab616998cbda3307d) --- libfreerdp-utils/args.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfreerdp-utils/args.c b/libfreerdp-utils/args.c index 9ac26deac..93cf6013e 100644 --- a/libfreerdp-utils/args.c +++ b/libfreerdp-utils/args.c @@ -513,7 +513,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, return FREERDP_ARGS_PARSE_FAILURE; } - settings->parent_window_xid = strtoul(argv[index], NULL, 16); + settings->parent_window_xid = strtol(argv[index], NULL, 0); if (settings->parent_window_xid == 0) {