From b841793de73cfe700cd2a294214cf47519e94873 Mon Sep 17 00:00:00 2001 From: jpapale Date: Mon, 28 Dec 2020 14:46:17 +0100 Subject: [PATCH] Activated 'maskUpdate' for MAC + QT >= 5.10, which solves MAC desktop issue, where events would not be propagated to apps on the background (cf https://bugreports.qt.io/browse/QTBUG-81456). --- src/core/UB.h | 4 +++ src/desktop/UBDesktopAnnotationController.cpp | 28 ++++++------------- src/desktop/UBDesktopPalette.cpp | 4 +-- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/core/UB.h b/src/core/UB.h index 4ad8701b..86f9691a 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -35,6 +35,10 @@ #define UB_MAX_ZOOM 9 +#if defined(Q_OS_LINUX) || (defined(Q_OS_OSX) && (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))) +#define UB_REQUIRES_MASK_UPDATE 1 +#endif + struct UBMimeType { enum Enum diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index d7e3e859..8ea7ccb7 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -86,19 +86,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true); #endif //Q_OS_OSX -#if defined(Q_OS_OSX) && (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) - /* 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 mTransparentDrawingView->setCacheMode(QGraphicsView::CacheNone); mTransparentDrawingView->resize(UBApplication::desktop()->width(), UBApplication::desktop()->height()); @@ -124,7 +112,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB connect( UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(keyboardActivated(bool)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool))); -#ifdef Q_OS_LINUX +#ifdef UB_REQUIRES_MASK_UPDATE connect(UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask())); connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(refreshMask())); connect(mDesktopPalette,SIGNAL(refreshMask()), this, SLOT(refreshMask())); @@ -179,7 +167,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB connect(&mHoldTimerMarker, SIGNAL(timeout()), this, SLOT(markerActionReleased())); connect(&mHoldTimerEraser, SIGNAL(timeout()), this, SLOT(eraserActionReleased())); -#ifdef Q_OS_LINUX +#ifdef UB_REQUIRES_MASK_UPDATE connect(mDesktopPalette, SIGNAL(moving()), this, SLOT(refreshMask())); connect(UBApplication::boardController->paletteManager()->rightPalette(), SIGNAL(resized()), this, SLOT(refreshMask())); connect(UBApplication::boardController->paletteManager()->addItemPalette(), SIGNAL(closed()), this, SLOT(refreshMask())); @@ -359,9 +347,9 @@ void UBDesktopAnnotationController::showWindow() mDesktopPalette->appear(); -#ifdef Q_OS_LINUX +#ifdef UB_REQUIRES_MASK_UPDATE updateMask(true); -#endif +#endif // UB_REQUIRES_MASK_UPDATE } @@ -404,9 +392,9 @@ void UBDesktopAnnotationController::updateBackground() || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Selector) { newBrush = QBrush(Qt::transparent); -#ifdef Q_OS_LINUX +#ifdef UB_REQUIRES_MASK_UPDATE updateMask(true); -#endif +#endif //UB_REQUIRES_MASK_UPDATE } else { @@ -415,9 +403,9 @@ void UBDesktopAnnotationController::updateBackground() #else newBrush = QBrush(QColor(127, 127, 127, 1)); #endif -#ifdef Q_OS_LINUX +#ifdef UB_REQUIRES_MASK_UPDATE updateMask(false); -#endif +#endif //UB_REQUIRES_MASK_UPDATE } if (mTransparentDrawingScene && mTransparentDrawingScene->backgroundBrush() != newBrush) diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index 5fa9c1cf..2346e4ac 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -173,7 +173,7 @@ void UBDesktopPalette::minimizeMe(eMinimizedLocation location) adjustSizeAndPosition(); -#ifdef Q_OS_LINUX +#ifdef UB_REQUIRES_MASK_UPDATE emit refreshMask(); #endif } @@ -203,7 +203,7 @@ void UBDesktopPalette::maximizeMe() // Notify that the maximization has been done emit maximized(); -#ifdef Q_OS_LINUX +#ifdef UB_REQUIRES_MASK_UPDATE emit refreshMask(); #endif }