1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup WindowManager 18 * @{ 19 * 20 * 21 * @brief Provides abilities of windowManager on the native side, such as key event 22 * filtration. 23 * 24 * @since 12 25 */ 26 27 /** 28 * @file oh_window_comm.h 29 * 30 * @brief Provides the comm type definitions of windowManager on the native side. 31 * 32 * @syscap SystemCapability.Window.SessionManager 33 * @library libnative_window_manager.so 34 * @kit ArkUI 35 * @since 12 36 */ 37 #ifndef OH_WINDOW_COMM_H 38 #define OH_WINDOW_COMM_H 39 40 #include "stdint.h" 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /** 47 * @brief The native pixel map information defined by Image Kit. 48 * 49 * @since 15 50 */ 51 typedef struct OH_PixelmapNative; 52 53 /** 54 * @brief Enumerates the result types of the wm interface 55 * 56 * @since 12 57 */ 58 typedef enum { 59 /** succ. */ 60 OK = 0, 61 /** 62 * @error No permission. 63 * 64 * @since 15 65 */ 66 WINDOW_MANAGER_ERRORCODE_NO_PERMISSION = 201, 67 /** 68 * @error Param is invalid. 69 * 70 * @since 15 71 */ 72 WINDOW_MANAGER_ERRORCODE_INVALID_PARAM = 401, 73 /** 74 * @error Device not support. 75 * 76 * @since 15 77 */ 78 WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED = 801, 79 /** window id is invaild. */ 80 INVAILD_WINDOW_ID = 1000, 81 /** failed. */ 82 SERVICE_ERROR = 2000, 83 /** 84 * @error Window state is abnormal. 85 * 86 * @since 15 87 */ 88 WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL = 1300002, 89 /** 90 * @error Window manager service works abnormally. 91 * 92 * @since 15 93 */ 94 WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL = 1300003, 95 } WindowManager_ErrorCode; 96 97 /** 98 * @brief Enumerates the avoid area types. 99 * 100 * @since 15 101 */ 102 typedef enum { 103 /** System. */ 104 WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM = 0, 105 /** Cutout. */ 106 WINDOW_MANAGER_AVOID_AREA_TYPE_CUTOUT = 1, 107 /** System gesture. */ 108 WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM_GESTURE = 2, 109 /** Keyboard. */ 110 WINDOW_MANAGER_AVOID_AREA_TYPE_KEYBOARD = 3, 111 /** Navigation indicator. */ 112 WINDOW_MANAGER_AVOID_AREA_TYPE_NAVIGATION_INDICATOR = 4, 113 } WindowManager_AvoidAreaType; 114 115 /** 116 * @brief The type of a window 117 * 118 * @since 15 119 */ 120 typedef enum { 121 /** Sub window. */ 122 WINDOW_MANAGER_WINDOW_TYPE_APP = 0, 123 /** Main window. */ 124 WINDOW_MANAGER_WINDOW_TYPE_MAIN = 1, 125 /** Float. */ 126 WINDOW_MANAGER_WINDOW_TYPE_FLOAT = 8, 127 /** Dialog. */ 128 WINDOW_MANAGER_WINDOW_TYPE_DIALOG = 16, 129 } WindowManager_WindowType; 130 131 /** 132 * @brief Defines the window rect data structure. 133 * 134 * @since 15 135 */ 136 typedef struct { 137 /** X-axis of the window. */ 138 int32_t posX; 139 /** Y-axis of the window. */ 140 int32_t posY; 141 /** Width of the window. */ 142 uint32_t width; 143 /** Height of the window. */ 144 uint32_t height; 145 } WindowManager_Rect; 146 147 /** 148 * @brief Properties of window 149 * 150 * @since 15 151 */ 152 typedef struct { 153 /** The position and size of the window. */ 154 WindowManager_Rect windowRect; 155 /** The position relative to the window and size of drawable area. */ 156 WindowManager_Rect drawableRect; 157 /** Window type. */ 158 WindowManager_WindowType type; 159 /** Whether the window is displayed in full screen mode. The default value is false. */ 160 bool isFullScreen; 161 /** Whether the window layout is full screen mode. The default value is false. */ 162 bool isLayoutFullScreen; 163 /** Whether the window can gain focus. The default value is true. */ 164 bool focusable; 165 /** Whether the window is touchable. The default value is false. */ 166 bool touchable; 167 /** Brightness value of window. */ 168 float brightness; 169 /** Whether keep screen on. */ 170 bool isKeepScreenOn; 171 /** Whether make window in privacy mode or not. */ 172 bool isPrivacyMode; 173 /** Whether is transparent or not. */ 174 bool isTransparent; 175 /** Window id. */ 176 uint32_t id; 177 /** Display id. */ 178 uint32_t displayId; 179 } WindowManager_WindowProperties; 180 181 /** 182 * @brief Defines the avoid area data structure. 183 * 184 * @since 15 185 */ 186 typedef struct { 187 /** Top rect of the avoid area. */ 188 WindowManager_Rect topRect; 189 /** Left rect of the avoid area. */ 190 WindowManager_Rect leftRect; 191 /** Right rect of the avoid area. */ 192 WindowManager_Rect rightRect; 193 /** Bottom rect of the avoid area. */ 194 WindowManager_Rect bottomRect; 195 } WindowManager_AvoidArea; 196 197 #ifdef __cplusplus 198 } 199 #endif 200 201 #endif // OH_WINDOW_COMM_H 202 /** @} */