Windows QPA: Do not send key events for mouse-synthesized app commands

Sending key events in addition causes applications to respond
twice to for example the back / forward extra mouse buttons.
Suppress the keypress by checking on the device. This is in
line with the other platforms, which do not send keypresses
either.
Native event filters will still be able to listen for
WM_APPCOMMAND.

Task-number: QTBUG-48117
Task-number: QTBUG-57198
Change-Id: I219e17244087663f06ab2c5a8cf4b880c3655700
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Friedemann Kleint 2016-11-22 15:45:36 +01:00
parent d8857f21ac
commit 389b4ec28b

View File

@ -861,6 +861,9 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd,
bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, const MSG &msg)
{
#if defined(WM_APPCOMMAND)
// QTBUG-57198, do not send mouse-synthesized commands as key events in addition
if (GET_DEVICE_LPARAM(msg.lParam) == FAPPCOMMAND_MOUSE)
return false;
const int cmd = GET_APPCOMMAND_LPARAM(msg.lParam);
const int dwKeys = GET_KEYSTATE_LPARAM(msg.lParam);
int state = 0;