[LyX features/killqt4] Remove all uses of Q_WS_* macros

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Nov 19 18:09:53 UTC 2022


The branch, killqt4, has been updated.

- Log -----------------------------------------------------------------

commit e11c7cb71da01989da9370c10e30af0c6a21a1f4
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sat Nov 19 19:53:28 2022 +0100

    Remove all uses of Q_WS_* macros
    
    They are only defined with Qt4.

diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 3e84743..d04511a 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -122,13 +122,7 @@
 #include <QThreadPool>
 #include <QWidget>
 
-#ifdef Q_WS_X11
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#include <QX11Info>
-#undef CursorShape
-#undef None
-#elif defined(QPA_XCB)
+#if defined(QPA_XCB)
 #include <xcb/xcb.h>
 #ifdef HAVE_QT5_X11_EXTRAS
 #include <QtX11Extras/QX11Info>
@@ -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<XEvent *>(&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 4aa9950..f0483c3 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 e8f7606..ad08a76 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 495f2a9..31cfec1 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
 }
 
 

-----------------------------------------------------------------------

Summary of changes:
 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(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list