Bo Peng wrote: > val = session().sessionInfo().load("WindowHeight", false);
Thanks, that works much better. See attached patch. Jürgen
Index: src/frontends/qt4/GuiView.C =================================================================== --- src/frontends/qt4/GuiView.C (Revision 16927) +++ src/frontends/qt4/GuiView.C (Arbeitskopie) @@ -690,12 +690,22 @@ Toolbars::ToolbarPtr GuiView::makeToolbar(ToolbarBackend::Toolbar const & tbb) { + // get window size + int w = width(); + int h = height(); + Session & session = LyX::ref().session(); + string val = session.sessionInfo().load("WindowWidth", false); + if (!val.empty()) + w = convert<unsigned int>(val); + val = session.sessionInfo().load("WindowHeight", false); + if (!val.empty()) + h = convert<unsigned int>(val); QLToolbar * Tb = new QLToolbar(tbb, *this); if (tbb.flags & ToolbarBackend::TOP) { addToolBar(Qt::TopToolBarArea, Tb); if (toolbarSize_.top_width > 0 - && toolbarSize_.top_width + Tb->sizeHint().width() > width()) { + && toolbarSize_.top_width + Tb->sizeHint().width() > w) { insertToolBarBreak(Tb); toolbarSize_.top_width = Tb->sizeHint().width(); } else @@ -707,7 +717,7 @@ // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock. #if (QT_VERSION >= 0x040202) if (toolbarSize_.bottom_width > 0 - && toolbarSize_.bottom_width + Tb->sizeHint().width() > width()) { + && toolbarSize_.bottom_width + Tb->sizeHint().width() > w) { insertToolBarBreak(Tb); toolbarSize_.bottom_width = Tb->sizeHint().width(); } else @@ -720,7 +730,7 @@ // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock. #if (QT_VERSION >= 0x040202) if (toolbarSize_.left_height > 0 - && toolbarSize_.left_height + Tb->sizeHint().height() > height()) { + && toolbarSize_.left_height + Tb->sizeHint().height() > h) { insertToolBarBreak(Tb); toolbarSize_.left_height = Tb->sizeHint().height(); } else @@ -733,7 +743,7 @@ // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock. #if (QT_VERSION >= 0x040202) if (toolbarSize_.right_height > 0 - && toolbarSize_.right_height + Tb->sizeHint().height() > height()) { + && toolbarSize_.right_height + Tb->sizeHint().height() > h) { insertToolBarBreak(Tb); toolbarSize_.right_height = Tb->sizeHint().height(); } else Index: src/lyx_main.C =================================================================== --- src/lyx_main.C (Revision 16924) +++ src/lyx_main.C (Arbeitskopie) @@ -653,10 +653,10 @@ } // if lyxrc returns (0,0), then use session info else { - string val = session().sessionInfo().load("WindowWidth"); + string val = session().sessionInfo().load("WindowWidth", false); if (!val.empty()) width = convert<unsigned int>(val); - val = session().sessionInfo().load("WindowHeight"); + val = session().sessionInfo().load("WindowHeight", false); if (!val.empty()) height = convert<unsigned int>(val); if (session().sessionInfo().load("WindowIsMaximized") == "yes")