瀏覽代碼

d.mon: partly revert https://trac.osgeo.org/grass/changeset/64437, another attempt to fix launching wx-monitors

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64443 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 年之前
父節點
當前提交
68f92b511f
共有 1 個文件被更改,包括 7 次插入9 次删除
  1. 7 9
      display/d.mon/start.c

+ 7 - 9
display/d.mon/start.c

@@ -75,7 +75,7 @@ char *start(const char *name, const char *output, int update)
 /* start wxGUI display monitor */
 /* start wxGUI display monitor */
 char *start_wx(const char *name, const char *element, int width, int height, int x_only)
 char *start_wx(const char *name, const char *element, int width, int height, int x_only)
 {
 {
-    char progname[GPATH_MAX];
+    char progname[GPATH_MAX], mon_path[GPATH_MAX];
     char str_width[1024], str_height[1024], *str_x_only;
     char str_width[1024], str_height[1024], *str_x_only;
     char *mapfile;
     char *mapfile;
     
     
@@ -97,9 +97,10 @@ char *start_wx(const char *name, const char *element, int width, int height, int
         str_x_only = "1";
         str_x_only = "1";
     else
     else
         str_x_only = "0";
         str_x_only = "0";
-
+    
+    G_file_name(mon_path, element, NULL, G_mapset());
     G_spawn_ex(getenv("GRASS_PYTHON"), progname, progname,
     G_spawn_ex(getenv("GRASS_PYTHON"), progname, progname,
-	       name, element, str_width, str_height, str_x_only, SF_BACKGROUND, NULL);
+               name, mon_path, str_width, str_height, str_x_only, SF_BACKGROUND, NULL);
 
 
     G_file_name(mapfile, element, "map.ppm", G_mapset());
     G_file_name(mapfile, element, "map.ppm", G_mapset());
     
     
@@ -190,13 +191,10 @@ int start_mon(const char *name, const char *output, int select,
     close(fd);
     close(fd);
 
 
     /* start monitor */
     /* start monitor */
-    if (strncmp(name, "wx", 2) == 0) {
-        G_file_name(file_path, mon_path, NULL, G_mapset());
-        out_file = start_wx(name, file_path, width, height, x_only);
-    }
-    else {
+    if (strncmp(name, "wx", 2) == 0)
+        out_file = start_wx(name, mon_path, width, height, x_only);
+    else
         out_file = start(name, output, update);
         out_file = start(name, output, update);
-    }
     
     
     /* create env file (environmental variables used for rendering) */
     /* create env file (environmental variables used for rendering) */
     G_debug(1, "Monitor name=%s, envfile=%s", name, env_file);
     G_debug(1, "Monitor name=%s, envfile=%s", name, env_file);