On Mon, 12 Mar 2001, Christoph Egger wrote:
> On Mon, 12 Mar 2001, Jos Hulzink wrote:
>
> > I have not been able to look at the Galloc code yet (unable to reach
> > site). But, my two dollarcents:
>
> I can send you a tarball in private, if you want.
Got it now, but a recent -compiling- ggi tarball would be appreciated. I
forgot where to get it, I used to click on a link on the site :)
> I won't use anything special from XFree. Everything, that is special
> to XFree belongs in the xf86-target.
>
> X is a standard. So I want to use the standard-methods for the
> X/Xlib-target.
I understand, but my X-experience is Xfree 3 and 4 :) I'll try to find out
about "generic-X"
> > > 2. How can I check reliable, _if_ there is one more cursor available?
> > > Or can I always assume, that there is one more available?
> >
> > AFAIK it is only available at allocation time: a BadAlloc RETVAL means
> > unable to allocate cursor space. There is no HowMuchFreeSpaceLeft() call
> > or something.
>
> Wonderful! X breaks the app, when an error like this occurs! In other
> words: It is impossible to write tolerant applications, when no more
> cursor is available. One person can run it, while another can't!
> Really wonderful!
Well... in fact you can never guarantee that you can allocate all cursor,
or you must make the check and allocation SMP-safe monolythic. This
applies for any target, not only X.
Please assume for now allocation is always possible, as far as I can find
out in the Xfree code now that is a rather safe assumption. I will try to
give you a good answer.
> > > 3. Should I use XCreateGlyphCursor() or XCreateFontCursor() to create
> > > a cursor, that response to the keyboard instead to the mouse?
> >
> > Good point. In my first opinion, I'd say none of them. Use
> > XCreatePixmapCursor() instead.
>
> I already use XCreatePixmapCursor() for creating a cursor, which
> response to the mouse. But it should be also possible to allocate
> one, which responses to the keyboard or whatever else?
Hmm... why only one ? There is one with the focus, but maybe more cursors.
And maybe mouse and keyboard cursor must be one and the same sometimes ?
hmm... just typing what my brain says....
> BTW: Does X support a Joysticks? If yes, how can I create a cursor
> that responses to them?
Nope. Maybe an extension, but not by default.
> > Why ? I can imagine games want their complete own implementation
> > of a keyboard-cursor,
>
> Yes, sure. But it must be allocated before you can give it a special
> form. And the (de)allocation part is the job of libGAlloc.
Jup, but giving a form is something else with pixmaps or characters :) How
to deal with that...
> > and with GlyphCursor they would be too limited in options.
> >
> > But the question was: Glyph or Font. I'd say Glyph then, eventually with a
> > shape to char conversion system. Reason: greater flexability in font and
> > colours. IMHO forcing the user to use the X Cursor font could never be the
> > goal of a flexible lib like this.
>
> OK.
>
> > > 4. When a buffer is stored on disk, should I emulate MMIO -access by
> > > using mmap() or should I use filedescriptors?
> >
> > Question not understood. I think a disk-buffer should be implemented like
> >
> > fd=fopen ('mydir/mybuf.fer');
> > buf=mmap (...fd...);
> >
> > using a filedescriptor AND mmap
>
> That is what I want to say with "emulation MMIO-access by using
> mmap()". With "using _only_ filedescriptors" I mean something like
> this:
> fd = open("mydir/mybuf.fer", O_CREATE | O_TRUNC | O_RDWR,0600);
> size = read(fd, buf, count);
> ...
> size = write(fd, buf, count);
> ...
> close(fd);
> You see, what I mean?
Yup. Think mmap is more flexible (one buffer with more items is hard to do
with the second implementation.)
Jos