macOS: Update all deprecated enums to their 10.12+ equivalents

Change-Id: I3034258da95c9c70eb6758db92967f438617f6e9
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
bb10
Tor Arne Vestbø 2018-08-24 16:51:23 +02:00
parent b02fe1bfe7
commit 556beea4c3
14 changed files with 133 additions and 135 deletions

View File

@ -116,8 +116,8 @@ static bool qt_filterEvent(NSEvent *event)
filterNativeEvent(q_macLocalEventType, static_cast<void*>(event), nullptr))
return true;
if ([event type] == NSApplicationDefined) {
switch (static_cast<short>([event subtype])) {
if (event.type == NSEventTypeApplicationDefined) {
switch (static_cast<short>(event.subtype)) {
case QtCocoaEventSubTypePostMessage:
qt_sendPostedMessage(event);
return true;
@ -137,7 +137,7 @@ static void qt_maybeSendKeyEquivalentUpEvent(NSEvent *event)
// and forward the key event to the key (focus) window.
// However, non-Qt windows will not (and should not) get
// any special treatment, only QWindow-owned NSWindows.
if (event.type == NSKeyUp && (event.modifierFlags & NSCommandKeyMask)) {
if (event.type == NSEventTypeKeyUp && (event.modifierFlags & NSEventModifierFlagCommand)) {
NSWindow *targetWindow = event.window;
if ([targetWindow.class conformsToProtocol:@protocol(QNSWindowProtocol)])
[targetWindow sendEvent:event];

View File

@ -293,25 +293,25 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
switch( [event type] )
{
case NSLeftMouseDown:
case NSLeftMouseUp:
case NSRightMouseDown:
case NSRightMouseUp:
case NSMouseMoved: // ??
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSMouseEntered:
case NSMouseExited:
case NSKeyDown:
case NSKeyUp:
case NSFlagsChanged: // key modifiers changed?
case NSCursorUpdate: // ??
case NSScrollWheel:
case NSTabletPoint:
case NSTabletProximity:
case NSOtherMouseDown:
case NSOtherMouseUp:
case NSOtherMouseDragged:
case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseUp:
case NSEventTypeRightMouseDown:
case NSEventTypeRightMouseUp:
case NSEventTypeMouseMoved: // ??
case NSEventTypeLeftMouseDragged:
case NSEventTypeRightMouseDragged:
case NSEventTypeMouseEntered:
case NSEventTypeMouseExited:
case NSEventTypeKeyDown:
case NSEventTypeKeyUp:
case NSEventTypeFlagsChanged: // key modifiers changed?
case NSEventTypeCursorUpdate: // ??
case NSEventTypeScrollWheel:
case NSEventTypeTabletPoint:
case NSEventTypeTabletProximity:
case NSEventTypeOtherMouseDown:
case NSEventTypeOtherMouseUp:
case NSEventTypeOtherMouseDragged:
#ifndef QT_NO_GESTURES
case NSEventTypeGesture: // touch events
case NSEventTypeMagnify:
@ -335,7 +335,7 @@ static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRun
// at least one event occur. Setting 'dequeuing' to 'no' in the following call
// causes it to hang under certain circumstances (QTBUG-28283), so we tell it
// to dequeue instead, just to repost the event again:
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
untilDate:[NSDate distantFuture]
inMode:runLoopMode
dequeue:YES];
@ -460,7 +460,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
// Dispatch all non-user events (but que non-user events up for later). In
// this case, we need more control over which events gets dispatched, and
// cannot use [NSApp runModalSession:session]:
event = [NSApp nextEventMatchingMask:NSAnyEventMask
event = [NSApp nextEventMatchingMask:NSEventMaskAny
untilDate:nil
inMode:NSModalPanelRunLoopMode
dequeue: YES];
@ -479,7 +479,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
} while (!d->interrupt && event);
} else do {
// INVARIANT: No modal window is executing.
event = [NSApp nextEventMatchingMask:NSAnyEventMask
event = [NSApp nextEventMatchingMask:NSEventMaskAny
untilDate:nil
inMode:NSDefaultRunLoopMode
dequeue: YES];
@ -936,7 +936,7 @@ void QCocoaEventDispatcherPrivate::cancelWaitForMoreEvents()
// In case the event dispatcher is waiting for more
// events somewhere, we post a dummy event to wake it up:
QMacAutoReleasePool pool;
[NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint
[NSApp postEvent:[NSEvent otherEventWithType:NSEventTypeApplicationDefined location:NSZeroPoint
modifierFlags:0 timestamp:0. windowNumber:0 context:nil
subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO];
}

View File

@ -515,8 +515,8 @@ static QString strippedText(QString s)
NSRect textRect = { { 0.0, 3.0 }, { 100.0, 25.0 } };
mTextField = [[NSTextField alloc] initWithFrame:textRect];
[[mTextField cell] setFont:[NSFont systemFontOfSize:
[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
[mTextField setAlignment:NSRightTextAlignment];
[NSFont systemFontSizeForControlSize:NSControlSizeRegular]]];
[mTextField setAlignment:NSTextAlignmentRight];
[mTextField setEditable:false];
[mTextField setSelectable:false];
[mTextField setBordered:false];

View File

@ -295,12 +295,12 @@ Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
Qt::MouseButton cocoaButton2QtButton(NSEvent *event)
{
switch (event.type) {
case NSMouseMoved:
case NSEventTypeMouseMoved:
return Qt::NoButton;
case NSRightMouseUp:
case NSRightMouseDown:
case NSRightMouseDragged:
case NSEventTypeRightMouseUp:
case NSEventTypeRightMouseDown:
case NSEventTypeRightMouseDragged:
return Qt::RightButton;
default:
@ -318,22 +318,22 @@ Qt::MouseButton cocoaButton2QtButton(NSEvent *event)
QEvent::Type cocoaEvent2QtMouseEvent(NSEvent *event)
{
switch (event.type) {
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
case NSEventTypeLeftMouseDown:
case NSEventTypeRightMouseDown:
case NSEventTypeOtherMouseDown:
return QEvent::MouseButtonPress;
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
case NSEventTypeLeftMouseUp:
case NSEventTypeRightMouseUp:
case NSEventTypeOtherMouseUp:
return QEvent::MouseButtonRelease;
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
case NSEventTypeLeftMouseDragged:
case NSEventTypeRightMouseDragged:
case NSEventTypeOtherMouseDragged:
return QEvent::MouseMove;
case NSMouseMoved:
case NSEventTypeMouseMoved:
return QEvent::MouseMove;
default:
@ -432,7 +432,7 @@ QT_END_NAMESPACE
// FIXME: Not obvious, from Cocoa's documentation, that QString::toNSString() makes a deep copy
button.title = (NSString *)cleanTitle.toCFString();
((NSButtonCell *)button.cell).font =
[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSControlSizeRegular]];
[self addSubview:button];
return button;
}

View File

@ -391,7 +391,7 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect,
if (view) {
// Finally, we need to synthesize an event.
NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown
NSEvent *menuEvent = [NSEvent mouseEventWithType:NSEventTypeRightMouseDown
location:nsPos
modifierFlags:0
timestamp:0

View File

@ -61,13 +61,13 @@ static quint32 constructModifierMask(quint32 accel_key)
quint32 ret = 0;
const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
if ((accel_key & Qt::CTRL) == Qt::CTRL)
ret |= (dontSwap ? NSControlKeyMask : NSCommandKeyMask);
ret |= (dontSwap ? NSEventModifierFlagControl : NSEventModifierFlagCommand);
if ((accel_key & Qt::META) == Qt::META)
ret |= (dontSwap ? NSCommandKeyMask : NSControlKeyMask);
ret |= (dontSwap ? NSEventModifierFlagCommand : NSEventModifierFlagControl);
if ((accel_key & Qt::ALT) == Qt::ALT)
ret |= NSAlternateKeyMask;
ret |= NSEventModifierFlagOption;
if ((accel_key & Qt::SHIFT) == Qt::SHIFT)
ret |= NSShiftKeyMask;
ret |= NSEventModifierFlagShift;
return ret;
}
@ -343,7 +343,7 @@ NSMenuItem *QCocoaMenuItem::sync()
#endif
{
m_native.keyEquivalent = @"";
m_native.keyEquivalentModifierMask = NSCommandKeyMask;
m_native.keyEquivalentModifierMask = NSEventModifierFlagCommand;
}
NSImage *img = nil;

View File

@ -155,7 +155,7 @@
action:@selector(hideOtherApplications:)
keyEquivalent:@"h"];
hideAllOthersItem.target = self;
hideAllOthersItem.keyEquivalentModifierMask = NSCommandKeyMask | NSAlternateKeyMask;
hideAllOthersItem.keyEquivalentModifierMask = NSEventModifierFlagCommand | NSEventModifierFlagOption;
[appMenu addItem:hideAllOthersItem];
// Show All

View File

@ -225,7 +225,8 @@ static NSString *qt_mac_removePrivateUnicode(NSString *string)
CHECK_MENU_CLASS(menu);
// Interested only in Shift, Cmd, Ctrl & Alt Keys, so ignoring masks like, Caps lock, Num Lock ...
static const NSUInteger mask = NSShiftKeyMask | NSControlKeyMask | NSCommandKeyMask | NSAlternateKeyMask;
static const NSUInteger mask = NSEventModifierFlagShift | NSEventModifierFlagControl
| NSEventModifierFlagCommand | NSEventModifierFlagOption;
// Change the private unicode keys to the ones used in setting the "Key Equivalents"
NSString *characters = qt_mac_removePrivateUnicode(event.charactersIgnoringModifiers);

View File

@ -337,9 +337,9 @@ void QCocoaWindow::setVisible(bool visible)
// Since this isn't a native popup, the window manager doesn't close the popup when you click outside
NSWindow *nativeParentWindow = parentCocoaWindow->nativeWindow();
NSUInteger parentStyleMask = nativeParentWindow.styleMask;
if ((m_resizableTransientParent = (parentStyleMask & NSResizableWindowMask))
&& !(nativeParentWindow.styleMask & NSFullScreenWindowMask))
nativeParentWindow.styleMask &= ~NSResizableWindowMask;
if ((m_resizableTransientParent = (parentStyleMask & NSWindowStyleMaskResizable))
&& !(nativeParentWindow.styleMask & NSWindowStyleMaskFullScreen))
nativeParentWindow.styleMask &= ~NSWindowStyleMaskResizable;
}
}
@ -384,7 +384,9 @@ void QCocoaWindow::setVisible(bool visible)
((NSPanel *)m_view.window).worksWhenModal = YES;
if (!(parentCocoaWindow && window()->transientParent()->isActive()) && window()->type() == Qt::Popup) {
removeMonitor();
monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDownMask|NSMouseMovedMask handler:^(NSEvent *e) {
NSEventMask eventMask = NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown
| NSEventMaskOtherMouseDown | NSEventMaskMouseMoved;
monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *e) {
const auto button = cocoaButton2QtButton(e);
const auto buttons = currentlyPressedMouseButtons();
const auto eventType = cocoaEvent2QtMouseEvent(e);
@ -446,9 +448,9 @@ void QCocoaWindow::setVisible(bool visible)
if (parentCocoaWindow && window()->type() == Qt::Popup) {
NSWindow *nativeParentWindow = parentCocoaWindow->nativeWindow();
if (m_resizableTransientParent
&& !(nativeParentWindow.styleMask & NSFullScreenWindowMask))
&& !(nativeParentWindow.styleMask & NSWindowStyleMaskFullScreen))
// A window should not be resizable while a transient popup is open
nativeParentWindow.styleMask |= NSResizableWindowMask;
nativeParentWindow.styleMask |= NSWindowStyleMaskResizable;
}
}
@ -491,39 +493,39 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
const bool frameless = (flags & Qt::FramelessWindowHint) || windowIsPopupType(type);
// Remove zoom button by disabling resize for CustomizeWindowHint windows, except for
// Qt::Tool windows (e.g. dock windows) which should always be resizeable.
const bool resizeable = !(flags & Qt::CustomizeWindowHint) || (type == Qt::Tool);
// Qt::Tool windows (e.g. dock windows) which should always be resizable.
const bool resizable = !(flags & Qt::CustomizeWindowHint) || (type == Qt::Tool);
// Select base window type. Note that the value of NSBorderlessWindowMask is 0.
NSUInteger styleMask = (frameless || !resizeable) ? NSBorderlessWindowMask : NSResizableWindowMask;
NSUInteger styleMask = (frameless || !resizable) ? NSWindowStyleMaskBorderless : NSWindowStyleMaskResizable;
if (frameless) {
// No further customizations for frameless since there are no window decorations.
} else if (flags & Qt::CustomizeWindowHint) {
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;
styleMask |= NSWindowStyleMaskTitled;
if (flags & Qt::WindowCloseButtonHint)
styleMask |= NSClosableWindowMask;
styleMask |= NSWindowStyleMaskClosable;
if (flags & Qt::WindowMinimizeButtonHint)
styleMask |= NSMiniaturizableWindowMask;
styleMask |= NSWindowStyleMaskMiniaturizable;
if (flags & Qt::WindowMaximizeButtonHint)
styleMask |= NSResizableWindowMask;
styleMask |= NSWindowStyleMaskResizable;
} else {
styleMask |= NSClosableWindowMask | NSTitledWindowMask;
styleMask |= NSWindowStyleMaskClosable | NSWindowStyleMaskTitled;
if (type != Qt::Dialog)
styleMask |= NSMiniaturizableWindowMask;
styleMask |= NSWindowStyleMaskMiniaturizable;
}
if (type == Qt::Tool)
styleMask |= NSUtilityWindowMask;
styleMask |= NSWindowStyleMaskUtilityWindow;
if (m_drawContentBorderGradient)
styleMask |= NSTexturedBackgroundWindowMask;
styleMask |= NSWindowStyleMaskTexturedBackground;
// Don't wipe fullscreen state
if (m_view.window.styleMask & NSFullScreenWindowMask)
styleMask |= NSFullScreenWindowMask;
if (m_view.window.styleMask & NSWindowStyleMaskFullScreen)
styleMask |= NSWindowStyleMaskFullScreen;
return styleMask;
}
@ -630,7 +632,7 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState)
const NSWindow *nsWindow = m_view.window;
if (nsWindow.styleMask & NSUtilityWindowMask
if (nsWindow.styleMask & NSWindowStyleMaskUtilityWindow
&& newState & (Qt::WindowMinimized | Qt::WindowFullScreen)) {
qWarning() << window()->type() << "windows can not be made" << newState;
handleWindowStateChanged(HandleUnconditionally);
@ -704,14 +706,14 @@ void QCocoaWindow::toggleMaximized()
// The NSWindow needs to be resizable, otherwise the window will
// not be possible to zoom back to non-zoomed state.
const bool wasResizable = window.styleMask & NSResizableWindowMask;
window.styleMask |= NSResizableWindowMask;
const bool wasResizable = window.styleMask & NSWindowStyleMaskResizable;
window.styleMask |= NSWindowStyleMaskResizable;
const id sender = window;
[window zoom:sender];
if (!wasResizable)
window.styleMask &= ~NSResizableWindowMask;
window.styleMask &= ~NSWindowStyleMaskResizable;
}
void QCocoaWindow::toggleFullScreen()
@ -735,13 +737,13 @@ void QCocoaWindow::windowWillEnterFullScreen()
// The NSWindow needs to be resizable, otherwise we'll end up with
// the normal window geometry, centered in the middle of the screen
// on a black background. The styleMask will be reset below.
m_view.window.styleMask |= NSResizableWindowMask;
m_view.window.styleMask |= NSWindowStyleMaskResizable;
}
bool QCocoaWindow::isTransitioningToFullScreen() const
{
NSWindow *window = m_view.window;
return window.styleMask & NSFullScreenWindowMask && !window.qt_fullScreen;
return window.styleMask & NSWindowStyleMaskFullScreen && !window.qt_fullScreen;
}
void QCocoaWindow::windowDidEnterFullScreen()
@ -765,7 +767,7 @@ void QCocoaWindow::windowWillExitFullScreen()
// The NSWindow needs to be resizable, otherwise we'll end up with
// a weird zoom animation. The styleMask will be reset below.
m_view.window.styleMask |= NSResizableWindowMask;
m_view.window.styleMask |= NSWindowStyleMaskResizable;
}
void QCocoaWindow::windowDidExitFullScreen()
@ -1707,7 +1709,7 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
return;
if (!m_drawContentBorderGradient) {
window.styleMask = window.styleMask & ~NSTexturedBackgroundWindowMask;
window.styleMask = window.styleMask & ~NSWindowStyleMaskTexturedBackground;
[window.contentView.superview setNeedsDisplay:YES];
window.titlebarAppearsTransparent = NO;
return;
@ -1733,7 +1735,7 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
int effectiveBottomContentBorderThickness = m_bottomContentBorderThickness;
[window setStyleMask:[window styleMask] | NSTexturedBackgroundWindowMask];
[window setStyleMask:[window styleMask] | NSWindowStyleMaskTexturedBackground];
window.titlebarAppearsTransparent = YES;
[window setContentBorderThickness:effectiveTopContentBorderThickness forEdge:NSMaxYEdge];

View File

@ -45,15 +45,15 @@
{
const bool dontSwapCtrlAndMeta = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
Qt::KeyboardModifiers qtMods =Qt::NoModifier;
if (modifierFlags & NSShiftKeyMask)
if (modifierFlags & NSEventModifierFlagShift)
qtMods |= Qt::ShiftModifier;
if (modifierFlags & NSControlKeyMask)
if (modifierFlags & NSEventModifierFlagShift)
qtMods |= dontSwapCtrlAndMeta ? Qt::ControlModifier : Qt::MetaModifier;
if (modifierFlags & NSAlternateKeyMask)
if (modifierFlags & NSEventModifierFlagOption)
qtMods |= Qt::AltModifier;
if (modifierFlags & NSCommandKeyMask)
if (modifierFlags & NSEventModifierFlagCommand)
qtMods |= dontSwapCtrlAndMeta ? Qt::MetaModifier : Qt::ControlModifier;
if (modifierFlags & NSNumericPadKeyMask)
if (modifierFlags & NSEventModifierFlagCommand)
qtMods |= Qt::KeypadModifier;
return qtMods;
}
@ -201,7 +201,7 @@
Q_UNUSED(sender);
NSEvent *currentEvent = [NSApp currentEvent];
if (!currentEvent || currentEvent.type != NSKeyDown)
if (!currentEvent || currentEvent.type != NSEventTypeKeyDown)
return;
// Handling the key event may recurse back here through interpretKeyEvents
@ -233,11 +233,11 @@
Qt::Key qt_code;
};
static qt_mac_enum_mapper modifier_key_symbols[] = {
{ NSShiftKeyMask, Qt::Key_Shift },
{ NSControlKeyMask, Qt::Key_Meta },
{ NSCommandKeyMask, Qt::Key_Control },
{ NSAlternateKeyMask, Qt::Key_Alt },
{ NSAlphaShiftKeyMask, Qt::Key_CapsLock },
{ NSEventModifierFlagShift, Qt::Key_Shift },
{ NSEventModifierFlagControl, Qt::Key_Meta },
{ NSEventModifierFlagCommand, Qt::Key_Control },
{ NSEventModifierFlagOption, Qt::Key_Alt },
{ NSEventModifierFlagCapsLock, Qt::Key_CapsLock },
{ 0ul, Qt::Key_unknown } };
for (int i = 0; modifier_key_symbols[i].mac_mask != 0u; ++i) {
uint mac_mask = modifier_key_symbols[i].mac_mask;

View File

@ -91,31 +91,26 @@
if (m_buttons != Qt::NoButton)
return;
NSEventType ty = [theEvent type];
switch (ty) {
case NSLeftMouseDown:
switch (theEvent.type) {
case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseDragged:
m_frameStrutButtons |= Qt::LeftButton;
break;
case NSLeftMouseUp:
case NSEventTypeLeftMouseUp:
m_frameStrutButtons &= ~Qt::LeftButton;
break;
case NSRightMouseDown:
case NSEventTypeRightMouseDown:
case NSEventTypeRightMouseDragged:
m_frameStrutButtons |= Qt::RightButton;
break;
case NSLeftMouseDragged:
m_frameStrutButtons |= Qt::LeftButton;
break;
case NSRightMouseDragged:
m_frameStrutButtons |= Qt::RightButton;
break;
case NSRightMouseUp:
case NSEventTypeRightMouseUp:
m_frameStrutButtons &= ~Qt::RightButton;
break;
case NSOtherMouseDown:
m_frameStrutButtons |= cocoaButton2QtButton([theEvent buttonNumber]);
case NSEventTypeOtherMouseDown:
m_frameStrutButtons |= cocoaButton2QtButton(theEvent.buttonNumber);
break;
case NSOtherMouseUp:
m_frameStrutButtons &= ~cocoaButton2QtButton([theEvent buttonNumber]);
case NSEventTypeOtherMouseUp:
m_frameStrutButtons &= ~cocoaButton2QtButton(theEvent.buttonNumber);
default:
break;
}
@ -581,7 +576,7 @@
// knowing whether or not a NSEventPhaseEnded will be followed by a momentum phase.
// The best we can do is to look at the event queue and hope that the system has
// had time to emit a momentum phase event.
if ([NSApp nextEventMatchingMask:NSScrollWheelMask untilDate:[NSDate distantPast]
if ([NSApp nextEventMatchingMask:NSEventMaskScrollWheel untilDate:[NSDate distantPast]
inMode:@"QtMomementumEventSearchMode" dequeue:NO].momentumPhase == NSEventPhaseBegan) {
Q_ASSERT(pixelDelta.isNull() && angleDelta.isNull());
return; // Ignore this event, as it has a delta of 0,0

View File

@ -64,7 +64,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
return false;
NSEventType eventType = [theEvent type];
if (eventType != NSTabletPoint && [theEvent subtype] != NSTabletPointEventSubtype)
if (eventType != NSEventTypeTabletPoint && [theEvent subtype] != NSEventSubtypeTabletPoint)
return false; // Not a tablet event.
ulong timestamp = [theEvent timestamp] * 1000;
@ -82,7 +82,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
}
const QCocoaTabletDeviceData &deviceData = tabletDeviceDataHash->value(deviceId);
bool down = (eventType != NSMouseMoved);
bool down = (eventType != NSEventTypeMouseMoved);
qreal pressure;
if (down) {
@ -182,17 +182,17 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
deviceData.capabilityMask = [theEvent capabilityMask];
switch ([theEvent pointingDeviceType]) {
case NSUnknownPointingDevice:
case NSPointingDeviceTypeUnknown:
default:
deviceData.pointerType = QTabletEvent::UnknownPointer;
break;
case NSPenPointingDevice:
case NSPointingDeviceTypePen:
deviceData.pointerType = QTabletEvent::Pen;
break;
case NSCursorPointingDevice:
case NSPointingDeviceTypeCursor:
deviceData.pointerType = QTabletEvent::Cursor;
break;
case NSEraserPointingDevice:
case NSPointingDeviceTypeEraser:
deviceData.pointerType = QTabletEvent::Eraser;
break;
}

View File

@ -50,13 +50,13 @@ Q_LOGGING_CATEGORY(lcQpaEvents, "qt.qpa.events");
static bool isMouseEvent(NSEvent *ev)
{
switch ([ev type]) {
case NSLeftMouseDown:
case NSLeftMouseUp:
case NSRightMouseDown:
case NSRightMouseUp:
case NSMouseMoved:
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSEventTypeLeftMouseDown:
case NSEventTypeLeftMouseUp:
case NSEventTypeRightMouseDown:
case NSEventTypeRightMouseUp:
case NSEventTypeMouseMoved:
case NSEventTypeLeftMouseDragged:
case NSEventTypeRightMouseDragged:
return true;
default:
return false;
@ -186,16 +186,16 @@ static bool isMouseEvent(NSEvent *ev)
/*!
Borderless windows need a transparent background
Technically windows with NSTexturedBackgroundWindowMask (such
as windows with unified toolbars) need to draw the textured
Technically windows with NSWindowStyleMaskTexturedBackground
(such as windows with unified toolbars) need to draw the textured
background of the NSWindow, and can't have a transparent
background, but as NSBorderlessWindowMask is 0, you can't
have a window with NSTexturedBackgroundWindowMask that is
background, but as NSWindowStyleMaskBorderless is 0, you can't
have a window with NSWindowStyleMaskTexturedBackground that is
also borderless.
*/
- (NSColor *)backgroundColor
{
return self.styleMask == NSBorderlessWindowMask
return self.styleMask == NSWindowStyleMaskBorderless
? [NSColor clearColor] : qt_objcDynamicSuper();
}

View File

@ -394,9 +394,9 @@ static bool setupSlider(NSSlider *slider, const QStyleOptionSlider *sl)
const bool ticksAbove = sl->tickPosition == QSlider::TicksAbove;
if (sl->orientation == Qt::Horizontal)
slider.tickMarkPosition = ticksAbove ? NSTickMarkAbove : NSTickMarkBelow;
slider.tickMarkPosition = ticksAbove ? NSTickMarkPositionAbove : NSTickMarkPositionBelow;
else
slider.tickMarkPosition = ticksAbove ? NSTickMarkLeft : NSTickMarkRight;
slider.tickMarkPosition = ticksAbove ? NSTickMarkPositionLeading : NSTickMarkPositionTrailing;
} else {
slider.numberOfTickMarks = 0;
}
@ -1785,10 +1785,10 @@ NSView *QMacStylePrivate::cocoaControl(CocoaControl widget) const
auto *ctrl = static_cast<NSControl *>(bv);
switch (widget.size) {
case QStyleHelper::SizeSmall:
ctrl.controlSize = NSSmallControlSize;
ctrl.controlSize = NSControlSizeSmall;
break;
case QStyleHelper::SizeMini:
ctrl.controlSize = NSMiniControlSize;
ctrl.controlSize = NSControlSizeMini;
break;
default:
break;
@ -1799,10 +1799,10 @@ NSView *QMacStylePrivate::cocoaControl(CocoaControl widget) const
pi.indeterminate = (widget.type == ProgressIndicator_Indeterminate);
switch (widget.size) {
case QStyleHelper::SizeSmall:
pi.controlSize = NSSmallControlSize;
pi.controlSize = NSControlSizeSmall;
break;
case QStyleHelper::SizeMini:
pi.controlSize = NSMiniControlSize;
pi.controlSize = NSControlSizeMini;
break;
default:
break;
@ -1848,10 +1848,10 @@ NSCell *QMacStylePrivate::cocoaCell(CocoaControl widget) const
switch (widget.size) {
case QStyleHelper::SizeSmall:
cell.controlSize = NSSmallControlSize;
cell.controlSize = NSControlSizeSmall;
break;
case QStyleHelper::SizeMini:
cell.controlSize = NSMiniControlSize;
cell.controlSize = NSControlSizeMini;
break;
default:
break;
@ -2191,9 +2191,9 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
ret = 0;
break;
case PM_TitleBarHeight: {
NSUInteger style = NSTitledWindowMask;
NSUInteger style = NSWindowStyleMaskTitled;
if (widget && ((widget->windowFlags() & Qt::Tool) == Qt::Tool))
style |= NSUtilityWindowMask;
style |= NSWindowStyleMaskUtilityWindow;
ret = int([NSWindow frameRectForContentRect:NSZeroRect
styleMask:style].size.height);
break; }