Description
This structure holds data passed to the event handler for the #PG_Event_DPI event. This
event is triggered when a ProGUI window's DPI settings change, typically because the window has been
moved
to a display monitor with different scaling settings.
Structure Definition
Structure PG_EventDPI
dpiX.i ; The new horizontal DPI value of the window's current monitor
dpiY.i ; The new vertical DPI value of the window's current monitor
dpiScaleX.d ; The new horizontal DPI scaling factor (dpiX / 96.0)
dpiScaleY.d ; The new vertical DPI scaling factor (dpiY / 96.0)
width.d ; Suggested new width for the window in Device Independent Pixels (DIPs), adjusted for the new DPI
height.d ; Suggested new height for the window in Device Independent Pixels (DIPs), adjusted for the new DPI
widthPixels.i ; Suggested new width for the window in physical pixels, adjusted for the new DPI
heightPixels.i ; Suggested new height for the window in physical pixels, adjusted for the new DPI
EndStructure
Members
dpiX.i
The new horizontal Dots Per Inch setting of the monitor the window is now
on.
dpiY.i
The new vertical Dots Per Inch setting of the monitor the window is now
on.
dpiScaleX.d
The calculated horizontal scaling factor based on the new DPI
(dpiX / 96.0).
dpiScaleY.d
The calculated vertical scaling factor based on the new DPI
(dpiY / 96.0).
width.d
The suggested width the window should be resized to, in DIPs, to maintain
its apparent size on the new display. ProGUI typically handles this automatically via WindowResize() internally before dispatching the event.
height.d
The suggested height the window should be resized to, in DIPs.
widthPixels.i
The suggested width the window should be resized to, in physical
pixels.
heightPixels.i
The suggested height the window should be resized to, in physical
pixels.
Used By Events
#PG_Event_DPI
Remarks
When the #PG_Event_DPI event is received, ProGUI has usually already initiated a resize of
the window based on the suggested pixel dimensions (`widthPixels`, `heightPixels`). Your handler for
this
event should typically be used to update any resources or perform calculations that are DPI-dependent
and
not automatically handled by ProGUI's layout and drawing systems (e.g., regenerating cached bitmaps at
the new resolution, adjusting font sizes for OS widgets if not handled automatically). ProGUI redraws
the
window automatically after a DPI change.
You can use the new scaling factors (`dpiScaleX`, `dpiScaleY`) to manually adjust non-ProGUI elements or perform custom scaling calculations if needed.
See Also
AddEventHandler, WindowGetDpiX, WindowGetDpiY, WindowGetDpiScaleX, WindowGetDpiScaleY, WindowResize, Event Handling Overview
Supported OS
Windows, Linux