Re: [AD] multiple windows

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Thu, 2006-08-17 at 00:46 +1000, Peter Wang wrote:
> 
> There's not "one global queue", there's just one global keyboard source.
> It happens to generate a event no matter which window is focused.
> 
> As I said, the reason for just having one keyboard source is practical.
> It's a pain to keep track of all the different event sources.
> 

Can you give a more practical example? With the three windows and three
tables, it might sense to only track the tablets in the drawing tablet,
and receive separate inputs from the tool selection and color selection
windows. So in my use case, it would be practical to separate them :)

> Also, it can be that you are not using any Allegro displays at all.
> You should be able to use the Allegro keyboard routines anyway.
> And we might want to be able to track keyboard event even if *no*
> Allegro windows are focused.

Is this possible in Windows, OSX or X11? I know it would work in DOS,
but in those three you need either a window or fullscreen display I
guess - which means, you wouldn't be able to track input without first
creating an AL_DISPLAY anyway (even if only due to OS limitation
then..).

> I found a bit of discussion in [1].  (Wow, has it really been so long :-( )
> Your idea is actually slightly different, in that Allegro will track the
> keyboard-event-source-of-this-window for you, so you could always call
> al_get_keyboard(window) and forget about holding onto the pointers.
> Maybe I could live with that but I'd have to think about it more.
> 

I see. With the global key event source, each window would in its
(platform specific) event loop attach key events to the global keyboard
queue.

So yes, it shouldn't make a big difference. My view of an AL_DISPLAY
currently is that of an OS window. And I believe we also will have an
easier time when we can write in the documentation "al_create_display
basically created a window" - compared to "al_create_display creates a
target for graphics operations, which is independent of any input
devices".

> > 
> > Well, we have two windows to handle, so each has to do its own
> > XNextEvent. Do we still need a background thread in 4.3 btw?
> 
> Yes.

Ok, I also believe it's the simpler design. But my idea was, we could do
without threads if al_get_event() would call a driver method to query
for OS events. It would work on the three platforms in any case. SO,
well, maybe worth considering for a moment, right now it should not be
hard to change it - and some people think threads are evil.
(Compatibility layer would still have the thread of course, should be no
problem.)

> > 
> > Yes, the compatibility layer could create an initial dummy AL_DISPLAY in
> > allegro_init.
> 
> As I mentioned just before, it might be nice to use the Allegro input
> routines without an (Allegro) window open.
> 

Did it work in your old A5 prototype? How did you implement that? As I
see the X11 API, I need a focused window to get keyboard/mouse input.

-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/