Commit 9ae0fe54 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved most of the implementation of SetWindowPos and SetDrawable into

the user driver, and the corresponding code into the dlls/x11drv directory. Moved a few functions out of the window driver into the user driver. Plus a few related cleanups.
parent 56a45b20
......@@ -239,7 +239,7 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
GDI_ReleaseObj( dc->hBitmap );
} else {
physDev->window = TTYDRV_GetRootWindow();
physDev->window = root_window;
physDev->cellWidth = cell_width;
physDev->cellHeight = cell_height;
......
......@@ -29,7 +29,6 @@ struct tagWND;
struct tagCURSORICONINFO;
struct tagCREATESTRUCTA;
struct tagWINDOWPOS;
struct tagKEYBOARD_CONFIG;
struct DIDEVICEOBJECTDATA;
#if defined(HAVE_LIBCURSES) || defined(HAVE_LIBNCURSES)
......@@ -127,36 +126,17 @@ extern int cell_height;
extern int screen_rows;
extern int screen_cols;
extern WINDOW *root_window;
static inline WINDOW *TTYDRV_GetRootWindow(void) { return root_window; }
/* TTY windows driver */
extern struct tagWND_DRIVER TTYDRV_WND_Driver;
typedef struct tagTTYDRV_WND_DATA {
WINDOW *window;
} TTYDRV_WND_DATA;
WINDOW *TTYDRV_WND_GetCursesWindow(struct tagWND *wndPtr);
extern HANDLE TTYDRV_LoadOEMResource(WORD resid, WORD type);
extern void TTYDRV_WND_Initialize(struct tagWND *wndPtr);
extern void TTYDRV_WND_Finalize(struct tagWND *wndPtr);
extern BOOL TTYDRV_WND_CreateDesktopWindow(struct tagWND *wndPtr);
extern BOOL TTYDRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCREATESTRUCTA *cs, BOOL bUnicode);
extern BOOL TTYDRV_WND_DestroyWindow(struct tagWND *pWnd);
extern struct tagWND *TTYDRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
extern void TTYDRV_WND_ForceWindowRaise(struct tagWND *pWnd);
extern void TTYDRV_WND_SetWindowPos(struct tagWND *wndPtr, const struct tagWINDOWPOS *winpos, BOOL bSMC_SETXPOS);
extern void TTYDRV_WND_SetText(struct tagWND *wndPtr, LPCWSTR text);
extern void TTYDRV_WND_SetFocus(struct tagWND *wndPtr);
extern void TTYDRV_WND_PreSizeMove(struct tagWND *wndPtr);
extern void TTYDRV_WND_PostSizeMove(struct tagWND *wndPtr);
extern void TTYDRV_WND_ScrollWindow(struct tagWND *wndPtr, HDC hdc, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
extern void TTYDRV_WND_SetDrawable(struct tagWND *wndPtr, HDC hdc, 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) */
......@@ -11,8 +11,6 @@ debug_channels (ttydrv)
# USER driver
@ cdecl Synchronize() TTYDRV_Synchronize
@ cdecl CheckFocus() TTYDRV_CheckFocus
@ cdecl UserRepaintDisable(long) TTYDRV_UserRepaintDisable
@ cdecl InitKeyboard() TTYDRV_InitKeyboard
@ cdecl VkKeyScan(long) TTYDRV_VkKeyScan
......@@ -24,8 +22,6 @@ debug_channels (ttydrv)
@ cdecl Beep() TTYDRV_Beep
@ cdecl GetDIState(long ptr) TTYDRV_GetDIState
@ cdecl GetDIData(ptr long ptr ptr long) TTYDRV_GetDIData
@ cdecl GetKeyboardConfig(ptr) TTYDRV_GetKeyboardConfig
@ cdecl SetKeyboardConfig(ptr long) TTYDRV_SetKeyboardConfig
@ cdecl InitMouse(ptr) TTYDRV_InitMouse
@ cdecl SetCursor(ptr) TTYDRV_SetCursor
@ cdecl MoveCursor(long long) TTYDRV_MoveCursor
......@@ -34,6 +30,10 @@ debug_channels (ttydrv)
@ cdecl GetScreenSaveTimeout() TTYDRV_GetScreenSaveTimeout
@ cdecl SetScreenSaveTimeout(long) TTYDRV_SetScreenSaveTimeout
@ cdecl LoadOEMResource(long long) TTYDRV_LoadOEMResource
@ cdecl CreateWindow(long) TTYDRV_CreateWindow
@ cdecl DestroyWindow(long) TTYDRV_DestroyWindow
@ cdecl GetDC(long long long long) TTYDRV_GetDC
@ cdecl SetWindowPos(ptr) TTYDRV_SetWindowPos
@ cdecl IsSingleWindow() TTYDRV_IsSingleWindow
@ cdecl AcquireClipboard() TTYDRV_AcquireClipboard
@ cdecl ReleaseClipboard() TTYDRV_ReleaseClipboard
......
......@@ -12,21 +12,6 @@
DEFAULT_DEBUG_CHANNEL(ttydrv);
/***********************************************************************
* TTYDRV_Synchronize
*/
void TTYDRV_Synchronize( void )
{
}
/***********************************************************************
* TTYDRV_CheckFocus
*/
BOOL TTYDRV_CheckFocus(void)
{
return TRUE;
}
/***********************************************************************
* TTYDRV_UserRepaintDisable
*/
void TTYDRV_UserRepaintDisable( BOOL bDisable )
......@@ -118,20 +103,6 @@ BOOL TTYDRV_GetDIData( BYTE *keystate, DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
}
/***********************************************************************
* TTYDRV_GetKeyboardConfig
*/
void TTYDRV_GetKeyboardConfig(KEYBOARD_CONFIG *cfg)
{
}
/***********************************************************************
* TTYDRV_SetKeyboardConfig
*/
extern void TTYDRV_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask)
{
}
/***********************************************************************
* TTYDRV_InitMouse
*/
void TTYDRV_InitMouse(LPMOUSE_EVENT_PROC proc)
......
......@@ -58,8 +58,6 @@ static BOOL load_driver(void)
return FALSE;
}
GET_USER_FUNC(Synchronize);
GET_USER_FUNC(CheckFocus);
GET_USER_FUNC(UserRepaintDisable);
GET_USER_FUNC(InitKeyboard);
GET_USER_FUNC(VkKeyScan);
......@@ -71,8 +69,6 @@ static BOOL load_driver(void)
GET_USER_FUNC(Beep);
GET_USER_FUNC(GetDIState);
GET_USER_FUNC(GetDIData);
GET_USER_FUNC(GetKeyboardConfig);
GET_USER_FUNC(SetKeyboardConfig);
GET_USER_FUNC(InitMouse);
GET_USER_FUNC(SetCursor);
GET_USER_FUNC(MoveCursor);
......@@ -90,6 +86,16 @@ static BOOL load_driver(void)
GET_USER_FUNC(RegisterClipboardFormat);
GET_USER_FUNC(IsSelectionOwner);
GET_USER_FUNC(ResetSelectionOwner);
GET_USER_FUNC(CreateWindow);
GET_USER_FUNC(DestroyWindow);
GET_USER_FUNC(GetDC);
GET_USER_FUNC(EnableWindow);
GET_USER_FUNC(SetFocus);
GET_USER_FUNC(SetParent);
GET_USER_FUNC(SetWindowPos);
GET_USER_FUNC(SetWindowRgn);
GET_USER_FUNC(SetWindowIcon);
GET_USER_FUNC(SetWindowText);
return TRUE;
}
......
......@@ -8,6 +8,8 @@ IMPORTS = user32 gdi32 kernel32
C_SRCS = \
dga2.c \
window.c \
winpos.c \
x11ddraw.c \
x11drv_main.c \
xvidmode.c
......
......@@ -11,8 +11,6 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
# USER driver
@ cdecl Synchronize() X11DRV_Synchronize
@ cdecl CheckFocus() X11DRV_CheckFocus
@ cdecl UserRepaintDisable(long) X11DRV_UserRepaintDisable
@ cdecl InitKeyboard() X11DRV_InitKeyboard
@ cdecl VkKeyScan(long) X11DRV_VkKeyScan
......@@ -24,8 +22,6 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
@ cdecl Beep() X11DRV_Beep
@ cdecl GetDIState(long ptr) X11DRV_GetDIState
@ cdecl GetDIData(ptr long ptr ptr long) X11DRV_GetDIData
@ cdecl GetKeyboardConfig(ptr) X11DRV_GetKeyboardConfig
@ cdecl SetKeyboardConfig(ptr long) X11DRV_SetKeyboardConfig
@ cdecl InitMouse(ptr) X11DRV_InitMouse
@ cdecl SetCursor(ptr) X11DRV_SetCursor
@ cdecl MoveCursor(long long) X11DRV_MoveCursor
......@@ -34,6 +30,16 @@ 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 DestroyWindow(long) X11DRV_DestroyWindow
@ cdecl GetDC(long long long long) X11DRV_GetDC
@ cdecl EnableWindow(long long) X11DRV_EnableWindow
@ cdecl SetFocus(long) X11DRV_SetFocus
@ cdecl SetParent(long long) X11DRV_SetParent
@ cdecl SetWindowPos(ptr) X11DRV_SetWindowPos
@ cdecl SetWindowRgn(long long) X11DRV_SetWindowRgn
@ cdecl SetWindowIcon(long long long) X11DRV_SetWindowIcon
@ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
@ cdecl IsSingleWindow() X11DRV_IsSingleWindow
@ cdecl AcquireClipboard() X11DRV_AcquireClipboard
@ cdecl ReleaseClipboard() X11DRV_ReleaseClipboard
......
......@@ -42,7 +42,6 @@ extern DCE* DCE_AllocDCE( HWND hWnd, DCE_TYPE type );
extern DCE* DCE_FreeDCE( DCE *dce );
extern void DCE_FreeWindowDCE( struct tagWND* );
extern INT DCE_ExcludeRgn( HDC, struct tagWND*, HRGN );
extern HRGN DCE_GetVisRgn( HWND, WORD, HWND, WORD );
extern BOOL DCE_InvalidateDCE( struct tagWND*, const RECT* );
#endif /* __WINE_DCE_H */
......@@ -25,10 +25,6 @@ extern BOOL TIMER_GetTimerMsg( struct tagMSG *msg, HWND hwnd,
HQUEUE16 hQueue, BOOL remove );
extern BOOL TIMER_IsTimerValid( HWND hwnd, UINT id, HWINDOWPROC hProc );
/* event.c */
extern void EVENT_Synchronize( void );
extern BOOL EVENT_CheckFocus( void );
/* input.c */
extern HWND EVENT_Capture( HWND, INT16 );
......
......@@ -7,6 +7,10 @@
#ifndef __WINE_USER_H
#define __WINE_USER_H
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "local.h"
extern WORD USER_HeapSel;
......@@ -29,19 +33,12 @@ extern WORD USER_HeapSel;
struct tagCURSORICONINFO;
struct DIDEVICEOBJECTDATA;
#define WINE_KEYBOARD_CONFIG_AUTO_REPEAT 0x00000001
typedef struct tagKEYBOARD_CONFIG {
BOOL auto_repeat;
} KEYBOARD_CONFIG;
typedef VOID CALLBACK (*LPMOUSE_EVENT_PROC)(DWORD,DWORD,DWORD,DWORD,DWORD);
struct tagWND;
typedef struct tagUSER_DRIVER {
/* event functions */
void (*pSynchronize)(void);
BOOL (*pCheckFocus)(void);
void (*pUserRepaintDisable)(BOOL);
/* keyboard functions */
void (*pInitKeyboard)(void);
......@@ -54,8 +51,6 @@ typedef struct tagUSER_DRIVER {
void (*pBeep)(void);
BOOL (*pGetDIState)(DWORD, LPVOID);
BOOL (*pGetDIData)(BYTE *, DWORD, struct DIDEVICEOBJECTDATA *, LPDWORD, DWORD);
void (*pGetKeyboardConfig)(KEYBOARD_CONFIG *);
void (*pSetKeyboardConfig)(KEYBOARD_CONFIG *, DWORD);
/* mouse functions */
void (*pInitMouse)(LPMOUSE_EVENT_PROC);
void (*pSetCursor)(struct tagCURSORICONINFO *);
......@@ -67,8 +62,6 @@ typedef struct tagUSER_DRIVER {
void (*pSetScreenSaveTimeout)(int);
/* resource functions */
HANDLE (*pLoadOEMResource)(WORD,WORD);
/* windowing functions */
BOOL (*pIsSingleWindow)(void);
/* clipboard functions */
void (*pAcquireClipboard)(void); /* Acquire selection */
void (*pReleaseClipboard)(void); /* Release selection */
......@@ -78,6 +71,19 @@ typedef struct tagUSER_DRIVER {
BOOL (*pRegisterClipboardFormat)(LPCSTR); /* Register a clipboard format */
BOOL (*pIsSelectionOwner)(void); /* Check if we own the selection */
void (*pResetSelectionOwner)(struct tagWND *, BOOL);
/* windowing functions */
BOOL (*pCreateWindow)(HWND);
BOOL (*pDestroyWindow)(HWND);
BOOL (*pGetDC)(HWND,HDC,HRGN,DWORD);
BOOL (*pEnableWindow)(HWND,BOOL);
void (*pSetFocus)(HWND);
HWND (*pSetParent)(HWND,HWND);
BOOL (*pSetWindowPos)(WINDOWPOS *);
BOOL (*pSetWindowRgn)(HWND,HRGN,BOOL);
HICON (*pSetWindowIcon)(HWND,HICON,BOOL);
BOOL (*pSetWindowText)(HWND,LPCWSTR);
BOOL (*pIsSingleWindow)(void);
} USER_DRIVER;
extern USER_DRIVER USER_Driver;
......
......@@ -66,45 +66,15 @@ typedef struct tagWND
} WND;
/* Host attributes */
#define HAK_BITGRAVITY 1
#define HAK_ACCEPTFOCUS 2
#define HAK_ICONICSTATE 3
#define HAK_ICONS 4
/* Bit Gravity */
#define BGForget 0
#define BGNorthWest 1
#define BGNorth 2
#define BGNorthEast 3
#define BGWest 4
#define BGCenter 5
#define BGEast 6
#define BGSouthWest 7
#define BGSouth 8
#define BGSouthEast 9
#define BGStatic 10
typedef struct tagWND_DRIVER
{
void (*pInitialize)(WND *);
void (*pFinalize)(WND *);
BOOL (*pCreateDesktopWindow)(WND *);
BOOL (*pCreateWindow)(WND *, CREATESTRUCTA *, BOOL);
BOOL (*pDestroyWindow)(WND *);
WND* (*pSetParent)(WND *, WND *);
void (*pForceWindowRaise)(WND *);
void (*pSetWindowPos)(WND *, const WINDOWPOS *, BOOL);
void (*pSetText)(WND *, LPCWSTR);
void (*pSetFocus)(WND *);
void (*pPreSizeMove)(WND *);
void (*pPostSizeMove)(WND *);
void (*pSurfaceCopy)(WND *, HDC, INT, INT, const RECT *, BOOL);
void (*pSetDrawable)(WND *, HDC, WORD, BOOL);
BOOL (*pSetHostAttr)(WND *, INT haKey, INT value);
BOOL (*pIsSelfClipping)(WND *);
void (*pSetWindowRgn)(WND *, const HRGN);
} WND_DRIVER;
extern WND_DRIVER *WND_Driver;
......
......@@ -14,8 +14,6 @@
struct tagWND;
#define DWP_MAGIC ((INT)('W' | ('P' << 8) | ('O' << 16) | ('S' << 24)))
/* undocumented SWP flags - from SDK 3.1 */
#define SWP_NOCLIENTSIZE 0x0800
#define SWP_NOCLIENTMOVE 0x1000
......@@ -25,16 +23,6 @@ struct tagWND;
struct tagWINDOWPOS16;
typedef struct
{
INT actualCount;
INT suggestedCount;
BOOL valid;
INT wMagic;
HWND hwndParent;
WINDOWPOS winPos[1];
} DWP;
extern BOOL WINPOS_RedrawIconTitle( HWND hWnd );
extern BOOL WINPOS_ShowIconTitle( struct tagWND* pWnd, BOOL bShow );
extern void WINPOS_GetMinMaxInfo( struct tagWND* pWnd, POINT *maxSize,
......
......@@ -31,7 +31,6 @@ struct tagDeviceCaps;
struct tagPALETTEOBJ;
struct tagWND;
struct tagWINDOWPOS;
struct tagKEYBOARD_CONFIG;
struct DIDEVICEOBJECTDATA;
/* X physical pen */
......@@ -364,8 +363,6 @@ extern UINT16 X11DRV_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
extern INT16 X11DRV_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
extern BOOL X11DRV_GetDIState(DWORD len, LPVOID ptr);
extern BOOL X11DRV_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
extern void X11DRV_GetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg);
extern void X11DRV_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DWORD mask);
extern void X11DRV_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
......@@ -391,28 +388,20 @@ typedef struct _X11DRV_WND_DATA {
extern Window X11DRV_WND_GetXWindow(struct tagWND *wndPtr);
extern Window X11DRV_WND_FindXWindow(struct tagWND *wndPtr);
extern void X11DRV_WND_Initialize(struct tagWND *wndPtr);
extern void X11DRV_WND_Finalize(struct tagWND *wndPtr);
extern BOOL X11DRV_WND_CreateDesktopWindow(struct tagWND *wndPtr);
extern BOOL X11DRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCREATESTRUCTA *cs, BOOL bUnicode);
extern BOOL X11DRV_WND_DestroyWindow(struct tagWND *pWnd);
extern struct tagWND *X11DRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
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_SetFocus(struct tagWND *wndPtr);
extern void X11DRV_WND_PreSizeMove(struct tagWND *wndPtr);
extern void X11DRV_WND_PostSizeMove(struct tagWND *wndPtr);
extern void X11DRV_WND_SurfaceCopy(struct tagWND *wndPtr, HDC hdc, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, HDC hdc, WORD flags, BOOL bSetClipOrigin);
extern void X11DRV_WND_SetGravity(struct tagWND* wndPtr, int value );
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 );
extern void X11DRV_EVENT_WaitShmCompletions( Drawable dw );
extern void X11DRV_EVENT_WaitReplaceShmCompletion( int *compl, Drawable dw );
extern void X11DRV_SetFocus( HWND hwnd );
#endif /* __WINE_X11DRV_H */
......@@ -16,7 +16,6 @@ C_SRCS = \
defwnd.c \
dialog.c \
driver.c \
event.c \
focus.c \
hook.c \
input.c \
......
......@@ -72,7 +72,8 @@ void DEFWND_SetTextA( WND *wndPtr, LPCSTR text )
else
ERR("Not enough memory for window text");
wndPtr->pDriver->pSetText(wndPtr, wndPtr->text);
if (USER_Driver.pSetWindowText)
USER_Driver.pSetWindowText(wndPtr->hwndSelf, wndPtr->text);
}
/***********************************************************************
......@@ -94,7 +95,8 @@ void DEFWND_SetTextW( WND *wndPtr, LPCWSTR text )
else
ERR("Not enough memory for window text");
wndPtr->pDriver->pSetText(wndPtr, wndPtr->text);
if (USER_Driver.pSetWindowText)
USER_Driver.pSetWindowText(wndPtr->hwndSelf, wndPtr->text);
}
/***********************************************************************
......@@ -165,7 +167,7 @@ static void DEFWND_SetRedraw( WND* wndPtr, WPARAM wParam )
if( wndPtr->dwStyle & WS_MINIMIZE ) wParam = RDW_VALIDATE;
else wParam = RDW_ALLCHILDREN | RDW_VALIDATE;
PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0, wParam, 0 );
RedrawWindow( wndPtr->hwndSelf, NULL, 0, wParam );
DCE_InvalidateDCE( wndPtr, &wndPtr->rectWindow );
wndPtr->dwStyle &= ~WS_VISIBLE;
}
......@@ -623,6 +625,9 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
return 1;
case WM_SETICON:
if (USER_Driver.pSetWindowIcon)
return USER_Driver.pSetWindowIcon( wndPtr->hwndSelf, lParam, (wParam != ICON_SMALL) );
else
{
int index = (wParam != ICON_SMALL) ? GCL_HICON : GCL_HICONSM;
HICON hOldIcon = GetClassLongW(wndPtr->hwndSelf, index);
......@@ -631,10 +636,6 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
SetWindowPos(wndPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED
| SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE
| SWP_NOZORDER);
if( wndPtr->flags & WIN_NATIVE )
wndPtr->pDriver->pSetHostAttr(wndPtr, HAK_ICONS, 0);
return hOldIcon;
}
......
/*
* X events handling functions
*
* Copyright 1993 Alexandre Julliard
*
*/
#include "message.h"
#include "user.h"
#include "win.h"
#include "debugtools.h"
DECLARE_DEBUG_CHANNEL(event);
/***********************************************************************
* EVENT_Synchronize
*
* Synchronize with the X server. Should not be used too often.
*/
void EVENT_Synchronize( void )
{
int iWndsLocks = WIN_SuspendWndsLock();
USER_Driver.pSynchronize();
WIN_RestoreWndsLock(iWndsLocks);
}
/**********************************************************************
* EVENT_CheckFocus
*/
BOOL EVENT_CheckFocus(void)
{
return USER_Driver.pCheckFocus();
}
......@@ -15,6 +15,7 @@
#include "hook.h"
#include "message.h"
#include "queue.h"
#include "user.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(win);
......@@ -26,35 +27,20 @@ DEFAULT_DEBUG_CHANNEL(win);
*/
void FOCUS_SwitchFocus( MESSAGEQUEUE *pMsgQ, HWND hFocusFrom, HWND hFocusTo )
{
WND *pFocusTo = WIN_FindWndPtr( hFocusTo );
PERQDATA_SetFocusWnd( pMsgQ->pQData, hFocusTo );
#if 0
if (hFocusFrom) SendMessageA( hFocusFrom, WM_KILLFOCUS, hFocusTo, 0 );
#else
/* FIXME: must be SendMessage16() because 32A doesn't do
* intertask at this time */
if (hFocusFrom) SendMessage16( hFocusFrom, WM_KILLFOCUS, hFocusTo, 0 );
#endif
if( !pFocusTo || hFocusTo != PERQDATA_GetFocusWnd( pMsgQ->pQData ) )
if( !hFocusTo || hFocusTo != PERQDATA_GetFocusWnd( pMsgQ->pQData ) )
{
WIN_ReleaseWndPtr(pFocusTo);
return;
}
/* According to API docs, the WM_SETFOCUS message is sent AFTER the window
has received the keyboard focus. */
if (USER_Driver.pSetFocus) USER_Driver.pSetFocus(hFocusTo);
pFocusTo->pDriver->pSetFocus(pFocusTo);
WIN_ReleaseWndPtr(pFocusTo);
#if 0
SendMessageA( hFocusTo, WM_SETFOCUS, hFocusFrom, 0 );
#else
SendMessage16( hFocusTo, WM_SETFOCUS, hFocusFrom, 0 );
#endif
}
......
......@@ -2458,8 +2458,8 @@ LONG WINAPI DispatchMessageA( const MSG* msg )
msg->hwnd);
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
/* Validate the update region to avoid infinite WM_PAINT loop */
PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0,
RDW_FRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT, 0 );
RedrawWindow( wndPtr->hwndSelf, NULL, 0,
RDW_FRAME | RDW_VALIDATE | RDW_NOCHILDREN | RDW_NOINTERNALPAINT );
}
END:
WIN_ReleaseWndPtr(wndPtr);
......
......@@ -988,8 +988,7 @@ BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
CONV_RECT16TO32( rectUpdate, &r );
return (BOOL16)RedrawWindow( (HWND)hwnd, &r, hrgnUpdate, flags );
}
return (BOOL16)PAINT_RedrawWindow( (HWND)hwnd, NULL,
(HRGN)hrgnUpdate, flags, 0 );
return RedrawWindow( hwnd, NULL, hrgnUpdate, flags );
}
......@@ -998,7 +997,7 @@ BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
*/
void WINAPI UpdateWindow16( HWND16 hwnd )
{
PAINT_RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN, 0 );
RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
}
/***********************************************************************
......@@ -1006,7 +1005,7 @@ void WINAPI UpdateWindow16( HWND16 hwnd )
*/
void WINAPI UpdateWindow( HWND hwnd )
{
PAINT_RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN, 0 );
RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
}
/***********************************************************************
......@@ -1014,8 +1013,7 @@ void WINAPI UpdateWindow( HWND hwnd )
*/
void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
{
PAINT_RedrawWindow((HWND)hwnd, NULL, (HRGN)hrgn,
RDW_INVALIDATE | (erase ? RDW_ERASE : 0), 0 );
RedrawWindow((HWND)hwnd, NULL, (HRGN)hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
}
......@@ -1024,7 +1022,7 @@ void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
*/
BOOL WINAPI InvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
{
return PAINT_RedrawWindow(hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0), 0 );
return RedrawWindow(hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
}
......@@ -1042,8 +1040,7 @@ void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
*/
BOOL WINAPI InvalidateRect( HWND hwnd, const RECT *rect, BOOL erase )
{
return PAINT_RedrawWindow( hwnd, rect, 0,
RDW_INVALIDATE | (erase ? RDW_ERASE : 0), 0 );
return RedrawWindow( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
}
......@@ -1052,8 +1049,7 @@ BOOL WINAPI InvalidateRect( HWND hwnd, const RECT *rect, BOOL erase )
*/
void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
{
PAINT_RedrawWindow( (HWND)hwnd, NULL, (HRGN)hrgn,
RDW_VALIDATE | RDW_NOCHILDREN, 0 );
RedrawWindow( (HWND)hwnd, NULL, (HRGN)hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
}
......@@ -1062,7 +1058,7 @@ void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
*/
void WINAPI ValidateRgn( HWND hwnd, HRGN hrgn )
{
PAINT_RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN, 0 );
RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
}
......@@ -1080,7 +1076,7 @@ void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
*/
void WINAPI ValidateRect( HWND hwnd, const RECT *rect )
{
PAINT_RedrawWindow( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN, 0 );
RedrawWindow( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
}
......
......@@ -336,8 +336,9 @@ rc.left, rc.top, rc.right, rc.bottom, (UINT16)flags );
}
if( flags & (SW_INVALIDATE | SW_ERASE) )
PAINT_RedrawWindow( hwnd, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE |
((flags & SW_ERASE) ? RDW_ERASENOW : 0) | ((flags & SW_SCROLLCHILDREN) ? RDW_ALLCHILDREN : 0 ), 0 );
RedrawWindow( hwnd, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE |
((flags & SW_ERASE) ? RDW_ERASENOW : 0) |
((flags & SW_SCROLLCHILDREN) ? RDW_ALLCHILDREN : 0 ) );
if( bCaret )
{
......
......@@ -455,8 +455,6 @@ static WND* WIN_DestroyWindow( WND* wndPtr )
TIMER_RemoveWindowTimers( wndPtr->hwndSelf );
PROPERTY_RemoveWindowProps( wndPtr );
wndPtr->dwMagic = 0; /* Mark it as invalid */
/* toss stale messages from the queue */
if( wndPtr->hmemTaskQ )
......@@ -494,16 +492,15 @@ static WND* WIN_DestroyWindow( WND* wndPtr )
DestroyMenu( wndPtr->hSysMenu );
wndPtr->hSysMenu = 0;
}
wndPtr->pDriver->pDestroyWindow( wndPtr );
USER_Driver.pDestroyWindow( wndPtr->hwndSelf );
DCE_FreeWindowDCE( wndPtr ); /* Always do this to catch orphaned DCs */
WINPROC_FreeProc( wndPtr->winproc, WIN_PROC_WINDOW );
CLASS_RemoveWindow( wndPtr->class );
wndPtr->class = NULL;
wndPtr->dwMagic = 0; /* Mark it as invalid */
WIN_UpdateWndPtr(&pWnd,wndPtr->next);
wndPtr->pDriver->pFinalize(wndPtr);
return pWnd;
}
......@@ -590,8 +587,6 @@ BOOL WIN_CreateDesktopWindow(void)
pWndDesktop = (WND *) USER_HEAP_LIN_ADDR( hwndDesktop );
pWndDesktop->pDriver = WND_Driver;
pWndDesktop->pDriver->pInitialize(pWndDesktop);
pWndDesktop->next = NULL;
pWndDesktop->child = NULL;
pWndDesktop->parent = NULL;
......@@ -626,7 +621,7 @@ BOOL WIN_CreateDesktopWindow(void)
pWndDesktop->cbWndExtra = wndExtra;
pWndDesktop->irefCount = 0;
if(!pWndDesktop->pDriver->pCreateDesktopWindow(pWndDesktop)) return FALSE;
if (!USER_Driver.pCreateWindow( hwndDesktop )) return FALSE;
SendMessageW( hwndDesktop, WM_NCCREATE, 0, 0 );
pWndDesktop->flags |= WIN_NEEDS_ERASEBKGND;
......@@ -789,7 +784,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
wndPtr->pDriver = wndPtr->parent->pDriver;
wndPtr->pDriver->pInitialize(wndPtr);
wndPtr->class = classPtr;
wndPtr->winproc = winproc;
......@@ -835,7 +829,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
if (ret)
{
TRACE("CBT-hook returned 0\n");
wndPtr->pDriver->pFinalize(wndPtr);
USER_HEAP_FREE( hwnd );
CLASS_RemoveWindow( classPtr );
retvalue = 0;
......@@ -889,7 +882,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
wndPtr->rectWindow.bottom = cs->y + cs->cy;
wndPtr->rectClient = wndPtr->rectWindow;
if(!wndPtr->pDriver->pCreateWindow(wndPtr, cs, type == WIN_PROC_32W))
if (!USER_Driver.pCreateWindow(wndPtr->hwndSelf))
{
retvalue = FALSE;
goto end;
......@@ -1374,9 +1367,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
if (wndPtr->dwStyle & WS_VISIBLE)
{
SetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW |
SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|
((QUEUE_IsExitingQueue(wndPtr->hmemTaskQ))?SWP_DEFERERASE:0) );
ShowWindow( hwnd, SW_HIDE );
if (!IsWindow(hwnd))
{
retvalue = TRUE;
......@@ -1413,7 +1404,6 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
else break;
}
if( !Options.managed || EVENT_CheckFocus() )
WINPOS_ActivateOtherWindow(wndPtr);
if( wndPtr->owner &&
......@@ -1725,45 +1715,34 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
WND *wndPtr;
BOOL retvalue;
TRACE("EnableWindow32: ( %x, %d )\n", hwnd, enable);
TRACE("( %x, %d )\n", hwnd, enable);
if (USER_Driver.pEnableWindow)
return USER_Driver.pEnableWindow( hwnd, enable );
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
if (enable && (wndPtr->dwStyle & WS_DISABLED))
{
/* Enable window */
wndPtr->dwStyle &= ~WS_DISABLED;
if( wndPtr->flags & WIN_NATIVE )
wndPtr->pDriver->pSetHostAttr( wndPtr, HAK_ACCEPTFOCUS, TRUE );
retvalue = ((wndPtr->dwStyle & WS_DISABLED) != 0);
if (enable && (wndPtr->dwStyle & WS_DISABLED))
{
wndPtr->dwStyle &= ~WS_DISABLED; /* Enable window */
SendMessageA( hwnd, WM_ENABLE, TRUE, 0 );
retvalue = TRUE;
goto end;
}
else if (!enable && !(wndPtr->dwStyle & WS_DISABLED))
{
SendMessageA( wndPtr->hwndSelf, WM_CANCELMODE, 0, 0);
/* Disable window */
wndPtr->dwStyle |= WS_DISABLED;
if( wndPtr->flags & WIN_NATIVE )
wndPtr->pDriver->pSetHostAttr( wndPtr, HAK_ACCEPTFOCUS, FALSE );
wndPtr->dwStyle |= WS_DISABLED; /* Disable window */
if (hwnd == GetFocus())
{
SetFocus( 0 ); /* A disabled window can't have the focus */
}
if (hwnd == GetCapture())
{
ReleaseCapture(); /* A disabled window can't capture the mouse */
}
SendMessageA( hwnd, WM_ENABLE, FALSE, 0 );
retvalue = FALSE;
goto end;
}
retvalue = ((wndPtr->dwStyle & WS_DISABLED) != 0);
end:
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
}
......@@ -2392,48 +2371,72 @@ HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
/*****************************************************************
* SetParent (USER32.@)
*/
HWND WINAPI SetParent( HWND hwndChild, HWND hwndNewParent )
HWND WINAPI SetParent( HWND hwnd, HWND parent )
{
WND *wndPtr;
WND *pWndParent;
DWORD dwStyle;
WND *pWndNewParent;
WND *pWndOldParent;
HWND retvalue;
if (hwnd == GetDesktopWindow()) /* sanity check */
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0;
}
if (USER_Driver.pSetParent)
return USER_Driver.pSetParent( hwnd, parent );
if(!(wndPtr = WIN_FindWndPtr(hwndChild))) return 0;
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
dwStyle = wndPtr->dwStyle;
pWndNewParent = hwndNewParent ? WIN_FindWndPtr(hwndNewParent)
: WIN_LockWndPtr(pWndDesktop);
pWndParent = parent ? WIN_FindWndPtr(parent) : WIN_GetDesktop();
if (!pWndParent)
{
WIN_ReleaseWndPtr( wndPtr );
return 0;
}
/* Windows hides the window first, then shows it again
* including the WM_SHOWWINDOW messages and all */
if (dwStyle & WS_VISIBLE)
ShowWindow( hwndChild, SW_HIDE );
if (dwStyle & WS_VISIBLE) ShowWindow( hwnd, SW_HIDE );
retvalue = wndPtr->parent->hwndSelf; /* old parent */
if (pWndParent != wndPtr->parent)
{
WIN_UnlinkWindow(wndPtr->hwndSelf);
wndPtr->parent = pWndParent;
pWndOldParent = WIN_LockWndPtr((*wndPtr->pDriver->pSetParent)(wndPtr, pWndNewParent));
if (parent != GetDesktopWindow()) /* a child window */
{
if( !( wndPtr->dwStyle & WS_CHILD ) )
{
if( wndPtr->wIDmenu != 0)
{
DestroyMenu( (HMENU) wndPtr->wIDmenu );
wndPtr->wIDmenu = 0;
}
}
}
WIN_LinkWindow(wndPtr->hwndSelf, HWND_TOP);
}
WIN_ReleaseWndPtr( pWndParent );
WIN_ReleaseWndPtr( wndPtr );
/* SetParent additionally needs to make hwndChild the topmost window
/* SetParent additionally needs to make hwnd the topmost window
in the x-order and send the expected WM_WINDOWPOSCHANGING and
WM_WINDOWPOSCHANGED notification messages.
*/
SetWindowPos( hwndChild, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|((dwStyle & WS_VISIBLE)?SWP_SHOWWINDOW:0));
SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|
((dwStyle & WS_VISIBLE)?SWP_SHOWWINDOW:0));
/* FIXME: a WM_MOVE is also generated (in the DefWindowProc handler
* for WM_WINDOWPOSCHANGED) in Windows, should probably remove SWP_NOMOVE */
retvalue = pWndOldParent?pWndOldParent->hwndSelf:0;
WIN_ReleaseWndPtr(pWndOldParent);
WIN_ReleaseWndPtr(pWndNewParent);
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
}
/*******************************************************************
* IsChild (USER.48)
*/
......@@ -3071,8 +3074,7 @@ BOOL WINAPI FlashWindow( HWND hWnd, BOOL bInvert )
}
else
{
PAINT_RedrawWindow( hWnd, 0, 0, RDW_INVALIDATE | RDW_ERASE |
RDW_UPDATENOW | RDW_FRAME, 0 );
RedrawWindow( hWnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_FRAME );
wndPtr->flags &= ~WIN_NCACTIVATED;
}
WIN_ReleaseWndPtr(wndPtr);
......
......@@ -93,7 +93,7 @@ static const char * const event_names[] =
static void CALLBACK EVENT_Flush( ULONG_PTR arg );
static void CALLBACK EVENT_ProcessAllEvents( ULONG_PTR arg );
static void EVENT_ProcessEvent( XEvent *event );
BOOL X11DRV_CheckFocus(void);
static BOOL X11DRV_CheckFocus(void);
/* Event handlers */
static void EVENT_Key( HWND hWnd, XKeyEvent *event );
......@@ -401,7 +401,7 @@ static void EVENT_ProcessEvent( XEvent *event )
(win_attr.map_state == IsViewable) )
{
TSXSetInputFocus( xfocChange->display, glastXFocusWin, RevertToParent, CurrentTime );
EVENT_Synchronize();
X11DRV_Synchronize();
break;
}
}
......@@ -877,7 +877,7 @@ static void EVENT_FocusOut( HWND hWnd, XFocusChangeEvent *event )
/**********************************************************************
* CheckFocus (X11DRV.@)
*/
BOOL X11DRV_CheckFocus(void)
static BOOL X11DRV_CheckFocus(void)
{
HWND hWnd;
Window xW;
......@@ -1850,7 +1850,7 @@ void EVENT_MapNotify( HWND hWnd, XMapEvent *event )
WIN_ReleaseWndPtr(pWnd);
if (hwndFocus && IsChild( hWnd, hwndFocus ))
X11DRV_WND_SetFocus(wndFocus);
X11DRV_SetFocus(hwndFocus);
WIN_ReleaseWndPtr(wndFocus);
......
......@@ -1726,30 +1726,3 @@ BOOL X11DRV_GetDIData(
return TRUE;
}
/***********************************************************************
* GetKeyboardConfig (X11DRV.@)
*/
void X11DRV_GetKeyboardConfig(KEYBOARD_CONFIG *cfg) {
XKeyboardState xks;
/* For the moment, only get the auto-repeat mode */
TSXGetKeyboardControl(display, &xks);
cfg->auto_repeat = xks.global_auto_repeat;
}
/***********************************************************************
* SetKeyboardConfig (X11DRV.@)
*/
void X11DRV_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask) {
XKeyboardControl xkc;
unsigned long X_mask = 0;
if (mask & WINE_KEYBOARD_CONFIG_AUTO_REPEAT) {
X_mask |= KBAutoRepeatMode;
xkc.auto_repeat_mode = cfg->auto_repeat;
}
if (X_mask)
TSXChangeKeyboardControl(display, X_mask, &xkc);
}
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