about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-27 23:55:35 +0100
committerhut <hut@lavabit.com>2009-12-27 23:55:35 +0100
commit8d0d8f9272b9ceef6b27d35580472b9c86dff681 (patch)
treeea0e08452cc7d49fb9a2f9acf2839c7ab30a4da6 /ranger
parenta666f32b959416d062ac38645dc27f20686d881b (diff)
downloadranger-8d0d8f9272b9ceef6b27d35580472b9c86dff681.tar.gz
fixed mouse-event with negative coordinates
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/mouse_event.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ranger/gui/mouse_event.py b/ranger/gui/mouse_event.py
index db98e1aa..c165ffa3 100644
--- a/ranger/gui/mouse_event.py
+++ b/ranger/gui/mouse_event.py
@@ -9,6 +9,14 @@ class MouseEvent(object):
 	def __init__(self, getmouse):
 		"""Creates a MouseEvent object from the result of win.getmouse()"""
 		_, self.x, self.y, _, self.bstate = getmouse
+
+		# x-values above ~220 suddenly became negative, apparently
+		# it's sufficient to add 0xFF to fix that error.
+		if self.x < 0:
+			self.x += 0xFF
+
+		if self.y < 0:
+			self.y += 0xFF
 	
 	def pressed(self, n):
 		"""Returns whether the mouse key n is pressed"""