mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 02:49:46 +00:00
Adjust preprocessor guards for Qt5/X11.
This fixes the -geometry command line option and restores the "Use icons from system's theme" checkbox in the preferences. There is still code addressing Qt4 and xlib that has to be audited. This code cannot be compiled with Qt5 because the default backend is now xcb and not xlib. I have marked such code with a "FIXME QT5" comment.
This commit is contained in:
parent
5d6351d476
commit
d4428ceb81
@ -169,6 +169,19 @@ AC_DEFUN([QT_DO_IT_ALL],
|
|||||||
[AC_MSG_ERROR([LyX requires at least version $1 of Qt. Only version $QTLIB_VERSION has been found.])
|
[AC_MSG_ERROR([LyX requires at least version $1 of Qt. Only version $QTLIB_VERSION has been found.])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
if test x$USE_QT5 = xyes ; then
|
||||||
|
save_CPPFLAGS=$CPPFLAGS
|
||||||
|
AC_MSG_CHECKING([whether Qt uses the X Window system])
|
||||||
|
CPPFLAGS="$save_CPPFLAGS $QT_CORE_INCLUDES"
|
||||||
|
AC_EGREP_CPP(xcb,
|
||||||
|
[#include <qconfig.h>
|
||||||
|
QT_QPA_DEFAULT_PLATFORM_NAME],
|
||||||
|
[AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(QPA_XCB, 1, [Define if Qt uses the X Window System])],
|
||||||
|
[AC_MSG_RESULT(no)])
|
||||||
|
CPPFLAGS=$save_CPPFLAGS
|
||||||
|
fi
|
||||||
|
|
||||||
QT_FIND_TOOL([QT_MOC], [moc])
|
QT_FIND_TOOL([QT_MOC], [moc])
|
||||||
QT_FIND_TOOL([QT_UIC], [uic])
|
QT_FIND_TOOL([QT_UIC], [uic])
|
||||||
QT_FIND_TOOL([QT_RCC], [rcc])
|
QT_FIND_TOOL([QT_RCC], [rcc])
|
||||||
|
@ -115,6 +115,7 @@
|
|||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
// FIXME QT5
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
@ -167,7 +168,7 @@ namespace lyx {
|
|||||||
|
|
||||||
frontend::Application * createApplication(int & argc, char * argv[])
|
frontend::Application * createApplication(int & argc, char * argv[])
|
||||||
{
|
{
|
||||||
#ifndef Q_WS_X11
|
#if !defined(Q_WS_X11) && !defined(QPA_XCB)
|
||||||
// prune -geometry argument(s) by shifting
|
// prune -geometry argument(s) by shifting
|
||||||
// the following ones 2 places down.
|
// the following ones 2 places down.
|
||||||
for (int i = 0 ; i < argc ; ++i) {
|
for (int i = 0 ; i < argc ; ++i) {
|
||||||
@ -1007,7 +1008,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
|||||||
setupApplescript();
|
setupApplescript();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
||||||
// doubleClickInterval() is 400 ms on X11 which is just too long.
|
// 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 Windows and Mac OS X, the operating system's value is used.
|
||||||
// On Microsoft Windows, calling this function sets the double
|
// On Microsoft Windows, calling this function sets the double
|
||||||
@ -2948,6 +2949,7 @@ bool GuiApplication::longOperationStarted() {
|
|||||||
//
|
//
|
||||||
// X11 specific stuff goes here...
|
// X11 specific stuff goes here...
|
||||||
|
|
||||||
|
// FIXME QT5
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
bool GuiApplication::x11EventFilter(XEvent * xev)
|
bool GuiApplication::x11EventFilter(XEvent * xev)
|
||||||
{
|
{
|
||||||
|
@ -99,6 +99,7 @@ public:
|
|||||||
//@{
|
//@{
|
||||||
bool notify(QObject * receiver, QEvent * event);
|
bool notify(QObject * receiver, QEvent * event);
|
||||||
void commitData(QSessionManager & sm);
|
void commitData(QSessionManager & sm);
|
||||||
|
// FIXME QT5
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
bool x11EventFilter(XEvent * ev);
|
bool x11EventFilter(XEvent * ev);
|
||||||
#endif
|
#endif
|
||||||
|
@ -541,7 +541,7 @@ bool GuiClipboard::hasInternal() const
|
|||||||
// are notified of changes. However, on Windows ownership is
|
// are notified of changes. However, on Windows ownership is
|
||||||
// emulated by Qt through the OleIsCurrentClipboard() API, while
|
// emulated by Qt through the OleIsCurrentClipboard() API, while
|
||||||
// on Mac OS X we deal with this issue by ourself.
|
// on Mac OS X we deal with this issue by ourself.
|
||||||
#if defined(Q_WS_X11) || defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
#ifndef Q_OS_MAC
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
// Set USE_PIXMAP_CACHE to 1 for enabling the use of a Pixmap cache when
|
// Set USE_PIXMAP_CACHE to 1 for enabling the use of a Pixmap cache when
|
||||||
// drawing text. This is especially useful for older PPC/Mac systems.
|
// drawing text. This is especially useful for older PPC/Mac systems.
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
||||||
#define USE_PIXMAP_CACHE 0
|
#define USE_PIXMAP_CACHE 0
|
||||||
#else
|
#else
|
||||||
#define USE_PIXMAP_CACHE 1
|
#define USE_PIXMAP_CACHE 1
|
||||||
|
@ -1046,7 +1046,7 @@ void PrefScreenFonts::updateRC(LyXRC const & rc)
|
|||||||
updateScreenFontSizes(rc);
|
updateScreenFontSizes(rc);
|
||||||
|
|
||||||
pixmapCacheCB->setChecked(rc.use_pixmap_cache);
|
pixmapCacheCB->setChecked(rc.use_pixmap_cache);
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
||||||
pixmapCacheCB->setEnabled(false);
|
pixmapCacheCB->setEnabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2540,7 +2540,7 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
|
|||||||
iconSetCO->addItem(qt_("Classic"), "classic");
|
iconSetCO->addItem(qt_("Classic"), "classic");
|
||||||
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
|
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
|
||||||
|
|
||||||
#if (!defined Q_WS_X11 || QT_VERSION < 0x040600)
|
#if (!(defined Q_WS_X11 || defined(QPA_XCB)) || QT_VERSION < 0x040600)
|
||||||
useSystemThemeIconsCB->hide();
|
useSystemThemeIconsCB->hide();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ void GuiView::saveLayout() const
|
|||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("views");
|
settings.beginGroup("views");
|
||||||
settings.beginGroup(QString::number(id_));
|
settings.beginGroup(QString::number(id_));
|
||||||
#ifdef Q_WS_X11
|
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
||||||
settings.setValue("pos", pos());
|
settings.setValue("pos", pos());
|
||||||
settings.setValue("size", size());
|
settings.setValue("size", size());
|
||||||
#else
|
#else
|
||||||
@ -679,7 +679,7 @@ bool GuiView::restoreLayout()
|
|||||||
}
|
}
|
||||||
setIconSize(icon_size);
|
setIconSize(icon_size);
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
||||||
QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
|
QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
|
||||||
QSize size = settings.value("size", QSize(690, 510)).toSize();
|
QSize size = settings.value("size", QSize(690, 510)).toSize();
|
||||||
resize(size);
|
resize(size);
|
||||||
|
@ -695,6 +695,7 @@ void GuiWorkArea::scrollTo(int value)
|
|||||||
}
|
}
|
||||||
// Show the cursor immediately after any operation.
|
// Show the cursor immediately after any operation.
|
||||||
startBlinkingCursor();
|
startBlinkingCursor();
|
||||||
|
// FIXME QT5
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
QApplication::syncX();
|
QApplication::syncX();
|
||||||
#endif
|
#endif
|
||||||
@ -1060,7 +1061,7 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
|
|||||||
// do nothing if there are other events
|
// do nothing if there are other events
|
||||||
// (the auto repeated events come too fast)
|
// (the auto repeated events come too fast)
|
||||||
// it looks like this is only needed on X11
|
// it looks like this is only needed on X11
|
||||||
#ifdef Q_WS_X11
|
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
||||||
if (qApp->hasPendingEvents() && ev->isAutoRepeat()) {
|
if (qApp->hasPendingEvents() && ev->isAutoRepeat()) {
|
||||||
switch (ev->key()) {
|
switch (ev->key()) {
|
||||||
case Qt::Key_PageDown:
|
case Qt::Key_PageDown:
|
||||||
|
Loading…
Reference in New Issue
Block a user