diff options
author | Pablo Barciela <[email protected]> | 2017-12-06 01:03:11 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-12-20 20:47:45 +0100 |
commit | 8d737c695f37a5bb0ad5ded56a44777249624cea (patch) | |
tree | 818759a6696563fdee0297528099302ce8907849 /capplets | |
parent | cde96bf637600cd257861b84ae39233ab800a9b9 (diff) | |
download | mate-control-center-8d737c695f37a5bb0ad5ded56a44777249624cea.tar.bz2 mate-control-center-8d737c695f37a5bb0ad5ded56a44777249624cea.tar.xz |
WidthOfScreen and HeightOfScreen implementation
This commit reverts:
https://github.com/mate-desktop/mate-control-center/commit/fe782c673262e861334bb48265abf5075ff02680
https://github.com/mate-desktop/mate-control-center/commit/061f3780a3af6224a804d239f9b9dfc5c81873f6
And it applies an alternative to fix the deprecated functions:
gdk_screen_get_width
gdk_screen_get_height
gdk_screen_width
gdk_screen_height
Diffstat (limited to 'capplets')
-rw-r--r-- | capplets/appearance/appearance-font.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c index 8012e151..0df8d4eb 100644 --- a/capplets/appearance/appearance-font.c +++ b/capplets/appearance/appearance-font.c @@ -420,53 +420,18 @@ dpi_from_pixels_and_mm (int pixels, int mm) static double get_dpi_from_x_server (void) { -#if GTK_CHECK_VERSION (3, 22, 0) - GdkDisplay *display; - GdkMonitor *monitor; -#endif GdkScreen *screen; double dpi; screen = gdk_screen_get_default (); -#if GTK_CHECK_VERSION (3, 22, 0) - display = gdk_screen_get_display (screen); - monitor = gdk_display_get_primary_monitor (display); -#endif + if (screen) { double width_dpi, height_dpi; - gint sc_width = 0; - gint sc_height = 0; -#if GTK_CHECK_VERSION (3, 22, 0) - gint n =0; - gint i = 0; - GdkRectangle geometry; - - n = gdk_display_get_n_monitors (display); - - for (i = 0; i < n; ++i) - { - monitor = gdk_display_get_monitor (display, i); - - gdk_monitor_get_geometry (monitor, &geometry); - sc_width = sc_width + geometry.width; - - if (geometry.height > sc_height) - sc_height = sc_height + geometry.height; - } -#else - gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, - &sc_width, &sc_height); -#endif -#if GTK_CHECK_VERSION (3, 22, 0) Screen *xscreen = gdk_x11_screen_get_xscreen (screen); - width_dpi = dpi_from_pixels_and_mm (sc_width, WidthMMOfScreen (xscreen)); - height_dpi = dpi_from_pixels_and_mm (sc_height, HeightMMOfScreen (xscreen)); -#else - width_dpi = dpi_from_pixels_and_mm (sc_width, gdk_screen_get_width_mm (screen)); - height_dpi = dpi_from_pixels_and_mm (sc_height, gdk_screen_get_height_mm (screen)); -#endif + width_dpi = dpi_from_pixels_and_mm (WidthOfScreen (xscreen), WidthMMOfScreen (xscreen)); + height_dpi = dpi_from_pixels_and_mm (HeightOfScreen (xscreen), HeightMMOfScreen (xscreen)); if (width_dpi < DPI_LOW_REASONABLE_VALUE || width_dpi > DPI_HIGH_REASONABLE_VALUE || height_dpi < DPI_LOW_REASONABLE_VALUE || height_dpi > DPI_HIGH_REASONABLE_VALUE) |