The final patch obviously doesn't contain the useless call to 
gtk_widget_get_toplevel (widget);

Erwann Chenede wrote:
> Hi All,
>
>    The bug is a side effect for 6446041(poor menu text rendering in 
> 8bit mode using default nimbus theme - firefox) my original fix was to
>    reset the GC clipping area and redraw the menu background. Soffice 
> doesn't like that as it redraws the menu background each time the item 
> focus is changed.
>    The solution was first to check if we are currently rendering in 8 
> depth mode (quick check) then query for the WM_CLASS info and check if 
> the
>    application is "gecko". If so reset the GC and redraw otherwise do 
> nothing.
>
>    See patch below.
>
>       Cheers,
>
>             Erwann
>
> Index: configure.in
> ===================================================================
> --- configure.in    (revision 47)
> +++ configure.in    (working copy)
> @@ -2,7 +2,7 @@
> ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
>
> AC_INIT(metacity)
> -AM_INIT_AUTOMAKE(nimbus, 0.0.13)
> +AM_INIT_AUTOMAKE(nimbus, 0.0.14)
> DISTDIR=${PACKAGE}-${VERSION}
> AM_MAINTAINER_MODE
>
> Index: gtk-engine/nimbus_style.c
> ===================================================================
> --- gtk-engine/nimbus_style.c    (revision 47)
> +++ gtk-engine/nimbus_style.c    (working copy)
> @@ -7,6 +7,8 @@
> #include "nimbus_style.h"
> #include "nimbus_rc_style.h"
> #include "nimbus_utils.h"
> +#include <X11/Xutil.h>
> +#include <gdk/gdkx.h>
>
> static const char *const state_names[5] = {
>     "Normal",
> @@ -1699,8 +1701,24 @@
>     {
>       GdkGC *start, *mid_start, *mid_end, *end;
>       sanitize_size (window, &width, &height);
> -      gdk_gc_set_clip_rectangle (style->bg_gc[GTK_STATE_NORMAL], NULL);
> -      gdk_draw_rectangle (window, style->bg_gc[GTK_STATE_NORMAL], 
> TRUE, x,y,width-1,height-1);
> +      if (gdk_drawable_get_depth (window) == 8)
> +    {
> +      XClassHint classHint;
> +      int        status;
> +      gtk_widget_get_toplevel (widget);
> +      status = XGetClassHint (GDK_DISPLAY_XDISPLAY 
> (gtk_widget_get_display (widget)),
> +                  GDK_WINDOW_XID ( gtk_widget_get_toplevel 
> (widget)->window), &classHint);
> +      if (status)
> +        {
> +          if (strcmp (classHint.res_name, "gecko") == 0)
> +        {
> +          XFree (classHint.res_name);
> +          XFree (classHint.res_class);
> +          gdk_gc_set_clip_rectangle (style->bg_gc[GTK_STATE_NORMAL], 
> NULL);      +          gdk_draw_rectangle (window, 
> style->bg_gc[GTK_STATE_NORMAL], TRUE, x,y,width-1,height-1);
> +        }
> +        }
> +    }
>       gdk_draw_rectangle (window, nimbus_realize_color (style, 
> rc->menu->border, area), FALSE, x,y,width-1,height-1);
>       gdk_draw_line (window, nimbus_realize_color (style, 
> rc->menu->shadow, area), x + width - 2,y+1,x + width - 2,height-2);
>     
>  


-- 
              Erwann Ch?ned?,
 Desktop Group, Sun Microsystems, Grenoble
 Phone  : +33 476 188 358       ext: 38358
[ I speak for myself, not for my employer ]



Reply via email to