docs
Docs
C++ API
C API
Search API
Ctrl K
2.0
2.0
latest
1.4
Ultralight C++ API
2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Monitor.h
Go to the documentation of this file.
1
///
2
/// Copyright (C) 2026 Ultralight, Inc. All rights reserved.
3
/// A license is required for commercial use. https://ultralig.ht
4
///
5
#pragma once
6
#include "
Defines.h
"
7
8
namespace
ultralight
{
9
10
///
11
/// A platform-specific monitor.
12
///
13
/// ## Coordinate Systems
14
///
15
/// A monitor may have a device scale applied by the OS (for example, a Retina display on macOS
16
/// may have a 2x or 3x DPI scale).
17
///
18
/// Unadorned dimensions in this API are logical pixels (device-scale independent). The device_*
19
/// accessors report physical device pixels. The two are related by scale():
20
///
21
/// ```
22
/// device_pixels = round(logical_pixels * scale)
23
/// ```
24
///
25
class
AExport
Monitor
{
26
public
:
27
virtual
~Monitor
() {}
28
29
///
30
/// Get the unique display ID of the monitor.
31
///
32
/// The renderer uses this ID to identify which monitor a View is on (ViewConfig::display_id).
33
///
34
/// The App tracks the refresh of each monitor it enumerates and automatically calls
35
/// Renderer::RefreshDisplay() with this ID to drive animation in the corresponding View%s.
36
///
37
/// @see App::monitor()
38
///
39
virtual
uint32_t
display_id
()
const
= 0;
40
41
///
42
/// Get the DPI scale (1.0 = 100%).
43
///
44
virtual
double
scale
()
const
= 0;
45
46
///
47
/// Get the width of the monitor (in logical pixels).
48
///
49
virtual
double
width
()
const
= 0;
50
51
///
52
/// Get the height of the monitor (in logical pixels).
53
///
54
virtual
double
height
()
const
= 0;
55
56
///
57
/// Get the width of the monitor (in device pixels).
58
///
59
virtual
uint32_t
device_width
()
const
= 0;
60
61
///
62
/// Get the height of the monitor (in device pixels).
63
///
64
virtual
uint32_t
device_height
()
const
= 0;
65
66
///
67
/// Get the refresh rate of the monitor (in Hz).
68
///
69
/// This is the nominal rate of the monitor's current display mode (60 when the rate is
70
/// unavailable). A variable-refresh display reports its maximum rate.
71
///
72
virtual
uint32_t
refresh_rate
()
const
= 0;
73
};
74
75
}
// namespace ultralight
Defines.h
AExport
#define AExport
Definition
Defines.h:41
ultralight::Monitor
A platform-specific monitor.
Definition
Monitor.h:25
ultralight::Monitor::~Monitor
virtual ~Monitor()
Definition
Monitor.h:27
ultralight::Monitor::scale
virtual double scale() const =0
Get the DPI scale (1.0 = 100%).
ultralight::Monitor::device_height
virtual uint32_t device_height() const =0
Get the height of the monitor (in device pixels).
ultralight::Monitor::width
virtual double width() const =0
Get the width of the monitor (in logical pixels).
ultralight::Monitor::height
virtual double height() const =0
Get the height of the monitor (in logical pixels).
ultralight::Monitor::device_width
virtual uint32_t device_width() const =0
Get the width of the monitor (in device pixels).
ultralight::Monitor::refresh_rate
virtual uint32_t refresh_rate() const =0
Get the refresh rate of the monitor (in Hz).
ultralight::Monitor::display_id
virtual uint32_t display_id() const =0
Get the unique display ID of the monitor.
ultralight
Root namespace for every public Ultralight type, function, and enumeration.
AppCore
Monitor.h
Docs
C++ API
C API
Version
2.0
2.0
latest
1.4