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