1998-12-07 10:13:40 +01:00
|
|
|
/*
|
|
|
|
* X11 windows driver
|
|
|
|
*
|
|
|
|
* Copyright 1993, 1994, 1995, 1996 Alexandre Julliard
|
|
|
|
* 1993 David Metcalfe
|
|
|
|
* 1995, 1996 Alex Korobka
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <X11/Xatom.h>
|
2000-04-25 21:55:35 +02:00
|
|
|
|
1998-12-07 10:13:40 +01:00
|
|
|
#include "ts_xlib.h"
|
|
|
|
#include "ts_xutil.h"
|
2000-07-29 01:04:54 +02:00
|
|
|
#include "ts_shape.h"
|
1998-12-07 10:13:40 +01:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2000-04-25 21:55:35 +02:00
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
#include "bitmap.h"
|
1999-07-04 18:02:24 +02:00
|
|
|
#include "debugtools.h"
|
1998-12-07 10:13:40 +01:00
|
|
|
#include "dce.h"
|
2000-08-04 06:18:04 +02:00
|
|
|
#include "dc.h"
|
1998-12-07 10:13:40 +01:00
|
|
|
#include "options.h"
|
|
|
|
#include "message.h"
|
1998-12-26 13:00:43 +01:00
|
|
|
#include "heap.h"
|
1998-12-07 10:13:40 +01:00
|
|
|
#include "win.h"
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
1999-02-04 12:11:01 +01:00
|
|
|
#include "class.h"
|
1998-12-07 10:13:40 +01:00
|
|
|
#include "x11drv.h"
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "wingdi.h"
|
2000-07-10 14:09:31 +02:00
|
|
|
#include "winnls.h"
|
1999-04-01 14:03:52 +02:00
|
|
|
#include "wine/winuser16.h"
|
1998-12-07 10:13:40 +01:00
|
|
|
|
2000-06-03 06:20:19 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(win);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-09-03 14:33:40 +02:00
|
|
|
/* Some useful macros */
|
|
|
|
#define HAS_DLGFRAME(style,exStyle) \
|
|
|
|
((!((style) & WS_THICKFRAME)) && (((style) & WS_DLGFRAME) || ((exStyle) & WS_EX_DLGMODALFRAME)))
|
|
|
|
|
1998-12-07 10:13:40 +01:00
|
|
|
/**********************************************************************/
|
|
|
|
|
1999-02-04 12:11:01 +01:00
|
|
|
extern Cursor X11DRV_MOUSE_XCursor; /* Current X cursor */
|
1999-04-01 14:03:52 +02:00
|
|
|
extern BOOL X11DRV_CreateBitmap( HBITMAP );
|
|
|
|
extern Pixmap X11DRV_BITMAP_Pixmap( HBITMAP );
|
1998-12-07 10:13:40 +01:00
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
2000-08-10 03:16:19 +02:00
|
|
|
WND_DRIVER X11DRV_WND_Driver =
|
|
|
|
{
|
|
|
|
X11DRV_WND_Initialize,
|
|
|
|
X11DRV_WND_Finalize,
|
|
|
|
X11DRV_WND_CreateDesktopWindow,
|
|
|
|
X11DRV_WND_CreateWindow,
|
|
|
|
X11DRV_WND_DestroyWindow,
|
|
|
|
X11DRV_WND_SetParent,
|
|
|
|
X11DRV_WND_ForceWindowRaise,
|
|
|
|
X11DRV_WND_SetWindowPos,
|
|
|
|
X11DRV_WND_SetText,
|
|
|
|
X11DRV_WND_SetFocus,
|
|
|
|
X11DRV_WND_PreSizeMove,
|
|
|
|
X11DRV_WND_PostSizeMove,
|
|
|
|
X11DRV_WND_SurfaceCopy,
|
|
|
|
X11DRV_WND_SetDrawable,
|
|
|
|
X11DRV_WND_SetHostAttr,
|
|
|
|
X11DRV_WND_IsSelfClipping,
|
|
|
|
X11DRV_WND_SetWindowRgn
|
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-12-07 10:13:40 +01:00
|
|
|
/* X context to associate a hwnd to an X window */
|
|
|
|
XContext winContext = 0;
|
|
|
|
|
|
|
|
Atom wmProtocols = None;
|
|
|
|
Atom wmDeleteWindow = None;
|
|
|
|
Atom dndProtocol = None;
|
|
|
|
Atom dndSelection = None;
|
1999-04-01 14:03:52 +02:00
|
|
|
Atom wmChangeState = None;
|
1998-12-07 10:13:40 +01:00
|
|
|
|
1999-12-12 00:54:59 +01:00
|
|
|
Atom kwmDockWindow = None;
|
|
|
|
|
1998-12-07 10:13:40 +01:00
|
|
|
/***********************************************************************
|
1998-12-26 13:00:43 +01:00
|
|
|
* X11DRV_WND_GetXWindow
|
1998-12-07 10:13:40 +01:00
|
|
|
*
|
|
|
|
* Return the X window associated to a window.
|
|
|
|
*/
|
1998-12-26 13:00:43 +01:00
|
|
|
Window X11DRV_WND_GetXWindow(WND *wndPtr)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1999-02-18 18:30:40 +01:00
|
|
|
return wndPtr && wndPtr->pDriverData ?
|
1998-12-26 13:00:43 +01:00
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_FindXWindow
|
|
|
|
*
|
|
|
|
* Return the the first X window associated to a window chain.
|
|
|
|
*/
|
|
|
|
Window X11DRV_WND_FindXWindow(WND *wndPtr)
|
|
|
|
{
|
|
|
|
while (wndPtr &&
|
|
|
|
!((X11DRV_WND_DATA *) wndPtr->pDriverData)->window)
|
|
|
|
wndPtr = wndPtr->parent;
|
|
|
|
return wndPtr ?
|
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window : 0;
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_RegisterWindow
|
|
|
|
*
|
|
|
|
* Associate an X window to a HWND.
|
|
|
|
*/
|
1999-02-04 12:11:01 +01:00
|
|
|
static void X11DRV_WND_RegisterWindow(WND *wndPtr)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1999-02-04 12:11:01 +01:00
|
|
|
TSXSetWMProtocols( display, X11DRV_WND_GetXWindow(wndPtr), &wmDeleteWindow, 1 );
|
1998-12-07 10:13:40 +01:00
|
|
|
|
|
|
|
if (!winContext) winContext = TSXUniqueContext();
|
1999-05-22 20:57:17 +02:00
|
|
|
TSXSaveContext( display, X11DRV_WND_GetXWindow(wndPtr),
|
|
|
|
winContext, (char *) wndPtr->hwndSelf );
|
1998-12-26 13:00:43 +01:00
|
|
|
}
|
|
|
|
|
2000-08-06 05:35:24 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_IsZeroSizeWnd
|
|
|
|
*
|
|
|
|
* Return TRUE if the window has a height or widht less or equal to 0
|
|
|
|
*/
|
|
|
|
static BOOL X11DRV_WND_IsZeroSizeWnd(WND *wndPtr)
|
|
|
|
{
|
|
|
|
if ( (wndPtr->rectWindow.left >= wndPtr->rectWindow.right) ||
|
|
|
|
(wndPtr->rectWindow.top >= wndPtr->rectWindow.bottom) )
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-12-26 13:00:43 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_WND_Initialize
|
|
|
|
*/
|
|
|
|
void X11DRV_WND_Initialize(WND *wndPtr)
|
|
|
|
{
|
|
|
|
X11DRV_WND_DATA *pWndDriverData =
|
|
|
|
(X11DRV_WND_DATA *) HeapAlloc(SystemHeap, 0, sizeof(X11DRV_WND_DATA));
|
|
|
|
|
|
|
|
wndPtr->pDriverData = (void *) pWndDriverData;
|
|
|
|
|
|
|
|
pWndDriverData->window = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_WND_Finalize
|
|
|
|
*/
|
|
|
|
void X11DRV_WND_Finalize(WND *wndPtr)
|
|
|
|
{
|
|
|
|
X11DRV_WND_DATA *pWndDriverData =
|
|
|
|
(X11DRV_WND_DATA *) wndPtr->pDriverData;
|
|
|
|
|
1999-01-23 15:03:11 +01:00
|
|
|
if (!wndPtr->pDriverData) {
|
1999-07-04 18:02:24 +02:00
|
|
|
ERR("Trying to destroy window again. Not good.\n");
|
1999-01-23 15:03:11 +01:00
|
|
|
return;
|
|
|
|
}
|
1998-12-26 13:00:43 +01:00
|
|
|
if(pWndDriverData->window)
|
|
|
|
{
|
1999-07-04 18:02:24 +02:00
|
|
|
ERR(
|
1998-12-26 13:00:43 +01:00
|
|
|
"WND destroyed without destroying "
|
|
|
|
"the associated X Window (%ld)\n",
|
|
|
|
pWndDriverData->window
|
|
|
|
);
|
|
|
|
}
|
|
|
|
HeapFree(SystemHeap, 0, wndPtr->pDriverData);
|
1999-01-24 19:55:48 +01:00
|
|
|
wndPtr->pDriverData = NULL;
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_WND_CreateDesktopWindow
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL X11DRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL bUnicode)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
|
|
|
if (wmProtocols == None)
|
|
|
|
wmProtocols = TSXInternAtom( display, "WM_PROTOCOLS", True );
|
|
|
|
if (wmDeleteWindow == None)
|
|
|
|
wmDeleteWindow = TSXInternAtom( display, "WM_DELETE_WINDOW", True );
|
|
|
|
if( dndProtocol == None )
|
|
|
|
dndProtocol = TSXInternAtom( display, "DndProtocol" , False );
|
|
|
|
if( dndSelection == None )
|
|
|
|
dndSelection = TSXInternAtom( display, "DndSelection" , False );
|
1999-04-01 14:03:52 +02:00
|
|
|
if( wmChangeState == None )
|
|
|
|
wmChangeState = TSXInternAtom (display, "WM_CHANGE_STATE", False);
|
1999-12-12 00:54:59 +01:00
|
|
|
if (kwmDockWindow == None)
|
|
|
|
kwmDockWindow = TSXInternAtom( display, "KWM_DOCKWINDOW", False );
|
1998-12-07 10:13:40 +01:00
|
|
|
|
2000-03-25 15:05:06 +01:00
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window = X11DRV_GetXRootWindow();
|
1998-12-07 10:13:40 +01:00
|
|
|
X11DRV_WND_RegisterWindow( wndPtr );
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-05-23 06:12:23 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_WND_IconChanged
|
|
|
|
*
|
|
|
|
* hIcon or hIconSm has changed (or is being initialised for the
|
|
|
|
* first time). Complete the X11 driver-specific initialisation.
|
|
|
|
*
|
|
|
|
* This is not entirely correct, may need to create
|
|
|
|
* an icon window and set the pixmap as a background
|
|
|
|
*/
|
|
|
|
static void X11DRV_WND_IconChanged(WND *wndPtr)
|
|
|
|
{
|
|
|
|
|
|
|
|
HICON16 hIcon = NC_IconForWindow(wndPtr);
|
|
|
|
|
|
|
|
if( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap )
|
|
|
|
DeleteObject( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap );
|
|
|
|
|
|
|
|
if( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask )
|
|
|
|
DeleteObject( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask);
|
|
|
|
|
|
|
|
if (!hIcon)
|
|
|
|
{
|
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap= 0;
|
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask= 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HBITMAP hbmOrig;
|
|
|
|
RECT rcMask;
|
|
|
|
BITMAP bmMask;
|
|
|
|
ICONINFO ii;
|
|
|
|
HDC hDC;
|
|
|
|
|
|
|
|
GetIconInfo(hIcon, &ii);
|
|
|
|
|
|
|
|
X11DRV_CreateBitmap(ii.hbmMask);
|
|
|
|
X11DRV_CreateBitmap(ii.hbmColor);
|
|
|
|
|
|
|
|
GetObjectA(ii.hbmMask, sizeof(bmMask), &bmMask);
|
|
|
|
rcMask.top = 0;
|
|
|
|
rcMask.left = 0;
|
|
|
|
rcMask.right = bmMask.bmWidth;
|
|
|
|
rcMask.bottom = bmMask.bmHeight;
|
|
|
|
|
|
|
|
hDC = CreateCompatibleDC(0);
|
|
|
|
hbmOrig = SelectObject(hDC, ii.hbmMask);
|
|
|
|
InvertRect(hDC, &rcMask);
|
|
|
|
SelectObject(hDC, hbmOrig);
|
|
|
|
DeleteDC(hDC);
|
|
|
|
|
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap = ii.hbmColor;
|
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask= ii.hbmMask;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void X11DRV_WND_SetIconHints(WND *wndPtr, XWMHints *hints)
|
|
|
|
{
|
|
|
|
if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap)
|
|
|
|
{
|
|
|
|
hints->icon_pixmap
|
|
|
|
= X11DRV_BITMAP_Pixmap(((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap);
|
|
|
|
hints->flags |= IconPixmapHint;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hints->flags &= ~IconPixmapHint;
|
|
|
|
|
|
|
|
if (((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask)
|
|
|
|
{
|
|
|
|
hints->icon_mask
|
|
|
|
= X11DRV_BITMAP_Pixmap(((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask);
|
|
|
|
hints->flags |= IconMaskHint;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hints->flags &= ~IconMaskHint;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_WND_UpdateIconHints
|
|
|
|
*
|
|
|
|
* hIcon or hIconSm has changed (or is being initialised for the
|
|
|
|
* first time). Complete the X11 driver-specific initialisation
|
|
|
|
* and set the window hints.
|
|
|
|
*
|
|
|
|
* This is not entirely correct, may need to create
|
|
|
|
* an icon window and set the pixmap as a background
|
|
|
|
*/
|
|
|
|
static void X11DRV_WND_UpdateIconHints(WND *wndPtr)
|
|
|
|
{
|
|
|
|
XWMHints* wm_hints;
|
|
|
|
|
|
|
|
X11DRV_WND_IconChanged(wndPtr);
|
|
|
|
|
2000-06-02 22:36:29 +02:00
|
|
|
wm_hints = TSXGetWMHints( display, X11DRV_WND_GetXWindow(wndPtr) );
|
|
|
|
if (!wm_hints) wm_hints = TSXAllocWMHints();
|
|
|
|
if (wm_hints)
|
|
|
|
{
|
|
|
|
X11DRV_WND_SetIconHints(wndPtr, wm_hints);
|
|
|
|
TSXSetWMHints( display, X11DRV_WND_GetXWindow(wndPtr), wm_hints );
|
|
|
|
TSXFree( wm_hints );
|
|
|
|
}
|
2000-05-23 06:12:23 +02:00
|
|
|
}
|
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
|
1998-12-07 10:13:40 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* X11DRV_WND_CreateWindow
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BOOL bUnicode)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
|
|
|
/* Create the X window (only for top-level windows, and then only */
|
|
|
|
/* when there's no desktop window) */
|
|
|
|
|
2000-06-13 05:35:36 +02:00
|
|
|
if ((X11DRV_GetXRootWindow() == DefaultRootWindow(display))
|
|
|
|
&& (wndPtr->parent->hwndSelf == GetDesktopWindow()))
|
1999-03-28 11:37:57 +02:00
|
|
|
{
|
|
|
|
Window wGroupLeader;
|
|
|
|
XWMHints* wm_hints;
|
1998-12-07 10:13:40 +01:00
|
|
|
XSetWindowAttributes win_attr;
|
|
|
|
|
1999-04-25 11:19:21 +02:00
|
|
|
/* Create "managed" windows only if a title bar or resizable */
|
|
|
|
/* frame is required. */
|
1999-12-12 00:54:59 +01:00
|
|
|
if (WIN_WindowNeedsWMBorder(cs->style, cs->dwExStyle)) {
|
1998-12-07 10:13:40 +01:00
|
|
|
win_attr.event_mask = ExposureMask | KeyPressMask |
|
|
|
|
KeyReleaseMask | PointerMotionMask |
|
|
|
|
ButtonPressMask | ButtonReleaseMask |
|
|
|
|
FocusChangeMask | StructureNotifyMask;
|
|
|
|
win_attr.override_redirect = FALSE;
|
|
|
|
wndPtr->flags |= WIN_MANAGED;
|
1999-12-12 00:54:59 +01:00
|
|
|
} else {
|
1998-12-07 10:13:40 +01:00
|
|
|
win_attr.event_mask = ExposureMask | KeyPressMask |
|
|
|
|
KeyReleaseMask | PointerMotionMask |
|
|
|
|
ButtonPressMask | ButtonReleaseMask |
|
|
|
|
FocusChangeMask;
|
|
|
|
win_attr.override_redirect = TRUE;
|
|
|
|
}
|
1999-03-28 11:37:57 +02:00
|
|
|
wndPtr->flags |= WIN_NATIVE;
|
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
win_attr.bit_gravity = (classPtr->style & (CS_VREDRAW | CS_HREDRAW)) ? BGForget : BGNorthWest;
|
1999-04-01 10:16:08 +02:00
|
|
|
win_attr.colormap = X11DRV_PALETTE_PaletteXColormap;
|
2000-02-19 21:50:00 +01:00
|
|
|
win_attr.backing_store = NotUseful;
|
1998-12-07 10:13:40 +01:00
|
|
|
win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
|
1999-02-04 12:11:01 +01:00
|
|
|
win_attr.cursor = X11DRV_MOUSE_XCursor;
|
1999-03-28 11:37:57 +02:00
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap = 0;
|
2000-05-23 06:12:23 +02:00
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask = 0;
|
1999-04-01 14:03:52 +02:00
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->bit_gravity = win_attr.bit_gravity;
|
2000-06-25 14:53:27 +02:00
|
|
|
|
|
|
|
/* Zero-size X11 window hack. X doesn't like them, and will crash */
|
|
|
|
/* with a BadValue unless we do something ugly like this. */
|
2000-08-06 05:35:24 +02:00
|
|
|
/* Zero size window won't be mapped */
|
2000-06-25 14:53:27 +02:00
|
|
|
if (cs->cx <= 0) cs->cx = 1;
|
|
|
|
if (cs->cy <= 0) cs->cy = 1;
|
2000-08-06 05:35:24 +02:00
|
|
|
|
2000-06-25 14:53:27 +02:00
|
|
|
|
1998-12-26 13:00:43 +01:00
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window =
|
2000-03-25 15:05:06 +01:00
|
|
|
TSXCreateWindow( display, X11DRV_GetXRootWindow(),
|
1999-02-04 12:11:01 +01:00
|
|
|
cs->x, cs->y, cs->cx, cs->cy,
|
|
|
|
0, CopyFromParent,
|
1998-12-26 13:00:43 +01:00
|
|
|
InputOutput, CopyFromParent,
|
|
|
|
CWEventMask | CWOverrideRedirect |
|
|
|
|
CWColormap | CWCursor | CWSaveUnder |
|
1999-03-28 11:37:57 +02:00
|
|
|
CWBackingStore | CWBitGravity,
|
|
|
|
&win_attr );
|
1998-12-26 13:00:43 +01:00
|
|
|
|
1999-03-28 11:37:57 +02:00
|
|
|
if(!(wGroupLeader = X11DRV_WND_GetXWindow(wndPtr)))
|
1998-12-07 10:13:40 +01:00
|
|
|
return FALSE;
|
|
|
|
|
1999-12-12 00:54:59 +01:00
|
|
|
/* If we are the systray, we need to be managed to be noticed by KWM */
|
|
|
|
|
|
|
|
if (wndPtr->dwExStyle & WS_EX_TRAYWINDOW)
|
|
|
|
X11DRV_WND_DockWindow(wndPtr);
|
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
if (wndPtr->flags & WIN_MANAGED)
|
|
|
|
{
|
|
|
|
XClassHint *class_hints = TSXAllocClassHint();
|
1999-06-18 19:03:13 +02:00
|
|
|
XSizeHints* size_hints = TSXAllocSizeHints();
|
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
if (class_hints)
|
|
|
|
{
|
|
|
|
class_hints->res_name = "wineManaged";
|
|
|
|
class_hints->res_class = "Wine";
|
|
|
|
TSXSetClassHint( display, ((X11DRV_WND_DATA *) wndPtr->pDriverData)->window, class_hints );
|
|
|
|
TSXFree (class_hints);
|
|
|
|
}
|
1998-12-15 18:33:04 +01:00
|
|
|
|
1999-06-18 19:03:13 +02:00
|
|
|
if (size_hints)
|
1999-04-01 14:03:52 +02:00
|
|
|
{
|
1999-06-18 19:03:13 +02:00
|
|
|
size_hints->win_gravity = StaticGravity;
|
2000-08-01 02:18:56 +02:00
|
|
|
size_hints->x = cs->x;
|
|
|
|
size_hints->y = cs->y;
|
|
|
|
size_hints->flags = PWinGravity|PPosition;
|
1999-06-18 19:03:13 +02:00
|
|
|
|
1999-09-03 14:33:40 +02:00
|
|
|
if (HAS_DLGFRAME(cs->style,cs->dwExStyle))
|
1999-04-01 14:03:52 +02:00
|
|
|
{
|
|
|
|
size_hints->min_width = size_hints->max_width = cs->cx;
|
|
|
|
size_hints->min_height = size_hints->max_height = cs->cy;
|
1999-06-18 19:03:13 +02:00
|
|
|
size_hints->flags |= PMinSize | PMaxSize;
|
1999-04-01 14:03:52 +02:00
|
|
|
}
|
1999-06-18 19:03:13 +02:00
|
|
|
|
|
|
|
TSXSetWMSizeHints( display, X11DRV_WND_GetXWindow(wndPtr),
|
|
|
|
size_hints, XA_WM_NORMAL_HINTS );
|
|
|
|
TSXFree(size_hints);
|
1999-04-01 14:03:52 +02:00
|
|
|
}
|
1998-12-15 18:33:04 +01:00
|
|
|
}
|
1998-12-07 10:13:40 +01:00
|
|
|
|
|
|
|
if (cs->hwndParent) /* Get window owner */
|
1999-03-28 11:37:57 +02:00
|
|
|
{
|
|
|
|
Window w;
|
1999-03-14 18:25:32 +01:00
|
|
|
WND *tmpWnd = WIN_FindWndPtr(cs->hwndParent);
|
1999-03-28 11:37:57 +02:00
|
|
|
|
|
|
|
w = X11DRV_WND_FindXWindow( tmpWnd );
|
|
|
|
if (w != None)
|
|
|
|
{
|
|
|
|
TSXSetTransientForHint( display, X11DRV_WND_GetXWindow(wndPtr), w );
|
|
|
|
wGroupLeader = w;
|
|
|
|
}
|
1999-03-14 18:25:32 +01:00
|
|
|
WIN_ReleaseWndPtr(tmpWnd);
|
1999-03-28 11:37:57 +02:00
|
|
|
}
|
|
|
|
|
2000-06-02 22:36:29 +02:00
|
|
|
if ((wm_hints = TSXAllocWMHints()))
|
1999-03-28 11:37:57 +02:00
|
|
|
{
|
|
|
|
wm_hints->flags = InputHint | StateHint | WindowGroupHint;
|
|
|
|
wm_hints->input = True;
|
1999-04-01 14:03:52 +02:00
|
|
|
|
|
|
|
if( wndPtr->flags & WIN_MANAGED )
|
|
|
|
{
|
2000-05-23 06:12:23 +02:00
|
|
|
X11DRV_WND_IconChanged(wndPtr);
|
|
|
|
X11DRV_WND_SetIconHints(wndPtr, wm_hints);
|
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
wm_hints->initial_state = (wndPtr->dwStyle & WS_MINIMIZE)
|
|
|
|
? IconicState : NormalState;
|
|
|
|
}
|
1999-03-28 11:37:57 +02:00
|
|
|
else
|
1999-04-01 14:03:52 +02:00
|
|
|
wm_hints->initial_state = NormalState;
|
1999-03-28 11:37:57 +02:00
|
|
|
wm_hints->window_group = wGroupLeader;
|
|
|
|
|
|
|
|
TSXSetWMHints( display, X11DRV_WND_GetXWindow(wndPtr), wm_hints );
|
|
|
|
TSXFree(wm_hints);
|
|
|
|
}
|
1998-12-07 10:13:40 +01:00
|
|
|
X11DRV_WND_RegisterWindow( wndPtr );
|
1999-03-28 11:37:57 +02:00
|
|
|
}
|
1998-12-07 10:13:40 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_DestroyWindow
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL X11DRV_WND_DestroyWindow(WND *wndPtr)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1999-04-01 14:03:52 +02:00
|
|
|
Window w;
|
|
|
|
if ((w = X11DRV_WND_GetXWindow(wndPtr)))
|
|
|
|
{
|
1998-12-07 10:13:40 +01:00
|
|
|
XEvent xe;
|
1999-04-01 14:03:52 +02:00
|
|
|
TSXDeleteContext( display, w, winContext );
|
|
|
|
TSXDestroyWindow( display, w );
|
|
|
|
while( TSXCheckWindowEvent(display, w, NoEventMask, &xe) );
|
|
|
|
|
1999-02-04 12:11:01 +01:00
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window = None;
|
1999-04-01 14:03:52 +02:00
|
|
|
if( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap )
|
|
|
|
{
|
|
|
|
DeleteObject( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap );
|
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconBitmap = 0;
|
|
|
|
}
|
2000-05-23 06:12:23 +02:00
|
|
|
if( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask )
|
|
|
|
{
|
|
|
|
DeleteObject( ((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask);
|
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->hWMIconMask= 0;
|
|
|
|
}
|
1999-04-01 14:03:52 +02:00
|
|
|
}
|
1998-12-07 10:13:40 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* X11DRV_WND_SetParent
|
|
|
|
*/
|
|
|
|
WND *X11DRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
|
|
|
|
{
|
1999-03-14 18:25:32 +01:00
|
|
|
WND *pDesktop = WIN_GetDesktop();
|
|
|
|
|
|
|
|
if( wndPtr && pWndParent && (wndPtr != pDesktop) )
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
|
|
|
WND* pWndPrev = wndPtr->parent;
|
|
|
|
|
|
|
|
if( pWndParent != pWndPrev )
|
|
|
|
{
|
1998-12-26 13:00:43 +01:00
|
|
|
if ( X11DRV_WND_GetXWindow(wndPtr) )
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
|
|
|
/* Toplevel window needs to be reparented. Used by Tk 8.0 */
|
|
|
|
|
1998-12-26 13:00:43 +01:00
|
|
|
TSXDestroyWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
|
|
|
|
((X11DRV_WND_DATA *) wndPtr->pDriverData)->window = None;
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
WIN_UnlinkWindow(wndPtr->hwndSelf);
|
|
|
|
wndPtr->parent = pWndParent;
|
|
|
|
|
1999-01-31 11:01:41 +01:00
|
|
|
/* Create an X counterpart for reparented top-level windows
|
1998-12-07 10:13:40 +01:00
|
|
|
* when not in the desktop mode. */
|
1999-01-31 11:01:41 +01:00
|
|
|
|
1999-03-14 18:25:32 +01:00
|
|
|
if( pWndParent == pDesktop )
|
1999-01-31 11:01:41 +01:00
|
|
|
{
|
2000-03-25 15:05:06 +01:00
|
|
|
if( X11DRV_GetXRootWindow() == DefaultRootWindow(display) )
|
1999-01-31 11:01:41 +01:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
CREATESTRUCTA cs;
|
1999-01-31 11:01:41 +01:00
|
|
|
cs.lpCreateParams = NULL;
|
2000-01-29 22:12:58 +01:00
|
|
|
cs.hInstance = 0; /* not used in following call */
|
1999-01-31 11:01:41 +01:00
|
|
|
cs.hMenu = 0; /* not used in following call */
|
|
|
|
cs.hwndParent = pWndParent->hwndSelf;
|
|
|
|
cs.cy = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
|
1999-03-14 14:41:07 +01:00
|
|
|
if (!cs.cy)
|
|
|
|
cs.cy = 1;
|
1999-01-31 11:01:41 +01:00
|
|
|
cs.cx = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
|
1999-03-14 14:41:07 +01:00
|
|
|
if (!cs.cx)
|
|
|
|
cs.cx = 1;
|
1999-01-31 11:01:41 +01:00
|
|
|
cs.y = wndPtr->rectWindow.top;
|
|
|
|
cs.x = wndPtr->rectWindow.left;
|
|
|
|
cs.style = wndPtr->dwStyle;
|
|
|
|
cs.lpszName = 0; /* not used in following call */
|
|
|
|
cs.lpszClass = 0; /*not used in following call */
|
|
|
|
cs.dwExStyle = wndPtr->dwExStyle;
|
|
|
|
X11DRV_WND_CreateWindow(wndPtr, wndPtr->class,
|
|
|
|
&cs, FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* a child window */
|
|
|
|
{
|
|
|
|
if( !( wndPtr->dwStyle & WS_CHILD ) )
|
|
|
|
{
|
|
|
|
if( wndPtr->wIDmenu != 0)
|
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
DestroyMenu( (HMENU) wndPtr->wIDmenu );
|
1999-01-31 11:01:41 +01:00
|
|
|
wndPtr->wIDmenu = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-01-30 16:50:58 +01:00
|
|
|
WIN_LinkWindow(wndPtr->hwndSelf, HWND_TOP);
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
1999-03-14 18:25:32 +01:00
|
|
|
WIN_ReleaseDesktop();
|
1998-12-07 10:13:40 +01:00
|
|
|
return pWndPrev;
|
|
|
|
} /* failure */
|
1999-03-14 18:25:32 +01:00
|
|
|
WIN_ReleaseDesktop();
|
1998-12-07 10:13:40 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_ForceWindowRaise
|
|
|
|
*
|
|
|
|
* Raise a window on top of the X stacking order, while preserving
|
|
|
|
* the correct Windows Z order.
|
|
|
|
*/
|
1999-02-04 12:11:01 +01:00
|
|
|
void X11DRV_WND_ForceWindowRaise(WND *wndPtr)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
|
|
|
XWindowChanges winChanges;
|
1999-03-14 18:25:32 +01:00
|
|
|
WND *wndPrev,*pDesktop = WIN_GetDesktop();
|
2000-08-06 05:35:24 +02:00
|
|
|
|
|
|
|
if (X11DRV_WND_IsZeroSizeWnd(wndPtr))
|
|
|
|
{
|
|
|
|
WIN_ReleaseDesktop();
|
|
|
|
return;
|
|
|
|
}
|
1998-12-07 10:13:40 +01:00
|
|
|
|
1999-02-04 12:11:01 +01:00
|
|
|
if( !wndPtr || !X11DRV_WND_GetXWindow(wndPtr) || (wndPtr->flags & WIN_MANAGED) )
|
1999-03-28 14:42:52 +02:00
|
|
|
{
|
|
|
|
WIN_ReleaseDesktop();
|
1998-12-07 10:13:40 +01:00
|
|
|
return;
|
1999-03-28 14:42:52 +02:00
|
|
|
}
|
1998-12-07 10:13:40 +01:00
|
|
|
|
1999-02-04 12:11:01 +01:00
|
|
|
/* Raise all windows up to wndPtr according to their Z order.
|
1998-12-07 10:13:40 +01:00
|
|
|
* (it would be easier with sibling-related Below but it doesn't
|
|
|
|
* work very well with SGI mwm for instance)
|
|
|
|
*/
|
|
|
|
winChanges.stack_mode = Above;
|
1999-02-04 12:11:01 +01:00
|
|
|
while (wndPtr)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
2000-08-06 05:35:24 +02:00
|
|
|
if ( !X11DRV_WND_IsZeroSizeWnd(wndPtr) && X11DRV_WND_GetXWindow(wndPtr) )
|
|
|
|
TSXReconfigureWMWindow( display, X11DRV_WND_GetXWindow(wndPtr), 0,
|
1998-12-26 13:00:43 +01:00
|
|
|
CWStackMode, &winChanges );
|
2000-08-06 05:35:24 +02:00
|
|
|
|
1999-03-14 18:25:32 +01:00
|
|
|
wndPrev = pDesktop->child;
|
1999-02-04 12:11:01 +01:00
|
|
|
if (wndPrev == wndPtr) break;
|
|
|
|
while (wndPrev && (wndPrev->next != wndPtr)) wndPrev = wndPrev->next;
|
2000-08-06 05:35:24 +02:00
|
|
|
|
1999-02-04 12:11:01 +01:00
|
|
|
wndPtr = wndPrev;
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
1999-03-14 18:25:32 +01:00
|
|
|
WIN_ReleaseDesktop();
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_FindDesktopXWindow [Internal]
|
|
|
|
*
|
|
|
|
* Find the actual X window which needs be restacked.
|
2000-02-20 20:17:15 +01:00
|
|
|
* Used by X11DRV_WND_SetWindowPos().
|
1998-12-07 10:13:40 +01:00
|
|
|
*/
|
|
|
|
static Window X11DRV_WND_FindDesktopXWindow( WND *wndPtr )
|
|
|
|
{
|
|
|
|
if (!(wndPtr->flags & WIN_MANAGED))
|
1998-12-26 13:00:43 +01:00
|
|
|
return X11DRV_WND_GetXWindow(wndPtr);
|
1998-12-07 10:13:40 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Window window, root, parent, *children;
|
|
|
|
int nchildren;
|
1998-12-26 13:00:43 +01:00
|
|
|
window = X11DRV_WND_GetXWindow(wndPtr);
|
1998-12-07 10:13:40 +01:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
TSXQueryTree( display, window, &root, &parent,
|
|
|
|
&children, &nchildren );
|
|
|
|
TSXFree( children );
|
|
|
|
if (parent == root)
|
|
|
|
return window;
|
|
|
|
window = parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* WINPOS_SetXWindowPos
|
|
|
|
*
|
|
|
|
* SetWindowPos() for an X window. Used by the real SetWindowPos().
|
|
|
|
*/
|
1999-03-28 11:37:57 +02:00
|
|
|
void X11DRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS *winpos, BOOL bChangePos)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1999-03-28 11:37:57 +02:00
|
|
|
XWindowChanges winChanges;
|
|
|
|
int changeMask = 0;
|
2000-08-06 05:35:24 +02:00
|
|
|
BOOL isZeroSizeWnd = FALSE;
|
|
|
|
BOOL forceMapWindow = FALSE;
|
1999-03-28 11:37:57 +02:00
|
|
|
WND *winposPtr = WIN_FindWndPtr( winpos->hwnd );
|
1999-06-18 19:03:13 +02:00
|
|
|
if ( !winposPtr ) return;
|
1999-02-04 12:11:01 +01:00
|
|
|
|
2000-08-06 05:35:24 +02:00
|
|
|
/* find out if after this function we will end out with a zero-size window */
|
|
|
|
if (X11DRV_WND_IsZeroSizeWnd(winposPtr))
|
|
|
|
{
|
|
|
|
/* if current size is 0, and no resizing */
|
|
|
|
if (winpos->flags & SWP_NOSIZE)
|
|
|
|
isZeroSizeWnd = TRUE;
|
|
|
|
else if ((winpos->cx > 0) && (winpos->cy > 0))
|
|
|
|
{
|
|
|
|
/* if this function is setting a new size > 0 for the window, we
|
|
|
|
should map the window if WS_VISIBLE is set */
|
|
|
|
if ((winposPtr->dwStyle & WS_VISIBLE) && !(winpos->flags & SWP_HIDEWINDOW))
|
|
|
|
forceMapWindow = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* if resizing to 0 */
|
|
|
|
if ( !(winpos->flags & SWP_NOSIZE) && ((winpos->cx <= 0) || (winpos->cy <= 0)) )
|
|
|
|
isZeroSizeWnd = TRUE;
|
|
|
|
|
2000-02-20 20:17:15 +01:00
|
|
|
if(!wndPtr->hwndSelf) wndPtr = NULL; /* FIXME: WND destroyed, shouldn't happen!!! */
|
1998-12-07 10:13:40 +01:00
|
|
|
|
1999-03-28 11:37:57 +02:00
|
|
|
if (!(winpos->flags & SWP_SHOWWINDOW) && (winpos->flags & SWP_HIDEWINDOW))
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1998-12-26 13:00:43 +01:00
|
|
|
if(X11DRV_WND_GetXWindow(wndPtr))
|
|
|
|
TSXUnmapWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
|
1999-03-28 11:37:57 +02:00
|
|
|
if(bChangePos)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1999-04-01 14:03:52 +02:00
|
|
|
if ( !(winpos->flags & SWP_NOSIZE))
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1999-03-28 11:37:57 +02:00
|
|
|
winChanges.width = (winpos->cx > 0 ) ? winpos->cx : 1;
|
|
|
|
winChanges.height = (winpos->cy > 0 ) ? winpos->cy : 1;
|
1998-12-07 10:13:40 +01:00
|
|
|
changeMask |= CWWidth | CWHeight;
|
|
|
|
|
|
|
|
/* Tweak dialog window size hints */
|
|
|
|
|
|
|
|
if ((winposPtr->flags & WIN_MANAGED) &&
|
1999-09-03 14:33:40 +02:00
|
|
|
HAS_DLGFRAME(winposPtr->dwStyle,winposPtr->dwExStyle))
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
|
|
|
XSizeHints *size_hints = TSXAllocSizeHints();
|
|
|
|
|
|
|
|
if (size_hints)
|
|
|
|
{
|
|
|
|
long supplied_return;
|
|
|
|
|
1998-12-26 13:00:43 +01:00
|
|
|
TSXGetWMSizeHints( display, X11DRV_WND_GetXWindow(winposPtr), size_hints,
|
1998-12-07 10:13:40 +01:00
|
|
|
&supplied_return, XA_WM_NORMAL_HINTS);
|
|
|
|
size_hints->min_width = size_hints->max_width = winpos->cx;
|
|
|
|
size_hints->min_height = size_hints->max_height = winpos->cy;
|
1998-12-26 13:00:43 +01:00
|
|
|
TSXSetWMSizeHints( display, X11DRV_WND_GetXWindow(winposPtr), size_hints,
|
1998-12-07 10:13:40 +01:00
|
|
|
XA_WM_NORMAL_HINTS );
|
|
|
|
TSXFree(size_hints);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-04-01 14:03:52 +02:00
|
|
|
if (!(winpos->flags & SWP_NOMOVE))
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
|
|
|
winChanges.x = winpos->x;
|
|
|
|
winChanges.y = winpos->y;
|
|
|
|
changeMask |= CWX | CWY;
|
|
|
|
}
|
2000-08-06 05:35:24 +02:00
|
|
|
if (!(winpos->flags & SWP_NOZORDER) && !isZeroSizeWnd)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
|
|
|
winChanges.stack_mode = Below;
|
|
|
|
changeMask |= CWStackMode;
|
|
|
|
|
|
|
|
if (winpos->hwndInsertAfter == HWND_TOP) winChanges.stack_mode = Above;
|
|
|
|
else if (winpos->hwndInsertAfter != HWND_BOTTOM)
|
|
|
|
{
|
|
|
|
WND* insertPtr = WIN_FindWndPtr( winpos->hwndInsertAfter );
|
|
|
|
Window stack[2];
|
2000-08-06 05:35:24 +02:00
|
|
|
|
2000-08-11 02:40:38 +02:00
|
|
|
/* If the window where we should do the insert is zero-sized (not mapped)
|
|
|
|
don't used this window since it will possibly crash the X server,
|
|
|
|
use the "non zero-sized" window above */
|
|
|
|
if (X11DRV_WND_IsZeroSizeWnd(insertPtr))
|
|
|
|
{
|
|
|
|
/* find the window on top of the zero sized window */
|
|
|
|
WND *pDesktop = WIN_GetDesktop();
|
|
|
|
WND *wndPrev = pDesktop->child;
|
|
|
|
WND *wndZeroSized = insertPtr;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
if (wndPrev == wndZeroSized)
|
|
|
|
break; /* zero-sized window is on top */
|
|
|
|
|
|
|
|
while (wndPrev && (wndPrev->next != wndZeroSized))
|
|
|
|
wndPrev = wndPrev->next;
|
|
|
|
|
|
|
|
/* check if the window found is not zero-sized */
|
|
|
|
if (X11DRV_WND_IsZeroSizeWnd(wndPrev))
|
|
|
|
{
|
|
|
|
wndZeroSized = wndPrev; /* restart the search */
|
|
|
|
wndPrev = pDesktop->child;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break; /* "above" window is found */
|
|
|
|
}
|
|
|
|
WIN_ReleaseDesktop();
|
|
|
|
|
|
|
|
if (wndPrev == wndZeroSized)
|
|
|
|
{
|
|
|
|
/* the zero-sized window is on top */
|
|
|
|
/* so set the window on top */
|
|
|
|
winChanges.stack_mode = Above;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stack[0] = X11DRV_WND_FindDesktopXWindow( wndPrev );
|
|
|
|
stack[1] = X11DRV_WND_FindDesktopXWindow( winposPtr );
|
|
|
|
|
|
|
|
TSXRestackWindows(display, stack, 2);
|
|
|
|
changeMask &= ~CWStackMode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* Normal behavior, windows are not zero-sized */
|
2000-08-06 05:35:24 +02:00
|
|
|
{
|
2000-08-11 02:40:38 +02:00
|
|
|
stack[0] = X11DRV_WND_FindDesktopXWindow( insertPtr );
|
|
|
|
stack[1] = X11DRV_WND_FindDesktopXWindow( winposPtr );
|
|
|
|
|
2000-08-06 05:35:24 +02:00
|
|
|
TSXRestackWindows(display, stack, 2);
|
|
|
|
changeMask &= ~CWStackMode;
|
|
|
|
}
|
2000-08-11 02:40:38 +02:00
|
|
|
|
2000-08-06 05:35:24 +02:00
|
|
|
WIN_ReleaseWndPtr(insertPtr);
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
}
|
1999-06-26 13:45:36 +02:00
|
|
|
if (changeMask && X11DRV_WND_GetXWindow(winposPtr))
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1999-04-01 14:03:52 +02:00
|
|
|
TSXReconfigureWMWindow( display, X11DRV_WND_GetXWindow(winposPtr), 0, changeMask, &winChanges );
|
|
|
|
if( winposPtr->class->style & (CS_VREDRAW | CS_HREDRAW) )
|
|
|
|
X11DRV_WND_SetHostAttr( winposPtr, HAK_BITGRAVITY, BGForget );
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
}
|
2000-08-06 05:35:24 +02:00
|
|
|
|
|
|
|
/* don't map the window if it's a zero size window */
|
|
|
|
if ( ((winpos->flags & SWP_SHOWWINDOW) && !isZeroSizeWnd) || forceMapWindow )
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
1999-04-01 14:03:52 +02:00
|
|
|
if(X11DRV_WND_GetXWindow(wndPtr))
|
|
|
|
TSXMapWindow( display, X11DRV_WND_GetXWindow(wndPtr) );
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
1999-03-28 11:37:57 +02:00
|
|
|
WIN_ReleaseWndPtr(winposPtr);
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* X11DRV_WND_SetText
|
|
|
|
*/
|
2000-07-10 14:09:31 +02:00
|
|
|
void X11DRV_WND_SetText(WND *wndPtr, LPCWSTR text)
|
1998-12-07 10:13:40 +01:00
|
|
|
{
|
2000-07-10 14:09:31 +02:00
|
|
|
UINT count;
|
|
|
|
char *buffer;
|
|
|
|
static UINT text_cp = (UINT)-1;
|
|
|
|
Window win;
|
|
|
|
|
|
|
|
if (!(win = X11DRV_WND_GetXWindow(wndPtr))) return;
|
|
|
|
|
|
|
|
if(text_cp == (UINT)-1)
|
|
|
|
{
|
|
|
|
text_cp = PROFILE_GetWineIniInt("x11drv", "TextCP", CP_ACP);
|
|
|
|
TRACE("text_cp = %u\n", text_cp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* allocate new buffer for window text */
|
|
|
|
count = WideCharToMultiByte(text_cp, 0, text, -1, NULL, 0, NULL, NULL);
|
|
|
|
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, count * sizeof(WCHAR) )))
|
|
|
|
{
|
|
|
|
ERR("Not enough memory for window text\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
WideCharToMultiByte(text_cp, 0, text, -1, buffer, count, NULL, NULL);
|
1998-12-07 10:13:40 +01:00
|
|
|
|
2000-07-10 14:09:31 +02:00
|
|
|
TSXStoreName( display, win, buffer );
|
|
|
|
TSXSetIconName( display, win, buffer );
|
|
|
|
HeapFree( GetProcessHeap(), 0, buffer );
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* X11DRV_WND_SetFocus
|
|
|
|
*
|
|
|
|
* Set the X focus.
|
|
|
|
* Explicit colormap management seems to work only with OLVWM.
|
|
|
|
*/
|
|
|
|
void X11DRV_WND_SetFocus(WND *wndPtr)
|
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
HWND hwnd = wndPtr->hwndSelf;
|
1998-12-07 10:13:40 +01:00
|
|
|
XWindowAttributes win_attr;
|
1998-12-27 16:26:28 +01:00
|
|
|
Window win;
|
2000-04-30 14:35:32 +02:00
|
|
|
WND *w = wndPtr;
|
2000-08-06 05:35:24 +02:00
|
|
|
|
|
|
|
if (X11DRV_WND_IsZeroSizeWnd(wndPtr))
|
|
|
|
return;
|
1998-12-07 10:13:40 +01:00
|
|
|
|
|
|
|
/* Only mess with the X focus if there's */
|
1999-11-04 03:10:08 +01:00
|
|
|
/* no desktop window and if the window is not managed by the WM. */
|
2000-04-30 14:35:32 +02:00
|
|
|
if ((X11DRV_GetXRootWindow() != DefaultRootWindow(display))) return;
|
|
|
|
while (w && !((X11DRV_WND_DATA *) w->pDriverData)->window)
|
|
|
|
w = w->parent;
|
|
|
|
if (!w) w = wndPtr;
|
|
|
|
if (w->flags & WIN_MANAGED) return;
|
|
|
|
|
1998-12-07 10:13:40 +01:00
|
|
|
if (!hwnd) /* If setting the focus to 0, uninstall the colormap */
|
|
|
|
{
|
1999-04-01 10:16:08 +02:00
|
|
|
if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
|
|
|
|
TSXUninstallColormap( display, X11DRV_PALETTE_PaletteXColormap );
|
1998-12-07 10:13:40 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set X focus and install colormap */
|
|
|
|
|
1998-12-27 16:26:28 +01:00
|
|
|
if (!(win = X11DRV_WND_FindXWindow(wndPtr))) return;
|
|
|
|
if (!TSXGetWindowAttributes( display, win, &win_attr ) ||
|
1998-12-07 10:13:40 +01:00
|
|
|
(win_attr.map_state != IsViewable))
|
|
|
|
return; /* If window is not viewable, don't change anything */
|
|
|
|
|
1998-12-27 16:26:28 +01:00
|
|
|
TSXSetInputFocus( display, win, RevertToParent, CurrentTime );
|
1999-04-01 10:16:08 +02:00
|
|
|
if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
|
|
|
|
TSXInstallColormap( display, X11DRV_PALETTE_PaletteXColormap );
|
1998-12-07 10:13:40 +01:00
|
|
|
|
1999-07-10 12:24:31 +02:00
|
|
|
EVENT_Synchronize();
|
1998-12-07 10:13:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* X11DRV_WND_PreSizeMove
|
|
|
|
*/
|
|
|
|
void X11DRV_WND_PreSizeMove(WND *wndPtr)
|
|
|
|
{
|
2000-03-25 15:05:06 +01:00
|
|
|
if (!(wndPtr->dwStyle & WS_CHILD) && (X11DRV_GetXRootWindow() == DefaultRootWindow(display)))
|
1998-12-07 10:13:40 +01:00
|
|
|
TSXGrabServer( display );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* X11DRV_WND_PostSizeMove
|
|
|
|
*/
|
|
|
|
void X11DRV_WND_PostSizeMove(WND *wndPtr)
|
|
|
|
{
|
1999-02-04 12:11:01 +01:00
|
|
|
if (!(wndPtr->dwStyle & WS_CHILD) &&
|
1999-02-14 14:32:13 +01:00
|
|
|
(X11DRV_GetXRootWindow() == DefaultRootWindow(display)))
|
1998-12-07 10:13:40 +01:00
|
|
|
TSXUngrabServer( display );
|
|
|
|
}
|
|
|
|
|
1998-12-26 13:00:43 +01:00
|
|
|
/*****************************************************************
|
1999-03-28 11:37:57 +02:00
|
|
|
* X11DRV_WND_SurfaceCopy
|
|
|
|
*
|
|
|
|
* Copies rect to (rect.left + dx, rect.top + dy).
|
1998-12-26 13:00:43 +01:00
|
|
|
*/
|
2000-08-04 06:18:04 +02:00
|
|
|
void X11DRV_WND_SurfaceCopy(WND* wndPtr, HDC hdc, INT dx, INT dy,
|
1999-03-28 11:37:57 +02:00
|
|
|
const RECT *rect, BOOL bUpdate)
|
1998-12-26 13:00:43 +01:00
|
|
|
{
|
2000-08-04 06:18:04 +02:00
|
|
|
X11DRV_PDEVICE *physDev;
|
1999-03-28 11:37:57 +02:00
|
|
|
POINT dst, src;
|
2000-08-04 06:18:04 +02:00
|
|
|
DC *dcPtr = DC_GetDCPtr( hdc );
|
|
|
|
|
|
|
|
if (!dcPtr) return;
|
|
|
|
physDev = (X11DRV_PDEVICE *)dcPtr->physDev;
|
1999-03-28 11:37:57 +02:00
|
|
|
dst.x = (src.x = dcPtr->w.DCOrgX + rect->left) + dx;
|
|
|
|
dst.y = (src.y = dcPtr->w.DCOrgY + rect->top) + dy;
|
1998-12-26 13:00:43 +01:00
|
|
|
|
1999-03-28 11:37:57 +02:00
|
|
|
if (bUpdate) /* handles non-Wine windows hanging over the copied area */
|
|
|
|
TSXSetGraphicsExposures( display, physDev->gc, True );
|
|
|
|
TSXSetFunction( display, physDev->gc, GXcopy );
|
|
|
|
TSXCopyArea( display, physDev->drawable, physDev->drawable,
|
|
|
|
physDev->gc, src.x, src.y,
|
|
|
|
rect->right - rect->left,
|
|
|
|
rect->bottom - rect->top,
|
|
|
|
dst.x, dst.y );
|
|
|
|
if (bUpdate)
|
|
|
|
TSXSetGraphicsExposures( display, physDev->gc, False );
|
|
|
|
|
|
|
|
if (bUpdate) /* Make sure exposure events have been processed */
|
1999-07-10 12:24:31 +02:00
|
|
|
EVENT_Synchronize();
|
2000-08-04 06:18:04 +02:00
|
|
|
GDI_HEAP_UNLOCK( hdc );
|
1998-12-26 13:00:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_SetDrawable
|
|
|
|
*
|
|
|
|
* Set the drawable, origin and dimensions for the DC associated to
|
|
|
|
* a given window.
|
|
|
|
*/
|
2000-08-04 06:18:04 +02:00
|
|
|
void X11DRV_WND_SetDrawable(WND *wndPtr, HDC hdc, WORD flags, BOOL bSetClipOrigin)
|
1998-12-26 13:00:43 +01:00
|
|
|
{
|
2000-08-04 06:18:04 +02:00
|
|
|
DC *dc = DC_GetDCPtr( hdc );
|
|
|
|
X11DRV_PDEVICE *physDev;
|
1999-12-27 06:26:00 +01:00
|
|
|
INT dcOrgXCopy = 0, dcOrgYCopy = 0;
|
1999-08-07 16:10:55 +02:00
|
|
|
BOOL offsetClipRgn = FALSE;
|
1998-12-26 13:00:43 +01:00
|
|
|
|
2000-08-04 06:18:04 +02:00
|
|
|
if (!dc) return;
|
|
|
|
physDev = (X11DRV_PDEVICE *)dc->physDev;
|
1998-12-26 13:00:43 +01:00
|
|
|
if (!wndPtr) /* Get a DC for the whole screen */
|
|
|
|
{
|
|
|
|
dc->w.DCOrgX = 0;
|
|
|
|
dc->w.DCOrgY = 0;
|
2000-03-25 15:05:06 +01:00
|
|
|
physDev->drawable = X11DRV_GetXRootWindow();
|
1998-12-26 13:00:43 +01:00
|
|
|
TSXSetSubwindowMode( display, physDev->gc, IncludeInferiors );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-08-07 16:10:55 +02:00
|
|
|
/*
|
|
|
|
* This function change the coordinate system (DCOrgX,DCOrgY)
|
|
|
|
* values. When it moves the origin, other data like the current clipping
|
|
|
|
* region will not be moved to that new origin. In the case of DCs that are class
|
|
|
|
* or window DCs that clipping region might be a valid value from a previous use
|
|
|
|
* of the DC and changing the origin of the DC without moving the clip region
|
|
|
|
* results in a clip region that is not placed properly in the DC.
|
|
|
|
* This code will save the dc origin, let the SetDrawable
|
|
|
|
* modify the origin and reset the clipping. When the clipping is set,
|
|
|
|
* it is moved according to the new DC origin.
|
|
|
|
*/
|
|
|
|
if ( (wndPtr->class->style & (CS_OWNDC | CS_CLASSDC)) && (dc->w.hClipRgn > 0))
|
|
|
|
{
|
|
|
|
dcOrgXCopy = dc->w.DCOrgX;
|
|
|
|
dcOrgYCopy = dc->w.DCOrgY;
|
|
|
|
offsetClipRgn = TRUE;
|
|
|
|
}
|
|
|
|
|
1998-12-26 13:00:43 +01:00
|
|
|
if (flags & DCX_WINDOW)
|
|
|
|
{
|
|
|
|
dc->w.DCOrgX = wndPtr->rectWindow.left;
|
|
|
|
dc->w.DCOrgY = wndPtr->rectWindow.top;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dc->w.DCOrgX = wndPtr->rectClient.left;
|
|
|
|
dc->w.DCOrgY = wndPtr->rectClient.top;
|
|
|
|
}
|
|
|
|
while (!X11DRV_WND_GetXWindow(wndPtr))
|
|
|
|
{
|
|
|
|
wndPtr = wndPtr->parent;
|
|
|
|
dc->w.DCOrgX += wndPtr->rectClient.left;
|
|
|
|
dc->w.DCOrgY += wndPtr->rectClient.top;
|
|
|
|
}
|
|
|
|
dc->w.DCOrgX -= wndPtr->rectWindow.left;
|
|
|
|
dc->w.DCOrgY -= wndPtr->rectWindow.top;
|
1999-08-07 16:10:55 +02:00
|
|
|
|
|
|
|
/* reset the clip region, according to the new origin */
|
|
|
|
if ( offsetClipRgn )
|
|
|
|
{
|
|
|
|
OffsetRgn(dc->w.hClipRgn, dc->w.DCOrgX - dcOrgXCopy,dc->w.DCOrgY - dcOrgYCopy);
|
|
|
|
}
|
|
|
|
|
1998-12-26 13:00:43 +01:00
|
|
|
physDev->drawable = X11DRV_WND_GetXWindow(wndPtr);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* This is needed when we reuse a cached DC because
|
|
|
|
* SetDCState() called by ReleaseDC() screws up DC
|
|
|
|
* origins for child windows.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if( bSetClipOrigin )
|
|
|
|
TSXSetClipOrigin( display, physDev->gc, dc->w.DCOrgX, dc->w.DCOrgY );
|
|
|
|
#endif
|
|
|
|
}
|
2000-08-04 06:18:04 +02:00
|
|
|
GDI_HEAP_UNLOCK( hdc );
|
1998-12-26 13:00:43 +01:00
|
|
|
}
|
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_SetWMHint
|
|
|
|
*/
|
|
|
|
static BOOL X11DRV_SetWMHint(Display* display, WND* wndPtr, int hint, int val)
|
|
|
|
{
|
2000-06-02 22:36:29 +02:00
|
|
|
XWMHints* wm_hints = TSXGetWMHints( display, X11DRV_WND_GetXWindow(wndPtr) );
|
|
|
|
if (!wm_hints) wm_hints = TSXAllocWMHints();
|
|
|
|
if (wm_hints)
|
1999-04-01 14:03:52 +02:00
|
|
|
{
|
|
|
|
wm_hints->flags = hint;
|
|
|
|
switch( hint )
|
|
|
|
{
|
|
|
|
case InputHint:
|
|
|
|
wm_hints->input = val;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case StateHint:
|
|
|
|
wm_hints->initial_state = val;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IconPixmapHint:
|
|
|
|
wm_hints->icon_pixmap = (Pixmap)val;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IconWindowHint:
|
|
|
|
wm_hints->icon_window = (Window)val;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
TSXSetWMHints( display, X11DRV_WND_GetXWindow(wndPtr), wm_hints );
|
|
|
|
TSXFree(wm_hints);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-28 11:37:57 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_SetHostAttr
|
1999-04-01 14:03:52 +02:00
|
|
|
*
|
|
|
|
* This function returns TRUE if the attribute is supported and the
|
|
|
|
* action was successful. Otherwise it should return FALSE and Wine will try
|
|
|
|
* to get by without the functionality provided by the host window system.
|
1999-03-28 11:37:57 +02:00
|
|
|
*/
|
|
|
|
BOOL X11DRV_WND_SetHostAttr(WND* wnd, INT ha, INT value)
|
|
|
|
{
|
|
|
|
Window w;
|
|
|
|
|
|
|
|
if( (w = X11DRV_WND_GetXWindow(wnd)) )
|
|
|
|
{
|
|
|
|
XSetWindowAttributes win_attr;
|
|
|
|
|
|
|
|
switch( ha )
|
|
|
|
{
|
1999-04-01 14:03:52 +02:00
|
|
|
case HAK_ICONICSTATE: /* called when a window is minimized/restored */
|
|
|
|
|
2000-08-06 05:35:24 +02:00
|
|
|
/* don't do anything if it'a zero size window */
|
|
|
|
if (X11DRV_WND_IsZeroSizeWnd(wnd))
|
|
|
|
return TRUE;
|
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
if( (wnd->flags & WIN_MANAGED) )
|
|
|
|
{
|
|
|
|
if( value )
|
|
|
|
{
|
|
|
|
if( wnd->dwStyle & WS_VISIBLE )
|
|
|
|
{
|
|
|
|
XClientMessageEvent ev;
|
|
|
|
|
|
|
|
/* FIXME: set proper icon */
|
|
|
|
|
|
|
|
ev.type = ClientMessage;
|
|
|
|
ev.display = display;
|
|
|
|
ev.message_type = wmChangeState;
|
|
|
|
ev.format = 32;
|
|
|
|
ev.data.l[0] = IconicState;
|
|
|
|
ev.window = w;
|
|
|
|
|
|
|
|
if( TSXSendEvent (display,
|
2000-03-25 15:05:06 +01:00
|
|
|
RootWindow( display, XScreenNumberOfScreen(X11DRV_GetXScreen()) ),
|
1999-04-01 14:03:52 +02:00
|
|
|
True, (SubstructureRedirectMask | SubstructureNotifyMask), (XEvent*)&ev))
|
|
|
|
{
|
|
|
|
XEvent xe;
|
|
|
|
TSXFlush (display);
|
|
|
|
while( !TSXCheckTypedWindowEvent( display, w, UnmapNotify, &xe) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
X11DRV_SetWMHint( display, wnd, StateHint, IconicState );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( !(wnd->flags & WS_VISIBLE) )
|
|
|
|
X11DRV_SetWMHint( display, wnd, StateHint, NormalState );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
XEvent xe;
|
1999-06-05 13:49:04 +02:00
|
|
|
TSXMapWindow(display, w );
|
1999-04-01 14:03:52 +02:00
|
|
|
while( !TSXCheckTypedWindowEvent( display, w, MapNotify, &xe) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HAK_BITGRAVITY: /* called when a window is resized */
|
1999-03-28 11:37:57 +02:00
|
|
|
|
|
|
|
if( ((X11DRV_WND_DATA *) wnd->pDriverData)->bit_gravity != value )
|
|
|
|
{
|
|
|
|
win_attr.bit_gravity = value;
|
|
|
|
((X11DRV_WND_DATA *) wnd->pDriverData)->bit_gravity = value;
|
|
|
|
TSXChangeWindowAttributes( display, w, CWBitGravity, &win_attr );
|
|
|
|
}
|
1999-04-01 14:03:52 +02:00
|
|
|
return TRUE;
|
2000-05-23 06:12:23 +02:00
|
|
|
|
|
|
|
case HAK_ICONS: /* called when the icons change */
|
|
|
|
if ( (wnd->flags & WIN_MANAGED) )
|
|
|
|
X11DRV_WND_UpdateIconHints(wnd);
|
|
|
|
return TRUE;
|
1999-03-28 11:37:57 +02:00
|
|
|
|
1999-04-01 14:03:52 +02:00
|
|
|
case HAK_ACCEPTFOCUS: /* called when a window is disabled/enabled */
|
1999-03-28 11:37:57 +02:00
|
|
|
|
|
|
|
if( (wnd->flags & WIN_MANAGED) )
|
1999-04-01 14:03:52 +02:00
|
|
|
return X11DRV_SetWMHint( display, wnd, InputHint, value );
|
1999-03-28 11:37:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-12-26 13:00:43 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_IsSelfClipping
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL X11DRV_WND_IsSelfClipping(WND *wndPtr)
|
1998-12-26 13:00:43 +01:00
|
|
|
{
|
1999-04-01 10:16:08 +02:00
|
|
|
return X11DRV_WND_GetXWindow(wndPtr) != None;
|
1998-12-26 13:00:43 +01:00
|
|
|
}
|
|
|
|
|
1999-12-12 00:54:59 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_DockWindow
|
|
|
|
*
|
|
|
|
* Set the X Property of the window that tells the windowmanager we really
|
|
|
|
* want to be in the systray
|
|
|
|
*
|
|
|
|
* KDE: set "KWM_DOCKWINDOW", type "KWM_DOCKWINDOW" to 1 before a window is
|
|
|
|
* mapped.
|
|
|
|
*
|
|
|
|
* all others: to be added ;)
|
|
|
|
*/
|
|
|
|
void X11DRV_WND_DockWindow(WND *wndPtr)
|
|
|
|
{
|
|
|
|
int data = 1;
|
|
|
|
Window win = X11DRV_WND_GetXWindow(wndPtr);
|
|
|
|
if (kwmDockWindow == None)
|
|
|
|
return; /* no KDE running */
|
|
|
|
TSXChangeProperty(
|
|
|
|
display,win,kwmDockWindow,kwmDockWindow,32,PropModeReplace,(char*)&data,1
|
|
|
|
);
|
|
|
|
}
|
2000-04-25 21:55:35 +02:00
|
|
|
|
2000-07-29 01:04:54 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* X11DRV_WND_SetWindowRgn
|
|
|
|
*
|
|
|
|
* Assign specified region to window (for non-rectangular windows)
|
|
|
|
*/
|
|
|
|
void X11DRV_WND_SetWindowRgn(WND *wndPtr, HRGN hrgnWnd)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_LIBXSHAPE
|
|
|
|
Window win = X11DRV_WND_GetXWindow(wndPtr);
|
|
|
|
|
|
|
|
if (!win) return;
|
|
|
|
|
|
|
|
if (!hrgnWnd)
|
|
|
|
{
|
|
|
|
TSXShapeCombineMask( display, win, ShapeBounding, 0, 0, None, ShapeSet );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
XRectangle *aXRect;
|
|
|
|
DWORD size;
|
|
|
|
DWORD dwBufferSize = GetRegionData(hrgnWnd, 0, NULL);
|
|
|
|
PRGNDATA pRegionData = HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
|
|
|
|
if (!pRegionData) return;
|
|
|
|
|
|
|
|
GetRegionData(hrgnWnd, dwBufferSize, pRegionData);
|
|
|
|
size = pRegionData->rdh.nCount;
|
|
|
|
/* convert region's "Windows rectangles" to XRectangles */
|
|
|
|
aXRect = HeapAlloc(GetProcessHeap(), 0, size * sizeof(*aXRect) );
|
|
|
|
if (aXRect)
|
|
|
|
{
|
|
|
|
XRectangle* pCurrRect = aXRect;
|
|
|
|
RECT *pRect = (RECT*) pRegionData->Buffer;
|
|
|
|
for (; pRect < ((RECT*) pRegionData->Buffer) + size ; ++pRect, ++pCurrRect)
|
|
|
|
{
|
|
|
|
pCurrRect->x = pRect->left;
|
|
|
|
pCurrRect->y = pRect->top;
|
|
|
|
pCurrRect->height = pRect->bottom - pRect->top;
|
|
|
|
pCurrRect->width = pRect->right - pRect->left;
|
|
|
|
|
|
|
|
TRACE("Rectangle %04d of %04ld data: X=%04d, Y=%04d, Height=%04d, Width=%04d.\n",
|
|
|
|
pRect - (RECT*) pRegionData->Buffer,
|
|
|
|
size,
|
|
|
|
pCurrRect->x,
|
|
|
|
pCurrRect->y,
|
|
|
|
pCurrRect->height,
|
|
|
|
pCurrRect->width);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* shape = non-rectangular windows (X11/extensions) */
|
|
|
|
TSXShapeCombineRectangles( display, win, ShapeBounding,
|
|
|
|
0, 0, aXRect,
|
|
|
|
pCurrRect - aXRect, ShapeSet, YXBanded );
|
|
|
|
HeapFree(GetProcessHeap(), 0, aXRect );
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, pRegionData);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_LIBXSHAPE */
|
|
|
|
}
|