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 /** 96 * @error Picture-In-Picture failed to destroy. 97 * 98 * @since 20 99 */ 100 WINDOW_MANAGER_ERRORCODE_PIP_DESTROY_FAILED = 1300011, 101 /** 102 * @error Picture-In-Picture state is abnormal. 103 * 104 * @since 20 105 */ 106 WINDOW_MANAGER_ERRORCODE_PIP_STATE_ABNORMAL = 1300012, 107 /** 108 * @error Picture-In-Picture failed to create. 109 * 110 * @since 20 111 */ 112 WINDOW_MANAGER_ERRORCODE_PIP_CREATE_FAILED = 1300013, 113 /** 114 * @error Picture-In-Picture internal error. 115 * 116 * @since 20 117 */ 118 WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR = 1300014, 119 /** 120 * @error Picture-In-Picture repeated operation. 121 * 122 * @since 20 123 */ 124 WINDOW_MANAGER_ERRORCODE_PIP_REPEATED_OPERATION = 1300015, 125 /** 126 * @error Parameter is incorrect. 127 * @since 20 128 */ 129 WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM = 1300016, 130 } WindowManager_ErrorCode; 131 132 /** 133 * @brief Enumerates the avoid area types. 134 * 135 * @since 15 136 */ 137 typedef enum { 138 /** System. */ 139 WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM = 0, 140 /** Cutout. */ 141 WINDOW_MANAGER_AVOID_AREA_TYPE_CUTOUT = 1, 142 /** System gesture. */ 143 WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM_GESTURE = 2, 144 /** Keyboard. */ 145 WINDOW_MANAGER_AVOID_AREA_TYPE_KEYBOARD = 3, 146 /** Navigation indicator. */ 147 WINDOW_MANAGER_AVOID_AREA_TYPE_NAVIGATION_INDICATOR = 4, 148 } WindowManager_AvoidAreaType; 149 150 /** 151 * @brief The type of a window 152 * 153 * @since 15 154 */ 155 typedef enum { 156 /** Sub window. */ 157 WINDOW_MANAGER_WINDOW_TYPE_APP = 0, 158 /** Main window. */ 159 WINDOW_MANAGER_WINDOW_TYPE_MAIN = 1, 160 /** Float. */ 161 WINDOW_MANAGER_WINDOW_TYPE_FLOAT = 8, 162 /** Dialog. */ 163 WINDOW_MANAGER_WINDOW_TYPE_DIALOG = 16, 164 } WindowManager_WindowType; 165 166 /** 167 * @brief Defines the window rect data structure. 168 * 169 * @since 15 170 */ 171 typedef struct { 172 /** X-axis of the window. */ 173 int32_t posX; 174 /** Y-axis of the window. */ 175 int32_t posY; 176 /** Width of the window. */ 177 uint32_t width; 178 /** Height of the window. */ 179 uint32_t height; 180 } WindowManager_Rect; 181 182 /** 183 * @brief Properties of window 184 * 185 * @since 15 186 */ 187 typedef struct { 188 /** The position and size of the window. */ 189 WindowManager_Rect windowRect; 190 /** The position relative to the window and size of drawable area. */ 191 WindowManager_Rect drawableRect; 192 /** Window type. */ 193 WindowManager_WindowType type; 194 /** Whether the window is displayed in full screen mode. The default value is false. */ 195 bool isFullScreen; 196 /** Whether the window layout is full screen mode. The default value is false. */ 197 bool isLayoutFullScreen; 198 /** Whether the window can gain focus. The default value is true. */ 199 bool focusable; 200 /** Whether the window is touchable. The default value is false. */ 201 bool touchable; 202 /** Brightness value of window. */ 203 float brightness; 204 /** Whether keep screen on. */ 205 bool isKeepScreenOn; 206 /** Whether make window in privacy mode or not. */ 207 bool isPrivacyMode; 208 /** Whether is transparent or not. */ 209 bool isTransparent; 210 /** Window id. */ 211 uint32_t id; 212 /** Display id. */ 213 uint32_t displayId; 214 } WindowManager_WindowProperties; 215 216 /** 217 * @brief Defines the avoid area data structure. 218 * 219 * @since 15 220 */ 221 typedef struct { 222 /** Top rect of the avoid area. */ 223 WindowManager_Rect topRect; 224 /** Left rect of the avoid area. */ 225 WindowManager_Rect leftRect; 226 /** Right rect of the avoid area. */ 227 WindowManager_Rect rightRect; 228 /** Bottom rect of the avoid area. */ 229 WindowManager_Rect bottomRect; 230 } WindowManager_AvoidArea; 231 232 #ifdef __cplusplus 233 } 234 #endif 235 236 #endif // OH_WINDOW_COMM_H 237 /** @} */