Class Monitor
- All Implemented Interfaces:
Proxy
GdkMonitor
objects represent 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(org.gnome.gdk.Surface)
to find a particular
monitor.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Monitor.Builder<B extends Monitor.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theInvalidateCallback
callback.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionMonitor
(MemorySegment address) Create a Monitor proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected Monitor
asParent()
Returns this instance as if it were its parent type.static Monitor.Builder
<? extends Monitor.Builder> builder()
AMonitor.Builder
object constructs aMonitor
with the specified properties.void
Emits the "invalidate" signal.Gets the name of the monitor's connector, if available.Gets a string describing the monitor, if available.Gets the display that this monitor belongs to.void
getGeometry
(Rectangle geometry) Retrieves the size and position of the monitor within the display coordinate space.int
Gets the height in millimeters of the monitor.Gets the name or PNP ID of the monitor's manufacturer.getModel()
Gets the string identifying the monitor model, if available.int
Gets the refresh rate of the monitor, if available.double
getScale()
Gets the internal scale factor that maps from monitor coordinates to device pixels.int
Gets 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 Type
getType()
Get the GType of the Monitor classint
Gets the width in millimeters of the monitor.boolean
isValid()
Returnstrue
if the this Monitor object corresponds to a physical monitor.onInvalidate
(Monitor.InvalidateCallback handler) Emitted when the output represented bymonitor
gets disconnected.Methods inherited from class org.gnome.gobject.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, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Monitor
Create a Monitor proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
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
-
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
- aGdkRectangle
to 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
-
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()Returnstrue
if the this Monitor object corresponds to a physical monitor.The this Monitor becomes invalid when the physical monitor is unplugged or removed.
- Returns:
true
if the object corresponds to a physical monitor
-
onInvalidate
public SignalConnection<Monitor.InvalidateCallback> onInvalidate(Monitor.InvalidateCallback handler) Emitted when the output represented bymonitor
gets 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(org.gnome.gdk.Monitor.InvalidateCallback)
. -
builder
AMonitor.Builder
object constructs aMonitor
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withMonitor.Builder.build()
.
-