static bool gfx_init_dwm(void) { static bool inited = false; if (inited) return true; dwmlib = dylib_load("dwmapi.dll"); if (!dwmlib) { RARCH_LOG("Did not find dwmapi.dll.\n"); return false; } atexit(gfx_dwm_shutdown); HRESULT (WINAPI *mmcss)(BOOL) = (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS"); if (mmcss) { RARCH_LOG("Setting multimedia scheduling for DWM.\n"); mmcss(TRUE); } inited = true; return true; }
static bool gfx_init_dwm(void) { HRESULT (WINAPI *mmcss)(BOOL); static bool inited = false; if (inited) return true; atexit(gfx_dwm_shutdown); #ifdef HAVE_DYNAMIC shell32lib = dylib_load("shell32.dll"); if (!shell32lib) { RARCH_WARN("Did not find shell32.dll.\n"); } dwmlib = dylib_load("dwmapi.dll"); if (!dwmlib) { RARCH_WARN("Did not find dwmapi.dll.\n"); return false; } DragAcceptFiles_func = (VOID (WINAPI*)(HWND, BOOL))dylib_proc(shell32lib, "DragAcceptFiles"); mmcss = (HRESULT(WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS"); #else DragAcceptFiles_func = DragAcceptFiles; #if 0 mmcss = DwmEnableMMCSS; #endif #endif if (mmcss) { RARCH_LOG("Setting multimedia scheduling for DWM.\n"); mmcss(TRUE); } inited = true; return true; }
void gfx_set_dwm(void) { static bool inited = false; if (inited) return; inited = true; dwmlib = dylib_load("dwmapi.dll"); if (!dwmlib) { RARCH_LOG("Did not find dwmapi.dll.\n"); return; } atexit(gfx_dwm_shutdown); HRESULT (WINAPI *mmcss)(BOOL) = (HRESULT (WINAPI*)(BOOL))dylib_proc(dwmlib, "DwmEnableMMCSS"); if (mmcss) { RARCH_LOG("Setting multimedia scheduling for DWM.\n"); mmcss(TRUE); } if (!g_settings.video.disable_composition) return; HRESULT (WINAPI *composition_enable)(UINT) = (HRESULT (WINAPI*)(UINT))dylib_proc(dwmlib, "DwmEnableComposition"); if (!composition_enable) { RARCH_ERR("Did not find DwmEnableComposition ...\n"); return; } HRESULT ret = composition_enable(0); if (FAILED(ret)) RARCH_ERR("Failed to set composition state ...\n"); }