Skip to content

Commit

Permalink
fix parsing of symbols using python3: strings vs bytes
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@22364 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 9, 2019
1 parent 3511993 commit 8b9dea3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/xpra/x11/bindings/keyboard_bindings.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,15 @@ cdef class _X11KeyboardBindings(_X11CoreBindings):
s = strtobytes(symbol)
keysym = XStringToKeysym(s)
if keysym==NoSymbol:
if symbol.startswith("U+"):
symbol = "0x"+symbol[2:]
if symbol.lower().startswith("0x"):
if s.startswith("U+"):
s = "0x"+s[2:]
if s.lower().startswith("0x"):
return int(symbol, 16)
if len(symbol)>0 and symbol[0] in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]:
return int(symbol)
if len(s)>0:
try:
return int(s)
except ValueError:
pass
return NoSymbol
return keysym

Expand Down

0 comments on commit 8b9dea3

Please sign in to comment.