From 928aec618d2aadc2141c4ddf52b533d15f859f6a Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 5 May 2009 22:41:02 +0000 Subject: [PATCH] better handle touchscreens --- panda/src/tform/mouseWatcher.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/panda/src/tform/mouseWatcher.cxx b/panda/src/tform/mouseWatcher.cxx index 473de6fcc6..9dff3f51e7 100644 --- a/panda/src/tform/mouseWatcher.cxx +++ b/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) {