* The enum values simply didn't make sense in the first place and should simply be dropped.
* Filtering of native events (QCoreApplication::setEventFilter, as well as
- QApplication::x11EventFilter/macEventFilter/qwsEventFilter) have been replaced
+ QApplication::x11EventFilter/macEventFilter/qwsEventFilter/winEventFilter) have been replaced
with QCoreApplication::installNativeEventFilter and removeNativeEventFilter,
for an API much closer to QEvent filtering. Note that the native events that can be
filtered this way depend on which QPA backend is chosen, at runtime. On X11, XEvents are
#endif //QT_NO_LIBRARY
/*!
- Sends \a message through the event filters that were set by
- installNativeEventFilter(). This function returns true as soon as an
- event filter returns true, and false otherwise to indicate that
- the processing of the event should continue.
-
- Subclasses of QAbstractEventDispatcher \e must call this function
- for \e all messages received from the system to ensure
- compatibility with any extensions that may be used in the
- application.
-
- Note that the type of \a message is platform dependent. See
- QAbstractNativeEventFilter for details.
-
- \sa installNativeEventFilter()
- \since 5.0
-
- \internal
- This method only exists for the Windows event dispatcher to call the winEventFilter virtual.
- Every other platform can just use QAbstractNativeEventFilter::filterNativeEvent directly.
-*/
-bool QCoreApplication::filterNativeEvent(const QByteArray &eventType, void *message, long *result)
-{
- if (result)
- *result = 0;
-#ifdef Q_OS_WIN
- if (winEventFilter(reinterpret_cast<MSG *>(message), result))
- return true;
-#endif
- QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance();
- if (dispatcher)
- return dispatcher->filterNativeEvent(eventType, message, result);
- return false;
-}
-
-
-/*!
Installs an event filter \a filterObj for all native events
received by the application in the main thread.
static void flush();
-#if defined(Q_OS_WIN)
- virtual bool winEventFilter(MSG *message, long *result);
-#endif
-
#if defined(Q_OS_UNIX)
static void watchUnixSignal(int signal, bool watch);
#endif
void installNativeEventFilter(QAbstractNativeEventFilter *filterObj);
void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj);
- bool filterNativeEvent(const QByteArray &eventType, void *message, long *result);
static bool isQuitLockEnabled();
static void setQuitLockEnabled(bool enabled);
Q_UNUSED(prevInstance);
}
-/*!
- The message procedure calls this function for every message
- received. Reimplement this function if you want to process window
- messages \a msg that are not processed by Qt. If you don't want
- the event to be processed by Qt, then return true and set \a result
- to the value that the window procedure should return. Otherwise
- return false.
-*/
-bool QCoreApplication::winEventFilter(MSG *msg, long *result) // Windows event filter
-{
- Q_UNUSED(msg);
- Q_UNUSED(result);
- return false;
-}
-
void QCoreApplicationPrivate::removePostedTimerEvent(QObject *object, int timerId)
{
QThreadData *data = object->d_func()->threadData;
msg.message = message;
msg.wParam = wp;
msg.lParam = lp;
- QCoreApplication *app = QCoreApplication::instance();
+ QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance();
long result;
- if (!app) {
+ if (!dispatcher) {
if (message == WM_TIMER)
KillTimer(hwnd, wp);
return 0;
- } else if (app->filterNativeEvent(QByteArrayLiteral("windows_dispatcher_MSG"), &msg, &result)) {
+ } else if (dispatcher->filterNativeEvent(QByteArrayLiteral("windows_dispatcher_MSG"), &msg, &result)) {
return result;
}
msg.pt.y = GET_Y_LPARAM(lParam);
long filterResult = 0;
- QCoreApplication* coreApp = QCoreApplication::instance();
- if (coreApp && coreApp->filterNativeEvent(d->m_eventType, &msg, &filterResult)) {
+ QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance();
+ if (dispatcher && dispatcher->filterNativeEvent(d->m_eventType, &msg, &filterResult)) {
*result = LRESULT(filterResult);
return true;
}
#endif
long result = 0;
- bool handled = QCoreApplication::instance()->filterNativeEvent(m_nativeInterface->genericEventFilterType(), event, &result);
+ QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance();
+ bool handled = dispatcher && dispatcher->filterNativeEvent(m_nativeInterface->genericEventFilterType(), event, &result);
uint response_type = event->response_type & ~0x80;