54 |
{ |
{ |
55 |
Window wnd; |
Window wnd; |
56 |
unsigned long id; |
unsigned long id; |
57 |
|
unsigned long parent; |
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. */ |
3085 |
XFree(sizehints); |
XFree(sizehints); |
3086 |
} |
} |
3087 |
|
|
|
/* Handle popups without parents through some ewm hints */ |
|
|
if (parent == 0xFFFFFFFF) |
|
|
ewmh_set_window_popup(wnd); |
|
3088 |
/* Set WM_TRANSIENT_FOR, if necessary */ |
/* Set WM_TRANSIENT_FOR, if necessary */ |
3089 |
else if (parent != 0x00000000) |
if ((parent != 0x00000000) && (parent != 0xFFFFFFFF)) |
3090 |
{ |
{ |
3091 |
sw_parent = seamless_get_window_by_id(parent); |
sw_parent = seamless_get_window_by_id(parent); |
3092 |
if (sw_parent) |
if (sw_parent) |
3111 |
sw = malloc(sizeof(seamless_window)); |
sw = malloc(sizeof(seamless_window)); |
3112 |
sw->wnd = wnd; |
sw->wnd = wnd; |
3113 |
sw->id = id; |
sw->id = id; |
3114 |
|
sw->parent = parent; |
3115 |
sw->xoffset = 0; |
sw->xoffset = 0; |
3116 |
sw->yoffset = 0; |
sw->yoffset = 0; |
3117 |
sw->width = 0; |
sw->width = 0; |
3211 |
return; |
return; |
3212 |
} |
} |
3213 |
|
|
|
if (sw->state == SEAMLESSRDP_NOTYETMAPPED) |
|
|
{ |
|
|
XMapWindow(g_display, sw->wnd); |
|
|
} |
|
|
|
|
|
sw->state = state; |
|
|
|
|
3214 |
switch (state) |
switch (state) |
3215 |
{ |
{ |
3216 |
case SEAMLESSRDP_NORMAL: |
case SEAMLESSRDP_NORMAL: |
3217 |
case SEAMLESSRDP_MAXIMIZED: |
case SEAMLESSRDP_MAXIMIZED: |
3218 |
ewmh_change_state(sw->wnd, state); |
ewmh_change_state(sw->wnd, state); |
3219 |
|
XMapWindow(g_display, sw->wnd); |
3220 |
break; |
break; |
3221 |
case SEAMLESSRDP_MINIMIZED: |
case SEAMLESSRDP_MINIMIZED: |
3222 |
/* EWMH says: "if an Application asks to toggle _NET_WM_STATE_HIDDEN |
/* EWMH says: "if an Application asks to toggle _NET_WM_STATE_HIDDEN |
3224 |
_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 |
3225 |
such as minimization, rather than an independent state." Besides, |
such as minimization, rather than an independent state." Besides, |
3226 |
XIconifyWindow is easier. */ |
XIconifyWindow is easier. */ |
3227 |
XIconifyWindow(g_display, sw->wnd, DefaultScreen(g_display)); |
if (sw->state == SEAMLESSRDP_NOTYETMAPPED) |
3228 |
|
{ |
3229 |
|
XWMHints *hints; |
3230 |
|
hints = XAllocWMHints(); |
3231 |
|
hints->flags = StateHint; |
3232 |
|
hints->initial_state = IconicState; |
3233 |
|
XSetWMHints(g_display, sw->wnd, hints); |
3234 |
|
XFree(hints); |
3235 |
|
XMapWindow(g_display, sw->wnd); |
3236 |
|
} |
3237 |
|
else |
3238 |
|
XIconifyWindow(g_display, sw->wnd, DefaultScreen(g_display)); |
3239 |
break; |
break; |
3240 |
default: |
default: |
3241 |
warning("SeamlessRDP: Invalid state %d\n", state); |
warning("SeamlessRDP: Invalid state %d\n", state); |
3242 |
break; |
break; |
3243 |
} |
} |
3244 |
|
|
3245 |
|
/* Handle popups without parents through some ewm hints */ |
3246 |
|
if ((sw->state == SEAMLESSRDP_NOTYETMAPPED) && (sw->parent == 0xFFFFFFFF)) |
3247 |
|
ewmh_set_window_popup(sw->wnd); |
3248 |
|
|
3249 |
|
sw->state = state; |
3250 |
} |
} |
3251 |
|
|
3252 |
|
|