From 95401a6c8f9f10c17f30389a82ee1845d4f1ce2a Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Sat, 4 May 2019 23:47:48 +0200 Subject: [PATCH] Desktop icon grid does not resize appropriately to monitor resolution (Bug #7508) Removed xinerama check method: Purging desktop items when outside monitor boundery is wrong since currently we only have one huge working area (one huge icon view), possibly bigger than one monitor On top xinerama check was calculating wrong. It even removed icons when inside monitor boundery. --- src/xfdesktop-icon-view.c | 79 +---------------------------------------------- 1 file changed, 1 insertion(+), 78 deletions(-) diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c index 66236613..1cf40546 100644 --- a/src/xfdesktop-icon-view.c +++ b/src/xfdesktop-icon-view.c @@ -2540,80 +2540,6 @@ xfdesktop_icon_view_repaint_icons(XfdesktopIconView *icon_view, } } -static inline gboolean -xfdesktop_rectangle_equal(GdkRectangle *rect1, GdkRectangle *rect2) -{ - return (rect1->x == rect2->x && rect1->y == rect2->y - && rect1->width == rect2->width && rect1->height == rect2->height); -} - -static inline gboolean -xfdesktop_rectangle_is_bounded_by(GdkRectangle *rect, - GdkRectangle *bounds) -{ - GdkRectangle intersection; - - if(gdk_rectangle_intersect(rect, bounds, &intersection)) { - if(xfdesktop_rectangle_equal(rect, &intersection)) - return TRUE; - } - - return FALSE; -} - -/* FIXME: add a cache for this so we don't have to compute this EVERY time */ -static void -xfdesktop_icon_view_setup_grids_xinerama(XfdesktopIconView *icon_view) -{ - GdkDisplay *display; - GdkRectangle *monitor_geoms, cell_rect; - gint nmonitors, i, row, col; - - DBG("entering"); - - display = gtk_widget_get_display(GTK_WIDGET(icon_view)); - nmonitors = gdk_display_get_n_monitors(display); - - if(nmonitors == 1) /* optimisation */ - return; - - monitor_geoms = g_new0(GdkRectangle, nmonitors); - - for(i = 0; i < nmonitors; ++i) { - gdk_monitor_get_geometry(gdk_display_get_monitor(display, i), &monitor_geoms[i]); - } - - /* cubic time; w00t! */ - cell_rect.width = cell_rect.height = CELL_SIZE; - for(row = 0; row < icon_view->priv->nrows; ++row) { - for(col = 0; col < icon_view->priv->ncols; ++col) { - gboolean bounded = FALSE; - - cell_rect.x = icon_view->priv->xorigin + icon_view->priv->xmargin + col * CELL_SIZE + col * icon_view->priv->xspacing; - cell_rect.y = icon_view->priv->yorigin + icon_view->priv->ymargin + row * CELL_SIZE + row * icon_view->priv->yspacing; - - for(i = 0; i < nmonitors; ++i) { - if(xfdesktop_rectangle_is_bounded_by(&cell_rect, - &monitor_geoms[i])) - { - bounded = TRUE; - break; - } - } - - if(!bounded) { - xfdesktop_grid_unset_position_free_raw(icon_view, row, col, - (gpointer)0xdeadbeef); - } - } - } - - g_free(monitor_geoms); - - DBG("exiting"); -} - - static void xfdesktop_setup_grids(XfdesktopIconView *icon_view) { @@ -2697,8 +2623,6 @@ xfdesktop_setup_grids(XfdesktopIconView *icon_view) XF_DEBUG("created grid_layout with %lu positions", (gulong)(new_size/sizeof(gpointer))); DUMP_GRID_LAYOUT(icon_view); - - xfdesktop_icon_view_setup_grids_xinerama(icon_view); } static GdkFilterReturn @@ -3459,8 +3383,7 @@ xfdesktop_grid_is_free_position(XfdesktopIconView *icon_view, { return FALSE; } - - return !icon_view->priv->grid_layout[col * icon_view->priv->nrows + row]; + return TRUE; } -- 2.11.0