Class Monitor
- All Implemented Interfaces:
Proxy
Represents the individual outputs that are associated with a GdkDisplay.
GdkDisplay keeps a GListModel to enumerate and monitor
monitors with Display.getMonitors(). You can use
Display.getMonitorAtSurface(Surface) to find a particular
monitor.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMonitor.Builder<B extends Monitor.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theInvalidateCallbackcallback.static classNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionMonitor()Create a new Monitor.Monitor(MemorySegment address) Create a Monitor instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected MonitorasParent()Return this instance as if it were its parent type.static Monitor.Builder<? extends Monitor.Builder> builder()AMonitor.Builderobject constructs aMonitorwith the specified properties.voidEmits the "invalidate" signal.@Nullable StringGets the name of the monitor's connector, if available.@Nullable StringGets a string describing the monitor, if available.Gets the display that this monitor belongs to.voidgetGeometry(Rectangle geometry) Retrieves the size and position of the monitor within the display coordinate space.intGets the height in millimeters of the monitor.@Nullable StringGets the name or PNP ID of the monitor's manufacturer.static MemoryLayoutThe memory layout of the native struct.@Nullable StringgetModel()Gets the string identifying the monitor model, if available.intGets the refresh rate of the monitor, if available.doublegetScale()Gets the internal scale factor that maps from monitor coordinates to device pixels.intGets the internal scale factor that maps from monitor coordinates to device pixels.Gets information about the layout of red, green and blue primaries for pixels.static @Nullable TypegetType()Get the GType of the Monitor class.intGets the width in millimeters of the monitor.booleanisValid()Returnstrueif the this Monitor object corresponds to a physical monitor.onInvalidate(Monitor.InvalidateCallback handler) Emitted when the output represented bymonitorgets disconnected.Methods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Monitor
Create a Monitor instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Monitor
public Monitor()Create a new Monitor.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
getConnector
Gets the name of the monitor's connector, if available.
These are strings such as "eDP-1", or "HDMI-2". They depend on software and hardware configuration, and should not be relied on as stable identifiers of a specific monitor.
- Returns:
- the name of the connector
-
getDescription
Gets a string describing the monitor, if available.
This can be used to identify a monitor in the UI.
- Returns:
- the monitor description
- Since:
- 4.10
-
getDisplay
-
getGeometry
Retrieves the size and position of the monitor within the display coordinate space.
The returned geometry is in ”application pixels”, not in ”device pixels” (see
getScale()).- Parameters:
geometry- aGdkRectangleto be filled with the monitor geometry
-
getHeightMm
public int getHeightMm()Gets the height in millimeters of the monitor.- Returns:
- the physical height of the monitor
-
getManufacturer
Gets the name or PNP ID of the monitor's manufacturer.
Note that this value might also vary depending on actual display backend.
The PNP ID registry is located at https://uefi.org/pnp_id_list.
- Returns:
- the name of the manufacturer
-
getModel
Gets the string identifying the monitor model, if available.- Returns:
- the monitor model
-
getRefreshRate
public int getRefreshRate()Gets the refresh rate of the monitor, if available.
The value is in milli-Hertz, so a refresh rate of 60Hz is returned as 60000.
- Returns:
- the refresh rate in milli-Hertz, or 0
-
getScale
public double getScale()Gets the internal scale factor that maps from monitor coordinates to device pixels.
This can be used if you want to create pixel based data for a particular monitor, but most of the time you’re drawing to a surface where it is better to use
Surface.getScale()instead.- Returns:
- the scale
- Since:
- 4.14
-
getScaleFactor
public int getScaleFactor()Gets the internal scale factor that maps from monitor coordinates to device pixels.
On traditional systems this is 1, but on very high density outputs it can be a higher value (often 2).
This can be used if you want to create pixel based data for a particular monitor, but most of the time you’re drawing to a surface where it is better to use
Surface.getScaleFactor()instead.- Returns:
- the scale factor
-
getSubpixelLayout
Gets information about the layout of red, green and blue primaries for pixels.- Returns:
- the subpixel layout
-
getWidthMm
public int getWidthMm()Gets the width in millimeters of the monitor.- Returns:
- the physical width of the monitor
-
isValid
public boolean isValid()Returns
trueif the this Monitor object corresponds to a physical monitor.The this Monitor becomes invalid when the physical monitor is unplugged or removed.
- Returns:
trueif the object corresponds to a physical monitor
-
onInvalidate
public SignalConnection<Monitor.InvalidateCallback> onInvalidate(Monitor.InvalidateCallback handler) Emitted when the output represented bymonitorgets disconnected.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitInvalidate
public void emitInvalidate()Emits the "invalidate" signal. SeeonInvalidate(Monitor.InvalidateCallback). -
builder
AMonitor.Builderobject constructs aMonitorwith the specified properties. Use the variousset...()methods to set properties, and finish construction withMonitor.Builder.build().- Returns:
- the builder object
-