Peter Kümmel wrote:
> Georg Baum wrote:
>> In src/lyx_main.C lines 340-341 two unsigned variables are set to -1 and
>> afterwards passed to the lyx_gui::start function which takes unsigned
>> arguments.
>> I forgot who did this change, but could this person please fix the problem?
>>
>>
>> Thanks,
>> Georg
>>
>>
> 
> Sorry, this was my fault, will fix it.
> Peter
> 
> 

Originally I've passed an additional parameter for the geometry option,
but then we've decided to pass -1. Then I have to patch it like this:

Is this really better than an additional parameter?


Index: frontends/gtk/lyx_gui.C
===================================================================
--- frontends/gtk/lyx_gui.C     (revision 14234)
+++ frontends/gtk/lyx_gui.C     (working copy)
@@ -141,8 +141,14 @@
 
 
 void lyx_gui::start(string const & batch, std::vector<string> const & files,
-                   unsigned int width, unsigned int height, int posx, int 
posy, bool)
+                   int signed_width, int signed_height, int posx, int posy, 
bool)
 {
+       unsigned int width(signed_width);
+       unsigned int height(signed_height);
+       if (signed_width < 0)
+               width =0;
+       if (signed_height < 0)
+               height = 0;
        int view_id = theApp->gui().newView(width, height);
        GView & view = static_cast<GView &> (theApp->gui().view(view_id));
        theApp->gui().newWorkArea(width, height, 0);
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C     (revision 14234)
+++ frontends/qt3/lyx_gui.C     (working copy)
@@ -234,8 +234,14 @@
 
 
 void start(string const & batch, vector<string> const & files,
-          unsigned int width, unsigned int height, int posx, int posy, bool 
maximize)
+          int signed_width, int signed_height, int posx, int posy, bool 
maximize)
 {
+       unsigned int width(signed_width);
+       unsigned int height(signed_height);
+       if (signed_width < 0)
+               width =0;
+       if (signed_height < 0)
+               height = 0;
        // this can't be done before because it needs the Languages object
        initEncodings();
 
Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C     (revision 14234)
+++ frontends/qt4/lyx_gui.C     (working copy)
@@ -194,8 +194,14 @@
 
 
 void start(string const & batch, vector<string> const & files,
-          unsigned int width, unsigned int height, int posx, int posy, bool 
maximize)
+          int signed_width, int signed_height, int posx, int posy, bool 
maximize)
 {
+       unsigned int width(signed_width);
+       unsigned int height(signed_height);
+       if (signed_width < 0)
+               width =0;
+       if (signed_height < 0)
+               height = 0;
        // this can't be done before because it needs the Languages object
        initEncodings();
 
Index: frontends/xforms/lyx_gui.C
===================================================================
--- frontends/xforms/lyx_gui.C  (revision 14234)
+++ frontends/xforms/lyx_gui.C  (working copy)
@@ -259,8 +259,14 @@
 
 
 void start(string const & batch, vector<string> const & files,
-          unsigned int width, unsigned int height, int posx, int posy, bool)
+          int signed_width, int signed_height, int posx, int posy, bool)
 {
+       unsigned int width(signed_width);
+       unsigned int height(signed_height);
+       if (signed_width < 0)
+               width =0;
+       if (signed_height < 0)
+               height = 0;
        int const geometryBitmask =
                XParseGeometry(geometry, &posx, &posy, &width, &height);
 
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 14234)
+++ frontends/lyx_gui.h (working copy)
@@ -57,7 +57,7 @@
  * batch commands, and loading the given documents
  */
 void start(std::string const & batch, std::vector<std::string> const & files,
-           unsigned int width, unsigned int height, int posx, int posy, bool 
maximize);
+           int width, int height, int posx, int posy, bool maximize);
 
 /**
  * Enter the main event loop (\sa LyX::exec2)
Index: lyx_main.C
===================================================================
--- lyx_main.C  (revision 14234)
+++ lyx_main.C  (working copy)
@@ -305,8 +305,8 @@
        if (lyx_gui::use_gui) {
                // determine windows size and position, from lyxrc and/or 
session
                // initial geometry
-               unsigned int width = 690;
-               unsigned int height = 510;
+               int width = 690;
+               int height = 510;
                bool maximize = false;
                // first try lyxrc
                if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
@@ -317,10 +317,10 @@
                else {
                        string val = session().loadSessionInfo("WindowWidth");
                        if (!val.empty())
-                               width = convert<unsigned int>(val);
+                               width = convert<int>(val);
                        val = session().loadSessionInfo("WindowHeight");
                        if (!val.empty())
-                               height = convert<unsigned int>(val);
+                               height = convert<int>(val);
                        if (session().loadSessionInfo("WindowIsMaximized") == 
"yes")
                                maximize = true;
                }

Reply via email to