*** 1.22	1993/03/02 01:57:10
--- callbacks.c	1993/05/05 20:01:40
***************
*** 232,241 ****
  XtPointer closure;
  XtPointer callData;
  {
!   WindowInfo *sd = (WindowInfo *)closure;
  
!   XtPopdown((Widget)sd->newwin_popup);
!   CreateWindow(newwin_buffer);
  }
  
  void
--- 232,241 ----
  XtPointer closure;
  XtPointer callData;
  {
!   WindowInfo *wi = (WindowInfo *)closure;
  
!   XtPopdown((Widget)wi->newwin_popup);
!   CreateWindow(wi->base, newwin_buffer);
  }
  
  void
*** 1.11	1993/02/26 02:09:54
--- help.c	1993/05/05 19:46:07
***************
*** 134,138 ****
  
    if (!help_widget)
      help_widget = createHelp();
!   XtPopup(help_widget, XtGrabNone);
  }
--- 134,139 ----
  
    if (!help_widget)
      help_widget = createHelp();
!   if (help_widget)
!     XtPopup(help_widget, XtGrabNone);
  }
*** 1.23	1993/04/30 21:40:35
--- main.c	1993/05/05 20:19:14
***************
*** 134,140 ****
        exit(0);
      }
  
!     CreateWindow(argv[i]);
    }
  
    /* if we haven't opened a window yet... */
--- 134,140 ----
        exit(0);
      }
  
!     CreateWindow(toplevel, argv[i]);
    }
  
    /* if we haven't opened a window yet... */
***************
*** 152,158 ****
      }
  
      /* bring up controlling window using stdin as input */
!     CreateWindow(NULL);
    }
  
    XtAppMainLoop(context);
--- 152,158 ----
      }
  
      /* bring up controlling window using stdin as input */
!     CreateWindow(toplevel, NULL);
    }
  
    XtAppMainLoop(context);
*** 1.14	1993/02/26 01:12:17
--- popup.c	1993/05/05 20:10:21
***************
*** 177,182 ****
--- 177,183 ----
  va_dcl
  #endif
  {
+   extern XtAppContext context;
    Widget msg_pop, form, msg_label, button;
    Arg args[15];
    Cardinal i;
***************
*** 187,192 ****
--- 188,199 ----
    XtCallbackProc btnproc;
    va_list vap;
  
+   /* can't popup a messagebox if widgets haven't been realized yet... */
+   if (!XtIsRealized(top)) {
+     XtAppWarning(context, msg);
+     return 0;
+   }
+ 
    accel = XtParseAcceleratorTable(myreturn);
  
    callback[1].callback = (XtCallbackProc) NULL;
*** 1.12	1993/02/26 01:13:12
--- util.c	1993/05/05 19:31:44
***************
*** 156,162 ****
    } else {
      if (!notFound)
        notFound = MessageBox(parent, "String not found .....", "OK", 0, 0);
!     SetPopup(parent, notFound);
    }
  }
  
--- 156,163 ----
    } else {
      if (!notFound)
        notFound = MessageBox(parent, "String not found .....", "OK", 0, 0);
!     if (notFound)
!       SetPopup(parent, notFound);
    }
  }
  
***************
*** 242,248 ****
      strcat(data.errmsg, filename);
  
      data.errbox = MessageBox(top, data.errmsg, "OK", popdownCouldntOpen, 0);
!     SetPopup(top, data.errbox);
    }
  }
  
--- 243,250 ----
      strcat(data.errmsg, filename);
  
      data.errbox = MessageBox(top, data.errmsg, "OK", popdownCouldntOpen, 0);
!     if (data.errbox)
!       SetPopup(top, data.errbox);
    }
  }
  
*** 1.11	1993/03/02 02:07:05
--- window.c	1993/05/05 20:02:49
***************
*** 49,58 ****
  }
  
  int
! CreateWindow(filename)
  const char *filename;
  {
-   extern Widget toplevel;
    FILE *file;
    Cardinal i;
    Arg args[2];
--- 49,58 ----
  }
  
  int
! CreateWindow(top, filename)
! Widget top;
  const char *filename;
  {
    FILE *file;
    Cardinal i;
    Arg args[2];
***************
*** 75,82 ****
        sprintf(message, "Can't have more than %d windows!",
  	      resources.maxWindows);
        if (!tooManyMsg)
! 	tooManyMsg = MessageBox(toplevel, message, "OK", popdownTooMany, 0);
!       SetPopup(toplevel, tooManyMsg);
      }
      return 1;
    }
--- 75,83 ----
        sprintf(message, "Can't have more than %d windows!",
  	      resources.maxWindows);
        if (!tooManyMsg)
! 	tooManyMsg = MessageBox(top, message, "OK", popdownTooMany, 0);
!       if (tooManyMsg)
! 	SetPopup(top, tooManyMsg);
      }
      return 1;
    }
***************
*** 95,101 ****
  
      /* try to open the file */
      if ((file = fopen(filename, "r")) == NULL) {
!       CouldntOpen(toplevel, filename);
        return 2;
      }
  
--- 96,102 ----
  
      /* try to open the file */
      if ((file = fopen(filename, "r")) == NULL) {
!       CouldntOpen(top, filename);
        return 2;
      }
  
***************
*** 111,119 ****
  
      /* don't let 'em get away with this!!! */
      if (!badFileMsg)
!       badFileMsg = MessageBox(toplevel, "Please specify a file name!",
  			      "OK", 0, 0);
!     SetPopup(toplevel, badFileMsg);
      return 3;
  
    }
--- 112,121 ----
  
      /* don't let 'em get away with this!!! */
      if (!badFileMsg)
!       badFileMsg = MessageBox(top, "Please specify a file name!",
  			      "OK", 0, 0);
!     if (badFileMsg)
!       SetPopup(top, badFileMsg);
      return 3;
  
    }
***************
*** 121,130 ****
    /* keep track of the new window */
    if ((wi = (WindowInfo *) malloc(sizeof(WindowInfo))) == NULL){
      if (!memErrMsg)
!       memErrMsg= MessageBox(toplevel,
  			    "Couldn't save internal window information!",
  			    "OK", 0, 0);
!     SetPopup(toplevel, memErrMsg);
      return 4;
    }
    wi->file = fixedname;
--- 123,133 ----
    /* keep track of the new window */
    if ((wi = (WindowInfo *) malloc(sizeof(WindowInfo))) == NULL){
      if (!memErrMsg)
!       memErrMsg= MessageBox(top,
  			    "Couldn't save internal window information!",
  			    "OK", 0, 0);
!     if (memErrMsg)
!       SetPopup(top, memErrMsg);
      return 4;
    }
    wi->file = fixedname;
*** 1.33	1993/04/30 21:39:15
--- xless.h	1993/05/05 20:03:56
***************
*** 251,257 ****
  extern XLessResources resources;
  
  /* prototypes from window.c */
! int CreateWindow ARGS((const char *));
  void DestroyWindowInfo ARGS((WindowInfo *));
  void DestroyAllWindows ARGS((void));
  extern WindowInfo *windowlist;
--- 251,257 ----
  extern XLessResources resources;
  
  /* prototypes from window.c */
! int CreateWindow ARGS((Widget, const char *));
  void DestroyWindowInfo ARGS((WindowInfo *));
  void DestroyAllWindows ARGS((void));
  extern WindowInfo *windowlist;
