Commit 7afa53c0 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Use standard dlopen() instead of the libwine wrappers.

parent 73effb1a
...@@ -87,7 +87,6 @@ ...@@ -87,7 +87,6 @@
#include "shlobj.h" #include "shlobj.h"
#include "shellapi.h" #include "shellapi.h"
#include "shlwapi.h" #include "shlwapi.h"
#include "wine/library.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
...@@ -1986,14 +1985,14 @@ static void xfixes_init(void) ...@@ -1986,14 +1985,14 @@ static void xfixes_init(void)
int major = 3, minor = 0; int major = 3, minor = 0;
void *handle; void *handle;
handle = wine_dlopen(SONAME_LIBXFIXES, RTLD_NOW, NULL, 0); handle = dlopen(SONAME_LIBXFIXES, RTLD_NOW);
if (!handle) return; if (!handle) return;
pXFixesQueryExtension = wine_dlsym(handle, "XFixesQueryExtension", NULL, 0); pXFixesQueryExtension = dlsym(handle, "XFixesQueryExtension");
if (!pXFixesQueryExtension) return; if (!pXFixesQueryExtension) return;
pXFixesQueryVersion = wine_dlsym(handle, "XFixesQueryVersion", NULL, 0); pXFixesQueryVersion = dlsym(handle, "XFixesQueryVersion");
if (!pXFixesQueryVersion) return; if (!pXFixesQueryVersion) return;
pXFixesSelectSelectionInput = wine_dlsym(handle, "XFixesSelectSelectionInput", NULL, 0); pXFixesSelectSelectionInput = dlsym(handle, "XFixesSelectSelectionInput");
if (!pXFixesSelectSelectionInput) return; if (!pXFixesSelectSelectionInput) return;
if (!pXFixesQueryExtension(clipboard_display, &event_base, &error_base)) if (!pXFixesQueryExtension(clipboard_display, &event_base, &error_base))
......
...@@ -51,7 +51,6 @@ MAKE_FUNCPTR(XcursorLibraryLoadCursor); ...@@ -51,7 +51,6 @@ MAKE_FUNCPTR(XcursorLibraryLoadCursor);
#include "x11drv.h" #include "x11drv.h"
#include "wine/server.h" #include "wine/server.h"
#include "wine/library.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -151,14 +150,13 @@ MAKE_FUNCPTR(XISelectEvents); ...@@ -151,14 +150,13 @@ MAKE_FUNCPTR(XISelectEvents);
void X11DRV_Xcursor_Init(void) void X11DRV_Xcursor_Init(void)
{ {
#ifdef SONAME_LIBXCURSOR #ifdef SONAME_LIBXCURSOR
xcursor_handle = wine_dlopen(SONAME_LIBXCURSOR, RTLD_NOW, NULL, 0); xcursor_handle = dlopen(SONAME_LIBXCURSOR, RTLD_NOW);
if (!xcursor_handle) /* wine_dlopen failed. */ if (!xcursor_handle)
{ {
WARN("Xcursor failed to load. Using fallback code.\n"); WARN("Xcursor failed to load. Using fallback code.\n");
return; return;
} }
#define LOAD_FUNCPTR(f) \ #define LOAD_FUNCPTR(f) p##f = dlsym(xcursor_handle, #f)
p##f = wine_dlsym(xcursor_handle, #f, NULL, 0)
LOAD_FUNCPTR(XcursorImageCreate); LOAD_FUNCPTR(XcursorImageCreate);
LOAD_FUNCPTR(XcursorImageDestroy); LOAD_FUNCPTR(XcursorImageDestroy);
...@@ -1868,7 +1866,7 @@ void X11DRV_XInput2_Init(void) ...@@ -1868,7 +1866,7 @@ void X11DRV_XInput2_Init(void)
{ {
#if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H) #if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H)
int event, error; int event, error;
void *libxi_handle = wine_dlopen( SONAME_LIBXI, RTLD_NOW, NULL, 0 ); void *libxi_handle = dlopen( SONAME_LIBXI, RTLD_NOW );
if (!libxi_handle) if (!libxi_handle)
{ {
...@@ -1876,7 +1874,7 @@ void X11DRV_XInput2_Init(void) ...@@ -1876,7 +1874,7 @@ void X11DRV_XInput2_Init(void)
return; return;
} }
#define LOAD_FUNCPTR(f) \ #define LOAD_FUNCPTR(f) \
if (!(p##f = wine_dlsym( libxi_handle, #f, NULL, 0))) \ if (!(p##f = dlsym( libxi_handle, #f))) \
{ \ { \
WARN("Failed to load %s.\n", #f); \ WARN("Failed to load %s.\n", #f); \
return; \ return; \
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include "x11drv.h" #include "x11drv.h"
#include "xcomposite.h" #include "xcomposite.h"
#include "winternl.h" #include "winternl.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
#ifdef SONAME_LIBGL #ifdef SONAME_LIBGL
...@@ -545,23 +544,22 @@ static void *opengl_handle; ...@@ -545,23 +544,22 @@ static void *opengl_handle;
static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context ) static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context )
{ {
char buffer[200];
int error_base, event_base; int error_base, event_base;
unsigned int i; unsigned int i;
/* No need to load any other libraries as according to the ABI, libGL should be self-sufficient /* No need to load any other libraries as according to the ABI, libGL should be self-sufficient
and include all dependencies */ and include all dependencies */
opengl_handle = wine_dlopen(SONAME_LIBGL, RTLD_NOW|RTLD_GLOBAL, buffer, sizeof(buffer)); opengl_handle = dlopen( SONAME_LIBGL, RTLD_NOW | RTLD_GLOBAL );
if (opengl_handle == NULL) if (opengl_handle == NULL)
{ {
ERR( "Failed to load libGL: %s\n", buffer ); ERR( "Failed to load libGL: %s\n", dlerror() );
ERR( "OpenGL support is disabled.\n"); ERR( "OpenGL support is disabled.\n");
return TRUE; return TRUE;
} }
for (i = 0; i < ARRAY_SIZE( opengl_func_names ); i++) for (i = 0; i < ARRAY_SIZE( opengl_func_names ); i++)
{ {
if (!(((void **)&opengl_funcs.gl)[i] = wine_dlsym( opengl_handle, opengl_func_names[i], NULL, 0 ))) if (!(((void **)&opengl_funcs.gl)[i] = dlsym( opengl_handle, opengl_func_names[i] )))
{ {
ERR( "%s not found in libGL, disabling OpenGL.\n", opengl_func_names[i] ); ERR( "%s not found in libGL, disabling OpenGL.\n", opengl_func_names[i] );
goto failed; goto failed;
...@@ -576,7 +574,7 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context ) ...@@ -576,7 +574,7 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context )
REDIRECT( glGetString ); REDIRECT( glGetString );
#undef REDIRECT #undef REDIRECT
pglXGetProcAddressARB = wine_dlsym(opengl_handle, "glXGetProcAddressARB", NULL, 0); pglXGetProcAddressARB = dlsym(opengl_handle, "glXGetProcAddressARB");
if (pglXGetProcAddressARB == NULL) { if (pglXGetProcAddressARB == NULL) {
ERR("Could not find glXGetProcAddressARB in libGL, disabling OpenGL.\n"); ERR("Could not find glXGetProcAddressARB in libGL, disabling OpenGL.\n");
goto failed; goto failed;
...@@ -727,7 +725,7 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context ) ...@@ -727,7 +725,7 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context )
return TRUE; return TRUE;
failed: failed:
wine_dlclose(opengl_handle, NULL, 0); dlclose(opengl_handle);
opengl_handle = NULL; opengl_handle = NULL;
return TRUE; return TRUE;
} }
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/library.h"
#include "x11drv.h" #include "x11drv.h"
#define VK_NO_PROTOTYPES #define VK_NO_PROTOTYPES
...@@ -107,34 +106,34 @@ static void *vulkan_handle; ...@@ -107,34 +106,34 @@ static void *vulkan_handle;
static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
{ {
if (!(vulkan_handle = wine_dlopen(SONAME_LIBVULKAN, RTLD_NOW, NULL, 0))) if (!(vulkan_handle = dlopen(SONAME_LIBVULKAN, RTLD_NOW)))
{ {
ERR("Failed to load %s.\n", SONAME_LIBVULKAN); ERR("Failed to load %s.\n", SONAME_LIBVULKAN);
return TRUE; return TRUE;
} }
#define LOAD_FUNCPTR(f) if (!(p##f = wine_dlsym(vulkan_handle, #f, NULL, 0))) goto fail; #define LOAD_FUNCPTR(f) if (!(p##f = dlsym(vulkan_handle, #f))) goto fail
#define LOAD_OPTIONAL_FUNCPTR(f) p##f = wine_dlsym(vulkan_handle, #f, NULL, 0); #define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(vulkan_handle, #f)
LOAD_FUNCPTR(vkCreateInstance) LOAD_FUNCPTR(vkCreateInstance);
LOAD_FUNCPTR(vkCreateSwapchainKHR) LOAD_FUNCPTR(vkCreateSwapchainKHR);
LOAD_FUNCPTR(vkCreateXlibSurfaceKHR) LOAD_FUNCPTR(vkCreateXlibSurfaceKHR);
LOAD_FUNCPTR(vkDestroyInstance) LOAD_FUNCPTR(vkDestroyInstance);
LOAD_FUNCPTR(vkDestroySurfaceKHR) LOAD_FUNCPTR(vkDestroySurfaceKHR);
LOAD_FUNCPTR(vkDestroySwapchainKHR) LOAD_FUNCPTR(vkDestroySwapchainKHR);
LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties) LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties);
LOAD_FUNCPTR(vkGetDeviceProcAddr) LOAD_FUNCPTR(vkGetDeviceProcAddr);
LOAD_FUNCPTR(vkGetInstanceProcAddr) LOAD_FUNCPTR(vkGetInstanceProcAddr);
LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilities2KHR) LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilities2KHR);
LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR);
LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceFormats2KHR) LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceFormats2KHR);
LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceFormatsKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceFormatsKHR);
LOAD_FUNCPTR(vkGetPhysicalDeviceSurfacePresentModesKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfacePresentModesKHR);
LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceSupportKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceSupportKHR);
LOAD_FUNCPTR(vkGetPhysicalDeviceXlibPresentationSupportKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceXlibPresentationSupportKHR);
LOAD_FUNCPTR(vkGetSwapchainImagesKHR) LOAD_FUNCPTR(vkGetSwapchainImagesKHR);
LOAD_FUNCPTR(vkQueuePresentKHR) LOAD_FUNCPTR(vkQueuePresentKHR);
LOAD_OPTIONAL_FUNCPTR(vkGetDeviceGroupSurfacePresentModesKHR) LOAD_OPTIONAL_FUNCPTR(vkGetDeviceGroupSurfacePresentModesKHR);
LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDevicePresentRectanglesKHR) LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDevicePresentRectanglesKHR);
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
#undef LOAD_OPTIONAL_FUNCPTR #undef LOAD_OPTIONAL_FUNCPTR
...@@ -143,7 +142,7 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) ...@@ -143,7 +142,7 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
return TRUE; return TRUE;
fail: fail:
wine_dlclose(vulkan_handle, NULL, 0); dlclose(vulkan_handle);
vulkan_handle = NULL; vulkan_handle = NULL;
return TRUE; return TRUE;
} }
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "x11drv.h" #include "x11drv.h"
#include "wine/library.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wintab.h" #include "wintab.h"
...@@ -327,18 +326,18 @@ MAKE_FUNCPTR(XFreeDeviceState) ...@@ -327,18 +326,18 @@ MAKE_FUNCPTR(XFreeDeviceState)
static INT X11DRV_XInput_Init(void) static INT X11DRV_XInput_Init(void)
{ {
xinput_handle = wine_dlopen(SONAME_LIBXI, RTLD_NOW, NULL, 0); xinput_handle = dlopen(SONAME_LIBXI, RTLD_NOW);
if (xinput_handle) if (xinput_handle)
{ {
#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(xinput_handle, #f, NULL, 0)) == NULL) goto sym_not_found; #define LOAD_FUNCPTR(f) if((p##f = dlsym(xinput_handle, #f)) == NULL) goto sym_not_found
LOAD_FUNCPTR(XListInputDevices) LOAD_FUNCPTR(XListInputDevices);
LOAD_FUNCPTR(XFreeDeviceList) LOAD_FUNCPTR(XFreeDeviceList);
LOAD_FUNCPTR(XOpenDevice) LOAD_FUNCPTR(XOpenDevice);
LOAD_FUNCPTR(XGetDeviceButtonMapping) LOAD_FUNCPTR(XGetDeviceButtonMapping);
LOAD_FUNCPTR(XCloseDevice) LOAD_FUNCPTR(XCloseDevice);
LOAD_FUNCPTR(XSelectExtensionEvent) LOAD_FUNCPTR(XSelectExtensionEvent);
LOAD_FUNCPTR(XQueryDeviceState) LOAD_FUNCPTR(XQueryDeviceState);
LOAD_FUNCPTR(XFreeDeviceState) LOAD_FUNCPTR(XFreeDeviceState);
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
return 1; return 1;
} }
......
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include "wine/server.h" #include "wine/server.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/library.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/heap.h" #include "wine/heap.h"
...@@ -461,7 +460,7 @@ static int xcomp_error_base; ...@@ -461,7 +460,7 @@ static int xcomp_error_base;
static void X11DRV_XComposite_Init(void) static void X11DRV_XComposite_Init(void)
{ {
void *xcomposite_handle = wine_dlopen(SONAME_LIBXCOMPOSITE, RTLD_NOW, NULL, 0); void *xcomposite_handle = dlopen(SONAME_LIBXCOMPOSITE, RTLD_NOW);
if (!xcomposite_handle) if (!xcomposite_handle)
{ {
TRACE("Unable to open %s, XComposite disabled\n", SONAME_LIBXCOMPOSITE); TRACE("Unable to open %s, XComposite disabled\n", SONAME_LIBXCOMPOSITE);
...@@ -470,23 +469,22 @@ static void X11DRV_XComposite_Init(void) ...@@ -470,23 +469,22 @@ static void X11DRV_XComposite_Init(void)
} }
#define LOAD_FUNCPTR(f) \ #define LOAD_FUNCPTR(f) \
if((p##f = wine_dlsym(xcomposite_handle, #f, NULL, 0)) == NULL) \ if((p##f = dlsym(xcomposite_handle, #f)) == NULL) goto sym_not_found
goto sym_not_found; LOAD_FUNCPTR(XCompositeQueryExtension);
LOAD_FUNCPTR(XCompositeQueryExtension) LOAD_FUNCPTR(XCompositeQueryVersion);
LOAD_FUNCPTR(XCompositeQueryVersion) LOAD_FUNCPTR(XCompositeVersion);
LOAD_FUNCPTR(XCompositeVersion) LOAD_FUNCPTR(XCompositeRedirectWindow);
LOAD_FUNCPTR(XCompositeRedirectWindow) LOAD_FUNCPTR(XCompositeRedirectSubwindows);
LOAD_FUNCPTR(XCompositeRedirectSubwindows) LOAD_FUNCPTR(XCompositeUnredirectWindow);
LOAD_FUNCPTR(XCompositeUnredirectWindow) LOAD_FUNCPTR(XCompositeUnredirectSubwindows);
LOAD_FUNCPTR(XCompositeUnredirectSubwindows) LOAD_FUNCPTR(XCompositeCreateRegionFromBorderClip);
LOAD_FUNCPTR(XCompositeCreateRegionFromBorderClip) LOAD_FUNCPTR(XCompositeNameWindowPixmap);
LOAD_FUNCPTR(XCompositeNameWindowPixmap)
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
if(!pXCompositeQueryExtension(gdi_display, &xcomp_event_base, if(!pXCompositeQueryExtension(gdi_display, &xcomp_event_base,
&xcomp_error_base)) { &xcomp_error_base)) {
TRACE("XComposite extension could not be queried; disabled\n"); TRACE("XComposite extension could not be queried; disabled\n");
wine_dlclose(xcomposite_handle, NULL, 0); dlclose(xcomposite_handle);
xcomposite_handle = NULL; xcomposite_handle = NULL;
usexcomposite = FALSE; usexcomposite = FALSE;
return; return;
...@@ -496,7 +494,7 @@ static void X11DRV_XComposite_Init(void) ...@@ -496,7 +494,7 @@ static void X11DRV_XComposite_Init(void)
sym_not_found: sym_not_found:
TRACE("Unable to load function pointers from %s, XComposite disabled\n", SONAME_LIBXCOMPOSITE); TRACE("Unable to load function pointers from %s, XComposite disabled\n", SONAME_LIBXCOMPOSITE);
wine_dlclose(xcomposite_handle, NULL, 0); dlclose(xcomposite_handle);
xcomposite_handle = NULL; xcomposite_handle = NULL;
usexcomposite = FALSE; usexcomposite = FALSE;
} }
...@@ -560,19 +558,18 @@ static void init_visuals( Display *display, int screen ) ...@@ -560,19 +558,18 @@ static void init_visuals( Display *display, int screen )
*/ */
static BOOL process_attach(void) static BOOL process_attach(void)
{ {
char error[1024];
Display *display; Display *display;
void *libx11 = wine_dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL, error, sizeof(error) ); void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL );
if (!libx11) if (!libx11)
{ {
ERR( "failed to load %s: %s\n", SONAME_LIBX11, error ); ERR( "failed to load %s: %s\n", SONAME_LIBX11, dlerror() );
return FALSE; return FALSE;
} }
pXGetEventData = wine_dlsym( libx11, "XGetEventData", NULL, 0 ); pXGetEventData = dlsym( libx11, "XGetEventData" );
pXFreeEventData = wine_dlsym( libx11, "XFreeEventData", NULL, 0 ); pXFreeEventData = dlsym( libx11, "XFreeEventData" );
#ifdef SONAME_LIBXEXT #ifdef SONAME_LIBXEXT
wine_dlopen( SONAME_LIBXEXT, RTLD_NOW|RTLD_GLOBAL, NULL, 0 ); dlopen( SONAME_LIBXEXT, RTLD_NOW|RTLD_GLOBAL );
#endif #endif
setup_options(); setup_options();
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#ifdef HAVE_X11_EXTENSIONS_XINERAMA_H #ifdef HAVE_X11_EXTENSIONS_XINERAMA_H
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#endif #endif
#include "wine/library.h"
#include "x11drv.h" #include "x11drv.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h" #include "wine/heap.h"
...@@ -86,14 +85,14 @@ static void load_xinerama(void) ...@@ -86,14 +85,14 @@ static void load_xinerama(void)
{ {
void *handle; void *handle;
if (!(handle = wine_dlopen(SONAME_LIBXINERAMA, RTLD_NOW, NULL, 0))) if (!(handle = dlopen(SONAME_LIBXINERAMA, RTLD_NOW)))
{ {
WARN( "failed to open %s\n", SONAME_LIBXINERAMA ); WARN( "failed to open %s\n", SONAME_LIBXINERAMA );
return; return;
} }
pXineramaQueryExtension = wine_dlsym( handle, "XineramaQueryExtension", NULL, 0 ); pXineramaQueryExtension = dlsym( handle, "XineramaQueryExtension" );
if (!pXineramaQueryExtension) WARN( "XineramaQueryScreens not found\n" ); if (!pXineramaQueryExtension) WARN( "XineramaQueryScreens not found\n" );
pXineramaQueryScreens = wine_dlsym( handle, "XineramaQueryScreens", NULL, 0 ); pXineramaQueryScreens = dlsym( handle, "XineramaQueryScreens" );
if (!pXineramaQueryScreens) WARN( "XineramaQueryScreens not found\n" ); if (!pXineramaQueryScreens) WARN( "XineramaQueryScreens not found\n" );
} }
......
...@@ -36,7 +36,6 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); ...@@ -36,7 +36,6 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
#include "x11drv.h" #include "x11drv.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/library.h"
#include "wine/unicode.h" #include "wine/unicode.h"
static void *xrandr_handle; static void *xrandr_handle;
...@@ -88,46 +87,45 @@ static int load_xrandr(void) ...@@ -88,46 +87,45 @@ static int load_xrandr(void)
{ {
int r = 0; int r = 0;
if (wine_dlopen(SONAME_LIBXRENDER, RTLD_NOW|RTLD_GLOBAL, NULL, 0) && if (dlopen(SONAME_LIBXRENDER, RTLD_NOW|RTLD_GLOBAL) &&
(xrandr_handle = wine_dlopen(SONAME_LIBXRANDR, RTLD_NOW, NULL, 0))) (xrandr_handle = dlopen(SONAME_LIBXRANDR, RTLD_NOW)))
{ {
#define LOAD_FUNCPTR(f) \ #define LOAD_FUNCPTR(f) \
if((p##f = wine_dlsym(xrandr_handle, #f, NULL, 0)) == NULL) \ if((p##f = dlsym(xrandr_handle, #f)) == NULL) goto sym_not_found
goto sym_not_found;
LOAD_FUNCPTR(XRRConfigCurrentConfiguration);
LOAD_FUNCPTR(XRRConfigCurrentConfiguration) LOAD_FUNCPTR(XRRConfigCurrentRate);
LOAD_FUNCPTR(XRRConfigCurrentRate) LOAD_FUNCPTR(XRRFreeScreenConfigInfo);
LOAD_FUNCPTR(XRRFreeScreenConfigInfo) LOAD_FUNCPTR(XRRGetScreenInfo);
LOAD_FUNCPTR(XRRGetScreenInfo) LOAD_FUNCPTR(XRRQueryExtension);
LOAD_FUNCPTR(XRRQueryExtension) LOAD_FUNCPTR(XRRQueryVersion);
LOAD_FUNCPTR(XRRQueryVersion) LOAD_FUNCPTR(XRRRates);
LOAD_FUNCPTR(XRRRates) LOAD_FUNCPTR(XRRSetScreenConfig);
LOAD_FUNCPTR(XRRSetScreenConfig) LOAD_FUNCPTR(XRRSetScreenConfigAndRate);
LOAD_FUNCPTR(XRRSetScreenConfigAndRate) LOAD_FUNCPTR(XRRSizes);
LOAD_FUNCPTR(XRRSizes)
r = 1; r = 1;
#ifdef HAVE_XRRGETSCREENRESOURCES #ifdef HAVE_XRRGETSCREENRESOURCES
LOAD_FUNCPTR(XRRFreeCrtcInfo) LOAD_FUNCPTR(XRRFreeCrtcInfo);
LOAD_FUNCPTR(XRRFreeOutputInfo) LOAD_FUNCPTR(XRRFreeOutputInfo);
LOAD_FUNCPTR(XRRFreeScreenResources) LOAD_FUNCPTR(XRRFreeScreenResources);
LOAD_FUNCPTR(XRRGetCrtcInfo) LOAD_FUNCPTR(XRRGetCrtcInfo);
LOAD_FUNCPTR(XRRGetOutputInfo) LOAD_FUNCPTR(XRRGetOutputInfo);
LOAD_FUNCPTR(XRRGetScreenResources) LOAD_FUNCPTR(XRRGetScreenResources);
LOAD_FUNCPTR(XRRGetScreenSizeRange) LOAD_FUNCPTR(XRRGetScreenSizeRange);
LOAD_FUNCPTR(XRRSetCrtcConfig) LOAD_FUNCPTR(XRRSetCrtcConfig);
LOAD_FUNCPTR(XRRSetScreenSize) LOAD_FUNCPTR(XRRSetScreenSize);
r = 2; r = 2;
#endif #endif
#ifdef HAVE_XRRGETPROVIDERRESOURCES #ifdef HAVE_XRRGETPROVIDERRESOURCES
LOAD_FUNCPTR(XRRSelectInput) LOAD_FUNCPTR(XRRSelectInput);
LOAD_FUNCPTR(XRRGetOutputPrimary) LOAD_FUNCPTR(XRRGetOutputPrimary);
LOAD_FUNCPTR(XRRGetProviderResources) LOAD_FUNCPTR(XRRGetProviderResources);
LOAD_FUNCPTR(XRRFreeProviderResources) LOAD_FUNCPTR(XRRFreeProviderResources);
LOAD_FUNCPTR(XRRGetProviderInfo) LOAD_FUNCPTR(XRRGetProviderInfo);
LOAD_FUNCPTR(XRRFreeProviderInfo) LOAD_FUNCPTR(XRRFreeProviderInfo);
r = 4; r = 4;
#endif #endif
...@@ -1120,7 +1118,7 @@ void X11DRV_XRandR_Init(void) ...@@ -1120,7 +1118,7 @@ void X11DRV_XRandR_Init(void)
if (ret >= 2 && (major > 1 || (major == 1 && minor >= 2))) if (ret >= 2 && (major > 1 || (major == 1 && minor >= 2)))
{ {
if (major > 1 || (major == 1 && minor >= 3)) if (major > 1 || (major == 1 && minor >= 3))
pXRRGetScreenResourcesCurrent = wine_dlsym( xrandr_handle, "XRRGetScreenResourcesCurrent", NULL, 0 ); pXRRGetScreenResourcesCurrent = dlsym( xrandr_handle, "XRRGetScreenResourcesCurrent" );
if (!pXRRGetScreenResourcesCurrent) if (!pXRRGetScreenResourcesCurrent)
pXRRGetScreenResourcesCurrent = pXRRGetScreenResources; pXRRGetScreenResourcesCurrent = pXRRGetScreenResources;
} }
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "winbase.h" #include "winbase.h"
#include "x11drv.h" #include "x11drv.h"
#include "winternl.h" #include "winternl.h"
#include "wine/library.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -326,10 +325,10 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void) ...@@ -326,10 +325,10 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void)
int event_base, i; int event_base, i;
if (!client_side_with_render) return NULL; if (!client_side_with_render) return NULL;
if (!(xrender_handle = wine_dlopen(SONAME_LIBXRENDER, RTLD_NOW, NULL, 0))) return NULL; if (!(xrender_handle = dlopen(SONAME_LIBXRENDER, RTLD_NOW))) return NULL;
#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(xrender_handle, #f, NULL, 0)) == NULL) return NULL #define LOAD_FUNCPTR(f) if((p##f = dlsym(xrender_handle, #f)) == NULL) return NULL
#define LOAD_OPTIONAL_FUNCPTR(f) p##f = wine_dlsym(xrender_handle, #f, NULL, 0) #define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(xrender_handle, #f)
LOAD_FUNCPTR(XRenderAddGlyphs); LOAD_FUNCPTR(XRenderAddGlyphs);
LOAD_FUNCPTR(XRenderChangePicture); LOAD_FUNCPTR(XRenderChangePicture);
LOAD_FUNCPTR(XRenderComposite); LOAD_FUNCPTR(XRenderComposite);
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "wingdi.h" #include "wingdi.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/library.h"
WINE_DEFAULT_DEBUG_CHANNEL(xvidmode); WINE_DEFAULT_DEBUG_CHANNEL(xvidmode);
...@@ -160,7 +159,7 @@ void X11DRV_XF86VM_Init(void) ...@@ -160,7 +159,7 @@ void X11DRV_XF86VM_Init(void)
if (xf86vm_major) return; /* already initialized? */ if (xf86vm_major) return; /* already initialized? */
xvidmode_handle = wine_dlopen(SONAME_LIBXXF86VM, RTLD_NOW, NULL, 0); xvidmode_handle = dlopen(SONAME_LIBXXF86VM, RTLD_NOW);
if (!xvidmode_handle) if (!xvidmode_handle)
{ {
TRACE("Unable to open %s, XVidMode disabled\n", SONAME_LIBXXF86VM); TRACE("Unable to open %s, XVidMode disabled\n", SONAME_LIBXXF86VM);
...@@ -169,23 +168,22 @@ void X11DRV_XF86VM_Init(void) ...@@ -169,23 +168,22 @@ void X11DRV_XF86VM_Init(void)
} }
#define LOAD_FUNCPTR(f) \ #define LOAD_FUNCPTR(f) \
if((p##f = wine_dlsym(xvidmode_handle, #f, NULL, 0)) == NULL) \ if((p##f = dlsym(xvidmode_handle, #f)) == NULL) goto sym_not_found
goto sym_not_found; LOAD_FUNCPTR(XF86VidModeGetAllModeLines);
LOAD_FUNCPTR(XF86VidModeGetAllModeLines) LOAD_FUNCPTR(XF86VidModeGetModeLine);
LOAD_FUNCPTR(XF86VidModeGetModeLine) LOAD_FUNCPTR(XF86VidModeLockModeSwitch);
LOAD_FUNCPTR(XF86VidModeLockModeSwitch) LOAD_FUNCPTR(XF86VidModeQueryExtension);
LOAD_FUNCPTR(XF86VidModeQueryExtension) LOAD_FUNCPTR(XF86VidModeQueryVersion);
LOAD_FUNCPTR(XF86VidModeQueryVersion) LOAD_FUNCPTR(XF86VidModeSetViewPort);
LOAD_FUNCPTR(XF86VidModeSetViewPort) LOAD_FUNCPTR(XF86VidModeSwitchToMode);
LOAD_FUNCPTR(XF86VidModeSwitchToMode)
#ifdef X_XF86VidModeSetGamma #ifdef X_XF86VidModeSetGamma
LOAD_FUNCPTR(XF86VidModeGetGamma) LOAD_FUNCPTR(XF86VidModeGetGamma);
LOAD_FUNCPTR(XF86VidModeSetGamma) LOAD_FUNCPTR(XF86VidModeSetGamma);
#endif #endif
#ifdef X_XF86VidModeSetGammaRamp #ifdef X_XF86VidModeSetGammaRamp
LOAD_FUNCPTR(XF86VidModeGetGammaRamp) LOAD_FUNCPTR(XF86VidModeGetGammaRamp);
LOAD_FUNCPTR(XF86VidModeGetGammaRampSize) LOAD_FUNCPTR(XF86VidModeGetGammaRampSize);
LOAD_FUNCPTR(XF86VidModeSetGammaRamp) LOAD_FUNCPTR(XF86VidModeSetGammaRamp);
#endif #endif
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
...@@ -242,7 +240,7 @@ void X11DRV_XF86VM_Init(void) ...@@ -242,7 +240,7 @@ void X11DRV_XF86VM_Init(void)
sym_not_found: sym_not_found:
TRACE("Unable to load function pointers from %s, XVidMode disabled\n", SONAME_LIBXXF86VM); TRACE("Unable to load function pointers from %s, XVidMode disabled\n", SONAME_LIBXXF86VM);
wine_dlclose(xvidmode_handle, NULL, 0); dlclose(xvidmode_handle);
xvidmode_handle = NULL; xvidmode_handle = NULL;
usexvidmode = FALSE; usexvidmode = FALSE;
} }
......
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