explorer: Retrieve the graphics driver module from gdi32.

This commit is contained in:
Alexandre Julliard 2013-02-06 12:46:14 +01:00
parent 0d7108c629
commit 3e24a17c03
3 changed files with 20 additions and 14 deletions

View file

@ -21,13 +21,14 @@
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include "wine/unicode.h"
#define OEMRESOURCE
#include <windows.h>
#include <rpc.h>
#include <wine/debug.h>
#include "wine/gdi_driver.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "explorer_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(explorer);
@ -35,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(explorer);
#define DESKTOP_CLASS_ATOM ((LPCWSTR)MAKEINTATOM(32769))
#define DESKTOP_ALL_ACCESS 0x01ff
static HMODULE graphics_driver;
static BOOL using_root;
/* screen saver handler */
@ -108,7 +110,6 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR
static unsigned long create_desktop( const WCHAR *name, unsigned int width, unsigned int height )
{
static const WCHAR rootW[] = {'r','o','o','t',0};
HMODULE x11drv = GetModuleHandleA( "winex11.drv" );
HDESK desktop;
unsigned long xwin = 0;
unsigned long (CDECL *create_desktop_func)(unsigned int, unsigned int);
@ -119,10 +120,10 @@ static unsigned long create_desktop( const WCHAR *name, unsigned int width, unsi
WINE_ERR( "failed to create desktop %s error %d\n", wine_dbgstr_w(name), GetLastError() );
ExitProcess( 1 );
}
/* magic: desktop "root" means use the X11 root window */
if (x11drv && strcmpiW( name, rootW ))
/* magic: desktop "root" means use the root window */
if (graphics_driver && strcmpiW( name, rootW ))
{
create_desktop_func = (void *)GetProcAddress( x11drv, "wine_create_desktop" );
create_desktop_func = (void *)GetProcAddress( graphics_driver, "wine_create_desktop" );
if (create_desktop_func) xwin = create_desktop_func( width, height );
}
SetThreadDesktop( desktop );
@ -260,8 +261,10 @@ static void set_desktop_window_title( HWND hwnd, const WCHAR *name )
/* main desktop management function */
void manage_desktop( WCHAR *arg )
{
static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
static const WCHAR messageW[] = {'M','e','s','s','a','g','e',0};
MSG msg;
HDC hdc;
HWND hwnd, msg_hwnd;
unsigned long xwin = 0;
unsigned int width, height;
@ -293,6 +296,9 @@ void manage_desktop( WCHAR *arg )
if (!get_default_desktop_size( name, &width, &height )) width = height = 0;
}
hdc = CreateDCW( displayW, NULL, NULL, NULL );
graphics_driver = __wine_get_driver_module( hdc );
if (name && width && height) xwin = create_desktop( name, width, height );
if (!xwin) using_root = TRUE; /* using the root window */
@ -308,6 +314,8 @@ void manage_desktop( WCHAR *arg )
msg_hwnd = CreateWindowExW( 0, messageW, NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
0, 0, 100, 100, 0, 0, 0, NULL );
DeleteDC( hdc );
if (hwnd == GetDesktopWindow())
{
HMODULE shell32;
@ -320,7 +328,7 @@ void manage_desktop( WCHAR *arg )
ClipCursor( NULL );
initialize_display_settings( hwnd );
initialize_appbar();
initialize_systray( using_root );
initialize_systray( graphics_driver, using_root );
if ((shell32 = LoadLibraryA( "shell32.dll" )) &&
(pShellDDEInit = (void *)GetProcAddress( shell32, (LPCSTR)188)))

View file

@ -22,7 +22,7 @@
#define __WINE_EXPLORER_PRIVATE_H
extern void manage_desktop( WCHAR *arg );
extern void initialize_systray( BOOL using_root );
extern void initialize_systray( HMODULE graphics_driver, BOOL using_root );
extern void initialize_appbar(void);
#endif /* __WINE_EXPLORER_PRIVATE_H */

View file

@ -629,14 +629,12 @@ static LRESULT WINAPI tray_wndproc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
}
/* this function creates the listener window */
void initialize_systray( BOOL using_root )
void initialize_systray( HMODULE graphics_driver, BOOL using_root )
{
HMODULE x11drv;
WNDCLASSEXW class;
static const WCHAR classname[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0};
if ((x11drv = GetModuleHandleA( "winex11.drv" )))
wine_notify_icon = (void *)GetProcAddress( x11drv, "wine_notify_icon" );
wine_notify_icon = (void *)GetProcAddress( graphics_driver, "wine_notify_icon" );
icon_cx = GetSystemMetrics( SM_CXSMICON ) + 2*ICON_BORDER;
icon_cy = GetSystemMetrics( SM_CYSMICON ) + 2*ICON_BORDER;
@ -651,7 +649,7 @@ void initialize_systray( BOOL using_root )
class.hIcon = LoadIconW(0, (LPCWSTR)IDI_WINLOGO);
class.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
class.hbrBackground = (HBRUSH) COLOR_WINDOW;
class.lpszClassName = (WCHAR *) &classname;
class.lpszClassName = classname;
if (!RegisterClassExW(&class))
{