- implementation of SetWindowsRgn and GetWindowRgn

- X11DRV and TTYDRV updated with new API SetWindowRgn
This commit is contained in:
Francois Jacques 2000-07-28 23:04:54 +00:00 committed by Alexandre Julliard
parent 7b49914afc
commit 5b6879c5c0
18 changed files with 498 additions and 207 deletions

446
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -177,6 +177,16 @@ then
AC_MSG_WARN([Xshm extension not found!!])
)
dnl *** Check for X shape extension
AC_CHECK_HEADERS(X11/Xlib.h X11/extensions/shape.h,
[ dnl *** If X11/extensions/shape.h exists...
AC_CHECK_LIB(Xext,XShapeQueryExtension,
AC_DEFINE(HAVE_LIBXSHAPE),,
$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
],
AC_MSG_WARN([XShape extension found!!])
)
dnl *** Check for XFree86 DGA / DGA 2.0 extension
AC_CHECK_HEADERS(X11/extensions/xf86dga.h,
[ dnl *** If X11/extensions/xf86dga.h exists, check

View File

@ -13,6 +13,7 @@
#include <X11/cursorfont.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include "ts_shape.h"
#include "winbase.h"
#include "wine/winbase16.h"

View File

@ -24,6 +24,9 @@
/* Define if you have the X Shm extension */
#undef HAVE_LIBXXSHM
/* Define if you have the X Shape extension */
#undef HAVE_LIBXSHAPE
/* Define if you have the Xxf86vm library */
#undef HAVE_LIBXXF86VM

View File

@ -68,6 +68,9 @@
/* Define if you have the X Shm extension */
#undef HAVE_LIBXXSHM
/* Define if you have the X Shape extension */
#undef HAVE_LIBXSHAPE
/* Define if you have the Xxf86vm library */
#undef HAVE_LIBXXF86VM
@ -257,6 +260,9 @@
/* Define if you have the <X11/extensions/XShm.h> header file. */
#undef HAVE_X11_EXTENSIONS_XSHM_H
/* Define if you have the <X11/extensions/shape.h> header file. */
#undef HAVE_X11_EXTENSIONS_SHAPE_H
/* Define if you have the <X11/extensions/xf86dga.h> header file. */
#undef HAVE_X11_EXTENSIONS_XF86DGA_H

24
include/ts_shape.h Normal file
View File

@ -0,0 +1,24 @@
/*
* Thread safe wrappers around shape calls.
* Always include this file instead of <X11/shape.h>.
* This file was generated automatically by tools/make_X11wrappers
*
* Copyright 1998 Kristian Nielsen
*/
#ifndef __WINE_TS_SHAPE_H
#define __WINE_TS_SHAPE_H
#include "config.h"
#ifdef HAVE_LIBXSHAPE
#include <X11/IntrinsicP.h>
#include <X11/extensions/shape.h>
extern void TSXShapeCombineRectangles(Display*, Window, int, int, int, XRectangle*, int, int, int);
extern void TSXShapeCombineMask(Display*, Window, int, int, int, Pixmap, int);
#endif /* defined(HAVE_LIBXSHAPE) */
#endif /* __WINE_TS_SHAPE_H */

View File

@ -201,5 +201,6 @@ extern void TTYDRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr,
extern void TTYDRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL bSetClipOrigin);
extern BOOL TTYDRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
extern BOOL TTYDRV_WND_IsSelfClipping(struct tagWND *wndPtr);
extern void TTYDRV_WND_SetWindowRgn(struct tagWND *wndPtr, HRGN hrgnWnd);
#endif /* !defined(__WINE_TTYDRV_H) */

View File

@ -78,6 +78,7 @@ typedef struct tagWND
struct tagDCE *dce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
HGLOBAL16 hmemTaskQ; /* Task queue global memory handle */
HRGN16 hrgnUpdate; /* Update region */
HRGN hrgnWnd; /* window's region */
HWND hwndLastActive;/* Last active popup hwnd */
DWORD dwStyle; /* Window style (from CreateWindow) */
DWORD dwExStyle; /* Extended style (from CreateWindowEx) */
@ -131,6 +132,7 @@ typedef struct tagWND_DRIVER
void (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL);
BOOL (*pSetHostAttr)(WND *, INT haKey, INT value);
BOOL (*pIsSelfClipping)(WND *);
void (*pSetWindowRgn)(WND *, const HRGN);
} WND_DRIVER;
extern WND_DRIVER *WND_Driver;

View File

@ -431,6 +431,7 @@ extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD
extern BOOL X11DRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
extern BOOL X11DRV_WND_IsSelfClipping(struct tagWND *wndPtr);
extern void X11DRV_WND_DockWindow(struct tagWND *wndPtr);
extern void X11DRV_WND_SetWindowRgn(struct tagWND *wndPtr, HRGN hrgnWnd);
extern int X11DRV_EVENT_PrepareShmCompletion( Drawable dw );
extern void X11DRV_EVENT_WaitShmCompletion( int compl );

View File

@ -17,7 +17,7 @@
$X11_include_dir = "/usr/X11/include";
$outdir = "tsx11";
$wantfile = "$outdir/X11_calls";
@dolist = ("Xlib", "Xresource", "Xutil", "xpm", "XShm", "xf86dga", "xf86dga2", "xf86vmode");
@dolist = ("Xlib", "Xresource", "Xutil", "xpm", "XShm", "xf86dga", "xf86dga2", "xf86vmode", "shape");
# First read list of wanted function names.
@ -80,6 +80,14 @@ foreach $name (@dolist) {
$pre_file = "#include \"windef.h\"\n#ifdef HAVE_LIBXXF86VM\n#define XMD_H\n#include \"basetsd.h\"\n";
$post_file = "#endif /* defined(HAVE_LIBXXF86VM) */\n";
}
if($name eq "shape") {
$extensions_dir = "extensions/";
$pre_file = "#ifdef HAVE_LIBXSHAPE\n#include <X11/IntrinsicP.h>\n";
$post_file = "#endif /* defined(HAVE_LIBXSHAPE) */\n";
$inc_name = "shape";
}
print OUTH <<END;
/*

View File

@ -13,6 +13,7 @@ C_SRCS = \
ts_xlib.c \
ts_xresource.c \
ts_xutil.c \
ts_shape.c \
ts_xpm.c
all: $(MODULE).o

View File

@ -143,6 +143,8 @@ XSetWMHints
XSetWMProperties
XSetWMProtocols
XSetWMSizeHints
XShapeCombineMask
XShapeCombineRectangles
XShmAttach
XShmCreateImage
XShmCreatePixmap

39
tsx11/ts_shape.c Normal file
View File

@ -0,0 +1,39 @@
/*
* Thread safe wrappers around shape calls.
* This file was generated automatically by tools/make_X11wrappers
* DO NOT EDIT!
*/
#include "config.h"
#ifdef HAVE_LIBXSHAPE
#include <X11/IntrinsicP.h>
#include <X11/extensions/shape.h>
#include "debugtools.h"
#include "ts_shape.h"
#include "x11drv.h"
DEFAULT_DEBUG_CHANNEL(x11)
void TSXShapeCombineRectangles(Display* a0, Window a1, int a2, int a3, int a4, XRectangle* a5, int a6, int a7, int a8)
{
TRACE("Call XShapeCombineRectangles\n");
EnterCriticalSection( &X11DRV_CritSection );
XShapeCombineRectangles(a0, a1, a2, a3, a4, a5, a6, a7, a8);
LeaveCriticalSection( &X11DRV_CritSection );
TRACE("Ret XShapeCombineRectangles\n");
}
void TSXShapeCombineMask(Display* a0, Window a1, int a2, int a3, int a4, Pixmap a5, int a6)
{
TRACE("Call XShapeCombineMask\n");
EnterCriticalSection( &X11DRV_CritSection );
XShapeCombineMask(a0, a1, a2, a3, a4, a5, a6);
LeaveCriticalSection( &X11DRV_CritSection );
TRACE("Ret XShapeCombineMask\n");
}
#endif /* defined(HAVE_LIBXSHAPE) */

View File

@ -39,7 +39,8 @@ WND_DRIVER TTYDRV_WND_Driver =
TTYDRV_WND_ScrollWindow,
TTYDRV_WND_SetDrawable,
TTYDRV_WND_SetHostAttr,
TTYDRV_WND_IsSelfClipping
TTYDRV_WND_IsSelfClipping,
TTYDRV_WND_SetWindowRgn
};

View File

@ -241,3 +241,11 @@ BOOL TTYDRV_WND_IsSelfClipping(WND *wndPtr)
return FALSE;
}
/***********************************************************************
* TTYDRV_WND_SetWindowRgn
*/
void TTYDRV_WND_SetWindowRgn(struct tagWND *wndPtr, HRGN hrgnWnd)
{
}

View File

@ -6,6 +6,7 @@
*/
#include <string.h>
#include "winerror.h"
#include "windef.h"
#include "wingdi.h"
#include "winerror.h"
@ -271,38 +272,74 @@ BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect )
/***********************************************************************
* GetWindowRgn
* GetWindowRgn (USER32)
*/
BOOL WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
int WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
{
RECT rect;
int nRet = ERROR;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return (ERROR);
FIXME("GetWindowRgn: doesn't really do regions\n");
memset (&rect, 0, sizeof(rect));
GetWindowRect ( hwnd, &rect );
FIXME("Check whether a valid region here\n");
SetRectRgn ( hrgn, rect.left, rect.top, rect.right, rect.bottom );
if (wndPtr)
{
if (wndPtr->hrgnWnd) nRet = CombineRgn( hrgn, wndPtr->hrgnWnd, 0, RGN_COPY );
WIN_ReleaseWndPtr(wndPtr);
return (SIMPLEREGION);
}
return nRet;
}
/***********************************************************************
* SetWindowRgn
* SetWindowRgn (USER32)
*/
INT WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn,BOOL bRedraw)
int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
{
int ret = FALSE;
RECT tempRect;
FIXME("SetWindowRgn: stub\n");
return TRUE;
WND *wndPtr = WIN_FindWndPtr(hwnd);
if (!wndPtr) return FALSE;
/* a region exists for this window */
if (hrgn != 0 && hrgn == wndPtr->hrgnWnd)
{
/* can't replace actual region with same region
since we're now owner of that region
*/
SetLastError(ERROR_INVALID_HANDLE);
goto done;
}
if (wndPtr->hrgnWnd)
{
/* delete previous region */
DeleteObject(wndPtr->hrgnWnd);
wndPtr->hrgnWnd = 0;
}
/* we'd like to set it back to 0 */
if (hrgn == 0)
{
GetWindowRect(hwnd, &tempRect);
}
else
{
/* verify that region really exists */
if (GetRgnBox(hrgn, &tempRect) == ERROR) goto done;
}
/* valid region handle */
wndPtr->hrgnWnd = hrgn;
SetWindowPos( hwnd, NULL, tempRect.left, tempRect.top,
tempRect.right - tempRect.left, tempRect.bottom - tempRect.top,
SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOMOVE |
SWP_NOZORDER | (bRedraw ? 0 : SWP_NOREDRAW) );
wndPtr->pDriver->pSetWindowRgn(wndPtr, hrgn);
ret = TRUE;
done:
WIN_ReleaseWndPtr(wndPtr);
return ret;
}
/***********************************************************************

View File

@ -39,7 +39,8 @@ WND_DRIVER X11DRV_WND_Driver =
X11DRV_WND_SurfaceCopy,
X11DRV_WND_SetDrawable,
X11DRV_WND_SetHostAttr,
X11DRV_WND_IsSelfClipping
X11DRV_WND_IsSelfClipping,
X11DRV_WND_SetWindowRgn
};

View File

@ -12,6 +12,7 @@
#include "ts_xlib.h"
#include "ts_xutil.h"
#include "ts_shape.h"
#include <stdlib.h>
#include <string.h>
@ -1010,3 +1011,62 @@ void X11DRV_WND_DockWindow(WND *wndPtr)
);
}
/***********************************************************************
* 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 */
}