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
This commit is contained in:
Peter Åstrand 2006-03-15 12:58:50 +00:00
parent 90aa81def6
commit bce447b305
2 changed files with 26 additions and 9 deletions

View File

@ -414,6 +414,7 @@ enum RDP_INPUT_DEVICE
#define exDiscReasonLicenseNoRemoteConnections 0x010a #define exDiscReasonLicenseNoRemoteConnections 0x010a
/* SeamlessRDP constants */ /* SeamlessRDP constants */
#define SEAMLESSRDP_NOTYETMAPPED -1
#define SEAMLESSRDP_NORMAL 0 #define SEAMLESSRDP_NORMAL 0
#define SEAMLESSRDP_MINIMIZED 1 #define SEAMLESSRDP_MINIMIZED 1
#define SEAMLESSRDP_MAXIMIZED 2 #define SEAMLESSRDP_MAXIMIZED 2

34
xwin.c
View File

@ -56,7 +56,7 @@ typedef struct _seamless_window
unsigned long id; unsigned long id;
int xoffset, yoffset; int xoffset, yoffset;
int width, height; int width, height;
unsigned int state; /* normal/minimized/maximized */ int state; /* normal/minimized/maximized. */
unsigned int desktop; unsigned int desktop;
struct _seamless_window *next; struct _seamless_window *next;
} seamless_window; } seamless_window;
@ -3044,6 +3044,7 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long
Window wnd; Window wnd;
XSetWindowAttributes attribs; XSetWindowAttributes attribs;
XClassHint *classhints; XClassHint *classhints;
XSizeHints *sizehints;
long input_mask; long input_mask;
seamless_window *sw, *sw_parent; 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); get_window_attribs(&attribs);
attribs.override_redirect = False; attribs.override_redirect = False;
/* FIXME: Do not assume that -1, -1 is outside screen Consider wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0, g_depth,
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,
InputOutput, g_visual, InputOutput, g_visual,
CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap | CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
CWBorderPixel, &attribs); CWBorderPixel, &attribs);
@ -3075,6 +3073,15 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long
XFree(classhints); 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 */ /* Set WM_TRANSIENT_FOR, if necessary */
if (parent) if (parent)
{ {
@ -3092,8 +3099,6 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long
XSelectInput(g_display, wnd, input_mask); XSelectInput(g_display, wnd, input_mask);
XMapWindow(g_display, wnd);
/* handle the WM_DELETE_WINDOW protocol. FIXME: When killing a /* handle the WM_DELETE_WINDOW protocol. FIXME: When killing a
seamless window, we could try to close the window on the seamless window, we could try to close the window on the
serverside, instead of terminating rdesktop */ 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->yoffset = 0;
sw->width = 0; sw->width = 0;
sw->height = 0; sw->height = 0;
sw->state = SEAMLESSRDP_NOTYETMAPPED;
sw->desktop = 0;
sw->next = g_seamless_windows; sw->next = g_seamless_windows;
g_seamless_windows = sw; 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 /* If we move the window in a maximized state, then KDE won't
accept restoration */ accept restoration */
if (sw->state != SEAMLESSRDP_NORMAL) switch (sw->state)
return; {
case SEAMLESSRDP_MINIMIZED:
case SEAMLESSRDP_MAXIMIZED:
return;
}
/* FIXME: Perhaps use ewmh_net_moveresize_window instead */ /* FIXME: Perhaps use ewmh_net_moveresize_window instead */
XMoveResizeWindow(g_display, sw->wnd, sw->xoffset, sw->yoffset, sw->width, sw->height); 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; return;
} }
if (sw->state == SEAMLESSRDP_NOTYETMAPPED)
{
XMapWindow(g_display, sw->wnd);
}
sw->state = state; sw->state = state;
switch (state) switch (state)