From aae5938e97496793c6ba950454eae7705fa75c0f Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Wed, 6 May 2020 08:32:26 +0200 Subject: [PATCH] Fix technical/shapewin move mode with window groups The technical etc. move modes using a shaped window ("avoid server grab" mode) only properly shaped the shape window of the first group member. Broken since 0c16916258bde5de8874b96f6539be6e6b2ab2cf - v1.0.12. This commit changed the mode of operation from one shape window in total to one per group member, i.e. shapes should no longer be combined. ..and drop useless fl variable in _MoveResizeMoveResume(). --- src/draw.c | 11 +++++------ src/ewins.h | 4 ++-- src/moveresize.c | 26 +++++++++++--------------- src/shapewin.c | 15 +++++---------- src/shapewin.h | 5 ++--- src/slide.c | 6 +++--- src/warp.c | 4 ++-- 7 files changed, 30 insertions(+), 41 deletions(-) diff --git a/src/draw.c b/src/draw.c index 5b1cff73..56ddf920 100644 --- a/src/draw.c +++ b/src/draw.c @@ -129,7 +129,7 @@ typedef struct { static void _ShapeDrawNograb_tech_box(EWin * ewin, int md, int firstlast, - int xn, int yn, int wn, int hn, int seqno) + int xn, int yn, int wn, int hn) { ShapeData *psd = (ShapeData *) ewin->shape_data; @@ -138,8 +138,8 @@ _ShapeDrawNograb_tech_box(EWin * ewin, int md, int firstlast, if (!psd->shwin) return; - ShapewinShapeSet(psd->shwin, md, xn, yn, wn, hn, psd->bl, psd->br, psd->bt, - psd->bb, seqno); + ShapewinShapeSet(psd->shwin, md, xn, yn, wn, hn, + psd->bl, psd->br, psd->bt, psd->bb); EoMap(psd->shwin, 0); CoordsShow(ewin); @@ -201,8 +201,7 @@ _ShapeDrawNontranslucent(EWin * ewin, int md, int firstlast, } void -DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, - int firstlast, int seqno) +DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, int firstlast) { ShapeData *psd; int dx, dy; @@ -262,7 +261,7 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, if (((md <= MR_BOX) || (md == MR_TECH_OPAQUE)) && Conf.movres.avoid_server_grab) { - _ShapeDrawNograb_tech_box(ewin, md, firstlast, x, y, w, h, seqno); + _ShapeDrawNograb_tech_box(ewin, md, firstlast, x, y, w, h); goto done; } diff --git a/src/ewins.h b/src/ewins.h index 897256ac..3bc8f0f8 100644 --- a/src/ewins.h +++ b/src/ewins.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2019 Kim Woelders + * Copyright (C) 2004-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -343,7 +343,7 @@ void DockIt(EWin * ewin); /* draw.c */ void DrawEwinShape(EWin * ewin, int md, int x, int y, int w, - int h, int firstlast, int seqno); + int h, int firstlast); void DrawEwinShapeEnd(EWin * ewin); int DrawEwinShapeNeedsGrab(int mode); diff --git a/src/moveresize.c b/src/moveresize.c index 0d74d0d0..1aa0659c 100644 --- a/src/moveresize.c +++ b/src/moveresize.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2015 Kim Woelders + * Copyright (C) 2004-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -163,7 +163,7 @@ _MoveResizeMoveEnd(EWin * ewin) for (i = 0; i < num; i++) DrawEwinShape(gwins[i], Mode_mr.mode, gwins[i]->shape_x, gwins[i]->shape_y, - gwins[i]->client.w, gwins[i]->client.h, 2, i); + gwins[i]->client.w, gwins[i]->client.h, 2); } Mode.mode = MODE_NONE; @@ -226,7 +226,7 @@ _MoveResizeMoveSuspend(void) { ewin = lst[i]; DrawEwinShape(ewin, Mode_mr.mode, ewin->shape_x, - ewin->shape_y, ewin->client.w, ewin->client.h, 3, i); + ewin->shape_y, ewin->client.w, ewin->client.h, 3); } Efree(lst); @@ -239,7 +239,7 @@ _MoveResizeMoveResume(void) { EWin *ewin, **lst; int i, num; - int x, y, fl, dx, dy; + int x, y, dx, dy; ewin = Mode_mr.ewin; if (!ewin) @@ -247,12 +247,8 @@ _MoveResizeMoveResume(void) GrabPointerSet(Mode_mr.events, ECSR_ACT_MOVE, 1); - fl = 0; if (Mode.mode == MODE_MOVE_PENDING) - { - Mode.mode = MODE_MOVE; - fl = 0; /* This is the first time we draw it */ - } + Mode.mode = MODE_MOVE; if (Mode_mr.grab_server) EGrabServer(); @@ -275,7 +271,7 @@ _MoveResizeMoveResume(void) x = ewin->shape_x + dx; y = ewin->shape_y + dy; DrawEwinShape(ewin, Mode_mr.mode, x, y, - ewin->client.w, ewin->client.h, fl, i); + ewin->client.w, ewin->client.h, 0); } Efree(lst); } @@ -427,7 +423,7 @@ MoveResizeResizeStart(EWin * ewin, int kbd, int hv) EwinShapeSet(ewin); ewin->state.show_coords = 1; DrawEwinShape(ewin, Conf.movres.mode_resize, EoGetX(ewin), EoGetY(ewin), - ewin->client.w, ewin->client.h, 0, 0); + ewin->client.w, ewin->client.h, 0); } static void @@ -449,7 +445,7 @@ _MoveResizeResizeEnd(EWin * ewin) ewin->state.show_coords = 0; DrawEwinShape(ewin, Conf.movres.mode_resize, ewin->shape_x, ewin->shape_y, - ewin->shape_w, ewin->shape_h, 2, 0); + ewin->shape_w, ewin->shape_h, 2); if ((Mode_mr.mode == MR_OPAQUE) || (Mode_mr.mode == MR_TECH_OPAQUE)) { @@ -513,7 +509,7 @@ _MoveResizeMoveHandleMotion(void) { ewin1 = gwins[i]; DrawEwinShape(ewin1, Mode_mr.mode, EoGetX(ewin1), EoGetY(ewin1), - ewin1->client.w, ewin1->client.h, 0, i); + ewin1->client.w, ewin1->client.h, 0); if (Conf.movres.mode_move == MR_OPAQUE) Mode_mr.mode = MR_OPAQUE; } @@ -649,7 +645,7 @@ _MoveResizeMoveHandleMotion(void) /* draw the new position of the window */ DrawEwinShape(ewin1, Mode_mr.mode, ewin1->shape_x + ndx, ewin1->shape_y + ndy, - ewin1->client.w, ewin1->client.h, 1, i); + ewin1->client.w, ewin1->client.h, 1); /* if we didnt jump the window after a resist at the edge */ /* reset the requested x to be the prev. requested + delta */ @@ -753,7 +749,7 @@ _MoveResizeResizeHandleMotion(void) break; } - DrawEwinShape(ewin, Conf.movres.mode_resize, x, y, w, h, 1, 0); + DrawEwinShape(ewin, Conf.movres.mode_resize, x, y, w, h, 1); } static void diff --git a/src/shapewin.c b/src/shapewin.c index bd45b690..0dcfe0bb 100644 --- a/src/shapewin.c +++ b/src/shapewin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 Kim Woelders + * Copyright (C) 2007-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -109,7 +109,7 @@ ShapewinCreate(int md) void ShapewinShapeSet(ShapeWin * sw, int md, int x, int y, int w, int h, - int bl, int br, int bt, int bb, int seqno) + int bl, int br, int bt, int bb) { int w2, h2; @@ -123,10 +123,8 @@ ShapewinShapeSet(ShapeWin * sw, int md, int x, int y, int w, int h, 0, 0, WinGetW(VROOT), WinGetH(VROOT)); XSetForeground(disp, sw->gc, 1); do_draw_technical(sw->mask, sw->gc, x, y, w, h, bl, br, bt, bb); - if (seqno == 0) - EShapeSetMask(EoGetWin(sw), 0, 0, sw->mask); - else - EShapeUnionMask(EoGetWin(sw), 0, 0, sw->mask); + + EShapeSetMask(EoGetWin(sw), 0, 0, sw->mask); } else { @@ -137,10 +135,7 @@ ShapewinShapeSet(ShapeWin * sw, int md, int x, int y, int w, int h, h = (h > 5) ? h - 2 : 3; _SHAPE_SET_RECT((&rl[4]), x + bl + 1, y + bt + 1, w, h); - if (seqno == 0) - EShapeSetRects(EoGetWin(sw), 0, 0, rl, 8); - else - EShapeUnionRects(EoGetWin(sw), 0, 0, rl, 8); + EShapeSetRects(EoGetWin(sw), 0, 0, rl, 8); } EoShapeUpdate(sw, 0); } diff --git a/src/shapewin.h b/src/shapewin.h index 4d64c1b2..a08956ed 100644 --- a/src/shapewin.h +++ b/src/shapewin.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Kim Woelders + * Copyright (C) 2014-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -38,8 +38,7 @@ struct _ShapeWin { ShapeWin *ShapewinCreate(int md); void ShapewinDestroy(ShapeWin * sw); void ShapewinShapeSet(ShapeWin * sw, int md, int x, int y, int w, - int h, int bl, int br, int bt, int bb, - int seqno); + int h, int bl, int br, int bt, int bb); void do_draw_technical(EX_Drawable dr, GC gc, int a, int b, int c, int d, int bl, diff --git a/src/slide.c b/src/slide.c index a12514f5..4e6c5cbb 100644 --- a/src/slide.c +++ b/src/slide.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2017 Kim Woelders + * Copyright (C) 2013-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -102,7 +102,7 @@ _EwinSlideSizeTo(EObj * eo, int remaining, void *state) if (p->mode == MR_OPAQUE) EwinMoveResize(ewin, x, y, w, h, MRF_KEEP_MAXIMIZED); else - DrawEwinShape(ewin, p->mode, x, y, w, h, p->firstlast, 0); + DrawEwinShape(ewin, p->mode, x, y, w, h, p->firstlast); if (p->firstlast == 0) p->firstlast = 1; @@ -111,7 +111,7 @@ _EwinSlideSizeTo(EObj * eo, int remaining, void *state) ewin->state.sliding = 0; if (p->mode != MR_OPAQUE) DrawEwinShape(ewin, p->mode, p->tx, p->ty, - ewin->client.w, ewin->client.h, 2, 0); + ewin->client.w, ewin->client.h, 2); EwinMove(ewin, p->tx, p->ty, MRF_NOCHECK_ONSCREEN | MRF_KEEP_MAXIMIZED); if (p->flags & SLIDE_WARP) { diff --git a/src/warp.c b/src/warp.c index 09f00e81..42789400 100644 --- a/src/warp.c +++ b/src/warp.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2018 Kim Woelders + * Copyright (C) 2004-2020 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -70,7 +70,7 @@ WarpShapeDraw(EWin * ewin) EwinBorderGetSize(ewin, &bl, &br, &bt, &bb); ShapewinShapeSet(shape_win, MR_BOX, EoGetX(ewin), EoGetY(ewin), - ewin->client.w, ewin->client.h, bl, br, bt, bb, 0); + ewin->client.w, ewin->client.h, bl, br, bt, bb); EoMap(shape_win, 0); }