commit 833f8c148e2c6e73eadc35d824b54f12cdf1d593
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sun Jun 11 12:43:30 2023 +0200

    Limit QEvent::ApplicationPaletteChange casing to Mac
    
    This is not needed on Linux and dramatically slows down runtime mode
    change
---
 src/frontends/qt/GuiView.cpp |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 6f20db2..e74a532 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -1745,14 +1745,6 @@ bool GuiView::event(QEvent * e)
                return QMainWindow::event(e);
        }
 
-       case QEvent::ApplicationPaletteChange: {
-               // runtime switch from/to dark mode (Mac OS)
-               // We need to update metrics here to avoid a crash (#12786)
-               theBufferList().changed(true);
-               refillToolbars();
-               return QMainWindow::event(e);
-       }
-
        case QEvent::Gesture: {
                QGestureEvent *ge = static_cast<QGestureEvent*>(e);
                QGesture *gp = ge->gesture(Qt::PinchGesture);
@@ -1774,8 +1766,20 @@ bool GuiView::event(QEvent * e)
                return QMainWindow::event(e);
        }
 
+       // dark/light mode runtime switch support, OS-dependent.
+       // 1. Mac OS X
+       // Limit to Q_OS_MAC as this unnecessarily would also
+       // trigger on Linux with grave performance issues
+#ifdef Q_OS_MAC
+       case QEvent::ApplicationPaletteChange: {
+               // We need to update metrics here to avoid a crash (#12786)
+               theBufferList().changed(true);
+               refillToolbars();
+               return QMainWindow::event(e);
+       }
+#endif
+       // 2. Linux
        case QEvent::StyleChange: {
-               // This might be a change from dark to light mode (Linux)
                // We need to update metrics here to avoid a crash (#12786)
                theBufferList().changed(true);
                return QMainWindow::event(e);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to