From 1d5d480c85afb2fd48f15dae33bf6f33ffb2a929 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 23 Mar 2013 14:16:08 +0100 Subject: [PATCH] Added support for building with Wayland. See NO_X11 define in BUILDING. --- BUILDING | 6 ++++++ src/defines.pri | 2 ++ src/lib/app/qupzilla.cpp | 8 ++++---- src/lib/app/qupzilla.h | 2 +- src/lib/lib.pro | 2 +- src/lib/tools/qztools.cpp | 4 ++-- src/lib/tools/qztools.h | 2 +- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/BUILDING b/BUILDING index 8f179a061..2bc8f29c9 100644 --- a/BUILDING +++ b/BUILDING @@ -127,6 +127,12 @@ Available Defines Linux / Unix specific defines: + NO_X11 Disable all direct X11 calls. + Enable when building for Wayland. + + example: + $ export NO_X11="true" + KDE For now, it just use better oxygen icons in Preferences. Nepomuk integration is planned, and it will be enabled with this define also. diff --git a/src/defines.pri b/src/defines.pri index 48e0ace80..b365fc2e4 100644 --- a/src/defines.pri +++ b/src/defines.pri @@ -62,6 +62,7 @@ d_no_system_datapath = $$(NO_SYSTEM_DATAPATH) d_use_webgl = $$(USE_WEBGL) d_w7api = $$(W7API) d_kde = $$(KDE) +d_nox11 = $$(NO_X11) d_portable = $$(PORTABLE_BUILD) d_nonblock_dialogs = $$(NONBLOCK_JS_DIALOGS) d_use_qtwebkit_2_2 = $$(USE_QTWEBKIT_2_2) @@ -74,6 +75,7 @@ win32-msvc* { equals(d_w7api, "true") { DEFINES *= W7API } } equals(d_kde, "true") { DEFINES *= KDE } +equals(d_nox11, "true") { DEFINES *= NO_X11 } equals(d_portable, "true") { DEFINES *= PORTABLE_BUILD } equals(d_nonblock_dialogs, "true") { DEFINES *= NONBLOCK_JS_DIALOGS } equals(d_use_qtwebkit_2_2, "true") { DEFINES *= USE_QTWEBKIT_2_2 } diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 41527b2f2..e66743f77 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -89,7 +89,7 @@ #include "qwebkitversion.h" #endif -#ifdef QZ_WS_X11 +#if defined(QZ_WS_X11) && !defined(NO_X11) #include #include #endif @@ -2295,7 +2295,7 @@ void QupZilla::setMenuBookmarksAction(QAction* action) QByteArray QupZilla::saveState(int version) const { -#ifdef QZ_WS_X11 +#if defined(QZ_WS_X11) && !defined(NO_X11) QByteArray data; QDataStream stream(&data, QIODevice::WriteOnly); @@ -2310,7 +2310,7 @@ QByteArray QupZilla::saveState(int version) const bool QupZilla::restoreState(const QByteArray &state, int version) { -#ifdef QZ_WS_X11 +#if defined(QZ_WS_X11) && !defined(NO_X11) QByteArray windowState; int desktopId = -1; @@ -2326,7 +2326,7 @@ bool QupZilla::restoreState(const QByteArray &state, int version) #endif } -#ifdef QZ_WS_X11 +#if defined(QZ_WS_X11) && !defined(NO_X11) int QupZilla::getCurrentVirtualDesktop() const { Display* display = static_cast(QzTools::X11Display(this)); diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h index 4e50c855b..35bb2ba02 100644 --- a/src/lib/app/qupzilla.h +++ b/src/lib/app/qupzilla.h @@ -245,7 +245,7 @@ private: bool eventFilter(QObject* object, QEvent* event); #endif -#ifdef QZ_WS_X11 +#if defined(QZ_WS_X11) && !defined(NO_X11) int getCurrentVirtualDesktop() const; void moveToVirtualDesktop(int desktopId); #endif diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 8e6911466..fe5aa4af3 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -452,7 +452,7 @@ isEqual(QT_MAJOR_VERSION, 5) { INSTALLS += target - LIBS += -lX11 + !contains(DEFINES, NO_X11):LIBS += -lX11 RESOURCES -= data/certs.qrc } diff --git a/src/lib/tools/qztools.cpp b/src/lib/tools/qztools.cpp index 90e319b52..6f05a2651 100644 --- a/src/lib/tools/qztools.cpp +++ b/src/lib/tools/qztools.cpp @@ -42,7 +42,7 @@ #if QT_VERSION >= 0x050000 #include #include -#else +#elif !defined(NO_X11) #include #endif @@ -616,7 +616,7 @@ QString QzTools::escape(const QString &string) #endif } -#ifdef QZ_WS_X11 +#if defined(QZ_WS_X11) && !defined(NO_X11) void* QzTools::X11Display(const QWidget* widget) { Q_UNUSED(widget) diff --git a/src/lib/tools/qztools.h b/src/lib/tools/qztools.h index 7465831f8..eb414c38b 100644 --- a/src/lib/tools/qztools.h +++ b/src/lib/tools/qztools.h @@ -71,7 +71,7 @@ QString QT_QUPZILLA_EXPORT operatingSystem(); bool QT_QUPZILLA_EXPORT isCertificateValid(const QSslCertificate &cert); QString QT_QUPZILLA_EXPORT escape(const QString &string); -#ifdef QZ_WS_X11 +#if defined(QZ_WS_X11) && !defined(NO_X11) void QT_QUPZILLA_EXPORT* X11Display(const QWidget* widget); #endif