mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2025-05-23 20:34:07 +02:00
Merge pull request #2677 from briankendall/fix-tray-window-spaces-bug
Fix macOS bug where tray window causes spaces to switch
This commit is contained in:
commit
7721832ee0
@ -267,6 +267,14 @@ void Systray::forceWindowInit(QQuickWindow *window) const
|
|||||||
// this shouldn't flicker
|
// this shouldn't flicker
|
||||||
window->show();
|
window->show();
|
||||||
window->hide();
|
window->hide();
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
// On macOS we need to designate the tray window as visible on all spaces and
|
||||||
|
// at the menu bar level, otherwise showing it can cause the current spaces to
|
||||||
|
// change, or the window could be obscured by another window that shouldn't
|
||||||
|
// normally cover a menu.
|
||||||
|
OCC::setTrayWindowLevelAndVisibleOnAllSpaces(window);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QScreen *Systray::currentScreen() const
|
QScreen *Systray::currentScreen() const
|
||||||
|
@ -23,12 +23,14 @@
|
|||||||
class QScreen;
|
class QScreen;
|
||||||
class QQmlApplicationEngine;
|
class QQmlApplicationEngine;
|
||||||
class QQuickWindow;
|
class QQuickWindow;
|
||||||
|
class QWindow;
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
bool canOsXSendUserNotification();
|
bool canOsXSendUserNotification();
|
||||||
void sendOsXUserNotification(const QString &title, const QString &message);
|
void sendOsXUserNotification(const QString &title, const QString &message);
|
||||||
|
void setTrayWindowLevelAndVisibleOnAllSpaces(QWindow *window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QWindow>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
@interface NotificationCenterDelegate : NSObject
|
@interface NotificationCenterDelegate : NSObject
|
||||||
@ -41,4 +42,13 @@ void sendOsXUserNotification(const QString &title, const QString &message)
|
|||||||
[notification release];
|
[notification release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setTrayWindowLevelAndVisibleOnAllSpaces(QWindow *window)
|
||||||
|
{
|
||||||
|
NSView *nativeView = (NSView *)window->winId();
|
||||||
|
NSWindow *nativeWindow = (NSWindow *)[nativeView window];
|
||||||
|
[nativeWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorIgnoresCycle |
|
||||||
|
NSWindowCollectionBehaviorTransient];
|
||||||
|
[nativeWindow setLevel:NSMainMenuWindowLevel];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user