diff options
Diffstat (limited to 'libs/input')
-rw-r--r-- | libs/input/InputDispatcher.cpp | 11 | ||||
-rw-r--r-- | libs/input/InputWindow.cpp | 9 | ||||
-rw-r--r-- | libs/input/InputWindow.h | 9 |
3 files changed, 21 insertions, 8 deletions
diff --git a/libs/input/InputDispatcher.cpp b/libs/input/InputDispatcher.cpp index 10a639e..8c8e705 100644 --- a/libs/input/InputDispatcher.cpp +++ b/libs/input/InputDispatcher.cpp @@ -48,6 +48,7 @@ #include <utils/Trace.h> #include <cutils/log.h> #include <androidfw/PowerManager.h> +#include <ui/Region.h> #include <stddef.h> #include <unistd.h> @@ -172,21 +173,23 @@ static bool isMainDisplay(int32_t displayId) { return displayId == ADISPLAY_ID_DEFAULT || displayId == ADISPLAY_ID_NONE; } -static void dumpRegion(String8& dump, const SkRegion& region) { +static void dumpRegion(String8& dump, const Region& region) { if (region.isEmpty()) { dump.append("<empty>"); return; } bool first = true; - for (SkRegion::Iterator it(region); !it.done(); it.next()) { + Region::const_iterator cur = region.begin(); + Region::const_iterator const tail = region.end(); + while (cur != tail) { if (first) { first = false; } else { dump.append("|"); } - const SkIRect& rect = it.rect(); - dump.appendFormat("[%d,%d][%d,%d]", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); + dump.appendFormat("[%d,%d][%d,%d]", cur->left, cur->top, cur->right, cur->bottom); + cur++; } } diff --git a/libs/input/InputWindow.cpp b/libs/input/InputWindow.cpp index fe61918..da59159 100644 --- a/libs/input/InputWindow.cpp +++ b/libs/input/InputWindow.cpp @@ -15,17 +15,24 @@ */ #define LOG_TAG "InputWindow" +#define LOG_NDEBUG 0 #include "InputWindow.h" #include <cutils/log.h> +#include <ui/Rect.h> +#include <ui/Region.h> + namespace android { // --- InputWindowInfo --- +void InputWindowInfo::addTouchableRegion(const Rect& region) { + touchableRegion.orSelf(region); +} bool InputWindowInfo::touchableRegionContainsPoint(int32_t x, int32_t y) const { - return touchableRegion.contains(x, y); + return touchableRegion.contains(x,y); } bool InputWindowInfo::frameContainsPoint(int32_t x, int32_t y) const { diff --git a/libs/input/InputWindow.h b/libs/input/InputWindow.h index 28fa7ab..9618ffe 100644 --- a/libs/input/InputWindow.h +++ b/libs/input/InputWindow.h @@ -19,16 +19,17 @@ #include <input/Input.h> #include <input/InputTransport.h> +#include <ui/Rect.h> +#include <ui/Region.h> #include <utils/RefBase.h> #include <utils/Timers.h> #include <utils/String8.h> -#include <SkRegion.h> - #include "InputApplication.h" namespace android { + /* * Describes the properties of a window that can receive input. */ @@ -125,7 +126,7 @@ struct InputWindowInfo { int32_t frameRight; int32_t frameBottom; float scaleFactor; - SkRegion touchableRegion; + Region touchableRegion; bool visible; bool canReceiveKeys; bool hasFocus; @@ -137,6 +138,8 @@ struct InputWindowInfo { int32_t inputFeatures; int32_t displayId; + void addTouchableRegion(const Rect& region); + bool touchableRegionContainsPoint(int32_t x, int32_t y) const; bool frameContainsPoint(int32_t x, int32_t y) const; |