Make DragAcceptFiles go through function pointer

This commit is contained in:
twinaphex 2017-08-09 16:25:23 +02:00
parent 4e49155147
commit 2f832d145f
2 changed files with 23 additions and 4 deletions

View File

@ -46,6 +46,9 @@
*/ */
static dylib_t dwmlib; static dylib_t dwmlib;
static dylib_t shell32lib;
VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL);
static bool dwm_composition_disabled; static bool dwm_composition_disabled;
@ -55,7 +58,10 @@ static void gfx_dwm_shutdown(void)
{ {
if (dwmlib) if (dwmlib)
dylib_close(dwmlib); dylib_close(dwmlib);
dwmlib = NULL; if (shell32lib)
dylib_close(shell32lib);
dwmlib = NULL;
shell32lib = NULL;
} }
static bool gfx_init_dwm(void) static bool gfx_init_dwm(void)
@ -65,13 +71,23 @@ static bool gfx_init_dwm(void)
if (inited) if (inited)
return true; return true;
atexit(gfx_dwm_shutdown);
shell32lib = dylib_load("shell32.dll");
if (!shell32lib)
{
RARCH_WARN("Did not find shell32.dll.\n");
}
dwmlib = dylib_load("dwmapi.dll"); dwmlib = dylib_load("dwmapi.dll");
if (!dwmlib) if (!dwmlib)
{ {
RARCH_LOG("Did not find dwmapi.dll.\n"); RARCH_WARN("Did not find dwmapi.dll.\n");
return false; return false;
} }
atexit(gfx_dwm_shutdown);
DragAcceptFiles_func =
(VOID (WINAPI*)(HWND, BOOL))dylib_proc(shell32lib, "DragAcceptFiles");
HRESULT (WINAPI *mmcss)(BOOL) = HRESULT (WINAPI *mmcss)(BOOL) =
(HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS"); (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS");

View File

@ -487,9 +487,12 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message,
return 0; return 0;
} }
extern VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL);
static void win32_set_droppable(ui_window_win32_t *window, bool droppable) static void win32_set_droppable(ui_window_win32_t *window, bool droppable)
{ {
DragAcceptFiles(window->hwnd, droppable); if (DragAcceptFiles_func != NULL)
DragAcceptFiles_func(window->hwnd, droppable);
} }
#ifdef HAVE_D3D9 #ifdef HAVE_D3D9