Skip to content

Commit

Permalink
#1157: reverse horizontal scrolling on macos (with env var to toggle)
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@18137 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jan 24, 2018
1 parent 591d7bc commit 6abcee1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def add_legacy_names(codecs):
TITLE_CLOSEEXIT = os.environ.get("XPRA_TITLE_CLOSEEXIT", "Xnest").split(",")

SKIP_DUPLICATE_BUTTON_EVENTS = envbool("XPRA_SKIP_DUPLICATE_BUTTON_EVENTS", True)
REVERSE_HORIZONTAL_SCROLLING = envbool("XPRA_REVERSE_HORIZONTAL_SCROLLING", OSX)


DRAW_TYPES = {bytes : "bytes", str : "bytes", tuple : "arrays", list : "arrays"}
Expand Down Expand Up @@ -1254,6 +1255,8 @@ def wheel_event(self, wid, deltax=0, deltay=0, deviceid=0):
#this is a different entry point for mouse wheel events,
#which provides finer grained deltas (if supported by the server)
#accumulate deltas:
if REVERSE_HORIZONTAL_SCROLLING:
deltax = -deltax
self.wheel_deltax += deltax
self.wheel_deltay += deltay
button = self.wheel_map.get(6+int(self.wheel_deltax>0)) #RIGHT=7, LEFT=6
Expand All @@ -1262,7 +1265,7 @@ def wheel_event(self, wid, deltax=0, deltay=0, deviceid=0):
button = self.wheel_map.get(5-int(self.wheel_deltay>0)) #UP=4, DOWN=5
if button>0:
self.wheel_deltay = self.send_wheel_delta(wid, button, self.wheel_deltay, deviceid)
log("wheel_delta%s new deltas=%s,%s", (wid, deltax, deltay, deviceid), self.wheel_deltax, self.wheel_deltay)
log("wheel_event%s new deltas=%s,%s", (wid, deltax, deltay, deviceid), self.wheel_deltax, self.wheel_deltay)

def send_button(self, wid, button, pressed, pointer, modifiers, buttons, *args):
pressed_state = self._button_state.get(button, False)
Expand Down

0 comments on commit 6abcee1

Please sign in to comment.