summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qguiapplication.cpp16
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp5
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h12
3 files changed, 15 insertions, 18 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 35332831d4..77897e9e57 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1736,7 +1736,6 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
{
switch(e->type) {
- case QWindowSystemInterfacePrivate::FrameStrutMouse:
case QWindowSystemInterfacePrivate::Mouse:
QGuiApplicationPrivate::processMouseEvent(static_cast<QWindowSystemInterfacePrivate::MouseEvent *>(e));
break;
@@ -1851,8 +1850,8 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
// A mouse event should not change both position and buttons at the same time. Instead we
// should first send a move event followed by a button changed event. Since this is not the case
// with the current event, we split it in two.
- QWindowSystemInterfacePrivate::MouseEvent mouseButtonEvent(
- e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers, e->source);
+ QWindowSystemInterfacePrivate::MouseEvent mouseButtonEvent(e->window.data(), e->timestamp,
+ e->localPos, e->globalPos, e->buttons, e->modifiers, e->source, e->nonClientArea);
if (e->flags & QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic)
mouseButtonEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
e->buttons = mouse_buttons;
@@ -1888,10 +1887,9 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
Qt::MouseButton button = Qt::NoButton;
bool doubleClick = false;
- const bool frameStrut = e->type == QWindowSystemInterfacePrivate::FrameStrutMouse;
if (QGuiApplicationPrivate::lastCursorPosition != globalPoint) {
- type = frameStrut ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove;
+ type = e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove;
QGuiApplicationPrivate::lastCursorPosition = globalPoint;
if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance||
qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance)
@@ -1913,14 +1911,14 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (button & e->buttons) {
ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval());
doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
- type = frameStrut ? QEvent::NonClientAreaMouseButtonPress : QEvent::MouseButtonPress;
+ type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonPress : QEvent::MouseButtonPress;
mousePressTime = e->timestamp;
mousePressButton = button;
const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
mousePressX = point.x();
mousePressY = point.y();
} else {
- type = frameStrut ? QEvent::NonClientAreaMouseButtonRelease : QEvent::MouseButtonRelease;
+ type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonRelease : QEvent::MouseButtonRelease;
}
}
@@ -1957,7 +1955,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QGuiApplication::sendSpontaneousEvent(window, &ev);
e->eventAccepted = ev.isAccepted();
if (!e->synthetic() && !ev.isAccepted()
- && !frameStrut
+ && !e->nonClientArea
&& qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
if (!m_fakeTouchDevice) {
m_fakeTouchDevice = new QTouchDevice;
@@ -1994,7 +1992,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (doubleClick) {
mousePressButton = Qt::NoButton;
if (!e->window.isNull() || e->nullWindow()) { // QTBUG-36364, check if window closed in response to press
- const QEvent::Type doubleClickType = frameStrut ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick;
+ const QEvent::Type doubleClickType = e->nonClientArea ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick;
QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint,
button, mouse_buttons, e->modifiers, e->source);
dblClickEvent.setTimestamp(e->timestamp);
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index f9580291bc..53653f94d8 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -368,8 +368,9 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong t
{
QWindowSystemInterfacePrivate::MouseEvent * e =
new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp,
- QWindowSystemInterfacePrivate::FrameStrutMouse,
- QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), b, mods, source);
+ QHighDpi::fromNativeLocalPosition(local, window),
+ QHighDpi::fromNativePixels(global, window),
+ b, mods, source, true);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index c45d13cde6..ee2780bf91 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -75,7 +75,7 @@ public:
ActivatedWindow = 0x05,
WindowStateChanged = 0x06,
Mouse = UserInputEvent | 0x07,
- FrameStrutMouse = UserInputEvent | 0x08,
+ FrameStrutMouse = UserInputEvent | 0x08, // ### Qt6 remove
Wheel = UserInputEvent | 0x09,
Key = UserInputEvent | 0x0a,
Touch = UserInputEvent | 0x0b,
@@ -227,16 +227,14 @@ public:
public:
MouseEvent(QWindow * w, ulong time, const QPointF &local, const QPointF &global,
Qt::MouseButtons b, Qt::KeyboardModifiers mods,
- Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
- : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(b), source(src) { }
- MouseEvent(QWindow * w, ulong time, EventType t, const QPointF &local, const QPointF &global,
- Qt::MouseButtons b, Qt::KeyboardModifiers mods,
- Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
- : InputEvent(w, time, t, mods), localPos(local), globalPos(global), buttons(b), source(src) { }
+ Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool frame = false)
+ : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(b),
+ source(src), nonClientArea(frame) { }
QPointF localPos;
QPointF globalPos;
Qt::MouseButtons buttons;
Qt::MouseEventSource source;
+ bool nonClientArea;
};
class WheelEvent : public InputEvent {