From f8194e2924acb6dd2c220710f1ccefdfb75053c6 Mon Sep 17 00:00:00 2001 From: that Date: Thu, 29 Jan 2015 01:05:01 +0100 Subject: gui: fix IsInRegion (0,0) was inside the region of "locationless" action objects, leading to all kinds of strange behavior when clicking in the upper left corner. Change-Id: I222db4ff499f3c30605b05267f005accb2e0dc99 --- gui/console.cpp | 4 ++-- gui/objects.hpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gui') diff --git a/gui/console.cpp b/gui/console.cpp index aad392ca3..218a30568 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -339,7 +339,7 @@ int GUIConsole::SetRenderPos(int x, int y, int w, int h) } // IsInRegion - Checks if the request is handled by this object -// Return 0 if this object handles the request, 1 if not +// Return 1 if this object handles the request, 0 if not int GUIConsole::IsInRegion(int x, int y) { if (mSlideout) @@ -353,7 +353,7 @@ int GUIConsole::IsInRegion(int x, int y) return 0; } - return (x < mConsoleX || x > mConsoleX + mConsoleW || y < mConsoleY || y > mConsoleY + mConsoleH) ? 0 : 1; + return (x < mConsoleX || x >= mConsoleX + mConsoleW || y < mConsoleY || y >= mConsoleY + mConsoleH) ? 0 : 1; } // NotifyTouch - Notify of a touch event diff --git a/gui/objects.hpp b/gui/objects.hpp index 832569c1d..bdccc6e42 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -111,8 +111,8 @@ public: virtual int SetActionPos(int x, int y, int w = 0, int h = 0); // IsInRegion - Checks if the request is handled by this object - // Return 0 if this object handles the request, 1 if not - virtual int IsInRegion(int x, int y) { return ((x < mActionX || x > mActionX + mActionW || y < mActionY || y > mActionY + mActionH) ? 0 : 1); } + // Return 1 if this object handles the request, 0 if not + virtual int IsInRegion(int x, int y) { return ((x < mActionX || x >= mActionX + mActionW || y < mActionY || y >= mActionY + mActionH) ? 0 : 1); } protected: int mActionX, mActionY, mActionW, mActionH; @@ -403,7 +403,7 @@ public: virtual int SetRenderPos(int x, int y, int w = 0, int h = 0); // IsInRegion - Checks if the request is handled by this object - // Return 0 if this object handles the request, 1 if not + // Return 1 if this object handles the request, 0 if not virtual int IsInRegion(int x, int y); // NotifyTouch - Notify of a touch event -- cgit v1.2.3