diff --git a/modules/FvwmPager/init_pager.c b/modules/FvwmPager/init_pager.c index 83d532832..260d85d58 100644 --- a/modules/FvwmPager/init_pager.c +++ b/modules/FvwmPager/init_pager.c @@ -322,9 +322,7 @@ void initialise_common_pager_fragments(void) /* Check that shape extension exists. */ if (FHaveShapeExtension && ShapeLabels) - { ShapeLabels = (FShapesSupported) ? 1 : 0; - } /* Load pixmaps for mono use */ if (Pdepth < 2) diff --git a/modules/FvwmPager/x_pager.c b/modules/FvwmPager/x_pager.c index f96e16d4c..f85b24534 100644 --- a/modules/FvwmPager/x_pager.c +++ b/modules/FvwmPager/x_pager.c @@ -345,58 +345,50 @@ void set_desk_size(bool update_label) void UpdateWindowShape(void) { - if (FHaveShapeExtension) - { - int i, j, cnt, shape_count, x_pos, y_pos; - XRectangle *shape; - struct fpmonitor *fp = fpmonitor_this(NULL); - - if (!fp || !ShapeLabels || label_h == 0) - return; - - shape_count = - ndesks + ((fp->m->virtual_scr.CurrentDesk < desk1 || fp->m->virtual_scr.CurrentDesk >desk2) ? 0 : 1); - - shape = fxmalloc(shape_count * sizeof (XRectangle)); - - cnt = 0; - y_pos = (LabelsBelow ? 0 : label_h); + if (!ShapeLabels || label_h == 0 || fAlwaysCurrentDesk) + return; - for (i = 0; i < Rows; ++i) - { - x_pos = 0; - for (j = 0; j < Columns; ++j) - { - if (cnt < ndesks) - { - shape[cnt].x = x_pos; - shape[cnt].y = y_pos; - shape[cnt].width = desk_w + 1; - shape[cnt].height = desk_h + 2; + int i, j, cnt, x_pos, y_pos; + XRectangle *shape; + struct fpmonitor *fp; + shape = fxmalloc(ndesks * sizeof (XRectangle)); + + cnt = 0; + y_pos = (LabelsBelow) ? 0 : label_h; + for (i = 0; i < Rows; i++) { + x_pos = 0; + for (j = 0; j < Columns; j++) { + if (cnt >= ndesks) + continue; - if (cnt == fp->m->virtual_scr.CurrentDesk - desk1) - { - shape[ndesks].x = x_pos; - shape[ndesks].y = - (LabelsBelow ? y_pos + desk_h + 2 : y_pos - label_h); - shape[ndesks].width = desk_w; - shape[ndesks].height = label_h + 2; - } + /* Default shape/hide labels. */ + shape[cnt].x = x_pos; + shape[cnt].y = y_pos; + shape[cnt].width = desk_w + 1; + shape[cnt].height = desk_h + 2; + + /* Show labels for active monitors. */ + TAILQ_FOREACH(fp, &fp_monitor_q, entry) { + if (fp->disabled || + (monitor_to_track != NULL && + monitor_to_track != fp) || + cnt + desk1 != + fp->m->virtual_scr.CurrentDesk) + continue; + + shape[cnt].y -= (LabelsBelow) ? 0 : label_h; + shape[cnt].height += label_h; + } + cnt++; + x_pos += desk_w + 1; + } + y_pos += desk_h + 2 + label_h; } - ++cnt; - x_pos += desk_w + 1; - } - y_pos += desk_h + 2 + label_h; - } - - FShapeCombineRectangles( - dpy, Scr.pager_w, FShapeBounding, 0, 0, shape, shape_count, FShapeSet, 0); - free(shape); - } + FShapeCombineRectangles(dpy, Scr.pager_w, FShapeBounding, + 0, 0, shape, cnt, FShapeSet, 0); + free(shape); } - - /* * * Decide what to do about received X events