From 2fea2c846689d3810def93e6e0e6eeb01c2ef718 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Mon, 4 Dec 2017 01:01:52 +0100 Subject: WidthOfScreen and HeightOfScreen implementation This commit reverts: https://github.com/mate-desktop/caja/commit/4c130e22b98bbc1a85747adac3b582e45d34514e https://github.com/mate-desktop/caja/commit/ac12e6d16f4a51b3327d013781e72cfec17f3624 https://github.com/mate-desktop/caja/commit/17b3c0ca924ffcd4bd06fded98227eba626d4f0b https://github.com/mate-desktop/caja/commit/42c8d2c3373c25d6e321be6950997c0d7ce44279 And it applies an alternative to fix the deprecated functions: gdk_screen_get_width gdk_screen_get_height gdk_screen_width gdk_screen_height --- libcaja-private/caja-icon-container.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'libcaja-private') diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index c7943964..59e8ab83 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -326,7 +326,6 @@ icon_set_position (CajaIcon *icon, int item_width, item_height; int height_above, width_left; int min_x, max_x, min_y, max_y; - int sc_width, sc_height; if (icon->x == x && icon->y == y) { @@ -355,16 +354,12 @@ icon_set_position (CajaIcon *icon, For now, we have a cheesy workaround: */ - - gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), - NULL, NULL, &sc_width, &sc_height); - container_x = 0; container_y = 0; - container_width = sc_width - container_x + container_width = WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) - container_x - container->details->left_margin - container->details->right_margin; - container_height = sc_height - container_y + container_height = HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) - container_y - container->details->top_margin - container->details->bottom_margin; pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit; @@ -5290,7 +5285,6 @@ 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; @@ -5321,14 +5315,11 @@ 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 > sc_width) + if (cont_x + cont_width - requisition.width > WidthOfScreen (gdk_x11_screen_get_xscreen (screen))) { - x = sc_width - requisition.width; + x = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) - requisition.width; } else if (cont_x + cont_width - requisition.width < 0) { @@ -5339,9 +5330,9 @@ caja_icon_container_search_position_func (CajaIconContainer *container, x = cont_x + cont_width - requisition.width; } - if (cont_y + cont_height > sc_height) + if (cont_y + cont_height > HeightOfScreen (gdk_x11_screen_get_xscreen (screen))) { - y = sc_height - requisition.height; + y = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) - requisition.height; } else if (cont_y + cont_height < 0) /* isn't really possible ... */ { @@ -6087,7 +6078,6 @@ 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; @@ -6105,13 +6095,9 @@ 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), - sc_width + 1, - sc_height + 1); + WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) + 1, + HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) + 1); gtk_widget_show (container->details->search_window); /* Send the event to the window. If the preedit_changed signal is emitted -- cgit v1.2.1