[evince/617-get-dpi-from-gdk-monitor] libdocument: deprecate ev_document_misc_get_screen_dpi()
- From: Jason Crain <jcrain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/617-get-dpi-from-gdk-monitor] libdocument: deprecate ev_document_misc_get_screen_dpi()
- Date: Tue, 5 Nov 2019 19:26:24 +0000 (UTC)
commit 711ff028cf531794c987c8326581b1261e9aef76
Author: Jason Crain <jason inspiresomeone us>
Date: Tue Nov 5 12:06:14 2019 -0700
libdocument: deprecate ev_document_misc_get_screen_dpi()
The GDK screen size functions, such as gdk_screen_get_width(), are
deprecated since GDK version 3.22 in favor of the per-monitor
information provided through GdkMonitor. In turn, deprecate evince's
ev_document_misc_get_screen_dpi() function in favor of
ev_document_misc_get_widget_dpi(), which uses the GdkMonitor API.
libdocument/ev-document-misc.c | 12 ++++++++++++
libdocument/ev-document-misc.h | 1 +
2 files changed, 13 insertions(+)
---
diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c
index fb6de3ec..d0954871 100644
--- a/libdocument/ev-document-misc.c
+++ b/libdocument/ev-document-misc.c
@@ -506,9 +506,20 @@ ev_document_misc_invert_pixbuf (GdkPixbuf *pixbuf)
}
}
+/**
+ * ev_document_misc_get_screen_dpi:
+ * @screen: a #GtkScreen
+ *
+ * Returns: The DPI of @screen, or 96 if the DPI is not available
+ *
+ * Deprecated: 3.36: This uses a deprecated GDK API. Use
+ * ev_document_misc_get_widget_dpi() instead, which uses GDK's per-monitor
+ * information.
+ */
gdouble
ev_document_misc_get_screen_dpi (GdkScreen *screen)
{
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gdouble dp, di;
/*diagonal in pixels*/
@@ -522,6 +533,7 @@ ev_document_misc_get_screen_dpi (GdkScreen *screen)
return 96;
return (dp / di);
+G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
diff --git a/libdocument/ev-document-misc.h b/libdocument/ev-document-misc.h
index 2933e4fc..bb2fe171 100644
--- a/libdocument/ev-document-misc.h
+++ b/libdocument/ev-document-misc.h
@@ -80,6 +80,7 @@ cairo_surface_t *ev_document_misc_surface_rotate_and_scale (cairo_surface_t *sur
void ev_document_misc_invert_surface (cairo_surface_t *surface);
void ev_document_misc_invert_pixbuf (GdkPixbuf *pixbuf);
+EV_DEPRECATED_FOR(ev_document_misc_get_widget_dpi)
gdouble ev_document_misc_get_screen_dpi (GdkScreen *screen);
gdouble ev_document_misc_get_widget_dpi (GtkWidget *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]