From: Terry Jan Reedy Date: Wed, 23 Sep 2015 01:10:22 +0000 (-0400) Subject: Issue #24570: Right-click for context menus now work on Mac Aqual also. X-Git-Tag: v2.7.11rc1~128 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ca33d56f005589967d5b3d77aa807270d5c376ed;p=thirdparty%2FPython%2Fcpython.git Issue #24570: Right-click for context menus now work on Mac Aqual also. Patch by Mark Roseman. --- diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 549886af5b9e..f9f53376abf5 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -202,13 +202,13 @@ class EditorWindow(object): if macosxSupport.isAquaTk(): # Command-W on editorwindows doesn't work without this. text.bind('<>', self.close_event) - # Some OS X systems have only one mouse button, - # so use control-click for pulldown menus there. - # (Note, AquaTk defines <2> as the right button if - # present and the Tk Text widget already binds <2>.) + # Some OS X systems have only one mouse button, so use + # control-click for popup context menus there. For two + # buttons, AquaTk defines <2> as the right button, not <3>. text.bind("",self.right_menu_event) + text.bind("<2>", self.right_menu_event) else: - # Elsewhere, use right-click for pulldown menus. + # Elsewhere, use right-click for popup menus. text.bind("<3>",self.right_menu_event) text.bind("<>", self.cut) text.bind("<>", self.copy) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 688ec1460722..603e6522858d 100755 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -1556,6 +1556,14 @@ def main(): root.withdraw() flist = PyShellFileList(root) macosxSupport.setupApp(root, flist) + + if macosxSupport.isAquaTk(): + # There are some screwed up <2> class bindings for text + # widgets defined in Tk which we need to do away with. + # See issue #24801. + root.unbind_class('Text', '') + root.unbind_class('Text', '') + root.unbind_class('Text', '<>') if enable_edit: if not (cmd or script):