Re: [AD] Using system mouse cursor

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


On Saturday 11 September 2004 09:20, Evert Glebbeek wrote:
> I don't get this... this is starting to get too annoying. I think I'll 
> revert to the old behavior and have a function that tries to enable the 
> hardware cursor, which has the effect of disabling reliable mickeys on 
> some platforms (ie, X11). That should hopefully clear that up...

Patch attached.

Evert
Index: include/xalleg.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/xalleg.h,v
retrieving revision 1.19
diff -u -r1.19 xalleg.h
--- include/xalleg.h	6 Sep 2004 22:52:46 -0000	1.19
+++ include/xalleg.h	13 Sep 2004 07:07:48 -0000
@@ -91,7 +91,7 @@
 
    int virtual_width;
    int virtual_height;
-
+   
    int mouse_warped;
    int keycode_to_scancode[256];
 
Index: include/allegro/mouse.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/mouse.h,v
retrieving revision 1.2
diff -u -r1.2 mouse.h
--- include/allegro/mouse.h	31 Oct 2002 12:56:24 -0000	1.2
+++ include/allegro/mouse.h	13 Sep 2004 07:07:48 -0000
@@ -44,6 +44,7 @@
    AL_METHOD(void, set_speed, (int xspeed, int yspeed));
    AL_METHOD(void, get_mickeys, (int *mickeyx, int *mickeyy));
    AL_METHOD(int,  analyse_data, (AL_CONST char *buffer, int size));
+   AL_METHOD(void,  enable_hardware_cursor, (AL_CONST int mode));
 } MOUSE_DRIVER;
 
 
@@ -57,6 +58,8 @@
 AL_FUNC(int, poll_mouse, (void));
 AL_FUNC(int, mouse_needs_poll, (void));
 
+AL_FUNC(void, enable_hardware_cursor, (AL_CONST int mode));
+
 AL_VAR(struct BITMAP *, mouse_sprite);
 AL_VAR(int, mouse_x_focus);
 AL_VAR(int, mouse_y_focus);
Index: src/mouse.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/mouse.c,v
retrieving revision 1.22
diff -u -r1.22 mouse.c
--- src/mouse.c	6 Sep 2004 08:55:30 -0000	1.22
+++ src/mouse.c	13 Sep 2004 07:07:49 -0000
@@ -736,6 +736,23 @@
 
 
 
+/* enable_hardware_cursor:
+ *  Switches the mouse to warp-mode on platforms that need this
+ */
+void enable_hardware_cursor(AL_CONST int mode)
+{
+   if ((mouse_driver) && (mouse_driver->enable_hardware_cursor)) {
+      enable_hardware_cursor(mode);
+      if (is_same_bitmap(_mouse_screen, screen)) {
+         BITMAP *bmp = _mouse_screen;
+         show_mouse(NULL);
+         show_mouse(bmp);
+      }
+   }
+}
+
+
+
 /* poll_mouse:
  *  Polls the current mouse state, and updates the user-visible information
  *  accordingly. On some drivers this is actually required to get the
Index: src/beos/bmouse.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/beos/bmouse.c,v
retrieving revision 1.3
diff -u -r1.3 bmouse.c
--- src/beos/bmouse.c	6 Nov 2001 17:16:39 -0000	1.3
+++ src/beos/bmouse.c	13 Sep 2004 07:07:49 -0000
@@ -38,5 +38,6 @@
    be_mouse_set_range,	// AL_METHOD(void, set_range, (int x1, int y1, int x2, int y2));
    be_mouse_set_speed,	// AL_METHOD(void, set_speed, (int xspeed, int yspeed));
    be_mouse_get_mickeys,// AL_METHOD(void, get_mickeys, (int *mickeyx, int *mickeyy));
-   NULL                 // AL_METHOD(int,  analyse_data, (const char *buffer, int size));
+   NULL,                // AL_METHOD(int,  analyse_data, (const char *buffer, int size));
+   NULL                 // AL_METHOD(void,  enable_hardware_cursor, (AL_CONST int mode));
 };
Index: src/dos/dmouse.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/dos/dmouse.c,v
retrieving revision 1.5
diff -u -r1.5 dmouse.c
--- src/dos/dmouse.c	6 Nov 2001 17:16:39 -0000	1.5
+++ src/dos/dmouse.c	13 Sep 2004 07:07:50 -0000
@@ -95,6 +95,7 @@
    mick_set_range,
    mick_set_speed,
    mick_get_mickeys,
+   NULL,
    NULL
 };
 
@@ -123,6 +124,7 @@
    int33_set_range,
    int33_set_speed,
    int33_get_mickeys,
+   NULL,
    NULL
 };
 
@@ -148,6 +150,7 @@
    int33_set_range,
    int33_set_speed,
    int33_get_mickeys,
+   NULL,
    NULL
 };
 
@@ -171,6 +174,7 @@
    int33_set_range,
    int33_set_speed,
    int33_get_mickeys,
+   NULL,
    NULL
 };
 
@@ -194,6 +198,7 @@
    mick_set_range,
    mick_set_speed,
    mick_get_mickeys,
+   NULL,
    NULL
 };
 
Index: src/macosx/qzmouse.m
===================================================================
RCS file: /cvsroot/alleg/allegro/src/macosx/qzmouse.m,v
retrieving revision 1.11
diff -u -r1.11 qzmouse.m
--- src/macosx/qzmouse.m	4 Jul 2004 13:44:49 -0000	1.11
+++ src/macosx/qzmouse.m	13 Sep 2004 07:07:50 -0000
@@ -46,7 +46,8 @@
    osx_mouse_set_range,
    NULL,       // AL_METHOD(void, set_speed, (int xspeed, int yspeed));
    osx_mouse_get_mickeys,
-   NULL        // AL_METHOD(int,  analyse_data, (AL_CONST char *buffer, int size));
+   NULL,       // AL_METHOD(int,  analyse_data, (AL_CONST char *buffer, int size));
+   NULL        // AL_METHOD(void,  enable_hardware_cursor, (AL_CONST int mode));
 };
 
 


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