InputWindow.cpp revision 4fb76253f255f0adb8a64835af37bb9176ee4016
1928e054931d357326613c78e62f4d850b7c442ffJeff Brown/*
2928e054931d357326613c78e62f4d850b7c442ffJeff Brown * Copyright (C) 2011 The Android Open Source Project
3928e054931d357326613c78e62f4d850b7c442ffJeff Brown *
4928e054931d357326613c78e62f4d850b7c442ffJeff Brown * Licensed under the Apache License, Version 2.0 (the "License");
5928e054931d357326613c78e62f4d850b7c442ffJeff Brown * you may not use this file except in compliance with the License.
6928e054931d357326613c78e62f4d850b7c442ffJeff Brown * You may obtain a copy of the License at
7928e054931d357326613c78e62f4d850b7c442ffJeff Brown *
8928e054931d357326613c78e62f4d850b7c442ffJeff Brown *      http://www.apache.org/licenses/LICENSE-2.0
9928e054931d357326613c78e62f4d850b7c442ffJeff Brown *
10928e054931d357326613c78e62f4d850b7c442ffJeff Brown * Unless required by applicable law or agreed to in writing, software
11928e054931d357326613c78e62f4d850b7c442ffJeff Brown * distributed under the License is distributed on an "AS IS" BASIS,
12928e054931d357326613c78e62f4d850b7c442ffJeff Brown * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13928e054931d357326613c78e62f4d850b7c442ffJeff Brown * See the License for the specific language governing permissions and
14928e054931d357326613c78e62f4d850b7c442ffJeff Brown * limitations under the License.
15928e054931d357326613c78e62f4d850b7c442ffJeff Brown */
16928e054931d357326613c78e62f4d850b7c442ffJeff Brown
17928e054931d357326613c78e62f4d850b7c442ffJeff Brown#define LOG_TAG "InputWindow"
18928e054931d357326613c78e62f4d850b7c442ffJeff Brown
19928e054931d357326613c78e62f4d850b7c442ffJeff Brown#include "InputWindow.h"
20928e054931d357326613c78e62f4d850b7c442ffJeff Brown
21928e054931d357326613c78e62f4d850b7c442ffJeff Brown#include <cutils/log.h>
22928e054931d357326613c78e62f4d850b7c442ffJeff Brown
23928e054931d357326613c78e62f4d850b7c442ffJeff Brownnamespace android {
24928e054931d357326613c78e62f4d850b7c442ffJeff Brown
25928e054931d357326613c78e62f4d850b7c442ffJeff Brown// --- InputWindow ---
26928e054931d357326613c78e62f4d850b7c442ffJeff Brown
27fbf097732137a32930d151f7ba6816a5b870c32aJeff Brownbool InputWindow::touchableRegionContainsPoint(int32_t x, int32_t y) const {
28fbf097732137a32930d151f7ba6816a5b870c32aJeff Brown    return touchableRegion.contains(x, y);
29928e054931d357326613c78e62f4d850b7c442ffJeff Brown}
30928e054931d357326613c78e62f4d850b7c442ffJeff Brown
31928e054931d357326613c78e62f4d850b7c442ffJeff Brownbool InputWindow::frameContainsPoint(int32_t x, int32_t y) const {
324fb76253f255f0adb8a64835af37bb9176ee4016Jeff Brown    return x >= frameLeft && x <= frameRight
334fb76253f255f0adb8a64835af37bb9176ee4016Jeff Brown            && y >= frameTop && y <= frameBottom;
34928e054931d357326613c78e62f4d850b7c442ffJeff Brown}
35928e054931d357326613c78e62f4d850b7c442ffJeff Brown
36928e054931d357326613c78e62f4d850b7c442ffJeff Brownbool InputWindow::isTrustedOverlay() const {
37928e054931d357326613c78e62f4d850b7c442ffJeff Brown    return layoutParamsType == TYPE_INPUT_METHOD
38928e054931d357326613c78e62f4d850b7c442ffJeff Brown            || layoutParamsType == TYPE_INPUT_METHOD_DIALOG
39928e054931d357326613c78e62f4d850b7c442ffJeff Brown            || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY;
40928e054931d357326613c78e62f4d850b7c442ffJeff Brown}
41928e054931d357326613c78e62f4d850b7c442ffJeff Brown
42928e054931d357326613c78e62f4d850b7c442ffJeff Brownbool InputWindow::supportsSplitTouch() const {
43928e054931d357326613c78e62f4d850b7c442ffJeff Brown    return layoutParamsFlags & InputWindow::FLAG_SPLIT_TOUCH;
44928e054931d357326613c78e62f4d850b7c442ffJeff Brown}
45928e054931d357326613c78e62f4d850b7c442ffJeff Brown
46928e054931d357326613c78e62f4d850b7c442ffJeff Brown} // namespace android
47