Re: Bug 50372: Setting stipple to NULL = X error



Havoc Pennington <hp redhat com> writes:

> Jamie Strachan <frostfreek yahoo com> writes:
> > I have posted a patch under bug 50372, that simply
> > ignores NULL stipples when setting the XGC.
> > (Also did the same for tiles.)
> > 
> > This means the XGC will have the previous stipple
> > defined until such time as another non-NULL stipple is
> > specified, or the XGC is destroyed.
> > 
> > While this is probably the easiest way to solve the
> > problem of eliminating the X Error, it occurs to me
> > that this may not be what is desired.
> > 
> > The API document does not specify what happens when
> > you specify the fill style as GDK_[OPAQUE_]STIPPLED,
> > and specify a stipple of NULL.
> > I would probably file that under "UNDEFINED
> > BEHAVIOUR", which can very well mean this patch is
> > sufficient.
> > 
> 
> If NULL is not allowed, it should g_return_if_fail (GDK_IS_BITMAP
> (stipple)).
> 
> If NULL is allowed, it should mean "unset the stipple," that is, I
> think you set it to None with the Xlib API.

But the whole point is, you can't set the stipple to None with the
Xlib API. You have to change the fill mode (gdk_gc_set_fill)
to be something other than GDK_STIPPLED. But I think changing
the fill mode would be wrong in this function.

In the bug report, it suggests simulating unsetting by setting
a 1x1 solid bitmap as the stipple - this behaves equivalently
to the "unset" default for a GC. Which is probably the best
option, though less efficient than for the user to simply
set the fill mode to something else.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]