Commit e419cb88 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved initialization of the desktop window in the graphics driver to a

separate CreateDesktopWindow entry point instead of overloading CreateWindow.
parent 8eb66646
......@@ -44,6 +44,7 @@
@ cdecl SetCursor(ptr) TTYDRV_SetCursor
@ cdecl GetScreenSaveActive() TTYDRV_GetScreenSaveActive
@ cdecl SetScreenSaveActive(long) TTYDRV_SetScreenSaveActive
@ cdecl CreateDesktopWindow(long) TTYDRV_CreateDesktopWindow
@ cdecl CreateWindow(long ptr long) TTYDRV_CreateWindow
@ cdecl DestroyWindow(long) TTYDRV_DestroyWindow
@ cdecl GetDC(long long long long) TTYDRV_GetDC
......
......@@ -125,13 +125,26 @@ static BOOL set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow
/**********************************************************************
* CreateDesktopWindow (TTYDRV.@)
*/
BOOL TTYDRV_CreateDesktopWindow( HWND hwnd )
{
RECT rect;
SetRect( &rect, 0, 0, cell_width * screen_cols, cell_height * screen_rows );
set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER );
SetPropA( hwnd, "__wine_ttydrv_window", root_window );
return TRUE;
}
/**********************************************************************
* CreateWindow (TTYDRV.@)
*/
BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
{
BOOL ret;
RECT rect;
HWND parent, hwndLinkAfter;
HWND hwndLinkAfter;
CBT_CREATEWNDA cbtc;
TRACE("(%p)\n", hwnd);
......@@ -140,16 +153,9 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy );
set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER );
parent = GetAncestor( hwnd, GA_PARENT );
if (!parent) /* desktop window */
{
SetPropA( hwnd, "__wine_ttydrv_window", root_window );
return TRUE;
}
#ifdef WINE_CURSES
/* Only create top-level windows */
if (parent == GetDesktopWindow())
if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())
{
WINDOW *window;
const INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */
......
......@@ -124,6 +124,7 @@ static BOOL load_driver(void)
GET_USER_FUNC(ResetSelectionOwner);
GET_USER_FUNC(ChangeDisplaySettingsExW);
GET_USER_FUNC(EnumDisplaySettingsExW);
GET_USER_FUNC(CreateDesktopWindow);
GET_USER_FUNC(CreateWindow);
GET_USER_FUNC(DestroyWindow);
GET_USER_FUNC(GetDCEx);
......
......@@ -137,6 +137,7 @@ typedef struct tagUSER_DRIVER {
LONG (*pChangeDisplaySettingsExW)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
BOOL (*pEnumDisplaySettingsExW)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
/* windowing functions */
BOOL (*pCreateDesktopWindow)(HWND);
BOOL (*pCreateWindow)(HWND,CREATESTRUCTA*,BOOL);
BOOL (*pDestroyWindow)(HWND);
HDC (*pGetDCEx)(HWND,HRGN,DWORD);
......
......@@ -613,8 +613,6 @@ void WIN_DestroyThreadWindows( HWND hwnd )
*/
BOOL WIN_CreateDesktopWindow(void)
{
CREATESTRUCTA cs;
TRACE("Creating desktop window\n");
SERVER_START_REQ( create_window )
......@@ -633,20 +631,7 @@ BOOL WIN_CreateDesktopWindow(void)
return FALSE;
}
cs.lpCreateParams = NULL;
cs.hInstance = 0;
cs.hMenu = 0;
cs.hwndParent = 0;
cs.x = 0;
cs.y = 0;
cs.cx = GetSystemMetrics( SM_CXSCREEN );
cs.cy = GetSystemMetrics( SM_CYSCREEN );
cs.style = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
cs.dwExStyle = 0;
cs.lpszName = NULL;
cs.lpszClass = DESKTOP_CLASS_ATOM;
return USER_Driver.pCreateWindow( hwndDesktop, &cs, TRUE );
return USER_Driver.pCreateDesktopWindow( hwndDesktop );
}
......
......@@ -641,27 +641,6 @@ void X11DRV_sync_window_position( Display *display, struct x11drv_win_data *data
/**********************************************************************
* create_desktop
*/
static void create_desktop( Display *display, struct x11drv_win_data *data )
{
VisualID visualid;
wine_tsx11_lock();
visualid = XVisualIDFromVisual(visual);
wine_tsx11_unlock();
data->whole_window = root_window;
data->whole_rect = data->client_rect = data->window_rect;
SetPropA( data->hwnd, whole_window_prop, (HANDLE)root_window );
SetPropA( data->hwnd, visual_id_prop, (HANDLE)visualid );
if (root_window != DefaultRootWindow(display)) X11DRV_create_desktop_thread();
}
/**********************************************************************
* create_whole_window
*
* Create the whole X window for a given window
......@@ -832,6 +811,60 @@ BOOL X11DRV_DestroyWindow( HWND hwnd )
}
static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd )
{
struct x11drv_win_data *data;
if ((data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data))))
{
data->hwnd = hwnd;
data->whole_window = 0;
data->icon_window = 0;
data->xic = 0;
data->managed = FALSE;
data->dce = NULL;
data->hWMIconBitmap = 0;
data->hWMIconMask = 0;
wine_tsx11_lock();
if (!winContext) winContext = XUniqueContext();
if (!win_data_context) win_data_context = XUniqueContext();
XSaveContext( display, (XID)hwnd, win_data_context, (char *)data );
wine_tsx11_unlock();
}
return data;
}
/**********************************************************************
* CreateDesktopWindow (X11DRV.@)
*/
BOOL X11DRV_CreateDesktopWindow( HWND hwnd )
{
Display *display = thread_display();
VisualID visualid;
struct x11drv_win_data *data;
RECT rect;
if (!(data = alloc_win_data( display, hwnd ))) return FALSE;
data->whole_window = root_window;
SetRect( &rect, 0, 0, screen_width, screen_height );
X11DRV_set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER, NULL );
wine_tsx11_lock();
visualid = XVisualIDFromVisual(visual);
wine_tsx11_unlock();
SetPropA( data->hwnd, whole_window_prop, (HANDLE)root_window );
SetPropA( data->hwnd, visual_id_prop, (HANDLE)visualid );
if (root_window != DefaultRootWindow(display) && !desktop_tid) X11DRV_create_desktop_thread();
return TRUE;
}
/**********************************************************************
* CreateWindow (X11DRV.@)
*/
......@@ -840,13 +873,15 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
Display *display = thread_display();
WND *wndPtr;
struct x11drv_win_data *data;
HWND parent, insert_after;
HWND insert_after;
RECT rect;
DWORD style;
CBT_CREATEWNDA cbtc;
CREATESTRUCTA cbcs;
BOOL ret = FALSE;
if (!(data = alloc_win_data( display, hwnd ))) return FALSE;
if (cs->cx > 65535)
{
ERR( "invalid window width %d\n", cs->cx );
......@@ -868,35 +903,12 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
cs->cy = 0;
}
if (!(data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)))) return FALSE;
data->hwnd = hwnd;
data->whole_window = 0;
data->icon_window = 0;
data->xic = 0;
data->managed = FALSE;
data->dce = NULL;
data->hWMIconBitmap = 0;
data->hWMIconMask = 0;
wine_tsx11_lock();
if (!winContext) winContext = XUniqueContext();
if (!win_data_context) win_data_context = XUniqueContext();
XSaveContext( display, (XID)hwnd, win_data_context, (char *)data );
wine_tsx11_unlock();
/* initialize the dimensions before sending WM_GETMINMAXINFO */
SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy );
X11DRV_set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER, NULL );
parent = GetAncestor( hwnd, GA_PARENT );
if (!parent)
{
create_desktop( display, data );
return TRUE;
}
/* create an X window if it's a top level window */
if (parent == GetDesktopWindow())
if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())
{
if (!create_whole_window( display, data, cs->style )) goto failed;
}
......
......@@ -85,6 +85,7 @@
@ cdecl EnumDisplaySettingsExW (ptr long ptr long) X11DRV_EnumDisplaySettingsExW
@ cdecl AcquireClipboard(long) X11DRV_AcquireClipboard
@ cdecl CountClipboardFormats() X11DRV_CountClipboardFormats
@ cdecl CreateDesktopWindow(long) X11DRV_CreateDesktopWindow
@ cdecl CreateWindow(long ptr long) X11DRV_CreateWindow
@ cdecl DestroyWindow(long) X11DRV_DestroyWindow
@ cdecl EmptyClipboard(long) X11DRV_EmptyClipboard
......
......@@ -588,7 +588,11 @@ BOOL X11DRV_set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow
}
SERVER_END_REQ;
if (win == WND_DESKTOP) return ret;
if (win == WND_DESKTOP)
{
data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
return ret;
}
if (ret)
{
......
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