Commit 1642fbcb authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Moved the DCE support from winex11 back to user32.

Window and class DCEs are now allocated lazily.
parent 4273a8ab
...@@ -52,6 +52,7 @@ typedef struct tagCLASS ...@@ -52,6 +52,7 @@ typedef struct tagCLASS
INT cbClsExtra; /* Class extra bytes */ INT cbClsExtra; /* Class extra bytes */
INT cbWndExtra; /* Window extra bytes */ INT cbWndExtra; /* Window extra bytes */
LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */ LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */
struct dce *dce; /* Opaque pointer to class DCE */
HINSTANCE hInstance; /* Module that created the task */ HINSTANCE hInstance; /* Module that created the task */
HICON hIcon; /* Default icon */ HICON hIcon; /* Default icon */
HICON hIconSm; /* Default small icon */ HICON hIconSm; /* Default small icon */
...@@ -243,6 +244,7 @@ static void CLASS_FreeClass( CLASS *classPtr ) ...@@ -243,6 +244,7 @@ static void CLASS_FreeClass( CLASS *classPtr )
USER_Lock(); USER_Lock();
if (classPtr->dce) free_dce( classPtr->dce, 0 );
list_remove( &classPtr->entry ); list_remove( &classPtr->entry );
if (classPtr->hbrBackground > (HBRUSH)(COLOR_GRADIENTINACTIVECAPTION + 1)) if (classPtr->hbrBackground > (HBRUSH)(COLOR_GRADIENTINACTIVECAPTION + 1))
DeleteObject( classPtr->hbrBackground ); DeleteObject( classPtr->hbrBackground );
...@@ -442,6 +444,26 @@ WNDPROC get_class_winproc( CLASS *class ) ...@@ -442,6 +444,26 @@ WNDPROC get_class_winproc( CLASS *class )
/*********************************************************************** /***********************************************************************
* get_class_dce
*/
struct dce *get_class_dce( CLASS *class )
{
return class->dce;
}
/***********************************************************************
* set_class_dce
*/
struct dce *set_class_dce( CLASS *class, struct dce *dce )
{
if (class->dce) return class->dce; /* already set, don't change it */
class->dce = dce;
return dce;
}
/***********************************************************************
* RegisterClassA (USER32.@) * RegisterClassA (USER32.@)
* *
* Register a window class. * Register a window class.
......
...@@ -64,6 +64,8 @@ struct tagWND; ...@@ -64,6 +64,8 @@ struct tagWND;
extern ATOM get_int_atom_value( LPCWSTR name ) DECLSPEC_HIDDEN; extern ATOM get_int_atom_value( LPCWSTR name ) DECLSPEC_HIDDEN;
extern void CLASS_RegisterBuiltinClasses(void) DECLSPEC_HIDDEN; extern void CLASS_RegisterBuiltinClasses(void) DECLSPEC_HIDDEN;
extern WNDPROC get_class_winproc( struct tagCLASS *class ) DECLSPEC_HIDDEN; extern WNDPROC get_class_winproc( struct tagCLASS *class ) DECLSPEC_HIDDEN;
extern struct dce *get_class_dce( struct tagCLASS *class ) DECLSPEC_HIDDEN;
extern struct dce *set_class_dce( struct tagCLASS *class, struct dce *dce ) DECLSPEC_HIDDEN;
extern void CLASS_FreeModuleClasses( HMODULE16 hModule ) DECLSPEC_HIDDEN; extern void CLASS_FreeModuleClasses( HMODULE16 hModule ) DECLSPEC_HIDDEN;
/* defwnd proc */ /* defwnd proc */
......
...@@ -108,7 +108,7 @@ static const USER_DRIVER *load_driver(void) ...@@ -108,7 +108,7 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(CreateDesktopWindow); GET_USER_FUNC(CreateDesktopWindow);
GET_USER_FUNC(CreateWindow); GET_USER_FUNC(CreateWindow);
GET_USER_FUNC(DestroyWindow); GET_USER_FUNC(DestroyWindow);
GET_USER_FUNC(GetDCEx); GET_USER_FUNC(GetDC);
GET_USER_FUNC(MsgWaitForMultipleObjectsEx); GET_USER_FUNC(MsgWaitForMultipleObjectsEx);
GET_USER_FUNC(ReleaseDC); GET_USER_FUNC(ReleaseDC);
GET_USER_FUNC(ScrollDC); GET_USER_FUNC(ScrollDC);
...@@ -121,7 +121,6 @@ static const USER_DRIVER *load_driver(void) ...@@ -121,7 +121,6 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(SetWindowText); GET_USER_FUNC(SetWindowText);
GET_USER_FUNC(ShowWindow); GET_USER_FUNC(ShowWindow);
GET_USER_FUNC(SysCommandSizeMove); GET_USER_FUNC(SysCommandSizeMove);
GET_USER_FUNC(WindowFromDC);
GET_USER_FUNC(WindowMessage); GET_USER_FUNC(WindowMessage);
#undef GET_USER_FUNC #undef GET_USER_FUNC
} }
...@@ -344,9 +343,9 @@ static void nulldrv_DestroyWindow( HWND hwnd ) ...@@ -344,9 +343,9 @@ static void nulldrv_DestroyWindow( HWND hwnd )
{ {
} }
static HDC nulldrv_GetDCEx( HWND hwnd, HRGN hrgn, DWORD flags ) static void nulldrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
const RECT *top_rect, DWORD flags )
{ {
return 0;
} }
static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout, static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
...@@ -356,9 +355,8 @@ static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *han ...@@ -356,9 +355,8 @@ static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *han
timeout, flags & MWMO_ALERTABLE ); timeout, flags & MWMO_ALERTABLE );
} }
static INT nulldrv_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint ) static void nulldrv_ReleaseDC( HWND hwnd, HDC hdc )
{ {
return 0;
} }
static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip, static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
...@@ -407,11 +405,6 @@ static void nulldrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam ) ...@@ -407,11 +405,6 @@ static void nulldrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
{ {
} }
static HWND nulldrv_WindowFromDC( HDC hdc )
{
return 0;
}
static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{ {
return 0; return 0;
...@@ -461,7 +454,7 @@ static const USER_DRIVER null_driver = ...@@ -461,7 +454,7 @@ static const USER_DRIVER null_driver =
nulldrv_CreateDesktopWindow, nulldrv_CreateDesktopWindow,
nulldrv_CreateWindow, nulldrv_CreateWindow,
nulldrv_DestroyWindow, nulldrv_DestroyWindow,
nulldrv_GetDCEx, nulldrv_GetDC,
nulldrv_MsgWaitForMultipleObjectsEx, nulldrv_MsgWaitForMultipleObjectsEx,
nulldrv_ReleaseDC, nulldrv_ReleaseDC,
nulldrv_ScrollDC, nulldrv_ScrollDC,
...@@ -474,7 +467,6 @@ static const USER_DRIVER null_driver = ...@@ -474,7 +467,6 @@ static const USER_DRIVER null_driver =
nulldrv_SetWindowText, nulldrv_SetWindowText,
nulldrv_ShowWindow, nulldrv_ShowWindow,
nulldrv_SysCommandSizeMove, nulldrv_SysCommandSizeMove,
nulldrv_WindowFromDC,
nulldrv_WindowMessage nulldrv_WindowMessage
}; };
...@@ -668,9 +660,10 @@ static void loaderdrv_DestroyWindow( HWND hwnd ) ...@@ -668,9 +660,10 @@ static void loaderdrv_DestroyWindow( HWND hwnd )
load_driver()->pDestroyWindow( hwnd ); load_driver()->pDestroyWindow( hwnd );
} }
static HDC loaderdrv_GetDCEx( HWND hwnd, HRGN hrgn, DWORD flags ) static void loaderdrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
const RECT *top_rect, DWORD flags )
{ {
return load_driver()->pGetDCEx( hwnd, hrgn, flags ); load_driver()->pGetDC( hdc, hwnd, top_win, win_rect, top_rect, flags );
} }
static DWORD loaderdrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout, static DWORD loaderdrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
...@@ -679,9 +672,9 @@ static DWORD loaderdrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *h ...@@ -679,9 +672,9 @@ static DWORD loaderdrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *h
return load_driver()->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags ); return load_driver()->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
} }
static INT loaderdrv_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint ) static void loaderdrv_ReleaseDC( HWND hwnd, HDC hdc )
{ {
return load_driver()->pReleaseDC( hwnd, hdc, end_paint ); load_driver()->pReleaseDC( hwnd, hdc );
} }
static BOOL loaderdrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip, static BOOL loaderdrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
...@@ -738,11 +731,6 @@ static void loaderdrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam ) ...@@ -738,11 +731,6 @@ static void loaderdrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
load_driver()->pSysCommandSizeMove( hwnd, wparam ); load_driver()->pSysCommandSizeMove( hwnd, wparam );
} }
static HWND loaderdrv_WindowFromDC( HDC hdc )
{
return load_driver()->pWindowFromDC( hdc );
}
static LRESULT loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) static LRESULT loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{ {
return load_driver()->pWindowMessage( hwnd, msg, wparam, lparam ); return load_driver()->pWindowMessage( hwnd, msg, wparam, lparam );
...@@ -792,7 +780,7 @@ static const USER_DRIVER lazy_load_driver = ...@@ -792,7 +780,7 @@ static const USER_DRIVER lazy_load_driver =
loaderdrv_CreateDesktopWindow, loaderdrv_CreateDesktopWindow,
loaderdrv_CreateWindow, loaderdrv_CreateWindow,
loaderdrv_DestroyWindow, loaderdrv_DestroyWindow,
loaderdrv_GetDCEx, loaderdrv_GetDC,
loaderdrv_MsgWaitForMultipleObjectsEx, loaderdrv_MsgWaitForMultipleObjectsEx,
loaderdrv_ReleaseDC, loaderdrv_ReleaseDC,
loaderdrv_ScrollDC, loaderdrv_ScrollDC,
...@@ -805,6 +793,5 @@ static const USER_DRIVER lazy_load_driver = ...@@ -805,6 +793,5 @@ static const USER_DRIVER lazy_load_driver =
loaderdrv_SetWindowText, loaderdrv_SetWindowText,
loaderdrv_ShowWindow, loaderdrv_ShowWindow,
loaderdrv_SysCommandSizeMove, loaderdrv_SysCommandSizeMove,
loaderdrv_WindowFromDC,
loaderdrv_WindowMessage loaderdrv_WindowMessage
}; };
...@@ -385,7 +385,6 @@ static void test_invisible_create(void) ...@@ -385,7 +385,6 @@ static void test_invisible_create(void)
dc1 = GetDC(hwnd_owndc); dc1 = GetDC(hwnd_owndc);
dc2 = GetDC(hwnd_owndc); dc2 = GetDC(hwnd_owndc);
todo_wine
ok(dc1 == dc2, "expected owndc dcs to match\n"); ok(dc1 == dc2, "expected owndc dcs to match\n");
ReleaseDC(hwnd_owndc, dc2); ReleaseDC(hwnd_owndc, dc2);
......
...@@ -794,3 +794,4 @@ ...@@ -794,3 +794,4 @@
@ cdecl WINPOS_ShowIconTitle(long long) @ cdecl WINPOS_ShowIconTitle(long long)
@ cdecl WIN_GetPtr(long) @ cdecl WIN_GetPtr(long)
@ cdecl WIN_SetStyle(long long long) @ cdecl WIN_SetStyle(long long long)
@ cdecl WIN_invalidate_dce(long ptr) invalidate_dce
...@@ -144,9 +144,9 @@ typedef struct tagUSER_DRIVER { ...@@ -144,9 +144,9 @@ typedef struct tagUSER_DRIVER {
BOOL (*pCreateDesktopWindow)(HWND); BOOL (*pCreateDesktopWindow)(HWND);
BOOL (*pCreateWindow)(HWND); BOOL (*pCreateWindow)(HWND);
void (*pDestroyWindow)(HWND); void (*pDestroyWindow)(HWND);
HDC (*pGetDCEx)(HWND,HRGN,DWORD); void (*pGetDC)(HDC,HWND,HWND,const RECT *,const RECT *,DWORD);
DWORD (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD); DWORD (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
INT (*pReleaseDC)(HWND,HDC,BOOL); void (*pReleaseDC)(HWND,HDC);
BOOL (*pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT); BOOL (*pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT);
void (*pSetFocus)(HWND); void (*pSetFocus)(HWND);
void (*pSetParent)(HWND,HWND,HWND); void (*pSetParent)(HWND,HWND,HWND);
...@@ -157,7 +157,6 @@ typedef struct tagUSER_DRIVER { ...@@ -157,7 +157,6 @@ typedef struct tagUSER_DRIVER {
void (*pSetWindowText)(HWND,LPCWSTR); void (*pSetWindowText)(HWND,LPCWSTR);
BOOL (*pShowWindow)(HWND,INT); BOOL (*pShowWindow)(HWND,INT);
void (*pSysCommandSizeMove)(HWND,WPARAM); void (*pSysCommandSizeMove)(HWND,WPARAM);
HWND (*pWindowFromDC)(HDC);
LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
} USER_DRIVER; } USER_DRIVER;
...@@ -231,9 +230,13 @@ extern HMODULE user32_module DECLSPEC_HIDDEN; ...@@ -231,9 +230,13 @@ extern HMODULE user32_module DECLSPEC_HIDDEN;
extern DWORD USER16_AlertableWait DECLSPEC_HIDDEN; extern DWORD USER16_AlertableWait DECLSPEC_HIDDEN;
extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN; extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN;
struct dce;
extern BOOL CLIPBOARD_ReleaseOwner(void) DECLSPEC_HIDDEN; extern BOOL CLIPBOARD_ReleaseOwner(void) DECLSPEC_HIDDEN;
extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL HOOK_IsHooked( INT id ) DECLSPEC_HIDDEN; extern BOOL HOOK_IsHooked( INT id ) DECLSPEC_HIDDEN;
extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
extern void invalidate_dce( HWND hwnd, const RECT *rect ) DECLSPEC_HIDDEN;
extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN; extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
extern void *get_hook_proc( void *proc, const WCHAR *module ); extern void *get_hook_proc( void *proc, const WCHAR *module );
extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN; extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
......
...@@ -522,7 +522,11 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) ...@@ -522,7 +522,11 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits )
} }
SERVER_END_REQ; SERVER_END_REQ;
WIN_ReleasePtr( win ); WIN_ReleasePtr( win );
if (ok) USER_Driver->pSetWindowStyle( hwnd, old_style ); if (ok)
{
USER_Driver->pSetWindowStyle( hwnd, old_style );
if ((old_style ^ new_style) & WS_VISIBLE) invalidate_dce( hwnd, NULL );
}
return old_style; return old_style;
} }
...@@ -631,6 +635,8 @@ LRESULT WIN_DestroyWindow( HWND hwnd ) ...@@ -631,6 +635,8 @@ LRESULT WIN_DestroyWindow( HWND hwnd )
if ((wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) != WS_CHILD) if ((wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) != WS_CHILD)
menu = (HMENU)wndPtr->wIDmenu; menu = (HMENU)wndPtr->wIDmenu;
sys_menu = wndPtr->hSysMenu; sys_menu = wndPtr->hSysMenu;
free_dce( wndPtr->dce, hwnd );
wndPtr->dce = NULL;
WIN_ReleasePtr( wndPtr ); WIN_ReleasePtr( wndPtr );
if (menu) DestroyMenu( menu ); if (menu) DestroyMenu( menu );
......
...@@ -276,6 +276,7 @@ int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw ) ...@@ -276,6 +276,7 @@ int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
UINT swp_flags = SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE; UINT swp_flags = SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE;
if (!bRedraw) swp_flags |= SWP_NOREDRAW; if (!bRedraw) swp_flags |= SWP_NOREDRAW;
SetWindowPos( hwnd, 0, 0, 0, 0, 0, swp_flags ); SetWindowPos( hwnd, 0, 0, 0, 0, 0, swp_flags );
invalidate_dce( hwnd, NULL );
} }
return ret; return ret;
} }
...@@ -1590,11 +1591,13 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, ...@@ -1590,11 +1591,13 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
{ {
WND *win; WND *win;
BOOL ret; BOOL ret;
RECT visible_rect; RECT visible_rect, old_window_rect;
DWORD new_style;
if (!(win = WIN_GetPtr( hwnd ))) return FALSE; if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
if (win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE; if (win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE;
old_window_rect = win->rectWindow;
SERVER_START_REQ( set_window_pos ) SERVER_START_REQ( set_window_pos )
{ {
req->handle = hwnd; req->handle = hwnd;
...@@ -1623,11 +1626,18 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, ...@@ -1623,11 +1626,18 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
} }
} }
SERVER_END_REQ; SERVER_END_REQ;
new_style = win->dwStyle;
WIN_ReleasePtr( win ); WIN_ReleasePtr( win );
if (ret) if (ret)
{
USER_Driver->pSetWindowPos( hwnd, insert_after, swp_flags, window_rect, USER_Driver->pSetWindowPos( hwnd, insert_after, swp_flags, window_rect,
client_rect, &visible_rect, valid_rects ); client_rect, &visible_rect, valid_rects );
if ((((swp_flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) && (new_style & WS_VISIBLE)) ||
(swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW)))
invalidate_dce( hwnd, &old_window_rect );
}
return ret; return ret;
} }
......
...@@ -14,7 +14,6 @@ C_SRCS = \ ...@@ -14,7 +14,6 @@ C_SRCS = \
clipboard.c \ clipboard.c \
clipping.c \ clipping.c \
codepage.c \ codepage.c \
dce.c \
desktop.c \ desktop.c \
dib.c \ dib.c \
dib_convert.c \ dib_convert.c \
......
...@@ -1468,8 +1468,6 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev, ...@@ -1468,8 +1468,6 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
ERR("Couldn't set format of the window, returning failure\n"); ERR("Couldn't set format of the window, returning failure\n");
return FALSE; return FALSE;
} }
physDev->gl_drawable = X11DRV_get_gl_drawable(hwnd);
} }
else if(physDev->bitmap) { else if(physDev->bitmap) {
if(!(value&GLX_PIXMAP_BIT)) { if(!(value&GLX_PIXMAP_BIT)) {
......
...@@ -71,6 +71,8 @@ static const char visual_id_prop[] = "__wine_x11_visual_id"; ...@@ -71,6 +71,8 @@ static const char visual_id_prop[] = "__wine_x11_visual_id";
extern int usexcomposite; extern int usexcomposite;
extern void WIN_invalidate_dce( HWND hwnd, const RECT *rect ); /* FIXME: to be removed */
/*********************************************************************** /***********************************************************************
* is_window_managed * is_window_managed
* *
...@@ -471,7 +473,7 @@ done: ...@@ -471,7 +473,7 @@ done:
wine_tsx11_lock(); wine_tsx11_lock();
XFlush( display ); XFlush( display );
wine_tsx11_unlock(); wine_tsx11_unlock();
invalidate_dce( hwnd, &data->window_rect ); WIN_invalidate_dce( hwnd, NULL );
return TRUE; return TRUE;
} }
...@@ -542,7 +544,6 @@ static void sync_gl_drawable(Display *display, struct x11drv_win_data *data) ...@@ -542,7 +544,6 @@ static void sync_gl_drawable(Display *display, struct x11drv_win_data *data)
SetPropA(data->hwnd, gl_drawable_prop, (HANDLE)data->gl_drawable); SetPropA(data->hwnd, gl_drawable_prop, (HANDLE)data->gl_drawable);
SetPropA(data->hwnd, pixmap_prop, (HANDLE)data->pixmap); SetPropA(data->hwnd, pixmap_prop, (HANDLE)data->pixmap);
invalidate_dce( data->hwnd, &data->window_rect );
} }
...@@ -1307,7 +1308,6 @@ void X11DRV_DestroyWindow( HWND hwnd ) ...@@ -1307,7 +1308,6 @@ void X11DRV_DestroyWindow( HWND hwnd )
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
free_window_dce( data );
destroy_whole_window( display, data ); destroy_whole_window( display, data );
destroy_icon_window( display, data ); destroy_icon_window( display, data );
...@@ -1489,9 +1489,6 @@ struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd ) ...@@ -1489,9 +1489,6 @@ struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd )
hwnd, data->whole_window, data->client_window, wine_dbgstr_rect( &data->window_rect ), hwnd, data->whole_window, data->client_window, wine_dbgstr_rect( &data->window_rect ),
wine_dbgstr_rect( &data->whole_rect ), wine_dbgstr_rect( &data->client_rect )); wine_dbgstr_rect( &data->whole_rect ), wine_dbgstr_rect( &data->client_rect ));
} }
/* get class or window DC if needed */
alloc_window_dce( data );
return data; return data;
} }
...@@ -1533,57 +1530,80 @@ Window X11DRV_get_client_window( HWND hwnd ) ...@@ -1533,57 +1530,80 @@ Window X11DRV_get_client_window( HWND hwnd )
/*********************************************************************** /***********************************************************************
* X11DRV_get_fbconfig_id * X11DRV_get_ic
* *
* Return the GLXFBConfig ID of the drawable used by the window for * Return the X input context associated with a window
* OpenGL rendering. This is 0 for windows without a pixel format set.
*/ */
XID X11DRV_get_fbconfig_id( HWND hwnd ) XIC X11DRV_get_ic( HWND hwnd )
{ {
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
if (!data) return (XID)GetPropA( hwnd, fbconfig_id_prop ); if (!data) return 0;
return data->fbconfig_id; return data->xic;
} }
/*********************************************************************** /***********************************************************************
* X11DRV_get_gl_drawable * X11DRV_GetDC (X11DRV.@)
*
* Return the GL drawable for this window.
*/ */
Drawable X11DRV_get_gl_drawable( HWND hwnd ) void X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
const RECT *top_rect, DWORD flags )
{ {
struct x11drv_escape_set_drawable escape;
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
if (!data) return (Drawable)GetPropA( hwnd, gl_drawable_prop ); escape.code = X11DRV_SET_DRAWABLE;
return data->gl_drawable; escape.mode = IncludeInferiors;
} escape.fbconfig_id = 0;
escape.gl_drawable = 0;
escape.pixmap = 0;
/*********************************************************************** if (top == hwnd && data && IsIconic( hwnd ) && data->icon_window)
* X11DRV_get_gl_pixmap {
* escape.drawable = data->icon_window;
* Return the Pixmap associated with the GL drawable (if any) for this window. }
*/ else if (top == hwnd && (flags & DCX_WINDOW))
Pixmap X11DRV_get_gl_pixmap( HWND hwnd ) {
{ escape.drawable = data ? data->whole_window : X11DRV_get_whole_window( hwnd );
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); }
else
{
escape.drawable = X11DRV_get_client_window( top );
escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop );
escape.gl_drawable = data ? data->gl_drawable : (Drawable)GetPropA( hwnd, gl_drawable_prop );
escape.pixmap = data ? data->pixmap : (Pixmap)GetPropA( hwnd, pixmap_prop );
}
if (!data) return (Pixmap)GetPropA( hwnd, pixmap_prop ); escape.dc_rect.left = win_rect->left - top_rect->left;
return data->pixmap; escape.dc_rect.top = win_rect->top - top_rect->top;
escape.dc_rect.right = win_rect->right - top_rect->left;
escape.dc_rect.bottom = win_rect->bottom - top_rect->top;
escape.drawable_rect.left = top_rect->left;
escape.drawable_rect.top = top_rect->top;
escape.drawable_rect.right = top_rect->right;
escape.drawable_rect.bottom = top_rect->bottom;
ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
} }
/*********************************************************************** /***********************************************************************
* X11DRV_get_ic * X11DRV_ReleaseDC (X11DRV.@)
*
* Return the X input context associated with a window
*/ */
XIC X11DRV_get_ic( HWND hwnd ) void X11DRV_ReleaseDC( HWND hwnd, HDC hdc )
{ {
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); struct x11drv_escape_set_drawable escape;
if (!data) return 0; escape.code = X11DRV_SET_DRAWABLE;
return data->xic; escape.drawable = root_window;
escape.mode = IncludeInferiors;
escape.drawable_rect = virtual_screen_rect;
SetRect( &escape.dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
virtual_screen_rect.bottom - virtual_screen_rect.top );
escape.fbconfig_id = 0;
escape.gl_drawable = 0;
escape.pixmap = 0;
ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
} }
...@@ -1708,7 +1728,6 @@ int X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) ...@@ -1708,7 +1728,6 @@ int X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
if ((data = X11DRV_get_win_data( hwnd ))) if ((data = X11DRV_get_win_data( hwnd )))
{ {
sync_window_region( thread_display(), data, hrgn ); sync_window_region( thread_display(), data, hrgn );
invalidate_dce( hwnd, &data->window_rect );
} }
else if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) else if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId())
{ {
......
...@@ -96,11 +96,11 @@ ...@@ -96,11 +96,11 @@
@ cdecl EnumClipboardFormats(long) X11DRV_EnumClipboardFormats @ cdecl EnumClipboardFormats(long) X11DRV_EnumClipboardFormats
@ cdecl GetClipboardData(long ptr ptr) X11DRV_GetClipboardData @ cdecl GetClipboardData(long ptr ptr) X11DRV_GetClipboardData
@ cdecl GetClipboardFormatName(long ptr long) X11DRV_GetClipboardFormatName @ cdecl GetClipboardFormatName(long ptr long) X11DRV_GetClipboardFormatName
@ cdecl GetDCEx(long long long) X11DRV_GetDCEx @ cdecl GetDC(long long long ptr ptr long) X11DRV_GetDC
@ cdecl IsClipboardFormatAvailable(long) X11DRV_IsClipboardFormatAvailable @ cdecl IsClipboardFormatAvailable(long) X11DRV_IsClipboardFormatAvailable
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx
@ cdecl RegisterClipboardFormat(wstr) X11DRV_RegisterClipboardFormat @ cdecl RegisterClipboardFormat(wstr) X11DRV_RegisterClipboardFormat
@ cdecl ReleaseDC(long long long) X11DRV_ReleaseDC @ cdecl ReleaseDC(long long) X11DRV_ReleaseDC
@ cdecl ScrollDC(long long long ptr ptr long ptr) X11DRV_ScrollDC @ cdecl ScrollDC(long long long ptr ptr long ptr) X11DRV_ScrollDC
@ cdecl SetClipboardData(long long long long) X11DRV_SetClipboardData @ cdecl SetClipboardData(long long long long) X11DRV_SetClipboardData
@ cdecl SetFocus(long) X11DRV_SetFocus @ cdecl SetFocus(long) X11DRV_SetFocus
...@@ -112,7 +112,6 @@ ...@@ -112,7 +112,6 @@
@ cdecl SetWindowText(long wstr) X11DRV_SetWindowText @ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
@ cdecl ShowWindow(long long) X11DRV_ShowWindow @ cdecl ShowWindow(long long) X11DRV_ShowWindow
@ cdecl SysCommandSizeMove(long long) X11DRV_SysCommandSizeMove @ cdecl SysCommandSizeMove(long long) X11DRV_SysCommandSizeMove
@ cdecl WindowFromDC(long) X11DRV_WindowFromDC
@ cdecl WindowMessage(long long long long) X11DRV_WindowMessage @ cdecl WindowMessage(long long long long) X11DRV_WindowMessage
# WinTab32 # WinTab32
......
...@@ -141,15 +141,11 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style ) ...@@ -141,15 +141,11 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
new_style = GetWindowLongW( hwnd, GWL_STYLE ); new_style = GetWindowLongW( hwnd, GWL_STYLE );
changed = new_style ^ old_style; changed = new_style ^ old_style;
if (changed & WS_VISIBLE) if ((changed & WS_VISIBLE) && (new_style & WS_VISIBLE))
{ {
data = X11DRV_get_win_data( hwnd );
if (data) invalidate_dce( hwnd, &data->window_rect );
/* we don't unmap windows, that causes trouble with the window manager */ /* we don't unmap windows, that causes trouble with the window manager */
if (!(new_style & WS_VISIBLE)) return; if (!(data = X11DRV_get_win_data( hwnd )) &&
!(data = X11DRV_create_win_data( hwnd ))) return;
if (!data && !(data = X11DRV_create_win_data( hwnd ))) return;
if (data->whole_window && X11DRV_is_window_rect_mapped( &data->window_rect )) if (data->whole_window && X11DRV_is_window_rect_mapped( &data->window_rect ))
{ {
...@@ -361,15 +357,6 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags, ...@@ -361,15 +357,6 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
SERVER_END_REQ; SERVER_END_REQ;
} }
/* invalidate DCEs */
if ((((swp_flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) && (new_style & WS_VISIBLE)) ||
(swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW)))
{
RECT rect;
UnionRect( &rect, rectWindow, &old_window_rect );
invalidate_dce( hwnd, &rect );
}
TRACE( "win %p window %s client %s style %08x\n", TRACE( "win %p window %s client %s style %08x\n",
hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style ); hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style );
...@@ -788,8 +775,6 @@ void X11DRV_MapNotify( HWND hwnd, XEvent *event ) ...@@ -788,8 +775,6 @@ void X11DRV_MapNotify( HWND hwnd, XEvent *event )
OffsetRect( &rect, virtual_screen_rect.left, virtual_screen_rect.top ); OffsetRect( &rect, virtual_screen_rect.left, virtual_screen_rect.top );
X11DRV_X_to_window_rect( data, &rect ); X11DRV_X_to_window_rect( data, &rect );
invalidate_dce( hwnd, &data->window_rect );
if (win->flags & WIN_RESTORE_MAX) style |= WS_MAXIMIZE; if (win->flags & WIN_RESTORE_MAX) style |= WS_MAXIMIZE;
WIN_SetStyle( hwnd, style, WS_MINIMIZE ); WIN_SetStyle( hwnd, style, WS_MINIMIZE );
WIN_ReleasePtr( win ); WIN_ReleasePtr( win );
......
...@@ -492,12 +492,6 @@ struct x11drv_escape_set_drawable ...@@ -492,12 +492,6 @@ struct x11drv_escape_set_drawable
Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */ Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */
}; };
struct x11drv_escape_set_dce
{
enum x11drv_escape_codes code; /* escape code (X11DRV_SET_DRAWABLE) */
struct dce *dce; /* pointer to DCE (opaque ptr for GDI) */
};
/************************************************************************** /**************************************************************************
* X11 USER driver * X11 USER driver
*/ */
...@@ -676,7 +670,6 @@ struct x11drv_win_data ...@@ -676,7 +670,6 @@ struct x11drv_win_data
BOOL managed : 1; /* is window managed? */ BOOL managed : 1; /* is window managed? */
BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */ BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */
DWORD wm_state; /* bit mask of active x11drv_wm_state values */ DWORD wm_state; /* bit mask of active x11drv_wm_state values */
struct dce *dce; /* DCE for CS_OWNDC or CS_CLASSDC windows */
unsigned int lock_changes; /* lock count for X11 change requests */ unsigned int lock_changes; /* lock count for X11 change requests */
HBITMAP hWMIconBitmap; HBITMAP hWMIconBitmap;
HBITMAP hWMIconMask; HBITMAP hWMIconMask;
...@@ -686,9 +679,6 @@ extern struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd ); ...@@ -686,9 +679,6 @@ extern struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd );
extern struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd ); extern struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd );
extern Window X11DRV_get_whole_window( HWND hwnd ); extern Window X11DRV_get_whole_window( HWND hwnd );
extern Window X11DRV_get_client_window( HWND hwnd ); extern Window X11DRV_get_client_window( HWND hwnd );
extern XID X11DRV_get_fbconfig_id( HWND hwnd );
extern Drawable X11DRV_get_gl_drawable( HWND hwnd );
extern Pixmap X11DRV_get_gl_pixmap( HWND hwnd );
extern BOOL X11DRV_is_window_rect_mapped( const RECT *rect ); extern BOOL X11DRV_is_window_rect_mapped( const RECT *rect );
extern XIC X11DRV_get_ic( HWND hwnd ); extern XIC X11DRV_get_ic( HWND hwnd );
extern BOOL X11DRV_set_win_format( HWND hwnd, XID fbconfig ); extern BOOL X11DRV_set_win_format( HWND hwnd, XID fbconfig );
...@@ -699,10 +689,6 @@ extern void mark_drawable_dirty( Drawable old, Drawable new ); ...@@ -699,10 +689,6 @@ extern void mark_drawable_dirty( Drawable old, Drawable new );
extern Drawable create_glxpixmap( Display *display, XVisualInfo *vis, Pixmap parent ); extern Drawable create_glxpixmap( Display *display, XVisualInfo *vis, Pixmap parent );
extern void flush_gl_drawable( X11DRV_PDEVICE *physDev ); extern void flush_gl_drawable( X11DRV_PDEVICE *physDev );
extern void alloc_window_dce( struct x11drv_win_data *data );
extern void free_window_dce( struct x11drv_win_data *data );
extern void invalidate_dce( HWND hwnd, const RECT *rect );
/* X context to associate a hwnd to an X window */ /* X context to associate a hwnd to an X window */
extern XContext winContext; extern XContext winContext;
......
...@@ -38,6 +38,7 @@ typedef struct tagWND ...@@ -38,6 +38,7 @@ typedef struct tagWND
HWND parent; /* Window parent */ HWND parent; /* Window parent */
HWND owner; /* Window owner */ HWND owner; /* Window owner */
struct tagCLASS *class; /* Window class */ struct tagCLASS *class; /* Window class */
struct dce *dce; /* DCE pointer */
WNDPROC winproc; /* Window procedure */ WNDPROC winproc; /* Window procedure */
DWORD dwMagic; /* Magic number (must be WND_MAGIC) */ DWORD dwMagic; /* Magic number (must be WND_MAGIC) */
DWORD tid; /* Owner thread id */ DWORD tid; /* Owner thread id */
......
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