Commit dc4fe773 authored by Alexandre Julliard's avatar Alexandre Julliard

Create an X window for every window, including children.

Fixed non-client rectangle calculations in managed mode. Added support for icon window in managed mode.
parent d7c69a5d
......@@ -27,7 +27,7 @@ debug_channels (ttydrv)
@ cdecl GetScreenSaveTimeout() TTYDRV_GetScreenSaveTimeout
@ cdecl SetScreenSaveTimeout(long) TTYDRV_SetScreenSaveTimeout
@ cdecl LoadOEMResource(long long) TTYDRV_LoadOEMResource
@ cdecl CreateWindow(long) TTYDRV_CreateWindow
@ cdecl CreateWindow(long ptr) TTYDRV_CreateWindow
@ cdecl DestroyWindow(long) TTYDRV_DestroyWindow
@ cdecl GetDC(long long long long) TTYDRV_GetDC
@ cdecl SetWindowPos(ptr) TTYDRV_SetWindowPos
......
......@@ -17,8 +17,7 @@ DEFAULT_DEBUG_CHANNEL(ttydrv);
WND_DRIVER TTYDRV_WND_Driver =
{
TTYDRV_WND_ForceWindowRaise,
TTYDRV_WND_SetHostAttr
TTYDRV_WND_ForceWindowRaise
};
#define SWP_AGG_NOGEOMETRYCHANGE \
......@@ -31,8 +30,10 @@ WND_DRIVER TTYDRV_WND_Driver =
/**********************************************************************
* CreateWindow (TTYDRV.@)
*/
BOOL TTYDRV_CreateWindow( HWND hwnd )
BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs )
{
BOOL ret;
#ifdef WINE_CURSES
WND *wndPtr = WIN_FindWndPtr( hwnd );
WINDOW *window;
......@@ -41,32 +42,40 @@ BOOL TTYDRV_CreateWindow( HWND hwnd )
TRACE("(%x)\n", hwnd);
/* Only create top-level windows */
if (wndPtr->dwStyle & WS_CHILD)
{
WIN_ReleaseWndPtr( wndPtr );
return TRUE;
}
if (!wndPtr->parent) /* desktop */
window = root_window;
else
if (!(wndPtr->dwStyle & WS_CHILD))
{
int x = wndPtr->rectWindow.left;
int y = wndPtr->rectWindow.top;
int cx = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
int cy = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
window = subwin( root_window, cy/cellHeight, cx/cellWidth,
y/cellHeight, x/cellWidth);
werase(window);
wrefresh(window);
if (!wndPtr->parent) /* desktop */
window = root_window;
else
{
int x = wndPtr->rectWindow.left;
int y = wndPtr->rectWindow.top;
int cx = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
int cy = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
window = subwin( root_window, cy/cellHeight, cx/cellWidth,
y/cellHeight, x/cellWidth);
werase(window);
wrefresh(window);
}
wndPtr->pDriverData = window;
}
wndPtr->pDriverData = window;
WIN_ReleaseWndPtr( wndPtr );
#else /* defined(WINE_CURSES) */
FIXME("(%x): stub\n", hwnd);
#endif /* defined(WINE_CURSES) */
return TRUE;
if (IsWindowUnicode( hwnd ))
{
ret = SendMessageW( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
if (ret) ret = (SendMessageW( hwnd, WM_CREATE, 0, (LPARAM)cs ) != -1);
}
else
{
ret = SendMessageA( hwnd, WM_NCCREATE, 0, (LPARAM)cs );
if (ret) ret = (SendMessageA( hwnd, WM_CREATE, 0, (LPARAM)cs ) != -1);
}
return ret;
}
/***********************************************************************
......@@ -97,16 +106,6 @@ void TTYDRV_WND_ForceWindowRaise(WND *wndPtr)
FIXME("(%p): stub\n", wndPtr);
}
/***********************************************************************
* TTYDRV_WND_SetHostAttr
*/
BOOL TTYDRV_WND_SetHostAttr(WND *wndPtr, INT attr, INT value)
{
FIXME("(%p): stub\n", wndPtr);
return TRUE;
}
/***********************************************************************
* DCE_OffsetVisRgn
......
......@@ -89,6 +89,7 @@ static BOOL load_driver(void)
GET_USER_FUNC(GetDC);
GET_USER_FUNC(EnableWindow);
GET_USER_FUNC(MsgWaitForMultipleObjectsEx);
GET_USER_FUNC(ScrollDC);
GET_USER_FUNC(ScrollWindowEx);
GET_USER_FUNC(SetFocus);
GET_USER_FUNC(SetParent);
......@@ -96,6 +97,7 @@ static BOOL load_driver(void)
GET_USER_FUNC(SetWindowRgn);
GET_USER_FUNC(SetWindowIcon);
GET_USER_FUNC(SetWindowText);
GET_USER_FUNC(ShowWindow);
GET_USER_FUNC(SysCommandSizeMove);
return TRUE;
......
......@@ -9,6 +9,7 @@ IMPORTS = user32 gdi32 kernel32
C_SRCS = \
desktop.c \
dga2.c \
scroll.c \
window.c \
winpos.c \
x11ddraw.c \
......
......@@ -55,11 +55,14 @@ static DWORD CALLBACK desktop_thread( LPVOID driver_data )
/* patch the desktop window queue to point to our queue */
win = WIN_FindWndPtr( hwnd );
win->hmemTaskQ = GetFastQueue16();
X11DRV_register_window( display, hwnd, win->pDriverData );
WIN_ReleaseWndPtr( win );
SetWindowLongW( hwnd, GWL_WNDPROC, (LONG)desktop_winproc );
X11DRV_register_window( display, hwnd, root_window );
TSXMapWindow( display, root_window );
wine_tsx11_lock();
XSetWMProtocols( display, root_window, &wmDeleteWindow, 1 );
XMapWindow( display, root_window );
wine_tsx11_unlock();
while (GetMessageW( &msg, hwnd, 0, 0 )) DispatchMessageW( &msg );
return 0;
......
/*
* Scroll windows and DCs
*
* Copyright 1993 David W. Metcalfe
* Copyright 1995, 1996 Alex Korobka
* Copyright 2001 Alexandre Julliard
*/
#include "config.h"
#include "ts_xlib.h"
#include "ts_xutil.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "x11drv.h"
#include "win.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(x11drv);
/*************************************************************************
* fix_caret
*/
static BOOL fix_caret(HWND hWnd, LPRECT lprc, UINT flags)
{
HWND hCaret = CARET_GetHwnd();
if( hCaret )
{
RECT rc;
CARET_GetRect( &rc );
if( hCaret == hWnd ||
(flags & SW_SCROLLCHILDREN && IsChild(hWnd, hCaret)) )
{
POINT pt;
pt.x = rc.left;
pt.y = rc.top;
MapWindowPoints( hCaret, hWnd, (LPPOINT)&rc, 2 );
if( IntersectRect(lprc, lprc, &rc) )
{
HideCaret(0);
lprc->left = pt.x;
lprc->top = pt.y;
return TRUE;
}
}
}
return FALSE;
}
/*************************************************************************
* ScrollDC (X11DRV.@)
*
* Only the hrgnUpdate is returned in device coordinates.
* rcUpdate must be returned in logical coordinates to comply with win API.
* FIXME: the doc explicitly states the opposite, to be checked
*/
BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc,
const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate )
{
RECT rect, rClip, rSrc;
TRACE( "%04x %d,%d hrgnUpdate=%04x rcUpdate = %p\n", hdc, dx, dy, hrgnUpdate, rcUpdate );
if (clipRect) TRACE( "cliprc = (%d,%d,%d,%d)\n",
clipRect->left, clipRect->top, clipRect->right, clipRect->bottom );
if (rc) TRACE( "rc = (%d,%d,%d,%d)\n", rc->left, rc->top, rc->right, rc->bottom );
/* compute device clipping region (in device coordinates) */
if (rc) rect = *rc;
else GetClipBox( hdc, &rect );
if (clipRect)
{
rClip = *clipRect;
IntersectRect( &rClip, &rect, &rClip );
}
else rClip = rect;
rSrc = rClip;
OffsetRect( &rSrc, -dx, -dy );
IntersectRect( &rSrc, &rSrc, &rect );
if (!IsRectEmpty(&rSrc))
{
/* copy bits */
if (!BitBlt( hdc, rSrc.left + dx, rSrc.top + dy,
rSrc.right - rSrc.left, rSrc.bottom - rSrc.top,
hdc, rSrc.left, rSrc.top, SRCCOPY))
return FALSE;
}
/* compute update areas */
if (hrgnUpdate || rcUpdate)
{
HRGN hrgn = hrgnUpdate, hrgn2;
POINT pt;
/* map everything to device coordinates */
pt.x = rect.left + dx;
pt.y = rect.top + dy;
LPtoDP( hdc, &pt, 1 );
LPtoDP( hdc, (LPPOINT)&rect, 2 );
LPtoDP( hdc, (LPPOINT)&rClip, 2 );
dx = pt.x - rect.left;
dy = pt.y - rect.top;
hrgn2 = CreateRectRgnIndirect( &rect );
if (hrgn) SetRectRgn( hrgn, rClip.left, rClip.top, rClip.right, rClip.bottom );
else hrgn = CreateRectRgn( rClip.left, rClip.top, rClip.right, rClip.bottom );
CombineRgn( hrgn, hrgn, hrgn2, RGN_AND );
OffsetRgn( hrgn2, dx, dy );
CombineRgn( hrgn, hrgn, hrgn2, RGN_DIFF );
if( rcUpdate )
{
GetRgnBox( hrgn, rcUpdate );
/* Put the rcUpdate in logical coordinate */
DPtoLP( hdc, (LPPOINT)rcUpdate, 2 );
}
if (!hrgnUpdate) DeleteObject( hrgn );
DeleteObject( hrgn2 );
}
return TRUE;
}
/*************************************************************************
* ScrollWindowEx (X11DRV.@)
*/
INT X11DRV_ScrollWindowEx( HWND hwnd, INT dx, INT dy,
const RECT *rect, const RECT *clipRect,
HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags )
{
INT retVal = NULLREGION;
BOOL bCaret = FALSE, bOwnRgn = TRUE;
RECT rc, cliprc;
WND* wnd = WIN_FindWndPtr( hwnd );
if( !wnd || !WIN_IsWindowDrawable( wnd, TRUE ))
{
retVal = ERROR;
goto END;
}
GetClientRect(hwnd, &rc);
if (rect) IntersectRect(&rc, &rc, rect);
if (clipRect) IntersectRect(&cliprc,&rc,clipRect);
else cliprc = rc;
if (!IsRectEmpty(&cliprc) && (dx || dy))
{
HDC hDC;
BOOL bUpdate = (rcUpdate || hrgnUpdate || flags & (SW_INVALIDATE | SW_ERASE));
HRGN hrgnClip = CreateRectRgnIndirect(&cliprc);
HRGN hrgnTemp;
RECT caretrc;
TRACE( "%04x, %d,%d hrgnUpdate=%04x rcUpdate = %p rc=(%d,%d-%d,%d) %04x\n",
hwnd, dx, dy, hrgnUpdate, rcUpdate,
rc.left, rc.top, rc.right, rc.bottom, flags );
if (clipRect) TRACE( "cliprc = (%d,%d,%d,%d)\n",
clipRect->left, clipRect->top,
clipRect->right, clipRect->bottom );
caretrc = rc;
bCaret = fix_caret(hwnd, &caretrc, flags);
if( hrgnUpdate ) bOwnRgn = FALSE;
else if( bUpdate ) hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 );
hDC = GetDCEx( hwnd, 0, DCX_CACHE | DCX_USESTYLE );
if (hDC)
{
HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
X11DRV_StartGraphicsExposures( hDC );
X11DRV_ScrollDC( hDC, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate );
X11DRV_EndGraphicsExposures( hDC, hrgn );
ReleaseDC( hwnd, hDC );
if (bUpdate) CombineRgn( hrgnUpdate, hrgnUpdate, hrgn, RGN_OR );
else RedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE | RDW_ERASE );
}
/* Take into account the fact that some damages may have occured during the scroll */
hrgnTemp = CreateRectRgn( 0, 0, 0, 0 );
if (GetUpdateRgn( hwnd, hrgnTemp, FALSE ) != NULLREGION)
{
OffsetRgn( hrgnTemp, dx, dy );
CombineRgn( hrgnTemp, hrgnTemp, hrgnClip, RGN_AND );
RedrawWindow( hwnd, NULL, hrgnTemp, RDW_INVALIDATE | RDW_ERASE );
}
DeleteObject( hrgnTemp );
if( flags & SW_SCROLLCHILDREN )
{
RECT r;
WND *w;
for( w =WIN_LockWndPtr(wnd->child); w; WIN_UpdateWndPtr(&w, w->next))
{
r = w->rectWindow;
if( !rect || IntersectRect(&r, &r, &rc) )
SetWindowPos(w->hwndSelf, 0, w->rectWindow.left + dx,
w->rectWindow.top + dy, 0,0, SWP_NOZORDER |
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW |
SWP_DEFERERASE );
}
}
if( flags & (SW_INVALIDATE | SW_ERASE) )
RedrawWindow( hwnd, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE |
((flags & SW_ERASE) ? RDW_ERASENOW : 0) |
((flags & SW_SCROLLCHILDREN) ? RDW_ALLCHILDREN : 0 ) );
if( bCaret )
{
SetCaretPos( caretrc.left + dx, caretrc.top + dy );
ShowCaret(0);
}
if( bOwnRgn && hrgnUpdate ) DeleteObject( hrgnUpdate );
DeleteObject( hrgnClip );
}
END:
WIN_ReleaseWndPtr(wnd);
return retVal;
}
......@@ -18,7 +18,6 @@
#include "wingdi.h"
#include "ddrawi.h"
#include "bitmap.h"
#include "win.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(x11drv);
......@@ -50,19 +49,12 @@ static void GrabPointer(HWND hWnd)
{
Display *display = thread_display();
if (hWnd) {
WND *tmpWnd;
Window win;
/* find the X11 window that ddraw uses */
tmpWnd = WIN_FindWndPtr(hWnd);
win = X11DRV_WND_GetXWindow(tmpWnd);
TRACE("WND: %p win: %ld\n", tmpWnd, win);
WIN_ReleaseWndPtr(tmpWnd);
Window win = X11DRV_get_whole_window(hWnd);
TRACE("WND: %x win: %ld\n", hWnd, win);
if (!win) {
TRACE("host off desktop\n");
tmpWnd = WIN_FindWndPtr(GetDesktopWindow());
win = X11DRV_WND_GetXWindow(tmpWnd);
TRACE("Owner WND: %p win: %ld\n", tmpWnd, win);
WIN_ReleaseWndPtr(tmpWnd);
win = root_window;
}
TSXGrabPointer(display, win, True, 0, GrabModeAsync, GrabModeAsync, win, None, CurrentTime);
}
......
......@@ -27,11 +27,12 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
@ cdecl GetScreenSaveTimeout() X11DRV_GetScreenSaveTimeout
@ cdecl SetScreenSaveTimeout(long) X11DRV_SetScreenSaveTimeout
@ cdecl LoadOEMResource(long long) X11DRV_LoadOEMResource
@ cdecl CreateWindow(long) X11DRV_CreateWindow
@ cdecl CreateWindow(long ptr) X11DRV_CreateWindow
@ cdecl DestroyWindow(long) X11DRV_DestroyWindow
@ cdecl GetDC(long long long long) X11DRV_GetDC
@ cdecl EnableWindow(long long) X11DRV_EnableWindow
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx
@ cdecl ScrollDC(long long long ptr ptr long ptr) X11DRV_ScrollDC
@ cdecl ScrollWindowEx(long long long ptr ptr long ptr long) X11DRV_ScrollWindowEx
@ cdecl SetFocus(long) X11DRV_SetFocus
@ cdecl SetParent(long long) X11DRV_SetParent
......@@ -39,6 +40,7 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
@ cdecl SetWindowRgn(long long long) X11DRV_SetWindowRgn
@ cdecl SetWindowIcon(long long long) X11DRV_SetWindowIcon
@ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
@ cdecl ShowWindow(long long) X11DRV_ShowWindow
@ cdecl SysCommandSizeMove(long long) X11DRV_SysCommandSizeMove
@ cdecl AcquireClipboard() X11DRV_AcquireClipboard
@ cdecl ReleaseClipboard() X11DRV_ReleaseClipboard
......
......@@ -1306,28 +1306,22 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
case SRCCOPY: /* 0xcc */
if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel)
{
BOOL expose = !(dcSrc->flags & DC_MEMORY) && !(dcDst->flags & DC_MEMORY);
if ( expose ) XSetGraphicsExposures( gdi_display, physDevDst->gc, True );
XSetFunction( gdi_display, physDevDst->gc, GXcopy );
XCopyArea( gdi_display, physDevSrc->drawable,
physDevDst->drawable, physDevDst->gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top );
if ( expose ) XSetGraphicsExposures( gdi_display, physDevDst->gc, False );
return TRUE;
}
if (dcSrc->bitsPerPixel == 1)
{
BOOL expose = !(dcSrc->flags & DC_MEMORY) && !(dcDst->flags & DC_MEMORY);
XSetBackground( gdi_display, physDevDst->gc, physDevDst->textPixel );
XSetForeground( gdi_display, physDevDst->gc, physDevDst->backgroundPixel );
XSetFunction( gdi_display, physDevDst->gc, GXcopy );
if ( expose ) XSetGraphicsExposures( gdi_display, physDevDst->gc, True );
XCopyPlane( gdi_display, physDevSrc->drawable,
physDevDst->drawable, physDevDst->gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top, 1 );
if ( expose ) XSetGraphicsExposures( gdi_display, physDevDst->gc, False );
return TRUE;
}
break;
......@@ -1355,6 +1349,7 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
}
tmpGC = XCreateGC( gdi_display, physDevDst->drawable, 0, NULL );
XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors );
XSetGraphicsExposures( gdi_display, tmpGC, False );
pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height,
dcDst->bitsPerPixel );
......
......@@ -41,6 +41,7 @@ BOOL X11DRV_BITMAP_Init(void)
{
BITMAP_monoGC = XCreateGC( gdi_display, tmpPixmap, 0, NULL );
XSetGraphicsExposures( gdi_display, BITMAP_monoGC, False );
XSetSubwindowMode( gdi_display, BITMAP_monoGC, IncludeInferiors );
XFreePixmap( gdi_display, tmpPixmap );
}
......@@ -50,6 +51,7 @@ BOOL X11DRV_BITMAP_Init(void)
{
BITMAP_colorGC = XCreateGC( gdi_display, tmpPixmap, 0, NULL );
XSetGraphicsExposures( gdi_display, BITMAP_colorGC, False );
XSetSubwindowMode( gdi_display, BITMAP_colorGC, IncludeInferiors );
XFreePixmap( gdi_display, tmpPixmap );
}
}
......@@ -101,6 +103,8 @@ HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
XFreeGC( gdi_display, physDev->gc );
physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL );
XSetGraphicsExposures( gdi_display, physDev->gc, False );
XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors );
XFlush( gdi_display );
wine_tsx11_unlock();
dc->bitsPerPixel = bmp->bitmap.bmBitsPixel;
DC_InitDC( dc );
......
......@@ -72,3 +72,102 @@ void X11DRV_SetDeviceClipping( DC * dc )
GDI_ReleaseObj( dc->hGCClipRgn );
}
/***********************************************************************
* X11DRV_SetDrawable
*
* Set the drawable, clipping mode and origin for a DC.
*/
void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, int org_x, int org_y )
{
DC *dc = DC_GetDCPtr( hdc );
if (dc)
{
X11DRV_PDEVICE *physDev = dc->physDev;
/*
* 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 (dc->hClipRgn) OffsetRgn( dc->hClipRgn, org_x - dc->DCOrgX, org_y - dc->DCOrgY );
dc->DCOrgX = org_x;
dc->DCOrgY = org_y;
physDev->drawable = drawable;
TSXSetSubwindowMode( gdi_display, physDev->gc, mode );
GDI_ReleaseObj( hdc );
}
}
/***********************************************************************
* X11DRV_StartGraphicsExposures
*
* Set the DC in graphics exposures mode
*/
void X11DRV_StartGraphicsExposures( HDC hdc )
{
DC *dc = DC_GetDCPtr( hdc );
if (dc)
{
X11DRV_PDEVICE *physDev = dc->physDev;
TSXSetGraphicsExposures( gdi_display, physDev->gc, True );
GDI_ReleaseObj( hdc );
}
}
/***********************************************************************
* X11DRV_EndGraphicsExposures
*
* End the graphics exposures mode and process the events
*/
void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn )
{
HRGN tmp = 0;
DC *dc = DC_GetDCPtr( hdc );
if (dc)
{
XEvent event;
X11DRV_PDEVICE *physDev = dc->physDev;
SetRectRgn( hrgn, 0, 0, 0, 0 );
wine_tsx11_lock();
XSetGraphicsExposures( gdi_display, physDev->gc, False );
XSync( gdi_display, False );
for (;;)
{
XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
if (event.type == NoExpose) break;
if (event.type == GraphicsExpose)
{
TRACE( "got %d,%d %dx%d count %d\n",
event.xgraphicsexpose.x, event.xgraphicsexpose.y,
event.xgraphicsexpose.width, event.xgraphicsexpose.height,
event.xgraphicsexpose.count );
if (!tmp) tmp = CreateRectRgn( 0, 0, 0, 0 );
SetRectRgn( tmp, event.xgraphicsexpose.x, event.xgraphicsexpose.y,
event.xgraphicsexpose.x + event.xgraphicsexpose.width,
event.xgraphicsexpose.y + event.xgraphicsexpose.height );
CombineRgn( hrgn, hrgn, tmp, RGN_OR );
if (!event.xgraphicsexpose.count) break;
}
else
{
ERR( "got unexpected event %d\n", event.type );
break;
}
if (tmp) DeleteObject( tmp );
}
wine_tsx11_unlock();
GDI_ReleaseObj( hdc );
}
}
......@@ -69,11 +69,12 @@ typedef struct tagUSER_DRIVER {
void (*pResetSelectionOwner)(struct tagWND *, BOOL);
/* windowing functions */
BOOL (*pCreateWindow)(HWND);
BOOL (*pCreateWindow)(HWND,CREATESTRUCTA*);
BOOL (*pDestroyWindow)(HWND);
BOOL (*pGetDC)(HWND,HDC,HRGN,DWORD);
BOOL (*pEnableWindow)(HWND,BOOL);
DWORD (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
BOOL (*pScrollDC)(HDC,INT,INT,const RECT*,const RECT*,HRGN,LPRECT);
INT (*pScrollWindowEx)(HWND,INT,INT,const RECT*,const RECT*,HRGN,LPRECT,UINT);
void (*pSetFocus)(HWND);
HWND (*pSetParent)(HWND,HWND);
......@@ -81,6 +82,7 @@ typedef struct tagUSER_DRIVER {
BOOL (*pSetWindowRgn)(HWND,HRGN,BOOL);
HICON (*pSetWindowIcon)(HWND,HICON,BOOL);
BOOL (*pSetWindowText)(HWND,LPCWSTR);
BOOL (*pShowWindow)(HWND,INT);
void (*pSysCommandSizeMove)(HWND,WPARAM);
} USER_DRIVER;
......
......@@ -16,13 +16,6 @@
#define WND_MAGIC 0x444e4957 /* 'WIND' */
/* PAINT_RedrawWindow() control flags */
#define RDW_EX_USEHRGN 0x0001
#define RDW_EX_DELETEHRGN 0x0002
#define RDW_EX_XYWINDOW 0x0004
#define RDW_EX_TOPFRAME 0x0010
#define RDW_EX_DELAY_NCPAINT 0x0020
struct tagCLASS;
struct tagDCE;
struct tagMESSAGEQUEUE;
......@@ -65,13 +58,9 @@ typedef struct tagWND
DWORD wExtra[1]; /* Window extra bytes */
} WND;
/* Host attributes */
#define HAK_ICONICSTATE 3
typedef struct tagWND_DRIVER
{
void (*pForceWindowRaise)(WND *);
BOOL (*pSetHostAttr)(WND *, INT haKey, INT value);
} WND_DRIVER;
extern WND_DRIVER *WND_Driver;
......@@ -104,14 +93,6 @@ typedef struct
#define BWA_SKIPOWNED 0x0004
#define BWA_SKIPICONIC 0x0008
/* WIN_UpdateNCRgn() flags */
#define UNC_CHECK 0x0001
#define UNC_ENTIRE 0x0002
#define UNC_REGION 0x0004
#define UNC_UPDATE 0x0008
#define UNC_DELAY_NCPAINT 0x0010
#define UNC_IN_BEGINPAINT 0x0020
/* Window functions */
extern void WIN_LockWnds( void );
extern void WIN_UnlockWnds( void );
......@@ -137,8 +118,6 @@ extern WND** WIN_BuildWinArray( WND *wndPtr, UINT bwa, UINT* pnum );
extern void WIN_ReleaseWinArray(WND **wndArray);
extern BOOL WIN_InternalShowOwnedPopups( HWND owner, BOOL fShow, BOOL unmanagedOnly );
extern HICON16 NC_IconForWindow( WND *wndPtr );
extern HWND CARET_GetHwnd(void);
extern void CARET_GetRect(LPRECT lprc); /* windows/caret.c */
......@@ -149,11 +128,6 @@ extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ); /* windows/defwnd.c
extern void PROPERTY_RemoveWindowProps( WND *pWnd ); /* windows/property.c */
extern BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
HRGN hrgnUpdate, UINT flags,
UINT control ); /* windows/painting.c */
extern HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT flags); /* windows/painting.c */
/* Classes functions */
struct tagCLASS; /* opaque structure */
struct builtin_class_descr;
......@@ -167,8 +141,4 @@ extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
/* windows/focus.c */
extern void FOCUS_SwitchFocus( struct tagMESSAGEQUEUE *pMsgQ, HWND , HWND );
/* generic method that returns TRUE if the window properties ask for a
window manager type of border */
extern BOOL WIN_WindowNeedsWMBorder( DWORD style, DWORD exStyle );
#endif /* __WINE_WIN_H */
......@@ -28,7 +28,6 @@ extern BOOL WINPOS_ShowIconTitle( struct tagWND* pWnd, BOOL bShow );
extern void WINPOS_GetMinMaxInfo( struct tagWND* pWnd, POINT *maxSize,
POINT *maxPos, POINT *minTrack,
POINT *maxTrack );
extern UINT WINPOS_MinMaximize( struct tagWND* pWnd, UINT16 cmd, LPRECT16 lpPos);
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
BOOL fChangeFocus );
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
......
......@@ -19,6 +19,7 @@
#include "winbase.h"
#include "gdi.h"
#include "user.h"
#include "win.h"
#include "thread.h"
#define MAX_PIXELFORMATS 8
......@@ -181,8 +182,11 @@ extern HBITMAP X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap, BOOL bDeleteP
extern Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc );
extern Pixmap X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp, HDC hdc );
extern BOOL X11DRV_SetupGCForPatBlt( struct tagDC *dc, GC gc,
BOOL fMapColors );
extern void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, int org_x, int org_y );
extern void X11DRV_StartGraphicsExposures( HDC hdc );
extern void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn );
extern BOOL X11DRV_SetupGCForPatBlt( struct tagDC *dc, GC gc, BOOL fMapColors );
extern BOOL X11DRV_SetupGCForBrush( struct tagDC *dc );
extern BOOL X11DRV_SetupGCForPen( struct tagDC *dc );
extern BOOL X11DRV_SetupGCForText( struct tagDC *dc );
......@@ -307,7 +311,7 @@ struct x11drv_thread_data
{
Display *display;
HANDLE display_fd;
int process_event_count;
int process_event_count; /* recursion count for event processing */
};
extern struct x11drv_thread_data *x11drv_init_thread_data(void);
......@@ -327,6 +331,15 @@ extern unsigned int screen_width;
extern unsigned int screen_height;
extern unsigned int screen_depth;
extern Atom wmProtocols;
extern Atom wmDeleteWindow;
extern Atom wmTakeFocus;
extern Atom dndProtocol;
extern Atom dndSelection;
extern Atom wmChangeState;
extern Atom kwmDockWindow;
extern Atom _kde_net_wm_system_tray_window_for;
static inline Visual *X11DRV_GetVisual(void) { return visual; }
static inline Window X11DRV_GetXRootWindow(void) { return root_window; }
......@@ -345,8 +358,6 @@ extern BOOL X11DRV_GetClipboardData(UINT wFormat);
extern WORD X11DRV_EVENT_XStateToKeyState( int state ) ;
extern void X11DRV_Synchronize( void );
typedef enum {
X11DRV_INPUT_RELATIVE,
X11DRV_INPUT_ABSOLUTE
......@@ -381,28 +392,50 @@ extern void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
extern struct tagWND_DRIVER X11DRV_WND_Driver;
typedef struct _X11DRV_WND_DATA {
Window window;
HBITMAP hWMIconBitmap;
HBITMAP hWMIconMask;
int bit_gravity;
} X11DRV_WND_DATA;
/* x11drv private window data */
struct x11drv_win_data
{
Window whole_window; /* X window for the complete window */
Window client_window; /* X window for the client area */
Window icon_window; /* X window for the icon */
RECT whole_rect; /* X window rectangle for the whole window relative to parent */
RECT client_rect; /* client area relative to whole window */
HBITMAP hWMIconBitmap;
HBITMAP hWMIconMask;
};
typedef struct x11drv_win_data X11DRV_WND_DATA;
extern Window X11DRV_WND_GetXWindow(struct tagWND *wndPtr);
extern Window X11DRV_WND_FindXWindow(struct tagWND *wndPtr);
extern Window X11DRV_get_client_window( HWND hwnd );
extern Window X11DRV_get_whole_window( HWND hwnd );
extern Window X11DRV_get_top_window( HWND hwnd );
inline static Window get_client_window( WND *wnd )
{
struct x11drv_win_data *data = wnd->pDriverData;
return data->client_window;
}
inline static Window get_whole_window( WND *wnd )
{
struct x11drv_win_data *data = wnd->pDriverData;
return data->whole_window;
}
extern void X11DRV_WND_ForceWindowRaise(struct tagWND *pWnd);
extern void X11DRV_WND_SetWindowPos(struct tagWND *wndPtr, const struct tagWINDOWPOS *winpos, BOOL bSMC_SETXPOS);
extern void X11DRV_WND_SetText(struct tagWND *wndPtr, LPCWSTR text);
extern void X11DRV_WND_SurfaceCopy(struct tagWND *wndPtr, HDC hdc, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
extern void X11DRV_WND_SetGravity(struct tagWND* wndPtr, int value );
extern BOOL X11DRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
extern void X11DRV_SetFocus( HWND hwnd );
extern Cursor X11DRV_GetCursor( Display *display, struct tagCURSORICONINFO *ptr );
extern void X11DRV_register_window( Display *display, HWND hwnd, Window win );
extern void X11DRV_expect_error( unsigned char request, unsigned char error, XID id );
extern int X11DRV_check_error(void);
extern void X11DRV_register_window( Display *display, HWND hwnd, struct x11drv_win_data *data );
extern void X11DRV_set_iconic_state( WND *win );
extern void X11DRV_window_to_X_rect( WND *win, RECT *rect );
extern void X11DRV_X_to_window_rect( WND *win, RECT *rect );
extern void X11DRV_create_desktop_thread(void);
extern Window X11DRV_create_desktop( XVisualInfo *desktop_vi, const char *geometry );
extern int X11DRV_sync_whole_window_position( Display *display, WND *win, int zorder );
extern int X11DRV_sync_client_window_position( Display *display, WND *win );
#endif /* __WINE_X11DRV_H */
......@@ -211,9 +211,9 @@ static void DCE_DeleteClipRgn( DCE* dce )
dce->hClipRgn = 0;
TRACE("\trestoring VisRgn\n");
RestoreVisRgn16(dce->hDC);
/* make it dirty so that the vis rgn gets recomputed next time */
dce->DCXflags |= DCX_DCEDIRTY;
SetHookFlags16( dce->hDC, DCHF_INVALIDATEVISRGN );
}
......@@ -412,8 +412,9 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
BOOL bUpdateClipOrigin = FALSE;
TRACE("hwnd %04x, hrgnClip %04x, flags %08x\n",
hwnd, hrgnClip, (unsigned)flags);
hwnd, hrgnClip, (unsigned)flags);
if (!hwnd) hwnd = GetDesktopWindow();
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
/* fixup flags */
......@@ -437,17 +438,11 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
else flags |= DCX_CACHE;
}
if( flags & DCX_NOCLIPCHILDREN )
{
flags |= DCX_CACHE;
flags &= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN);
}
if (flags & DCX_WINDOW)
flags = (flags & ~DCX_CLIPCHILDREN) | DCX_CACHE;
if (!(wndPtr->dwStyle & WS_CHILD) || !wndPtr->parent )
flags &= ~DCX_PARENTCLIP;
if (!wndPtr->parent || (wndPtr->parent->hwndSelf == GetDesktopWindow()))
flags = (flags & ~DCX_PARENTCLIP) | DCX_CLIPSIBLINGS;
else if( flags & DCX_PARENTCLIP )
{
flags |= DCX_CACHE;
......@@ -514,25 +509,6 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
{
TRACE("\tskipping hVisRgn update\n");
bUpdateVisRgn = FALSE; /* updated automatically, via DCHook() */
/* Abey - 16Jul99. to take care of the nested GetDC. first one
with DCX_EXCLUDERGN or DCX_INTERSECTRGN flags and the next
one with or without these flags. */
if(dce->DCXflags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN))
{
/* This is likely to be a nested BeginPaint().
or a BeginPaint() followed by a GetDC()*/
if( dce->hClipRgn != hrgnClip )
{
FIXME("new hrgnClip[%04x] smashes the previous[%04x]\n",
hrgnClip, dce->hClipRgn );
DCE_DeleteClipRgn( dce );
}
else
RestoreVisRgn16(dce->hDC);
}
}
}
if (!dce)
......@@ -542,6 +518,14 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
}
if (!(flags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN))) hrgnClip = 0;
if (((flags ^ dce->DCXflags) & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) &&
(dce->hClipRgn != hrgnClip))
{
/* if the extra clip region has changed, get rid of the old one */
DCE_DeleteClipRgn( dce );
}
dce->hwndCurrent = hwnd;
dce->hClipRgn = hrgnClip;
dce->DCXflags = flags & (DCX_PARENTCLIP | DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
......@@ -581,7 +565,7 @@ HDC WINAPI GetDC(
HWND hwnd /* [in] handle of window */
) {
if (!hwnd)
return GetDCEx( GetDesktopWindow(), 0, DCX_CACHE | DCX_WINDOW );
return GetDCEx( 0, 0, DCX_CACHE | DCX_WINDOW );
return GetDCEx( hwnd, 0, DCX_USESTYLE );
}
......@@ -591,7 +575,6 @@ HDC WINAPI GetDC(
*/
HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
{
if (!hwnd) hwnd = GetDesktopWindow16();
return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
}
......@@ -601,7 +584,6 @@ HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
*/
HDC WINAPI GetWindowDC( HWND hwnd )
{
if (!hwnd) hwnd = GetDesktopWindow();
return GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
}
......
......@@ -415,11 +415,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
}
case WM_SYNCPAINT:
if (wndPtr->hrgnUpdate)
{
RedrawWindow ( wndPtr->hwndSelf, 0, wndPtr->hrgnUpdate,
RDW_ERASENOW | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN );
}
RedrawWindow ( wndPtr->hwndSelf, NULL, 0, RDW_ERASENOW | RDW_ERASE | RDW_ALLCHILDREN );
return 0;
case WM_SETREDRAW:
......
......@@ -28,6 +28,17 @@ DECLARE_DEBUG_CHANNEL(nonclient);
(r).right = (wnd)->rectClient.right - (wnd)->rectWindow.left; \
(r).bottom = (wnd)->rectClient.bottom - (wnd)->rectWindow.top
/* PAINT_RedrawWindow() control flags */
#define RDW_EX_DELAY_NCPAINT 0x0020
/* WIN_UpdateNCRgn() flags */
#define UNC_CHECK 0x0001
#define UNC_ENTIRE 0x0002
#define UNC_REGION 0x0004
#define UNC_UPDATE 0x0008
#define UNC_DELAY_NCPAINT 0x0010
#define UNC_IN_BEGINPAINT 0x0020
/* Last COLOR id */
#define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION
......@@ -127,7 +138,7 @@ static BOOL WIN_HaveToDelayNCPAINT(
* is 1 then the hRgn is preserved and RDW_Paint() will have to get
* a DC without extra clipping region.
*/
HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags )
static HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags )
{
RECT r;
HRGN hClip = 0;
......@@ -323,7 +334,7 @@ HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
TRACE("hrgnUpdate = %04x, \n", hrgnUpdate);
if (GetClassWord16(wndPtr->hwndSelf, GCW_STYLE) & CS_PARENTDC)
if (GetClassLongA(wndPtr->hwndSelf, GCL_STYLE) & CS_PARENTDC)
{
/* Don't clip the output to the update region for CS_PARENTDC window */
if( hrgnUpdate )
......@@ -336,7 +347,7 @@ HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
if( hrgnUpdate ) /* convert to client coordinates */
OffsetRgn( hrgnUpdate, wndPtr->rectWindow.left - wndPtr->rectClient.left,
wndPtr->rectWindow.top - wndPtr->rectClient.top );
lps->hdc = GetDCEx(hwnd, hrgnUpdate, DCX_INTERSECTRGN |
lps->hdc = GetDCEx(hwnd, hrgnUpdate, DCX_INTERSECTRGN |
DCX_WINDOWPAINT | DCX_USESTYLE | (bIcon ? DCX_WINDOW : 0) );
/* ReleaseDC() in EndPaint() will delete the region */
}
......@@ -477,7 +488,7 @@ END:
* Validate the portions of parents that are covered by a validated child
* wndPtr = child
*/
void RDW_ValidateParent(WND *wndChild)
static void RDW_ValidateParent(WND *wndChild)
{
WND *wndParent = WIN_LockWndPtr(wndChild->parent);
WND *wndDesktop = WIN_GetDesktop();
......@@ -611,15 +622,14 @@ static void RDW_UpdateRgns( WND* wndPtr, HRGN hRgn, UINT flags, BOOL firstRecurs
if( CombineRgn( wndPtr->hrgnUpdate, wndPtr->hrgnUpdate, hRgn, RGN_DIFF )
== NULLREGION )
goto EMPTY;
{
DeleteObject( wndPtr->hrgnUpdate );
wndPtr->hrgnUpdate = 0;
}
}
else /* validate everything */
{
if( wndPtr->hrgnUpdate > 1 )
{
EMPTY:
DeleteObject( wndPtr->hrgnUpdate );
}
if( wndPtr->hrgnUpdate > 1 ) DeleteObject( wndPtr->hrgnUpdate );
wndPtr->hrgnUpdate = 0;
}
......@@ -757,7 +767,7 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
if (wndPtr->hrgnUpdate) /* wm_painticon wparam is 1 */
SendMessage16( hWnd, (bIcon) ? WM_PAINTICON : WM_PAINT, bIcon, 0 );
}
else if ((flags & RDW_ERASENOW) || (ex & RDW_EX_TOPFRAME))
else if (flags & RDW_ERASENOW)
{
UINT dcx = DCX_INTERSECTRGN | DCX_USESTYLE | DCX_KEEPCLIPRGN | DCX_WINDOWPAINT | DCX_CACHE;
HRGN hrgnRet;
......@@ -765,7 +775,6 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
hrgnRet = WIN_UpdateNCRgn(wndPtr,
hrgn,
UNC_REGION | UNC_CHECK |
((ex & RDW_EX_TOPFRAME) ? UNC_ENTIRE : 0) |
((ex & RDW_EX_DELAY_NCPAINT) ? UNC_DELAY_NCPAINT : 0) );
if( hrgnRet )
......@@ -792,7 +801,6 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
}
if( !IsWindow(hWnd) ) return hrgn;
ex &= ~RDW_EX_TOPFRAME;
/* ... and its child windows */
......@@ -820,12 +828,12 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
return hrgn;
}
/***********************************************************************
* PAINT_RedrawWindow
*
* RedrawWindow (USER32.@)
*/
BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
HRGN hrgnUpdate, UINT flags, UINT ex )
BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rectUpdate,
HRGN hrgnUpdate, UINT flags )
{
HRGN hRgn = 0;
RECT r, r2;
......@@ -848,8 +856,8 @@ BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
if( hrgnUpdate )
{
GetRgnBox( hrgnUpdate, &r );
TRACE( "%04x (%04x) NULL %04x box (%i,%i-%i,%i) flags=%04x, exflags=%04x\n",
hwnd, wndPtr->hrgnUpdate, hrgnUpdate, r.left, r.top, r.right, r.bottom, flags, ex);
TRACE( "%04x (%04x) NULL %04x box (%i,%i-%i,%i) flags=%04x\n",
hwnd, wndPtr->hrgnUpdate, hrgnUpdate, r.left, r.top, r.right, r.bottom, flags );
}
else
{
......@@ -857,9 +865,9 @@ BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
r = *rectUpdate;
else
SetRectEmpty( &r );
TRACE( "%04x (%04x) %s %d,%d-%d,%d %04x flags=%04x, exflags=%04x\n",
TRACE( "%04x (%04x) %s %d,%d-%d,%d %04x flags=%04x\n",
hwnd, wndPtr->hrgnUpdate, rectUpdate ? "rect" : "NULL", r.left,
r.top, r.right, r.bottom, hrgnUpdate, flags, ex );
r.top, r.right, r.bottom, hrgnUpdate, flags );
}
}
......@@ -870,17 +878,9 @@ BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
else
r = wndPtr->rectClient;
if( ex & RDW_EX_XYWINDOW )
{
pt.x = pt.y = 0;
OffsetRect( &r, -wndPtr->rectWindow.left, -wndPtr->rectWindow.top );
}
else
{
pt.x = wndPtr->rectClient.left - wndPtr->rectWindow.left;
pt.y = wndPtr->rectClient.top - wndPtr->rectWindow.top;
OffsetRect( &r, -wndPtr->rectClient.left, -wndPtr->rectClient.top );
}
pt.x = wndPtr->rectClient.left - wndPtr->rectWindow.left;
pt.y = wndPtr->rectClient.top - wndPtr->rectWindow.top;
OffsetRect( &r, -wndPtr->rectClient.left, -wndPtr->rectClient.top );
if (flags & RDW_INVALIDATE) /* ------------------------- Invalidate */
{
......@@ -935,7 +935,6 @@ rect2i:
{
if( !IntersectRect( &r2, &r, rectUpdate ) ) goto END;
OffsetRect( &r2, pt.x, pt.y );
rect2v:
hRgn = CreateRectRgnIndirect( &r2 );
}
else /* entire window or client depending on RDW_FRAME */
......@@ -945,7 +944,7 @@ rect2v:
else
{
GETCLIENTRECTW( wndPtr, r2 );
goto rect2v;
hRgn = CreateRectRgnIndirect( &r2 );
}
}
}
......@@ -956,7 +955,7 @@ rect2v:
/* Erase/update windows, from now on hRgn is a scratch region */
hRgn = RDW_Paint( wndPtr, (hRgn == 1) ? 0 : hRgn, flags, ex );
hRgn = RDW_Paint( wndPtr, (hRgn == 1) ? 0 : hRgn, flags, 0 );
END:
if( hRgn > 1 && (hRgn != hrgnUpdate) )
......@@ -967,16 +966,6 @@ END:
/***********************************************************************
* RedrawWindow (USER32.@)
*/
BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rectUpdate,
HRGN hrgnUpdate, UINT flags )
{
return PAINT_RedrawWindow( hwnd, rectUpdate, hrgnUpdate, flags, 0 );
}
/***********************************************************************
* RedrawWindow (USER.290)
*/
BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
......
......@@ -13,10 +13,6 @@
#include "wingdi.h"
#include "wine/winuser16.h"
#include "winuser.h"
#include "win.h"
#include "gdi.h"
#include "dce.h"
#include "region.h"
#include "user.h"
#include "debugtools.h"
......@@ -79,109 +75,9 @@ BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc,
const RECT *prLClip, HRGN hrgnUpdate,
LPRECT rcUpdate )
{
RECT rect, rClip, rSrc;
POINT src, dest;
DC *dc = DC_GetDCUpdate( hdc );
TRACE("%04x %d,%d hrgnUpdate=%04x rcUpdate = %p cliprc = (%d,%d-%d,%d), rc=(%d,%d-%d,%d)\n",
(HDC16)hdc, dx, dy, hrgnUpdate, rcUpdate,
prLClip ? prLClip->left : 0, prLClip ? prLClip->top : 0, prLClip ? prLClip->right : 0, prLClip ? prLClip->bottom : 0,
rc ? rc->left : 0, rc ? rc->top : 0, rc ? rc->right : 0, rc ? rc->bottom : 0 );
if ( !dc || !hdc ) return FALSE;
/*
TRACE(scroll,"\t[wndOrgX=%i, wndExtX=%i, vportOrgX=%i, vportExtX=%i]\n",
dc->wndOrgX, dc->wndExtX, dc->vportOrgX, dc->vportExtX );
TRACE(scroll,"\t[wndOrgY=%i, wndExtY=%i, vportOrgY=%i, vportExtY=%i]\n",
dc->wndOrgY, dc->wndExtY, dc->vportOrgY, dc->vportExtY );
*/
/* compute device clipping region (in device coordinates) */
if ( rc )
rect = *rc;
else /* maybe we should just return FALSE? */
GetClipBox( hdc, &rect );
LPtoDP( hdc, (LPPOINT)&rect, 2 );
if (prLClip)
{
rClip = *prLClip;
LPtoDP( hdc, (LPPOINT)&rClip, 2 );
IntersectRect( &rClip, &rect, &rClip );
}
else
rClip = rect;
dx = XLPTODP ( dc, rect.left + dx ) - XLPTODP ( dc, rect.left );
dy = YLPTODP ( dc, rect.top + dy ) - YLPTODP ( dc, rect.top );
rSrc = rClip;
OffsetRect( &rSrc, -dx, -dy );
IntersectRect( &rSrc, &rSrc, &rect );
if(dc->hVisRgn)
{
if (!IsRectEmpty(&rSrc))
{
dest.x = (src.x = rSrc.left) + dx;
dest.y = (src.y = rSrc.top) + dy;
/* copy bits */
DPtoLP( hdc, (LPPOINT)&rSrc, 2 );
DPtoLP( hdc, &src, 1 );
DPtoLP( hdc, &dest, 1 );
if (!BitBlt( hdc, dest.x, dest.y,
rSrc.right - rSrc.left, rSrc.bottom - rSrc.top,
hdc, src.x, src.y, SRCCOPY))
{
GDI_ReleaseObj( hdc );
return FALSE;
}
}
/* compute update areas */
if (hrgnUpdate || rcUpdate)
{
HRGN hrgn =
(hrgnUpdate) ? hrgnUpdate : CreateRectRgn( 0,0,0,0 );
HRGN hrgn2;
hrgn2 = CreateRectRgnIndirect( &rect );
OffsetRgn( hrgn2, dc->DCOrgX, dc->DCOrgY );
CombineRgn( hrgn2, hrgn2, dc->hVisRgn, RGN_AND );
OffsetRgn( hrgn2, -dc->DCOrgX, -dc->DCOrgY );
SetRectRgn( hrgn, rClip.left, rClip.top,
rClip.right, rClip.bottom );
CombineRgn( hrgn, hrgn, hrgn2, RGN_AND );
OffsetRgn( hrgn2, dx, dy );
CombineRgn( hrgn, hrgn, hrgn2, RGN_DIFF );
if( rcUpdate )
{
GetRgnBox( hrgn, rcUpdate );
/* Put the rcUpdate in logical coordinate */
DPtoLP( hdc, (LPPOINT)rcUpdate, 2 );
}
if (!hrgnUpdate) DeleteObject( hrgn );
DeleteObject( hrgn2 );
}
}
else
{
if (hrgnUpdate) SetRectRgn(hrgnUpdate, 0, 0, 0, 0);
if (rcUpdate) SetRectEmpty(rcUpdate);
}
GDI_ReleaseObj( hdc );
return TRUE;
if (USER_Driver.pScrollDC)
return USER_Driver.pScrollDC( hdc, dx, dy, rc, prLClip, hrgnUpdate, rcUpdate );
return FALSE;
}
......
......@@ -553,6 +553,7 @@ BOOL WIN_CreateDesktopWindow(void)
DWORD clsStyle;
WNDPROC winproc;
DCE *dce;
CREATESTRUCTA cs;
TRACE("Creating desktop window\n");
......@@ -601,9 +602,21 @@ BOOL WIN_CreateDesktopWindow(void)
pWndDesktop->cbWndExtra = wndExtra;
pWndDesktop->irefCount = 0;
if (!USER_Driver.pCreateWindow( hwndDesktop )) return FALSE;
cs.lpCreateParams = NULL;
cs.hInstance = 0;
cs.hMenu = 0;
cs.hwndParent = 0;
cs.x = 0;
cs.y = 0;
cs.cx = pWndDesktop->rectWindow.right;
cs.cy = pWndDesktop->rectWindow.bottom;
cs.style = pWndDesktop->dwStyle;
cs.dwExStyle = pWndDesktop->dwExStyle;
cs.lpszName = NULL;
cs.lpszClass = DESKTOP_CLASS_ATOM;
if (!USER_Driver.pCreateWindow( hwndDesktop, &cs )) return FALSE;
SendMessageW( hwndDesktop, WM_NCCREATE, 0, 0 );
pWndDesktop->flags |= WIN_NEEDS_ERASEBKGND;
return TRUE;
}
......@@ -685,14 +698,12 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
INT sw = SW_SHOW;
struct tagCLASS *classPtr;
WND *wndPtr;
HWND retvalue;
HWND16 hwnd, hwndLinkAfter;
HWND hwnd, hwndLinkAfter;
POINT maxSize, maxPos, minTrack, maxTrack;
INT wndExtra;
DWORD clsStyle;
WNDPROC winproc;
DCE *dce;
LRESULT CALLBACK (*localSend32)(HWND, UINT, WPARAM, LPARAM);
TRACE("%s %s %08lx %08lx %d,%d %dx%d %04x %04x %08x %p\n",
(type == WIN_PROC_32W) ? debugres_w((LPWSTR)cs->lpszName) : debugres_a(cs->lpszName),
......@@ -811,7 +822,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
TRACE("CBT-hook returned 0\n");
USER_HEAP_FREE( hwnd );
CLASS_RemoveWindow( classPtr );
retvalue = 0;
hwnd = 0;
goto end;
}
}
......@@ -862,12 +873,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
wndPtr->rectWindow.bottom = cs->y + cs->cy;
wndPtr->rectClient = wndPtr->rectWindow;
if (!USER_Driver.pCreateWindow(wndPtr->hwndSelf))
{
retvalue = FALSE;
goto end;
}
/* Set the window menu */
if ((wndPtr->dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
......@@ -889,96 +894,44 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
}
else wndPtr->wIDmenu = (UINT)cs->hMenu;
/* Send the WM_CREATE message
* Perhaps we shouldn't allow width/height changes as well.
* See p327 in "Internals".
*/
maxPos.x = wndPtr->rectWindow.left; maxPos.y = wndPtr->rectWindow.top;
localSend32 = (type == WIN_PROC_32W) ? SendMessageW : SendMessageA;
if( (*localSend32)( hwnd, WM_NCCREATE, 0, (LPARAM)cs) )
if (!USER_Driver.pCreateWindow( wndPtr->hwndSelf, cs ))
{
/* Insert the window in the linked list */
WARN("aborted by WM_xxCREATE!\n");
WIN_ReleaseWndPtr(WIN_DestroyWindow( wndPtr ));
CLASS_RemoveWindow( classPtr );
WIN_ReleaseWndPtr(wndPtr);
return 0;
}
WIN_LinkWindow( hwnd, hwndLinkAfter );
if( (wndPtr->dwStyle & WS_CHILD) && !(wndPtr->dwExStyle & WS_EX_NOPARENTNOTIFY) )
{
/* Notify the parent window only */
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
OffsetRect(&wndPtr->rectWindow, maxPos.x - wndPtr->rectWindow.left,
maxPos.y - wndPtr->rectWindow.top);
if( ((*localSend32)( hwnd, WM_CREATE, 0, (LPARAM)cs )) != -1 )
SendMessageA( wndPtr->parent->hwndSelf, WM_PARENTNOTIFY,
MAKEWPARAM(WM_CREATE, wndPtr->wIDmenu), (LPARAM)hwnd );
if( !IsWindow(hwnd) )
{
/* Send the size messages */
if (!(wndPtr->flags & WIN_NEED_SIZE))
{
/* send it anyway */
if (((wndPtr->rectClient.right-wndPtr->rectClient.left) <0)
||((wndPtr->rectClient.bottom-wndPtr->rectClient.top)<0))
WARN("sending bogus WM_SIZE message 0x%08lx\n",
MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
wndPtr->rectClient.bottom-wndPtr->rectClient.top));
(*localSend32)( hwnd, WM_SIZE, SIZE_RESTORED,
MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
wndPtr->rectClient.bottom-wndPtr->rectClient.top));
(*localSend32)( hwnd, WM_MOVE, 0,
MAKELONG( wndPtr->rectClient.left,
wndPtr->rectClient.top ) );
}
/* Show the window, maximizing or minimizing if needed */
if (wndPtr->dwStyle & (WS_MINIMIZE | WS_MAXIMIZE))
{
RECT16 newPos;
UINT16 swFlag = (wndPtr->dwStyle & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
wndPtr->dwStyle &= ~(WS_MAXIMIZE | WS_MINIMIZE);
WINPOS_MinMaximize( wndPtr, swFlag, &newPos );
swFlag = ((wndPtr->dwStyle & WS_CHILD) || GetActiveWindow())
? SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED
: SWP_NOZORDER | SWP_FRAMECHANGED;
SetWindowPos( hwnd, 0, newPos.left, newPos.top,
newPos.right, newPos.bottom, swFlag );
}
if( (wndPtr->dwStyle & WS_CHILD) && !(wndPtr->dwExStyle & WS_EX_NOPARENTNOTIFY) )
{
/* Notify the parent window only */
SendMessageA( wndPtr->parent->hwndSelf, WM_PARENTNOTIFY,
MAKEWPARAM(WM_CREATE, wndPtr->wIDmenu), (LPARAM)hwnd );
if( !IsWindow(hwnd) )
{
retvalue = 0;
goto end;
}
}
if (cs->style & WS_VISIBLE) ShowWindow( hwnd, sw );
/* Call WH_SHELL hook */
if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
HOOK_CallHooksA( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
TRACE("created window %04x\n", hwnd);
retvalue = hwnd;
hwnd = 0;
goto end;
}
WIN_UnlinkWindow( hwnd );
}
/* Abort window creation */
if (cs->style & WS_VISIBLE)
{
/* in case WS_VISIBLE got set in the meantime */
wndPtr->dwStyle &= ~WS_VISIBLE;
ShowWindow( hwnd, sw );
}
WARN("aborted by WM_xxCREATE!\n");
WIN_ReleaseWndPtr(WIN_DestroyWindow( wndPtr ));
CLASS_RemoveWindow( classPtr );
retvalue = 0;
end:
WIN_ReleaseWndPtr(wndPtr);
/* Call WH_SHELL hook */
return retvalue;
if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
HOOK_CallHooksA( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
TRACE("created window %04x\n", hwnd);
end:
WIN_ReleaseWndPtr(wndPtr);
return hwnd;
}
......@@ -2176,8 +2129,12 @@ INT WINAPI GetWindowTextA( HWND hwnd, LPSTR lpString, INT nMaxCount )
*/
INT WINAPI InternalGetWindowText(HWND hwnd,LPWSTR lpString,INT nMaxCount )
{
FIXME("(0x%08x,%p,0x%x),stub!\n",hwnd,lpString,nMaxCount);
return GetWindowTextW(hwnd,lpString,nMaxCount);
WND *win = WIN_FindWndPtr( hwnd );
if (!win) return 0;
if (win->text) lstrcpynW( lpString, win->text, nMaxCount );
else lpString[0] = 0;
WIN_ReleaseWndPtr( win );
return strlenW(lpString);
}
......
......@@ -315,7 +315,6 @@ int X11DRV_CLIPBOARD_CacheDataFormats( Atom SelectionName )
Display *display = thread_display();
HWND hWnd = 0;
HWND hWndClipWindow = GetOpenClipboardWindow();
WND* wnd = NULL;
XEvent xe;
Atom aTargets;
Atom atype=AnyPropertyType;
......@@ -343,10 +342,7 @@ int X11DRV_CLIPBOARD_CacheDataFormats( Atom SelectionName )
/*
* Query the selection owner for the TARGETS property
*/
wnd = WIN_FindWndPtr(hWnd);
w = X11DRV_WND_FindXWindow(wnd);
WIN_ReleaseWndPtr(wnd);
wnd = NULL;
w = X11DRV_get_top_window(hWnd);
aTargets = TSXInternAtom(display, "TARGETS", False);
......@@ -863,9 +859,7 @@ void X11DRV_AcquireClipboard(void)
if ( !(selectionAcquired == (S_PRIMARY | S_CLIPBOARD)) )
{
Atom xaClipboard = TSXInternAtom(display, _CLIPBOARD, False);
WND *tmpWnd = WIN_FindWndPtr( hWndClipWindow ? hWndClipWindow : AnyPopup() );
owner = X11DRV_WND_FindXWindow(tmpWnd );
WIN_ReleaseWndPtr(tmpWnd);
owner = X11DRV_get_top_window( hWndClipWindow ? hWndClipWindow : AnyPopup() );
/* Grab PRIMARY selection if not owned */
if ( !(selectionAcquired & S_PRIMARY) )
......@@ -1012,18 +1006,15 @@ BOOL X11DRV_GetClipboardData(UINT wFormat)
BOOL bRet = selectionAcquired;
HWND hWndClipWindow = GetOpenClipboardWindow();
HWND hWnd = (hWndClipWindow) ? hWndClipWindow : GetActiveWindow();
WND* wnd = NULL;
LPWINE_CLIPFORMAT lpFormat;
TRACE("%d\n", wFormat);
if( !selectionAcquired && (wnd = WIN_FindWndPtr(hWnd)) )
if (!selectionAcquired)
{
XEvent xe;
Atom propRequest;
Window w = X11DRV_WND_FindXWindow(wnd);
WIN_ReleaseWndPtr(wnd);
wnd = NULL;
Window w = X11DRV_get_top_window(hWnd);
/* Map the format ID requested to an X selection property.
* If the format is in the cache, use the atom associated
......@@ -1089,7 +1080,7 @@ void X11DRV_ResetSelectionOwner(WND *pWnd, BOOL bFooBar)
{
Display *display = thread_display();
HWND hWndClipOwner = 0;
Window XWnd = X11DRV_WND_GetXWindow(pWnd);
Window XWnd = get_whole_window(pWnd);
Atom xaClipboard;
BOOL bLostSelection = FALSE;
......@@ -1118,10 +1109,10 @@ void X11DRV_ResetSelectionOwner(WND *pWnd, BOOL bFooBar)
selectionWindow = None;
if( pWnd->next )
selectionWindow = X11DRV_WND_GetXWindow(pWnd->next);
selectionWindow = get_whole_window(pWnd->next);
else if( pWnd->parent )
if( pWnd->parent->child != pWnd )
selectionWindow = X11DRV_WND_GetXWindow(pWnd->parent->child);
selectionWindow = get_whole_window(pWnd->parent->child);
if( selectionWindow != None )
{
......
......@@ -708,7 +708,7 @@ void X11DRV_KEYBOARD_UpdateState ( void )
*
* Handle a X key event
*/
void X11DRV_KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
void X11DRV_KEYBOARD_HandleEvent( XKeyEvent *event, int x, int y )
{
char Str[24];
KeySym keysym;
......@@ -717,8 +717,6 @@ void X11DRV_KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
static BOOL force_extended = FALSE; /* hack for AltGr translation */
int ascii_chars;
INT event_x = (pWnd? pWnd->rectWindow.left : 0) + event->x;
INT event_y = (pWnd? pWnd->rectWindow.top : 0) + event->y;
DWORD event_time = event->time - X11DRV_server_startticks;
/* this allows support for dead keys */
......@@ -745,11 +743,11 @@ void X11DRV_KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
{
TRACE_(key)("Alt Gr key event received\n");
event->keycode = kcControl; /* Simulate Control */
X11DRV_KEYBOARD_HandleEvent( pWnd, event );
X11DRV_KEYBOARD_HandleEvent( event, x, y );
event->keycode = kcAlt; /* Simulate Alt */
force_extended = TRUE;
X11DRV_KEYBOARD_HandleEvent( pWnd, event );
X11DRV_KEYBOARD_HandleEvent( event, x, y );
force_extended = FALSE;
/* Here we save the pressed/released state of the AltGr key, to be able to
......@@ -783,13 +781,11 @@ void X11DRV_KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
switch (vkey & 0xff)
{
case VK_NUMLOCK:
KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, event->type, event_x, event_y,
event_time );
KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, event->type, x, y, event_time );
break;
case VK_CAPITAL:
TRACE("Caps Lock event. (type %d). State before : %#.2x\n",event->type,pKeyStateTable[vkey]);
KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, event->type, event_x, event_y,
event_time );
KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, event->type, x, y, event_time );
TRACE("State after : %#.2x\n",pKeyStateTable[vkey]);
break;
default:
......@@ -797,19 +793,15 @@ void X11DRV_KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
if (!(pKeyStateTable[VK_NUMLOCK] & 0x01) != !(event->state & NumLockMask))
{
TRACE("Adjusting NumLock state. \n");
KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, KeyPress, event_x, event_y,
event_time );
KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, KeyRelease, event_x, event_y,
event_time );
KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, KeyPress, x, y, event_time );
KEYBOARD_GenerateMsg( VK_NUMLOCK, 0x45, KeyRelease, x, y, event_time );
}
/* Adjust the CAPSLOCK state if it has been changed outside wine */
if (!(pKeyStateTable[VK_CAPITAL] & 0x01) != !(event->state & LockMask))
{
TRACE("Adjusting Caps Lock state.\n");
KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, KeyPress, event_x, event_y,
event_time );
KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, KeyRelease, event_x, event_y,
event_time );
KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, KeyPress, x, y, event_time );
KEYBOARD_GenerateMsg( VK_CAPITAL, 0x3A, KeyRelease, x, y, event_time );
}
/* Not Num nor Caps : end of intermediary states for both. */
NumState = FALSE;
......@@ -823,8 +815,7 @@ void X11DRV_KEYBOARD_HandleEvent( WND *pWnd, XKeyEvent *event )
if ( vkey & 0x100 ) dwFlags |= KEYEVENTF_EXTENDEDKEY;
if ( force_extended ) dwFlags |= KEYEVENTF_WINE_FORCEEXTENDED;
KEYBOARD_SendEvent( vkey & 0xff, bScan, dwFlags,
event_x, event_y, event_time );
KEYBOARD_SendEvent( vkey & 0xff, bScan, dwFlags, x, y, event_time );
}
}
}
......
......@@ -154,13 +154,8 @@ Cursor X11DRV_GetCursor( Display *display, CURSORICONINFO *ptr )
/* set the cursor of a window; helper for X11DRV_SetCursor */
static BOOL CALLBACK set_win_cursor( HWND hwnd, LPARAM cursor )
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr)
{
Window win = X11DRV_WND_GetXWindow(wndPtr);
if (win) TSXDefineCursor( thread_display(), win, (Cursor)cursor );
}
WIN_ReleaseWndPtr( wndPtr );
Window win = X11DRV_get_whole_window( hwnd );
if (win) TSXDefineCursor( thread_display(), win, (Cursor)cursor );
return TRUE;
}
......
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