mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-30 05:12:40 +00:00
Store correctly the window position with Wayland
To do this, hard-coded test for xcb had to be replaced with a call to
platformName(). Since this method does not exist in Qt4, we emulate
it.
Note that Qt5 uses xcb bindings for X11 system, while Qt4 relies on
older X11 bindings. We return platorm == "qt4x11" in this case.
Fixes bug #11746.
(cherry picked from commit 222a317dd2
)
This commit is contained in:
parent
c9040100b5
commit
d418b6f4c8
@ -1111,6 +1111,29 @@ GuiApplication * theGuiApp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
double GuiApplication::pixelRatio() const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
|
@ -154,6 +154,11 @@ public:
|
|||||||
///
|
///
|
||||||
GuiView & view(int id) const;
|
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
|
/// Current ratio between physical pixels and device-independent pixels
|
||||||
double pixelRatio() const;
|
double pixelRatio() const;
|
||||||
|
|
||||||
|
@ -750,12 +750,11 @@ void GuiView::saveLayout() const
|
|||||||
settings.setValue("devel_mode", devel_mode_);
|
settings.setValue("devel_mode", devel_mode_);
|
||||||
settings.beginGroup("views");
|
settings.beginGroup("views");
|
||||||
settings.beginGroup(QString::number(id_));
|
settings.beginGroup(QString::number(id_));
|
||||||
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") {
|
||||||
settings.setValue("pos", pos());
|
settings.setValue("pos", pos());
|
||||||
settings.setValue("size", size());
|
settings.setValue("size", size());
|
||||||
#else
|
} else
|
||||||
settings.setValue("geometry", saveGeometry());
|
settings.setValue("geometry", saveGeometry());
|
||||||
#endif
|
|
||||||
settings.setValue("layout", saveState(0));
|
settings.setValue("layout", saveState(0));
|
||||||
settings.setValue("icon_size", toqstr(d.iconSize(iconSize())));
|
settings.setValue("icon_size", toqstr(d.iconSize(iconSize())));
|
||||||
}
|
}
|
||||||
@ -795,19 +794,20 @@ bool GuiView::restoreLayout()
|
|||||||
//code below is skipped when when ~/.config/LyX is (re)created
|
//code below is skipped when when ~/.config/LyX is (re)created
|
||||||
setIconSize(d.iconSize(settings.value(icon_key).toString()));
|
setIconSize(d.iconSize(settings.value(icon_key).toString()));
|
||||||
|
|
||||||
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "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);
|
||||||
move(pos);
|
move(pos);
|
||||||
#else
|
} else {
|
||||||
// Work-around for bug #6034: the window ends up in an undetermined
|
// Work-around for bug #6034: the window ends up in an undetermined
|
||||||
// state when trying to restore a maximized window when it is
|
// state when trying to restore a maximized window when it is
|
||||||
// already maximized.
|
// already maximized.
|
||||||
if (!(windowState() & Qt::WindowMaximized))
|
if (!(windowState() & Qt::WindowMaximized))
|
||||||
if (!restoreGeometry(settings.value("geometry").toByteArray()))
|
if (!restoreGeometry(settings.value("geometry").toByteArray()))
|
||||||
setGeometry(50, 50, 690, 510);
|
setGeometry(50, 50, 690, 510);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
// Make sure layout is correctly oriented.
|
// Make sure layout is correctly oriented.
|
||||||
setLayoutDirection(qApp->layoutDirection());
|
setLayoutDirection(qApp->layoutDirection());
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ What's new
|
|||||||
|
|
||||||
* USER INTERFACE
|
* USER INTERFACE
|
||||||
|
|
||||||
|
- Fix problem with display of menus on Gnome Wayland (bug 11746).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user