summaryrefslogtreecommitdiff
path: root/eel/eel-gtk-extensions.c
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-11 16:52:57 +0200
committerlukefromdc <[email protected]>2017-08-12 22:16:28 -0400
commit42c8d2c3373c25d6e321be6950997c0d7ce44279 (patch)
tree9eb8112ce7dd51b0073ea7521770c372b26d1039 /eel/eel-gtk-extensions.c
parent17b3c0ca924ffcd4bd06fded98227eba626d4f0b (diff)
downloadcaja-42c8d2c3373c25d6e321be6950997c0d7ce44279.tar.bz2
caja-42c8d2c3373c25d6e321be6950997c0d7ce44279.tar.xz
avoid deprecated gdk_screen_width/height
Diffstat (limited to 'eel/eel-gtk-extensions.c')
-rw-r--r--eel/eel-gtk-extensions.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index b9d870c5..e388636a 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -86,6 +86,11 @@ eel_gtk_window_get_geometry_string (GtkWindow *window)
static void
sanity_check_window_position (int *left, int *top)
{
+ gint sc_width, sc_height;
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()),
+ NULL, NULL, &sc_width, &sc_height);
+
g_assert (left != NULL);
g_assert (top != NULL);
@@ -95,7 +100,7 @@ sanity_check_window_position (int *left, int *top)
* isn't off the bottom of the screen, or so close to the bottom
* that it might be obscured by the panel.
*/
- *top = CLAMP (*top, 0, gdk_screen_height() - MINIMUM_ON_SCREEN_HEIGHT);
+ *top = CLAMP (*top, 0, sc_height - MINIMUM_ON_SCREEN_HEIGHT);
/* FIXME bugzilla.eazel.com 669:
* If window has negative left coordinate, set_uposition sends it
@@ -108,12 +113,17 @@ sanity_check_window_position (int *left, int *top)
* the screen, or so close to the right edge that it might be
* obscured by the panel.
*/
- *left = CLAMP (*left, 0, gdk_screen_width() - MINIMUM_ON_SCREEN_WIDTH);
+ *left = CLAMP (*left, 0, sc_width - MINIMUM_ON_SCREEN_WIDTH);
}
static void
sanity_check_window_dimensions (guint *width, guint *height)
{
+ gint sc_width, sc_height;
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()),
+ NULL, NULL, &sc_width, &sc_height);
+
g_assert (width != NULL);
g_assert (height != NULL);
@@ -122,8 +132,8 @@ sanity_check_window_dimensions (guint *width, guint *height)
* be reached (might not be necessary with all window managers,
* but seems reasonable anyway).
*/
- *width = MIN (*width, gdk_screen_width());
- *height = MIN (*height, gdk_screen_height());
+ *width = MIN (*width, sc_width);
+ *height = MIN (*height, sc_height);
}
/**