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:
parent
58a67e4e0a
commit
b56e856d21
@ -293,46 +293,42 @@ 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]) {
|
||||||
|
case NSEventTypeLeftMouseDown:
|
||||||
switch( [event type] )
|
case NSEventTypeLeftMouseUp:
|
||||||
{
|
case NSEventTypeRightMouseDown:
|
||||||
case NSEventTypeLeftMouseDown:
|
case NSEventTypeRightMouseUp:
|
||||||
case NSEventTypeLeftMouseUp:
|
case NSEventTypeMouseMoved: // ??
|
||||||
case NSEventTypeRightMouseDown:
|
case NSEventTypeLeftMouseDragged:
|
||||||
case NSEventTypeRightMouseUp:
|
case NSEventTypeRightMouseDragged:
|
||||||
case NSEventTypeMouseMoved: // ??
|
case NSEventTypeMouseEntered:
|
||||||
case NSEventTypeLeftMouseDragged:
|
case NSEventTypeMouseExited:
|
||||||
case NSEventTypeRightMouseDragged:
|
case NSEventTypeKeyDown:
|
||||||
case NSEventTypeMouseEntered:
|
case NSEventTypeKeyUp:
|
||||||
case NSEventTypeMouseExited:
|
case NSEventTypeFlagsChanged: // key modifiers changed?
|
||||||
case NSEventTypeKeyDown:
|
case NSEventTypeCursorUpdate: // ??
|
||||||
case NSEventTypeKeyUp:
|
case NSEventTypeScrollWheel:
|
||||||
case NSEventTypeFlagsChanged: // key modifiers changed?
|
case NSEventTypeTabletPoint:
|
||||||
case NSEventTypeCursorUpdate: // ??
|
case NSEventTypeTabletProximity:
|
||||||
case NSEventTypeScrollWheel:
|
case NSEventTypeOtherMouseDown:
|
||||||
case NSEventTypeTabletPoint:
|
case NSEventTypeOtherMouseUp:
|
||||||
case NSEventTypeTabletProximity:
|
case NSEventTypeOtherMouseDragged:
|
||||||
case NSEventTypeOtherMouseDown:
|
|
||||||
case NSEventTypeOtherMouseUp:
|
|
||||||
case NSEventTypeOtherMouseDragged:
|
|
||||||
#ifndef QT_NO_GESTURES
|
#ifndef QT_NO_GESTURES
|
||||||
case NSEventTypeGesture: // touch events
|
case NSEventTypeGesture: // touch events
|
||||||
case NSEventTypeMagnify:
|
case NSEventTypeMagnify:
|
||||||
case NSEventTypeSwipe:
|
case NSEventTypeSwipe:
|
||||||
case NSEventTypeRotate:
|
case NSEventTypeRotate:
|
||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user