[GRASS-SVN] r65182 - grass/trunk/display/d.mon

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 3 07:26:58 PDT 2015


Author: martinl
Date: 2015-05-03 07:26:58 -0700 (Sun, 03 May 2015)
New Revision: 65182

Modified:
   grass/trunk/display/d.mon/main.c
   grass/trunk/display/d.mon/start.c
Log:
d.mon: fix width/height handling with respect to `resolution`


Modified: grass/trunk/display/d.mon/main.c
===================================================================
--- grass/trunk/display/d.mon/main.c	2015-05-03 14:11:53 UTC (rev 65181)
+++ grass/trunk/display/d.mon/main.c	2015-05-03 14:26:58 UTC (rev 65182)
@@ -206,6 +206,21 @@
 
         width = width_opt->answer ? atoi(width_opt->answer) : 0;
         height = height_opt->answer ? atoi(height_opt->answer) : 0;
+        if (width < 1) {
+            char *env_width = getenv("GRASS_RENDER_WIDTH");
+            if (env_width)
+                width = atoi(env_width);
+        }
+        if (height < 1) {
+            char *env_height = getenv("GRASS_RENDER_HEIGHT");
+            if (env_height)
+                height = atoi(env_height);
+        }
+        if (width < 1)
+            width = DEFAULT_WIDTH;
+        if (height < 1)
+            height = DEFAULT_HEIGHT;
+        
         if (res_opt->answer) {
             int res;
             
@@ -214,6 +229,8 @@
             height *= res;
         }
 
+        G_debug(1, "Monitor width/height = %d/%d", width, height);
+
 	ret = start_mon(start_opt->answer, output_opt->answer, !select_flag->answer,
 			width, height, bgcolor_opt->answer,
 			!truecolor_flag->answer, x_flag->answer, update_flag->answer);

Modified: grass/trunk/display/d.mon/start.c
===================================================================
--- grass/trunk/display/d.mon/start.c	2015-05-03 14:11:53 UTC (rev 65181)
+++ grass/trunk/display/d.mon/start.c	2015-05-03 14:26:58 UTC (rev 65182)
@@ -86,14 +86,8 @@
     mapfile[0] = '\0';
 
     sprintf(progname, "%s/gui/wxpython/mapdisp/main.py", G_gisbase());
-    if (width > 0)
-        sprintf(str_width, "%d", width);
-    else
-        str_width[0] = '\0';
-    if (height > 0)
-        sprintf(str_height, "%d", height);
-    else
-        str_height[0] = '\0';
+    sprintf(str_width, "%d", width);
+    sprintf(str_height, "%d", height);
 
     if (x_only)
         str_x_only = "1";
@@ -215,13 +209,9 @@
     write(fd, buf, strlen(buf));
     sprintf(buf, "GRASS_RENDER_FILE_READ=TRUE\n");
     write(fd, buf, strlen(buf));
-    env_width = getenv("GRASS_RENDER_WIDTH");
-    sprintf(buf, "GRASS_RENDER_WIDTH=%d\n",
-            width > 0 ? width : (env_width ? atoi(env_width) : DEFAULT_WIDTH));
+    sprintf(buf, "GRASS_RENDER_WIDTH=%d\n", width);
     write(fd, buf, strlen(buf));
-    env_height = getenv("GRASS_RENDER_HEIGHT");
-    sprintf(buf, "GRASS_RENDER_HEIGHT=%d\n",
-            height > 0 ? height : (env_height ? atoi(env_height) : DEFAULT_HEIGHT));
+    sprintf(buf, "GRASS_RENDER_HEIGHT=%d\n", height);
     write(fd, buf, strlen(buf));
     if (bgcolor) {
 	if (strcmp(bgcolor, "none") == 0)



More information about the grass-commit mailing list