Commit 5b6879c5 authored by Francois Jacques's avatar Francois Jacques Committed by Alexandre Julliard

- implementation of SetWindowsRgn and GetWindowRgn

- X11DRV and TTYDRV updated with new API SetWindowRgn
parent 7b49914a
...@@ -177,6 +177,16 @@ then ...@@ -177,6 +177,16 @@ then
AC_MSG_WARN([Xshm extension not found!!]) 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 dnl *** Check for XFree86 DGA / DGA 2.0 extension
AC_CHECK_HEADERS(X11/extensions/xf86dga.h, AC_CHECK_HEADERS(X11/extensions/xf86dga.h,
[ dnl *** If X11/extensions/xf86dga.h exists, check [ dnl *** If X11/extensions/xf86dga.h exists, check
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#include "ts_xlib.h" #include "ts_xlib.h"
#include "ts_xutil.h" #include "ts_xutil.h"
#include "ts_shape.h"
#include "winbase.h" #include "winbase.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
/* Define if you have the X Shm extension */ /* Define if you have the X Shm extension */
#undef HAVE_LIBXXSHM #undef HAVE_LIBXXSHM
/* Define if you have the X Shape extension */
#undef HAVE_LIBXSHAPE
/* Define if you have the Xxf86vm library */ /* Define if you have the Xxf86vm library */
#undef HAVE_LIBXXF86VM #undef HAVE_LIBXXF86VM
......
...@@ -68,6 +68,9 @@ ...@@ -68,6 +68,9 @@
/* Define if you have the X Shm extension */ /* Define if you have the X Shm extension */
#undef HAVE_LIBXXSHM #undef HAVE_LIBXXSHM
/* Define if you have the X Shape extension */
#undef HAVE_LIBXSHAPE
/* Define if you have the Xxf86vm library */ /* Define if you have the Xxf86vm library */
#undef HAVE_LIBXXF86VM #undef HAVE_LIBXXF86VM
...@@ -257,6 +260,9 @@ ...@@ -257,6 +260,9 @@
/* Define if you have the <X11/extensions/XShm.h> header file. */ /* Define if you have the <X11/extensions/XShm.h> header file. */
#undef HAVE_X11_EXTENSIONS_XSHM_H #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. */ /* Define if you have the <X11/extensions/xf86dga.h> header file. */
#undef HAVE_X11_EXTENSIONS_XF86DGA_H #undef HAVE_X11_EXTENSIONS_XF86DGA_H
......
/*
* 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 */
...@@ -201,5 +201,6 @@ extern void TTYDRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr, ...@@ -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 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_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
extern BOOL TTYDRV_WND_IsSelfClipping(struct tagWND *wndPtr); extern BOOL TTYDRV_WND_IsSelfClipping(struct tagWND *wndPtr);
extern void TTYDRV_WND_SetWindowRgn(struct tagWND *wndPtr, HRGN hrgnWnd);
#endif /* !defined(__WINE_TTYDRV_H) */ #endif /* !defined(__WINE_TTYDRV_H) */
...@@ -78,6 +78,7 @@ typedef struct tagWND ...@@ -78,6 +78,7 @@ typedef struct tagWND
struct tagDCE *dce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */ struct tagDCE *dce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
HGLOBAL16 hmemTaskQ; /* Task queue global memory handle */ HGLOBAL16 hmemTaskQ; /* Task queue global memory handle */
HRGN16 hrgnUpdate; /* Update region */ HRGN16 hrgnUpdate; /* Update region */
HRGN hrgnWnd; /* window's region */
HWND hwndLastActive;/* Last active popup hwnd */ HWND hwndLastActive;/* Last active popup hwnd */
DWORD dwStyle; /* Window style (from CreateWindow) */ DWORD dwStyle; /* Window style (from CreateWindow) */
DWORD dwExStyle; /* Extended style (from CreateWindowEx) */ DWORD dwExStyle; /* Extended style (from CreateWindowEx) */
...@@ -131,6 +132,7 @@ typedef struct tagWND_DRIVER ...@@ -131,6 +132,7 @@ typedef struct tagWND_DRIVER
void (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL); void (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL);
BOOL (*pSetHostAttr)(WND *, INT haKey, INT value); BOOL (*pSetHostAttr)(WND *, INT haKey, INT value);
BOOL (*pIsSelfClipping)(WND *); BOOL (*pIsSelfClipping)(WND *);
void (*pSetWindowRgn)(WND *, const HRGN);
} WND_DRIVER; } WND_DRIVER;
extern WND_DRIVER *WND_Driver; extern WND_DRIVER *WND_Driver;
......
...@@ -431,6 +431,7 @@ extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD ...@@ -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_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
extern BOOL X11DRV_WND_IsSelfClipping(struct tagWND *wndPtr); extern BOOL X11DRV_WND_IsSelfClipping(struct tagWND *wndPtr);
extern void X11DRV_WND_DockWindow(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 int X11DRV_EVENT_PrepareShmCompletion( Drawable dw );
extern void X11DRV_EVENT_WaitShmCompletion( int compl ); extern void X11DRV_EVENT_WaitShmCompletion( int compl );
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
$X11_include_dir = "/usr/X11/include"; $X11_include_dir = "/usr/X11/include";
$outdir = "tsx11"; $outdir = "tsx11";
$wantfile = "$outdir/X11_calls"; $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. # First read list of wanted function names.
...@@ -80,6 +80,14 @@ foreach $name (@dolist) { ...@@ -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"; $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"; $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; print OUTH <<END;
/* /*
......
...@@ -13,6 +13,7 @@ C_SRCS = \ ...@@ -13,6 +13,7 @@ C_SRCS = \
ts_xlib.c \ ts_xlib.c \
ts_xresource.c \ ts_xresource.c \
ts_xutil.c \ ts_xutil.c \
ts_shape.c \
ts_xpm.c ts_xpm.c
all: $(MODULE).o all: $(MODULE).o
......
...@@ -143,6 +143,8 @@ XSetWMHints ...@@ -143,6 +143,8 @@ XSetWMHints
XSetWMProperties XSetWMProperties
XSetWMProtocols XSetWMProtocols
XSetWMSizeHints XSetWMSizeHints
XShapeCombineMask
XShapeCombineRectangles
XShmAttach XShmAttach
XShmCreateImage XShmCreateImage
XShmCreatePixmap XShmCreatePixmap
......
/*
* 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) */
...@@ -39,7 +39,8 @@ WND_DRIVER TTYDRV_WND_Driver = ...@@ -39,7 +39,8 @@ WND_DRIVER TTYDRV_WND_Driver =
TTYDRV_WND_ScrollWindow, TTYDRV_WND_ScrollWindow,
TTYDRV_WND_SetDrawable, TTYDRV_WND_SetDrawable,
TTYDRV_WND_SetHostAttr, TTYDRV_WND_SetHostAttr,
TTYDRV_WND_IsSelfClipping TTYDRV_WND_IsSelfClipping,
TTYDRV_WND_SetWindowRgn
}; };
...@@ -241,3 +241,11 @@ BOOL TTYDRV_WND_IsSelfClipping(WND *wndPtr) ...@@ -241,3 +241,11 @@ BOOL TTYDRV_WND_IsSelfClipping(WND *wndPtr)
return FALSE; return FALSE;
} }
/***********************************************************************
* TTYDRV_WND_SetWindowRgn
*/
void TTYDRV_WND_SetWindowRgn(struct tagWND *wndPtr, HRGN hrgnWnd)
{
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
#include <string.h> #include <string.h>
#include "winerror.h"
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "winerror.h" #include "winerror.h"
...@@ -271,38 +272,74 @@ BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect ) ...@@ -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 )
{
int nRet = ERROR;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (wndPtr)
{
if (wndPtr->hrgnWnd) nRet = CombineRgn( hrgn, wndPtr->hrgnWnd, 0, RGN_COPY );
WIN_ReleaseWndPtr(wndPtr);
}
return nRet;
}
/***********************************************************************
* SetWindowRgn (USER32)
*/
int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
{ {
RECT rect; int ret = FALSE;
WND * wndPtr = WIN_FindWndPtr( hwnd ); RECT tempRect;
if (!wndPtr) return (ERROR);
FIXME("GetWindowRgn: doesn't really do regions\n"); WND *wndPtr = WIN_FindWndPtr(hwnd);
memset (&rect, 0, sizeof(rect));
GetWindowRect ( hwnd, &rect ); if (!wndPtr) return FALSE;
FIXME("Check whether a valid region here\n"); /* 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;
}
SetRectRgn ( hrgn, rect.left, rect.top, rect.right, rect.bottom ); if (wndPtr->hrgnWnd)
{
/* delete previous region */
DeleteObject(wndPtr->hrgnWnd);
wndPtr->hrgnWnd = 0;
}
WIN_ReleaseWndPtr(wndPtr); /* we'd like to set it back to 0 */
return (SIMPLEREGION); if (hrgn == 0)
} {
GetWindowRect(hwnd, &tempRect);
}
else
{
/* verify that region really exists */
if (GetRgnBox(hrgn, &tempRect) == ERROR) goto done;
}
/*********************************************************************** /* valid region handle */
* SetWindowRgn wndPtr->hrgnWnd = hrgn;
*/ SetWindowPos( hwnd, NULL, tempRect.left, tempRect.top,
INT WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn,BOOL bRedraw) 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);
FIXME("SetWindowRgn: stub\n"); ret = TRUE;
return TRUE;
done:
WIN_ReleaseWndPtr(wndPtr);
return ret;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -39,7 +39,8 @@ WND_DRIVER X11DRV_WND_Driver = ...@@ -39,7 +39,8 @@ WND_DRIVER X11DRV_WND_Driver =
X11DRV_WND_SurfaceCopy, X11DRV_WND_SurfaceCopy,
X11DRV_WND_SetDrawable, X11DRV_WND_SetDrawable,
X11DRV_WND_SetHostAttr, X11DRV_WND_SetHostAttr,
X11DRV_WND_IsSelfClipping X11DRV_WND_IsSelfClipping,
X11DRV_WND_SetWindowRgn
}; };
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ts_xlib.h" #include "ts_xlib.h"
#include "ts_xutil.h" #include "ts_xutil.h"
#include "ts_shape.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -1010,3 +1011,62 @@ void X11DRV_WND_DockWindow(WND *wndPtr) ...@@ -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 */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment