2 * Window related functions
4 * Copyright 1993, 1994, 1995, 1996, 2001 Alexandre Julliard
5 * Copyright 1993 David Metcalfe
6 * Copyright 1995, 1996 Alex Korobka
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include <X11/Xresource.h>
33 #include <X11/Xutil.h>
40 #include "wine/unicode.h"
42 #include "wine/debug.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(x11drv
);
50 extern Pixmap
X11DRV_BITMAP_Pixmap( HBITMAP
);
52 #define HAS_DLGFRAME(style,exStyle) \
53 (((exStyle) & WS_EX_DLGMODALFRAME) || \
54 (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME)))
56 /* X context to associate a hwnd to an X window */
57 XContext winContext
= 0;
59 Atom X11DRV_Atoms
[NB_XATOMS
- FIRST_XATOM
];
61 static const char * const atom_names
[NB_XATOMS
- FIRST_XATOM
] =
80 "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR",
84 "_NET_WM_WINDOW_TYPE",
85 "_NET_WM_WINDOW_TYPE_UTILITY",
108 static LPCSTR whole_window_atom
;
109 static LPCSTR client_window_atom
;
110 static LPCSTR icon_window_atom
;
112 /***********************************************************************
115 * Check if a given window should be managed
117 inline static BOOL
is_window_managed( WND
*win
)
119 if (!managed_mode
) return FALSE
;
120 /* tray window is always managed */
121 if (win
->dwExStyle
& WS_EX_TRAYWINDOW
) return TRUE
;
122 /* child windows are not managed */
123 if (win
->dwStyle
& WS_CHILD
) return FALSE
;
124 /* windows with caption are managed */
125 if ((win
->dwStyle
& WS_CAPTION
) == WS_CAPTION
) return TRUE
;
126 /* tool windows are not managed */
127 if (win
->dwExStyle
& WS_EX_TOOLWINDOW
) return FALSE
;
128 /* windows with thick frame are managed */
129 if (win
->dwStyle
& WS_THICKFRAME
) return TRUE
;
130 /* application windows are managed */
131 if (win
->dwExStyle
& WS_EX_APPWINDOW
) return TRUE
;
132 /* popup windows that aren't owned are managed */
133 if ((win
->dwStyle
& WS_POPUP
) && !win
->owner
) return TRUE
;
134 /* default: not managed */
139 /***********************************************************************
140 * is_client_window_mapped
142 * Check if the X client window should be mapped
144 inline static BOOL
is_client_window_mapped( WND
*win
)
146 struct x11drv_win_data
*data
= win
->pDriverData
;
147 return !(win
->dwStyle
& WS_MINIMIZE
) && !IsRectEmpty( &data
->client_rect
);
151 /***********************************************************************
152 * get_window_attributes
154 * Fill the window attributes structure for an X window.
156 static int get_window_attributes( Display
*display
, WND
*win
, XSetWindowAttributes
*attr
)
158 BOOL is_top_level
= is_window_top_level( win
);
159 BOOL managed
= is_top_level
&& is_window_managed( win
);
161 if (managed
) WIN_SetExStyle( win
->hwndSelf
, win
->dwExStyle
| WS_EX_MANAGED
);
162 else WIN_SetExStyle( win
->hwndSelf
, win
->dwExStyle
& ~WS_EX_MANAGED
);
164 attr
->override_redirect
= !managed
;
165 attr
->colormap
= X11DRV_PALETTE_PaletteXColormap
;
166 attr
->save_under
= ((win
->clsStyle
& CS_SAVEBITS
) != 0);
167 attr
->cursor
= x11drv_thread_data()->cursor
;
168 attr
->event_mask
= (ExposureMask
| PointerMotionMask
|
169 ButtonPressMask
| ButtonReleaseMask
| EnterWindowMask
);
171 if (is_window_top_level( win
))
172 attr
->event_mask
|= (KeyPressMask
| KeyReleaseMask
| StructureNotifyMask
|
173 FocusChangeMask
| KeymapStateMask
);
175 return (CWOverrideRedirect
| CWSaveUnder
| CWEventMask
| CWColormap
| CWCursor
);
179 /***********************************************************************
180 * X11DRV_sync_window_style
182 * Change the X window attributes when the window style has changed.
184 void X11DRV_sync_window_style( Display
*display
, WND
*win
)
186 XSetWindowAttributes attr
;
190 mask
= get_window_attributes( display
, win
, &attr
);
191 XChangeWindowAttributes( display
, get_whole_window(win
), mask
, &attr
);
196 /***********************************************************************
199 * fill the window changes structure
201 static int get_window_changes( XWindowChanges
*changes
, const RECT
*old
, const RECT
*new )
205 if (old
->right
- old
->left
!= new->right
- new->left
)
207 if (!(changes
->width
= new->right
- new->left
)) changes
->width
= 1;
210 if (old
->bottom
- old
->top
!= new->bottom
- new->top
)
212 if (!(changes
->height
= new->bottom
- new->top
)) changes
->height
= 1;
215 if (old
->left
!= new->left
)
217 changes
->x
= new->left
;
220 if (old
->top
!= new->top
)
222 changes
->y
= new->top
;
229 /***********************************************************************
232 static Window
create_icon_window( Display
*display
, WND
*win
)
234 struct x11drv_win_data
*data
= win
->pDriverData
;
235 XSetWindowAttributes attr
;
237 attr
.event_mask
= (ExposureMask
| KeyPressMask
| KeyReleaseMask
| PointerMotionMask
|
238 ButtonPressMask
| ButtonReleaseMask
| EnterWindowMask
);
239 attr
.bit_gravity
= NorthWestGravity
;
240 attr
.backing_store
= NotUseful
/*WhenMapped*/;
241 attr
.colormap
= X11DRV_PALETTE_PaletteXColormap
; /* Needed due to our visual */
244 data
->icon_window
= XCreateWindow( display
, root_window
, 0, 0,
245 GetSystemMetrics( SM_CXICON
),
246 GetSystemMetrics( SM_CYICON
),
249 CWEventMask
| CWBitGravity
| CWBackingStore
| CWColormap
, &attr
);
250 XSaveContext( display
, data
->icon_window
, winContext
, (char *)win
->hwndSelf
);
253 TRACE( "created %lx\n", data
->icon_window
);
254 SetPropA( win
->hwndSelf
, icon_window_atom
, (HANDLE
)data
->icon_window
);
255 return data
->icon_window
;
260 /***********************************************************************
261 * destroy_icon_window
263 inline static void destroy_icon_window( Display
*display
, WND
*win
)
265 struct x11drv_win_data
*data
= win
->pDriverData
;
267 if (!data
->icon_window
) return;
268 if (x11drv_thread_data()->cursor_window
== data
->icon_window
)
269 x11drv_thread_data()->cursor_window
= None
;
271 XDeleteContext( display
, data
->icon_window
, winContext
);
272 XDestroyWindow( display
, data
->icon_window
);
273 data
->icon_window
= 0;
275 RemovePropA( win
->hwndSelf
, icon_window_atom
);
279 /***********************************************************************
282 * Set the icon wm hints
284 static void set_icon_hints( Display
*display
, WND
*wndPtr
, XWMHints
*hints
)
286 X11DRV_WND_DATA
*data
= wndPtr
->pDriverData
;
287 HICON hIcon
= (HICON
)GetClassLongA( wndPtr
->hwndSelf
, GCL_HICON
);
289 if (data
->hWMIconBitmap
) DeleteObject( data
->hWMIconBitmap
);
290 if (data
->hWMIconMask
) DeleteObject( data
->hWMIconMask
);
291 data
->hWMIconBitmap
= 0;
292 data
->hWMIconMask
= 0;
294 if (!(wndPtr
->dwExStyle
& WS_EX_MANAGED
))
296 destroy_icon_window( display
, wndPtr
);
297 hints
->flags
&= ~(IconPixmapHint
| IconMaskHint
| IconWindowHint
);
301 if (!data
->icon_window
) create_icon_window( display
, wndPtr
);
302 hints
->icon_window
= data
->icon_window
;
303 hints
->flags
= (hints
->flags
& ~(IconPixmapHint
| IconMaskHint
)) | IconWindowHint
;
313 GetIconInfo(hIcon
, &ii
);
315 GetObjectA(ii
.hbmMask
, sizeof(bmMask
), &bmMask
);
318 rcMask
.right
= bmMask
.bmWidth
;
319 rcMask
.bottom
= bmMask
.bmHeight
;
321 hDC
= CreateCompatibleDC(0);
322 hbmOrig
= SelectObject(hDC
, ii
.hbmMask
);
323 InvertRect(hDC
, &rcMask
);
324 SelectObject(hDC
, ii
.hbmColor
); /* force the color bitmap to x11drv mode too */
325 SelectObject(hDC
, hbmOrig
);
328 data
->hWMIconBitmap
= ii
.hbmColor
;
329 data
->hWMIconMask
= ii
.hbmMask
;
331 hints
->icon_pixmap
= X11DRV_BITMAP_Pixmap(data
->hWMIconBitmap
);
332 hints
->icon_mask
= X11DRV_BITMAP_Pixmap(data
->hWMIconMask
);
333 destroy_icon_window( display
, wndPtr
);
334 hints
->flags
= (hints
->flags
& ~IconWindowHint
) | IconPixmapHint
| IconMaskHint
;
339 /***********************************************************************
342 * set the window size hints
344 static void set_size_hints( Display
*display
, WND
*win
)
346 XSizeHints
* size_hints
;
347 struct x11drv_win_data
*data
= win
->pDriverData
;
349 if ((size_hints
= XAllocSizeHints()))
351 size_hints
->win_gravity
= StaticGravity
;
352 size_hints
->x
= data
->whole_rect
.left
;
353 size_hints
->y
= data
->whole_rect
.top
;
354 size_hints
->flags
= PWinGravity
| PPosition
;
356 if (HAS_DLGFRAME( win
->dwStyle
, win
->dwExStyle
))
358 size_hints
->max_width
= data
->whole_rect
.right
- data
->whole_rect
.left
;
359 size_hints
->max_height
= data
->whole_rect
.bottom
- data
->whole_rect
.top
;
360 size_hints
->min_width
= size_hints
->max_width
;
361 size_hints
->min_height
= size_hints
->max_height
;
362 size_hints
->flags
|= PMinSize
| PMaxSize
;
364 XSetWMNormalHints( display
, data
->whole_window
, size_hints
);
370 /***********************************************************************
371 * X11DRV_set_wm_hints
373 * Set the window manager hints for a newly-created window
375 void X11DRV_set_wm_hints( Display
*display
, WND
*win
)
377 struct x11drv_win_data
*data
= win
->pDriverData
;
379 XClassHint
*class_hints
;
390 protocols
[i
++] = x11drv_atom(WM_DELETE_WINDOW
);
391 protocols
[i
++] = x11drv_atom(_NET_WM_PING
);
392 if (use_take_focus
) protocols
[i
++] = x11drv_atom(WM_TAKE_FOCUS
);
393 XChangeProperty( display
, data
->whole_window
, x11drv_atom(WM_PROTOCOLS
),
394 XA_ATOM
, 32, PropModeReplace
, (char *)protocols
, i
);
397 if ((class_hints
= XAllocClassHint()))
399 class_hints
->res_name
= "wine";
400 class_hints
->res_class
= "Wine";
401 XSetClassHint( display
, data
->whole_window
, class_hints
);
402 XFree( class_hints
);
405 /* transient for hint */
408 Window owner_win
= X11DRV_get_whole_window( win
->owner
);
409 XSetTransientForHint( display
, data
->whole_window
, owner_win
);
410 group_leader
= owner_win
;
412 else group_leader
= data
->whole_window
;
415 set_size_hints( display
, win
);
417 /* systray properties (KDE only for now) */
418 if (win
->dwExStyle
& WS_EX_TRAYWINDOW
)
421 XChangeProperty( display
, data
->whole_window
, x11drv_atom(KWM_DOCKWINDOW
),
422 x11drv_atom(KWM_DOCKWINDOW
), 32, PropModeReplace
, (char*)&val
, 1 );
423 XChangeProperty( display
, data
->whole_window
, x11drv_atom(_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR
),
424 XA_WINDOW
, 32, PropModeReplace
, (char*)&data
->whole_window
, 1 );
427 /* set the WM_CLIENT_MACHINE and WM_LOCALE_NAME properties */
428 XSetWMProperties(display
, data
->whole_window
, NULL
, NULL
, NULL
, 0, NULL
, NULL
, NULL
);
429 /* set the pid. together, these properties are needed so the window manager can kill us if we freeze */
431 XChangeProperty(display
, data
->whole_window
, x11drv_atom(_NET_WM_PID
),
432 XA_CARDINAL
, 32, PropModeReplace
, (char *)&i
, 1);
434 /* map WS_EX_TOOLWINDOW to _NET_WM_WINDOW_TYPE_UTILITY */
435 if (win
->dwExStyle
& WS_EX_TOOLWINDOW
)
437 Atom a
= x11drv_atom(_NET_WM_WINDOW_TYPE_UTILITY
);
438 XChangeProperty(display
, data
->whole_window
, x11drv_atom(_NET_WM_WINDOW_TYPE
),
439 XA_ATOM
, 32, PropModeReplace
, (char*)&a
, 1);
442 mwm_hints
.flags
= MWM_HINTS_FUNCTIONS
| MWM_HINTS_DECORATIONS
;
443 mwm_hints
.functions
= 0;
444 if ((win
->dwStyle
& WS_CAPTION
) == WS_CAPTION
) mwm_hints
.functions
|= MWM_FUNC_MOVE
;
445 if (win
->dwStyle
& WS_THICKFRAME
) mwm_hints
.functions
|= MWM_FUNC_MOVE
| MWM_FUNC_RESIZE
;
446 if (win
->dwStyle
& WS_MINIMIZEBOX
) mwm_hints
.functions
|= MWM_FUNC_MINIMIZE
;
447 if (win
->dwStyle
& WS_MAXIMIZEBOX
) mwm_hints
.functions
|= MWM_FUNC_MAXIMIZE
;
448 if (win
->dwStyle
& WS_SYSMENU
) mwm_hints
.functions
|= MWM_FUNC_CLOSE
;
449 mwm_hints
.decorations
= 0;
450 if ((win
->dwStyle
& WS_CAPTION
) == WS_CAPTION
) mwm_hints
.decorations
|= MWM_DECOR_TITLE
;
451 if (win
->dwExStyle
& WS_EX_DLGMODALFRAME
) mwm_hints
.decorations
|= MWM_DECOR_BORDER
;
452 else if (win
->dwStyle
& WS_THICKFRAME
) mwm_hints
.decorations
|= MWM_DECOR_BORDER
| MWM_DECOR_RESIZEH
;
453 else if ((win
->dwStyle
& (WS_DLGFRAME
|WS_BORDER
)) == WS_DLGFRAME
) mwm_hints
.decorations
|= MWM_DECOR_BORDER
;
454 else if (win
->dwStyle
& WS_BORDER
) mwm_hints
.decorations
|= MWM_DECOR_BORDER
;
455 else if (!(win
->dwStyle
& (WS_CHILD
|WS_POPUP
))) mwm_hints
.decorations
|= MWM_DECOR_BORDER
;
456 if (win
->dwStyle
& WS_SYSMENU
) mwm_hints
.decorations
|= MWM_DECOR_MENU
;
457 if (win
->dwStyle
& WS_MINIMIZEBOX
) mwm_hints
.decorations
|= MWM_DECOR_MINIMIZE
;
458 if (win
->dwStyle
& WS_MAXIMIZEBOX
) mwm_hints
.decorations
|= MWM_DECOR_MAXIMIZE
;
460 XChangeProperty( display
, data
->whole_window
, x11drv_atom(_MOTIF_WM_HINTS
),
461 x11drv_atom(_MOTIF_WM_HINTS
), 32, PropModeReplace
,
462 (char*)&mwm_hints
, sizeof(mwm_hints
)/sizeof(long) );
464 XChangeProperty( display
, data
->whole_window
, x11drv_atom(XdndAware
),
465 XA_ATOM
, 32, PropModeReplace
, (unsigned char*)&dndVersion
, 1 );
467 wm_hints
= XAllocWMHints();
473 wm_hints
->flags
= InputHint
| StateHint
| WindowGroupHint
;
474 wm_hints
->input
= !(win
->dwStyle
& WS_DISABLED
);
476 set_icon_hints( display
, win
, wm_hints
);
478 wm_hints
->initial_state
= (win
->dwStyle
& WS_MINIMIZE
) ? IconicState
: NormalState
;
479 wm_hints
->window_group
= group_leader
;
482 XSetWMHints( display
, data
->whole_window
, wm_hints
);
489 /***********************************************************************
490 * X11DRV_set_iconic_state
492 * Set the X11 iconic state according to the window style.
494 void X11DRV_set_iconic_state( WND
*win
)
496 Display
*display
= thread_display();
497 struct x11drv_win_data
*data
= win
->pDriverData
;
499 BOOL iconic
= IsIconic( win
->hwndSelf
);
503 if (iconic
) XUnmapWindow( display
, data
->client_window
);
504 else if (is_client_window_mapped( win
)) XMapWindow( display
, data
->client_window
);
506 if (!(wm_hints
= XGetWMHints( display
, data
->whole_window
))) wm_hints
= XAllocWMHints();
507 wm_hints
->flags
|= StateHint
| IconPositionHint
;
508 wm_hints
->initial_state
= iconic
? IconicState
: NormalState
;
509 wm_hints
->icon_x
= win
->rectWindow
.left
;
510 wm_hints
->icon_y
= win
->rectWindow
.top
;
511 XSetWMHints( display
, data
->whole_window
, wm_hints
);
513 if (win
->dwStyle
& WS_VISIBLE
)
516 XIconifyWindow( display
, data
->whole_window
, DefaultScreen(display
) );
518 if (!IsRectEmpty( &win
->rectWindow
)) XMapWindow( display
, data
->whole_window
);
526 /***********************************************************************
527 * X11DRV_window_to_X_rect
529 * Convert a rect from client to X window coordinates
531 void X11DRV_window_to_X_rect( WND
*win
, RECT
*rect
)
535 if (!(win
->dwExStyle
& WS_EX_MANAGED
)) return;
536 if (IsRectEmpty( rect
)) return;
538 rc
.top
= rc
.bottom
= rc
.left
= rc
.right
= 0;
540 AdjustWindowRectEx( &rc
, win
->dwStyle
& ~(WS_HSCROLL
|WS_VSCROLL
), FALSE
, win
->dwExStyle
);
542 rect
->left
-= rc
.left
;
543 rect
->right
-= rc
.right
;
545 rect
->bottom
-= rc
.bottom
;
546 if (rect
->top
>= rect
->bottom
) rect
->bottom
= rect
->top
+ 1;
547 if (rect
->left
>= rect
->right
) rect
->right
= rect
->left
+ 1;
551 /***********************************************************************
552 * X11DRV_X_to_window_rect
554 * Opposite of X11DRV_window_to_X_rect
556 void X11DRV_X_to_window_rect( WND
*win
, RECT
*rect
)
558 if (!(win
->dwExStyle
& WS_EX_MANAGED
)) return;
559 if (IsRectEmpty( rect
)) return;
561 AdjustWindowRectEx( rect
, win
->dwStyle
& ~(WS_HSCROLL
|WS_VSCROLL
), FALSE
, win
->dwExStyle
);
563 if (rect
->top
>= rect
->bottom
) rect
->bottom
= rect
->top
+ 1;
564 if (rect
->left
>= rect
->right
) rect
->right
= rect
->left
+ 1;
568 /***********************************************************************
569 * X11DRV_sync_whole_window_position
571 * Synchronize the X whole window position with the Windows one
573 int X11DRV_sync_whole_window_position( Display
*display
, WND
*win
, int zorder
)
575 XWindowChanges changes
;
577 struct x11drv_win_data
*data
= win
->pDriverData
;
578 RECT whole_rect
= win
->rectWindow
;
580 X11DRV_window_to_X_rect( win
, &whole_rect
);
581 mask
= get_window_changes( &changes
, &data
->whole_rect
, &whole_rect
);
585 if (is_window_top_level( win
))
587 /* find window that this one must be after */
588 HWND prev
= GetWindow( win
->hwndSelf
, GW_HWNDPREV
);
589 while (prev
&& !(GetWindowLongW( prev
, GWL_STYLE
) & WS_VISIBLE
))
590 prev
= GetWindow( prev
, GW_HWNDPREV
);
591 if (!prev
) /* top child */
593 changes
.stack_mode
= Above
;
598 /* should use stack_mode Below but most window managers don't get it right */
599 /* so move it above the next one in Z order */
600 HWND next
= GetWindow( win
->hwndSelf
, GW_HWNDNEXT
);
601 while (next
&& !(GetWindowLongW( next
, GWL_STYLE
) & WS_VISIBLE
))
602 next
= GetWindow( next
, GW_HWNDNEXT
);
605 changes
.stack_mode
= Above
;
606 changes
.sibling
= X11DRV_get_whole_window(next
);
607 mask
|= CWStackMode
| CWSibling
;
613 HWND next
= GetWindow( win
->hwndSelf
, GW_HWNDNEXT
);
615 if (win
->parent
== GetDesktopWindow() &&
616 root_window
!= DefaultRootWindow(display
))
618 /* in desktop mode we need the sibling to belong to the same process */
621 WND
*ptr
= WIN_GetPtr( next
);
622 if (ptr
!= WND_OTHER_PROCESS
)
624 WIN_ReleasePtr( ptr
);
627 next
= GetWindow( next
, GW_HWNDNEXT
);
631 if (!next
) /* bottom child */
633 changes
.stack_mode
= Below
;
638 changes
.stack_mode
= Above
;
639 changes
.sibling
= X11DRV_get_whole_window(next
);
640 mask
|= CWStackMode
| CWSibling
;
645 data
->whole_rect
= whole_rect
;
649 TRACE( "setting win %lx pos %ld,%ld,%ldx%ld after %lx changes=%x\n",
650 data
->whole_window
, whole_rect
.left
, whole_rect
.top
,
651 whole_rect
.right
- whole_rect
.left
, whole_rect
.bottom
- whole_rect
.top
,
652 changes
.sibling
, mask
);
654 XSync( gdi_display
, False
); /* flush graphics operations before moving the window */
655 if (is_window_top_level( win
))
657 if (mask
& (CWWidth
|CWHeight
)) set_size_hints( display
, win
);
658 XReconfigureWMWindow( display
, data
->whole_window
,
659 DefaultScreen(display
), mask
, &changes
);
661 else XConfigureWindow( display
, data
->whole_window
, mask
, &changes
);
668 /***********************************************************************
669 * X11DRV_sync_client_window_position
671 * Synchronize the X client window position with the Windows one
673 int X11DRV_sync_client_window_position( Display
*display
, WND
*win
)
675 XWindowChanges changes
;
677 struct x11drv_win_data
*data
= win
->pDriverData
;
678 RECT client_rect
= win
->rectClient
;
680 OffsetRect( &client_rect
, -data
->whole_rect
.left
, -data
->whole_rect
.top
);
682 if ((mask
= get_window_changes( &changes
, &data
->client_rect
, &client_rect
)))
684 BOOL was_mapped
= is_client_window_mapped( win
);
686 TRACE( "setting win %lx pos %ld,%ld,%ldx%ld (was %ld,%ld,%ldx%ld) after %lx changes=%x\n",
687 data
->client_window
, client_rect
.left
, client_rect
.top
,
688 client_rect
.right
- client_rect
.left
, client_rect
.bottom
- client_rect
.top
,
689 data
->client_rect
.left
, data
->client_rect
.top
,
690 data
->client_rect
.right
- data
->client_rect
.left
,
691 data
->client_rect
.bottom
- data
->client_rect
.top
,
692 changes
.sibling
, mask
);
693 data
->client_rect
= client_rect
;
695 XSync( gdi_display
, False
); /* flush graphics operations before moving the window */
696 if (was_mapped
&& !is_client_window_mapped( win
))
697 XUnmapWindow( display
, data
->client_window
);
698 XConfigureWindow( display
, data
->client_window
, mask
, &changes
);
699 if (!was_mapped
&& is_client_window_mapped( win
))
700 XMapWindow( display
, data
->client_window
);
707 /***********************************************************************
708 * X11DRV_register_window
710 * Associate an X window to a HWND.
712 void X11DRV_register_window( Display
*display
, HWND hwnd
, struct x11drv_win_data
*data
)
715 XSaveContext( display
, data
->whole_window
, winContext
, (char *)hwnd
);
716 XSaveContext( display
, data
->client_window
, winContext
, (char *)hwnd
);
721 /**********************************************************************
724 static void create_desktop( Display
*display
, WND
*wndPtr
)
726 X11DRV_WND_DATA
*data
= wndPtr
->pDriverData
;
729 winContext
= XUniqueContext();
730 XInternAtoms( display
, (char **)atom_names
, NB_XATOMS
- FIRST_XATOM
, False
, X11DRV_Atoms
);
733 whole_window_atom
= MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_whole_window" ));
734 client_window_atom
= MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_client_window" ));
735 icon_window_atom
= MAKEINTATOMA( GlobalAddAtomA( "__wine_x11_icon_window" ));
737 data
->whole_window
= data
->client_window
= root_window
;
738 data
->whole_rect
= data
->client_rect
= wndPtr
->rectWindow
;
740 SetPropA( wndPtr
->hwndSelf
, whole_window_atom
, (HANDLE
)root_window
);
741 SetPropA( wndPtr
->hwndSelf
, client_window_atom
, (HANDLE
)root_window
);
742 SetPropA( wndPtr
->hwndSelf
, "__wine_x11_visual_id", (HANDLE
)XVisualIDFromVisual(visual
) );
744 X11DRV_InitClipboard();
746 if (root_window
!= DefaultRootWindow(display
)) X11DRV_create_desktop_thread();
750 /**********************************************************************
751 * create_whole_window
753 * Create the whole X window for a given window
755 static Window
create_whole_window( Display
*display
, WND
*win
)
757 struct x11drv_win_data
*data
= win
->pDriverData
;
759 XSetWindowAttributes attr
;
762 BOOL is_top_level
= is_window_top_level( win
);
764 rect
= win
->rectWindow
;
765 X11DRV_window_to_X_rect( win
, &rect
);
767 if (!(cx
= rect
.right
- rect
.left
)) cx
= 1;
768 if (!(cy
= rect
.bottom
- rect
.top
)) cy
= 1;
770 parent
= X11DRV_get_client_window( win
->parent
);
774 mask
= get_window_attributes( display
, win
, &attr
);
776 /* set the attributes that don't change over the lifetime of the window */
777 attr
.bit_gravity
= ForgetGravity
;
778 attr
.win_gravity
= NorthWestGravity
;
779 attr
.backing_store
= NotUseful
/*WhenMapped*/;
780 mask
|= CWBitGravity
| CWWinGravity
| CWBackingStore
;
782 data
->whole_rect
= rect
;
783 data
->whole_window
= XCreateWindow( display
, parent
, rect
.left
, rect
.top
, cx
, cy
,
784 0, screen_depth
, InputOutput
, visual
,
787 if (!data
->whole_window
)
795 XIM xim
= x11drv_thread_data()->xim
;
796 if (xim
) data
->xic
= XCreateIC( xim
,
797 XNInputStyle
, XIMPreeditNothing
| XIMStatusNothing
,
798 XNClientWindow
, data
->whole_window
,
799 XNFocusWindow
, data
->whole_window
,
803 /* non-maximized child must be at bottom of Z order */
804 if ((win
->dwStyle
& (WS_CHILD
|WS_MAXIMIZE
)) == WS_CHILD
)
806 XWindowChanges changes
;
807 changes
.stack_mode
= Below
;
808 XConfigureWindow( display
, data
->whole_window
, CWStackMode
, &changes
);
813 if (is_top_level
) X11DRV_set_wm_hints( display
, win
);
815 return data
->whole_window
;
819 /**********************************************************************
820 * create_client_window
822 * Create the client window for a given window
824 static Window
create_client_window( Display
*display
, WND
*win
)
826 struct x11drv_win_data
*data
= win
->pDriverData
;
827 RECT rect
= data
->whole_rect
;
828 XSetWindowAttributes attr
;
830 OffsetRect( &rect
, -data
->whole_rect
.left
, -data
->whole_rect
.top
);
831 data
->client_rect
= rect
;
833 attr
.event_mask
= (ExposureMask
| PointerMotionMask
|
834 ButtonPressMask
| ButtonReleaseMask
| EnterWindowMask
);
835 attr
.bit_gravity
= (win
->clsStyle
& (CS_VREDRAW
| CS_HREDRAW
)) ?
836 ForgetGravity
: NorthWestGravity
;
837 attr
.backing_store
= NotUseful
/*WhenMapped*/;
840 data
->client_window
= XCreateWindow( display
, data
->whole_window
, 0, 0,
841 max( rect
.right
- rect
.left
, 1 ),
842 max( rect
.bottom
- rect
.top
, 1 ),
845 CWEventMask
| CWBitGravity
| CWBackingStore
, &attr
);
846 if (data
->client_window
&& is_client_window_mapped( win
))
847 XMapWindow( display
, data
->client_window
);
849 return data
->client_window
;
853 /*****************************************************************
854 * SetWindowText (X11DRV.@)
856 BOOL
X11DRV_SetWindowText( HWND hwnd
, LPCWSTR text
)
858 Display
*display
= thread_display();
865 if ((win
= X11DRV_get_whole_window( hwnd
)))
867 /* allocate new buffer for window text */
868 count
= WideCharToMultiByte(CP_UNIXCP
, 0, text
, -1, NULL
, 0, NULL
, NULL
);
869 if (!(buffer
= HeapAlloc( GetProcessHeap(), 0, count
)))
871 ERR("Not enough memory for window text\n");
874 WideCharToMultiByte(CP_UNIXCP
, 0, text
, -1, buffer
, count
, NULL
, NULL
);
876 count
= WideCharToMultiByte(CP_UTF8
, 0, text
, strlenW(text
), NULL
, 0, NULL
, NULL
);
877 if (!(utf8_buffer
= HeapAlloc( GetProcessHeap(), 0, count
)))
879 ERR("Not enough memory for window text in UTF-8\n");
882 WideCharToMultiByte(CP_UTF8
, 0, text
, strlenW(text
), utf8_buffer
, count
, NULL
, NULL
);
885 if (XmbTextListToTextProperty( display
, &buffer
, 1, XStdICCTextStyle
, &prop
) == Success
)
887 XSetWMName( display
, win
, &prop
);
888 XSetWMIconName( display
, win
, &prop
);
892 Implements a NET_WM UTF-8 title. It should be without a trailing \0,
893 according to the standard
894 ( http://www.pps.jussieu.fr/~jch/software/UTF8_STRING/UTF8_STRING.text ).
896 XChangeProperty( display
, win
, x11drv_atom(_NET_WM_NAME
), x11drv_atom(UTF8_STRING
),
897 8, PropModeReplace
, (unsigned char *) utf8_buffer
, count
);
900 HeapFree( GetProcessHeap(), 0, utf8_buffer
);
901 HeapFree( GetProcessHeap(), 0, buffer
);
907 /***********************************************************************
908 * DestroyWindow (X11DRV.@)
910 BOOL
X11DRV_DestroyWindow( HWND hwnd
)
912 struct x11drv_thread_data
*thread_data
= x11drv_thread_data();
913 Display
*display
= thread_data
->display
;
914 WND
*wndPtr
= WIN_GetPtr( hwnd
);
915 X11DRV_WND_DATA
*data
= wndPtr
->pDriverData
;
917 if (!data
) goto done
;
919 if (data
->whole_window
)
921 TRACE( "win %p xwin %lx/%lx\n", hwnd
, data
->whole_window
, data
->client_window
);
922 if (thread_data
->cursor_window
== data
->whole_window
) thread_data
->cursor_window
= None
;
923 if (thread_data
->last_focus
== hwnd
) thread_data
->last_focus
= 0;
925 XSync( gdi_display
, False
); /* flush any reference to this drawable in GDI queue */
926 XDeleteContext( display
, data
->whole_window
, winContext
);
927 XDeleteContext( display
, data
->client_window
, winContext
);
928 XDestroyWindow( display
, data
->whole_window
); /* this destroys client too */
931 XUnsetICFocus( data
->xic
);
932 XDestroyIC( data
->xic
);
934 destroy_icon_window( display
, wndPtr
);
938 if (data
->hWMIconBitmap
) DeleteObject( data
->hWMIconBitmap
);
939 if (data
->hWMIconMask
) DeleteObject( data
->hWMIconMask
);
940 HeapFree( GetProcessHeap(), 0, data
);
941 wndPtr
->pDriverData
= NULL
;
943 WIN_ReleasePtr( wndPtr
);
948 /**********************************************************************
949 * CreateWindow (X11DRV.@)
951 BOOL
X11DRV_CreateWindow( HWND hwnd
, CREATESTRUCTA
*cs
, BOOL unicode
)
953 Display
*display
= thread_display();
955 struct x11drv_win_data
*data
;
962 ERR( "invalid window width %d\n", cs
->cx
);
967 ERR( "invalid window height %d\n", cs
->cx
);
971 if (!(data
= HeapAlloc(GetProcessHeap(), 0, sizeof(*data
)))) return FALSE
;
972 data
->whole_window
= 0;
973 data
->client_window
= 0;
974 data
->icon_window
= 0;
976 data
->hWMIconBitmap
= 0;
977 data
->hWMIconMask
= 0;
979 wndPtr
= WIN_GetPtr( hwnd
);
980 wndPtr
->pDriverData
= data
;
982 /* initialize the dimensions before sending WM_GETMINMAXINFO */
983 SetRect( &rect
, cs
->x
, cs
->y
, cs
->x
+ cs
->cx
, cs
->y
+ cs
->cy
);
984 WIN_SetRectangles( hwnd
, &rect
, &rect
);
988 create_desktop( display
, wndPtr
);
989 WIN_ReleasePtr( wndPtr
);
993 if (!create_whole_window( display
, wndPtr
)) goto failed
;
994 if (!create_client_window( display
, wndPtr
)) goto failed
;
996 XSync( display
, False
);
999 SetPropA( hwnd
, whole_window_atom
, (HANDLE
)data
->whole_window
);
1000 SetPropA( hwnd
, client_window_atom
, (HANDLE
)data
->client_window
);
1002 /* Call the WH_CBT hook */
1004 cbtc
.hwndInsertAfter
= HWND_TOP
;
1005 if (HOOK_CallHooks( WH_CBT
, HCBT_CREATEWND
, (WPARAM
)hwnd
, (LPARAM
)&cbtc
, unicode
))
1007 TRACE("CBT-hook returned !0\n");
1011 /* Send the WM_GETMINMAXINFO message and fix the size if needed */
1012 if ((cs
->style
& WS_THICKFRAME
) || !(cs
->style
& (WS_POPUP
| WS_CHILD
)))
1014 POINT maxSize
, maxPos
, minTrack
, maxTrack
;
1016 WIN_ReleasePtr( wndPtr
);
1017 WINPOS_GetMinMaxInfo( hwnd
, &maxSize
, &maxPos
, &minTrack
, &maxTrack
);
1018 if (maxSize
.x
< cs
->cx
) cs
->cx
= maxSize
.x
;
1019 if (maxSize
.y
< cs
->cy
) cs
->cy
= maxSize
.y
;
1020 if (cs
->cx
< minTrack
.x
) cs
->cx
= minTrack
.x
;
1021 if (cs
->cy
< minTrack
.y
) cs
->cy
= minTrack
.y
;
1022 if (cs
->cx
< 0) cs
->cx
= 0;
1023 if (cs
->cy
< 0) cs
->cy
= 0;
1025 if (!(wndPtr
= WIN_GetPtr( hwnd
))) return FALSE
;
1026 SetRect( &rect
, cs
->x
, cs
->y
, cs
->x
+ cs
->cx
, cs
->y
+ cs
->cy
);
1027 WIN_SetRectangles( hwnd
, &rect
, &rect
);
1028 X11DRV_sync_whole_window_position( display
, wndPtr
, 0 );
1030 WIN_ReleasePtr( wndPtr
);
1032 /* send WM_NCCREATE */
1033 TRACE( "hwnd %p cs %d,%d %dx%d\n", hwnd
, cs
->x
, cs
->y
, cs
->cx
, cs
->cy
);
1035 ret
= SendMessageW( hwnd
, WM_NCCREATE
, 0, (LPARAM
)cs
);
1037 ret
= SendMessageA( hwnd
, WM_NCCREATE
, 0, (LPARAM
)cs
);
1040 WARN("aborted by WM_xxCREATE!\n");
1044 if (!(wndPtr
= WIN_GetPtr(hwnd
))) return FALSE
;
1046 X11DRV_sync_window_style( display
, wndPtr
);
1048 /* send WM_NCCALCSIZE */
1049 rect
= wndPtr
->rectWindow
;
1050 WIN_ReleasePtr( wndPtr
);
1051 SendMessageW( hwnd
, WM_NCCALCSIZE
, FALSE
, (LPARAM
)&rect
);
1053 if (!(wndPtr
= WIN_GetPtr(hwnd
))) return FALSE
;
1054 if (rect
.left
> rect
.right
|| rect
.top
> rect
.bottom
) rect
= wndPtr
->rectWindow
;
1055 WIN_SetRectangles( hwnd
, &wndPtr
->rectWindow
, &rect
);
1056 X11DRV_sync_client_window_position( display
, wndPtr
);
1057 X11DRV_register_window( display
, hwnd
, data
);
1059 TRACE( "win %p window %ld,%ld,%ld,%ld client %ld,%ld,%ld,%ld whole %ld,%ld,%ld,%ld X client %ld,%ld,%ld,%ld xwin %x/%x\n",
1060 hwnd
, wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
,
1061 wndPtr
->rectWindow
.right
, wndPtr
->rectWindow
.bottom
,
1062 wndPtr
->rectClient
.left
, wndPtr
->rectClient
.top
,
1063 wndPtr
->rectClient
.right
, wndPtr
->rectClient
.bottom
,
1064 data
->whole_rect
.left
, data
->whole_rect
.top
,
1065 data
->whole_rect
.right
, data
->whole_rect
.bottom
,
1066 data
->client_rect
.left
, data
->client_rect
.top
,
1067 data
->client_rect
.right
, data
->client_rect
.bottom
,
1068 (unsigned int)data
->whole_window
, (unsigned int)data
->client_window
);
1070 if ((wndPtr
->dwStyle
& (WS_CHILD
|WS_MAXIMIZE
)) == WS_CHILD
)
1071 WIN_LinkWindow( hwnd
, wndPtr
->parent
, HWND_BOTTOM
);
1073 WIN_LinkWindow( hwnd
, wndPtr
->parent
, HWND_TOP
);
1075 WIN_ReleasePtr( wndPtr
);
1078 ret
= (SendMessageW( hwnd
, WM_CREATE
, 0, (LPARAM
)cs
) != -1);
1080 ret
= (SendMessageA( hwnd
, WM_CREATE
, 0, (LPARAM
)cs
) != -1);
1084 WIN_UnlinkWindow( hwnd
);
1088 /* Send the size messages */
1090 if (!(wndPtr
= WIN_FindWndPtr(hwnd
))) return FALSE
;
1091 if (!(wndPtr
->flags
& WIN_NEED_SIZE
))
1093 /* send it anyway */
1094 if (((wndPtr
->rectClient
.right
-wndPtr
->rectClient
.left
) <0)
1095 ||((wndPtr
->rectClient
.bottom
-wndPtr
->rectClient
.top
)<0))
1096 WARN("sending bogus WM_SIZE message 0x%08lx\n",
1097 MAKELONG(wndPtr
->rectClient
.right
-wndPtr
->rectClient
.left
,
1098 wndPtr
->rectClient
.bottom
-wndPtr
->rectClient
.top
));
1099 SendMessageW( hwnd
, WM_SIZE
, SIZE_RESTORED
,
1100 MAKELONG(wndPtr
->rectClient
.right
-wndPtr
->rectClient
.left
,
1101 wndPtr
->rectClient
.bottom
-wndPtr
->rectClient
.top
));
1102 SendMessageW( hwnd
, WM_MOVE
, 0,
1103 MAKELONG( wndPtr
->rectClient
.left
, wndPtr
->rectClient
.top
) );
1106 /* Show the window, maximizing or minimizing if needed */
1108 if (wndPtr
->dwStyle
& (WS_MINIMIZE
| WS_MAXIMIZE
))
1110 extern UINT
WINPOS_MinMaximize( HWND hwnd
, UINT cmd
, LPRECT rect
); /*FIXME*/
1113 UINT swFlag
= (wndPtr
->dwStyle
& WS_MINIMIZE
) ? SW_MINIMIZE
: SW_MAXIMIZE
;
1114 WIN_SetStyle( hwnd
, wndPtr
->dwStyle
& ~(WS_MAXIMIZE
| WS_MINIMIZE
) );
1115 WINPOS_MinMaximize( hwnd
, swFlag
, &newPos
);
1116 swFlag
= ((wndPtr
->dwStyle
& WS_CHILD
) || GetActiveWindow())
1117 ? SWP_NOACTIVATE
| SWP_NOZORDER
| SWP_FRAMECHANGED
1118 : SWP_NOZORDER
| SWP_FRAMECHANGED
;
1119 SetWindowPos( hwnd
, 0, newPos
.left
, newPos
.top
,
1120 newPos
.right
, newPos
.bottom
, swFlag
);
1123 /* if the window was made visible set create struct flag so that
1124 * we do a proper ShowWindow later on */
1125 if (wndPtr
->dwStyle
& WS_VISIBLE
) cs
->style
|= WS_VISIBLE
;
1127 WIN_ReleaseWndPtr( wndPtr
);
1132 X11DRV_DestroyWindow( hwnd
);
1133 if (wndPtr
) WIN_ReleasePtr( wndPtr
);
1138 /***********************************************************************
1139 * X11DRV_get_client_window
1141 * Return the X window associated with the client area of a window
1143 Window
X11DRV_get_client_window( HWND hwnd
)
1146 WND
*win
= WIN_GetPtr( hwnd
);
1148 if (win
== WND_OTHER_PROCESS
)
1149 return (Window
)GetPropA( hwnd
, client_window_atom
);
1153 struct x11drv_win_data
*data
= win
->pDriverData
;
1154 ret
= data
->client_window
;
1155 WIN_ReleasePtr( win
);
1161 /***********************************************************************
1162 * X11DRV_get_whole_window
1164 * Return the X window associated with the full area of a window
1166 Window
X11DRV_get_whole_window( HWND hwnd
)
1169 WND
*win
= WIN_GetPtr( hwnd
);
1171 if (win
== WND_OTHER_PROCESS
)
1172 return (Window
)GetPropA( hwnd
, whole_window_atom
);
1176 struct x11drv_win_data
*data
= win
->pDriverData
;
1177 ret
= data
->whole_window
;
1178 WIN_ReleasePtr( win
);
1184 /***********************************************************************
1187 * Return the X input context associated with a window
1189 XIC
X11DRV_get_ic( HWND hwnd
)
1192 WND
*win
= WIN_GetPtr( hwnd
);
1194 if (win
&& win
!= WND_OTHER_PROCESS
)
1196 struct x11drv_win_data
*data
= win
->pDriverData
;
1198 WIN_ReleasePtr( win
);
1204 /*****************************************************************
1205 * SetParent (X11DRV.@)
1207 HWND
X11DRV_SetParent( HWND hwnd
, HWND parent
)
1209 Display
*display
= thread_display();
1213 /* Windows hides the window first, then shows it again
1214 * including the WM_SHOWWINDOW messages and all */
1215 BOOL was_visible
= ShowWindow( hwnd
, SW_HIDE
);
1217 if (!IsWindow( parent
)) return 0;
1218 if (!(wndPtr
= WIN_GetPtr(hwnd
)) || wndPtr
== WND_OTHER_PROCESS
) return 0;
1220 retvalue
= wndPtr
->parent
; /* old parent */
1221 if (parent
!= retvalue
)
1223 struct x11drv_win_data
*data
= wndPtr
->pDriverData
;
1225 WIN_LinkWindow( hwnd
, parent
, HWND_TOP
);
1227 if (parent
!= GetDesktopWindow()) /* a child window */
1229 if (!(wndPtr
->dwStyle
& WS_CHILD
))
1231 HMENU menu
= (HMENU
)SetWindowLongW( hwnd
, GWL_ID
, 0 );
1232 if (menu
) DestroyMenu( menu
);
1236 if (is_window_top_level( wndPtr
)) X11DRV_set_wm_hints( display
, wndPtr
);
1238 X11DRV_sync_window_style( display
, wndPtr
);
1239 XReparentWindow( display
, data
->whole_window
, X11DRV_get_client_window(parent
),
1240 data
->whole_rect
.left
, data
->whole_rect
.top
);
1241 wine_tsx11_unlock();
1243 WIN_ReleasePtr( wndPtr
);
1245 /* SetParent additionally needs to make hwnd the topmost window
1246 in the x-order and send the expected WM_WINDOWPOSCHANGING and
1247 WM_WINDOWPOSCHANGED notification messages.
1249 SetWindowPos( hwnd
, HWND_TOPMOST
, 0, 0, 0, 0,
1250 SWP_NOACTIVATE
| SWP_NOMOVE
| SWP_NOSIZE
| (was_visible
? SWP_SHOWWINDOW
: 0) );
1251 /* FIXME: a WM_MOVE is also generated (in the DefWindowProc handler
1252 * for WM_WINDOWPOSCHANGED) in Windows, should probably remove SWP_NOMOVE */
1258 /*****************************************************************
1259 * SetFocus (X11DRV.@)
1262 * Explicit colormap management seems to work only with OLVWM.
1264 void X11DRV_SetFocus( HWND hwnd
)
1266 Display
*display
= thread_display();
1267 XWindowAttributes win_attr
;
1270 /* Only mess with the X focus if there's */
1271 /* no desktop window and if the window is not managed by the WM. */
1272 if (root_window
!= DefaultRootWindow(display
)) return;
1274 if (!hwnd
) /* If setting the focus to 0, uninstall the colormap */
1277 if (X11DRV_PALETTE_PaletteFlags
& X11DRV_PALETTE_PRIVATE
)
1278 XUninstallColormap( display
, X11DRV_PALETTE_PaletteXColormap
);
1279 wine_tsx11_unlock();
1283 hwnd
= GetAncestor( hwnd
, GA_ROOT
);
1284 if (GetWindowLongW( hwnd
, GWL_EXSTYLE
) & WS_EX_MANAGED
) return;
1285 if (!(win
= X11DRV_get_whole_window( hwnd
))) return;
1287 /* Set X focus and install colormap */
1289 if (XGetWindowAttributes( display
, win
, &win_attr
) &&
1290 (win_attr
.map_state
== IsViewable
))
1292 /* If window is not viewable, don't change anything */
1294 /* we must not use CurrentTime (ICCCM), so try to use last message time instead */
1295 /* FIXME: this is not entirely correct */
1296 XSetInputFocus( display
, win
, RevertToParent
,
1297 /*CurrentTime*/ GetMessageTime() + X11DRV_server_startticks
);
1298 if (X11DRV_PALETTE_PaletteFlags
& X11DRV_PALETTE_PRIVATE
)
1299 XInstallColormap( display
, X11DRV_PALETTE_PaletteXColormap
);
1301 wine_tsx11_unlock();
1305 /**********************************************************************
1306 * SetWindowIcon (X11DRV.@)
1308 * hIcon or hIconSm has changed (or is being initialised for the
1309 * first time). Complete the X11 driver-specific initialisation
1310 * and set the window hints.
1312 * This is not entirely correct, may need to create
1313 * an icon window and set the pixmap as a background
1315 HICON
X11DRV_SetWindowIcon( HWND hwnd
, HICON icon
, BOOL small
)
1318 Display
*display
= thread_display();
1319 HICON old
= (HICON
)SetClassLongW(hwnd
, small
? GCL_HICONSM
: GCL_HICON
, (LONG
)icon
);
1321 SetWindowPos( hwnd
, 0, 0, 0, 0, 0, SWP_FRAMECHANGED
| SWP_NOSIZE
|
1322 SWP_NOMOVE
| SWP_NOACTIVATE
| SWP_NOZORDER
);
1324 if (!(wndPtr
= WIN_GetPtr( hwnd
)) || wndPtr
== WND_OTHER_PROCESS
) return old
;
1326 if (wndPtr
->dwExStyle
& WS_EX_MANAGED
)
1328 Window win
= get_whole_window(wndPtr
);
1332 if (!(wm_hints
= XGetWMHints( display
, win
))) wm_hints
= XAllocWMHints();
1333 wine_tsx11_unlock();
1336 set_icon_hints( display
, wndPtr
, wm_hints
);
1338 XSetWMHints( display
, win
, wm_hints
);
1340 wine_tsx11_unlock();
1343 WIN_ReleasePtr( wndPtr
);