[Bug 60050] New: winewayland: Alt without Ctrl is mapped to AltGr, breaking Alt+<letter> menu mnemonics on layouts that have AltGr (AZERTY, QWERTZ, …)
http://bugs.winehq.org/show_bug.cgi?id=60050 Bug ID: 60050 Summary: winewayland: Alt without Ctrl is mapped to AltGr, breaking Alt+<letter> menu mnemonics on layouts that have AltGr (AZERTY, QWERTZ, …) Product: Wine Version: 11.13 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winewayland Assignee: wine-bugs@list.winehq.org Reporter: tony.cuny@gmail.com Target Milestone: --- Distribution: --- Under the Wayland driver (winewayland), pressing Alt+<letter> does not trigger the corresponding menu mnemonic on any keyboard layout that has an AltGr key (e.g. French AZERTY, German QWERTZ). For example, in Notepad on a French layout, **Alt+F does not open the "Fichier" menu**; the keystroke produces no usable WM_SYSCHAR. The same applies to the other Alt+<letter> mnemonics (Alt+E, Alt+O, …). This makes Alt+<letter> menu access unusable for a large class of applications on the most common non-US European layouts. The X11 driver (winex11) does not have this problem: Alt+<letter> opens the mnemonic as expected. (Note: this is specific to Alt+<letter>. Tapping Alt alone to enter menu mode, and F10 menu navigation, are unaffected — they do not go through the character table.) Steps to reproduce 1. Run a Wayland session with an AltGr layout (e.g. French/AZERTY or German/QWERTZ). 2. Make Wine use the Wayland driver: `wine reg add "HKCU\Software\Wine\Drivers" /v Graphics /d "wayland,x11" /f` 3. `wine notepad` 4. Press "Alt+F" (left Alt). Expected: the "File"/"Fichier" menu drops down (mnemonic match). Actual: nothing happens; the menu does not open. Same for Alt+E, Alt+O, etc. Confirmed on stock Wine 11.13 (winewayland, French/AZERTY compositor keymap). The offending code is present unchanged in current git master (dlls/winewayland.drv/wayland_keyboard.c). Root cause In `add_xkb_layout()` (dlls/winewayland.drv/wayland_keyboard.c), while building the VK_TO_WCHARS table, the loop over modifier combinations maps *any* combination that contains the Alt bit to the XKB AltGr mask: for (mod = 0; mod < 8; ++mod) { ... if (mod & (1 << 0)) mod_mask |= shift_mask; if (mod & (1 << 1)) mod_mask |= control_mask; /* Windows uses VK_CTRL + VK_MENU for AltGr, we cannot combine Ctrl and Alt */ if (mod & (1 << 2)) mod_mask = (mod_mask & ~control_mask) | altgr_mask; ... } Bit 2 is the Alt (VK_MENU) modifier. The problem is that this also fires for Alt alone (bit 2 set, bit 1 / Ctrl clear). On Windows, AltGr is `VK_CONTROL + VK_MENU`; Alt on its own is *not* a layout modifier and must produce the same glyph as the base column, so that Alt+<letter> yields WM_SYSCHAR with the plain letter and application menus can match their mnemonics. By mapping Alt-alone to the AltGr mask, the layout table returns the AltGr-column glyph (which is empty for most letters) for Alt+<letter>, so no usable WM_SYSCHAR is produced and the mnemonic never matches. Proposed fix Only map to AltGr when *both* the Ctrl bit and the Alt bit are set (i.e. Ctrl+Alt, and Shift+Ctrl+Alt); Alt alone keeps the base column: ```diff - /* Windows uses VK_CTRL + VK_MENU for AltGr, we cannot combine Ctrl and Alt */ - if (mod & (1 << 2)) mod_mask = (mod_mask & ~control_mask) | altgr_mask; + /* Windows uses VK_CTRL + VK_MENU for AltGr, we cannot combine Ctrl and Alt. + * Alt alone (without Ctrl) is not a layout modifier on Windows: it must + * produce the base-column glyph so Alt+<letter> yields WM_SYSCHAR with the + * plain letter and menu mnemonics match. Only Ctrl+Alt (and Shift+Ctrl+Alt) + * maps to the XKB AltGr mask. */ + if ((mod & (1 << 2)) && (mod & (1 << 1))) + mod_mask = (mod_mask & ~control_mask) | altgr_mask; ``` -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla