2 ===================================================================
3 RCS file: /home/cvs/fvwm/fvwm/fvwm/colorset.c,v
4 retrieving revision 1.52
5 diff -u -r1.52 colorset.c
6 --- fvwm/colorset.c 27 Jan 2007 11:33:15 -0000 1.52
7 +++ fvwm/colorset.c 5 Feb 2007 19:15:51 -0000
20 char *icon_tint = NULL;
21 + char *translucent_tint = NULL;
22 Bool have_pixels_changed = False;
23 Bool has_icon_pixels_changed = False;
24 Bool has_fg_changed = False;
26 Bool has_fg_tint_changed = False;
27 Bool has_bg_tint_changed = False;
28 Bool has_icon_tint_changed = False;
29 + Bool has_translucent_tint_changed = False;
30 Bool has_pixmap_changed = False;
31 Bool has_shape_changed = False;
32 Bool has_image_alpha_changed = False;
35 has_pixmap_changed = True;
36 free_colorset_background(cs, True);
37 + cs->is_translucent = False;
38 + cs->translucent_tint_percent = 0;
39 + cs->color_flags &= ~TRANSLUCENT_TINT_SUPPLIED;
40 + has_translucent_tint_changed = True;
42 case 22: /* NoShape */
43 has_shape_changed = True;
45 cs->icon_alpha_percent = tmp;
48 + case 42: /* Translucent */
49 + cs->is_translucent = True;
51 + cs, args, &translucent_tint,
52 + TRANSLUCENT_TINT_SUPPLIED,
53 + &has_translucent_tint_changed, &percent,
55 + if (has_translucent_tint_changed)
57 + cs->translucent_tint_percent = percent;
60 + case 43: /* NoTranslucent */
61 + cs->is_translucent = False;
62 + cs->translucent_tint_percent = 0;
63 + cs->color_flags &= ~TRANSLUCENT_TINT_SUPPLIED;
64 + has_translucent_tint_changed = True;
67 /* test for ?Gradient */
68 if (option[0] && StrEquals(&option[1], "Gradient"))
69 @@ -1615,6 +1641,27 @@
73 + * ---------- change the translucent tint colour ----------
75 + if (has_translucent_tint_changed)
77 + /* user specified colour */
78 + if (translucent_tint != NULL)
81 + dpy, Pcmap, &cs->translucent_tint, 1, 0, True);
82 + cs->translucent_tint = GetColor(translucent_tint);
88 + dpy, Pcmap, &cs->translucent_tint, 1, 0, True);
89 + cs->translucent_tint = GetColor(black);
94 * ---------- send new colorset to fvwm and clean up ----------
96 /* make sure the server has this to avoid races */
98 ncs->fgsh = GetColor(white);
99 ncs->tint = GetColor(black);
100 ncs->icon_tint = GetColor(black);
101 + ncs->translucent_tint = GetColor(black);
102 ncs->pixmap = XCreatePixmapFromBitmapData(
104 &g_bits[4 * (nColorsets % 3)], 4, 4,
105 @@ -1727,6 +1775,7 @@
106 ncs->fgsh = GetForeShadow(ncs->fg, ncs->bg);
107 ncs->tint = GetColor(black);
108 ncs->icon_tint = GetColor(black);
109 + ncs->translucent_tint = GetColor(black);
111 ncs->fg_tint = ncs->bg_tint = GetColor(black);
112 /* set flags for fg contrast, bg average */
113 @@ -1738,6 +1787,7 @@
114 ncs->icon_alpha_percent = 100;
115 ncs->tint_percent = 0;
116 ncs->icon_tint_percent = 0;
117 + ncs->translucent_tint_percent = 0;
118 ncs->fg_tint_percent = ncs->bg_tint_percent = 0;
119 ncs->dither = (PictureDitherByDefault())? True:False;
121 Index: fvwm/menuroot.h
122 ===================================================================
123 RCS file: /home/cvs/fvwm/fvwm/fvwm/menuroot.h,v
124 retrieving revision 1.3
125 diff -u -r1.3 menuroot.h
126 --- fvwm/menuroot.h 13 Jan 2007 15:07:14 -0000 1.3
127 +++ fvwm/menuroot.h 5 Feb 2007 19:17:37 -0000
131 /* alloc pixels when dithering is used for gradients */
132 + /* x,y XMapRaise */
137 /* access macros to dynamic menu members */
139 ===================================================================
140 RCS file: /home/cvs/fvwm/fvwm/fvwm/menus.c,v
141 retrieving revision 1.409
142 diff -u -r1.409 menus.c
143 --- fvwm/menus.c 27 Jan 2007 11:51:15 -0000 1.409
144 +++ fvwm/menus.c 5 Feb 2007 19:17:50 -0000
147 /* ---------------------------- local macros ------------------------------- */
149 +#define MENU_IS_TRANSLUCENT(mr,cs) \
150 + (!MR_IS_TEAR_OFF_MENU(mr) && CSET_IS_TRANSLUCENT(cs))
151 +#define MENU_IS_TRANSPARENT(mr,cs) \
152 + (MENU_IS_TRANSLUCENT(mr,cs) || CSET_IS_TRANSPARENT(cs))
153 +#define MR_IS_TRANSLUCENT_MENU(mr) \
154 + (!MR_IS_TEAR_OFF_MENU(mr) && MR_STYLE(mr) && \
155 + ST_HAS_MENU_CSET(MR_STYLE(mr)) && CSET_IS_TRANSLUCENT( \
156 + ST_CSET_MENU(MR_STYLE(mr))))
157 +#define MR_IS_TRANSPARENT_MENU(mr) \
158 + (MR_IS_TRANSLUCENT_MENU(mr) || (MR_STYLE(mr) && \
159 + ST_HAS_MENU_CSET(MR_STYLE(mr)) && CSET_IS_TRANSPARENT( \
160 + ST_CSET_MENU(MR_STYLE(mr)))))
162 /* ---------------------------- imports ------------------------------------ */
164 /* This external is safe. It's written only during startup. */
166 } mloop_static_info_t;
168 /* ---------------------------- forward declarations ----------------------- */
169 +static MenuRoot *seek_submenu_instance(
170 + MenuRoot *parent_menu, MenuItem *parent_item);
172 /* ---------------------------- local variables ---------------------------- */
174 @@ -353,12 +368,22 @@
175 Bool transparent_bg = False;
178 - if (ST_HAS_MENU_CSET(MR_STYLE(mr)) &&
179 - CSET_IS_TRANSPARENT(ST_CSET_MENU(MR_STYLE(mr))))
180 + if (MR_IS_TRANSPARENT_MENU(mr))
182 transparent_bg = True;
183 get_menu_repaint_transparent_parameters(
185 + if (MR_IS_TRANSLUCENT_MENU(mr) && MR_SUBMENU_ITEM(mr))
188 + smr = seek_submenu_instance(
189 + mr, MR_SUBMENU_ITEM(mr));
192 + /* just unmap it here, popdown later */
193 + XUnmapWindow(dpy, MR_WINDOW(smr));
197 AnimatedMoveOfWindow(
198 MR_WINDOW(mr), act_x, act_y, act_x - MR_XANIMATION(mr),
199 @@ -1779,6 +1804,7 @@
200 /* Doh. Use the standard display instead. */
201 MR_CREATE_DPY(mr) = dpy;
203 + MR_IS_TEAR_OFF_MENU(mr) = 1;
207 @@ -2594,7 +2620,37 @@
209 MR_IS_PAINTED(mr) = 1;
210 /* paint the menu background */
211 - if (ms && ST_HAS_MENU_CSET(ms))
212 + if (MR_IS_TRANSLUCENT_MENU(mr))
214 + Pixmap trans = None;
215 + FvwmRenderAttributes fra;
216 + colorset_t *colorset = &Colorset[ST_CSET_MENU(ms)];
219 + if (colorset->translucent_tint_percent > 0)
221 + fra.mask = FRAM_HAVE_TINT;
222 + fra.tint = colorset->translucent_tint;
223 + fra.tint_percent = colorset->translucent_tint_percent;
225 + if (MR_IS_BACKGROUND_SET(mr) == False)
227 + trans = PGraphicsCreateTranslucent(
228 + dpy, MR_WINDOW(mr), &fra,
229 + BACK_GC(ST_MENU_INACTIVE_GCS(ms)),
230 + MR_X(mr), MR_Y(mr), MR_WIDTH(mr), MR_HEIGHT(mr));
231 + XMapRaised(dpy, MR_WINDOW(mr));
234 + XSetWindowBackgroundPixmap(
235 + dpy, MR_WINDOW(mr), trans);
236 + MR_IS_BACKGROUND_SET(mr) = True;
237 + clear_expose_menu_area(MR_WINDOW(mr), pevent);
238 + XFreePixmap(dpy, trans);
242 + else if (ms && ST_HAS_MENU_CSET(ms))
244 if (MR_IS_BACKGROUND_SET(mr) == False)
246 @@ -3401,10 +3457,7 @@
247 MR_HAS_POPPED_UP_RIGHT(mr) = 0;
249 MR_XANIMATION(parent_menu) += end_x - prev_x;
250 - if (ST_HAS_MENU_CSET(MR_STYLE(parent_menu)) &&
251 - CSET_IS_TRANSPARENT(
253 - MR_STYLE(parent_menu))))
254 + if (MR_IS_TRANSPARENT_MENU(parent_menu))
256 transparent_bg = True;
257 get_menu_repaint_transparent_parameters(
258 @@ -3583,10 +3636,21 @@
261 XMoveWindow(dpy, MR_WINDOW(mr), x, y);
264 XSelectInput(dpy, MR_WINDOW(mr), event_mask);
265 - XMapRaised(dpy, MR_WINDOW(mr));
266 - if (popdown_window)
267 - XUnmapWindow(dpy, popdown_window);
268 + if (MR_IS_TRANSLUCENT_MENU(mr))
270 + if (popdown_window)
271 + XUnmapWindow(dpy, popdown_window);
272 + paint_menu(mr, NULL, fw);
276 + XMapRaised(dpy, MR_WINDOW(mr));
277 + if (popdown_window)
278 + XUnmapWindow(dpy, popdown_window);
281 MR_MAPPED_COPIES(mr)++;
282 MST_USAGE_COUNT(mr)++;
283 @@ -6123,16 +6187,122 @@
287 - if (!last && CSET_IS_TRANSPARENT_PR_TINT(ST_CSET_MENU(ms)))
289 + (CSET_IS_TRANSPARENT_PR_TINT(ST_CSET_MENU(ms)) ||
290 + MR_IS_TRANSLUCENT_MENU(mr)))
295 - SetWindowBackgroundWithOffset(
296 - dpy, MR_WINDOW(mr), step_x - current_x, step_y - current_y,
297 - MR_WIDTH(mr), MR_HEIGHT(mr),
298 - &Colorset[ST_CSET_MENU(ms)], Pdepth,
299 - FORE_GC(MST_MENU_INACTIVE_GCS(mr)), False);
300 + if (MR_IS_TRANSLUCENT_MENU(mr))
303 + FvwmRenderAttributes fra;
304 + colorset_t *colorset = &Colorset[ST_CSET_MENU(ms)];
307 + if (colorset->translucent_tint_percent > 0)
309 + fra.mask = FRAM_HAVE_TINT;
310 + fra.tint = colorset->translucent_tint;
311 + fra.tint_percent = colorset->translucent_tint_percent;
313 + if (current_x == step_x)
315 + /* Reuse the old pixmap for the part of the menu
316 + * that has not moved. (This can be extended to get
317 + * two new rectangles, one in each direction)
319 + * It saves the unmapping of the window and makes
320 + * Things less flickering.
323 + unsigned long valuemask = GCSubwindowMode;
326 + values.subwindow_mode = IncludeInferiors;
331 + trans = XCreatePixmap(dpy, MR_WINDOW(mr), MR_WIDTH(mr),
332 + MR_HEIGHT(mr), Pdepth);
333 + my_gc = fvwmlib_XCreateGC(dpy, MR_WINDOW(mr), 0, NULL);
334 + XChangeGC(dpy, my_gc, valuemask, &values);
336 + XClearWindow(dpy, MR_WINDOW(mr));
338 + if (current_y < step_y)
340 + XCopyArea(dpy, MR_WINDOW(mr), trans, my_gc, 0,
341 + step_y-current_y, MR_WIDTH(mr),
342 + MR_HEIGHT(mr)-(step_y-current_y),
344 + tmp = PGraphicsCreateTranslucent(
345 + dpy, MR_WINDOW(mr), &fra,
346 + BACK_GC(ST_MENU_INACTIVE_GCS(ms)),
347 + current_x, current_y+MR_HEIGHT(mr),
348 + MR_WIDTH(mr), step_y-current_y);
350 + XCopyArea(dpy, tmp, trans, my_gc, 0, 0,
351 + MR_WIDTH(mr), step_y-current_y,0,
352 + MR_HEIGHT(mr)-(step_y-current_y));
356 + XCopyArea(dpy, MR_WINDOW(mr), trans, my_gc, 0,
358 + MR_HEIGHT(mr)-(current_y-step_y), 0,
360 + tmp = PGraphicsCreateTranslucent(
361 + dpy, MR_WINDOW(mr), &fra,
362 + BACK_GC(ST_MENU_INACTIVE_GCS(ms)),
363 + current_x,step_y, MR_WIDTH(mr),
365 + XCopyArea(dpy, tmp, trans, my_gc, 0, 0,
366 + MR_WIDTH(mr), current_y-step_y,0,
371 + XFreePixmap(dpy, tmp);
372 + XFreeGC(dpy,my_gc);
376 + XUnmapWindow(dpy, MR_WINDOW(mr));
379 + trans = PGraphicsCreateTranslucent(
380 + dpy, MR_WINDOW(mr), &fra,
381 + BACK_GC(ST_MENU_INACTIVE_GCS(ms)),
382 + step_x, step_y, MR_WIDTH(mr),
384 + XMapRaised(dpy, MR_WINDOW(mr));
386 + XSetWindowBackgroundPixmap(
387 + dpy, MR_WINDOW(mr), trans);
388 + XFreePixmap(dpy, trans);
389 + if (current_x == step_x)
391 + /* Redraw the border */
393 + dpy, MR_WINDOW(mr), 0, 0, MR_WIDTH(mr) - 1,
394 + MR_HEIGHT(mr) - 1, (Pdepth < 2) ?
395 + SHADOW_GC(MST_MENU_INACTIVE_GCS(mr)) :
396 + HILIGHT_GC(MST_MENU_INACTIVE_GCS(mr)),
397 + SHADOW_GC(MST_MENU_INACTIVE_GCS(mr)),
398 + MST_BORDER_WIDTH(mr));
403 + SetWindowBackgroundWithOffset(
404 + dpy, MR_WINDOW(mr), step_x - current_x,
405 + step_y - current_y, MR_WIDTH(mr), MR_HEIGHT(mr),
406 + &Colorset[ST_CSET_MENU(ms)], Pdepth,
407 + FORE_GC(MST_MENU_INACTIVE_GCS(mr)), False);
412 @@ -6173,10 +6343,7 @@
416 - SetWindowBackground(
417 - dpy, MR_WINDOW(mr), MR_WIDTH(mr), MR_HEIGHT(mr),
418 - &Colorset[ST_CSET_MENU(ms)], Pdepth,
419 - FORE_GC(MST_MENU_INACTIVE_GCS(mr)), False);
420 + update_transparent_menu_bg(prtm, x, y, x, y, end_x, end_y);
422 /* redraw the background of non active item */
423 for (mi = MR_FIRST_ITEM(mr); mi != NULL; mi = MI_NEXT_ITEM(mi))
424 @@ -6813,10 +6980,12 @@
426 dpy, MR_WINDOW(mr), MR_WIDTH(mr),
428 - &Colorset[ST_CSET_MENU(ms)],
430 + &Colorset[ST_CSET_MENU(ms)], Pdepth,
431 FORE_GC(MST_MENU_INACTIVE_GCS(mr)),
435 + dpy, MR_WINDOW(mr), 0, 0, MR_WIDTH(mr),
436 + MR_HEIGHT(mr), True);
438 else if ((ST_HAS_ACTIVE_CSET(ms) &&
439 ST_CSET_ACTIVE(ms) == cset) ||
441 ===================================================================
442 RCS file: /home/cvs/fvwm/fvwm/fvwm/menus.h,v
443 retrieving revision 1.111
444 diff -u -r1.111 menus.h
445 --- fvwm/menus.h 27 Jan 2007 11:51:15 -0000 1.111
446 +++ fvwm/menus.h 5 Feb 2007 19:17:50 -0000
448 #define IS_MENU_RETURN(x) \
449 ((x)==MENU_DONE || (x)==MENU_ABORTED || (x)==MENU_SUBMENU_TORN_OFF)
451 +#define MR_X(m) ((m)->d->x)
452 +#define MR_Y(m) ((m)->d->y)
457 Index: libs/Colorset.h
458 ===================================================================
459 RCS file: /home/cvs/fvwm/fvwm/libs/Colorset.h,v
460 retrieving revision 1.38
461 diff -u -r1.38 Colorset.h
462 --- libs/Colorset.h 10 Jan 2007 00:34:27 -0000 1.38
463 +++ libs/Colorset.h 5 Feb 2007 19:19:00 -0000
466 Bool allows_buffered_transparency;
467 Bool is_maybe_root_transparent;
468 + /* only use by fvwm menu (non tear-off) */
469 + Bool is_translucent;
470 + Pixel translucent_tint;
471 + unsigned int translucent_tint_percent : 7;
476 #define FG_TINT_SUPPLIED 0x100
477 #define BG_TINT_SUPPLIED 0x200
478 #define ICON_TINT_SUPPLIED 0x400
479 +#define TRANSLUCENT_TINT_SUPPLIED 0x800
482 /* colorsets are stored as an array of structs to permit fast dereferencing */
484 (cset != NULL && cset->pixmap == ParentRelative && \
485 cset->tint_percent > 0)
487 +#define CSET_IS_TRANSLUCENT(cset) \
488 + (cset >= 0 && Colorset[cset].is_translucent)
489 +#define CSETS_IS_TRANSLUCENT(cset) \
490 + (cset && cset->is_translucent)
492 #ifndef FVWM_COLORSET_PRIVATE
493 /* Create n new colorsets, fvwm/colorset.c does its own thing (different size)
495 Index: libs/PictureGraphics.c
496 ===================================================================
497 RCS file: /home/cvs/fvwm/fvwm/libs/PictureGraphics.c,v
498 retrieving revision 1.29
499 diff -u -r1.29 PictureGraphics.c
500 --- libs/PictureGraphics.c 27 Jan 2007 11:33:16 -0000 1.29
501 +++ libs/PictureGraphics.c 5 Feb 2007 19:19:49 -0000
502 @@ -1340,7 +1340,7 @@
506 -#if 0 /* humm... maybe useful one day with menus */
507 +#if 1 /* humm... maybe useful one day with menus */
508 Pixmap PGraphicsCreateTranslucent(
509 Display *dpy, Window win, FvwmRenderAttributes *fra, GC gc,
510 int x, int y, int width, int height)
511 Index: libs/PictureGraphics.h
512 ===================================================================
513 RCS file: /home/cvs/fvwm/fvwm/libs/PictureGraphics.h,v
514 retrieving revision 1.13
515 diff -u -r1.13 PictureGraphics.h
516 --- libs/PictureGraphics.h 9 May 2006 20:46:29 -0000 1.13
517 +++ libs/PictureGraphics.h 5 Feb 2007 19:19:49 -0000
519 Display *dpy, Window win, Pixel tint, int tint_percent,
520 Drawable dest, Bool dest_is_a_window, GC gc, GC mono_gc, GC alpha_gc,
521 int dest_x, int dest_y, int dest_w, int dest_h);
523 +Pixmap PGraphicsCreateTranslucent(
524 + Display *dpy, Window win, FvwmRenderAttributes *fra, GC gc,
525 + int x, int y, int width, int height);
527 Pixmap PGraphicsCreateDitherPixmap(
528 Display *dpy, Window win, Drawable src, Pixmap mask, int depth, GC gc,