about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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"""