From 7c6bf6aaf74aa124f023bd1cccada42bbbee55c4 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Fri, 13 Jan 2017 14:31:36 -0500 Subject: [PATCH] fix msys2 compilation when opengl, vulkan and d3d9 are disabled --- gfx/common/win32_common.cpp | 12 ++++++++++++ gfx/common/win32_common.h | 4 ++++ menu/drivers_display/menu_display_gdi.c | 2 +- qb/config.libs.sh | 4 +++- ui/drivers/ui_win32.c | 5 ++++- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index 19928d2c65..3274a77c15 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -60,11 +60,13 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam); } #endif +#ifdef HAVE_D3D9 extern "C" bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lParam); extern void *dinput_gdi; extern void *dinput_wgl; extern void *dinput; +#endif unsigned g_resize_width = 0; unsigned g_resize_height = 0; @@ -426,6 +428,7 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, extern void ui_window_win32_set_droppable(void *data, bool droppable); +#ifdef HAVE_D3D9 LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -466,11 +469,15 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, return 0; } +#ifdef HAVE_D3D9 if (dinput && dinput_handle_message(dinput, message, wparam, lparam)) return 0; +#endif return DefWindowProc(hwnd, message, wparam, lparam); } +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -510,10 +517,13 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, return 0; } +#ifdef HAVE_D3D9 if (dinput_wgl && dinput_handle_message(dinput_wgl, message, wparam, lparam)) return 0; +#endif return DefWindowProc(hwnd, message, wparam, lparam); } +#endif LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) @@ -569,8 +579,10 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, return 0; } +#ifdef HAVE_D3D9 if (dinput_gdi && dinput_handle_message(dinput_gdi, message, wparam, lparam)) return 0; +#endif return DefWindowProc(hwnd, message, wparam, lparam); } diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index ffd27fc17f..61aa2849b7 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -120,11 +120,15 @@ void win32_window_reset(void); void win32_destroy_window(void); +#ifdef HAVE_D3D9 LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); +#endif +#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); +#endif LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); diff --git a/menu/drivers_display/menu_display_gdi.c b/menu/drivers_display/menu_display_gdi.c index 1a49da97a3..e04541c9ea 100644 --- a/menu/drivers_display/menu_display_gdi.c +++ b/menu/drivers_display/menu_display_gdi.c @@ -26,7 +26,7 @@ #include "../menu_display.h" #if defined(_WIN32) && !defined(_XBOX) -#include "../common/win32_common.h" +#include "../../gfx/common/win32_common.h" #endif static void *menu_display_gdi_get_default_mvp(void) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 937649064c..d20d7efe1b 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -455,7 +455,9 @@ if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH" echo "Notice: RGUI not available, MaterialUI, XMB and ZARCH will also be disabled." elif [ "$HAVE_OPENGL" = 'no' ] && [ "$HAVE_OPENGLES" = 'no' ] && [ "$HAVE_VULKAN" = 'no' ]; then if [ "$OS" = 'Win32' ]; then - echo "Notice: Hardware rendering context not available, the GDI video driver must be used." + HAVE_SHADERPIPELINE=no + HAVE_VULKAN=no + echo "Notice: Hardware rendering context not available." else HAVE_MATERIALUI=no HAVE_XMB=no diff --git a/ui/drivers/ui_win32.c b/ui/drivers/ui_win32.c index b83d23dcfd..42777b92ea 100644 --- a/ui/drivers/ui_win32.c +++ b/ui/drivers/ui_win32.c @@ -364,6 +364,7 @@ void shader_dlg_show(HWND parent_hwnd) window->set_focused(&g_shader_dlg.window); } +#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -440,6 +441,7 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message, return DefWindowProc(hwnd, message, wparam, lparam); } +#endif bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name) @@ -475,6 +477,7 @@ bool win32_window_init(WNDCLASSEX *wndclass, bool win32_shader_dlg_init(void) { +#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN) static bool inited = false; int pos_y; HFONT hFont; @@ -522,7 +525,7 @@ bool win32_shader_dlg_init(void) pos_y += SHADER_DLG_SEPARATOR_HEIGHT + SHADER_DLG_CTRL_MARGIN; g_shader_dlg.parameters_start_y = pos_y; - +#endif return true; }