Re: [AD] Using system mouse cursor

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


Evert Glebbeek wrote:
Except that the term hardware cursor is already used by Allegro in the sense in which I used it and the term system cursors was not yet defined. So the distinction is in that sense historical.

The only distinction should be which cursor the mouse driver sets (the Allegro default or system default).

If the system has no default cursor, wouldn't there be no system cursor(s) to draw?

Allegro draws its own default cursor (the black arrow or the black watch) in that case, with the current setup. To be honest, I'd rather have it fail outright when a system cursor is requested that isn't available instead of switching back to a soft cursor.

If Allegro can't set a system cursor, no it shouldn't switch back to a software cursor. It should switch to a custom hardware cursor, using Allegro's default cursors.

But Allegro itself would never draw system or (custom) hardware cursors.

See above. Allegro draws its own default cursor as a system cursor if there is no real system cursor to draw.

In that case it should use Allegro's default cursors as hardware cursors, so that you still get a "default" cursor (the system's if it has one, or Allegro's) done by the OS/hardware.

At the API level, there are two other types of cursor: custom and system.

Why are these seperate at the API level? The only way to get a system cursor is to pass NULL to set_mouse_cursor, but this can still give you a custom cursor if a system one isn't available. How does/why should the API differ past that?

Custom cursors are typically soft cursors, although some drivers can use a hard cursor to display a custom cursor shape. This is the only cursor type that existed in Allegro upto now. System cursors are typically hard cursors where the shape is determined by the OS, except when the driver does not offer this functionality: then they are soft cursors drawn by Allegro with their shape determined by Allegro.

I think you're over-analyzing it. Custom cursors are done in software, unless the mouse driver can put them into hardware/the OS (and the appropriate function has been called). If a NULL cursor bitmap has been set to use, it selects a system cursor if available, or else it uses Allegro's default (in hardware).

So the difference between using a system cursor or custom hardware cursor is just what bitmap is set (NULL or not) and what the mouse driver supports. Allegro itself shouldn't differentiate beyond that.

It would be a lot easier if system cursors are always hard cursors (meaning that Allegro will never try to draw its own).

Allegro shouldn't. If someone calls enable_hardware_mouse() then set_mouse_cursor(MOUSE_CURSOR_ARROW, bitmap), this is how Allegro would attempt to set it up when select_mouse_cursor(MOUSE_CURSOR_ARROW) is called:

* If bitmap is NULL, try to set a system cursor (done by the OS/hardware).
* If that fails/isn't available/bitmap isn't NULL, try to set a custom hardware cursor using bitmap (if not NULL) or Allegro's default.
* If that fails (shouldn't if bitmap is NULL), set a software cursor.

- Kitty Cat




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