[AD] GUI kills OS cursor

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


While playing around with my double-buffered dialogs (used gui_set_screen to set a memory buffer, then used a custom proc to blit it to the screen), I added the use of the OS cursor for smoother movement by calling show_os_cursor. However, I noticed that once I quit the first dialog and went into another one, I'd be back to use the software cursor.

I looked through gui.c and mouse.c, but I'm honestly not sure what the problem is. do_dialog checks if the mouse is being shown on the GUI bitmap (in my program, it is not), and if not, it sets the mouse to the GUI bitmap. Then, after the dialog quits, it sets the mouse back to the previous bitmap.

Now, my theory is that setting the OS cursor sets _mouse_screen to NULL, and the subsequent call to show_mouse(gui_bmp) is ignored (you still get the OS cursor). However, after the dialog exits, it calls show_mouse(mouse_screen), and if _mouse_screen was NULL, it'll effectively and ungratiously kill the OS cursor when it tries to "restore" the mouse to the previous bitmap.

If that happens to be the case, the attached patch should fix the problem. If that's not the case, or if there's an unforeseen side-effect of this change, then I'm not sure what to do...
Index: src/gui.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/gui.c,v
retrieving revision 1.73
diff -u -r1.73 gui.c
--- src/gui.c	31 Mar 2005 22:31:19 -0000	1.73
+++ src/gui.c	4 Apr 2005 21:45:42 -0000
@@ -792,7 +792,7 @@
          rest(1);
    }
 
-   if (_gfx_mode_set_count == screen_count)
+   if (_gfx_mode_set_count == screen_count && !(gfx_capabilities&GFX_HW_CURSOR))
       show_mouse(mouse_screen);
 
    return shutdown_dialog(player);


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