From 3eb6ce02a5472d2ec2f533b9903924dfb8964452 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Sat, 4 May 2019 23:57:56 +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 | 77 +---------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c index c598171b..41fb6bfb 100644 --- a/src/xfdesktop-icon-view.c +++ b/src/xfdesktop-icon-view.c @@ -2615,78 +2615,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) -{ - GdkScreen *gscreen; - GdkRectangle *monitor_geoms, cell_rect; - gint nmonitors, i, row, col; - - TRACE("entering"); - - gscreen = gtk_widget_get_screen(GTK_WIDGET(icon_view)); - - nmonitors = gdk_screen_get_n_monitors(gscreen); - if(nmonitors == 1) /* optimisation */ - return; - - monitor_geoms = g_new0(GdkRectangle, nmonitors); - for(i = 0; i < nmonitors; ++i) - gdk_screen_get_monitor_geometry(gscreen, 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); - - TRACE("exiting"); -} - - static void xfdesktop_setup_grids(XfdesktopIconView *icon_view) { @@ -2757,8 +2685,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 @@ -3583,8 +3509,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