Re: [AD] X hardware cursors fix

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


On Sun, 2005-03-20 at 01:47 +1100, Peter Wang wrote: 
> I think something like it is probably needed, but not sure about the 
> semantics.  Didn't look at it that much yet.

My main concern is the way how you need to display Allegro's software
cursor just to know if a HW cursor is available. But this is actually
connected to having to query gfx_capabilities..

> >Oh, and I'm more and more wondering about the rationale behind using
> >gfx_capabilities for the mouse flags.. it's the moue driver after all
> >who has the hardware cursor methods, not the gfx driver. 
> >
> 
> Actually, it's the other way around (or should be).
> 
> I don't like gfx_capabilities & GFX_SYSTEM_CURSOR though.  
> "Capabilities" should be about the gfx driver's potential, not what it 
> is doing at present.  Of course, gfx_capabilities & 
> GFX_CAN_TRIPLE_BUFFER and gfx_capabilities & GFX_HW_CURSOR violate this 
> already.

Yes, I see. So we would have a static field in each driver with its
capabilities. Having GFX_CAN_TRIPLE_BUFFER in there would merely tell if
the driver can principally do it, not if it is currently enabled.

GFX_CAN_TRIPLE_BUFFER we can't change for 4.2.0, because it already was
in 4.0.0. But GFX_HW_CURSOR and GFX_SYSTEM_CURSOR we could still fix.

What about this:

Add show_os_cursor(), so in the case where the user just wants a HW/OS
cursor, there is no confusion. A simple return value tells if it
suceeded or not. No need for any flags, since Allegro isn't in any way
involved into drawing the mouse.

The show_mouse API, OTOH, means Allegro takes over mouse drawing. But
since the user must be prepared for the software mouse in any case, what
if we simply drop these 3 functions:

enable_hardware_cursor/disable_hardware_cursor/select_mouse_cursor

- Then we don't need the two flags anymore.
- There is no loss of functionality (use show_os_cursor).
- User code gets simpler. (In the case show_mouse is used and drawing is
done to screen, instead of "enable_hardware_mouse();show_mouse();", you
call "if (show_os_cursor(...)) show_mouse();". In the other 99% of uses
where double_buffering/page_flipping and the likes is used, it gets much
simpler of course, since you don't need show_mouse and querying of the
capabilities flag.)
- Our mouse documentation would be much more understandable. (No more:
Note: this function only has an effect after calling that other
functions, but before checking that and that flag :P)

-- 
Elias Pschernig





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