This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: right-mouse click in IDLE on Mac doesn't work
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.6, Python 3.4, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: markroseman, ned.deily, ronaldoussoren, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2015-08-06 01:36 by markroseman, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
macpopup.patch markroseman, 2015-08-07 21:57 review
macpopup-revised.patch markroseman, 2015-08-18 20:44 review
Messages (9)
msg248092 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-06 01:36
For popup menus, control-click works, but right-click on mouse buttons that support it, doesn't work.

This is a followup to #10404, last addressed in 2010.

As noted there, right click behaviour should be supported.

The right click Tk text bindings on Mac (which is B2) seem to bind both to the virtual 'PasteSelection' event, and also to fast-scroll through a large file is you click and drag with the right mouse button. Both of these are blatant problems with Tk's text.tcl.

The issue when trying to fix this before was when a B2 (context menu) binding was added to the text widget, both that and the bogus B2 bindings fired. This is because Tk can fire multiple bindings for a widget (default is bindings for the widget itself, the widget's toplevel, the widget's class, and 'all'). 

There is a way to short-circuit this in Tcl (basically the widget-specific binding calls 'break', which prevents the others from firing). The simpler alternative is probably just redefining the alternative class-level (Text) bindings.

In other words, yeah, this should be pretty easily fixable.
msg248213 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-08-07 18:54
From your description, I an not sure what it is that does not work.
msg248215 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-07 19:08
If you have your mouse set up to have two buttons, right-clicking in the editor window doesn't bring up the context menu it's supposed to.
msg248232 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-07 21:57
Have attached macpopup.patch which removes the incorrect Tk behaviour and makes it so that right click on Mac will bring up the context menu as appropriate.
msg248569 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-08-14 08:55
Looks as right button on Mac corresponds to middle button on X Window (paste selection and scroll if moved). This behavior is standard for all Tk applications. I don't think we should break this.
msg248587 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-14 13:40
There is no notion of middle button on Mac, hence right button is B2. It's documented. Current Tk 8.6 has even removed the <<PasteSelection>> binding from B2 on Aqua because of this (I've filed a Tk bug report to backport this to 8.5). 8.6 also defines a <<ContextMenu>> virtual event, which on Mac is tied to B2.

Mac UI guidelines define use of 'right button' (when available) to be used for context menu clicks.

So yeah, we should change this. :-)
msg248588 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-08-14 14:33
Ah, so this is a workaround of 8.5- bug. Then looks reasonable to me.

Added comments on Rietveld.
msg248792 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-18 20:44
Have attached macpopup-revised.patch, incorporating Serhiy's very helpful suggestions. Unless there are any other thoughts, this one is probably ready to go.
msg251387 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-09-23 01:22
Serhiy, thanks for the review.  I bungled the issue number on the commit message, so here are the commit notices.  Will correct for NEWS.

New changeset b79dd0d7dc98 by Terry Jan Reedy in branch '2.7':
Issue #24570: Right-click for context menus now work on Mac Aqual also.

New changeset 51b2b1a821b7 by Terry Jan Reedy in branch '3.4':
Issue #24570: Right-click for context menus now work on Mac Aqual also.
Date User Action Args
2022-04-11 14:58:19adminsetgithub: 68989
2015-09-23 01:22:33terry.reedysetstatus: open -> closed
versions: + Python 3.6
messages: + msg251387

resolution: fixed
stage: patch review -> resolved
2015-08-18 20:44:42markrosemansetfiles: + macpopup-revised.patch

messages: + msg248792
2015-08-14 14:34:00serhiy.storchakasetstage: patch review
2015-08-14 14:33:50serhiy.storchakasetmessages: + msg248588
2015-08-14 13:40:23markrosemansetmessages: + msg248587
2015-08-14 08:55:49serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg248569
2015-08-07 21:57:32markrosemansetfiles: + macpopup.patch
keywords: + patch
messages: + msg248232
2015-08-07 19:08:06markrosemansetmessages: + msg248215
2015-08-07 18:54:29terry.reedysetmessages: + msg248213
2015-08-06 01:40:26markrosemansetcomponents: + IDLE
2015-08-06 01:36:03markrosemancreate