On Tue, Aug 27, 2013 at 06:38:40PM -0400, Scott Kostyshak wrote:
> On Tue, Aug 27, 2013 at 5:58 PM, Enrico Forestieri <[email protected]> wrote:
> > On Tue, Aug 27, 2013 at 11:19:43PM +0200, Enrico Forestieri wrote:
> >> On Tue, Aug 27, 2013 at 04:38:29PM -0400, Scott Kostyshak wrote:
> >> >
> >> > Did parenleft and bracketleft bind codes ever work on Windows?
> >>
> >> Of course. Only now I noticed the breakage, so it must be a recently
> >> introduced feature (maybe Qt related).
> >
> > It's definitely a bug introduced by Qt. I downgraded Qt from 4.8.5 to
> > 4.8.4 by simply replacing the shared libraries and the shortcuts work
> > again (with the same lyx binary).
> >
> > This problem does also occur with Qt 5.1.0.
>
> This is good to know. Hopefully it is known to Qt (although it seems
> like it is not).
I think they introduced this bug as a by-product of the fix to
QTBUG-8764 and QTBUG-10032 and suspect that the attached diff
is the culprit. Will try to revert and recompile Qt when time
permits.
This seems to be Windows specific, though.
--
Enrico
--- qt-everywhere-opensource-src-4.8.4/src/gui/kernel/qkeymapper_win.cpp
2012-11-23 11:09:53.000000000 +0100
+++ qt-everywhere-opensource-src-4.8.5/src/gui/kernel/qkeymapper_win.cpp
2013-06-07 07:16:59.000000000 +0200
@@ -74,6 +74,9 @@ extern Q_CORE_EXPORT QLocale qt_localeFr
#ifndef VK_OEM_3
#define VK_OEM_3 0xC0
#endif
+#ifndef MAPVK_VK_TO_CHAR
+#define MAPVK_VK_TO_CHAR (2)
+#endif
#if defined(Q_OS_WINCE)
bool GetKeyboardState(unsigned char* kbuffer)
@@ -925,9 +928,15 @@ bool QKeyMapperPrivate::translateKeyEven
if (isNumpad && (nModifiers & AltAny)) {
code = winceKeyBend(msg.wParam);
} else if (!isDeadKey) {
- unsigned char kbdBuffer[256]; // Will hold the complete keyboard
state
- GetKeyboardState(kbdBuffer);
- code = toKeyOrUnicode(msg.wParam, scancode, kbdBuffer);
+ // QTBUG-8764, QTBUG-10032
+ // Can't call toKeyOrUnicode because that would call ToUnicode,
and, if a dead key
+ // is pressed at the moment, Windows would NOT use it to compose a
character for the next
+ // WM_CHAR event.
+
+ // Instead, use MapVirtualKey, which will provide adequate values.
+ code = MapVirtualKey(msg.wParam, MAPVK_VK_TO_CHAR);
+ if (code < 0x20 || code == 0x7f) // The same logic as in
toKeyOrUnicode()
+ code = winceKeyBend(msg.wParam);
}
// Invert state logic: