+(defun make-dialog-box (&optional spec props parent)
+ "Create a frame suitable for use as a general dialog box.
+The frame is made a child of PARENT (defaults to the selected frame),
+and has additional properties PROPS, as well as `dialog-frame-plist'.
+SPEC is a string or glyph to be placed in the gutter. If INVISIBLE is
+non-nil then the frame is initially unmapped.
+Normally the created frame has no modelines, menubars, scrollbars,
+minibuffer or toolbars and is entirely covered by its gutter."
+ (or parent (setq parent (selected-frame)))
+ (let* ((ftop (frame-property parent 'top))
+ (fleft (frame-property parent 'left))
+ (fwidth (frame-pixel-width parent))
+ (fheight (frame-pixel-height parent))
+ (fonth (font-height (face-font 'default)))
+ (fontw (font-width (face-font 'default)))
+ (props (append props dialog-frame-plist))
+ (dfheight (plist-get props 'height))
+ (dfwidth (plist-get props 'width))
+ (unmapped (plist-get props 'initially-unmapped))
+ (gutter-spec spec)
+ (name (or (plist-get props 'name) "XEmacs"))
+ (frame nil))
+ (plist-remprop props 'initially-unmapped)
+ ;; allow the user to just provide a glyph
+ (when (glyphp spec)
+ (setq gutter-spec (copy-sequence "\n"))
+ (set-extent-begin-glyph (make-extent 0 1 gutter-spec) spec))
+ ;; under FVWM at least, if I don't specify the initial position,
+ ;; it ends up always at (0, 0). xwininfo doesn't tell me
+ ;; that there are any program-specified position hints, so
+ ;; it must be an FVWM bug. So just be smashing and position
+ ;; in the center of the selected frame.
+ (setq frame (make-frame
+ (append props
+ `(popup ,parent initially-unmapped t
+ menubar-visible-p nil
+ has-modeline-p nil
+ default-toolbar-visible-p nil
+ top-gutter-visible-p t
+ top-gutter-height ,(* dfheight fonth)
+ top-gutter ,gutter-spec
+ minibuffer none
+ name ,name
+ modeline-shadow-thickness 0
+ vertical-scrollbar-visible-p nil
+ horizontal-scrollbar-visible-p nil
+ unsplittable t
+ left ,(+ fleft (- (/ fwidth 2)
+ (/ (* dfwidth fontw)
+ 2)))
+ top ,(+ ftop (- (/ fheight 2)
+ (/ (* dfheight fonth)
+ 2)))))))
+ (set-face-foreground 'modeline [default foreground] frame)
+ (set-face-background 'modeline [default background] frame)
+ (unless unmapped (make-frame-visible frame))
+ frame))
+
+