54 |
{ |
{ |
55 |
Window wnd; |
Window wnd; |
56 |
unsigned long id; |
unsigned long id; |
57 |
|
unsigned long parent; |
58 |
|
XWMHints *hints; |
59 |
int xoffset, yoffset; |
int xoffset, yoffset; |
60 |
int width, height; |
int width, height; |
61 |
int state; /* normal/minimized/maximized. */ |
int state; /* normal/minimized/maximized. */ |
295 |
if (sw == win) |
if (sw == win) |
296 |
{ |
{ |
297 |
*prevnext = sw->next; |
*prevnext = sw->next; |
298 |
|
XFree(sw->hints); |
299 |
xfree(sw); |
xfree(sw); |
300 |
return; |
return; |
301 |
} |
} |
3065 |
CWBorderPixel, &attribs); |
CWBorderPixel, &attribs); |
3066 |
|
|
3067 |
XStoreName(g_display, wnd, "SeamlessRDP"); |
XStoreName(g_display, wnd, "SeamlessRDP"); |
3068 |
|
ewmh_set_wm_name(wnd, "SeamlessRDP"); |
3069 |
|
|
3070 |
mwm_hide_decorations(wnd); |
mwm_hide_decorations(wnd); |
3071 |
|
|
3088 |
} |
} |
3089 |
|
|
3090 |
/* Set WM_TRANSIENT_FOR, if necessary */ |
/* Set WM_TRANSIENT_FOR, if necessary */ |
3091 |
if (parent) |
if ((parent != 0x00000000) && (parent != 0xFFFFFFFF)) |
3092 |
{ |
{ |
3093 |
sw_parent = seamless_get_window_by_id(parent); |
sw_parent = seamless_get_window_by_id(parent); |
3094 |
if (sw_parent) |
if (sw_parent) |
3097 |
warning("ui_seamless_create_window: No parent window 0x%lx\n", parent); |
warning("ui_seamless_create_window: No parent window 0x%lx\n", parent); |
3098 |
} |
} |
3099 |
|
|
3100 |
|
|
3101 |
/* FIXME: Support for Input Context:s */ |
/* FIXME: Support for Input Context:s */ |
3102 |
|
|
3103 |
get_input_mask(&input_mask); |
get_input_mask(&input_mask); |
3113 |
sw = malloc(sizeof(seamless_window)); |
sw = malloc(sizeof(seamless_window)); |
3114 |
sw->wnd = wnd; |
sw->wnd = wnd; |
3115 |
sw->id = id; |
sw->id = id; |
3116 |
|
sw->parent = parent; |
3117 |
|
sw->hints = XAllocWMHints(); |
3118 |
|
sw->hints->flags = 0; |
3119 |
sw->xoffset = 0; |
sw->xoffset = 0; |
3120 |
sw->yoffset = 0; |
sw->yoffset = 0; |
3121 |
sw->width = 0; |
sw->width = 0; |
3197 |
return; |
return; |
3198 |
} |
} |
3199 |
|
|
3200 |
|
/* FIXME: Might want to convert the name for non-EWMH WMs */ |
3201 |
XStoreName(g_display, sw->wnd, title); |
XStoreName(g_display, sw->wnd, title); |
3202 |
|
ewmh_set_wm_name(sw->wnd, title); |
3203 |
} |
} |
3204 |
|
|
3205 |
|
|
3215 |
return; |
return; |
3216 |
} |
} |
3217 |
|
|
|
if (sw->state == SEAMLESSRDP_NOTYETMAPPED) |
|
|
{ |
|
|
XMapWindow(g_display, sw->wnd); |
|
|
} |
|
|
|
|
|
sw->state = state; |
|
|
|
|
3218 |
switch (state) |
switch (state) |
3219 |
{ |
{ |
3220 |
case SEAMLESSRDP_NORMAL: |
case SEAMLESSRDP_NORMAL: |
3221 |
case SEAMLESSRDP_MAXIMIZED: |
case SEAMLESSRDP_MAXIMIZED: |
3222 |
ewmh_change_state(sw->wnd, state); |
ewmh_change_state(sw->wnd, state); |
3223 |
|
XMapWindow(g_display, sw->wnd); |
3224 |
break; |
break; |
3225 |
case SEAMLESSRDP_MINIMIZED: |
case SEAMLESSRDP_MINIMIZED: |
3226 |
/* EWMH says: "if an Application asks to toggle _NET_WM_STATE_HIDDEN |
/* EWMH says: "if an Application asks to toggle _NET_WM_STATE_HIDDEN |
3228 |
_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 |
3229 |
such as minimization, rather than an independent state." Besides, |
such as minimization, rather than an independent state." Besides, |
3230 |
XIconifyWindow is easier. */ |
XIconifyWindow is easier. */ |
3231 |
XIconifyWindow(g_display, sw->wnd, DefaultScreen(g_display)); |
if (sw->state == SEAMLESSRDP_NOTYETMAPPED) |
3232 |
|
{ |
3233 |
|
sw->hints->flags |= StateHint; |
3234 |
|
sw->hints->initial_state = IconicState; |
3235 |
|
XSetWMHints(g_display, sw->wnd, sw->hints); |
3236 |
|
XMapWindow(g_display, sw->wnd); |
3237 |
|
} |
3238 |
|
else |
3239 |
|
XIconifyWindow(g_display, sw->wnd, DefaultScreen(g_display)); |
3240 |
break; |
break; |
3241 |
default: |
default: |
3242 |
warning("SeamlessRDP: Invalid state %d\n", state); |
warning("SeamlessRDP: Invalid state %d\n", state); |
3243 |
break; |
break; |
3244 |
} |
} |
3245 |
|
|
3246 |
|
/* Handle popups without parents through some ewm hints */ |
3247 |
|
if ((sw->state == SEAMLESSRDP_NOTYETMAPPED) && (sw->parent == 0xFFFFFFFF)) |
3248 |
|
ewmh_set_window_popup(sw->wnd); |
3249 |
|
|
3250 |
|
sw->state = state; |
3251 |
} |
} |
3252 |
|
|
3253 |
|
|