macOS: Remove workaround for queued input events to stale windows
We now track the platform window with a QPointer, so the event callbacks can (and do) check the validity of the platform window before passing them on. The window property of the NSView is also nil at the point of even delivery, if we need another way to check if the event is still valid. Task-number: QTBUG-39211 Change-Id: I6179bdb3af9606cd0abf981c0fe6cacb9a2d98ab Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
c888d302bc
commit
85cbd35178
@ -177,8 +177,6 @@ public:
|
|||||||
void maybeCancelWaitForMoreEvents();
|
void maybeCancelWaitForMoreEvents();
|
||||||
void ensureNSAppInitialized();
|
void ensureNSAppInitialized();
|
||||||
|
|
||||||
void removeQueuedUserInputEvents(int nsWinNumber);
|
|
||||||
|
|
||||||
QCFSocketNotifier cfSocketNotifier;
|
QCFSocketNotifier cfSocketNotifier;
|
||||||
QList<void *> queuedUserInputEvents; // NSEvent *
|
QList<void *> queuedUserInputEvents; // NSEvent *
|
||||||
CFRunLoopSourceRef postedEventsSource;
|
CFRunLoopSourceRef postedEventsSource;
|
||||||
|
@ -889,21 +889,6 @@ void QCocoaEventDispatcherPrivate::processPostedEvents()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCocoaEventDispatcherPrivate::removeQueuedUserInputEvents(int nsWinNumber)
|
|
||||||
{
|
|
||||||
if (nsWinNumber) {
|
|
||||||
int eventIndex = queuedUserInputEvents.size();
|
|
||||||
|
|
||||||
while (--eventIndex >= 0) {
|
|
||||||
NSEvent * nsevent = static_cast<NSEvent *>(queuedUserInputEvents.at(eventIndex));
|
|
||||||
if ([nsevent windowNumber] == nsWinNumber) {
|
|
||||||
queuedUserInputEvents.removeAt(eventIndex);
|
|
||||||
[nsevent release];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
|
void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
|
||||||
CFRunLoopActivity activity,
|
CFRunLoopActivity activity,
|
||||||
void *info)
|
void *info)
|
||||||
|
@ -147,15 +147,7 @@ static bool isMouseEvent(NSEvent *ev)
|
|||||||
|
|
||||||
- (void)clearWindow
|
- (void)clearWindow
|
||||||
{
|
{
|
||||||
if (_window) {
|
_window = nil;
|
||||||
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
|
|
||||||
if (cocoaEventDispatcher) {
|
|
||||||
QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
|
|
||||||
cocoaEventDispatcherPrivate->removeQueuedUserInputEvents([_window windowNumber]);
|
|
||||||
}
|
|
||||||
|
|
||||||
_window = nil;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
|
Loading…
Reference in New Issue
Block a user