Skip to content

Commit

Permalink
Fix key binding on OSX (#1074)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scroogeee authored Jul 8, 2024
1 parent 8de6846 commit 1ef147d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions amulet_map_editor/api/wx/util/key_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,21 @@ def __init__(self, parent: wx.Window, action: str):

self._key = ((), "NONE")

self.Bind(wx.EVT_LEFT_DOWN, self._on_key)
self.Bind(wx.EVT_MIDDLE_DOWN, self._on_key)
self.Bind(wx.EVT_RIGHT_DOWN, self._on_key)
self.Bind(wx.EVT_KEY_DOWN, self._on_key)
self.Bind(wx.EVT_MOUSEWHEEL, self._on_key)
self.Bind(wx.EVT_MOUSE_AUX1_DOWN, self._on_key)
self.Bind(wx.EVT_MOUSE_AUX2_DOWN, self._on_key)
panel = wx.Panel(self)
panel.SetFocus()

panel.Bind(wx.EVT_LEFT_DOWN, self._on_key)
panel.Bind(wx.EVT_MIDDLE_DOWN, self._on_key)
panel.Bind(wx.EVT_RIGHT_DOWN, self._on_key)
panel.Bind(wx.EVT_KEY_DOWN, self._on_key)
panel.Bind(wx.EVT_MOUSEWHEEL, self._on_key)
panel.Bind(wx.EVT_MOUSE_AUX1_DOWN, self._on_key)
panel.Bind(wx.EVT_MOUSE_AUX2_DOWN, self._on_key)

sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(panel, 1, wx.EXPAND)
self.SetSizer(sizer)
self.Layout()

def _on_key(self, evt):
key = serialise_key_event(evt)
Expand Down

0 comments on commit 1ef147d

Please sign in to comment.