From 8015841a1a7cd440396cbab771bbbcc9a1ce34f4 Mon Sep 17 00:00:00 2001 From: Timon Wong Date: Fri, 31 May 2013 13:28:36 +0800 Subject: [PATCH] Replace Q_WS_X11 -> HAVE_X11 --- broken_xrecord.cc | 4 ++-- goldendict.pro | 1 + hotkeywrapper.cc | 6 +++--- hotkeywrapper.hh | 2 +- keyboardstate.cc | 4 ++-- mainwindow.cc | 10 +++++----- mainwindow.hh | 4 ++-- qtsingleapplication/src/qtsingleapplication.cpp | 4 ++-- qtsingleapplication/src/qtsingleapplication.h | 4 ++-- scanpopup.cc | 4 ++-- 10 files changed, 22 insertions(+), 21 deletions(-) diff --git a/broken_xrecord.cc b/broken_xrecord.cc index 957b1963..d3f1b00a 100644 --- a/broken_xrecord.cc +++ b/broken_xrecord.cc @@ -5,7 +5,7 @@ #include -#ifdef Q_WS_X11 +#ifdef HAVE_X11 #include #include #include @@ -13,7 +13,7 @@ bool isRECORDBroken() { -#ifdef Q_WS_X11 +#ifdef HAVE_X11 char const * vendor = ServerVendor( QX11Info::display() ); diff --git a/goldendict.pro b/goldendict.pro index 6871b9a6..6d95837a 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -82,6 +82,7 @@ win32 { } unix:!mac { + DEFINES += HAVE_X11 # This is to keep symbols for backtraces QMAKE_CXXFLAGS += -rdynamic QMAKE_LFLAGS += -rdynamic diff --git a/hotkeywrapper.cc b/hotkeywrapper.cc index dbbf47d0..65034be4 100644 --- a/hotkeywrapper.cc +++ b/hotkeywrapper.cc @@ -10,7 +10,7 @@ #include "dprintf.hh" -#ifdef Q_WS_X11 +#ifdef HAVE_X11 #include #endif @@ -97,7 +97,7 @@ void HotkeyWrapper::waitKey2() { state2 = false; -#ifdef Q_WS_X11 +#ifdef HAVE_X11 if ( keyToUngrab != grabbedKeys.end() ) { @@ -185,7 +185,7 @@ bool HotkeyWrapper::checkState(quint32 vk, quint32 mod) state2waiter = hs; QTimer::singleShot(500, this, SLOT(waitKey2())); - #ifdef Q_WS_X11 + #ifdef HAVE_X11 // Grab the second key, unless it's grabbed already // Note that we only grab the clipboard key only if diff --git a/hotkeywrapper.hh b/hotkeywrapper.hh index 8d3b112e..2b2ccc8b 100644 --- a/hotkeywrapper.hh +++ b/hotkeywrapper.hh @@ -3,7 +3,7 @@ #include -#ifdef Q_WS_X11 +#ifdef HAVE_X11 #include diff --git a/keyboardstate.cc b/keyboardstate.cc index a0da6f90..43b1bd39 100644 --- a/keyboardstate.cc +++ b/keyboardstate.cc @@ -6,7 +6,7 @@ #ifdef Q_OS_WIN32 #include -#elif defined(Q_WS_X11) +#elif defined(HAVE_X11) #include #include #include @@ -19,7 +19,7 @@ bool KeyboardState::checkModifiersPressed( int mask ) { #if defined(Q_WS_QWS) return false; - #elif defined Q_OS_WIN32 + #elif defined(Q_OS_WIN32) return !( ( mask & Alt && !( GetAsyncKeyState( VK_MENU ) & 0x8000 ) ) || diff --git a/mainwindow.cc b/mainwindow.cc index af5ee8ff..46d6c310 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -47,7 +47,7 @@ #include "wstring_qt.hh" #endif -#ifdef Q_WS_X11 +#ifdef HAVE_X11 #include #include #endif @@ -2395,7 +2395,7 @@ void MainWindow::showTranslationFor( QString const & inWord, //ui.tabWidget->setTabText( ui.tabWidget->indexOf(ui.tab), inWord.trimmed() ); } -#ifdef Q_WS_X11 +#ifdef HAVE_X11 void MainWindow::toggleMainWindow( bool onlyShow, bool byIconClick ) #else void MainWindow::toggleMainWindow( bool onlyShow ) @@ -2441,7 +2441,7 @@ void MainWindow::toggleMainWindow( bool onlyShow ) if ( shown ) { focusTranslateLine(); -#ifdef Q_WS_X11 +#ifdef HAVE_X11 Window wh = 0; int rev = 0; XGetInputFocus( QX11Info::display(), &wh, &rev ); @@ -2554,7 +2554,7 @@ void MainWindow::checkForNewRelease() QNetworkRequest req( QUrl( "http://goldendict.org/latest_release.php?current=" PROGRAM_VERSION "&platform=" -#ifdef Q_WS_X11 +#ifdef HAVE_X11 "x11" #endif #ifdef Q_OS_MAC @@ -2649,7 +2649,7 @@ void MainWindow::trayIconActivated( QSystemTrayIcon::ActivationReason r ) switch(r) { case QSystemTrayIcon::Trigger: // Left click toggles the visibility of main window -#ifdef Q_WS_X11 +#ifdef HAVE_X11 toggleMainWindow( false, true ); #else toggleMainWindow(); diff --git a/mainwindow.hh b/mainwindow.hh index 9f743aad..1a847e2e 100644 --- a/mainwindow.hh +++ b/mainwindow.hh @@ -28,7 +28,7 @@ #include "translatebox.hh" #include "wordlist.hh" -#ifdef Q_WS_X11 +#ifdef HAVE_X11 #include #endif @@ -195,7 +195,7 @@ private: /// Brings the main window to front if it's not currently, or hides it /// otherwise. The hiding part is omitted if onlyShow is true. -#ifdef Q_WS_X11 +#ifdef HAVE_X11 void toggleMainWindow( bool onlyShow = false, bool byIconClick = false ); #else void toggleMainWindow( bool onlyShow = false ); diff --git a/qtsingleapplication/src/qtsingleapplication.cpp b/qtsingleapplication/src/qtsingleapplication.cpp index d0fb15d7..48bb4585 100644 --- a/qtsingleapplication/src/qtsingleapplication.cpp +++ b/qtsingleapplication/src/qtsingleapplication.cpp @@ -184,7 +184,7 @@ QtSingleApplication::QtSingleApplication(int &argc, char **argv, Type type) } -# if defined(Q_WS_X11) +# if defined(HAVE_X11) /*! Special constructor for X11, ref. the documentation of QApplication's corresponding constructor. The application identifier @@ -222,7 +222,7 @@ QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int { sysInit(appId); } -# endif // Q_WS_X11 +# endif // HAVE_X11 #endif // QT_VERSION < 0x050000 diff --git a/qtsingleapplication/src/qtsingleapplication.h b/qtsingleapplication/src/qtsingleapplication.h index 049406f7..eb7eeb79 100644 --- a/qtsingleapplication/src/qtsingleapplication.h +++ b/qtsingleapplication/src/qtsingleapplication.h @@ -70,11 +70,11 @@ public: QtSingleApplication(const QString &id, int &argc, char **argv); #if QT_VERSION < 0x050000 QtSingleApplication(int &argc, char **argv, Type type); -# if defined(Q_WS_X11) +# if defined(HAVE_X11) QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); -# endif // Q_WS_X11 +# endif // HAVE_X11 #endif // QT_VERSION < 0x050000 bool isRunning(); diff --git a/scanpopup.cc b/scanpopup.cc index e85fcda3..caf58a35 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -207,7 +207,7 @@ ScanPopup::ScanPopup( QWidget * parent, connect( definition, SIGNAL( statusBarMessage( QString const &, int, QPixmap const & ) ), this, SLOT( showStatusBarMessage( QString const &, int, QPixmap const & ) ) ); -#ifdef Q_WS_X11 +#ifdef HAVE_X11 connect( QApplication::clipboard(), SIGNAL( changed( QClipboard::Mode ) ), this, SLOT( clipboardChanged( QClipboard::Mode ) ) ); #endif @@ -765,7 +765,7 @@ void ScanPopup::requestWindowFocus() // One of the rare, actually working workarounds for requesting a user keyboard focus on X11, // works for Qt::Popup windows, exactly like our Scan Popup (in unpinned state). // Modern window managers actively resist to automatically focus pop-up windows. -#ifdef Q_WS_X11 +#ifdef HAVE_X11 if ( !ui.pinButton->isChecked() ) { QMenu m( this );