]> git.lyx.org Git - lyx.git/commitdiff
more geometry stuff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 5 Jul 2000 20:16:38 +0000 (20:16 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 5 Jul 2000 20:16:38 +0000 (20:16 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@861 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/lyx_gui.C
src/lyx_main.C

index 7a55ceaf21f8ccbd1edcb3b42bcf023c824abe52..d2cf17c17655577135df7263ad907f302c872945 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-07-05  R. Lahaye  <lahaye@postech.ac.kr>
+
+       * src/lyx_gui.C src/lyx_main.C: improve the -geometry support,
+       handle neg values, set min width to 590, add doc about -display  
+
 2000-07-05  Juergen Vigna  <jug@sad.it>
 
        * src/insets/lyxinset.h: changed Painter & in ascent(), descent()
index e518b420ede9dcae52e8d4f44f3d272d397b1308..13a86144e6010de841cb000016868f139936b5d9 100644 (file)
@@ -91,7 +91,7 @@ bool     cursor_follows_scrollbar;
 
 FL_resource res[] =
 {
-       {"geometry", "geometryClass", FL_STRING, geometry, "690x510", 40}
+       {"geometry", "geometryClass", FL_STRING, geometry, "", 40}
 };
 
 
@@ -125,7 +125,12 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
        fl_initialize(argc, argv, "LyX", cmdopt, num_res);
        fl_get_app_resources(res, num_res);
 
-        XParseGeometry(geometry, &xpos, &ypos, (unsigned int *) &width, (unsigned int *) &height);
+       static const int geometryBitmask = XParseGeometry( geometry,
+                                                           &xpos,
+                                                           &ypos,
+                                                           (unsigned int *) &width,
+                                                           (unsigned int *) &height
+                                                         );
 
        Display * display = fl_get_display();
        if (!display) {
@@ -135,16 +140,32 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
        fcntl(ConnectionNumber(display), F_SETFD, FD_CLOEXEC);
        // X Error handler install goes here
        XSetErrorHandler(LyX_XErrHandler);
-       
-       // Make sure default screen is not larger than monitor
-       if (width == 690 && height == 510) {
+
+       // A width less than 590 pops up an awkward main window
+       if (width < 590) width = 590;
+
+       // If width is not set by geometry, check it against monitor width
+       if ( !(geometryBitmask & 4) ) {
                Screen * scr = DefaultScreenOfDisplay(fl_get_display());
-               if (HeightOfScreen(scr) - 24 < height)
-                       height = HeightOfScreen(scr) - 24;
                if (WidthOfScreen(scr) - 8 < width)
                        width = WidthOfScreen(scr) - 8;
        }
 
+       // If height is not set by geometry, check it against monitor height
+       if ( !(geometryBitmask & 8) ) {
+               Screen * scr = DefaultScreenOfDisplay(fl_get_display());
+               if (HeightOfScreen(scr) - 24 < height)
+                       height = HeightOfScreen(scr) - 24;
+       }
+
+       // Recalculate xpos if it's negative
+       if (geometryBitmask & 16)
+               xpos += WidthOfScreen(DefaultScreenOfDisplay(fl_get_display())) - width;
+
+       // Recalculate ypos if it's negative
+       if (geometryBitmask & 32)
+               ypos += HeightOfScreen(DefaultScreenOfDisplay(fl_get_display())) - height;
+
        // Initialize the LyXColorHandler
        lyxColorHandler = new LyXColorHandler;
 }
index 5e5062a9e27f42c7a444ffe8526537d42af072ac..ea304882d842c51b49987796092f74c05cfb18e4 100644 (file)
@@ -594,7 +594,8 @@ void commandLineHelp()
                  "\t-help              summarize LyX usage\n"
                  "\t-userdir dir       try to set user directory to dir\n"
                  "\t-sysdir dir        try to set system directory to dir\n"
-                 "\t-geometry WxH+X+Y  set the width of the main window\n"
+                 "\t-display display   use display as DISPLAY\n"
+                 "\t-geometry WxH+X+Y  set geometry of the main window\n"
                   "\t-dbg feature[,feature]...\n"
                   "                  select the features to debug.\n"
                   "                  Type `lyx -dbg' to see the list of features\n"