On Wed, Jul 10, 2002 at 10:45:02PM +0200, Dominik Vogt wrote:
> On Wed, Jul 10, 2002 at 10:12:18PM +0200, Remko Troncon wrote:
> > There seems to be a problem in the drawing of menus. The problem is as 
> > follows:
> > I have a grey/white DGradient as a background of my menus. When i use 
> > FreeType
> > fonts as my menu font, the gradient doesnt show at all, i only get a
> > plain grey background.
> > I tried to trace the problem, and stumbled upon some code in menuitem.c. 
> > In menuitem_paint(), there is a piece of code
> >      ...
> >      else if ( xft_redraw || ... ) {
> >          ...
> >          XClearArea(...)
> >      }
> > When i comment the XClearArea (or the xft_redraw condition), the
> > gradient does show. 

But the text may become ugly. With xft we cannot draw text onto a given
text as the drawing procedure take in account what is under the text
which is drawn.

> > I've never programmed with Xlibs before, so i don't
> > really know how the XClearArea works, so maybe someone can help me find
> > out what could be going wrong ?
>
> The XClearArea() call erases the foreground of the window so that
> the window backgorund shines through.  The reason why this doesn't
> work with b and d gradients is that they are drawn on the window
> *foreground* (unlike all other types of gradients).  That happens
> only with the
> 
>   MenuFace B/DGradient ...
> 
> options.  If you instead define a colorset with the gradient and
> then set
> 
>   MenuFace Colorset ...
> 
> it works as expected.
> 
> Olivier:  I guess you added that XClearArea() call.  Do you know
> of any other places in the menu code where you added similar
> calls?  We should continue to support direct gradient drawing
> since they look a lot better this way (less blocky).
>

I do not think that there is an other place in the menu code
where I added such clearing. I was not award that B/DGradient
is drawn on the foreground. 

But what about redrawing the relevant part of the gradient
in this case: in the place of the XClearArea put (around
line 404 of menuitems.c (+ do paint_menu_gradient_background
global (menus.c + menus.h) and pass mr in some way to
menuitem_paint).

                if (xft_redraw && !ST_HAS_MENU_CSET(ms) && 
                    ST_FACE(ms).type == GradientMenu &&
                    (ST_FACE(ms).gradient_type == D_GRADIENT ||
                     ST_FACE(ms).gradient_type == B_GRADIENT))
                {
                        XEvent e;

                        e.xexpose.x = MDIM_ITEM_X_OFFSET(*dim);
                        e.xexpose.y = y_offset + d;
                        e.xexpose.width = MDIM_ITEM_WIDTH(*dim);
                        e.xexpose.height = y_height + relief_thickness - d;
                        paint_menu_gradient_background(mr, &e);
                                                       ^^pbs
                }
                else
                {
                        XClearArea(
                                dpy, mpip->w, MDIM_ITEM_X_OFFSET(*dim),
                                y_offset + d, MDIM_ITEM_WIDTH(*dim),
                                y_height + relief_thickness - d,
                                0);
                }

Anyway, maybe the good solution is to paint the _all_ menu into
the background (with the selected item drawn on an additional
window). This will supress all flickering which come from
xft redrawing ...

Olivier

PS: I'am not at home for a few weeks and I've at present time some
pbs with my internet connection.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to