From e11c7cb71da01989da9370c10e30af0c6a21a1f4 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sat, 19 Nov 2022 19:53:28 +0100 Subject: [PATCH] Remove all uses of Q_WS_* macros They are only defined with Qt4. --- src/frontends/qt/GuiApplication.cpp | 63 ++--------------------------- src/frontends/qt/GuiApplication.h | 4 +- src/frontends/qt/GuiView.cpp | 2 - src/frontends/qt/GuiWorkArea.cpp | 4 -- 4 files changed, 5 insertions(+), 68 deletions(-) diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp index 3e847435e2..d04511ae7f 100644 --- a/src/frontends/qt/GuiApplication.cpp +++ b/src/frontends/qt/GuiApplication.cpp @@ -122,13 +122,7 @@ #include #include -#ifdef Q_WS_X11 -#include -#include -#include -#undef CursorShape -#undef None -#elif defined(QPA_XCB) +#if defined(QPA_XCB) #include #ifdef HAVE_QT5_X11_EXTRAS #include @@ -173,7 +167,7 @@ namespace lyx { frontend::Application * createApplication(int & argc, char * argv[]) { -#if !defined(Q_WS_X11) && !defined(QPA_XCB) +#if !defined(QPA_XCB) // prune -geometry argument(s) by shifting // the following ones 2 places down. for (int i = 0 ; i < argc ; ++i) { @@ -1203,7 +1197,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv) #endif #endif -#if defined(Q_WS_X11) || defined(QPA_XCB) +#if defined(QPA_XCB) // doubleClickInterval() is 400 ms on X11 which is just too long. // On Windows and Mac OS X, the operating system's value is used. // On Microsoft Windows, calling this function sets the double @@ -3496,56 +3490,7 @@ bool GuiApplication::longOperationStarted() { // // X11 specific stuff goes here... -#ifdef Q_WS_X11 -bool GuiApplication::x11EventFilter(XEvent * xev) -{ - if (!current_view_) - return false; - - switch (xev->type) { - case SelectionRequest: { - if (xev->xselectionrequest.selection != XA_PRIMARY) - break; - LYXERR(Debug::SELECTION, "X requested selection."); - BufferView * bv = current_view_->currentBufferView(); - if (bv) { - docstring const sel = bv->requestSelection(); - if (!sel.empty()) { - d->selection_.put(sel); - // Refresh the selection request timestamp. - // We have to do this by ourselves as Qt seems - // not doing that, maybe because of our - // "persistent selection" implementation - // (see comments in GuiSelection.cpp). - XSelectionEvent nev; - nev.type = SelectionNotify; - nev.display = xev->xselectionrequest.display; - nev.requestor = xev->xselectionrequest.requestor; - nev.selection = xev->xselectionrequest.selection; - nev.target = xev->xselectionrequest.target; - nev.property = 0L; // None - nev.time = CurrentTime; - XSendEvent(QX11Info::display(), - nev.requestor, False, 0, - reinterpret_cast(&nev)); - return true; - } - } - break; - } - case SelectionClear: { - if (xev->xselectionclear.selection != XA_PRIMARY) - break; - LYXERR(Debug::SELECTION, "Lost selection."); - BufferView * bv = current_view_->currentBufferView(); - if (bv) - bv->clearSelection(); - break; - } - } - return false; -} -#elif defined(QPA_XCB) +#if defined(QPA_XCB) bool GuiApplication::nativeEventFilter(const QByteArray & eventType, void * message, long *) { diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h index 4aa99504ce..f0483c315a 100644 --- a/src/frontends/qt/GuiApplication.h +++ b/src/frontends/qt/GuiApplication.h @@ -117,9 +117,7 @@ public: //@{ bool notify(QObject * receiver, QEvent * event) override; void commitData(QSessionManager & sm); -#ifdef Q_WS_X11 - bool x11EventFilter(XEvent * ev) override; -#elif defined(QPA_XCB) +#if defined(QPA_XCB) virtual bool nativeEventFilter(const QByteArray & eventType, void * message, long * result) override; #endif diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index e8f7606e8e..ad08a7637e 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -1493,9 +1493,7 @@ void GuiView::updateWindowTitle(GuiWorkArea * wa) // buffer-save has changed too. updateToolbars(); } -#ifndef Q_WS_MAC title += from_ascii(" - LyX"); -#endif setWindowTitle(toqstr(title)); // Sets the path for the window: this is used by OSX to // allow a context click on the title bar showing a menu diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp index 495f2a9ff5..31cfec18f8 100644 --- a/src/frontends/qt/GuiWorkArea.cpp +++ b/src/frontends/qt/GuiWorkArea.cpp @@ -584,10 +584,6 @@ void GuiWorkArea::scrollTo(int value) } // Show the caret immediately after any operation. startBlinkingCaret(); - // FIXME QT5 -#ifdef Q_WS_X11 - QApplication::syncX(); -#endif } -- 2.39.5