Compare commits

..

No commits in common. "4d46f766ea3f24608b8b7b418893054bfa7495dd" and "76ef192214237a5ac11edfd9c09062131eabde12" have entirely different histories.

10 changed files with 83 additions and 52 deletions

View File

@ -805,6 +805,7 @@ if(LYX_USE_QT MATCHES "QT6|QT5")
Qt5_wrap_ui(${ARGN})
endmacro()
endif()
# set QPA_XCB if QT uses X11
find_package(${QtVal}Core CONFIG REQUIRED)
if (${QtVal}Core_FOUND)
find_package(${QtVal}Widgets CONFIG REQUIRED)
@ -1187,13 +1188,6 @@ get_data_destination(dest_data)
list(APPEND tmp_vi " LyX files dir: ${CMAKE_INSTALL_PREFIX}/${dest_data}")
string(REPLACE ";" "\\n" VERSION_INFO "${tmp_vi}")
# the result XCB_LIBRARY will be used in src/CMakeLists.txt and also in configuring config.h
find_library(XCB_LIBRARY NAMES xcb)
if (XCB_LIBRARY)
set(HAVE_LIBXCB 1 CACHE BOOL "" FORCE)
else()
set(HAVE_LIBXCB 0 CACHE BOOL "" FORCE)
endif()
configure_file(${LYX_CMAKE_DIR}/config.h.cmake ${TOP_BINARY_DIR}/config.h)
unset(opts)
unset(tmp_vi)

View File

@ -214,15 +214,31 @@ AC_DEFUN([QT_DO_IT_ALL],
fi;;
esac
dnl Specific support for X11 will be built if these are available
AC_CHECK_HEADERS([xcb/xcb.h])
AC_CHECK_LIB([xcb], [xcb_send_event])
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$save_CPPFLAGS $QT_CORE_INCLUDES"
AC_CHECK_HEADER(QtGui/qtgui-config.h,
[lyx_qt_config=QtGui/qtgui-config.h],
[lyx_qt_config=qconfig.h])
AC_MSG_CHECKING([whether Qt uses the X Window system])
if test x$USE_QT6 = xyes ; then
dnl FIXME: Check whether defining QPA_XCB makes sense with Qt6
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
[#include <$lyx_qt_config>]
[#if !defined(QT_FEATURE_xcb) || QT_FEATURE_xcb < 0]
[#error Fail]
[#endif]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(QPA_XCB, 1, [Define if Qt uses the X Window System])],
[AC_MSG_RESULT(no)])
else
AC_EGREP_CPP(xcb,
[#include <$lyx_qt_config>
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)])
fi
CPPFLAGS=$save_CPPFLAGS
QT_FIND_TOOL([QT_MOC], [moc])

View File

@ -28,7 +28,7 @@ test_big_endian(WORDS_BIGENDIAN)
set(Include_Defines)
foreach(_h_file aspell.h aspell/aspell.h limits.h locale.h
stdlib.h sys/stat.h sys/time.h sys/types.h sys/utime.h
sys/socket.h unistd.h inttypes.h utime.h string.h argz.h xcb/xcb.h)
sys/socket.h unistd.h inttypes.h utime.h string.h argz.h)
string(REGEX REPLACE "[/\\.]" "_" _hf ${_h_file})
string(TOUPPER ${_hf} _HF)
check_include_files(${_h_file} HAVE_${_HF})
@ -275,6 +275,7 @@ else()
endif()
endif()
set(QPA_XCB)
set(HAVE_QT5_X11_EXTRAS)
set(HAVE_QT6_X11_EXTRAS)
if (LYX_USE_QT MATCHES "QT5|QT6")
@ -311,6 +312,10 @@ if (LYX_USE_QT MATCHES "QT5|QT6")
}
"
QT_USES_X11)
if(QT_USES_X11 AND NOT LYX_USE_QT MATCHES "QT6")
set(QPA_XCB ${QT_USES_X11})
message(STATUS "Found QPA_XCB = ${QPA_XCB}")
endif()
endif()
if (${QtVal}X11Extras_FOUND)

View File

@ -64,6 +64,9 @@
#cmakedefine Z_PREFIX 1
// Defined if QT=QT5 uses X11
#cmakedefine QPA_XCB 1
// Define if you have the Qt5X11Extras module
#cmakedefine HAVE_QT5_X11_EXTRAS 1
@ -88,13 +91,10 @@ ${Include_used_spellchecker}
// Define to 1 if enchant is version 2.x at least
#cmakedefine HAVE_ENCHANT2 1
// Define to 1 if have xcb library
#cmakedefine HAVE_LIBXCB ${HAVE_LIBXCB}
#endif // config.h guard
#define MYTHES_H_LOCATION <${MYTHES_DIR}/mythes.hxx>
#endif // config.h guard
// Unguarded cleanup of global namespace:
#ifdef ColorMode

View File

@ -148,6 +148,7 @@ if(QT_USES_X11)
find_package(X11 REQUIRED)
target_link_libraries(${_lyx} ${X11_X11_LIB}) # we need it because we use XSendEvent
if(HAVE_QT5_X11_EXTRAS)
find_library(XCB_LIBRARY NAMES xcb)
if (XCB_LIBRARY MATCHES "NOTFOUND")
message(FATAL_ERROR "Need xcb library to use with QT5_X11_EXTRAS")
endif()

View File

@ -127,6 +127,8 @@ namespace {
string cl_system_support;
string cl_user_support;
string geometryArg;
LyX * singleton_ = nullptr;
void showFileError(string const & error)
@ -609,7 +611,7 @@ void LyX::execCommands()
}
// create the first main window
lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW));
lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW, geometryArg));
if (!pimpl_->files_to_load_.empty()) {
// if some files were specified at command-line we assume that the
@ -1340,6 +1342,20 @@ int parse_import(string const & type, string const & file, string & batch)
}
int parse_geometry(string const & arg1, string const &, string &)
{
geometryArg = arg1;
#if !defined(QPA_XCB)
// don't remove "-geometry", it will be pruned out later in the
// frontend if need be.
return -1;
#else
// but that is only done if QPA_XCB is not defined.
return 1;
#endif
}
int parse_batch(string const &, string const &, string &)
{
use_gui = false;
@ -1417,6 +1433,7 @@ void LyX::easyParse(int & argc, char * argv[])
cmdmap["--export-to"] = parse_export_to;
cmdmap["-i"] = parse_import;
cmdmap["--import"] = parse_import;
cmdmap["-geometry"] = parse_geometry;
cmdmap["-batch"] = parse_batch;
cmdmap["-f"] = parse_force;
cmdmap["--force-overwrite"] = parse_force;
@ -1429,10 +1446,6 @@ void LyX::easyParse(int & argc, char * argv[])
cmdmap["--ignore-error-message"] = parse_ignore_error_message;
for (int i = 1; i < argc; ++i) {
// Let Qt handle -geometry even when not on X11.
if (from_utf8(argv[i]) == "-geometry")
argv[i] = const_cast<char *>("-qwindowgeometry");
map<string, cmd_helper>::const_iterator it
= cmdmap.find(argv[i]);

View File

@ -4594,9 +4594,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
int const n = (c == ' ' ? 4 : 1);
for (int i = 0; i < n
&& !par.empty() && par.getChar(0) == c; ++i) {
if (cur.pit() == pit && cur.pos() > 0)
if (cur.pit() == pit)
cur.posBackward();
if (cur.realAnchor().pit() == pit && cur.realAnchor().pos() > 0)
if (cur.realAnchor().pit() == pit
&& cur.realAnchor().pos() > 0 )
cur.realAnchor().backwardPos();
par.eraseChar(0, tc);
}
@ -6386,7 +6387,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// FIXME: the following code should go in favor of fine grained
// update flag treatment.
if (singleParUpdate && !needsUpdate) {
if (singleParUpdate) {
// Inserting characters does not change par height in general. So, try
// to update _only_ this paragraph. BufferView will detect if a full
// metrics update is needed anyway.

View File

@ -121,7 +121,7 @@
#include <QThreadPool>
#include <QWidget>
#ifdef HAVE_XCB_XCB_H
#if defined(QPA_XCB)
#include <xcb/xcb.h>
#ifdef HAVE_QT5_X11_EXTRAS
#include <QtX11Extras/QX11Info>
@ -172,6 +172,20 @@ namespace lyx {
frontend::Application * createApplication(int & argc, char * argv[])
{
#if !defined(QPA_XCB)
// prune -geometry argument(s) by shifting
// the following ones 2 places down.
for (int i = 0 ; i < argc ; ++i) {
if (strcmp(argv[i], "-geometry") == 0) {
int const remove = (i+1) < argc ? 2 : 1;
argc -= remove;
for (int j = i; j < argc; ++j)
argv[j] = argv[j + remove];
--i;
}
}
#endif
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
// On Windows, allow bringing the LyX window to top
AllowSetForegroundWindow(ASFW_ANY);
@ -1157,14 +1171,10 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
// Install Qt native translator for GUI elements.
installTranslator(&d->qt_trans_);
if (platformName() == "xcb") {
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
// Enable reception of XCB events.
installNativeEventFilter(this);
#else
LYXERR0("Warning: X11 support is incomplete in this LyX binary.");
#ifdef QPA_XCB
// Enable reception of XCB events.
installNativeEventFilter(this);
#endif
}
// FIXME: quitOnLastWindowClosed is true by default. We should have a
// lyxrc setting for this in order to let the application stay resident.
@ -1185,13 +1195,13 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
this, SLOT(onApplicationStateChanged(Qt::ApplicationState)));
#endif
if (platformName() == "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
// click interval for all applications. So we don't!
QApplication::setDoubleClickInterval(300);
}
#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
// click interval for all applications. So we don't!
QApplication::setDoubleClickInterval(300);
#endif
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(onLastWindowClosed()));
@ -3481,7 +3491,7 @@ bool GuiApplication::longOperationStarted() {
//
// X11 specific stuff goes here...
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
#if defined(QPA_XCB)
bool GuiApplication::nativeEventFilter(const QByteArray & eventType,
void * message, QINTPTR *)
{

View File

@ -20,7 +20,7 @@
#include <QApplication>
#include <QList>
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
#ifdef QPA_XCB
#include <QAbstractNativeEventFilter>
#endif
@ -53,7 +53,7 @@ There should be only one instance of this class. No Qt object
initialisation should be done before the instantiation of this class.
*/
class GuiApplication : public QApplication, public Application
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
#ifdef QPA_XCB
, public QAbstractNativeEventFilter
#endif
{
@ -120,7 +120,7 @@ public:
//@{
bool notify(QObject * receiver, QEvent * event) override;
void commitData(QSessionManager & sm);
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
#if defined(QPA_XCB)
#if (QT_VERSION < 0x060000)
#define QINTPTR long
#else

View File

@ -57,11 +57,6 @@ What's new
- Speedup interactive use by avoiding expensive math macros bookkeeping
when possible.
- Make -geometry command-line option work on all platforms.
- Fix macOS bug, where XQuartz application would be launched for no
reason (bug #13086).
* DOCUMENTATION AND LOCALIZATION
@ -121,12 +116,8 @@ What's new
and xltable), as this is not supported by the packages. Also fix the
disabling mechanism in the table dialog.
- Fix display of integral limits on Windows (bug 13087).
- Fix display of integral limits on Windows (bug 13087)
- Fix crash when deleting tabs in a selection (with S-BackTab) in a
text-only inset (ERT, Listings...).
- Fix display glitches when applying some operations to a selection.
* INTERNALS