diff options
author | David Faure <faure@kde.org> | 2012-07-20 20:52:44 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-24 00:08:28 +0200 |
commit | 42c86bba9d46d8d16ffd6c90ec34857eccc23df4 (patch) | |
tree | 703d79deb66054ed88613474f8d87e9f742f65dd /src | |
parent | 607c37befb145c3aa1b9d29365ac682a2bd3a55f (diff) |
Remove winEventFilter, replaced with installNativeEventFilter.
No reason to keep a virtual method for Windows when all other similar methods
(macEvent and x11Event) have been removed, and when installNativeEventFilter
provides a much nicer solution (no need to derive from QApplication).
Change-Id: Ia2a7960e320fcbd04cef91f467900861dbb377c1
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 36 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.h | 5 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_win.cpp | 15 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 3 |
6 files changed, 7 insertions, 62 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 5ffd94b068..58d8957812 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2139,42 +2139,6 @@ void QCoreApplication::removeLibraryPath(const QString &path) #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. diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 549b6f135d..b791c9168a 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -152,17 +152,12 @@ public: 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); diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index e42411917f..bba27272f9 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -157,21 +157,6 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, 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; diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index e5cc627edb..baacfa6a80 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -353,13 +353,13 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA 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; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index b12975174f..b2c492af39 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -706,8 +706,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, 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; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7f197c8ad5..11e1cc0c17 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -543,7 +543,8 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) #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; |