|Subject:||[macOS][known issue] mouse buttons 2 and 3 are swapped|
On macOS (native 'aqua' windowingsystem), any mouse button 2 ("right-click") functionality is bound to mouse button 3 ("middle-click"; n.b., many mice and trackpads don't have a third mouse button), and vice versa. This appears to be historically correct behavior since on Windows, Linux, and X11 on Mac, the mouse buttons (left, middle, right) are ordered (1, 2, 3) respectively; whereas on Mac (aqua), it assigns the right mouse button as button 2 for backwards compatibility with older Mac software. Cf., One workaround is for a Tk program to detect 'aqua' as the windowingsystem and assign buttons appropriately. Another is to rely on a package that detects the platform (e.g. VirtualMouse for Tcl/Tk). The widget demo program doesn't implement any workaround at the moment I guess Tcl::pTk is doing its job correctly then by not automatically reassigning mouse buttons depending on the platform. However, for TkHijack, it might be useful to document this behavior. My ideas so far are to: (1) discuss this behavior in the documentation for TkHijack, and (2) print a warning, if possible, once a program running with TkHijack attempts to bind to mouse buttons 2 or 3 when windowsystem is 'aqua'; and then provide the program maintainer two ways 'silence' the warning by loading either: (a) a pTk submodule that silences the warning and automatically swaps buttons 2 and 3, or (b) a pTk submodule that only silences the warning, and assumes the program maintainer implemented their own workaround.