Re: [AD] Windows mouse patch |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Monday 25 October 2004 10:00, Peter Wang wrote:
> Can you post it here?
I swear, one of these days I'm going to change the source to my mail
program to make it ask if I want to attach anything before sending.
Attached.
Evert
Index: src/win/wmouse.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/win/wmouse.c,v
retrieving revision 1.37
diff -u -r1.37 wmouse.c
--- src/win/wmouse.c 20 Oct 2004 20:03:31 -0000 1.37
+++ src/win/wmouse.c 24 Oct 2004 20:56:51 -0000
@@ -92,8 +92,8 @@
#define MAF_DEFAULT 1 /* mouse acceleration parameters */
static int mouse_accel_fact = MAF_DEFAULT;
static int mouse_accel_mult = MAF_DEFAULT;
-static int mouse_accel_thr1 = 5;
-static int mouse_accel_thr2 = 16;
+static int mouse_accel_thr1 = 50; /* 50 = 5^2 *2 */
+static int mouse_accel_thr2 = 512; /* 512 = 16^2 *2 */
static int mouse_minx = 0; /* mouse range */
static int mouse_miny = 0;
@@ -213,9 +213,10 @@
case DIMOFS_X:
if (!gfx_driver || !gfx_driver->windowed) {
if (mouse_accel_mult) {
- if (ABS(data) >= mouse_accel_thr2)
+ int mag = last_mickeyx*last_mickeyx + last_mickeyy*last_mickeyy;
+ if (mag >= mouse_accel_thr2)
data *= (mouse_accel_mult<<1);
- else if (ABS(data) >= mouse_accel_thr1)
+ else if (mag >= mouse_accel_thr1)
data *= mouse_accel_mult;
}
@@ -226,9 +227,10 @@
case DIMOFS_Y:
if (!gfx_driver || !gfx_driver->windowed) {
if (mouse_accel_mult) {
- if (ABS(data) >= mouse_accel_thr2)
+ int mag = last_mickeyx*last_mickeyx + last_mickeyy*last_mickeyy;
+ if (mag >= mouse_accel_thr2)
data *= (mouse_accel_mult<<1);
- else if (ABS(data) >= mouse_accel_thr1)
+ else if (mag >= mouse_accel_thr1)
data *= mouse_accel_mult;
}
@@ -427,6 +429,8 @@
DWORD level;
if (mouse_dinput_device) {
+ static int last_mickeyx=0;
+ static int last_mickeyy=0;
/* necessary in order to set the cooperative level */
mouse_dinput_unacquire();
@@ -469,6 +473,7 @@
int mouse_set_syscursor(void)
{
if ((mouse_dinput_device && _mouse_on) || (gfx_driver && !gfx_driver->windowed)) {
+ last_mickeyx = data;
SetCursor(_win_hcursor);
/* Make sure the cursor is removed by the system. */
PostMessage(allegro_wnd, WM_MOUSEMOVE, 0, 0);
@@ -482,6 +487,7 @@
/* mouse_set_sysmenu: [window thread]
+ last_mickeyy = data;
* Changes the state of the mouse when going to/from sysmenu mode.
*/
int mouse_set_sysmenu(int state)