On 17 Nov 2000, Marcus Sundberg wrote:

> [EMAIL PROTECTED] (Christoph Egger) writes:
> 
> > On 17 Nov 2000, Marcus Sundberg wrote:
> > > > diff -uNr 20001115/degas/lib/libggi/extensions/misc/display/X/init.c 
>degas/lib/libggi/extensions/misc/display/X/init.c
> > > > --- 20001115/degas/lib/libggi/extensions/misc/display/X/init.c  Tue Apr 25 
>07:07:28 2000
> > > > +++ degas/lib/libggi/extensions/misc/display/X/init.c   Fri Nov 17 13:35:06 
>2000
> > > > @@ -62,7 +62,7 @@
> > > >  
> > > >         me->setsplitline = GGI_x_setsplitline;
> > > >  
> > > > -       *dlret = GGI_DL_EXTENSION;
> > > > +       *dlret = GGI_DL_OPDISPLAY;
> > > >         return 0;
> > > >  }
> > > 
> > > No, where did you get this idea?
> > 
> > On Tue, 7 Nov 2000, Jon M. Taylor wrote to me in a PM:
> > -------------------------------------------------------------------------
> > > I hacked libxmi since two days.
> > > The demos runs without segfaults.
> > 
> >         MUCH better!  I too got it to run without segfaults, and the X
> > target code looks OK.  Nice job!
> 
> At a quick glance the code looks completely bogus, I'll have a look at
> it this weekend. The extension-segfault problems are the major reason
> why I said the extension system should be re-designed a while ago.

I am just trying to get the X-target working. XMI_X_getapi() is called for some
days. But XMI_X_setmode() not. Jon said, that this _have_ to happen to
replace the drawing functions with the ones of the X-target.

I solved that by changing a demo of libxmi: I moved xmiAttach(), so
that ggiSetMode() is called _after_ xmiAttach(). But then I got segfaults. Jon
said to me, that this is the wrong way. So I redid this.

Just a few minutes ago, I got the first success:

I hooked the XMI_X_fillpolygon() in XMI_X_getapi(). XMI_X_fillpolygon() is now
called instead of the stubs one. Unfortunetly, it results in an X-error:

---------------------------------------------------------------------------
X error of failed request: BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request: 69 (X_FillPoly)
  Resource id in failed request: 0x1
  Serial number of failed request: 227
  Current serial number in output stream: 228
---------------------------------------------------------------------------

I think, that this is caused by an wrong argument.


BTW: I also found an (design) bug: Both the stubs code and the x-target-code
uses it's own private data-field allocated with malloc(). The pointer returned
by malloc() is stored in LIBGGI_XMIEXT(vis)->priv.

In other words: Both the default-stubs-target and the x-target overwrite
themself causing memory-leaks...


 
> [snip]
> 
> > > I did the hack in the X-target as you said.
> > > The XMI_X_getapi() is called, but not the XMI_X_setmode() one.
> > > I don't know why. Maybe I got you wrong in some aspects you gave?
> > >
> > > Patch is attached. Please have a look at it and give me feedback.
> > 
> >         The problem is that your GGIopen() function is returning
> > GGI_DL_EXTENSION, when it should be returning GGI_DL_OPDISPLAY.  This
> > return type tells GGI what type of library it is, so it knows what actions
> > to take.  The X-target is a display target, not an extension.
> 
> Extension sublibs are are always extensionsublibs and should return
> GGI_DL_EXTENSION. If they change any pointers in vis->opdisplay
> they should *also* return GGI_DL_OPDISPLAY. Note that the return is
> a mask.
> 
> > -------------------------------------------------------------------------
> > 
> > 
> > > GGI_DL_EXTENSION is correct.
> > 
> > In the misc extension or in the libedemo?
> 
> Both, as neither touch anything in vis->opdisplay.

So the correct solution for both is:

        return (GGI_DL_EXTENSION | GGI_DL_OPDISPLAY)

Right?


Christoph Egger
E-Mail: [EMAIL PROTECTED]


Reply via email to