54 |
{ |
{ |
55 |
Window wnd; |
Window wnd; |
56 |
unsigned long id; |
unsigned long id; |
57 |
|
XWMHints *hints; |
58 |
int xoffset, yoffset; |
int xoffset, yoffset; |
59 |
int width, height; |
int width, height; |
60 |
int state; /* normal/minimized/maximized. */ |
int state; /* normal/minimized/maximized. */ |
294 |
if (sw == win) |
if (sw == win) |
295 |
{ |
{ |
296 |
*prevnext = sw->next; |
*prevnext = sw->next; |
297 |
|
XFree(sw->hints); |
298 |
xfree(sw); |
xfree(sw); |
299 |
return; |
return; |
300 |
} |
} |
3115 |
sw = malloc(sizeof(seamless_window)); |
sw = malloc(sizeof(seamless_window)); |
3116 |
sw->wnd = wnd; |
sw->wnd = wnd; |
3117 |
sw->id = id; |
sw->id = id; |
3118 |
|
sw->hints = XAllocWMHints(); |
3119 |
|
sw->hints->flags = 0; |
3120 |
sw->xoffset = 0; |
sw->xoffset = 0; |
3121 |
sw->yoffset = 0; |
sw->yoffset = 0; |
3122 |
sw->width = 0; |
sw->width = 0; |
3216 |
return; |
return; |
3217 |
} |
} |
3218 |
|
|
|
if (sw->state == SEAMLESSRDP_NOTYETMAPPED) |
|
|
{ |
|
|
XMapWindow(g_display, sw->wnd); |
|
|
} |
|
|
|
|
|
sw->state = state; |
|
|
|
|
3219 |
switch (state) |
switch (state) |
3220 |
{ |
{ |
3221 |
case SEAMLESSRDP_NORMAL: |
case SEAMLESSRDP_NORMAL: |
3222 |
case SEAMLESSRDP_MAXIMIZED: |
case SEAMLESSRDP_MAXIMIZED: |
3223 |
ewmh_change_state(sw->wnd, state); |
ewmh_change_state(sw->wnd, state); |
3224 |
|
XMapWindow(g_display, sw->wnd); |
3225 |
break; |
break; |
3226 |
case SEAMLESSRDP_MINIMIZED: |
case SEAMLESSRDP_MINIMIZED: |
3227 |
/* EWMH says: "if an Application asks to toggle _NET_WM_STATE_HIDDEN |
/* EWMH says: "if an Application asks to toggle _NET_WM_STATE_HIDDEN |
3229 |
_NET_WM_STATE_HIDDEN is a function of some other aspect of the window |
_NET_WM_STATE_HIDDEN is a function of some other aspect of the window |
3230 |
such as minimization, rather than an independent state." Besides, |
such as minimization, rather than an independent state." Besides, |
3231 |
XIconifyWindow is easier. */ |
XIconifyWindow is easier. */ |
3232 |
XIconifyWindow(g_display, sw->wnd, DefaultScreen(g_display)); |
if (sw->state == SEAMLESSRDP_NOTYETMAPPED) |
3233 |
|
{ |
3234 |
|
sw->hints->flags |= StateHint; |
3235 |
|
sw->hints->initial_state = IconicState; |
3236 |
|
XSetWMHints(g_display, sw->wnd, sw->hints); |
3237 |
|
XMapWindow(g_display, sw->wnd); |
3238 |
|
} |
3239 |
|
else |
3240 |
|
XIconifyWindow(g_display, sw->wnd, DefaultScreen(g_display)); |
3241 |
break; |
break; |
3242 |
default: |
default: |
3243 |
warning("SeamlessRDP: Invalid state %d\n", state); |
warning("SeamlessRDP: Invalid state %d\n", state); |
3244 |
break; |
break; |
3245 |
} |
} |
3246 |
|
|
3247 |
|
sw->state = state; |
3248 |
} |
} |
3249 |
|
|
3250 |
|
|