From 66baf6634e33fb8050f53c02b6654a051d45134e Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 14 Feb 2020 11:01:49 +0100 Subject: [PATCH 1/2] workaround to broken StaysOnTop+TransluscentBackground behavior on OSX 10.13+ (cf. https://bugreports.qt.io/browse/QTBUG-81456). Not satisfying at all but only thing I found acceptable for the moment... --- src/desktop/UBDesktopAnnotationController.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index c7a84db8..94602ac1 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -84,8 +84,10 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true); #ifdef Q_OS_OSX mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true); -#endif + mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint | Qt::Window | Qt::NoDropShadowWindowHint | Qt::X11BypassWindowManagerHint); +#else mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Window | Qt::NoDropShadowWindowHint | Qt::X11BypassWindowManagerHint); +#endif mTransparentDrawingView->setCacheMode(QGraphicsView::CacheNone); mTransparentDrawingView->resize(UBApplication::desktop()->width(), UBApplication::desktop()->height()); From e20a45167a21933a5855c6bad75ebaa8078e7eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Fri, 14 Feb 2020 11:29:06 +0100 Subject: [PATCH 2/2] restrict workaround to 10.13+ versions --- src/desktop/UBDesktopAnnotationController.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 94602ac1..81133d44 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -84,7 +84,15 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true); #ifdef Q_OS_OSX mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true); - mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint | Qt::Window | Qt::NoDropShadowWindowHint | Qt::X11BypassWindowManagerHint); + /* https://bugreports.qt.io/browse/QTBUG-81456 */ + if (QOperatingSystemVersion::current().minorVersion() > 12) /* > Sierra */ + { + mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint | Qt::Window | Qt::NoDropShadowWindowHint | Qt::X11BypassWindowManagerHint); + } + else + { + mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Window | Qt::NoDropShadowWindowHint | Qt::X11BypassWindowManagerHint); + } #else mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Window | Qt::NoDropShadowWindowHint | Qt::X11BypassWindowManagerHint); #endif