summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-07 02:56:30 +0200
committerlukefromdc <[email protected]>2017-08-12 22:16:28 -0400
commit17b3c0ca924ffcd4bd06fded98227eba626d4f0b (patch)
tree089be8a53def688e8dea11c48b00c16a34111d7f
parent6c51a333e80df22587df4d9e0e2789fd1289d728 (diff)
downloadcaja-17b3c0ca924ffcd4bd06fded98227eba626d4f0b.tar.bz2
caja-17b3c0ca924ffcd4bd06fded98227eba626d4f0b.tar.xz
avoid deprecated gdk_screen_get_width/height
-rw-r--r--eel/eel-background.c8
-rw-r--r--eel/eel-gtk-extensions.c5
-rw-r--r--libcaja-private/caja-icon-container.c21
-rw-r--r--src/caja-desktop-window.c8
-rw-r--r--src/caja-window.c14
-rw-r--r--src/file-manager/fm-desktop-icon-view.c10
6 files changed, 46 insertions, 20 deletions
diff --git a/eel/eel-background.c b/eel/eel-background.c
index 76f47a69..b096650a 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -311,9 +311,13 @@ drawable_get_adjusted_size (EelBackground *self,
{
if (self->details->is_desktop)
{
+ gint sc_width, sc_height;
GdkScreen *screen = gtk_widget_get_screen (self->details->widget);
- *width = gdk_screen_get_width (screen);
- *height = gdk_screen_get_height (screen);
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &sc_width, &sc_height);
+ *width = sc_width;
+ *height = sc_height;
}
else
{
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index 800fe6cd..b9d870c5 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -168,8 +168,9 @@ eel_gtk_window_set_initial_geometry (GtkWindow *window,
real_top = top;
screen = gtk_window_get_screen (window);
- screen_width = gdk_screen_get_width (screen);
- screen_height = gdk_screen_get_height (screen);
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &screen_width, &screen_height);
/* This is sub-optimal. GDK doesn't allow us to set win_gravity
* to South/East types, which should be done if using negative
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index a6064905..c37a0d1a 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -5285,6 +5285,7 @@ caja_icon_container_search_position_func (CajaIconContainer *container,
gint x, y;
gint cont_x, cont_y;
gint cont_width, cont_height;
+ gint sc_width, sc_height;
GdkWindow *cont_window;
GdkScreen *screen;
GtkRequisition requisition;
@@ -5305,11 +5306,14 @@ caja_icon_container_search_position_func (CajaIconContainer *container,
cont_width = gdk_window_get_width (cont_window);
cont_height = gdk_window_get_height (cont_window);
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &sc_width, &sc_height);
+
gtk_widget_get_preferred_size (search_dialog, &requisition, NULL);
- if (cont_x + cont_width - requisition.width > gdk_screen_get_width (screen))
+ if (cont_x + cont_width - requisition.width > sc_width)
{
- x = gdk_screen_get_width (screen) - requisition.width;
+ x = sc_width - requisition.width;
}
else if (cont_x + cont_width - requisition.width < 0)
{
@@ -5320,9 +5324,9 @@ caja_icon_container_search_position_func (CajaIconContainer *container,
x = cont_x + cont_width - requisition.width;
}
- if (cont_y + cont_height > gdk_screen_get_height (screen))
+ if (cont_y + cont_height > sc_height)
{
- y = gdk_screen_get_height (screen) - requisition.height;
+ y = sc_height - requisition.height;
}
else if (cont_y + cont_height < 0) /* isn't really possible ... */
{
@@ -6068,6 +6072,7 @@ key_press_event (GtkWidget *widget,
const char *new_text;
gboolean retval;
GdkScreen *screen;
+ gint sc_width, sc_height;
gboolean text_modified;
gulong popup_menu_id;
@@ -6085,9 +6090,13 @@ key_press_event (GtkWidget *widget,
/* Move the entry off screen */
screen = gtk_widget_get_screen (GTK_WIDGET (container));
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &sc_width, &sc_height);
+
gtk_window_move (GTK_WINDOW (container->details->search_window),
- gdk_screen_get_width (screen) + 1,
- gdk_screen_get_height (screen) + 1);
+ sc_width + 1,
+ sc_height + 1);
gtk_widget_show (container->details->search_window);
/* Send the event to the window. If the preedit_changed signal is emitted
diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c
index 0d2a9f7f..3bb72095 100644
--- a/src/caja-desktop-window.c
+++ b/src/caja-desktop-window.c
@@ -115,8 +115,8 @@ caja_desktop_window_screen_size_changed (GdkScreen *screen,
{
int width_request, height_request;
- width_request = gdk_screen_get_width (screen);
- height_request = gdk_screen_get_height (screen);
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &width_request, &height_request);
g_object_set (window,
"width_request", width_request,
@@ -131,8 +131,8 @@ caja_desktop_window_new (CajaApplication *application,
CajaDesktopWindow *window;
int width_request, height_request;
- width_request = gdk_screen_get_width (screen);
- height_request = gdk_screen_get_height (screen);
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &width_request, &height_request);
window = CAJA_DESKTOP_WINDOW
(gtk_widget_new (caja_desktop_window_get_type(),
diff --git a/src/caja-window.c b/src/caja-window.c
index 84ae7487..f820a20b 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -516,7 +516,12 @@ caja_window_zoom_to_default (CajaWindow *window)
static guint
get_max_forced_height (GdkScreen *screen)
{
- return (gdk_screen_get_height (screen) * 90) / 100;
+ gint height;
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ NULL, &height);
+
+ return (height * 90) / 100;
}
/* Code should never force the window wider than this size.
@@ -525,7 +530,12 @@ get_max_forced_height (GdkScreen *screen)
static guint
get_max_forced_width (GdkScreen *screen)
{
- return (gdk_screen_get_width (screen) * 90) / 100;
+ gint width;
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &width, NULL);
+
+ return (width * 90) / 100;
}
/* This must be called when construction of CajaWindow is finished,
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index a327ac9c..05cb59ac 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -119,8 +119,8 @@ icon_container_set_workarea (CajaIconContainer *icon_container,
left = right = top = bottom = 0;
- screen_width = gdk_screen_get_width (screen);
- screen_height = gdk_screen_get_height (screen);
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &screen_width, &screen_height);
for (i = 0; i < n_items; i += 4)
{
@@ -442,8 +442,10 @@ realized_callback (GtkWidget *widget, FMDesktopIconView *desktop_icon_view)
*/
allocation.x = 0;
allocation.y = 0;
- allocation.width = gdk_screen_get_width (screen);
- allocation.height = gdk_screen_get_height (screen);
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
+ &allocation.width, &allocation.height);
+
gtk_widget_size_allocate (GTK_WIDGET(get_icon_container(desktop_icon_view)),
&allocation);