[AD] Touchscreen patch

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


My touchscreen seems to add a mouse down and a mouse up event at the
same time when tapping. The current code under Windows has all
events being processed and then update_mouse() being called
afterwards. All this patch does is put the update_mouse() calls into
the loop so its called with every mouse event (so the mouse down
isn't missed). The touchscreen now works in my allegro app and the
regular mouse seems unaffected. Please, if someone could review the
patch that knows more about the mouse driver.

Trent :{)>
Index: src/win/wmouse.c
===================================================================
--- src/win/wmouse.c	(revision 10152)
+++ src/win/wmouse.c	(working copy)
@@ -339,53 +339,53 @@
       for (i = 0; i < waiting_messages; i++) {
          mouse_dinput_handle_event(message_buffer[i].dwOfs,
                                    message_buffer[i].dwData);
-      }
 
-      if (gfx_driver && gfx_driver->windowed) {
-         /* windowed input mode */
-         if (!wnd_sysmenu) {
-            POINT p;
+         if (gfx_driver && gfx_driver->windowed) {
+            /* windowed input mode */
+            if (!wnd_sysmenu) {
+               POINT p;
 
-            READ_CURSOR_POS(p);
+               READ_CURSOR_POS(p);
 
-            mymickey_x += p.x - mymickey_ox;
-            mymickey_y += p.y - mymickey_oy;
+               mymickey_x += p.x - mymickey_ox;
+               mymickey_y += p.y - mymickey_oy;
 
-            mymickey_ox = p.x;
-            mymickey_oy = p.y;
+               mymickey_ox = p.x;
+               mymickey_oy = p.y;
 
-            _handle_mouse_input();
+               _handle_mouse_input();
+            }
          }
-      }
-      else {
-         /* fullscreen input mode */
-         mymickey_x += dinput_x - mymickey_ox;
-         mymickey_y += dinput_y - mymickey_oy;
+         else {
+            /* fullscreen input mode */
+            mymickey_x += dinput_x - mymickey_ox;
+            mymickey_y += dinput_y - mymickey_oy;
 
-         mymickey_ox = dinput_x;
-         mymickey_oy = dinput_y;
+            mymickey_ox = dinput_x;
+            mymickey_oy = dinput_y;
 
-         _mouse_x = MICKEY_TO_COORD_X(mouse_mx + dinput_x);
-         _mouse_y = MICKEY_TO_COORD_Y(mouse_my + dinput_y);
+            _mouse_x = MICKEY_TO_COORD_X(mouse_mx + dinput_x);
+            _mouse_y = MICKEY_TO_COORD_Y(mouse_my + dinput_y);
 
-         if ((_mouse_x < mouse_minx) || (_mouse_x > mouse_maxx) ||
-             (_mouse_y < mouse_miny) || (_mouse_y > mouse_maxy)) {
+            if ((_mouse_x < mouse_minx) || (_mouse_x > mouse_maxx) ||
+                (_mouse_y < mouse_miny) || (_mouse_y > mouse_maxy)) {
 
-            _mouse_x = MID(mouse_minx, _mouse_x, mouse_maxx);
-            _mouse_y = MID(mouse_miny, _mouse_y, mouse_maxy);
+               _mouse_x = MID(mouse_minx, _mouse_x, mouse_maxx);
+               _mouse_y = MID(mouse_miny, _mouse_y, mouse_maxy);
 
-            mouse_mx = COORD_TO_MICKEY_X(_mouse_x);
-            mouse_my = COORD_TO_MICKEY_Y(_mouse_y);
+               mouse_mx = COORD_TO_MICKEY_X(_mouse_x);
+               mouse_my = COORD_TO_MICKEY_Y(_mouse_y);
 
-            CLEAR_MICKEYS();
-         }
+               CLEAR_MICKEYS();
+            }
 
-         if (!_mouse_on) {
-            _mouse_on = TRUE;
-            wnd_schedule_proc(mouse_set_syscursor);
+            if (!_mouse_on) {
+               _mouse_on = TRUE;
+               wnd_schedule_proc(mouse_set_syscursor);
+            }
+
+            _handle_mouse_input();
          }
-
-         _handle_mouse_input();
       }
    }
 }


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