Link Here
|
75 |
|
75 |
|
76 |
/* ---------------------------- local macros ------------------------------- */ |
76 |
/* ---------------------------- local macros ------------------------------- */ |
77 |
|
77 |
|
|
|
78 |
#define MENU_IS_TRANSLUCENT(mr,cs) \ |
79 |
(!MR_IS_TEAR_OFF_MENU(mr) && CSET_IS_TRANSLUCENT(cs)) |
80 |
#define MENU_IS_TRANSPARENT(mr,cs) \ |
81 |
(MENU_IS_TRANSLUCENT(mr,cs) || CSET_IS_TRANSPARENT(cs)) |
82 |
#define MR_IS_TRANSLUCENT_MENU(mr) \ |
83 |
(!MR_IS_TEAR_OFF_MENU(mr) && MR_STYLE(mr) && \ |
84 |
ST_HAS_MENU_CSET(MR_STYLE(mr)) && CSET_IS_TRANSLUCENT( \ |
85 |
ST_CSET_MENU(MR_STYLE(mr)))) |
86 |
#define MR_IS_TRANSPARENT_MENU(mr) \ |
87 |
(MR_IS_TRANSLUCENT_MENU(mr) || (MR_STYLE(mr) && \ |
88 |
ST_HAS_MENU_CSET(MR_STYLE(mr)) && CSET_IS_TRANSPARENT( \ |
89 |
ST_CSET_MENU(MR_STYLE(mr))))) |
90 |
|
78 |
/* ---------------------------- imports ------------------------------------ */ |
91 |
/* ---------------------------- imports ------------------------------------ */ |
79 |
|
92 |
|
80 |
/* This external is safe. It's written only during startup. */ |
93 |
/* This external is safe. It's written only during startup. */ |
Link Here
|
188 |
} mloop_static_info_t; |
201 |
} mloop_static_info_t; |
189 |
|
202 |
|
190 |
/* ---------------------------- forward declarations ----------------------- */ |
203 |
/* ---------------------------- forward declarations ----------------------- */ |
|
|
204 |
static MenuRoot *seek_submenu_instance( |
205 |
MenuRoot *parent_menu, MenuItem *parent_item); |
191 |
|
206 |
|
192 |
/* ---------------------------- local variables ---------------------------- */ |
207 |
/* ---------------------------- local variables ---------------------------- */ |
193 |
|
208 |
|
Link Here
|
353 |
Bool transparent_bg = False; |
368 |
Bool transparent_bg = False; |
354 |
|
369 |
|
355 |
/* move it back */ |
370 |
/* move it back */ |
356 |
if (ST_HAS_MENU_CSET(MR_STYLE(mr)) && |
371 |
if (MR_IS_TRANSPARENT_MENU(mr)) |
357 |
CSET_IS_TRANSPARENT(ST_CSET_MENU(MR_STYLE(mr)))) |
|
|
358 |
{ |
372 |
{ |
359 |
transparent_bg = True; |
373 |
transparent_bg = True; |
360 |
get_menu_repaint_transparent_parameters( |
374 |
get_menu_repaint_transparent_parameters( |
361 |
&mrtp, mr, fw); |
375 |
&mrtp, mr, fw); |
|
|
376 |
if (MR_IS_TRANSLUCENT_MENU(mr) && MR_SUBMENU_ITEM(mr)) |
377 |
{ |
378 |
MenuRoot *smr; |
379 |
smr = seek_submenu_instance( |
380 |
mr, MR_SUBMENU_ITEM(mr)); |
381 |
if (smr) |
382 |
{ |
383 |
/* just unmap it here, popdown later */ |
384 |
XUnmapWindow(dpy, MR_WINDOW(smr)); |
385 |
} |
386 |
} |
362 |
} |
387 |
} |
363 |
AnimatedMoveOfWindow( |
388 |
AnimatedMoveOfWindow( |
364 |
MR_WINDOW(mr), act_x, act_y, act_x - MR_XANIMATION(mr), |
389 |
MR_WINDOW(mr), act_x, act_y, act_x - MR_XANIMATION(mr), |
Link Here
|
1779 |
/* Doh. Use the standard display instead. */ |
1804 |
/* Doh. Use the standard display instead. */ |
1780 |
MR_CREATE_DPY(mr) = dpy; |
1805 |
MR_CREATE_DPY(mr) = dpy; |
1781 |
} |
1806 |
} |
|
|
1807 |
MR_IS_TEAR_OFF_MENU(mr) = 1; |
1782 |
} |
1808 |
} |
1783 |
else |
1809 |
else |
1784 |
{ |
1810 |
{ |
Link Here
|
2594 |
} |
2620 |
} |
2595 |
MR_IS_PAINTED(mr) = 1; |
2621 |
MR_IS_PAINTED(mr) = 1; |
2596 |
/* paint the menu background */ |
2622 |
/* paint the menu background */ |
2597 |
if (ms && ST_HAS_MENU_CSET(ms)) |
2623 |
if (MR_IS_TRANSLUCENT_MENU(mr)) |
|
|
2624 |
{ |
2625 |
Pixmap trans = None; |
2626 |
FvwmRenderAttributes fra; |
2627 |
colorset_t *colorset = &Colorset[ST_CSET_MENU(ms)]; |
2628 |
|
2629 |
fra.mask = 0; |
2630 |
if (colorset->translucent_tint_percent > 0) |
2631 |
{ |
2632 |
fra.mask = FRAM_HAVE_TINT; |
2633 |
fra.tint = colorset->translucent_tint; |
2634 |
fra.tint_percent = colorset->translucent_tint_percent; |
2635 |
} |
2636 |
if (MR_IS_BACKGROUND_SET(mr) == False) |
2637 |
{ |
2638 |
trans = PGraphicsCreateTranslucent( |
2639 |
dpy, MR_WINDOW(mr), &fra, |
2640 |
BACK_GC(ST_MENU_INACTIVE_GCS(ms)), |
2641 |
MR_X(mr), MR_Y(mr), MR_WIDTH(mr), MR_HEIGHT(mr)); |
2642 |
XMapRaised(dpy, MR_WINDOW(mr)); |
2643 |
if (trans != None) |
2644 |
{ |
2645 |
XSetWindowBackgroundPixmap( |
2646 |
dpy, MR_WINDOW(mr), trans); |
2647 |
MR_IS_BACKGROUND_SET(mr) = True; |
2648 |
clear_expose_menu_area(MR_WINDOW(mr), pevent); |
2649 |
XFreePixmap(dpy, trans); |
2650 |
} |
2651 |
} |
2652 |
} |
2653 |
else if (ms && ST_HAS_MENU_CSET(ms)) |
2598 |
{ |
2654 |
{ |
2599 |
if (MR_IS_BACKGROUND_SET(mr) == False) |
2655 |
if (MR_IS_BACKGROUND_SET(mr) == False) |
2600 |
{ |
2656 |
{ |
Link Here
|
3401 |
MR_HAS_POPPED_UP_RIGHT(mr) = 0; |
3457 |
MR_HAS_POPPED_UP_RIGHT(mr) = 0; |
3402 |
} |
3458 |
} |
3403 |
MR_XANIMATION(parent_menu) += end_x - prev_x; |
3459 |
MR_XANIMATION(parent_menu) += end_x - prev_x; |
3404 |
if (ST_HAS_MENU_CSET(MR_STYLE(parent_menu)) && |
3460 |
if (MR_IS_TRANSPARENT_MENU(parent_menu)) |
3405 |
CSET_IS_TRANSPARENT( |
|
|
3406 |
ST_CSET_MENU( |
3407 |
MR_STYLE(parent_menu)))) |
3408 |
{ |
3461 |
{ |
3409 |
transparent_bg = True; |
3462 |
transparent_bg = True; |
3410 |
get_menu_repaint_transparent_parameters( |
3463 |
get_menu_repaint_transparent_parameters( |
Link Here
|
3583 |
*/ |
3636 |
*/ |
3584 |
|
3637 |
|
3585 |
XMoveWindow(dpy, MR_WINDOW(mr), x, y); |
3638 |
XMoveWindow(dpy, MR_WINDOW(mr), x, y); |
|
|
3639 |
MR_X(mr) = x; |
3640 |
MR_Y(mr) = y; |
3586 |
XSelectInput(dpy, MR_WINDOW(mr), event_mask); |
3641 |
XSelectInput(dpy, MR_WINDOW(mr), event_mask); |
3587 |
XMapRaised(dpy, MR_WINDOW(mr)); |
3642 |
if (MR_IS_TRANSLUCENT_MENU(mr)) |
3588 |
if (popdown_window) |
3643 |
{ |
3589 |
XUnmapWindow(dpy, popdown_window); |
3644 |
if (popdown_window) |
|
|
3645 |
XUnmapWindow(dpy, popdown_window); |
3646 |
paint_menu(mr, NULL, fw); |
3647 |
} |
3648 |
else |
3649 |
{ |
3650 |
XMapRaised(dpy, MR_WINDOW(mr)); |
3651 |
if (popdown_window) |
3652 |
XUnmapWindow(dpy, popdown_window); |
3653 |
} |
3590 |
XFlush(dpy); |
3654 |
XFlush(dpy); |
3591 |
MR_MAPPED_COPIES(mr)++; |
3655 |
MR_MAPPED_COPIES(mr)++; |
3592 |
MST_USAGE_COUNT(mr)++; |
3656 |
MST_USAGE_COUNT(mr)++; |
Link Here
|
6123 |
{ |
6187 |
{ |
6124 |
last = True; |
6188 |
last = True; |
6125 |
} |
6189 |
} |
6126 |
if (!last && CSET_IS_TRANSPARENT_PR_TINT(ST_CSET_MENU(ms))) |
6190 |
if (!last && |
|
|
6191 |
(CSET_IS_TRANSPARENT_PR_TINT(ST_CSET_MENU(ms)) || |
6192 |
MR_IS_TRANSLUCENT_MENU(mr))) |
6127 |
{ |
6193 |
{ |
6128 |
/* too slow ... */ |
6194 |
/* too slow ... */ |
6129 |
return; |
6195 |
return; |
6130 |
} |
6196 |
} |
6131 |
SetWindowBackgroundWithOffset( |
6197 |
if (MR_IS_TRANSLUCENT_MENU(mr)) |
6132 |
dpy, MR_WINDOW(mr), step_x - current_x, step_y - current_y, |
6198 |
{ |
6133 |
MR_WIDTH(mr), MR_HEIGHT(mr), |
6199 |
Pixmap trans, tmp; |
6134 |
&Colorset[ST_CSET_MENU(ms)], Pdepth, |
6200 |
FvwmRenderAttributes fra; |
6135 |
FORE_GC(MST_MENU_INACTIVE_GCS(mr)), False); |
6201 |
colorset_t *colorset = &Colorset[ST_CSET_MENU(ms)]; |
|
|
6202 |
|
6203 |
fra.mask = 0; |
6204 |
if (colorset->translucent_tint_percent > 0) |
6205 |
{ |
6206 |
fra.mask = FRAM_HAVE_TINT; |
6207 |
fra.tint = colorset->translucent_tint; |
6208 |
fra.tint_percent = colorset->translucent_tint_percent; |
6209 |
} |
6210 |
if (current_x == step_x) |
6211 |
{ |
6212 |
/* Reuse the old pixmap for the part of the menu |
6213 |
* that has not moved. (This can be extended to get |
6214 |
* two new rectangles, one in each direction) |
6215 |
* |
6216 |
* It saves the unmapping of the window and makes |
6217 |
* Things less flickering. |
6218 |
*/ |
6219 |
GC my_gc; |
6220 |
unsigned long valuemask = GCSubwindowMode; |
6221 |
XGCValues values; |
6222 |
int out_y=0; |
6223 |
values.subwindow_mode = IncludeInferiors; |
6224 |
if (step_y < 0) |
6225 |
{ |
6226 |
out_y = -step_y; |
6227 |
} |
6228 |
trans = XCreatePixmap(dpy, MR_WINDOW(mr), MR_WIDTH(mr), |
6229 |
MR_HEIGHT(mr), Pdepth); |
6230 |
my_gc = fvwmlib_XCreateGC(dpy, MR_WINDOW(mr), 0, NULL); |
6231 |
XChangeGC(dpy, my_gc, valuemask, &values); |
6232 |
|
6233 |
XClearWindow(dpy, MR_WINDOW(mr)); |
6234 |
|
6235 |
if (current_y < step_y) |
6236 |
{ |
6237 |
XCopyArea(dpy, MR_WINDOW(mr), trans, my_gc, 0, |
6238 |
step_y-current_y, MR_WIDTH(mr), |
6239 |
MR_HEIGHT(mr)-(step_y-current_y), |
6240 |
0,0); |
6241 |
tmp = PGraphicsCreateTranslucent( |
6242 |
dpy, MR_WINDOW(mr), &fra, |
6243 |
BACK_GC(ST_MENU_INACTIVE_GCS(ms)), |
6244 |
current_x, current_y+MR_HEIGHT(mr), |
6245 |
MR_WIDTH(mr), step_y-current_y); |
6246 |
|
6247 |
XCopyArea(dpy, tmp, trans, my_gc, 0, 0, |
6248 |
MR_WIDTH(mr), step_y-current_y,0, |
6249 |
MR_HEIGHT(mr)-(step_y-current_y)); |
6250 |
} |
6251 |
else |
6252 |
{ |
6253 |
XCopyArea(dpy, MR_WINDOW(mr), trans, my_gc, 0, |
6254 |
0, MR_WIDTH(mr), |
6255 |
MR_HEIGHT(mr)-(current_y-step_y), 0, |
6256 |
current_y-step_y); |
6257 |
tmp = PGraphicsCreateTranslucent( |
6258 |
dpy, MR_WINDOW(mr), &fra, |
6259 |
BACK_GC(ST_MENU_INACTIVE_GCS(ms)), |
6260 |
current_x,step_y, MR_WIDTH(mr), |
6261 |
current_y-step_y); |
6262 |
XCopyArea(dpy, tmp, trans, my_gc, 0, 0, |
6263 |
MR_WIDTH(mr), current_y-step_y,0, |
6264 |
out_y); |
6265 |
} |
6266 |
MR_X(mr) = step_x; |
6267 |
MR_Y(mr) = step_y; |
6268 |
XFreePixmap(dpy, tmp); |
6269 |
XFreeGC(dpy,my_gc); |
6270 |
} |
6271 |
else |
6272 |
{ |
6273 |
XUnmapWindow(dpy, MR_WINDOW(mr)); |
6274 |
MR_X(mr) = step_x; |
6275 |
MR_Y(mr) = step_y; |
6276 |
trans = PGraphicsCreateTranslucent( |
6277 |
dpy, MR_WINDOW(mr), &fra, |
6278 |
BACK_GC(ST_MENU_INACTIVE_GCS(ms)), |
6279 |
step_x, step_y, MR_WIDTH(mr), |
6280 |
MR_HEIGHT(mr)); |
6281 |
XMapRaised(dpy, MR_WINDOW(mr)); |
6282 |
} |
6283 |
XSetWindowBackgroundPixmap( |
6284 |
dpy, MR_WINDOW(mr), trans); |
6285 |
XFreePixmap(dpy, trans); |
6286 |
if (current_x == step_x) |
6287 |
{ |
6288 |
/* Redraw the border */ |
6289 |
RelieveRectangle( |
6290 |
dpy, MR_WINDOW(mr), 0, 0, MR_WIDTH(mr) - 1, |
6291 |
MR_HEIGHT(mr) - 1, (Pdepth < 2) ? |
6292 |
SHADOW_GC(MST_MENU_INACTIVE_GCS(mr)) : |
6293 |
HILIGHT_GC(MST_MENU_INACTIVE_GCS(mr)), |
6294 |
SHADOW_GC(MST_MENU_INACTIVE_GCS(mr)), |
6295 |
MST_BORDER_WIDTH(mr)); |
6296 |
} |
6297 |
} |
6298 |
else |
6299 |
{ |
6300 |
SetWindowBackgroundWithOffset( |
6301 |
dpy, MR_WINDOW(mr), step_x - current_x, |
6302 |
step_y - current_y, MR_WIDTH(mr), MR_HEIGHT(mr), |
6303 |
&Colorset[ST_CSET_MENU(ms)], Pdepth, |
6304 |
FORE_GC(MST_MENU_INACTIVE_GCS(mr)), False); |
6305 |
} |
6136 |
} |
6306 |
} |
6137 |
|
6307 |
|
6138 |
|
6308 |
|
Link Here
|
6173 |
} |
6343 |
} |
6174 |
if (!is_bg_set) |
6344 |
if (!is_bg_set) |
6175 |
{ |
6345 |
{ |
6176 |
SetWindowBackground( |
6346 |
update_transparent_menu_bg(prtm, x, y, x, y, end_x, end_y); |
6177 |
dpy, MR_WINDOW(mr), MR_WIDTH(mr), MR_HEIGHT(mr), |
|
|
6178 |
&Colorset[ST_CSET_MENU(ms)], Pdepth, |
6179 |
FORE_GC(MST_MENU_INACTIVE_GCS(mr)), False); |
6180 |
} |
6347 |
} |
6181 |
/* redraw the background of non active item */ |
6348 |
/* redraw the background of non active item */ |
6182 |
for (mi = MR_FIRST_ITEM(mr); mi != NULL; mi = MI_NEXT_ITEM(mi)) |
6349 |
for (mi = MR_FIRST_ITEM(mr); mi != NULL; mi = MI_NEXT_ITEM(mi)) |
Link Here
|
6813 |
SetWindowBackground( |
6980 |
SetWindowBackground( |
6814 |
dpy, MR_WINDOW(mr), MR_WIDTH(mr), |
6981 |
dpy, MR_WINDOW(mr), MR_WIDTH(mr), |
6815 |
MR_HEIGHT(mr), |
6982 |
MR_HEIGHT(mr), |
6816 |
&Colorset[ST_CSET_MENU(ms)], |
6983 |
&Colorset[ST_CSET_MENU(ms)], Pdepth, |
6817 |
Pdepth, |
|
|
6818 |
FORE_GC(MST_MENU_INACTIVE_GCS(mr)), |
6984 |
FORE_GC(MST_MENU_INACTIVE_GCS(mr)), |
6819 |
True); |
6985 |
False); |
|
|
6986 |
XClearArea( |
6987 |
dpy, MR_WINDOW(mr), 0, 0, MR_WIDTH(mr), |
6988 |
MR_HEIGHT(mr), True); |
6820 |
} |
6989 |
} |
6821 |
else if ((ST_HAS_ACTIVE_CSET(ms) && |
6990 |
else if ((ST_HAS_ACTIVE_CSET(ms) && |
6822 |
ST_CSET_ACTIVE(ms) == cset) || |
6991 |
ST_CSET_ACTIVE(ms) == cset) || |