1 /* 2 * Copyright (c) 2024 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 #ifndef OH_WINDOW_COMM_H 16 #define OH_WINDOW_COMM_H 17 18 #include "stdint.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 /** 25 * @brief The native pixel map information defined by Image Kit. 26 * 27 * @since 15 28 */ 29 struct OH_PixelmapNative; 30 31 /** 32 * @brief Enumerates the result types of the wm interface 33 * 34 * @since 12 35 */ 36 typedef enum { 37 /** succ. */ 38 OK = 0, 39 /** 40 * @error No permission. 41 * 42 * @since 15 43 */ 44 WINDOW_MANAGER_ERRORCODE_NO_PERMISSION = 201, 45 /** 46 * @error Param is invalid. 47 * 48 * @since 15 49 */ 50 WINDOW_MANAGER_ERRORCODE_INVALID_PARAM = 401, 51 /** 52 * @error Device not support. 53 * 54 * @since 15 55 */ 56 WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED = 801, 57 /** window id is invaild. */ 58 INVAILD_WINDOW_ID = 1000, 59 /** failed. */ 60 SERVICE_ERROR = 2000, 61 /** 62 * @error Window state is abnormal. 63 * 64 * @since 15 65 */ 66 WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL = 1300002, 67 /** 68 * @error Window manager service works abnormally. 69 * 70 * @since 15 71 */ 72 WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL = 1300003, 73 } WindowManager_ErrorCode; 74 75 /** 76 * @brief Enumerates the avoid area types. 77 * 78 * @since 15 79 */ 80 typedef enum { 81 /** System. */ 82 WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM = 0, 83 /** Cutout. */ 84 WINDOW_MANAGER_AVOID_AREA_TYPE_CUTOUT = 1, 85 /** System gesture. */ 86 WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM_GESTURE = 2, 87 /** Keyboard. */ 88 WINDOW_MANAGER_AVOID_AREA_TYPE_KEYBOARD = 3, 89 /** Navigation indicator. */ 90 WINDOW_MANAGER_AVOID_AREA_TYPE_NAVIGATION_INDICATOR = 4, 91 } WindowManager_AvoidAreaType; 92 93 /** 94 * @brief The type of a window 95 * 96 * @since 15 97 */ 98 typedef enum { 99 /** Sub window. */ 100 WINDOW_MANAGER_WINDOW_TYPE_APP = 0, 101 /** Main Window. */ 102 WINDOW_MANAGER_WINDOW_TYPE_MAIN = 1, 103 /** Float. */ 104 WINDOW_MANAGER_WINDOW_TYPE_FLOAT = 8, 105 /** Dialog. */ 106 WINDOW_MANAGER_WINDOW_TYPE_DIALOG = 16, 107 } WindowManager_WindowType; 108 109 /** 110 * @brief Defines the window rect data structure. 111 * 112 * @since 15 113 */ 114 typedef struct { 115 /** X-axis of the window. */ 116 int32_t posX; 117 /** Y-axis of the window. */ 118 int32_t posY; 119 /** Width of the window. */ 120 uint32_t width; 121 /** Height of the window. */ 122 uint32_t height; 123 } WindowManager_Rect; 124 125 /** 126 * @brief Properties of window 127 * 128 * @since 15 129 */ 130 typedef struct { 131 /** The position and size of the window */ 132 WindowManager_Rect windowRect; 133 /** The position relative to the window and size of drawable area */ 134 WindowManager_Rect drawableRect; 135 /** Window type */ 136 WindowManager_WindowType type; 137 /** Whether the window is displayed in full screen mode. The default value is false */ 138 bool isFullScreen; 139 /** Whether the window layout is in full screen mode(whether the window is immersive). The default value is false */ 140 bool isLayoutFullScreen; 141 /** Whether the window can gain focus. The default value is true */ 142 bool focusable; 143 /** Whether the window is touchable. The default value is false */ 144 bool touchable; 145 /** Brightness value of window */ 146 float brightness; 147 /** Whether keep screen on */ 148 bool isKeepScreenOn; 149 /** Whether make window in privacy mode or not */ 150 bool isPrivacyMode; 151 /** Whether is transparent or not */ 152 bool isTransparent; 153 /** Window id */ 154 uint32_t id; 155 /** Display id */ 156 uint32_t displayId; 157 } WindowManager_WindowProperties; 158 159 /** 160 * @brief Defines the avoid area data structure. 161 * 162 * @since 15 163 */ 164 typedef struct { 165 /** Top rect of the avoid area. */ 166 WindowManager_Rect topRect; 167 /** Left rect of the avoid area. */ 168 WindowManager_Rect leftRect; 169 /** Right rect of the avoid area. */ 170 WindowManager_Rect rightRect; 171 /** Bottom rect of the avoid area. */ 172 WindowManager_Rect bottomRect; 173 } WindowManager_AvoidArea; 174 175 #ifdef __cplusplus 176 } 177 #endif 178 179 #endif // OH_WINDOW_COMM_H