Handle initially minimized windows through WM_HINTS.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1141 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Pierre Ossman 2006-03-16 08:11:29 +00:00
parent 70af626e05
commit bb3bcfc8a2

22
xwin.c
View File

@ -54,6 +54,7 @@ typedef struct _seamless_window
{
Window wnd;
unsigned long id;
XWMHints *hints;
int xoffset, yoffset;
int width, height;
int state; /* normal/minimized/maximized. */
@ -293,6 +294,7 @@ seamless_remove_window(seamless_window * win)
if (sw == win)
{
*prevnext = sw->next;
XFree(sw->hints);
xfree(sw);
return;
}
@ -3113,6 +3115,8 @@ ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long
sw = malloc(sizeof(seamless_window));
sw->wnd = wnd;
sw->id = id;
sw->hints = XAllocWMHints();
sw->hints->flags = 0;
sw->xoffset = 0;
sw->yoffset = 0;
sw->width = 0;
@ -3212,18 +3216,12 @@ 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)
{
case SEAMLESSRDP_NORMAL:
case SEAMLESSRDP_MAXIMIZED:
ewmh_change_state(sw->wnd, state);
XMapWindow(g_display, sw->wnd);
break;
case SEAMLESSRDP_MINIMIZED:
/* EWMH says: "if an Application asks to toggle _NET_WM_STATE_HIDDEN
@ -3231,12 +3229,22 @@ ui_seamless_setstate(unsigned long id, unsigned int state, unsigned long flags)
_NET_WM_STATE_HIDDEN is a function of some other aspect of the window
such as minimization, rather than an independent state." Besides,
XIconifyWindow is easier. */
if (sw->state == SEAMLESSRDP_NOTYETMAPPED)
{
sw->hints->flags |= StateHint;
sw->hints->initial_state = IconicState;
XSetWMHints(g_display, sw->wnd, sw->hints);
XMapWindow(g_display, sw->wnd);
}
else
XIconifyWindow(g_display, sw->wnd, DefaultScreen(g_display));
break;
default:
warning("SeamlessRDP: Invalid state %d\n", state);
break;
}
sw->state = state;
}