Title: Qt swapping ctrl and cmd on OSX · Issue #21110 · matplotlib/matplotlib · GitHub
Open Graph Title: Qt swapping ctrl and cmd on OSX · Issue #21110 · matplotlib/matplotlib
X Title: Qt swapping ctrl and cmd on OSX · Issue #21110 · matplotlib/matplotlib
Description: There is special casing for ctl / cmd in the Qt backend on OSX matplotlib/lib/matplotlib/backends/backend_qt.py Lines 49 to 51 in 9465538 # In OSX, the control and super (aka cmd/apple) keys are switched. ("Key_Control", "control" if sys...
Open Graph Description: There is special casing for ctl / cmd in the Qt backend on OSX matplotlib/lib/matplotlib/backends/backend_qt.py Lines 49 to 51 in 9465538 # In OSX, the control and super (aka cmd/apple) keys are sw...
X Description: There is special casing for ctl / cmd in the Qt backend on OSX matplotlib/lib/matplotlib/backends/backend_qt.py Lines 49 to 51 in 9465538 # In OSX, the control and super (aka cmd/apple) keys are sw...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/21110
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Qt swapping ctrl and cmd on OSX","articleBody":"There is special casing for ctl / cmd in the Qt backend on OSX\r\n\r\nhttps://github.com/matplotlib/matplotlib/blob/9465538da0ebd041c3a87f7b004339c17576ae55/lib/matplotlib/backends/backend_qt.py#L49-L51\r\n\r\nThat is making the tests fail. \r\n\r\nLooking at a US mac keyboard on the left side I see:\r\n\r\n```\r\nctrl | option | command\r\n```\r\n\r\nand looking at US windows keyboard I see\r\n\r\n```\r\nctrl | meta (aka windows) | alt\r\n```\r\n\r\nhowever that does not tell us what keycodes they actually generate.\r\n\r\nWe used to implement this logic differently (before we unified the qt backend code) \r\n\r\n### 3.4.3\r\n\r\nhttps://github.com/matplotlib/matplotlib/blob/919145fe9849c999aa491457c6de6faede5959c3/lib/matplotlib/backends/backend_qt5.py#L62-L67\r\n\r\n### 3.2.2\r\n\r\nhttps://github.com/matplotlib/matplotlib/blob/a1a5298b0d4a8d8230103d0fa8d369fca7fdeea0/lib/matplotlib/backends/backend_qt5.py#L70-L85\r\n\r\nThis swapping goes all the way back to 5fdd68adac02827bb28f17ea88d2a6996c4acb1d (2012).\r\n\r\nI think we need to:\r\n\r\n - have a mac user with a mac keyboard veryify that the keys they hit match the keycodes we expect\r\n - if the keys are right to the human typing then fix the tests (probably by tweaking what the key-codes fed in are)\r\n - if the keys are wrong to the human typing\r\n - if they are consistent across mpl versions on osx: gnash our teeth in despair and figure out how we want to fix this (on one hand, we should make sure that the key-codes are consistent across platfroms, on the other hand we do not want to break existing OSX users).\r\n - if they changed from 3.4 to the default branch, fix the re-mapping\r\n\r\nI also have a worry that Qt has started to fix this for us.\r\n\r\n----\r\n\r\nFYI: I just ran the latest tests and these are now failing for me and I'm wondering if it has to do with being on a mac? The tests look like they are swapping cmd/ctrl, so I tried swapping the modifier keys on my system and that didn't help.\r\n\r\n```bash\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-control] - AssertionError: assert 'cmd+a' == 'ctrl+a'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-alt_control] - AssertionError: assert 'alt+cmd' == 'alt+control'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-control_alt] - AssertionError: assert 'cmd+alt' == 'ctrl+alt'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-modifier_order] - AssertionError: assert 'cmd+alt+ctrl+á' == 'ctrl+alt+super+á'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-backspace_mod] - AssertionError: assert 'cmd+backspace' == 'ctrl+backspace'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[QtAgg-control] - AssertionError: assert 'cmd+a' == 'ctrl+a'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[QtAgg-alt_control] - AssertionError: assert 'alt+cmd' == 'alt+control'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[QtAgg-control_alt] - AssertionError: assert 'cmd+alt' == 'ctrl+alt'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[QtAgg-modifier_order] - AssertionError: assert 'cmd+alt+ctrl+á' == 'ctrl+alt+super+á'\r\nFAILED lib/matplotlib/tests/test_backend_qt.py::test_correct_key[QtAgg-backspace_mod] - AssertionError: assert 'cmd+backspace' == 'ctrl+backspace'\r\n```\r\n\r\nIt looks like these _may_ be getting skipped on the macos-latest CI?\r\n\r\n```bash\r\nSKIPPED [22] lib/matplotlib/tests/test_backend_qt.py:168: No usable Qt bindings\r\n```\r\n\r\n_Originally posted by @greglucas in https://github.com/matplotlib/matplotlib/issues/20868#issuecomment-921432176_\r\n","author":{"url":"https://github.com/tacaswell","@type":"Person","name":"tacaswell"},"datePublished":"2021-09-17T13:52:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/21110/matplotlib/issues/21110"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d7803033-2b48-1212-5299-17ea28982380 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C080:33B84F:3F615DB:57E4D8E:6A54CBFD |
| html-safe-nonce | e80bbf6af212be995530918c39ad20282c5abce048706a702362570e08f04508 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDgwOjMzQjg0RjozRjYxNURCOjU3RTREOEU6NkE1NENCRkQiLCJ2aXNpdG9yX2lkIjoiODk5MjA3MjM1NDgxNDIyODQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4f989c243de6ee282a0ea7b0df6583b3de1591a0c5e5aa2ef696b1a8e89ea084 |
| hovercard-subject-tag | issue:999379271 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/21110/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1136dd024fb7548307014dac3494fa902d7c454b3a15c5d58e275c85b79413b1/matplotlib/matplotlib/issues/21110 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1136dd024fb7548307014dac3494fa902d7c454b3a15c5d58e275c85b79413b1/matplotlib/matplotlib/issues/21110 |
| og:image:alt | There is special casing for ctl / cmd in the Qt backend on OSX matplotlib/lib/matplotlib/backends/backend_qt.py Lines 49 to 51 in 9465538 # In OSX, the control and super (aka cmd/apple) keys are sw... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tacaswell |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6e5f2e6ff3f430aa60a674066f957bca9f2106017e1b68126417422b58ce6e1e |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | be4d48619391052c9d312c7b587bb2ac38a97f57 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width