Cocoa: rename IsMouseOrKeyEvent -> isUserInputEvent

This matches the intended use of this function. Reformat
to modern Qt style.

Change-Id: I076d2bdb3ac14b346f0dc6934f7a47765badc6b0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Morten Johan Sørvig 2019-03-18 12:25:14 +01:00
parent 58a67e4e0a
commit b56e856d21

View File

@ -293,12 +293,9 @@ bool QCocoaEventDispatcher::hasPendingEvents()
return qGlobalPostedEventsCount() || (qt_is_gui_used && !CFRunLoopIsWaiting(CFRunLoopGetMain())); return qGlobalPostedEventsCount() || (qt_is_gui_used && !CFRunLoopIsWaiting(CFRunLoopGetMain()));
} }
static bool IsMouseOrKeyEvent( NSEvent* event ) static bool isUserInputEvent(NSEvent* event)
{ {
bool result = false; switch ([event type]) {
switch( [event type] )
{
case NSEventTypeLeftMouseDown: case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseUp: case NSEventTypeLeftMouseUp:
case NSEventTypeRightMouseDown: case NSEventTypeRightMouseDown:
@ -326,13 +323,12 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
case NSEventTypeBeginGesture: case NSEventTypeBeginGesture:
case NSEventTypeEndGesture: case NSEventTypeEndGesture:
#endif // QT_NO_GESTURES #endif // QT_NO_GESTURES
result = true; return true;
break; break;
default: default:
break; break;
} }
return result; return false;
} }
static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRunLoopMode) static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRunLoopMode)
@ -465,7 +461,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
dequeue: YES]; dequeue: YES];
if (event) { if (event) {
if (IsMouseOrKeyEvent(event)) { if (isUserInputEvent(event)) {
[event retain]; [event retain];
d->queuedUserInputEvents.append(event); d->queuedUserInputEvents.append(event);
continue; continue;
@ -485,7 +481,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
if (event) { if (event) {
if (flags & QEventLoop::ExcludeUserInputEvents) { if (flags & QEventLoop::ExcludeUserInputEvents) {
if (IsMouseOrKeyEvent(event)) { if (isUserInputEvent(event)) {
[event retain]; [event retain];
d->queuedUserInputEvents.append(event); d->queuedUserInputEvents.append(event);
continue; continue;