diff options
author | ZenWalker <[email protected]> | 2017-08-08 02:14:01 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-14 08:03:54 +0200 |
commit | 7f887e614812ccb86f5d784e2db58bede8daa712 (patch) | |
tree | 860298892997172e8a6711f33268b194881f1c17 | |
parent | daa0acc2088b8501c3c55134f8f21f3e853ca83d (diff) | |
download | mate-settings-daemon-7f887e614812ccb86f5d784e2db58bede8daa712.tar.bz2 mate-settings-daemon-7f887e614812ccb86f5d784e2db58bede8daa712.tar.xz |
avoid deprecated gdk_screen_get_width/height
-rw-r--r-- | plugins/a11y-keyboard/msd-a11y-preferences-dialog.c | 12 | ||||
-rw-r--r-- | plugins/background/msd-background-manager.c | 16 | ||||
-rw-r--r-- | plugins/common/msd-osd-window.c | 8 | ||||
-rw-r--r-- | plugins/xsettings/msd-xsettings-manager.c | 8 |
4 files changed, 32 insertions, 12 deletions
diff --git a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c index 410757a..92b75c3 100644 --- a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c +++ b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c @@ -177,11 +177,15 @@ get_dpi_from_x_server (void) if (screen != NULL) { double width_dpi; double height_dpi; + gint sc_width; + gint sc_height; + + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &sc_width, &sc_height); + + 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)); - width_dpi = dpi_from_pixels_and_mm (gdk_screen_get_width (screen), - gdk_screen_get_width_mm (screen)); - height_dpi = dpi_from_pixels_and_mm (gdk_screen_get_height (screen), - gdk_screen_get_height_mm (screen)); if (width_dpi < DPI_LOW_REASONABLE_VALUE || width_dpi > DPI_HIGH_REASONABLE_VALUE || height_dpi < DPI_LOW_REASONABLE_VALUE diff --git a/plugins/background/msd-background-manager.c b/plugins/background/msd-background-manager.c index de1ff34..eed9302 100644 --- a/plugins/background/msd-background-manager.c +++ b/plugins/background/msd-background-manager.c @@ -183,10 +183,14 @@ static void real_draw_bg (MsdBackgroundManager *manager, GdkScreen *screen) { + gint width; + gint height; + MsdBackgroundManagerPrivate *p = manager->priv; GdkWindow *window = gdk_screen_get_root_window (screen); - gint width = gdk_screen_get_width (screen); - gint height = gdk_screen_get_height (screen); + + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &width, &height); free_bg_surface (manager); p->surface = mate_bg_create_surface (p->bg, window, width, height, TRUE); @@ -250,15 +254,19 @@ static void on_screen_size_changed (GdkScreen *screen, MsdBackgroundManager *manager) { + gint sc_width, sc_height; + MsdBackgroundManagerPrivate *p = manager->priv; + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &sc_width, &sc_height); + if (!p->msd_can_draw || p->draw_in_progress || caja_is_drawing_bg (manager)) return; gint scr_num = gdk_x11_screen_get_screen_number (screen); gchar *old_size = g_list_nth_data (manager->priv->scr_sizes, scr_num); - gchar *new_size = g_strdup_printf ("%dx%d", gdk_screen_get_width (screen), - gdk_screen_get_height (screen)); + gchar *new_size = g_strdup_printf ("%dx%d", sc_width, sc_height); if (g_strcmp0 (old_size, new_size) != 0) { g_debug ("Screen%d size changed: %s -> %s", scr_num, old_size, new_size); diff --git a/plugins/common/msd-osd-window.c b/plugins/common/msd-osd-window.c index 03e1ec3..e5dab81 100644 --- a/plugins/common/msd-osd-window.c +++ b/plugins/common/msd-osd-window.c @@ -444,6 +444,7 @@ msd_osd_window_init (MsdOsdWindow *window) if (window->priv->is_composited) { gdouble scalew, scaleh, scale; + gint sc_width, sc_height; gint size; gtk_window_set_decorated (GTK_WINDOW (window), FALSE); @@ -452,9 +453,12 @@ msd_osd_window_init (MsdOsdWindow *window) GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET (window)); gtk_style_context_add_class (style, "window-frame"); + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &sc_width, &sc_height); + /* assume 130x130 on a 640x480 display and scale from there */ - scalew = gdk_screen_get_width (screen) / 640.0; - scaleh = gdk_screen_get_height (screen) / 480.0; + scalew = sc_width / 640.0; + scaleh = sc_height / 480.0; scale = MIN (scalew, scaleh); size = 130 * MAX (1, scale); diff --git a/plugins/xsettings/msd-xsettings-manager.c b/plugins/xsettings/msd-xsettings-manager.c index e7849ec..c3d06dd 100644 --- a/plugins/xsettings/msd-xsettings-manager.c +++ b/plugins/xsettings/msd-xsettings-manager.c @@ -237,9 +237,13 @@ get_dpi_from_x_server (void) screen = gdk_screen_get_default (); if (screen != NULL) { double width_dpi, height_dpi; + gint sc_width, sc_height; - width_dpi = dpi_from_pixels_and_mm (gdk_screen_get_width (screen), gdk_screen_get_width_mm (screen)); - height_dpi = dpi_from_pixels_and_mm (gdk_screen_get_height (screen), gdk_screen_get_height_mm (screen)); + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &sc_width, &sc_height); + + 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)); 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) { |