diff options
author | ZenWalker <[email protected]> | 2017-08-06 02:01:47 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-15 17:20:58 +0200 |
commit | 061f3780a3af6224a804d239f9b9dfc5c81873f6 (patch) | |
tree | 6bd01d58e8dcce0c51e015b1a441c25b9c5a6d9e | |
parent | 930a86b399d43ab779d8b70e43e31e4ef453fb8e (diff) | |
download | mate-control-center-061f3780a3af6224a804d239f9b9dfc5c81873f6.tar.bz2 mate-control-center-061f3780a3af6224a804d239f9b9dfc5c81873f6.tar.xz |
avoid deprecated gdk_screen_get_width/height
-rw-r--r-- | capplets/appearance/appearance-font.c | 10 | ||||
-rw-r--r-- | typing-break/drw-break-window.c | 13 | ||||
-rw-r--r-- | typing-break/drw-utils.c | 5 | ||||
-rw-r--r-- | typing-break/drwright.c | 9 |
4 files changed, 23 insertions, 14 deletions
diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c index af2a1a41..f47504f3 100644 --- a/capplets/appearance/appearance-font.c +++ b/capplets/appearance/appearance-font.c @@ -425,11 +425,13 @@ get_dpi_from_x_server (void) screen = gdk_screen_get_default (); if (screen) { 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) diff --git a/typing-break/drw-break-window.c b/typing-break/drw-break-window.c index 8c2a62fb..6a72f68e 100644 --- a/typing-break/drw-break-window.c +++ b/typing-break/drw-break-window.c @@ -127,6 +127,8 @@ drw_break_window_init (DrwBreakWindow *window) gint root_monitor = 0; GdkScreen *screen = NULL; GdkRectangle monitor; + gint sc_width; + gint sc_height; gint right_padding; gint bottom_padding; GSettings *settings; @@ -149,16 +151,17 @@ drw_break_window_init (DrwBreakWindow *window) screen = gdk_screen_get_default (); gdk_screen_get_monitor_geometry (screen, root_monitor, &monitor); - gtk_window_set_default_size (GTK_WINDOW (window), - gdk_screen_get_width (screen), - gdk_screen_get_height (screen)); + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &sc_width, &sc_height); + + gtk_window_set_default_size (GTK_WINDOW (window), sc_width, sc_height); gtk_window_set_decorated (GTK_WINDOW (window), FALSE); gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); drw_setup_background (GTK_WIDGET (window)); - right_padding = gdk_screen_get_width (screen) - monitor.width - monitor.x; - bottom_padding = gdk_screen_get_height (screen) - monitor.height - monitor.y; + right_padding = sc_width - monitor.width - monitor.x; + bottom_padding = sc_height - monitor.height - monitor.y; outer_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_hexpand (outer_vbox, TRUE); diff --git a/typing-break/drw-utils.c b/typing-break/drw-utils.c index 974f47ac..53a6493f 100644 --- a/typing-break/drw-utils.c +++ b/typing-break/drw-utils.c @@ -124,8 +124,9 @@ set_pixmap_background (GtkWidget *window) gtk_widget_realize (window); screen = gtk_widget_get_screen (window); - width = gdk_screen_get_width (screen); - height = gdk_screen_get_height (screen); + + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &width, &height); tmp_pixbuf = gdk_pixbuf_get_from_window (gdk_screen_get_root_window (screen), 0, diff --git a/typing-break/drwright.c b/typing-break/drwright.c index 6cc6b248..6a7726a6 100644 --- a/typing-break/drwright.c +++ b/typing-break/drwright.c @@ -811,15 +811,18 @@ create_secondary_break_windows (void) if (screen != gdk_screen_get_default ()) { /* Handled by DrwBreakWindow. */ + gint sc_width, sc_height; + window = gtk_window_new (GTK_WINDOW_POPUP); windows = g_list_prepend (windows, window); gtk_window_set_screen (GTK_WINDOW (window), screen); - gtk_window_set_default_size (GTK_WINDOW (window), - gdk_screen_get_width (screen), - gdk_screen_get_height (screen)); + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &sc_width, &sc_height); + + gtk_window_set_default_size (GTK_WINDOW (window), sc_width, sc_height); gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); drw_setup_background (GTK_WIDGET (window)); |