summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2015-09-23 01:10:27 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2015-09-23 01:10:27 (GMT)
commit3c7eccd0a64e4a2c76a06c5cc2001e934bf4a86a (patch)
tree4d0ae65edab357b349873d32b3cceeba27aa1791
parent8f278f166255bb02dbee21e98689bb2fed58b3df (diff)
downloadcpython-3c7eccd0a64e4a2c76a06c5cc2001e934bf4a86a.zip
cpython-3c7eccd0a64e4a2c76a06c5cc2001e934bf4a86a.tar.gz
cpython-3c7eccd0a64e4a2c76a06c5cc2001e934bf4a86a.tar.bz2
Issue #24570: Right-click for context menus now work on Mac Aqual also.
Patch by Mark Roseman.
-rw-r--r--Lib/idlelib/EditorWindow.py10
-rwxr-xr-xLib/idlelib/PyShell.py8
2 files changed, 13 insertions, 5 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 496eecd..dacb843 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -175,13 +175,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)
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 90fc689..4a68b19 100755
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1547,6 +1547,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):