summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-24 09:41:20 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-09-04 22:23:19 +0200
commit211cef46f6d9d8738c09f906f9c0c3080b445dc8 (patch)
tree39685f045aa35fa6cdf6e0895d8289a6bb01f185 /src/gui/kernel
parentca1aa81c97670bf4ac94e1d586b0648636c0d20d (diff)
Introduce flags to QWindowSystemInterface::WindowSystemEvent.
Replace boolean member variables by flags. Task-number: QTBUG-38768 Change-Id: If1302d9cc555d20df44147c9fa0f193a471fc95c Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qguiapplication.cpp26
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h20
2 files changed, 29 insertions, 17 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 2d7900b5d9..a327a43557 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1708,7 +1708,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QPointF localPoint = e->localPos;
QPointF globalPoint = e->globalPos;
- if (e->nullWindow) {
+ if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(globalPoint.toPoint());
if (window) {
QPointF delta = globalPoint - globalPoint.toPoint();
@@ -1761,7 +1761,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
ev.setTimestamp(e->timestamp);
setMouseEventSource(&ev, e->source);
#ifndef QT_NO_CURSOR
- if (!e->synthetic) {
+ if (!e->synthetic()) {
if (const QScreen *screen = window->screen())
if (QPlatformCursor *cursor = screen->handle()->cursor())
cursor->pointerEvent(ev);
@@ -1779,7 +1779,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
QGuiApplication::sendSpontaneousEvent(window, &ev);
- if (!e->synthetic && !ev.isAccepted()
+ if (!e->synthetic() && !ev.isAccepted()
&& !frameStrut
&& qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
if (!m_fakeTouchDevice) {
@@ -1810,12 +1810,12 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type);
QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers);
- fake.synthetic = true;
+ fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processTouchEvent(&fake);
}
if (doubleClick) {
mousePressButton = Qt::NoButton;
- if (!e->window.isNull() || e->nullWindow) { // QTBUG-36364, check if window closed in response to press
+ 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;
QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint,
button, buttons, e->modifiers);
@@ -1833,7 +1833,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
QPointF globalPoint = e->globalPos;
QPointF localPoint = e->localPos;
- if (e->nullWindow) {
+ if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(globalPoint.toPoint());
if (window) {
QPointF delta = globalPoint - globalPoint.toPoint();
@@ -1864,7 +1864,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
{
QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
- if (e->nullWindow
+ if (e->nullWindow()
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
|| e->key == Qt::Key_Back || e->key == Qt::Key_Menu
#endif
@@ -2105,7 +2105,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
// subsequent events up to the release are delivered to that same window.
// If window is given, just send to that.
if (type == QEvent::TabletPress) {
- if (e->nullWindow) {
+ if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(e->global.toPoint());
localValid = false;
}
@@ -2113,7 +2113,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
return;
tabletPressTarget = window;
} else {
- if (e->nullWindow) {
+ if (e->nullWindow()) {
window = tabletPressTarget;
localValid = false;
}
@@ -2247,7 +2247,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
touchEvent.setWindow(*winIt);
QGuiApplication::sendSpontaneousEvent(*winIt, &touchEvent);
}
- if (!self->synthesizedMousePoints.isEmpty() && !e->synthetic) {
+ if (!self->synthesizedMousePoints.isEmpty() && !e->synthetic()) {
for (QHash<QWindow *, SynthesizedMouseData>::const_iterator synthIt = self->synthesizedMousePoints.constBegin(),
synthItEnd = self->synthesizedMousePoints.constEnd(); synthIt != synthItEnd; ++synthIt) {
if (!synthIt->window)
@@ -2259,7 +2259,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
Qt::NoButton,
e->modifiers,
Qt::MouseEventSynthesizedByQt);
- fake.synthetic = true;
+ fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processMouseEvent(&fake);
}
self->synthesizedMousePoints.clear();
@@ -2438,7 +2438,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
}
QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
- if (!e->synthetic && !touchEvent.isAccepted() && synthesizeMouseFromTouchEventsEnabled()) {
+ if (!e->synthetic() && !touchEvent.isAccepted() && synthesizeMouseFromTouchEventsEnabled()) {
// exclude touchpads as those generate their own mouse events
if (touchEvent.device()->type() != QTouchDevice::TouchPad) {
Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton;
@@ -2459,7 +2459,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
touchPoint.pos(),
touchPoint.screenPos(),
b, e->modifiers);
- fake.synthetic = true;
+ fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processMouseEvent(&fake);
break;
}
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 89ca4064b2..c608061d04 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -101,11 +101,20 @@ public:
class WindowSystemEvent {
public:
+ enum {
+ Synthetic = 0x1,
+ NullWindow = 0x2
+ };
+
explicit WindowSystemEvent(EventType t)
- : type(t), synthetic(false) { }
+ : type(t), flags(0) { }
virtual ~WindowSystemEvent() { }
+
+ bool synthetic() const { return flags & Synthetic; }
+ bool nullWindow() const { return flags & NullWindow; }
+
EventType type;
- bool synthetic;
+ int flags;
};
class CloseEvent : public WindowSystemEvent {
@@ -194,9 +203,12 @@ public:
class UserEvent : public WindowSystemEvent {
public:
UserEvent(QWindow * w, ulong time, EventType t)
- : WindowSystemEvent(t), window(w), nullWindow(w == 0), timestamp(time) { }
+ : WindowSystemEvent(t), window(w), timestamp(time)
+ {
+ if (!w)
+ flags |= NullWindow;
+ }
QPointer<QWindow> window;
- bool nullWindow;
unsigned long timestamp;
};