diff --git a/exo/exo-icon-view.c b/exo/exo-icon-view.c index 5b96d37..e15e174 100644 --- a/exo/exo-icon-view.c +++ b/exo/exo-icon-view.c @@ -361,7 +361,8 @@ static void exo_icon_view_set_pixbuf_column (ExoIco static void exo_icon_view_set_icon_column (ExoIconView *icon_view, gint column); -static void exo_icon_view_get_screen_dimensions (gint *width, +static void exo_icon_view_get_screen_dimensions (GdkWindow *window, + gint *width, gint *height); /* Source side drag signals */ @@ -673,7 +674,7 @@ exo_icon_view_get_accessible (GtkWidget *widget) } static void -exo_icon_view_get_screen_dimensions (gint *width, gint *height) +exo_icon_view_get_screen_dimensions (GdkWindow *window, gint *width, gint *height) { #if GTK_CHECK_VERSION(3, 22, 0) GdkDisplay *display; @@ -681,13 +682,13 @@ exo_icon_view_get_screen_dimensions (gint *width, gint *height) GdkRectangle geometry; display = gdk_display_get_default (); - monitor = gdk_display_get_primary_monitor (display); + monitor = gdk_display_get_monitor_at_window (display, window); gdk_monitor_get_geometry (monitor, &geometry); if (width != NULL) - *width = geometry.width; + *width = geometry.x + geometry.width; if (height != NULL) - *height = geometry.height; + *height = geometry.y + geometry.height; #else if (width != NULL) *width = gdk_screen_width (); @@ -697,23 +698,23 @@ exo_icon_view_get_screen_dimensions (gint *width, gint *height) } static gint -exo_icon_view_get_screen_width (void) +exo_icon_view_get_screen_width (GdkWindow *window) { gint width; gint height; - exo_icon_view_get_screen_dimensions (&width, &height); + exo_icon_view_get_screen_dimensions (window, &width, &height); return width; } static gint -exo_icon_view_get_screen_height (void) +exo_icon_view_get_screen_height (GdkWindow *window) { gint width; gint height; - exo_icon_view_get_screen_dimensions (&width, &height); + exo_icon_view_get_screen_dimensions (window, &width, &height); return height; } @@ -2948,8 +2949,8 @@ exo_icon_view_key_press_event (GtkWidget *widget, /* move the search window offscreen */ gtk_window_move (GTK_WINDOW (icon_view->priv->search_window), - exo_icon_view_get_screen_width () + 1, - exo_icon_view_get_screen_height () + 1); + exo_icon_view_get_screen_width (gtk_widget_get_window (icon_view->priv->search_entry)) + 1, + exo_icon_view_get_screen_height (gtk_widget_get_window (icon_view->priv->search_entry)) + 1); gtk_widget_show (icon_view->priv->search_window); /* allocate a new event to forward */ @@ -9293,15 +9294,15 @@ exo_icon_view_search_position_func (ExoIconView *icon_view, gtk_widget_size_request (search_dialog, &requisition); #endif - if (view_x + view_width - requisition.width > exo_icon_view_get_screen_width ()) - x = exo_icon_view_get_screen_width () - requisition.width; + if (view_x + view_width - requisition.width > exo_icon_view_get_screen_width (view_window)) + x = exo_icon_view_get_screen_width (view_window) - requisition.width; else if (view_x + view_width - requisition.width < 0) x = 0; else x = view_x + view_width - requisition.width; - if (view_y + view_height > exo_icon_view_get_screen_height ()) - y = exo_icon_view_get_screen_height () - requisition.height; + if (view_y + view_height > exo_icon_view_get_screen_height (view_window)) + y = exo_icon_view_get_screen_height (view_window) - requisition.height; else if (view_y + view_height < 0) /* isn't really possible ... */ y = 0; else