mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 03:36:01 +01:00
Check GTK+ version for monitor methods
This commit is contained in:
parent
250547cabd
commit
9bfefaf905
1 changed files with 5 additions and 1 deletions
|
@ -154,6 +154,10 @@ zathura_update_view_dpi(zathura_t* zathura)
|
||||||
if (display == NULL) {
|
if (display == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double dpi = 0.0;
|
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION(3,22,0)
|
||||||
GdkMonitor* monitor = gdk_display_get_monitor_at_window(display, window);
|
GdkMonitor* monitor = gdk_display_get_monitor_at_window(display, window);
|
||||||
if (monitor == NULL) {
|
if (monitor == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -167,12 +171,12 @@ zathura_update_view_dpi(zathura_t* zathura)
|
||||||
gdk_monitor_get_geometry(monitor, &monitor_geom);
|
gdk_monitor_get_geometry(monitor, &monitor_geom);
|
||||||
|
|
||||||
/* calculate dpi, knowing that 1 inch = 25.4 mm */
|
/* calculate dpi, knowing that 1 inch = 25.4 mm */
|
||||||
double dpi = 0.0;
|
|
||||||
if (width_mm == 0) {
|
if (width_mm == 0) {
|
||||||
girara_debug("cannot calculate DPI: monitor has zero width");
|
girara_debug("cannot calculate DPI: monitor has zero width");
|
||||||
} else {
|
} else {
|
||||||
dpi = monitor_geom.width * 25.4 / width_mm;
|
dpi = monitor_geom.width * 25.4 / width_mm;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GDK_WINDOWING_WAYLAND
|
#ifdef GDK_WINDOWING_WAYLAND
|
||||||
/* work around apparend bug in GDK: on Wayland, monitor geometry doesn't
|
/* work around apparend bug in GDK: on Wayland, monitor geometry doesn't
|
||||||
|
|
Loading…
Reference in a new issue