]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #24570: Right-click for context menus now work on Mac Aqual also.
authorTerry Jan Reedy <tjreedy@udel.edu>
Wed, 23 Sep 2015 01:10:22 +0000 (21:10 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Wed, 23 Sep 2015 01:10:22 +0000 (21:10 -0400)
Patch by Mark Roseman.

Lib/idlelib/EditorWindow.py
Lib/idlelib/PyShell.py

index 549886af5b9e6422c8f6b73b22a8bdc81fb90e2f..f9f53376abf5662a29e4256e0fe61a70d2d26ca0 100644 (file)
@@ -202,13 +202,13 @@ class EditorWindow(object):
         if macosxSupport.isAquaTk():
             # Command-W on editorwindows doesn't work without this.
             text.bind('<<close-window>>', 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("<Control-Button-1>",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("<<cut>>", self.cut)
         text.bind("<<copy>>", self.copy)
index 688ec146072217e1444a374887f567f1d16d492d..603e6522858d7ea7bb3c167984995b7bacca65e3 100755 (executable)
@@ -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', '<B2>')
+        root.unbind_class('Text', '<B2-Motion>')
+        root.unbind_class('Text', '<<PasteSelection>>')
 
     if enable_edit:
         if not (cmd or script):