updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / fvwm+ / 03-ResizeOutlineThin.patch
blob54cdc4a2d2b24a39cbab175576c51743b491735a
1 diff -U10 -r fvwm/fvwm.h fvwm/fvwm.h
2 --- fvwm/fvwm.h 2011-12-09 18:29:08.008461188 +0100
3 +++ fvwm/fvwm.h 2011-12-09 18:38:57.683444407 +0100
4 @@ -218,20 +218,21 @@
5 unsigned do_ewmh_ignore_window_type : 1;
6 unsigned do_iconify_window_groups : 1;
7 unsigned do_ignore_gnome_hints : 1;
8 unsigned do_ignore_icon_boxes : 1;
9 unsigned do_ignore_restack : 1;
10 unsigned do_use_window_group_hint : 1;
11 unsigned do_lower_transient : 1;
12 unsigned do_not_show_on_map : 1;
13 unsigned do_raise_transient : 1;
14 unsigned do_resize_opaque : 1;
15 + unsigned do_resize_outline_thin : 1;
16 unsigned do_shrink_windowshade : 1;
17 unsigned do_stack_transient_parent : 1;
18 unsigned do_window_list_skip : 1;
19 unsigned ewmh_maximize_mode : 2; /* see ewmh.h */
20 unsigned has_depressable_border : 1;
21 unsigned has_mwm_border : 1;
22 unsigned has_mwm_buttons : 1;
23 unsigned has_mwm_override : 1;
24 unsigned has_no_icon_title : 1;
25 unsigned has_override_size : 1;
26 diff -U10 -r fvwm/move_resize.c fvwm/move_resize.c
27 --- fvwm/move_resize.c 2011-08-28 02:28:04.000000000 +0200
28 +++ fvwm/move_resize.c 2011-12-09 18:44:06.335552790 +0100
29 @@ -101,179 +101,195 @@
30 /* ----- end of move globals ----- */
32 /* ----- resize globals ----- */
34 /* DO NOT USE (STATIC) GLOBALS IN THIS MODULE!
35 * Since some functions are called from other modules unwanted side effects
36 * (i.e. bugs.) would be created */
38 extern Window PressedW;
40 -static void draw_move_resize_grid(int x, int y, int width, int height);
41 +static void draw_move_resize_grid(int x, int y, int width, int height, Bool thin);
43 /* ----- end of resize globals ----- */
47 * Procedure:
48 * draw_move_resize_grid - move a window outline
50 * Inputs:
51 * root - the window we are outlining
52 * x - upper left x coordinate
53 * y - upper left y coordinate
54 * width - the width of the rectangle
55 * height - the height of the rectangle
58 static int get_outline_rects(
59 - XRectangle *rects, int x, int y, int width, int height)
60 + XRectangle *rects, int x, int y, int width, int height, Bool do_outline_thin)
62 int i;
63 int n;
64 int m;
66 - n = 3;
67 - m = (width - 5) / 2;
68 - if (m < n)
69 + if (do_outline_thin)
71 - n = m;
72 - }
73 - m = (height - 5) / 2;
74 - if (m < n)
75 - {
76 - n = m;
77 + n = 1;
79 - if (n < 1)
80 + else
82 - n = 1;
83 + n = 3;
84 + m = (width - 5) / 2;
85 + if (m < n)
86 + {
87 + n = m;
88 + }
89 + m = (height - 5) / 2;
90 + if (m < n)
91 + {
92 + n = m;
93 + }
94 + if (n < 1)
95 + {
96 + n = 1;
97 + }
100 for (i = 0; i < n; i++)
102 rects[i].x = x + i;
103 rects[i].y = y + i;
104 rects[i].width = width - (i << 1);
105 rects[i].height = height - (i << 1);
107 - if (width - (n << 1) >= 5 && height - (n << 1) >= 5)
108 + if (!do_outline_thin)
110 - if (width - (n << 1) >= 10)
111 + if (width - (n << 1) >= 5 && height - (n << 1) >= 5)
113 - int off = (width - (n << 1)) / 3 + n;
114 - rects[i].x = x + off;
115 - rects[i].y = y + n;
116 - rects[i].width = width - (off << 1);
117 - rects[i].height = height - (n << 1);
118 - i++;
120 - if (height - (n << 1) >= 10)
122 - int off = (height - (n << 1)) / 3 + n;
123 - rects[i].x = x + n;
124 - rects[i].y = y + off;
125 - rects[i].width = width - (n << 1);
126 - rects[i].height = height - (off << 1);
127 - i++;
128 + if (width - (n << 1) >= 10)
130 + int off = (width - (n << 1)) / 3 + n;
131 + rects[i].x = x + off;
132 + rects[i].y = y + n;
133 + rects[i].width = width - (off << 1);
134 + rects[i].height = height - (n << 1);
135 + i++;
137 + if (height - (n << 1) >= 10)
139 + int off = (height - (n << 1)) / 3 + n;
140 + rects[i].x = x + n;
141 + rects[i].y = y + off;
142 + rects[i].width = width - (n << 1);
143 + rects[i].height = height - (off << 1);
144 + i++;
149 return i;
152 struct
154 rectangle geom;
155 struct
157 unsigned is_enabled : 1;
158 + unsigned do_outline_thin : 1;
159 } flags;
160 } move_resize_grid =
162 { 0, 0, 0, 0 },
163 - { 0 }
164 + { 0, 0 }
167 -static void draw_move_resize_grid(int x, int y, int width, int height)
168 +static void draw_move_resize_grid(int x, int y, int width, int height, Bool do_outline_thin)
170 int nrects = 0;
171 XRectangle rects[10];
173 if (move_resize_grid.flags.is_enabled &&
174 x == move_resize_grid.geom.x &&
175 y == move_resize_grid.geom.y &&
176 width == move_resize_grid.geom.width &&
177 - height == move_resize_grid.geom.height)
178 + height == move_resize_grid.geom.height &&
179 + do_outline_thin == move_resize_grid.flags.do_outline_thin)
181 return;
184 memset(rects, 0, 10 * sizeof(XRectangle));
185 /* place the resize rectangle into the array of rectangles */
186 /* interleave them for best visual look */
187 /* draw the new one, if any */
188 if (move_resize_grid.flags.is_enabled
189 /*move_resize_grid.geom.width && move_resize_grid.geom.height*/)
191 move_resize_grid.flags.is_enabled = 0;
192 nrects +=
193 get_outline_rects(
194 &(rects[0]), move_resize_grid.geom.x,
195 move_resize_grid.geom.y,
196 move_resize_grid.geom.width,
197 - move_resize_grid.geom.height);
198 + move_resize_grid.geom.height,
199 + move_resize_grid.flags.do_outline_thin);
201 if (width && height)
203 move_resize_grid.flags.is_enabled = 1;
204 move_resize_grid.geom.x = x;
205 move_resize_grid.geom.y = y;
206 move_resize_grid.geom.width = width;
207 move_resize_grid.geom.height = height;
208 + move_resize_grid.flags.do_outline_thin = do_outline_thin;
209 nrects += get_outline_rects(
210 - &(rects[nrects]), x, y, width, height);
211 + &(rects[nrects]), x, y, width, height, do_outline_thin);
213 if (nrects > 0)
215 XDrawRectangles(dpy, Scr.Root, Scr.XorGC, rects, nrects);
216 XFlush(dpy);
219 return;
222 void switch_move_resize_grid(Bool state)
224 if (state == False)
226 if (move_resize_grid.flags.is_enabled)
228 - draw_move_resize_grid(0, 0, 0, 0);
229 + draw_move_resize_grid(0, 0, 0, 0, 0);
231 else
233 move_resize_grid.geom.x = 0;
234 move_resize_grid.geom.y = 0;
235 move_resize_grid.geom.width = 0;
236 - move_resize_grid.geom.height = 0;
237 + move_resize_grid.geom.height = 0;
238 + move_resize_grid.flags.do_outline_thin = 0;
241 else if (!move_resize_grid.flags.is_enabled)
243 if (move_resize_grid.geom.width &&
244 move_resize_grid.geom.height)
246 draw_move_resize_grid(
247 move_resize_grid.geom.x,
248 move_resize_grid.geom.y,
249 move_resize_grid.geom.width,
250 - move_resize_grid.geom.height);
251 + move_resize_grid.geom.height,
252 + move_resize_grid.flags.do_outline_thin);
256 return;
259 static int ParsePositionArgumentSuffix(
260 float *ret_factor, char *suffix, float wfactor, float sfactor)
262 int n;
263 @@ -2362,20 +2378,21 @@
264 int orig_icon_x = 0;
265 int orig_icon_y = 0;
266 Bool do_snap = True;
267 Bool was_snapped = False;
268 /* if Alt is initially pressed don't enable no-snap until Alt is
269 * released */
270 Bool nosnap_enabled = False;
271 /* Must not set placed by button if the event is a modified KeyEvent */
272 Bool is_fake_event;
273 FvwmWindow *fw = exc->w.fw;
274 + Bool do_outline_thin = DO_RESIZE_OUTLINE_THIN(fw);
275 unsigned int draw_parts = PART_NONE;
276 XEvent e;
278 if (!GrabEm(cursor, GRAB_NORMAL))
280 XBell(dpy, 0);
281 return False;
283 if (!IS_MAPPED(fw) && !IS_ICONIFIED(fw))
285 @@ -2435,21 +2452,21 @@
286 yt += YOffset;
288 button_mask &= DEFAULT_ALL_BUTTONS_MASK;
289 xl_orig = xl;
290 yt_orig = yt;
292 /* draw initial outline */
293 if (!IS_ICONIFIED(fw) &&
294 ((!do_move_opaque && !Scr.gs.do_emulate_mwm) || !IS_MAPPED(fw)))
296 - draw_move_resize_grid(xl, yt, Width - 1, Height - 1);
297 + draw_move_resize_grid(xl, yt, Width - 1, Height - 1, do_outline_thin);
300 if (move_w == FW_W_FRAME(fw) && do_move_opaque)
302 draw_parts = border_get_transparent_decorations_part(fw);
304 DisplayPosition(fw, exc->x.elast, xl, yt, True);
306 memset(&e, 0, sizeof(e));
308 @@ -2765,21 +2782,21 @@
311 /* check Paging request once and only once after
312 * outline redrawn redraw after paging if needed
313 * - mab */
314 for (paged = 0; paged <= 1; paged++)
316 if (!do_move_opaque)
318 draw_move_resize_grid(
319 - xl, yt, Width - 1, Height - 1);
320 + xl, yt, Width - 1, Height - 1, do_outline_thin);
322 else
324 if (IS_ICONIFIED(fw))
326 set_icon_position(fw, xl, yt);
327 move_icon_to_position(fw);
328 broadcast_icon_geometry(
329 fw, False);
331 @@ -2837,21 +2854,21 @@
332 if (!do_move_opaque)
334 /* must undraw the rubber band in case the
335 * event causes some drawing */
336 switch_move_resize_grid(False);
338 dispatch_event(&e);
339 if (!do_move_opaque)
341 draw_move_resize_grid(
342 - xl, yt, Width - 1, Height - 1);
343 + xl, yt, Width - 1, Height - 1, do_outline_thin);
345 break;
347 default:
348 /* cannot happen */
349 break;
350 } /* switch */
351 xl += x_virtual_offset;
352 yt += y_virtual_offset;
353 if (do_move_opaque && !IS_ICONIFIED(fw) &&
354 @@ -3459,21 +3476,21 @@
355 * y_off - y offset of pointer from border (input/output)
356 * drag - resize internal structure
357 * orig - resize internal structure
358 * xmotionp - pointer to xmotion in resize_window
359 * ymotionp - pointer to ymotion in resize_window
362 static void __resize_step(
363 const exec_context_t *exc, int x_root, int y_root, int *x_off,
364 int *y_off, rectangle *drag, const rectangle *orig, int *xmotionp,
365 - int *ymotionp, Bool do_resize_opaque, Bool is_direction_fixed)
366 + int *ymotionp, Bool do_resize_opaque, Bool is_direction_fixed, Bool do_outline_thin)
368 int action = 0;
369 int x2;
370 int y2;
371 int xdir;
372 int ydir;
374 x2 = x_root - *x_off;
375 x_root += *x_off;
376 if (is_direction_fixed == True && (*xmotionp != 0 || *ymotionp != 0))
377 @@ -3581,21 +3598,21 @@
378 drag->x = orig->x + orig->width - drag->width;
380 if (*ymotionp == 1)
382 drag->y = orig->y + orig->height - drag->height;
384 if (!do_resize_opaque)
386 draw_move_resize_grid(
387 drag->x, drag->y, drag->width - 1,
388 - drag->height - 1);
389 + drag->height - 1, do_outline_thin);
391 else
393 frame_setup_window(
394 exc->w.fw, drag->x, drag->y, drag->width,
395 drag->height, False);
398 DisplaySize(exc->w.fw, exc->x.elast, drag->width, drag->height, False, False);
400 @@ -3640,20 +3657,21 @@
401 int i;
402 size_borders b;
403 frame_move_resize_args mr_args = NULL;
404 long evmask;
405 XEvent ev;
406 int ref_x;
407 int ref_y;
408 int x_off;
409 int y_off;
410 direction_t dir;
411 + Bool do_outline_thin = DO_RESIZE_OUTLINE_THIN(fw);
412 int warp_x = 0;
413 int warp_y = 0;
415 bad_window = False;
416 ResizeWindow = FW_W_FRAME(fw);
417 if (fev_get_evpos_or_query(dpy, Scr.Root, exc->x.etrigger, &px, &py) ==
418 False ||
419 XTranslateCoordinates(
420 dpy, Scr.Root, ResizeWindow, px, py, &px, &py,
421 &JunkChild) == False)
422 @@ -3963,42 +3981,42 @@
423 else
425 /* wait until the pointer hits a border before making a
426 * decision about the resize direction */
429 /* draw the rubber-band window */
430 if (!do_resize_opaque)
432 draw_move_resize_grid(
433 - drag->x, drag->y, drag->width - 1, drag->height - 1);
434 + drag->x, drag->y, drag->width - 1, drag->height - 1, do_outline_thin);
436 /* kick off resizing without requiring any motion if invoked with a key
437 * press */
438 if (exc->x.elast->type == KeyPress)
440 int xo;
441 int yo;
443 if (FQueryPointer(
444 dpy, Scr.Root, &JunkRoot, &JunkChild, &stashed_x,
445 &stashed_y, &JunkX, &JunkY, &JunkMask) == False)
447 /* pointer is on a different screen */
448 stashed_x = 0;
449 stashed_y = 0;
451 xo = 0;
452 yo = 0;
453 __resize_step(
454 exc, stashed_x, stashed_y, &xo, &yo, drag, orig,
455 - &xmotion, &ymotion, do_resize_opaque, True);
456 + &xmotion, &ymotion, do_resize_opaque, True, do_outline_thin);
458 else
460 stashed_x = stashed_y = -1;
463 /* loop to resize */
464 memset(&ev, 0, sizeof(ev));
465 while (!is_finished && bad_window != FW_W(fw))
467 @@ -4145,39 +4163,39 @@
469 if (!fForceRedraw)
471 x = ev.xmotion.x_root;
472 y = ev.xmotion.y_root;
473 /* resize before paging request to prevent
474 * resize from lagging * mouse - mab */
475 __resize_step(
476 exc, x, y, &x_off, &y_off, drag, orig,
477 &xmotion, &ymotion, do_resize_opaque,
478 - is_direction_fixed);
479 + is_direction_fixed, do_outline_thin);
480 /* need to move the viewport */
481 HandlePaging(
482 &ev, dx, dy, &x, &y, &delta_x,
483 &delta_y, False, False, False,
484 fw->edge_delay_ms_resize);
486 /* redraw outline if we paged - mab */
487 if (delta_x != 0 || delta_y != 0)
489 sorig.x -= delta_x;
490 sorig.y -= delta_y;
491 drag->x -= delta_x;
492 drag->y -= delta_y;
494 __resize_step(
495 exc, x, y, &x_off, &y_off, drag, orig,
496 &xmotion, &ymotion, do_resize_opaque,
497 - is_direction_fixed);
498 + is_direction_fixed, do_outline_thin);
500 fForceRedraw = False;
501 is_done = True;
502 break;
504 case PropertyNotify:
506 evh_args_t ea;
507 exec_context_changes_t ecc;
509 @@ -4198,21 +4216,21 @@
511 /* must undraw the rubber band in case the
512 * event causes some drawing */
513 switch_move_resize_grid(False);
515 dispatch_event(&ev);
516 if (!do_resize_opaque)
518 draw_move_resize_grid(
519 drag->x, drag->y, drag->width - 1,
520 - drag->height - 1);
521 + drag->height - 1, do_outline_thin);
524 else
526 if (do_resize_opaque)
528 /* only do this with opaque resizes, (i.e. the
529 * server is not grabbed) */
530 BroadcastConfig(M_CONFIGURE_WINDOW, fw);
531 FlushAllMessageQueues();
532 @@ -4251,21 +4269,21 @@
533 int yo;
534 rectangle g;
536 xo = 0;
537 yo = 0;
538 xmotion = 1;
539 ymotion = 1;
540 g = sorig;
541 __resize_step(
542 exc, sorig.x, sorig.y, &xo, &yo, &g, orig,
543 - &xmotion, &ymotion, do_resize_opaque, True);
544 + &xmotion, &ymotion, do_resize_opaque, True, do_outline_thin);
546 if (vx != Scr.Vx || vy != Scr.Vy)
548 MoveViewport(vx, vy, False);
550 /* restore all geometry-related info */
551 fw->g = g_backup;
552 if (bad_window == FW_W(fw))
554 XUnmapWindow(dpy, FW_W_FRAME(fw));
555 diff -U10 -r fvwm/style.c fvwm/style.c
556 --- fvwm/style.c 2011-12-09 18:29:08.011794436 +0100
557 +++ fvwm/style.c 2011-12-09 18:38:57.690110903 +0100
558 @@ -4057,20 +4057,26 @@
559 S_SET_DO_RESIZE_OPAQUE(SCF(*ps), on);
560 S_SET_DO_RESIZE_OPAQUE(SCM(*ps), 1);
561 S_SET_DO_RESIZE_OPAQUE(SCC(*ps), 1);
563 else if (StrEquals(token, "ResizeOutline"))
565 S_SET_DO_RESIZE_OPAQUE(SCF(*ps), !on);
566 S_SET_DO_RESIZE_OPAQUE(SCM(*ps), 1);
567 S_SET_DO_RESIZE_OPAQUE(SCC(*ps), 1);
569 + else if (StrEquals(token, "ResizeOutlineThin"))
571 + S_SET_DO_RESIZE_OUTLINE_THIN(SCF(*ps), on);
572 + S_SET_DO_RESIZE_OUTLINE_THIN(SCM(*ps), 1);
573 + S_SET_DO_RESIZE_OUTLINE_THIN(SCC(*ps), 1);
575 else if (StrEquals(token, "RightTitleRotatedCW"))
577 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCF(*ps), on);
578 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCM(*ps), 1);
579 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCC(*ps), 1);
581 else if (StrEquals(token, "RightTitleRotatedCCW"))
583 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCF(*ps), !on);
584 S_SET_IS_RIGHT_TITLE_ROTATED_CW(SCM(*ps), 1);
585 diff -U10 -r fvwm/style.h fvwm/style.h
586 --- fvwm/style.h 2011-12-09 18:29:08.015127684 +0100
587 +++ fvwm/style.h 2011-12-09 18:38:57.690110903 +0100
588 @@ -225,20 +225,24 @@
589 #define S_SET_DO_NOT_SHOW_ON_MAP(c,x) \
590 ((c).s.do_not_show_on_map = !!(x))
591 #define S_DO_RAISE_TRANSIENT(c) \
592 ((c).s.do_raise_transient)
593 #define S_SET_DO_RAISE_TRANSIENT(c,x) \
594 ((c).s.do_raise_transient = !!(x))
595 #define S_DO_RESIZE_OPAQUE(c) \
596 ((c).s.do_resize_opaque)
597 #define S_SET_DO_RESIZE_OPAQUE(c,x) \
598 ((c).s.do_resize_opaque = !!(x))
599 +#define S_DO_RESIZE_OUTLINE_THIN(c) \
600 + ((c).s.do_resize_outline_thin)
601 +#define S_SET_DO_RESIZE_OUTLINE_THIN(c,x) \
602 + ((c).s.do_resize_outline_thin = !!(x))
603 #define S_DO_SHRINK_WINDOWSHADE(c) \
604 ((c).s.do_shrink_windowshade)
605 #define S_SET_DO_SHRINK_WINDOWSHADE(c,x) \
606 ((c).s.do_shrink_windowshade = !!(x))
607 #define S_DO_STACK_TRANSIENT_PARENT(c) \
608 ((c).s.do_stack_transient_parent)
609 #define S_SET_DO_STACK_TRANSIENT_PARENT(c,x) \
610 ((c).s.do_stack_transient_parent = !!(x))
611 #define S_DO_WINDOW_LIST_SKIP(c) \
612 ((c).s.do_window_list_skip)
613 diff -U10 -r fvwm/window_flags.h fvwm/window_flags.h
614 --- fvwm/window_flags.h 2006-12-21 17:38:58.000000000 +0100
615 +++ fvwm/window_flags.h 2011-12-09 18:38:57.690110903 +0100
616 @@ -14,20 +14,22 @@
617 ((fw)->flags.common.s.focus_policy)
619 #define DO_LOWER_TRANSIENT(fw) \
620 ((fw)->flags.common.s.do_lower_transient)
621 #define DO_NOT_SHOW_ON_MAP(fw) \
622 ((fw)->flags.common.s.do_not_show_on_map)
623 #define DO_RAISE_TRANSIENT(fw) \
624 ((fw)->flags.common.s.do_raise_transient)
625 #define DO_RESIZE_OPAQUE(fw) \
626 ((fw)->flags.common.s.do_resize_opaque)
627 +#define DO_RESIZE_OUTLINE_THIN(fw) \
628 + ((fw)->flags.common.s.do_resize_outline_thin)
629 #define DO_SHRINK_WINDOWSHADE(fw) \
630 ((fw)->flags.common.s.do_shrink_windowshade)
631 #define SET_DO_SHRINK_WINDOWSHADE(fw,x) \
632 (fw)->flags.common.s.do_shrink_windowshade = !!(x)
633 #define SETM_DO_SHRINK_WINDOWSHADE(fw,x) \
634 (fw)->flag_mask.common.s.do_shrink_windowshade = !!(x)
635 #define DO_SKIP_CIRCULATE(fw) \
636 ((fw)->flags.common.s.do_circulate_skip)
637 #define SET_DO_SKIP_CIRCULATE(fw,x) \
638 (fw)->flags.common.s.do_circulate_skip = !!(x)