From bce447b305a2f9051e4936825466d007fe8be4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Wed, 15 Mar 2006 12:58:50 +0000 Subject: [PATCH] Do not map seamless window until STATE is recieved git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1131 423420c4-83ab-492f-b58f-81f9feb106b5 --- constants.h | 1 + xwin.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/constants.h b/constants.h index e4d5aa1..5958d35 100644 --- a/constants.h +++ b/constants.h @@ -414,6 +414,7 @@ enum RDP_INPUT_DEVICE #define exDiscReasonLicenseNoRemoteConnections 0x010a /* SeamlessRDP constants */ +#define SEAMLESSRDP_NOTYETMAPPED -1 #define SEAMLESSRDP_NORMAL 0 #define SEAMLESSRDP_MINIMIZED 1 #define SEAMLESSRDP_MAXIMIZED 2 diff --git a/xwin.c b/xwin.c index ecf68d0..22feaef 100644 --- a/xwin.c +++ b/xwin.c @@ -56,7 +56,7 @@ typedef struct _seamless_window unsigned long id; int xoffset, yoffset; int width, height; - unsigned int state; /* normal/minimized/maximized */ + int state; /* normal/minimized/maximized. */ unsigned int desktop; struct _seamless_window *next; } seamless_window; @@ -3044,6 +3044,7 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long Window wnd; XSetWindowAttributes attribs; XClassHint *classhints; + XSizeHints *sizehints; long input_mask; seamless_window *sw, *sw_parent; @@ -3055,10 +3056,7 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long get_window_attribs(&attribs); attribs.override_redirect = False; - /* FIXME: Do not assume that -1, -1 is outside screen Consider - wait with showing the window until STATE and others have - been recieved. */ - wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0, 0, + wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0, g_depth, InputOutput, g_visual, CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap | CWBorderPixel, &attribs); @@ -3075,6 +3073,15 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long XFree(classhints); } + /* WM_NORMAL_HINTS */ + sizehints = XAllocSizeHints(); + if (sizehints != NULL) + { + sizehints->flags = USPosition; + XSetWMNormalHints(g_display, wnd, sizehints); + XFree(sizehints); + } + /* Set WM_TRANSIENT_FOR, if necessary */ if (parent) { @@ -3092,8 +3099,6 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long XSelectInput(g_display, wnd, input_mask); - XMapWindow(g_display, wnd); - /* 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 */ @@ -3106,6 +3111,8 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long sw->yoffset = 0; sw->width = 0; sw->height = 0; + sw->state = SEAMLESSRDP_NOTYETMAPPED; + sw->desktop = 0; sw->next = g_seamless_windows; g_seamless_windows = sw; } @@ -3157,8 +3164,12 @@ ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, u /* If we move the window in a maximized state, then KDE won't accept restoration */ - if (sw->state != SEAMLESSRDP_NORMAL) - return; + switch (sw->state) + { + case SEAMLESSRDP_MINIMIZED: + case SEAMLESSRDP_MAXIMIZED: + return; + } /* FIXME: Perhaps use ewmh_net_moveresize_window instead */ XMoveResizeWindow(g_display, sw->wnd, sw->xoffset, sw->yoffset, sw->width, sw->height); @@ -3193,6 +3204,11 @@ ui_seamless_setstate(unsigned long id, unsigned int state, unsigned long flags) return; } + if (sw->state == SEAMLESSRDP_NOTYETMAPPED) + { + XMapWindow(g_display, sw->wnd); + } + sw->state = state; switch (state)