Re: Bug 50372: Setting stipple to NULL = X error
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Cc: Jamie Strachan <frostfreek yahoo com>
- Subject: Re: Bug 50372: Setting stipple to NULL = X error
- Date: 26 Mar 2001 14:58:02 -0500
Jamie Strachan <frostfreek yahoo com> writes:
> http://bugzilla.gnome.org/show_bug.cgi?id=50372
>
> Alright, I have patched this to clear the X GC stipple/tile when a NULL is specified.
Hmmm, a neat trick.
But if we are going this route, wouldn't it be better to simply
do, instead of:
===
if (copyclear_mask)
{
GC temp;
temp = XCreateGC(GDK_GC_XDISPLAY(gc), GDK_ROOT_WINDOW(), 0, &xvalues);
g_return_if_fail(temp != NULL);
/* Copy everything except Null-stipple and/or null-tile */
XCopyGC(GDK_GC_XDISPLAY(gc), GDK_GC_XGC (gc), ~copyclear_mask, temp);
/* overwrite the GC with the stipple-less copy... */
XCopyGC(GDK_GC_XDISPLAY(gc), temp, ~0, GDK_GC_XGC (gc));
XFreeGC(GDK_GC_XDISPLAY(gc), temp);
xvalues_mask &= ~copyclear_mask;
}
===
Simply:
===
if (copyclear_mask)
{
GC temp;
temp = XCreateGC(GDK_GC_XDISPLAY(gc), GDK_ROOT_WINDOW(), 0, &xvalues);
XCopyGC(GDK_GC_XDISPLAY(gc), temp, copyclear_mask, GDK_GC_XGC(gc));
XFreeGC(GDK_GC_XDISPLAY(gc), temp);
xvalues_mask &= ~copyclear_mask;
}
===
(I'd avoid the g_return_if_fail() here - g_return_if_fail() is
supposed to be used for catching programmer errors.
Either you should you do nothing/g_assert() if you think the failure
will never ever happen, or you should handle it.
In this case, we assume throughout GDK that calls like XCreateGC
will always succeed.)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]