Browse Source

better handle touchscreens

David Rose 16 years ago
parent
commit
928aec618d
1 changed files with 9 additions and 5 deletions
  1. 9 5
      panda/src/tform/mouseWatcher.cxx

+ 9 - 5
panda/src/tform/mouseWatcher.cxx

@@ -1409,11 +1409,7 @@ do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input,
   output.set_data(_pixel_size_output, pixel_size);
   _pixel_size = pixel_size;
 
-  if (!input.has_data(_xy_input)) {
-    // No mouse in the window.
-    set_no_mouse();
-
-  } else {
+  if (input.has_data(_xy_input)) {
     // The mouse is within the window.  Get the current mouse position.
     const EventStoreVec2 *xy, *pixel_xy;
     DCAST_INTO_V(xy, input.get_data(_xy_input).get_ptr());
@@ -1570,6 +1566,14 @@ do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input,
     }
   }
 
+  if (!input.has_data(_xy_input)) {
+    // No mouse in the window.  We check this down here, below the
+    // button checking, in case the mouse left the window in the same
+    // frame it released a button (particularly likely with a
+    // touchscreen input that's emulating a mouse).
+    set_no_mouse();
+  }
+
   // Now check the inactivity timer.
   if (_has_inactivity_timeout) {
     if (activity) {