mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 13:04:58 +00:00
Temptatively fix fullscreen problems on X11.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24960 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a2db0e8ed4
commit
57fb699944
@ -321,18 +321,47 @@ GuiView::GuiView(int id)
|
|||||||
// with some window manager under X11.
|
// with some window manager under X11.
|
||||||
setMinimumSize(300, 200);
|
setMinimumSize(300, 200);
|
||||||
|
|
||||||
|
if (lyxrc.allow_geometry_session) {
|
||||||
// Now take care of session management.
|
// Now take care of session management.
|
||||||
QSettings settings;
|
restoreLayout();
|
||||||
|
|
||||||
if (!lyxrc.allow_geometry_session) {
|
|
||||||
// No session handling, default to a sane size.
|
|
||||||
setGeometry(50, 50, 690, 510);
|
|
||||||
initToolbars();
|
|
||||||
settings.clear();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No session handling, default to a sane size.
|
||||||
|
setGeometry(50, 50, 690, 510);
|
||||||
|
initToolbars();
|
||||||
|
// This enables to clear session data if any.
|
||||||
|
QSettings settings;
|
||||||
|
settings.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GuiView::~GuiView()
|
||||||
|
{
|
||||||
|
delete &d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiView::saveLayout() const
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
QString const key = "view-" + QString::number(id_);
|
QString const key = "view-" + QString::number(id_);
|
||||||
|
#ifdef Q_WS_X11
|
||||||
|
settings.setValue(key + "/pos", pos());
|
||||||
|
settings.setValue(key + "/size", size());
|
||||||
|
#else
|
||||||
|
settings.setValue(key + "/geometry", saveGeometry());
|
||||||
|
#endif
|
||||||
|
settings.setValue(key + "/layout", saveState(0));
|
||||||
|
settings.setValue(key + "/icon_size", iconSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiView::restoreLayout()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
QString const key = "view-" + QString::number(id_);
|
||||||
|
setIconSize(settings.value(key + "/icon_size").toSize());
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
QPoint pos = settings.value(key + "/pos", QPoint(50, 50)).toPoint();
|
QPoint pos = settings.value(key + "/pos", QPoint(50, 50)).toPoint();
|
||||||
QSize size = settings.value(key + "/size", QSize(690, 510)).toSize();
|
QSize size = settings.value(key + "/size", QSize(690, 510)).toSize();
|
||||||
@ -344,14 +373,6 @@ GuiView::GuiView(int id)
|
|||||||
#endif
|
#endif
|
||||||
if (!restoreState(settings.value(key + "/layout").toByteArray(), 0))
|
if (!restoreState(settings.value(key + "/layout").toByteArray(), 0))
|
||||||
initToolbars();
|
initToolbars();
|
||||||
|
|
||||||
setIconSize(settings.value(key + "/icon_size").toSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GuiView::~GuiView()
|
|
||||||
{
|
|
||||||
delete &d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -525,18 +546,10 @@ void GuiView::closeEvent(QCloseEvent * close_event)
|
|||||||
|
|
||||||
// Saving fullscreen requires additional tweaks in the toolbar code.
|
// Saving fullscreen requires additional tweaks in the toolbar code.
|
||||||
// It wouldn't also work under linux natively.
|
// It wouldn't also work under linux natively.
|
||||||
if (lyxrc.allow_geometry_session && !isFullScreen()) {
|
if (lyxrc.allow_geometry_session) {
|
||||||
QSettings settings;
|
// Save this window geometry and layout.
|
||||||
QString const key = "view-" + QString::number(id_);
|
saveLayout();
|
||||||
#ifdef Q_WS_X11
|
// Then the toolbar private states.
|
||||||
settings.setValue(key + "/pos", pos());
|
|
||||||
settings.setValue(key + "/size", size());
|
|
||||||
#else
|
|
||||||
settings.setValue(key + "/geometry", saveGeometry());
|
|
||||||
#endif
|
|
||||||
settings.setValue(key + "/icon_size", iconSize());
|
|
||||||
settings.setValue(key + "/layout", saveState(0));
|
|
||||||
|
|
||||||
ToolbarMap::iterator end = d.toolbars_.end();
|
ToolbarMap::iterator end = d.toolbars_.end();
|
||||||
for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it)
|
for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it)
|
||||||
it->second->saveSession();
|
it->second->saveSession();
|
||||||
@ -1993,9 +2006,6 @@ void GuiView::lfunUiToggle(FuncRequest const & cmd)
|
|||||||
|
|
||||||
void GuiView::toggleFullScreen()
|
void GuiView::toggleFullScreen()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
|
||||||
QString const key = "view-" + QString::number(id_);
|
|
||||||
|
|
||||||
if (isFullScreen()) {
|
if (isFullScreen()) {
|
||||||
for (int i = 0; i != d.splitter_->count(); ++i)
|
for (int i = 0; i != d.splitter_->count(); ++i)
|
||||||
d.tabWorkArea(i)->setFullScreen(false);
|
d.tabWorkArea(i)->setFullScreen(false);
|
||||||
@ -2005,21 +2015,19 @@ void GuiView::toggleFullScreen()
|
|||||||
setWindowState(windowState() ^ Qt::WindowFullScreen);
|
setWindowState(windowState() ^ Qt::WindowFullScreen);
|
||||||
menuBar()->show();
|
menuBar()->show();
|
||||||
statusBar()->show();
|
statusBar()->show();
|
||||||
if (lyxrc.full_screen_toolbars) {
|
if (lyxrc.full_screen_toolbars)
|
||||||
if (!restoreState(settings.value(key + "/layout").toByteArray(), 0))
|
restoreLayout();
|
||||||
initToolbars();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i != d.splitter_->count(); ++i)
|
for (int i = 0; i != d.splitter_->count(); ++i)
|
||||||
d.tabWorkArea(i)->setFullScreen(true);
|
d.tabWorkArea(i)->setFullScreen(true);
|
||||||
#if QT_VERSION >= 0x040300
|
#if QT_VERSION >= 0x040300
|
||||||
setContentsMargins(-2, -2, -2, -2);
|
setContentsMargins(-2, -2, -2, -2);
|
||||||
#endif
|
#endif
|
||||||
|
saveLayout();
|
||||||
setWindowState(windowState() ^ Qt::WindowFullScreen);
|
setWindowState(windowState() ^ Qt::WindowFullScreen);
|
||||||
statusBar()->hide();
|
statusBar()->hide();
|
||||||
menuBar()->hide();
|
menuBar()->hide();
|
||||||
if (lyxrc.full_screen_toolbars) {
|
if (lyxrc.full_screen_toolbars) {
|
||||||
settings.setValue(key + "/layout", saveState(0));
|
|
||||||
ToolbarMap::iterator end = d.toolbars_.end();
|
ToolbarMap::iterator end = d.toolbars_.end();
|
||||||
for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it)
|
for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it)
|
||||||
it->second->hide();
|
it->second->hide();
|
||||||
|
@ -245,6 +245,10 @@ public:
|
|||||||
void updateCompletion(Cursor & cur, bool start, bool keep);
|
void updateCompletion(Cursor & cur, bool start, bool keep);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
void saveLayout() const;
|
||||||
|
///
|
||||||
|
void restoreLayout();
|
||||||
///
|
///
|
||||||
GuiToolbar * toolbar(std::string const & name);
|
GuiToolbar * toolbar(std::string const & name);
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user