Hi all
I think the previous mail might be a tad buggered -- the patch wasn't
included as plain text. I blame Sylpheed; fortunately Mutt's still
around to sort out the problem. Anyway, as before: desktop move/resize
grid looks a tad clunky, modified to simple window outline. Desktop
looks cleaner, code looks cleaner, my level of happiness increases ;-)
Patch against 2.5.17:
diff -Nurp fvwm-2.5.17/fvwm/move_resize.c fvwm-2.5.17-new/fvwm/move_resize.c
--- fvwm-2.5.17/fvwm/move_resize.c 2006-07-17 22:38:49.000000000 +0200
+++ fvwm-2.5.17-new/fvwm/move_resize.c 2006-08-29 00:25:50.000000000 +0200
@@ -124,60 +124,6 @@ static void draw_move_resize_grid(int x,
* height - the height of the rectangle
*
*/
-static int get_outline_rects(
- XRectangle *rects, int x, int y, int width, int height)
-{
- int i;
- int n;
- int m;
-
- n = 3;
- m = (width - 5) / 2;
- if (m < n)
- {
- n = m;
- }
- m = (height - 5) / 2;
- if (m < n)
- {
- n = m;
- }
- if (n < 1)
- {
- n = 1;
- }
-
- for (i = 0; i < n; i++)
- {
- rects[i].x = x + i;
- rects[i].y = y + i;
- rects[i].width = width - (i << 1);
- rects[i].height = height - (i << 1);
- }
- if (width - (n << 1) >= 5 && height - (n << 1) >= 5)
- {
- if (width - (n << 1) >= 10)
- {
- int off = (width - (n << 1)) / 3 + n;
- rects[i].x = x + off;
- rects[i].y = y + n;
- rects[i].width = width - (off << 1);
- rects[i].height = height - (n << 1);
- i++;
- }
- if (height - (n << 1) >= 10)
- {
- int off = (height - (n << 1)) / 3 + n;
- rects[i].x = x + n;
- rects[i].y = y + off;
- rects[i].width = width - (n << 1);
- rects[i].height = height - (off << 1);
- i++;
- }
- }
-
- return i;
-}
struct
{
@@ -194,9 +140,6 @@ struct
static void draw_move_resize_grid(int x, int y, int width, int height)
{
- int nrects = 0;
- XRectangle rects[10];
-
if (move_resize_grid.flags.is_enabled &&
x == move_resize_grid.geom.x &&
y == move_resize_grid.geom.y &&
@@ -206,21 +149,17 @@ static void draw_move_resize_grid(int x,
return;
}
- memset(rects, 0, 10 * sizeof(XRectangle));
- /* place the resize rectangle into the array of rectangles */
- /* interleave them for best visual look */
- /* draw the new one, if any */
- if (move_resize_grid.flags.is_enabled
- /*move_resize_grid.geom.width && move_resize_grid.geom.height*/)
+ /* erase old frame */
+ if (move_resize_grid.flags.is_enabled)
{
move_resize_grid.flags.is_enabled = 0;
- nrects +=
- get_outline_rects(
- &(rects[0]), move_resize_grid.geom.x,
- move_resize_grid.geom.y,
- move_resize_grid.geom.width,
- move_resize_grid.geom.height);
+ XDrawRectangle(dpy, Scr.Root, Scr.XorGC,
+ move_resize_grid.geom.x,
+ move_resize_grid.geom.y,
+ move_resize_grid.geom.width,
+ move_resize_grid.geom.height);
}
+ /* draw new frame */
if (width && height)
{
move_resize_grid.flags.is_enabled = 1;
@@ -228,14 +167,13 @@ static void draw_move_resize_grid(int x,
move_resize_grid.geom.y = y;
move_resize_grid.geom.width = width;
move_resize_grid.geom.height = height;
- nrects += get_outline_rects(
- &(rects[nrects]), x, y, width, height);
- }
- if (nrects > 0)
- {
- XDrawRectangles(dpy, Scr.Root, Scr.XorGC, rects, nrects);
- XFlush(dpy);
+ XDrawRectangle(dpy, Scr.Root, Scr.XorGC,
+ move_resize_grid.geom.x,
+ move_resize_grid.geom.y,
+ move_resize_grid.geom.width,
+ move_resize_grid.geom.height);
}
+ XFlush(dpy);
return;
}