1# oh_display_manager.h 2<!--Kit: ArkUI--> 3<!--Subsystem: Window--> 4<!--Owner: @oh_wangxk; @logn--> 5<!--Designer: @hejunfei1991--> 6<!--Tester: @qinliwen0417--> 7<!--Adviser: @ge-yafang--> 8 9## Overview 10 11The file declares the functions for basic display management. You can call the functions to obtain various information about the default display and listen for display status changes, such as rotation, folding, and unfolding. 12 13**File to include**: <window_manager/oh_display_manager.h> 14 15**Library**: libnative_display_manager.so 16 17**System capability**: SystemCapability.WindowManager.WindowManager.Core 18 19**Since**: 12 20 21**Related module**: [OH_DisplayManager](capi-oh-displaymanager.md) 22 23## Summary 24 25### Functions 26 27| Name| typedef Keyword| Description| 28| -- | -- | -- | 29| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayId(uint64_t *displayId)](#oh_nativedisplaymanager_getdefaultdisplayid) | - | Obtains the ID of the default display.| 30| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayWidth(int32_t *displayWidth)](#oh_nativedisplaymanager_getdefaultdisplaywidth) | - | Obtains the width of the default display.| 31| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayHeight(int32_t *displayHeight)](#oh_nativedisplaymanager_getdefaultdisplayheight) | - | Obtains the height of the default display.| 32| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRotation(NativeDisplayManager_Rotation *displayRotation)](#oh_nativedisplaymanager_getdefaultdisplayrotation) | - | Obtains the clockwise rotation angle of the default display.| 33| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayOrientation(NativeDisplayManager_Orientation *displayOrientation)](#oh_nativedisplaymanager_getdefaultdisplayorientation) | - | Obtains the orientation of the default display.| 34| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio(float *virtualPixels)](#oh_nativedisplaymanager_getdefaultdisplayvirtualpixelratio) | - | Obtains the virtual pixel ratio of the default display.| 35| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRefreshRate(uint32_t *refreshRate)](#oh_nativedisplaymanager_getdefaultdisplayrefreshrate) | - | Obtains the refresh rate of the default display.| 36| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityDpi(int32_t *densityDpi)](#oh_nativedisplaymanager_getdefaultdisplaydensitydpi) | - | Obtains the physical pixel density of the default display.| 37| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityPixels(float *densityPixels)](#oh_nativedisplaymanager_getdefaultdisplaydensitypixels) | - | Obtains the logical pixel density of the default display.| 38| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayScaledDensity(float *scaledDensity)](#oh_nativedisplaymanager_getdefaultdisplayscaleddensity) | - | Obtains the scale factor of fonts displayed on the default display.| 39| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi(float *xDpi)](#oh_nativedisplaymanager_getdefaultdisplaydensityxdpi) | - | Obtains the number of physical pixels per inch on the default display in the X dimension.| 40| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi(float *yDpi)](#oh_nativedisplaymanager_getdefaultdisplaydensityydpi) | - | Obtains the number of physical pixels per inch on the default display in the Y dimension.| 41| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo(NativeDisplayManager_CutoutInfo **cutoutInfo)](#oh_nativedisplaymanager_createdefaultdisplaycutoutinfo) | - | Obtains the unusable area of the default display, including punch hole, notch, and curved area of a waterfall display.| 42| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo(NativeDisplayManager_CutoutInfo *cutoutInfo)](#oh_nativedisplaymanager_destroydefaultdisplaycutoutinfo) | - | Destroys the unusable area of the default display, including punch hole, notch, and curved area of a waterfall display.| 43| [bool OH_NativeDisplayManager_IsFoldable()](#oh_nativedisplaymanager_isfoldable) | - | Checks whether the current device is foldable.| 44| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetFoldDisplayMode(NativeDisplayManager_FoldDisplayMode *displayMode)](#oh_nativedisplaymanager_getfolddisplaymode) | - | Obtains the display mode of the foldable device.| 45| [typedef void (\*OH_NativeDisplayManager_DisplayChangeCallback)(uint64_t displayId)](#oh_nativedisplaymanager_displaychangecallback) | OH_NativeDisplayManager_DisplayChangeCallback | Defines a callback function to listen for display status changes.| 46| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayChangeListener(OH_NativeDisplayManager_DisplayChangeCallback displayChangeCallback, uint32_t *listenerIndex)](#oh_nativedisplaymanager_registerdisplaychangelistener) | - | Registers a listener for display status changes (such as rotation, refresh rate, DPI, and resolution changes).| 47| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayChangeListener(uint32_t listenerIndex)](#oh_nativedisplaymanager_unregisterdisplaychangelistener) | - | Unregisters a listener for display status changes.| 48| [typedef void (\*OH_NativeDisplayManager_FoldDisplayModeChangeCallback)(NativeDisplayManager_FoldDisplayMode displayMode)](#oh_nativedisplaymanager_folddisplaymodechangecallback) | OH_NativeDisplayManager_FoldDisplayModeChangeCallback | Defines a callback function to listen for folded/unfolded state changes of the display.| 49| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener(OH_NativeDisplayManager_FoldDisplayModeChangeCallback displayModeChangeCallback, uint32_t *listenerIndex)](#oh_nativedisplaymanager_registerfolddisplaymodechangelistener) | - | Registers a listener for folded/unfolded state changes of the display.| 50| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener(uint32_t listenerIndex)](#oh_nativedisplaymanager_unregisterfolddisplaymodechangelistener) | - | Unregisters a listener for folded/unfolded state changes of the display.| 51| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays(NativeDisplayManager_DisplaysInfo **allDisplays)](#oh_nativedisplaymanager_createalldisplays) | - | Obtains the object that contains the information about all displays.| 52| [void OH_NativeDisplayManager_DestroyAllDisplays(NativeDisplayManager_DisplaysInfo *allDisplays)](#oh_nativedisplaymanager_destroyalldisplays) | - | Destroys the object that contains the information about all displays.| 53| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayById(uint32_t displayId,NativeDisplayManager_DisplayInfo **displayInfo)](#oh_nativedisplaymanager_createdisplaybyid) | - | Obtains the object that contains the information about a display.| 54| [void OH_NativeDisplayManager_DestroyDisplay(NativeDisplayManager_DisplayInfo *displayInfo)](#oh_nativedisplaymanager_destroydisplay) | - | Destroys the object that contains the information about a display.| 55| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreatePrimaryDisplay(NativeDisplayManager_DisplayInfo **displayInfo)](#oh_nativedisplaymanager_createprimarydisplay) | - | Obtains the object that contains the information about the primary display. For devices other than 2-in-1 devices, the displayInfo object obtained contains information about the built-in screen. For 2-in-1 devices with an external screen, the displayInfo object obtained contains information about the current primary screen. For 2-in-1 devices without an external screen, the displayInfo object obtained contains information about the built-in screen.| 56| [typedef void (\*OH_NativeDisplayManager_AvailableAreaChangeCallback)(uint64_t displayId)](#oh_nativedisplaymanager_availableareachangecallback) | OH_NativeDisplayManager_AvailableAreaChangeCallback | Defines a callback function to listen for available area changes of a display.| 57| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterAvailableAreaChangeListener(OH_NativeDisplayManager_AvailableAreaChangeCallback availableAreaChangeCallback, uint32_t *listenerIndex)](#oh_nativedisplaymanager_registeravailableareachangelistener) | - | Registers a listener for available area changes of the display.| 58| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterAvailableAreaChangeListener(uint32_t listenerIndex)](#oh_nativedisplaymanager_unregisteravailableareachangelistener) | - | Unregisters a listener for available area changes of the display.| 59| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAvailableArea(uint64_t displayId, NativeDisplayManager_Rect **availableArea)](#oh_nativedisplaymanager_createavailablearea) | - | Obtains the available area of a display.| 60| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_DestroyAvailableArea(NativeDisplayManager_Rect *availableArea)](#oh_nativedisplaymanager_destroyavailablearea) | - | Destroys the available area of a display.| 61| [typedef void (\*OH_NativeDisplayManager_DisplayAddCallback)(uint64_t displayId)](#oh_nativedisplaymanager_displayaddcallback) | OH_NativeDisplayManager_DisplayAddCallback | Defines a callback function to listen for display addition events.| 62| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayAddListener(OH_NativeDisplayManager_DisplayAddCallback displayAddCallback, uint32_t *listenerIndex)](#oh_nativedisplaymanager_registerdisplayaddlistener) | - | Registers a listener for display addition events (for example, monitor inserted).| 63| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayAddListener(uint32_t listenerIndex)](#oh_nativedisplaymanager_unregisterdisplayaddlistener) | - | Unregisters a listener for display addition events.| 64| [typedef void (\*OH_NativeDisplayManager_DisplayRemoveCallback)(uint64_t displayId)](#oh_nativedisplaymanager_displayremovecallback) | OH_NativeDisplayManager_DisplayRemoveCallback | Defines a callback function to listen for display removal events.| 65| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayRemoveListener(OH_NativeDisplayManager_DisplayRemoveCallback displayRemoveCallback, uint32_t *listenerIndex)](#oh_nativedisplaymanager_registerdisplayremovelistener) | - | Registers a listener for display removal events (for example, monitor removed).| 66| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayRemoveListener(uint32_t listenerIndex)](#oh_nativedisplaymanager_unregisterdisplayremovelistener) | - | Unregisters a listener for display removal events.| 67| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDisplaySourceMode(uint64_t displayId, NativeDisplayManager_SourceMode *sourceMode)](#oh_nativedisplaymanager_getdisplaysourcemode) | - | Obtains the source mode of a display.| 68| [NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDisplayPosition(uint64_t displayId, int32_t *x, int32_t *y)](#oh_nativedisplaymanager_getdisplayposition) | - | Obtains the position of a display.| 69 70## Function Description 71 72### OH_NativeDisplayManager_GetDefaultDisplayId() 73 74``` 75NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayId(uint64_t *displayId) 76``` 77 78**Description** 79 80Obtains the ID of the default display. 81 82**System capability**: SystemCapability.WindowManager.WindowManager.Core 83 84**Since**: 12 85 86 87**Parameters** 88 89| Parameter| Description| 90| -- | -- | 91| uint64_t *displayId | Pointer to the display ID. The value is a non-negative integer.| 92 93**Return value** 94 95| Type| Description| 96| -- | -- | 97| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 98 99### OH_NativeDisplayManager_GetDefaultDisplayWidth() 100 101``` 102NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayWidth(int32_t *displayWidth) 103``` 104 105**Description** 106 107Obtains the width of the default display. 108 109**System capability**: SystemCapability.WindowManager.WindowManager.Core 110 111**Since**: 12 112 113 114**Parameters** 115 116| Parameter| Description| 117| -- | -- | 118| int32_t *displayWidth | Pointer to the width, in px. The value is an integer.| 119 120**Return value** 121 122| Type| Description| 123| -- | -- | 124| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 125 126### OH_NativeDisplayManager_GetDefaultDisplayHeight() 127 128``` 129NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayHeight(int32_t *displayHeight) 130``` 131 132**Description** 133 134Obtains the height of the default display. 135 136**System capability**: SystemCapability.WindowManager.WindowManager.Core 137 138**Since**: 12 139 140 141**Parameters** 142 143| Parameter| Description| 144| -- | -- | 145| int32_t *displayHeight | Pointer to the height, in px. The value is an integer.| 146 147**Return value** 148 149| Type| Description| 150| -- | -- | 151| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 152 153### OH_NativeDisplayManager_GetDefaultDisplayRotation() 154 155``` 156NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRotation(NativeDisplayManager_Rotation *displayRotation) 157``` 158 159**Description** 160 161Obtains the clockwise rotation angle of the default display. 162 163**System capability**: SystemCapability.WindowManager.WindowManager.Core 164 165**Since**: 12 166 167 168**Parameters** 169 170| Parameter| Description| 171| -- | -- | 172| [NativeDisplayManager_Rotation](capi-oh-display-info-h.md#nativedisplaymanager_rotation) *displayRotation | Pointer to the clockwise rotation angle. For details about the available options, see [NativeDisplayManager_Rotation](capi-oh-display-info-h.md#nativedisplaymanager_rotation).| 173 174**Return value** 175 176| Type| Description| 177| -- | -- | 178| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 179 180### OH_NativeDisplayManager_GetDefaultDisplayOrientation() 181 182``` 183NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayOrientation(NativeDisplayManager_Orientation *displayOrientation) 184``` 185 186**Description** 187 188Obtains the orientation of the default display. 189 190**System capability**: SystemCapability.WindowManager.WindowManager.Core 191 192**Since**: 12 193 194 195**Parameters** 196 197| Parameter| Description| 198| -- | -- | 199| [NativeDisplayManager_Orientation](capi-oh-display-info-h.md#nativedisplaymanager_orientation) *displayOrientation | Pointer to the orientation. For details about the available options, see [NativeDisplayManager_Orientation](capi-oh-display-info-h.md#nativedisplaymanager_orientation).| 200 201**Return value** 202 203| Type| Description| 204| -- | -- | 205| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 206 207### OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio() 208 209``` 210NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio(float *virtualPixels) 211``` 212 213**Description** 214 215Obtains the virtual pixel ratio of the default display. 216 217**System capability**: SystemCapability.WindowManager.WindowManager.Core 218 219**Since**: 12 220 221 222**Parameters** 223 224| Parameter| Description| 225| -- | -- | 226| float *virtualPixels | Pointer to the virtual pixel ratio. The value is a floating-point number, and it is usually the same as that of **densityPixels**.| 227 228**Return value** 229 230| Type| Description| 231| -- | -- | 232| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 233 234### OH_NativeDisplayManager_GetDefaultDisplayRefreshRate() 235 236``` 237NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRefreshRate(uint32_t *refreshRate) 238``` 239 240**Description** 241 242Obtains the refresh rate of the default display. 243 244**System capability**: SystemCapability.WindowManager.WindowManager.Core 245 246**Since**: 12 247 248 249**Parameters** 250 251| Parameter| Description| 252| -- | -- | 253| uint32_t *refreshRate | Pointer to the refresh rate. The value is an integer, in Hz.| 254 255**Return value** 256 257| Type| Description| 258| -- | -- | 259| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 260 261### OH_NativeDisplayManager_GetDefaultDisplayDensityDpi() 262 263``` 264NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityDpi(int32_t *densityDpi) 265``` 266 267**Description** 268 269Obtains the physical pixel density of the default display. 270 271**System capability**: SystemCapability.WindowManager.WindowManager.Core 272 273**Since**: 12 274 275 276**Parameters** 277 278| Parameter| Description| 279| -- | -- | 280| int32_t *densityDpi | Pointer to the physical pixel density, that is, the number of pixels per inch. The value is an integer, in px. The actual value depends on the options provided in device settings. | 281 282**Return value** 283 284| Type| Description| 285| -- | -- | 286| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 287 288### OH_NativeDisplayManager_GetDefaultDisplayDensityPixels() 289 290``` 291NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityPixels(float *densityPixels) 292``` 293 294**Description** 295 296Obtains the logical pixel density of the default display. 297 298**System capability**: SystemCapability.WindowManager.WindowManager.Core 299 300**Since**: 12 301 302 303**Parameters** 304 305| Parameter| Description| 306| -- | -- | 307| float *densityPixels | Pointer to the logical pixel density, which indicates the scaling coefficient of the physical pixels and logical pixels. The value is a floating-point number in the range [0.5, 4.0]. Generally, the value is **1.0** or **3.0**. The actual value depends on the density DPI provided by the device in use. | 308 309**Return value** 310 311| Type| Description| 312| -- | -- | 313| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 314 315### OH_NativeDisplayManager_GetDefaultDisplayScaledDensity() 316 317``` 318NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayScaledDensity(float *scaledDensity) 319``` 320 321**Description** 322 323Obtains the scale factor of fonts displayed on the default display. 324 325**System capability**: SystemCapability.WindowManager.WindowManager.Core 326 327**Since**: 12 328 329 330**Parameters** 331 332| Parameter| Description| 333| -- | -- | 334| float *scaledDensity | Pointer to the scale factor. The value is a floating-point number, and it is usually the same as that of **densityPixels**.| 335 336**Return value** 337 338| Type| Description| 339| -- | -- | 340| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 341 342### OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi() 343 344``` 345NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi(float *xDpi) 346``` 347 348**Description** 349 350Obtains the number of physical pixels per inch on the default display in the X dimension. 351 352**System capability**: SystemCapability.WindowManager.WindowManager.Core 353 354**Since**: 12 355 356 357**Parameters** 358 359| Parameter| Description| 360| -- | -- | 361| float *xDpi | Pointer to the number of physical pixels per inch in the X dimension. The value is a floating-point number.| 362 363**Return value** 364 365| Type| Description| 366| -- | -- | 367| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 368 369### OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi() 370 371``` 372NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi(float *yDpi) 373``` 374 375**Description** 376 377Obtains the number of physical pixels per inch on the default display in the Y dimension. 378 379**System capability**: SystemCapability.WindowManager.WindowManager.Core 380 381**Since**: 12 382 383 384**Parameters** 385 386| Parameter| Description| 387| -- | -- | 388| float *yDpi | Pointer to the number of physical pixels per inch in the Y dimension. The value is a floating-point number.| 389 390**Return value** 391 392| Type| Description| 393| -- | -- | 394| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 395 396### OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo() 397 398``` 399NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo(NativeDisplayManager_CutoutInfo **cutoutInfo) 400``` 401 402**Description** 403 404Obtains the unusable area of the default display, including punch hole, notch, and curved area of a waterfall display. 405 406**System capability**: SystemCapability.WindowManager.WindowManager.Core 407 408**Since**: 12 409 410 411**Parameters** 412 413| Parameter| Description| 414| -- | -- | 415| [NativeDisplayManager_CutoutInfo](capi-nativedisplaymanager-cutoutinfo.md) **cutoutInfo | Double pointer to the unusable area information, which is encapsulated in [NativeDisplayManager_CutoutInfo](capi-nativedisplaymanager-cutoutinfo.md).| 416 417**Return value** 418 419| Type| Description| 420| -- | -- | 421| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 422 423### OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo() 424 425``` 426NativeDisplayManager_ErrorCode OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo(NativeDisplayManager_CutoutInfo *cutoutInfo) 427``` 428 429**Description** 430 431Destroys the unusable area of the default display, including punch hole, notch, and curved area of a waterfall display. 432 433**System capability**: SystemCapability.WindowManager.WindowManager.Core 434 435**Since**: 12 436 437 438**Parameters** 439 440| Parameter| Description| 441| -- | -- | 442| [NativeDisplayManager_CutoutInfo](capi-nativedisplaymanager-cutoutinfo.md) *cutoutInfo | Pointer to the unusable area information object, which is obtained by calling [OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo](capi-oh-display-manager-h.md#oh_nativedisplaymanager_createdefaultdisplaycutoutinfo). For details, see [NativeDisplayManager_CutoutInfo](capi-nativedisplaymanager-cutoutinfo.md).| 443 444**Return value** 445 446| Type| Description| 447| -- | -- | 448| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 449 450### OH_NativeDisplayManager_IsFoldable() 451 452``` 453bool OH_NativeDisplayManager_IsFoldable() 454``` 455 456**Description** 457 458Checks whether the current device is foldable. 459 460**System capability**: SystemCapability.WindowManager.WindowManager.Core 461 462**Since**: 12 463 464**Return value** 465 466| Type| Description| 467| -- | -- | 468| bool | Check result for whether the device is foldable. **true** if foldable, **false** otherwise.| 469 470### OH_NativeDisplayManager_GetFoldDisplayMode() 471 472``` 473NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetFoldDisplayMode(NativeDisplayManager_FoldDisplayMode *displayMode) 474``` 475 476**Description** 477 478Obtains the display mode of the foldable device. 479 480**System capability**: SystemCapability.Window.SessionManager 481 482**Since**: 12 483 484 485**Parameters** 486 487| Parameter| Description| 488| -- | -- | 489| [NativeDisplayManager_FoldDisplayMode](capi-oh-display-info-h.md#nativedisplaymanager_folddisplaymode) *displayMode | Pointer to the display mode. For details about the available options, see [NativeDisplayManager_FoldDisplayMode](capi-oh-display-info-h.md#nativedisplaymanager_folddisplaymode).| 490 491**Return value** 492 493| Type| Description| 494| -- | -- | 495| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 496 497### OH_NativeDisplayManager_DisplayChangeCallback() 498 499``` 500typedef void (*OH_NativeDisplayManager_DisplayChangeCallback)(uint64_t displayId) 501``` 502 503**Description** 504 505Defines a callback function to listen for display status changes. 506 507**System capability**: SystemCapability.Window.SessionManager 508 509**Since**: 12 510 511 512**Parameters** 513 514| Parameter| Description| 515| -- | -- | 516| uint64_t displayId | ID of the display.| 517 518### OH_NativeDisplayManager_RegisterDisplayChangeListener() 519 520``` 521NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayChangeListener(OH_NativeDisplayManager_DisplayChangeCallback displayChangeCallback, uint32_t *listenerIndex) 522``` 523 524**Description** 525 526Registers a listener for display status changes (such as rotation, refresh rate, DPI, and resolution changes). 527 528**System capability**: SystemCapability.WindowManager.WindowManager.Core 529 530**Since**: 12 531 532 533**Parameters** 534 535| Parameter| Description| 536| -- | -- | 537| [OH_NativeDisplayManager_DisplayChangeCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_displaychangecallback) displayChangeCallback | Callback function triggered when the display status is changed. For details, see [OH_NativeDisplayManager_DisplayChangeCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_displaychangecallback).| 538| uint32_t *listenerIndex | Pointer to the index of the listener registered. It can be used as an input parameter of [OH_NativeDisplayManager_UnregisterDisplayChangeListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_unregisterdisplaychangelistener).| 539 540**Return value** 541 542| Type| Description| 543| -- | -- | 544| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 545 546### OH_NativeDisplayManager_UnregisterDisplayChangeListener() 547 548``` 549NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayChangeListener(uint32_t listenerIndex) 550``` 551 552**Description** 553 554Unregisters a listener for display status changes. 555 556**System capability**: SystemCapability.WindowManager.WindowManager.Core 557 558**Since**: 12 559 560 561**Parameters** 562 563| Parameter| Description| 564| -- | -- | 565| uint32_t listenerIndex | Index of the listener returned when [OH_NativeDisplayManager_RegisterDisplayChangeListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_registerdisplaychangelistener) is called.| 566 567**Return value** 568 569| Type| Description| 570| -- | -- | 571| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 572 573### OH_NativeDisplayManager_FoldDisplayModeChangeCallback() 574 575``` 576typedef void (*OH_NativeDisplayManager_FoldDisplayModeChangeCallback)(NativeDisplayManager_FoldDisplayMode displayMode) 577``` 578 579**Description** 580 581Defines a callback function to listen for folded/unfolded state changes of the display. 582 583**System capability**: SystemCapability.Window.SessionManager 584 585**Since**: 12 586 587 588**Parameters** 589 590| Parameter| Description| 591| -- | -- | 592| [NativeDisplayManager_FoldDisplayMode](capi-oh-display-info-h.md#nativedisplaymanager_folddisplaymode) displayMode | Folded or unfolded state of the display. For details about the available options, see [NativeDisplayManager_FoldDisplayMode](capi-oh-display-info-h.md#nativedisplaymanager_folddisplaymode).| 593 594### OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener() 595 596``` 597NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener(OH_NativeDisplayManager_FoldDisplayModeChangeCallback displayModeChangeCallback, uint32_t *listenerIndex) 598``` 599 600**Description** 601 602Registers a listener for folded/unfolded state changes of the display. 603 604**System capability**: SystemCapability.Window.SessionManager 605 606**Since**: 12 607 608 609**Parameters** 610 611| Parameter| Description| 612| -- | -- | 613| [OH_NativeDisplayManager_FoldDisplayModeChangeCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_folddisplaymodechangecallback) displayModeChangeCallback | Callback function triggered when the folded/unfolded state of the display is changed. For details, see [OH_NativeDisplayManager_FoldDisplayModeChangeCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_folddisplaymodechangecallback).| 614| uint32_t *listenerIndex | Pointer to the index of the listener registered. It can be used as an input parameter of [OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_unregisterfolddisplaymodechangelistener).| 615 616**Return value** 617 618| Type| Description| 619| -- | -- | 620| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 621 622### OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener() 623 624``` 625NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener(uint32_t listenerIndex) 626``` 627 628**Description** 629 630Unregisters a listener for folded/unfolded state changes of the display. 631 632**System capability**: SystemCapability.Window.SessionManager 633 634**Since**: 12 635 636 637**Parameters** 638 639| Parameter| Description| 640| -- | -- | 641| uint32_t listenerIndex | Index of the listener returned when [OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_registerfolddisplaymodechangelistener) is called.| 642 643**Return value** 644 645| Type| Description| 646| -- | -- | 647| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 648 649### OH_NativeDisplayManager_CreateAllDisplays() 650 651``` 652NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays(NativeDisplayManager_DisplaysInfo **allDisplays) 653``` 654 655**Description** 656 657Obtains the object that contains the information about all displays. 658 659**System capability**: SystemCapability.Window.SessionManager.Core 660 661**Since**: 14 662 663 664**Parameters** 665 666| Parameter| Description| 667| -- | -- | 668| [NativeDisplayManager_DisplaysInfo](capi-nativedisplaymanager-displaysinfo.md) **allDisplays | Double pointer to the display information, which is encapsulated in [NativeDisplayManager_DisplaysInfo](capi-nativedisplaymanager-displaysinfo.md).| 669 670**Return value** 671 672| Type| Description| 673| -- | -- | 674| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 675 676### OH_NativeDisplayManager_DestroyAllDisplays() 677 678``` 679void OH_NativeDisplayManager_DestroyAllDisplays(NativeDisplayManager_DisplaysInfo *allDisplays) 680``` 681 682**Description** 683 684Destroys the object that contains the information about all displays. 685 686**System capability**: SystemCapability.Window.SessionManager.Core 687 688**Since**: 14 689 690 691**Parameters** 692 693| Parameter| Description| 694| -- | -- | 695| [NativeDisplayManager_DisplaysInfo](capi-nativedisplaymanager-displaysinfo.md) *allDisplays | Pointer to the display information object, which is obtained by calling [OH_NativeDisplayManager_CreateAllDisplays](capi-oh-display-manager-h.md#oh_nativedisplaymanager_createalldisplays). For details, see [NativeDisplayManager_DisplaysInfo](capi-nativedisplaymanager-displaysinfo.md).| 696 697### OH_NativeDisplayManager_CreateDisplayById() 698 699``` 700NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayById(uint32_t displayId,NativeDisplayManager_DisplayInfo **displayInfo) 701``` 702 703**Description** 704 705Obtains the object that contains the information about a display. 706 707**System capability**: SystemCapability.Window.SessionManager.Core 708 709**Since**: 14 710 711 712**Parameters** 713 714| Parameter| Description| 715| -- | -- | 716| uint32_t displayId | ID of the display. The value must be a non-negative integer.| 717| [NativeDisplayManager_DisplayInfo](capi-nativedisplaymanager-displayinfo.md) **displayInfo | Double pointer to the display information, which is encapsulated in [NativeDisplayManager_DisplayInfo](capi-nativedisplaymanager-displayinfo.md).| 718 719**Return value** 720 721| Type| Description| 722| -- | -- | 723| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 724 725### OH_NativeDisplayManager_DestroyDisplay() 726 727``` 728void OH_NativeDisplayManager_DestroyDisplay(NativeDisplayManager_DisplayInfo *displayInfo) 729``` 730 731**Description** 732 733Destroys the object that contains the information about a display. 734 735**System capability**: SystemCapability.Window.SessionManager.Core 736 737**Since**: 14 738 739 740**Parameters** 741 742| Parameter| Description| 743| -- | -- | 744| [NativeDisplayManager_DisplayInfo](capi-nativedisplaymanager-displayinfo.md) *displayInfo | Pointer to the display information object, which is obtained by calling [OH_NativeDisplayManager_CreateDisplayById](capi-oh-display-manager-h.md#oh_nativedisplaymanager_createdisplaybyid) or [OH_NativeDisplayManager_CreatePrimaryDisplay](capi-oh-display-manager-h.md#oh_nativedisplaymanager_createprimarydisplay). For details, see [NativeDisplayManager_DisplayInfo](capi-nativedisplaymanager-displayinfo.md).| 745 746### OH_NativeDisplayManager_CreatePrimaryDisplay() 747 748``` 749NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreatePrimaryDisplay(NativeDisplayManager_DisplayInfo **displayInfo) 750``` 751 752**Description** 753 754Obtains the object that contains the information about the primary display. For devices other than 2-in-1 devices, the displayInfo object obtained contains information about the built-in screen. For 2-in-1 devices with an external screen, the displayInfo object obtained contains information about the current primary screen. For 2-in-1 devices without an external screen, the displayInfo object obtained contains information about the built-in screen. 755 756**System capability**: SystemCapability.Window.SessionManager.Core 757 758**Since**: 14 759 760 761**Parameters** 762 763| Parameter| Description| 764| -- | -- | 765| [NativeDisplayManager_DisplayInfo](capi-nativedisplaymanager-displayinfo.md) **displayInfo | Double pointer to the display information, which is encapsulated in [NativeDisplayManager_DisplayInfo](capi-nativedisplaymanager-displayinfo.md).| 766 767**Return value** 768 769| Type| Description| 770| -- | -- | 771| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 772 773### OH_NativeDisplayManager_AvailableAreaChangeCallback() 774 775``` 776typedef void (*OH_NativeDisplayManager_AvailableAreaChangeCallback)(uint64_t displayId) 777``` 778 779**Description** 780 781Defines a callback function to listen for available area changes of a display. 782 783**Since**: 20 784 785 786**Parameters** 787 788| Parameter| Description| 789| -- | -- | 790| uint64_t displayId | Display ID, which is a non-negative integer.| 791 792### OH_NativeDisplayManager_RegisterAvailableAreaChangeListener() 793 794``` 795NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterAvailableAreaChangeListener(OH_NativeDisplayManager_AvailableAreaChangeCallback availableAreaChangeCallback, uint32_t *listenerIndex) 796``` 797 798**Description** 799 800Registers a listener for available area changes of the display. 801 802**Since**: 20 803 804 805**Parameters** 806 807| Parameter| Description| 808| -- | -- | 809| [OH_NativeDisplayManager_AvailableAreaChangeCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_availableareachangecallback) availableAreaChangeCallback | Callback function triggered when the available area of the display changes.<br>For details, see [OH_NativeDisplayManager_AvailableAreaChangeCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_availableareachangecallback).| 810| uint32_t *listenerIndex | Pointer to the index of the listener registered.<br>It can be used as an input parameter of [OH_NativeDisplayManager_UnregisterAvailableAreaChangeListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_unregisteravailableareachangelistener).| 811 812**Return value** 813 814| Type| Description| 815| -- | -- | 816| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 817 818### OH_NativeDisplayManager_UnregisterAvailableAreaChangeListener() 819 820``` 821NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterAvailableAreaChangeListener(uint32_t listenerIndex) 822``` 823 824**Description** 825 826Unregisters a listener for available area changes of the display. 827 828**Since**: 20 829 830 831**Parameters** 832 833| Parameter| Description| 834| -- | -- | 835| uint32_t listenerIndex | Index of the listener returned<br>when [OH_NativeDisplayManager_RegisterAvailableAreaChangeListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_registeravailableareachangelistener) is called.| 836 837**Return value** 838 839| Type| Description| 840| -- | -- | 841| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 842 843### OH_NativeDisplayManager_CreateAvailableArea() 844 845``` 846NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAvailableArea(uint64_t displayId, NativeDisplayManager_Rect **availableArea) 847``` 848 849**Description** 850 851Obtains the available area of a display. This function can be used only on 2-in-1 devices. 852 853**Since**: 20 854 855 856**Parameters** 857 858| Parameter| Description| 859| -- | -- | 860| uint64_t displayId | Display ID, which is a non-negative integer.| 861| [NativeDisplayManager_Rect](capi-nativedisplaymanager-rect.md) **availableArea | Double pointer to the available area of the display. For details, see [NativeDisplayManager_Rect](capi-nativedisplaymanager-rect.md).| 862 863**Return value** 864 865| Type| Description| 866| -- | -- | 867| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 868 869### OH_NativeDisplayManager_DestroyAvailableArea() 870 871``` 872NativeDisplayManager_ErrorCode OH_NativeDisplayManager_DestroyAvailableArea(NativeDisplayManager_Rect *availableArea) 873``` 874 875**Description** 876 877Destroys the available area of a display. This function can be used only on 2-in-1 devices. 878 879**Since**: 20 880 881 882**Parameters** 883 884| Parameter| Description| 885| -- | -- | 886| [NativeDisplayManager_Rect](capi-nativedisplaymanager-rect.md) *availableArea | Pointer to the available area, which is obtained by calling [OH_NativeDisplayManager_CreateAvailableArea](capi-oh-display-manager-h.md#oh_nativedisplaymanager_createavailablearea).<br>For details about the available area, see [NativeDisplayManager_Rect](capi-nativedisplaymanager-rect.md).| 887 888**Return value** 889 890| Type| Description| 891| -- | -- | 892| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 893 894### OH_NativeDisplayManager_DisplayAddCallback() 895 896``` 897typedef void (*OH_NativeDisplayManager_DisplayAddCallback)(uint64_t displayId) 898``` 899 900**Description** 901 902Defines a callback function to listen for display addition events. 903 904**Since**: 20 905 906 907**Parameters** 908 909| Parameter| Description| 910| -- | -- | 911| uint64_t displayId | Display ID, which is a non-negative integer.| 912 913### OH_NativeDisplayManager_RegisterDisplayAddListener() 914 915``` 916NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayAddListener(OH_NativeDisplayManager_DisplayAddCallback displayAddCallback, uint32_t *listenerIndex) 917``` 918 919**Description** 920 921Registers a listener for display addition events (for example, monitor inserted). 922 923**Since**: 20 924 925 926**Parameters** 927 928| Parameter| Description| 929| -- | -- | 930| [OH_NativeDisplayManager_DisplayAddCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_displayaddcallback) displayAddCallback | Callback function triggered when a display is added. For details, see [OH_NativeDisplayManager_DisplayAddCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_displayaddcallback).| 931| uint32_t *listenerIndex | Pointer to the index of the listener registered.<br>It can be used as an input parameter of [OH_NativeDisplayManager_UnregisterDisplayAddListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_unregisterdisplayaddlistener).| 932 933**Return value** 934 935| Type| Description| 936| -- | -- | 937| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 938 939### OH_NativeDisplayManager_UnregisterDisplayAddListener() 940 941``` 942NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayAddListener(uint32_t listenerIndex) 943``` 944 945**Description** 946 947Unregisters a listener for display addition events. 948 949**Since**: 20 950 951 952**Parameters** 953 954| Parameter| Description| 955| -- | -- | 956| uint32_t listenerIndex | Index of the listener returned when [OH_NativeDisplayManager_RegisterDisplayAddListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_registerdisplayaddlistener) is called.| 957 958**Return value** 959 960| Type| Description| 961| -- | -- | 962| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 963 964### OH_NativeDisplayManager_DisplayRemoveCallback() 965 966``` 967typedef void (*OH_NativeDisplayManager_DisplayRemoveCallback)(uint64_t displayId) 968``` 969 970**Description** 971 972Defines a callback function to listen for display removal events. 973 974**Since**: 20 975 976 977**Parameters** 978 979| Parameter| Description| 980| -- | -- | 981| uint64_t displayId | Display ID, which is a non-negative integer.| 982 983### OH_NativeDisplayManager_RegisterDisplayRemoveListener() 984 985``` 986NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayRemoveListener(OH_NativeDisplayManager_DisplayRemoveCallback displayRemoveCallback, uint32_t *listenerIndex) 987``` 988 989**Description** 990 991Registers a listener for display removal events (for example, monitor removed). 992 993**Since**: 20 994 995 996**Parameters** 997 998| Parameter| Description| 999| -- | -- | 1000| [OH_NativeDisplayManager_DisplayRemoveCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_displayremovecallback) displayRemoveCallback | Callback function triggered when a display is removed. For details, see [OH_NativeDisplayManager_DisplayRemoveCallback](capi-oh-display-manager-h.md#oh_nativedisplaymanager_displayremovecallback).| 1001| uint32_t *listenerIndex | Pointer to the index of the listener registered.<br>It can be used as an input parameter of [OH_NativeDisplayManager_UnregisterDisplayRemoveListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_unregisterdisplayremovelistener).| 1002 1003**Return value** 1004 1005| Type| Description| 1006| -- | -- | 1007| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 1008 1009### OH_NativeDisplayManager_UnregisterDisplayRemoveListener() 1010 1011``` 1012NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayRemoveListener(uint32_t listenerIndex) 1013``` 1014 1015**Description** 1016 1017Unregisters the listener for display removal events. 1018 1019**Since**: 20 1020 1021 1022**Parameters** 1023 1024| Parameter| Description| 1025| -- | -- | 1026| uint32_t listenerIndex | Index of the listener returned when [OH_NativeDisplayManager_RegisterDisplayRemoveListener](capi-oh-display-manager-h.md#oh_nativedisplaymanager_registerdisplayremovelistener) is called.| 1027 1028**Return value** 1029 1030| Type| Description| 1031| -- | -- | 1032| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 1033 1034### OH_NativeDisplayManager_GetDisplaySourceMode() 1035 1036``` 1037NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDisplaySourceMode(uint64_t displayId, NativeDisplayManager_SourceMode *sourceMode) 1038``` 1039 1040**Description** 1041 1042Obtains the source mode of a display. 1043 1044**Since**: 20 1045 1046 1047**Parameters** 1048 1049| Parameter| Description| 1050| -- | -- | 1051| uint64_t displayId | Display ID, which is a non-negative integer.| 1052| [NativeDisplayManager_SourceMode](capi-oh-display-info-h.md#nativedisplaymanager_sourcemode) *sourceMode | Pointer to the source mode. For details about the available options, see [NativeDisplayManager_SourceMode](capi-oh-display-info-h.md#nativedisplaymanager_sourcemode).| 1053 1054**Return value** 1055 1056| Type| Description| 1057| -- | -- | 1058| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).| 1059 1060### OH_NativeDisplayManager_GetDisplayPosition() 1061 1062``` 1063NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDisplayPosition(uint64_t displayId, int32_t *x, int32_t *y) 1064``` 1065 1066**Description** 1067 1068Obtains the position of a display. 1069 1070**Since**: 20 1071 1072 1073**Parameters** 1074 1075| Parameter| Description| 1076| -- | -- | 1077| uint64_t displayId | Display ID, which is a non-negative integer.| 1078| int32_t *x | Pointer to the X coordinate of the upper-left corner of the primary screen.| 1079| int32_t *y | Pointer to the Y coordinate of the upper-left corner of the primary screen.| 1080 1081**Return value** 1082 1083| Type| Description| 1084| -- | -- | 1085| [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode) | Status code defined in [NativeDisplayManager_ErrorCode](capi-oh-display-info-h.md#nativedisplaymanager_errorcode).<br>Currently, only the primary screen and extended screen support position information query. Queries for other screens return **DISPLAY_MANAGER_ERROR_ILLEGAL_PARAM**.| 1086