Provide (almost) correct modifiers in DirectManipulation.
This commit is contained in:
parent
2f0ac38228
commit
91d43ea4b5
1 changed files with 23 additions and 1 deletions
|
|
@ -144,6 +144,28 @@ void FixAeroSnap(HWND handle) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] Qt::KeyboardModifiers LookupModifiers() {
|
||||||
|
const auto check = [](int key) {
|
||||||
|
return (GetKeyState(key) & 0x8000) != 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto result = Qt::KeyboardModifiers();
|
||||||
|
if (check(VK_SHIFT)) {
|
||||||
|
result |= Qt::ShiftModifier;
|
||||||
|
}
|
||||||
|
// NB AltGr key (i.e., VK_RMENU on some keyboard layout) is not handled.
|
||||||
|
if (check(VK_RMENU) || check(VK_MENU)) {
|
||||||
|
result |= Qt::AltModifier;
|
||||||
|
}
|
||||||
|
if (check(VK_CONTROL)) {
|
||||||
|
result |= Qt::ControlModifier;
|
||||||
|
}
|
||||||
|
if (check(VK_LWIN) || check(VK_RWIN)) {
|
||||||
|
result |= Qt::MetaModifier;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class WindowHelper::NativeFilter final : public QAbstractNativeEventFilter {
|
class WindowHelper::NativeFilter final : public QAbstractNativeEventFilter {
|
||||||
|
|
@ -431,7 +453,7 @@ void WindowHelper::handleDirectManipulationEvent(
|
||||||
QPointF(global.x, global.y),
|
QPointF(global.x, global.y),
|
||||||
event.delta,
|
event.delta,
|
||||||
event.delta,
|
event.delta,
|
||||||
QGuiApplication::keyboardModifiers(),
|
LookupModifiers(),
|
||||||
phase,
|
phase,
|
||||||
Qt::MouseEventSynthesizedBySystem);
|
Qt::MouseEventSynthesizedBySystem);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue