mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
gdk: Add private convenience api
Add a function to get the monitor resolution. We may use this information in the future to make font rendering decisions.
This commit is contained in:
parent
cc8db1805d
commit
a63e9d38fb
@ -744,3 +744,11 @@ gdk_monitor_set_description (GdkMonitor *monitor,
|
||||
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
|
||||
}
|
||||
|
||||
#define MM_PER_INCH 25.4
|
||||
|
||||
double
|
||||
gdk_monitor_get_dpi (GdkMonitor *monitor)
|
||||
{
|
||||
return MAX ((monitor->geometry.width * monitor->scale) / (monitor->width_mm / MM_PER_INCH),
|
||||
(monitor->geometry.height * monitor->scale) / (monitor->height_mm / MM_PER_INCH));
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
|
||||
void gdk_monitor_invalidate (GdkMonitor *monitor);
|
||||
void gdk_monitor_set_description (GdkMonitor *monitor,
|
||||
const char *description);
|
||||
double gdk_monitor_get_dpi (GdkMonitor *monitor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user