[AD] do_menu() and scare_mouse()

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


I just discovered that the same improvement as the one Elias applied to the 
dialog code can also be applied to the menu code: using scare_mouse_area() 
instead of scare_mouse(). This way the mouse cursor doesn't flicker any more 
when menus are navigated with the keyboard.

Patch applied (it removes the +1 that was probably related to the menus being 
overstretched, now fixed by an earlier patch from Elias).

It looks like the potential of this scare_mouse_area() function has not been 
fully understood until now...

-- 
Eric Botcazou
--- /home/eric/cvs/allegro/src/gui.c	Tue Nov 12 11:53:00 2002
+++ allegro/src/gui.c	Wed Nov 13 19:27:27 2002
@@ -1540,8 +1540,6 @@
    int ret = -1;
    ASSERT(menu);
 
-   scare_mouse();
-
    fill_menu_info(&m, menu, parent, bar, x, y, minw, minh);
 
    if (repos) {
@@ -1549,11 +1547,13 @@
       m.y = MID(0, m.y, SCREEN_H-m.h-1);
    }
 
+   scare_mouse_area(m.x, m.y, m.w, m.h);
+   
    /* save screen under the menu */
-   m.saved = create_bitmap(m.w+1, m.h+1); 
+   m.saved = create_bitmap(m.w, m.h); 
 
    if (m.saved)
-      blit(screen, m.saved, m.x, m.y, 0, 0, m.w+1, m.h+1);
+      blit(screen, m.saved, m.x, m.y, 0, 0, m.w, m.h);
    else
       *allegro_errno = ENOMEM;
 
@@ -1702,7 +1702,7 @@
       if ((redraw) || (m.sel != old_sel)) {           /* selection changed? */
          gui_timer = 0;
 
-	 scare_mouse();
+	 scare_mouse_area(m.x, m.y, m.w, m.h);
 	 acquire_screen();
 
 	 if (redraw) {
@@ -1810,8 +1809,8 @@
 
    /* restore screen */
    if (m.saved) {
-      scare_mouse();
-      blit(m.saved, screen, 0, 0, m.x, m.y, m.w+1, m.h+1);
+      scare_mouse_area(m.x, m.y, m.w, m.h);
+      blit(m.saved, screen, 0, 0, m.x, m.y, m.w, m.h);
       unscare_mouse();
       destroy_bitmap(m.saved);
    }


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