4 * Copyright 1993, 1994, 1995, 1996 Alexandre Julliard
6 * 1995, 1996 Alex Korobka
11 #ifndef X_DISPLAY_MISSING
13 #include <X11/Xatom.h>
31 #include "wine/winuser16.h"
33 /**********************************************************************/
35 extern Cursor X11DRV_MOUSE_XCursor; /* Current X cursor */
36 extern BOOL X11DRV_CreateBitmap( HBITMAP );
37 extern Pixmap X11DRV_BITMAP_Pixmap( HBITMAP );
39 /**********************************************************************/
41 /* X context to associate a hwnd to an X window */
42 XContext winContext = 0;
44 Atom wmProtocols = None;
45 Atom wmDeleteWindow = None;
46 Atom dndProtocol = None;
47 Atom dndSelection = None;
48 Atom wmChangeState = None;
50 /***********************************************************************
51 * X11DRV_WND_GetXWindow
53 * Return the X window associated to a window.
55 Window X11DRV_WND_GetXWindow(WND *wndPtr)
57 return wndPtr && wndPtr->pDriverData ?
58 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->window : 0;
61 /***********************************************************************
62 * X11DRV_WND_FindXWindow
64 * Return the the first X window associated to a window chain.
66 Window X11DRV_WND_FindXWindow(WND *wndPtr)
69 !((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
70 wndPtr = wndPtr->parent;
72 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->window : 0;
75 /***********************************************************************
76 * X11DRV_WND_GetXScreen
78 * Return the X screen associated to the window.
80 Screen *X11DRV_WND_GetXScreen(WND *wndPtr)
82 while(wndPtr->parent) wndPtr = wndPtr->parent;
83 return X11DRV_DESKTOP_GetXScreen((struct tagDESKTOP *) wndPtr->wExtra);
86 /***********************************************************************
87 * X11DRV_WND_GetXRootWindow
89 * Return the X display associated to the window.
91 Window X11DRV_WND_GetXRootWindow(WND *wndPtr)
93 while(wndPtr->parent) wndPtr = wndPtr->parent;
94 return X11DRV_DESKTOP_GetXRootWindow((struct tagDESKTOP *) wndPtr->wExtra);
97 /***********************************************************************
98 * X11DRV_WND_RegisterWindow
100 * Associate an X window to a HWND.
102 static void X11DRV_WND_RegisterWindow(WND *wndPtr)
104 TSXSetWMProtocols( display, X11DRV_WND_GetXWindow(wndPtr), &wmDeleteWindow, 1 );
106 if (!winContext) winContext = TSXUniqueContext();
107 TSXSaveContext( display, X11DRV_WND_GetXWindow(wndPtr), winContext, (char *) wndPtr );
110 /**********************************************************************
111 * X11DRV_WND_Initialize
113 void X11DRV_WND_Initialize(WND *wndPtr)
115 X11DRV_WND_DATA *pWndDriverData =
116 (X11DRV_WND_DATA *) HeapAlloc(SystemHeap, 0, sizeof(X11DRV_WND_DATA));
118 wndPtr->pDriverData = (void *) pWndDriverData;
120 pWndDriverData->window = 0;
123 /**********************************************************************
124 * X11DRV_WND_Finalize
126 void X11DRV_WND_Finalize(WND *wndPtr)
128 X11DRV_WND_DATA *pWndDriverData =
129 (X11DRV_WND_DATA *) wndPtr->pDriverData;
131 if (!wndPtr->pDriverData) {
132 ERR(win,"Trying to destroy window again. Not good.\n");
135 if(pWndDriverData->window)
138 "WND destroyed without destroying "
139 "the associated X Window (%ld)\n",
140 pWndDriverData->window
143 HeapFree(SystemHeap, 0, wndPtr->pDriverData);
144 wndPtr->pDriverData = NULL;
147 /**********************************************************************
148 * X11DRV_WND_CreateDesktopWindow
150 BOOL X11DRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL bUnicode)
152 if (wmProtocols == None)
153 wmProtocols = TSXInternAtom( display, "WM_PROTOCOLS", True );
154 if (wmDeleteWindow == None)
155 wmDeleteWindow = TSXInternAtom( display, "WM_DELETE_WINDOW", True );
156 if( dndProtocol == None )
157 dndProtocol = TSXInternAtom( display, "DndProtocol" , False );
158 if( dndSelection == None )
159 dndSelection = TSXInternAtom( display, "DndSelection" , False );
160 if( wmChangeState == None )
161 wmChangeState = TSXInternAtom (display, "WM_CHANGE_STATE", False);
163 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->window =
164 X11DRV_WND_GetXRootWindow( wndPtr );
165 X11DRV_WND_RegisterWindow( wndPtr );
171 /**********************************************************************
172 * X11DRV_WND_CreateWindow
174 BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BOOL bUnicode)
176 /* Create the X window (only for top-level windows, and then only */
177 /* when there's no desktop window) */
179 if (!(cs->style & WS_CHILD) &&
180 (X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display)))
184 XSetWindowAttributes win_attr;
186 if (Options.managed && ((cs->style & (WS_DLGFRAME | WS_THICKFRAME)) ||
187 (cs->dwExStyle & WS_EX_DLGMODALFRAME)))
189 win_attr.event_mask = ExposureMask | KeyPressMask |
190 KeyReleaseMask | PointerMotionMask |
191 ButtonPressMask | ButtonReleaseMask |
192 FocusChangeMask | StructureNotifyMask;
193 win_attr.override_redirect = FALSE;
194 wndPtr->flags |= WIN_MANAGED;
198 win_attr.event_mask = ExposureMask | KeyPressMask |
199 KeyReleaseMask | PointerMotionMask |
200 ButtonPressMask | ButtonReleaseMask |
202 win_attr.override_redirect = TRUE;
204 wndPtr->flags |= WIN_NATIVE;
206 win_attr.bit_gravity = (classPtr->style & (CS_VREDRAW | CS_HREDRAW)) ? BGForget : BGNorthWest;
207 win_attr.colormap = X11DRV_PALETTE_PaletteXColormap;
208 win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful;
209 win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
210 win_attr.cursor = X11DRV_MOUSE_XCursor;
212 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap = 0;
213 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->bit_gravity = win_attr.bit_gravity;
214 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->window =
215 TSXCreateWindow( display,
216 X11DRV_WND_GetXRootWindow(wndPtr),
217 cs->x, cs->y, cs->cx, cs->cy,
219 InputOutput, CopyFromParent,
220 CWEventMask | CWOverrideRedirect |
221 CWColormap | CWCursor | CWSaveUnder |
222 CWBackingStore | CWBitGravity,
225 if(!(wGroupLeader = X11DRV_WND_GetXWindow(wndPtr)))
228 if (wndPtr->flags & WIN_MANAGED)
230 XClassHint *class_hints = TSXAllocClassHint();
234 class_hints->res_name = "wineManaged";
235 class_hints->res_class = "Wine";
236 TSXSetClassHint( display, ((X11DRV_WND_DATA *) wndPtr->pDriverData)->window, class_hints );
237 TSXFree (class_hints);
240 if (cs->dwExStyle & WS_EX_DLGMODALFRAME)
242 XSizeHints* size_hints = TSXAllocSizeHints();
246 size_hints->min_width = size_hints->max_width = cs->cx;
247 size_hints->min_height = size_hints->max_height = cs->cy;
248 size_hints->flags = (PSize | PMinSize | PMaxSize);
249 TSXSetWMSizeHints( display, X11DRV_WND_GetXWindow(wndPtr),
250 size_hints, XA_WM_NORMAL_HINTS );
256 if (cs->hwndParent) /* Get window owner */
259 WND *tmpWnd = WIN_FindWndPtr(cs->hwndParent);
261 w = X11DRV_WND_FindXWindow( tmpWnd );
264 TSXSetTransientForHint( display, X11DRV_WND_GetXWindow(wndPtr), w );
267 WIN_ReleaseWndPtr(tmpWnd);
270 wm_hints = TSXAllocWMHints();
272 wm_hints->flags = InputHint | StateHint | WindowGroupHint;
273 wm_hints->input = True;
275 if( wndPtr->flags & WIN_MANAGED )
277 if( wndPtr->class->hIcon )
281 if( (ptr = (CURSORICONINFO *)GlobalLock16( wndPtr->class->hIcon )) )
283 /* This is not entirely correct, may need to create
284 * an icon window and set the pixmap as a background */
286 HBITMAP hBitmap = CreateBitmap( ptr->nWidth, ptr->nHeight,
287 ptr->bPlanes, ptr->bBitsPerPixel, (char *)(ptr + 1) +
288 ptr->nHeight * BITMAP_GetWidthBytes(ptr->nWidth,1) );
292 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap = hBitmap;
293 X11DRV_CreateBitmap( hBitmap );
294 wm_hints->flags |= IconPixmapHint;
295 wm_hints->icon_pixmap = X11DRV_BITMAP_Pixmap( hBitmap );
299 wm_hints->initial_state = (wndPtr->dwStyle & WS_MINIMIZE)
300 ? IconicState : NormalState;
303 wm_hints->initial_state = NormalState;
304 wm_hints->window_group = wGroupLeader;
306 TSXSetWMHints( display, X11DRV_WND_GetXWindow(wndPtr), wm_hints );
309 X11DRV_WND_RegisterWindow( wndPtr );
314 /***********************************************************************
315 * X11DRV_WND_DestroyWindow
317 BOOL X11DRV_WND_DestroyWindow(WND *wndPtr)
320 if ((w = X11DRV_WND_GetXWindow(wndPtr)))
323 TSXDeleteContext( display, w, winContext );
324 TSXDestroyWindow( display, w );
325 while( TSXCheckWindowEvent(display, w, NoEventMask, &xe) );
327 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->window = None;
328 if( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap )
330 DeleteObject( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap );
331 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap = 0;
338 /*****************************************************************
339 * X11DRV_WND_SetParent
341 WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
343 WND *pDesktop = WIN_GetDesktop();
345 if( wndPtr && pWndParent && (wndPtr != pDesktop) )
347 WND* pWndPrev = wndPtr->parent;
349 if( pWndParent != pWndPrev )
351 if ( X11DRV_WND_GetXWindow(wndPtr) )
353 /* Toplevel window needs to be reparented. Used by Tk 8.0 */
355 TSXDestroyWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
356 ((X11DRV_WND_DATA *) wndPtr->pDriverData)->window = None;
359 WIN_UnlinkWindow(wndPtr->hwndSelf);
360 wndPtr->parent = pWndParent;
362 /* Create an X counterpart for reparented top-level windows
363 * when not in the desktop mode. */
365 if( pWndParent == pDesktop )
367 wndPtr->dwStyle &= ~WS_CHILD;
369 if( X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display) )
372 cs.lpCreateParams = NULL;
373 cs.hInstance = 0; /* not used if following call */
374 cs.hMenu = 0; /* not used in following call */
375 cs.hwndParent = pWndParent->hwndSelf;
376 cs.cy = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
379 cs.cx = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
382 cs.y = wndPtr->rectWindow.top;
383 cs.x = wndPtr->rectWindow.left;
384 cs.style = wndPtr->dwStyle;
385 cs.lpszName = 0; /* not used in following call */
386 cs.lpszClass = 0; /*not used in following call */
387 cs.dwExStyle = wndPtr->dwExStyle;
388 X11DRV_WND_CreateWindow(wndPtr, wndPtr->class,
392 else /* a child window */
394 if( !( wndPtr->dwStyle & WS_CHILD ) )
396 wndPtr->dwStyle |= WS_CHILD;
397 if( wndPtr->wIDmenu != 0)
399 DestroyMenu( (HMENU) wndPtr->wIDmenu );
404 WIN_LinkWindow(wndPtr->hwndSelf, HWND_TOP);
406 WIN_ReleaseDesktop();
409 WIN_ReleaseDesktop();
413 /***********************************************************************
414 * X11DRV_WND_ForceWindowRaise
416 * Raise a window on top of the X stacking order, while preserving
417 * the correct Windows Z order.
419 void X11DRV_WND_ForceWindowRaise(WND *wndPtr)
421 XWindowChanges winChanges;
422 WND *wndPrev,*pDesktop = WIN_GetDesktop();
424 if( !wndPtr || !X11DRV_WND_GetXWindow(wndPtr) || (wndPtr->flags & WIN_MANAGED) )
426 WIN_ReleaseDesktop();
430 /* Raise all windows up to wndPtr according to their Z order.
431 * (it would be easier with sibling-related Below but it doesn't
432 * work very well with SGI mwm for instance)
434 winChanges.stack_mode = Above;
437 if (X11DRV_WND_GetXWindow(wndPtr))
438 TSXReconfigureWMWindow( display, X11DRV_WND_GetXWindow(wndPtr), 0,
439 CWStackMode, &winChanges );
440 wndPrev = pDesktop->child;
441 if (wndPrev == wndPtr) break;
442 while (wndPrev && (wndPrev->next != wndPtr)) wndPrev = wndPrev->next;
445 WIN_ReleaseDesktop();
448 /***********************************************************************
449 * X11DRV_WND_FindDesktopXWindow [Internal]
451 * Find the actual X window which needs be restacked.
452 * Used by X11DRV_SetWindowPos().
454 static Window X11DRV_WND_FindDesktopXWindow( WND *wndPtr )
456 if (!(wndPtr->flags & WIN_MANAGED))
457 return X11DRV_WND_GetXWindow(wndPtr);
460 Window window, root, parent, *children;
462 window = X11DRV_WND_GetXWindow(wndPtr);
465 TSXQueryTree( display, window, &root, &parent,
466 &children, &nchildren );
475 /***********************************************************************
476 * WINPOS_SetXWindowPos
478 * SetWindowPos() for an X window. Used by the real SetWindowPos().
480 void X11DRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS *winpos, BOOL bChangePos)
482 XWindowChanges winChanges;
484 WND *winposPtr = WIN_FindWndPtr( winpos->hwnd );
486 if(!wndPtr->hwndSelf) wndPtr = NULL; /* FIXME: WND destroyed, shouldn't happend!!! */
488 if (!(winpos->flags & SWP_SHOWWINDOW) && (winpos->flags & SWP_HIDEWINDOW))
490 if(X11DRV_WND_GetXWindow(wndPtr))
491 TSXUnmapWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
496 if ( !(winpos->flags & SWP_NOSIZE))
498 winChanges.width = (winpos->cx > 0 ) ? winpos->cx : 1;
499 winChanges.height = (winpos->cy > 0 ) ? winpos->cy : 1;
500 changeMask |= CWWidth | CWHeight;
502 /* Tweak dialog window size hints */
504 if ((winposPtr->flags & WIN_MANAGED) &&
505 (winposPtr->dwExStyle & WS_EX_DLGMODALFRAME))
507 XSizeHints *size_hints = TSXAllocSizeHints();
511 long supplied_return;
513 TSXGetWMSizeHints( display, X11DRV_WND_GetXWindow(winposPtr), size_hints,
514 &supplied_return, XA_WM_NORMAL_HINTS);
515 size_hints->min_width = size_hints->max_width = winpos->cx;
516 size_hints->min_height = size_hints->max_height = winpos->cy;
517 TSXSetWMSizeHints( display, X11DRV_WND_GetXWindow(winposPtr), size_hints,
518 XA_WM_NORMAL_HINTS );
523 if (!(winpos->flags & SWP_NOMOVE))
525 winChanges.x = winpos->x;
526 winChanges.y = winpos->y;
527 changeMask |= CWX | CWY;
529 if (!(winpos->flags & SWP_NOZORDER))
531 winChanges.stack_mode = Below;
532 changeMask |= CWStackMode;
534 if (winpos->hwndInsertAfter == HWND_TOP) winChanges.stack_mode = Above;
535 else if (winpos->hwndInsertAfter != HWND_BOTTOM)
537 WND* insertPtr = WIN_FindWndPtr( winpos->hwndInsertAfter );
540 stack[0] = X11DRV_WND_FindDesktopXWindow( insertPtr );
541 stack[1] = X11DRV_WND_FindDesktopXWindow( winposPtr );
543 /* for stupid window managers (i.e. all of them) */
545 TSXRestackWindows(display, stack, 2);
546 changeMask &= ~CWStackMode;
548 WIN_ReleaseWndPtr(insertPtr);
553 TSXReconfigureWMWindow( display, X11DRV_WND_GetXWindow(winposPtr), 0, changeMask, &winChanges );
554 if( winposPtr->class->style & (CS_VREDRAW | CS_HREDRAW) )
555 X11DRV_WND_SetHostAttr( winposPtr, HAK_BITGRAVITY, BGForget );
559 if ( winpos->flags & SWP_SHOWWINDOW )
561 if(X11DRV_WND_GetXWindow(wndPtr))
562 TSXMapWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
564 WIN_ReleaseWndPtr(winposPtr);
567 /*****************************************************************
570 void X11DRV_WND_SetText(WND *wndPtr, LPCSTR text)
572 if (!X11DRV_WND_GetXWindow(wndPtr))
575 TSXStoreName( display, X11DRV_WND_GetXWindow(wndPtr), text );
576 TSXSetIconName( display, X11DRV_WND_GetXWindow(wndPtr), text );
579 /*****************************************************************
580 * X11DRV_WND_SetFocus
583 * Explicit colormap management seems to work only with OLVWM.
585 void X11DRV_WND_SetFocus(WND *wndPtr)
587 HWND hwnd = wndPtr->hwndSelf;
588 XWindowAttributes win_attr;
591 /* Only mess with the X focus if there's */
592 /* no desktop window and no window manager. */
593 if ((X11DRV_WND_GetXRootWindow(wndPtr) != DefaultRootWindow(display))
594 || Options.managed) return;
596 if (!hwnd) /* If setting the focus to 0, uninstall the colormap */
598 if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
599 TSXUninstallColormap( display, X11DRV_PALETTE_PaletteXColormap );
603 /* Set X focus and install colormap */
605 if (!(win = X11DRV_WND_FindXWindow(wndPtr))) return;
606 if (!TSXGetWindowAttributes( display, win, &win_attr ) ||
607 (win_attr.map_state != IsViewable))
608 return; /* If window is not viewable, don't change anything */
610 TSXSetInputFocus( display, win, RevertToParent, CurrentTime );
611 if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
612 TSXInstallColormap( display, X11DRV_PALETTE_PaletteXColormap );
617 /*****************************************************************
618 * X11DRV_WND_PreSizeMove
620 void X11DRV_WND_PreSizeMove(WND *wndPtr)
622 if (!(wndPtr->dwStyle & WS_CHILD) &&
623 (X11DRV_WND_GetXRootWindow(wndPtr) == DefaultRootWindow(display)))
624 TSXGrabServer( display );
627 /*****************************************************************
628 * X11DRV_WND_PostSizeMove
630 void X11DRV_WND_PostSizeMove(WND *wndPtr)
632 if (!(wndPtr->dwStyle & WS_CHILD) &&
633 (X11DRV_GetXRootWindow() == DefaultRootWindow(display)))
634 TSXUngrabServer( display );
637 /*****************************************************************
638 * X11DRV_WND_SurfaceCopy
640 * Copies rect to (rect.left + dx, rect.top + dy).
642 void X11DRV_WND_SurfaceCopy(WND* wndPtr, DC *dcPtr, INT dx, INT dy,
643 const RECT *rect, BOOL bUpdate)
645 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dcPtr->physDev;
648 dst.x = (src.x = dcPtr->w.DCOrgX + rect->left) + dx;
649 dst.y = (src.y = dcPtr->w.DCOrgY + rect->top) + dy;
651 if (bUpdate) /* handles non-Wine windows hanging over the copied area */
652 TSXSetGraphicsExposures( display, physDev->gc, True );
653 TSXSetFunction( display, physDev->gc, GXcopy );
654 TSXCopyArea( display, physDev->drawable, physDev->drawable,
655 physDev->gc, src.x, src.y,
656 rect->right - rect->left,
657 rect->bottom - rect->top,
660 TSXSetGraphicsExposures( display, physDev->gc, False );
662 if (bUpdate) /* Make sure exposure events have been processed */
666 /***********************************************************************
667 * X11DRV_WND_SetDrawable
669 * Set the drawable, origin and dimensions for the DC associated to
672 void X11DRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin)
674 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
676 if (!wndPtr) /* Get a DC for the whole screen */
680 physDev->drawable = X11DRV_WND_GetXRootWindow(wndPtr);
681 TSXSetSubwindowMode( display, physDev->gc, IncludeInferiors );
685 if (flags & DCX_WINDOW)
687 dc->w.DCOrgX = wndPtr->rectWindow.left;
688 dc->w.DCOrgY = wndPtr->rectWindow.top;
692 dc->w.DCOrgX = wndPtr->rectClient.left;
693 dc->w.DCOrgY = wndPtr->rectClient.top;
695 while (!X11DRV_WND_GetXWindow(wndPtr))
697 wndPtr = wndPtr->parent;
698 dc->w.DCOrgX += wndPtr->rectClient.left;
699 dc->w.DCOrgY += wndPtr->rectClient.top;
701 dc->w.DCOrgX -= wndPtr->rectWindow.left;
702 dc->w.DCOrgY -= wndPtr->rectWindow.top;
703 physDev->drawable = X11DRV_WND_GetXWindow(wndPtr);
706 /* This is needed when we reuse a cached DC because
707 * SetDCState() called by ReleaseDC() screws up DC
708 * origins for child windows.
712 TSXSetClipOrigin( display, physDev->gc, dc->w.DCOrgX, dc->w.DCOrgY );
717 /***********************************************************************
720 static BOOL X11DRV_SetWMHint(Display* display, WND* wndPtr, int hint, int val)
722 XWMHints* wm_hints = TSXAllocWMHints();
724 wm_hints->flags = hint;
728 wm_hints->input = val;
732 wm_hints->initial_state = val;
736 wm_hints->icon_pixmap = (Pixmap)val;
740 wm_hints->icon_window = (Window)val;
744 TSXSetWMHints( display, X11DRV_WND_GetXWindow(wndPtr), wm_hints );
752 /***********************************************************************
753 * X11DRV_WND_SetHostAttr
755 * This function returns TRUE if the attribute is supported and the
756 * action was successful. Otherwise it should return FALSE and Wine will try
757 * to get by without the functionality provided by the host window system.
759 BOOL X11DRV_WND_SetHostAttr(WND* wnd, INT ha, INT value)
763 if( (w = X11DRV_WND_GetXWindow(wnd)) )
765 XSetWindowAttributes win_attr;
769 case HAK_ICONICSTATE: /* called when a window is minimized/restored */
771 if( (wnd->flags & WIN_MANAGED) )
775 if( wnd->dwStyle & WS_VISIBLE )
777 XClientMessageEvent ev;
779 /* FIXME: set proper icon */
781 ev.type = ClientMessage;
782 ev.display = display;
783 ev.message_type = wmChangeState;
785 ev.data.l[0] = IconicState;
788 if( TSXSendEvent (display,
789 RootWindow( display, XScreenNumberOfScreen(X11DRV_WND_GetXScreen(wnd)) ),
790 True, (SubstructureRedirectMask | SubstructureNotifyMask), (XEvent*)&ev))
794 while( !TSXCheckTypedWindowEvent( display, w, UnmapNotify, &xe) );
800 X11DRV_SetWMHint( display, wnd, StateHint, IconicState );
804 if( !(wnd->flags & WS_VISIBLE) )
805 X11DRV_SetWMHint( display, wnd, StateHint, NormalState );
809 XMapWindow(display, w );
810 while( !TSXCheckTypedWindowEvent( display, w, MapNotify, &xe) );
817 case HAK_BITGRAVITY: /* called when a window is resized */
819 if( ((X11DRV_WND_DATA *) wnd->pDriverData)->bit_gravity != value )
821 win_attr.bit_gravity = value;
822 ((X11DRV_WND_DATA *) wnd->pDriverData)->bit_gravity = value;
823 TSXChangeWindowAttributes( display, w, CWBitGravity, &win_attr );
827 case HAK_ACCEPTFOCUS: /* called when a window is disabled/enabled */
829 if( (wnd->flags & WIN_MANAGED) )
830 return X11DRV_SetWMHint( display, wnd, InputHint, value );
836 /***********************************************************************
837 * X11DRV_WND_IsSelfClipping
839 BOOL X11DRV_WND_IsSelfClipping(WND *wndPtr)
841 return X11DRV_WND_GetXWindow(wndPtr) != None;
844 #endif /* !defined(X_DISPLAY_MISSING) */