1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/gonk/libui/InputWindow.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* 1.5 + * Copyright (C) 2011 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#define LOG_TAG "InputWindow" 1.21 + 1.22 +#include "InputWindow.h" 1.23 + 1.24 +#include "cutils_log.h" 1.25 + 1.26 +namespace android { 1.27 + 1.28 +// --- InputWindowInfo --- 1.29 + 1.30 +bool InputWindowInfo::touchableRegionContainsPoint(int32_t x, int32_t y) const { 1.31 + return touchableRegion.contains(x, y); 1.32 +} 1.33 + 1.34 +bool InputWindowInfo::frameContainsPoint(int32_t x, int32_t y) const { 1.35 + return x >= frameLeft && x <= frameRight 1.36 + && y >= frameTop && y <= frameBottom; 1.37 +} 1.38 + 1.39 +bool InputWindowInfo::isTrustedOverlay() const { 1.40 + return layoutParamsType == TYPE_INPUT_METHOD 1.41 + || layoutParamsType == TYPE_INPUT_METHOD_DIALOG 1.42 + || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY; 1.43 +} 1.44 + 1.45 +bool InputWindowInfo::supportsSplitTouch() const { 1.46 + return layoutParamsFlags & FLAG_SPLIT_TOUCH; 1.47 +} 1.48 + 1.49 + 1.50 +// --- InputWindowHandle --- 1.51 + 1.52 +InputWindowHandle::InputWindowHandle(const sp<InputApplicationHandle>& inputApplicationHandle) : 1.53 + inputApplicationHandle(inputApplicationHandle), mInfo(NULL) { 1.54 +} 1.55 + 1.56 +InputWindowHandle::~InputWindowHandle() { 1.57 + delete mInfo; 1.58 +} 1.59 + 1.60 +void InputWindowHandle::releaseInfo() { 1.61 + if (mInfo) { 1.62 + delete mInfo; 1.63 + mInfo = NULL; 1.64 + } 1.65 +} 1.66 + 1.67 +} // namespace android