diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index acb61e82b2..65aff57150 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -50,8 +50,7 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam); extern "C" bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lParam); -extern "C" bool doubleclick_on_titlebar; - +bool doubleclick_on_titlebar = false; unsigned g_resize_width; unsigned g_resize_height; bool g_restore_desktop; @@ -78,6 +77,19 @@ static HMONITOR win32_monitor_last; static unsigned win32_monitor_count; static HMONITOR win32_monitor_all[MAX_MONITORS]; +extern "C" +{ + bool doubleclick_on_titlebar_pressed(void) + { + return doubleclick_on_titlebar; + } + + void unset_doubleclick_on_titlebar(void) + { + doubleclick_on_titlebar = false; + } +}; + INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { @@ -301,8 +313,6 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, { settings_t *settings = config_get_ptr(); - doubleclick_on_titlebar = false; - if (message == WM_NCLBUTTONDBLCLK) doubleclick_on_titlebar = true; @@ -364,8 +374,6 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, LRESULT ret; bool quit = false; - doubleclick_on_titlebar = false; - if (message == WM_NCLBUTTONDBLCLK) doubleclick_on_titlebar = true; @@ -414,8 +422,6 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, bool quit = false; settings_t *settings = config_get_ptr(); - doubleclick_on_titlebar = false; - if (message == WM_NCLBUTTONDBLCLK) doubleclick_on_titlebar = true; diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index 62520691e6..eef7da15a2 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -181,7 +181,8 @@ static void *dinput_init(void) return di; } -extern bool doubleclick_on_titlebar; +extern "C" bool doubleclick_on_titlebar_pressed(void); +extern "C" void unset_doubleclick_on_titlebar(void); static void dinput_poll(void *data) { @@ -220,7 +221,12 @@ static void dinput_poll(void *data) di->mouse_x = di->window_pos_x; di->mouse_y = di->window_pos_y; - if (!doubleclick_on_titlebar) + if (doubleclick_on_titlebar_pressed()) + { + di->mouse_l = 0; + unset_doubleclick_on_titlebar(); + } + else di->mouse_l = mouse_state.rgbButtons[0]; di->mouse_r = mouse_state.rgbButtons[1]; di->mouse_m = mouse_state.rgbButtons[2];