lyx/0001-Store-correctly-the-window-position-with-Wayland.patch
Cor Blom f6e5956811 - Add 0001-Store-correctly-the-window-position-with-Wayland.patch
to fix possible menu shifting on GNOME Wayland (see upstream bug
  https://www.lyx.org/trac/ticket/11746)
  Some highlights:
  * Added the ability to create new child documents from within the
    'include file' dialog
  * Pasting table content outside a table no longer pastes tab
    characters

OBS-URL: https://build.opensuse.org/package/show/Publishing/lyx?expand=0&rev=201
2020-12-01 08:33:33 +00:00

99 lines
3.6 KiB
Diff

Index: src/frontends/qt/GuiApplication.cpp
===================================================================
--- src/frontends/qt/GuiApplication.cpp (revision 5061db891c2b7b9ca96ca40a3ee90bd9b2c76392)
+++ src/frontends/qt/GuiApplication.cpp (revision 222a317dd243fb18f01bfa6e994902fee06ae3db)
@@ -1090,4 +1090,27 @@
+#if QT_VERSION < 0x050000
+// Emulate platformName() for Qt4
+
+// FIXME: when ditching this method, remove all tests
+// platformName() == "qt4x11"
+// in the code
+QString GuiApplication::platformName() const
+{
+# if defined(Q_WS_X11)
+ // Note that this one does not really exist
+ return "qt4x11";
+# elif defined(Q_OS_MAC)
+ return "cocoa";
+# elif defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
+ return "windows";
+# else
+ LYXERR0("Unknown platform!");
+ return "unknown";
+# endif
+}
+#endif
+
+
double GuiApplication::pixelRatio() const
{
Index: src/frontends/qt/GuiApplication.h
===================================================================
--- src/frontends/qt/GuiApplication.h (revision 5061db891c2b7b9ca96ca40a3ee90bd9b2c76392)
+++ src/frontends/qt/GuiApplication.h (revision 222a317dd243fb18f01bfa6e994902fee06ae3db)
@@ -161,4 +161,9 @@
GuiView & view(int id) const;
+#if (QT_VERSION < 0x050000)
+ /// Emulate platformName() for Qt4
+ QString platformName() const;
+#endif
+
/// Current ratio between physical pixels and device-independent pixels
double pixelRatio() const;
Index: src/frontends/qt/GuiView.cpp
===================================================================
--- src/frontends/qt/GuiView.cpp (revision 21422dd6527754d8b7876a6e11b686cd726321ed)
+++ src/frontends/qt/GuiView.cpp (revision 222a317dd243fb18f01bfa6e994902fee06ae3db)
@@ -817,10 +817,9 @@
settings.beginGroup("views");
settings.beginGroup(QString::number(id_));
-#if defined(Q_WS_X11) || defined(QPA_XCB)
- settings.setValue("pos", pos());
- settings.setValue("size", size());
-#else
- settings.setValue("geometry", saveGeometry());
-#endif
+ if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") {
+ settings.setValue("pos", pos());
+ settings.setValue("size", size());
+ } else
+ settings.setValue("geometry", saveGeometry());
settings.setValue("layout", saveState(0));
settings.setValue("icon_size", toqstr(d.iconSize(iconSize())));
@@ -862,17 +861,18 @@
setIconSize(d.iconSize(settings.value(icon_key).toString()));
-#if defined(Q_WS_X11) || defined(QPA_XCB)
- QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
- QSize size = settings.value("size", QSize(690, 510)).toSize();
- resize(size);
- move(pos);
-#else
- // Work-around for bug #6034: the window ends up in an undetermined
- // state when trying to restore a maximized window when it is
- // already maximized.
- if (!(windowState() & Qt::WindowMaximized))
- if (!restoreGeometry(settings.value("geometry").toByteArray()))
- setGeometry(50, 50, 690, 510);
-#endif
+ if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") {
+ QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
+ QSize size = settings.value("size", QSize(690, 510)).toSize();
+ resize(size);
+ move(pos);
+ } else {
+ // Work-around for bug #6034: the window ends up in an undetermined
+ // state when trying to restore a maximized window when it is
+ // already maximized.
+ if (!(windowState() & Qt::WindowMaximized))
+ if (!restoreGeometry(settings.value("geometry").toByteArray()))
+ setGeometry(50, 50, 690, 510);
+ }
+
// Make sure layout is correctly oriented.
setLayoutDirection(qApp->layoutDirection());