From 7174efe2182376411ba2bcfb67d7e6025111183f Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 13 Apr 2020 16:55:27 -0700 Subject: InputWindow: Default initialize all values A future patch will initialize InputWindows from a new location. It's a little troublesome to have to keep track of which values are initialized by default and not. Bug: 152064592 Test: Existing tests pass Change-Id: I200d9c050d8bf6d96c45ce75f95cb4d6537ab0ba --- include/input/InputWindow.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'include/input/InputWindow.h') diff --git a/include/input/InputWindow.h b/include/input/InputWindow.h index c44db514d2..edaf8f530b 100644 --- a/include/input/InputWindow.h +++ b/include/input/InputWindow.h @@ -123,17 +123,17 @@ struct InputWindowInfo { // input windows that have the same token. sp token; // This uniquely identifies the input window. - int32_t id = 0; + int32_t id = -1; std::string name; - int32_t layoutParamsFlags; - int32_t layoutParamsType; - nsecs_t dispatchingTimeout; + int32_t layoutParamsFlags = 0; + int32_t layoutParamsType = 0; + nsecs_t dispatchingTimeout = -1; /* These values are filled in by SurfaceFlinger. */ - int32_t frameLeft; - int32_t frameTop; - int32_t frameRight; - int32_t frameBottom; + int32_t frameLeft = -1; + int32_t frameTop = -1; + int32_t frameRight = -1; + int32_t frameBottom = -1; /* * SurfaceFlinger consumes this value to shrink the computed frame. This is @@ -145,7 +145,7 @@ struct InputWindowInfo { // A global scaling factor for all windows. Unlike windowScaleX/Y this results // in scaling of the TOUCH_MAJOR/TOUCH_MINOR axis. - float globalScaleFactor; + float globalScaleFactor = 1.0f; // Scaling factors applied to individual windows. float windowXScale = 1.0f; @@ -156,18 +156,18 @@ struct InputWindowInfo { * to absolute coordinates by SurfaceFlinger once the frame is computed. */ Region touchableRegion; - bool visible; - bool canReceiveKeys; - bool hasFocus; - bool hasWallpaper; - bool paused; - int32_t ownerPid; - int32_t ownerUid; - int32_t inputFeatures; - int32_t displayId; + bool visible = false; + bool canReceiveKeys = false; + bool hasFocus = false; + bool hasWallpaper = false; + bool paused = false; + int32_t ownerPid = -1; + int32_t ownerUid = -1; + int32_t inputFeatures = 0; + int32_t displayId = ADISPLAY_ID_NONE; int32_t portalToDisplayId = ADISPLAY_ID_NONE; InputApplicationInfo applicationInfo; - bool replaceTouchableRegionWithCrop; + bool replaceTouchableRegionWithCrop = false; wp touchableRegionCropHandle; void addTouchableRegion(const Rect& region); -- cgit v1.2.3-59-g8ed1b