*** 1.1	1994/05/03 14:14:37
--- add_window.c	1994/05/03 14:22:28
***************
*** 47,57 ****
--- 47,66 ----
  #include "screen.h"
  #ifdef SHAPE
  #include <X11/extensions/shape.h>
+ #include <X11/Xresource.h>
  #endif /* SHAPE */
  #include "module.h"
  
  char NoName[] = "Untitled"; /* name if no name is specified */
  
+ /* Used to parse command line of clients for specific desk requests. */
+ /* Todo: check for multiple desks. */
+ static XrmDatabase db;
+ static XrmOptionDescRec table [] = {
+     {"-workspace",	"*desk",	XrmoptionSepArg, (caddr_t) NULL},
+     {"-xrm",		NULL,		XrmoptionResArg, (caddr_t) NULL},
+ };
+ 
  /***********************************************************************
   *
   *  Procedure:
***************
*** 80,85 ****
--- 89,98 ----
    extern Bool NeedToResizeToo;
    extern FvwmWindow *colormap_win;
    char *forecolor = NULL, *backcolor = NULL;
+   int client_argc;
+   char **client_argv = NULL, *str_type;
+   Bool status;
+   XrmValue rm_value;
  
    NeedToResizeToo = False;
    /* allocate space for the fvwm window */
***************
*** 201,206 ****
--- 214,232 ----
    tmp_win->frame_height = tmp_win->attr.height + tmp_win->title_height+
      2*tmp_win->boundary_width;
  
+ 
+   /* Find out if the client requested a specific desk on the command line. */
+   if (XGetCommand (dpy, tmp_win->w, &client_argv, &client_argc)) {
+       XrmParseCommand (&db, table, 2, "fvwm", &client_argc, client_argv);
+       status = XrmGetResource (db, "fvwm.desk", "Fvwm.Desk", &str_type, &rm_value);
+       if ((status == True) && (rm_value.size != 0)) {
+           Desk = atoi(rm_value.addr);
+ 	  tmp_win->flags |= STAYSONDESK_FLAG;
+ 	  tflag |= STAYSONDESK_FLAG;
+       }
+       XrmDestroyDatabase (db);
+       db = NULL;
+   }
  
    if(!PlaceWindow(tmp_win, tflag, Desk))
      return NULL;
