summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2012-06-23 21:48:53 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-20 18:34:08 +0200
commit1603ba23656c8c31dc05fe9b3f1e12b22e29989a (patch)
tree5e507db7a34023b9236c982257923a2242c1693a /src/gui/kernel
parent981ea7a1aa602cebfdd43b7dc6efd3abf5a1cba3 (diff)
Provide public API for native event filtering, moved up from QPA.
The previous API was hard to use (global function, no type safety, manual chaining), and confusing (app vs dispatcher split only made sense on Windows). Installing and removing out of order would have the risk of setting back a dangling pointer (crash). Meanwhile QPA added type safety, and this new API models the QObject::installEventFilter API for ease of use. The virtual method is in a new interface, QAbstractNativeEventFilter. QPA was even calling the dispatcher event filter with QPA-private event classes, which made no sense (refactoring leftover from when the code was in the dispatcher). Now the QPA plugins trigger the qcoreapp event filters with the actual native events directly. Change-Id: Ie35e47c59c862383bcaf857b28d54f7c72547882 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qplatformnativeinterface.cpp47
-rw-r--r--src/gui/kernel/qplatformnativeinterface.h3
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp6
3 files changed, 0 insertions, 56 deletions
diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp
index f0bd3f0658..e35948fd0c 100644
--- a/src/gui/kernel/qplatformnativeinterface.cpp
+++ b/src/gui/kernel/qplatformnativeinterface.cpp
@@ -146,51 +146,4 @@ void QPlatformNativeInterface::setWindowProperty(QPlatformWindow *window, const
Q_UNUSED(value);
}
-/*!
- \typedef QPlatformNativeInterface::EventFilter
- \since 5.0
-
- A function with the following signature that can be used as an
- event filter:
-
- \code
- bool myEventFilter(void *message, long *result);
- \endcode
-
- \sa setEventFilter()
-*/
-
-/*!
- \fn EventFilter QPlatformNativeInterface::setEventFilter(const QByteArray &eventType, EventFilter filter)
- \since 5.0
-
- Replaces the event filter function for the native interface with
- \a filter and returns the pointer to the replaced event filter
- function. Only the current event filter function is called. If you
- want to use both filter functions, save the replaced EventFilter
- in a place where you can call it from.
-
- The event filter function set here is called for all messages
- received from the platform if they are given type \eventType.
- It is \e not called for messages that are not meant for Qt objects.
-
- The type of event is specific to the platform plugin chosen at run-time.
-
- The event filter function should return \c true if the message should
- be filtered, (i.e. stopped). It should return \c false to allow
- processing the message to continue.
-
- By default, no event filter function is set. For example, this function
- returns a null EventFilter the first time it is called.
-
- \note The filter function here receives native messages,
- for example, MSG or XEvent structs. It is called by the platform plugin.
-*/
-QPlatformNativeInterface::EventFilter QPlatformNativeInterface::setEventFilter(const QByteArray &eventType, QPlatformNativeInterface::EventFilter filter)
-{
- Q_UNUSED(eventType);
- Q_UNUSED(filter);
- return 0;
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformnativeinterface.h b/src/gui/kernel/qplatformnativeinterface.h
index 37339f4860..16a9db0f73 100644
--- a/src/gui/kernel/qplatformnativeinterface.h
+++ b/src/gui/kernel/qplatformnativeinterface.h
@@ -88,9 +88,6 @@ public:
virtual QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const;
virtual void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value);
- typedef bool (*EventFilter)(void *message, long *result);
- virtual EventFilter setEventFilter(const QByteArray &eventType, EventFilter filter);
-
Q_SIGNALS:
void windowPropertyChanged(QPlatformWindow *window, const QString &propertyName);
};
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index f9eae3b765..207c858a76 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -518,11 +518,6 @@ bool QWindowSystemInterface::sendWindowSystemEvents(QAbstractEventDispatcher *ev
break;
}
- if (eventDispatcher->filterEvent(event)) {
- delete event;
- continue;
- }
-
nevents++;
QGuiApplicationPrivate::processWindowSystemEvent(event);
@@ -554,7 +549,6 @@ QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *w, const QMi
\brief Passes a native event identified by \a eventType to the \a window.
\note This function can only be called from the GUI thread.
- \sa QPlatformNativeInterface::setEventFilter()
*/
bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)