diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 69d192b4f5..c539afbfcd 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -299,6 +299,22 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect) // will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm) } +bool QCocoaWindow::startSystemMove() +{ + switch (NSApp.currentEvent.type) { + case NSEventTypeLeftMouseDown: + case NSEventTypeRightMouseDown: + case NSEventTypeOtherMouseDown: + case NSEventTypeMouseMoved: + // The documentation only describes starting a system move + // based on mouse down events, but move events also work. + [m_view.window performWindowDragWithEvent:NSApp.currentEvent]; + return true; + default: + return false; + } +} + void QCocoaWindow::setVisible(bool visible) { qCDebug(lcQpaWindow) << "QCocoaWindow::setVisible" << window() << visible; @@ -878,14 +894,10 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon) QMacAutoReleasePool pool; - if (icon.isNull()) { - NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; - [iconButton setImage:[workspace iconForFile:m_view.window.representedFilename]]; - } else { - QPixmap pixmap = icon.pixmap(QSize(22, 22)); - NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap)); - [iconButton setImage:[image autorelease]]; - } + if (icon.isNull()) + iconButton.image = [NSWorkspace.sharedWorkspace iconForFile:m_view.window.representedFilename]; + else + iconButton.image = [NSImage imageFromQIcon:icon]; } void QCocoaWindow::setAlertState(bool enabled) @@ -1224,7 +1236,9 @@ void QCocoaWindow::windowDidOrderOffScreen() void QCocoaWindow::windowDidChangeOcclusionState() { - if (m_view.window.occlusionState & NSWindowOcclusionStateVisible) + bool visible = m_view.window.occlusionState & NSWindowOcclusionStateVisible; + qCDebug(lcQpaWindow) << "QCocoaWindow::windowDidChangeOcclusionState" << window() << "is now" << (visible ? "visible" : "occluded"); + if (visible) [m_view setNeedsDisplay:YES]; else handleExposeEvent(QRegion()); @@ -1619,6 +1633,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) nsWindow.restorable = NO; nsWindow.level = windowLevel(flags); + nsWindow.tabbingMode = NSWindowTabbingModeDisallowed; if (shouldBePanel) { // Qt::Tool windows hide on app deactivation, unless Qt::WA_MacAlwaysShowToolWindow is set |