From 8033a496f29ed76c361822e0d2f11beaea22a27b Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Wed, 5 Dec 2018 07:27:23 -0800 Subject: Input: Handle parent surface crops 1/2 - Surface Insets are set to offset the client content and draw a border around the client surface (such as shadows in dialogs). Inputs sent to the client are offset such that 0,0 is the start of the client content. When accounting for surface insets, check if the surface is already cropped by a parent so that the input offset is not set twice. - Restrict the touchable region to the input frame bounds. Test: Open event in calendar. Try to close the event. The event is a dialog and draws shadows. Test: Open app selector in secondary split screen. Ensure input does not go to primary split screen window. Bug: 120413463, 120460606 Change-Id: I0d519f9eb381664b1e71a924b13419dcc1170ba1 --- libs/ui/Rect.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libs/ui/Rect.cpp') diff --git a/libs/ui/Rect.cpp b/libs/ui/Rect.cpp index d8702e5755..045db31087 100644 --- a/libs/ui/Rect.cpp +++ b/libs/ui/Rect.cpp @@ -72,6 +72,14 @@ Rect& Rect::offsetBy(int32_t x, int32_t y) { return *this; } +Rect& Rect::inset(int32_t left, int32_t top, int32_t right, int32_t bottom) { + this->left += left; + this->top += top; + this->right -= right; + this->bottom -= bottom; + return *this; +} + const Rect Rect::operator +(const Point& rhs) const { const Rect result(left + rhs.x, top + rhs.y, right + rhs.x, bottom + rhs.y); return result; -- cgit v1.2.3-59-g8ed1b From 91f568305a97a6d5b6f54cc0d091a29c76a8348d Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Wed, 5 Dec 2018 12:13:34 -0800 Subject: Fix -Wshadow-field warnings. Test: build Change-Id: I15c7a530ab7c4ba038c49b7ba48dcf76422a2b5f --- libs/ui/Rect.cpp | 10 +++++----- libs/ui/include/ui/Rect.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'libs/ui/Rect.cpp') diff --git a/libs/ui/Rect.cpp b/libs/ui/Rect.cpp index 045db31087..13fed3a239 100644 --- a/libs/ui/Rect.cpp +++ b/libs/ui/Rect.cpp @@ -72,11 +72,11 @@ Rect& Rect::offsetBy(int32_t x, int32_t y) { return *this; } -Rect& Rect::inset(int32_t left, int32_t top, int32_t right, int32_t bottom) { - this->left += left; - this->top += top; - this->right -= right; - this->bottom -= bottom; +Rect& Rect::inset(int32_t _left, int32_t _top, int32_t _right, int32_t _bottom) { + this->left += _left; + this->top += _top; + this->right -= _right; + this->bottom -= _bottom; return *this; } diff --git a/libs/ui/include/ui/Rect.h b/libs/ui/include/ui/Rect.h index 9edb510ee9..e9da087347 100644 --- a/libs/ui/include/ui/Rect.h +++ b/libs/ui/include/ui/Rect.h @@ -178,7 +178,7 @@ public: /** * Insets the rectangle on all sides specified by the insets. */ - Rect& inset(int32_t left, int32_t top, int32_t right, int32_t bottom); + Rect& inset(int32_t _left, int32_t _top, int32_t _right, int32_t _bottom); bool intersect(const Rect& with, Rect* result) const; -- cgit v1.2.3-59-g8ed1b