Hopefully fix the ignored -geometry option under X11.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21645 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-16 21:52:04 +00:00
parent e0a62da75a
commit ce46ca8653

View File

@ -71,6 +71,7 @@
#include <QMenu> #include <QMenu>
#include <QPainter> #include <QPainter>
#include <QPixmap> #include <QPixmap>
#include <QPoint>
#include <QPushButton> #include <QPushButton>
#include <QSettings> #include <QSettings>
#include <QShowEvent> #include <QShowEvent>
@ -367,26 +368,31 @@ void GuiView::init()
this, SLOT(clearMessage())); this, SLOT(clearMessage()));
d.setBackground(); d.setBackground();
if (!lyxrc.allow_geometry_session)
setGeometry(50, 50, 690, 510);
// Now take care of session management.
QSettings settings;
QString const key = "view-" + QString::number(id());
#ifdef Q_WS_X11
QPoint pos = settings.value(key + "/pos", QPoint(50, 50)).toPoint();
QSize size = settings.value(key + "/size", QSize(690, 510)).toSize();
resize(size);
move(pos);
#else
if (!restoreGeometry(settings.value(key + "/geometry").toByteArray()))
setGeometry(50, 50, 690, 510);
#endif
setIconSize(settings.value(key + "/icon_size").toSize());
} }
void GuiView::showEvent(QShowEvent * e) void GuiView::showEvent(QShowEvent * e)
{ {
if (lyxrc.allow_geometry_session) { LYXERR(Debug::GUI, "Passed Geometry "
QSettings settings; << size().height() << "x" << size().width()
QString const key = "view-" + QString::number(id()); << "+" << pos().x() << "+" << pos().y());
#ifdef Q_WS_X11
QPoint pos = settings.value(key + "/pos", QPoint(50, 50)).toPoint();
QSize size = settings.value(key + "/size", QSize(690, 510)).toSize();
resize(size);
move(pos);
#else
if (!restoreGeometry(settings.value(key + "/geometry").toByteArray()))
setGeometry(50, 50, 690, 510);
#endif
setIconSize(settings.value(key + "/icon_size").toSize());
} else
setGeometry(50, 50, 690, 510);
if (d.splitter_->count() == 0) if (d.splitter_->count() == 0)
// No work area, switch to the background widget. // No work area, switch to the background widget.