From c948fd08f2bee82230b0d4bf507b247909ae1341 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Sep 2010 21:53:12 +0000 Subject: [PATCH] - fixed: GUI mouse events did not take letterboxing into account. SVN r2788 (trunk) --- src/menu/menu.cpp | 3 ++- src/v_video.h | 1 + src/win32/i_input.cpp | 1 + src/win32/win32iface.h | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index f74ac4794..6d60344b1 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -211,7 +211,8 @@ bool DMenu::MouseEventBack(int type, int x, int y) { if (m_show_backbutton&1) x -= screen->GetWidth() - tex->GetScaledWidth() * CleanXfac; if (m_show_backbutton&2) y -= screen->GetHeight() - tex->GetScaledHeight() * CleanYfac; - mBackbuttonSelected = (x >= 0 && x < tex->GetScaledWidth() * CleanXfac && y < tex->GetScaledHeight() * CleanYfac); + mBackbuttonSelected = ( x >= 0 && x < tex->GetScaledWidth() * CleanXfac && + y >= 0 && y < tex->GetScaledHeight() * CleanYfac); if (mBackbuttonSelected && type == MOUSE_Release) { if (m_use_mouse == 2) mBackbuttonSelected = false; diff --git a/src/v_video.h b/src/v_video.h index 8d492c7b4..f4fb6f5bf 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -413,6 +413,7 @@ public: virtual bool WipeDo(int ticks); virtual void WipeCleanup(); virtual int GetPixelDoubling() const { return 0; } + virtual int GetTrueHeight() { return GetHeight(); } uint32 GetLastFPS() const { return LastCount; } diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index 49915bf29..c5370fb03 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -325,6 +325,7 @@ bool GUIWndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESU int shift = screen? screen->GetPixelDoubling() : 0; ev.data1 = LOWORD(lParam) >> shift; ev.data2 = HIWORD(lParam) >> shift; + if (screen) ev.data2 -= (screen->GetTrueHeight() - screen->GetHeight())/2; } if (wParam & MK_SHIFT) ev.data3 |= GKM_SHIFT; diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index e3710b234..e6745b6cf 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -162,6 +162,7 @@ public: void SetVSync (bool vsync); void NewRefreshRate(); HRESULT GetHR (); + virtual int GetTrueHeight() { return TrueHeight; } void Blank (); bool PaintToWindow (); @@ -265,6 +266,7 @@ public: bool WipeDo(int ticks); void WipeCleanup(); HRESULT GetHR (); + virtual int GetTrueHeight() { return TrueHeight; } private: friend class D3DTex;