[aseprite] 232/308: Remove mouse speed modifications from Allegro4/X11 port

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:45:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 7b8b2dae53e8fd374a426f3b7ace6a1746713d82
Author: David Capello <davidcapello at gmail.com>
Date:   Fri Feb 12 18:56:15 2016 -0300

    Remove mouse speed modifications from Allegro4/X11 port
    
    This might be related to #957
---
 src/allegro/src/x/xmouse.c | 90 +---------------------------------------------
 src/allegro/src/x/xwin.c   |  2 --
 src/allegro/src/x/xwin.h   |  4 ---
 3 files changed, 1 insertion(+), 95 deletions(-)

diff --git a/src/allegro/src/x/xmouse.c b/src/allegro/src/x/xmouse.c
index e47588f..60b6c68 100644
--- a/src/allegro/src/x/xmouse.c
+++ b/src/allegro/src/x/xmouse.c
@@ -45,21 +45,15 @@ static int mouse_mult = -1;       /* mouse acceleration multiplier */
 static int mouse_div = -1;        /* mouse acceleration divisor */
 static int mouse_threshold = -1;  /* mouse acceleration threshold */
 
-static int last_xspeed = -1;      /* latest set_mouse_speed() settings */
-static int last_yspeed = -1;
-
 
 
 static int _xwin_mousedrv_init(void);
 static void _xwin_mousedrv_exit(void);
 static void _xwin_mousedrv_position(int x, int y);
 static void _xwin_mousedrv_set_range(int x1, int y1, int x2, int y2);
-static void _xwin_mousedrv_set_speed(int xspeed, int yspeed);
 static void _xwin_mousedrv_get_mickeys(int *mickeyx, int *mickeyy);
 static int _xwin_select_system_cursor(AL_CONST int cursor);
 
-static void _xwin_set_mouse_speed(int xspeed, int yspeed);
-
 static MOUSE_DRIVER mouse_xwin =
 {
    MOUSE_XWINDOWS,
@@ -72,7 +66,7 @@ static MOUSE_DRIVER mouse_xwin =
    NULL,
    _xwin_mousedrv_position,
    _xwin_mousedrv_set_range,
-   _xwin_mousedrv_set_speed,
+   NULL,
    _xwin_mousedrv_get_mickeys,
    NULL,
    _xwin_enable_hardware_cursor,
@@ -127,9 +121,6 @@ static int _xwin_mousedrv_init(void)
    num_buttons = _xwin_get_pointer_mapping(map, sizeof(map));
    num_buttons = CLAMP(2, num_buttons, 3);
 
-   last_xspeed = -1;
-   last_yspeed = -1;
-
    XLOCK();
 
    _xwin_mouse_interrupt = _xwin_mousedrv_handler;
@@ -206,23 +197,6 @@ static void _xwin_mousedrv_set_range(int x1, int y1, int x2, int y2)
 
 
 
-/* _xwin_mousedrv_set_speed:
- *  Sets the speed of the mouse cursor.  We don't set the speed if the cursor
- *  isn't in the window, but we remember the setting so it will be set the
- *  next time the cursor enters the window.
- */
-static void _xwin_mousedrv_set_speed(int xspeed, int yspeed)
-{
-   if (_mouse_on) {
-      _xwin_set_mouse_speed(xspeed, yspeed);
-   }
-
-   last_xspeed = xspeed;
-   last_yspeed = yspeed;
-}
-
-
-
 /* _xwin_mousedrv_get_mickeys:
  *  Reads the mickey-mode count.
  */
@@ -278,65 +252,3 @@ static int _xwin_select_system_cursor(AL_CONST int cursor)
 
    return cursor;
 }
-
-
-
-/* _xwin_set_mouse_speed:
- *  The actual function that sets the speed of the mouse cursor.
- *  Each step slows down or speeds the mouse up by 0.5x.
- */
-static void _xwin_set_mouse_speed(int xspeed, int yspeed)
-{
-   int speed;
-   int hundredths;
-
-   XLOCK();
-
-   if (mouse_mult < 0)
-      XGetPointerControl(_xwin.display, &mouse_mult, &mouse_div,
-         &mouse_threshold);
-
-   speed = MAX(1, (xspeed + yspeed) / 2);
-
-   if (mouse_div == 0)
-      hundredths = mouse_mult * 100;
-   else
-      hundredths = (mouse_mult * 100 / mouse_div);
-   hundredths -= (speed - 2) * 50;
-   if (hundredths < 0)
-      hundredths = 0;
-
-   XChangePointerControl(_xwin.display, 1, 1, hundredths,
-      100, mouse_threshold);
-
-   XUNLOCK();
-}
-
-
-
-/* _xwin_mouse_leave_notify:
- *  Reset the mouse speed to its original value when the cursor leave the
- *  Allegro window.
- */
-void _xwin_mouse_leave_notify(void)
-{
-   if (mouse_mult >= 0) {
-      XLOCK();
-      XChangePointerControl(_xwin.display, 1, 1, mouse_mult,
-         mouse_div, mouse_threshold);
-      XUNLOCK();
-   }
-}
-
-
-
-/* _xwin_mouse_enter_notify:
- *  Restore the mouse speed setting when the mouse cursor re-enters the
- *  Allegro window.
- */
-void _xwin_mouse_enter_notify(void)
-{
-   if (last_xspeed >= 0) {
-      _xwin_set_mouse_speed(last_xspeed, last_yspeed);
-   }
-}
diff --git a/src/allegro/src/x/xwin.c b/src/allegro/src/x/xwin.c
index 0369539..bc195db 100644
--- a/src/allegro/src/x/xwin.c
+++ b/src/allegro/src/x/xwin.c
@@ -2428,7 +2428,6 @@ static void _xwin_private_process_event(XEvent *event)
       case EnterNotify:
          /* Mouse entered window.  */
          _mouse_on = TRUE;
-         _xwin_mouse_enter_notify();
          mouse_savedx = event->xcrossing.x;
          mouse_savedy = event->xcrossing.y;
          mouse_was_warped = 0;
@@ -2446,7 +2445,6 @@ static void _xwin_private_process_event(XEvent *event)
          _mouse_on = FALSE;
          if (_xwin_mouse_interrupt)
             (*_xwin_mouse_interrupt)(0, 0, 0, 0, mouse_buttons);
-         _xwin_mouse_leave_notify();
          break;
       case Expose:
          /* Request to redraw part of the window.  */
diff --git a/src/allegro/src/x/xwin.h b/src/allegro/src/x/xwin.h
index 7f5f41d..0acca89 100644
--- a/src/allegro/src/x/xwin.h
+++ b/src/allegro/src/x/xwin.h
@@ -79,8 +79,4 @@ AL_FUNC(void, _xwin_keyboard_handler, (XKeyEvent *event, int dga2_hack));
 AL_FUNC(void, _xwin_get_keyboard_mapping, (void));
 AL_FUNC(void, _xwin_keyboard_focus_handler, (XFocusChangeEvent *event));
 
-/* Defined in xmouse.c. */
-AL_FUNC(void, _xwin_mouse_leave_notify, (void));
-AL_FUNC(void, _xwin_mouse_enter_notify, (void));
-
 #endif /* !__bma_xwin_h */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list