handler.c revision 50e2e347
1/* $XConsortium: handler.c,v 1.22 94/12/16 21:36:53 gildea Exp $ */
2/*
3
4Copyright (c) 1987, 1988  X Consortium
5
6Permission is hereby granted, free of charge, to any person obtaining
7a copy of this software and associated documentation files (the
8"Software"), to deal in the Software without restriction, including
9without limitation the rights to use, copy, modify, merge, publish,
10distribute, sublicense, and/or sell copies of the Software, and to
11permit persons to whom the Software is furnished to do so, subject to
12the following conditions:
13
14The above copyright notice and this permission notice shall be included
15in all copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
21OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23OTHER DEALINGS IN THE SOFTWARE.
24
25Except as contained in this notice, the name of the X Consortium shall
26not be used in advertising or otherwise to promote the sale, use or
27other dealings in this Software without prior written authorization
28from the X Consortium.
29
30*/
31/* $XFree86: xc/programs/xman/handler.c,v 1.6 2003/01/19 04:44:45 paulo Exp $ */
32
33/*
34 * xman - X window system manual page display program.
35 * Author:    Chris D. Peterson, MIT Project Athena
36 * Created:   October 29, 1987
37 */
38#ifdef HAVE_CONFIG_H
39# include "config.h"
40#endif
41
42#include <sys/types.h>
43#include <sys/stat.h>
44#include "globals.h"
45#include "vendor.h"
46#ifdef INCLUDE_XPRINT_SUPPORT
47#include "printdialog.h"
48#include "print.h"
49#endif /* INCLUDE_XPRINT_SUPPORT */
50
51#ifdef RELEASE_VERSION
52#define XMAN_VERSION "Xman Version " PACKAGE_VERSION " - X11R" RELEASE_VERSION
53#else
54#define XMAN_VERSION "Xman Version " PACKAGE_VERSION
55#endif
56
57static void PutUpManpage(ManpageGlobals * man_globals, FILE * file);
58static void ToggleBothShownState(ManpageGlobals * man_globals);
59
60/*	Function Name: OptionCallback
61 *	Description: This is the callback function for the callback menu.
62 *	Arguments: w - the widget we are calling back from.
63 *                 globals_pointer - a pointer to the psuedo globals structure
64 *                                  for this manpage.
65 *                 junk - (call data) not used.
66 *	Returns: none.
67 */
68
69/*ARGSUSED*/
70void
71OptionCallback(Widget w, XtPointer pointer, XtPointer junk)
72{
73  ManpageGlobals * man_globals = (ManpageGlobals *) pointer;
74  String params;
75  Cardinal num_params = 1;
76
77  if ( w == man_globals->search_entry )
78    PopupSearch(XtParent(w), NULL, NULL, NULL);
79  else if (w == man_globals->dir_entry) {       /* Put Up Directory */
80    params = "Directory";
81    GotoPage(XtParent(w), NULL, &params, &num_params);
82  }
83  else if (w == man_globals->manpage_entry ) {  /* Put Up Man Page */
84    params = "ManualPage";
85    GotoPage(XtParent(w), NULL, &params, &num_params);
86  }
87  else if ( w == man_globals->help_entry )      /* Help */
88    PopupHelp(XtParent(w), NULL, NULL, NULL);
89  else if ( w == man_globals->both_screens_entry ) /*Toggle Both_Shown State.*/
90    ToggleBothShownState(man_globals);
91  else if ( w == man_globals->remove_entry)     /* Kill the manpage */
92    RemoveThisManpage(XtParent(w), NULL, NULL, NULL);
93  else if ( w == man_globals->open_entry)       /* Open new manpage */
94    CreateNewManpage(XtParent(w), NULL, NULL, NULL);
95#ifdef INCLUDE_XPRINT_SUPPORT
96  else if ( w == man_globals->print_entry)    /* Print current manpage */
97    PrintThisManpage(XtParent(w), NULL, NULL, NULL);
98#endif /* INCLUDE_XPRINT_SUPPORT */
99  else if ( w == man_globals->version_entry)    /* Get version */
100    ShowVersion(XtParent(w), NULL, NULL, NULL);
101  else if ( w == man_globals->quit_entry)      /* Quit. */
102    Quit(XtParent(w), NULL, NULL, NULL);
103}
104
105/*      Function Name: ToggleBothShownState;
106 *      Description: toggles the state of the both shown feature.
107 *      Arguments: man_globals - the man globals structure.
108 *      Returns: none.
109 */
110
111/*
112 * I did not have a two state widget, which is the way this
113 * should really be done.  1/22/88 - CDP.
114 */
115
116static void
117ToggleBothShownState(ManpageGlobals * man_globals)
118{
119  char * label_str;
120  Arg arglist[1];
121
122  if (man_globals->both_shown == TRUE) {
123    label_str = SHOW_BOTH;
124    if (man_globals->dir_shown)
125      XtUnmanageChild(man_globals->manpagewidgets.manpage);
126    else
127      XtUnmanageChild(man_globals->manpagewidgets.directory);
128  }
129  else {
130    Widget manpage = man_globals->manpagewidgets.manpage;
131    Widget dir = man_globals->manpagewidgets.directory;
132
133    label_str = SHOW_ONE;
134
135    XtSetArg(arglist[0], XtNpreferredPaneSize, resources.directory_height);
136    XtSetValues(dir, arglist, (Cardinal) 1);
137
138    if (!man_globals->dir_shown) {
139      XtUnmanageChild(manpage);
140      XtManageChild(dir);
141    }
142    XtManageChild(manpage);
143  }
144  man_globals->both_shown = !man_globals->both_shown;
145
146  if (man_globals->dir_shown)
147    ChangeLabel(man_globals->label,
148		man_globals->section_name[man_globals->current_directory]);
149  else
150    ChangeLabel(man_globals->label, man_globals->manpage_title);
151
152  XtSetArg(arglist[0], XtNlabel, label_str);
153  XtSetValues(man_globals->both_screens_entry, arglist, ONE);
154
155  /* if both are shown there is no need to switch between the two. */
156
157  XtSetArg(arglist[0], XtNsensitive, !man_globals->both_shown);
158  XtSetValues(man_globals->manpage_entry, arglist, ONE);
159  XtSetValues(man_globals->dir_entry, arglist, ONE);
160}
161
162/*	Function Name: Popup
163 *	Description: This function pops up the given widget under the cursor.
164 *	Arguments: w - the widget to popup.
165 *                 grab_kind - the kind of grab to register.
166 *	Returns: none
167 */
168
169/* How far off the top of the widget to have the initial cursor postion. */
170
171#define OFF_OF_TOP 25
172
173void
174Popup(Widget w, XtGrabKind grab_kind)
175{
176  int x_root,y_root,y_pos,garbage;
177  unsigned int mask;
178  Window junk_window;
179
180  XQueryPointer(XtDisplay(w), XtWindow(w), &junk_window, &junk_window,
181		&x_root, &y_root, &garbage, &garbage, &mask);
182
183  y_pos = OFF_OF_TOP - Height(w)/2 - BorderWidth(w);
184  PositionCenter(w, x_root, y_root, y_pos, 0, 2, 2);
185  XtPopup(w, grab_kind);
186}
187
188/*	Function Name: PutUpManpage
189 *	Description: Puts the manpage on the display.
190 *	Arguments: man_globals - a pointer to the psuedo globals structure
191 *                                  for this manpage.
192 *                 file - the file to display.
193 *	Returns: none.
194 */
195
196static void
197PutUpManpage(ManpageGlobals * man_globals, FILE * file)
198{
199  String params = "ManualPage";
200  Cardinal num_params = 1;
201
202  if (file == NULL)
203    return;
204
205  OpenFile(man_globals, file);
206
207  if (!man_globals->both_shown) {
208    Arg arglist[1];
209    XtSetArg(arglist[0], XtNsensitive, TRUE);
210    XtSetValues(man_globals->manpage_entry, arglist, ONE);
211    XtSetValues(man_globals->both_screens_entry, arglist, ONE);
212  }
213  GotoPage(man_globals->manpagewidgets.manpage, NULL, &params, &num_params);
214}
215
216/*	Function Name: DirectoryHandler
217 *	Description: This is the callback function for the directory listings.
218 *	Arguments: w - the widget we are calling back from.
219 *                 global_pointer - the pointer to the psuedo global structure
220 *                                  associated with this manpage.
221 *                 ret_val - return value from the list widget.
222 *	Returns: none.
223 */
224
225void
226DirectoryHandler(Widget w, XtPointer global_pointer, XtPointer ret_val)
227{
228  FILE * file;			/* The manpage file. */
229  ManpageGlobals * man_globals = (ManpageGlobals *) global_pointer;
230  XawListReturnStruct * ret_struct = (XawListReturnStruct *) ret_val;
231
232  file = FindManualFile(man_globals, man_globals->current_directory,
233			ret_struct->list_index);
234  PutUpManpage(man_globals, file);
235  if ((file != NULL) && (file != man_globals->curr_file)) {
236    fclose(file);
237  }
238}
239
240/*	Function Name: DirPopupCallback
241 *	Description: This is the callback function for the callback menu.
242 *	Arguments: w - the widget we are calling back from.
243 *                 pointer - a pointer to the psuedo globals structure
244 *                                  for this manpage.
245 *                 junk - (call data) not used.
246 *	Returns: none.
247 */
248
249/*ARGSUSED*/
250void
251DirPopupCallback(Widget w, XtPointer pointer, XtPointer junk)
252{
253  ManpageGlobals * man_globals;
254  MenuStruct * menu_struct;
255  Widget parent;
256  int number;
257  int current_box;
258
259  menu_struct = (MenuStruct *) pointer;
260  man_globals = (ManpageGlobals *) menu_struct->data;
261
262  number = menu_struct->number;
263  current_box = man_globals->current_directory;
264
265  /* We have used this guy, pop down the menu. */
266
267  if (number != current_box) {
268    /* This is the only one that we know has a parent. */
269    parent = XtParent(man_globals->manpagewidgets.box[INITIAL_DIR]);
270
271    MakeDirectoryBox(man_globals, parent,
272		     man_globals->manpagewidgets.box + number, number);
273    XtUnmanageChild(man_globals->manpagewidgets.box[current_box]);
274    XtManageChild(man_globals->manpagewidgets.box[number]);
275
276    XawListUnhighlight(man_globals->manpagewidgets.box[current_box]);
277    ChangeLabel(man_globals->label, man_globals->section_name[number]);
278    man_globals->current_directory = number;
279  }
280
281  /* put up directory. */
282  if (!man_globals->both_shown) {
283    XtUnmanageChild(man_globals->manpagewidgets.manpage);
284    XtManageChild(man_globals->manpagewidgets.directory);
285  }
286}
287
288/************************************************************
289 *
290 * Action Routines.
291 *
292 ************************************************************/
293
294/*	Function Name: SaveFormattedPage
295 *	Description: This is the action routine may save the manpage.
296 *      Arguments: w - any widget in the widget tree.
297 *                 event - NOT USED.
298 *                 params, num_params - the parameters paseed to the action
299 *                                      routine, can be either Manpage or
300 *                                      Directory.
301 *      Returns: none.
302 */
303
304/*ARGSUSED*/
305void
306SaveFormattedPage(Widget w, XEvent * event, String * params, Cardinal * num_params)
307{
308  ManpageGlobals * man_globals;
309  char cmdbuf[BUFSIZ], error_buf[BUFSIZ];
310
311  if (*num_params != 1) {
312    XtAppWarning(XtWidgetToApplicationContext(w),
313       "Xman - SaveFormattedPage: This action routine requires one argument.");
314    return;
315  }
316
317  man_globals = GetGlobals(w);
318
319/*
320 * If we are not active then take no action.
321 */
322
323  switch (params[0][0]) {
324  case 'S':
325  case 's':
326
327#ifndef NO_COMPRESS
328    if (!man_globals->compress)
329#endif
330
331      snprintf(cmdbuf, sizeof(cmdbuf), "%s %s %s", COPY,
332	       man_globals->tempfile, man_globals->save_file);
333
334#ifndef NO_COMPRESS
335    else
336      if (man_globals->gzip)
337	snprintf(cmdbuf, sizeof(cmdbuf), "%s < %s > %s", GZIP_COMPRESS,
338		 man_globals->tempfile, man_globals->save_file);
339      else
340	snprintf(cmdbuf, sizeof(cmdbuf), "%s < %s > %s", COMPRESS,
341		 man_globals->tempfile, man_globals->save_file);
342#endif
343
344    if(! system(cmdbuf)) {
345	/* make sure the formatted man page is fully accessible by the world */
346	if (chmod(man_globals->save_file, CHMOD_MODE) != 0) {
347	    snprintf(error_buf, sizeof(error_buf),
348		    "Couldn't set permissions on formatted man page '%s'.\n",
349		    man_globals->save_file);
350	    PopupWarning( man_globals, error_buf);
351	}
352    } else {
353	snprintf(error_buf, sizeof(error_buf),
354		 "Error while executing the command '%s'.\n", cmdbuf);
355	PopupWarning( man_globals, error_buf);
356    }
357    break;
358  case 'C':
359  case 'c':
360    break;
361  default:
362    PopupWarning(man_globals, "Xman - SaveFormattedPage: "
363		 "Unknown argument must be either 'Save' or 'Cancel'.");
364    return;
365  }
366
367/*
368 * We do not need the filename anymore, and have the fd open.
369 * We will unlink it.
370 */
371
372  unlink(man_globals->tempfile);
373  XtPopdown( XtParent(XtParent(w)) );
374}
375
376/*      Function Name: GotoPage
377 *      Description: The Action routine that switches over to the manpage
378 *                   or directory.
379 *      Arguments: w - any widget in the widget tree.
380 *                 event - NOT USED.
381 *                 params, num_params - the parameters paseed to the action
382 *                                      routine, can be either Manpage or
383 *                                      Directory.
384 *      Returns: none.
385 */
386
387/*ARGSUSED*/
388void
389GotoPage(Widget w, XEvent * event, String * params, Cardinal * num_params)
390{
391  ManpageGlobals * man_globals;
392  Arg arglist[1];
393  Boolean sensitive;
394
395  if (*num_params != 1) {
396    XtAppWarning(XtWidgetToApplicationContext(w),
397		"Xman - GotoPage: This action routine requires one argument.");
398    return;
399  }
400
401  man_globals = GetGlobals(w);
402
403  if (man_globals->both_shown) {
404    ChangeLabel(man_globals->label,
405		man_globals->section_name[man_globals->current_directory]);
406    return;
407  }
408
409  switch (params[0][0]) {
410  case 'M':
411  case 'm':
412    XtSetArg(arglist[0], XtNsensitive, &sensitive);
413    XtGetValues(man_globals->manpage_entry, arglist, ONE);
414    if (sensitive) {
415      ChangeLabel(man_globals->label,man_globals->manpage_title);
416      XtUnmanageChild(man_globals->manpagewidgets.directory);
417      XtManageChild(man_globals->manpagewidgets.manpage);
418      man_globals->dir_shown = FALSE;
419    }
420    break;
421  case 'D':
422  case 'd':
423    ChangeLabel(man_globals->label,
424		man_globals->section_name[man_globals->current_directory]);
425    XtUnmanageChild(man_globals->manpagewidgets.manpage);
426    XtManageChild(man_globals->manpagewidgets.directory);
427    man_globals->dir_shown = TRUE;
428    break;
429  default:
430    XtAppWarning(XtWidgetToApplicationContext(w),
431		 "Xman - GotoPage: Unknown argument must be "
432		 "either Manpage or Directory.");
433    return;
434  }
435}
436
437/*      Function Name: Quit.
438 *      Description: Quits Xman.
439 *      Arguments: w - any widget.
440 *                 event - NOT USED.
441 *                 params, num_params - NOT USED.
442 *      Returns: none.
443 */
444
445/*ARGSUSED*/
446void
447Quit(Widget w, XEvent * event, String * params, Cardinal * num_params)
448{
449  XtAppSetExitFlag(XtWidgetToApplicationContext(w));
450}
451
452/*      Function Name: PopupHelp
453 *      Description: Pops up xman's help.
454 *      Arguments: w - NOT USED.
455 *                 event - NOT USED.
456 *                 params, num_params - NOT USED.
457 *      Returns: none.
458 */
459
460/*ARGSUSED*/
461void
462PopupHelp(Widget w, XEvent * event, String * params, Cardinal * num_params)
463{
464  if (MakeHelpWidget())
465    XtPopup(help_widget,XtGrabNone);
466}
467
468/*      Function Name: PopupSearch
469 *      Description: Pops up this manual pages search widget.
470 *      Arguments: w - any widget in this manpage.
471 *                 event - NOT USED.
472 *                 params, num_params - NOT USED.
473 *      Returns: none.
474 */
475
476/*ARGSUSED*/
477void
478PopupSearch(Widget w, XEvent * event, String * params, Cardinal * num_params)
479{
480  ManpageGlobals * man_globals = GetGlobals(w);
481
482  if (man_globals->search_widget) {
483    if (!XtIsRealized(man_globals->search_widget)) {
484      XtRealizeWidget(man_globals->search_widget);
485      AddCursor(man_globals->search_widget, resources.cursors.search_entry);
486    }
487    Popup(man_globals->search_widget, XtGrabNone);
488  }
489}
490
491/*      Function Name: CreateNewManpage
492 *      Description: Creates A New Manual Page.
493 *      Arguments: w - NOT USED.
494 *                 event - NOT USED.
495 *                 params, num_params - NOT USED.
496 *      Returns: none.
497 */
498
499/*ARGSUSED*/
500void
501CreateNewManpage(Widget w, XEvent * event, String * params, Cardinal * num_params)
502{
503  (void) CreateManpage(NULL);
504  man_pages_shown++;
505}
506
507/*      Function Name: RemoveThisManpage
508 *      Description: Removes a manual page.
509 *      Arguments: w - any widget in the manpage.
510 *                 event - NOT USED.
511 *                 params, num_params - NOT USED.
512 *      Returns: none.
513 */
514
515/*ARGSUSED*/
516void
517RemoveThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params)
518{
519  ManpageGlobals * man_globals = GetGlobals(w);
520
521  if (man_globals->This_Manpage != help_widget) {
522    RemoveGlobals(man_globals->This_Manpage);
523    XtDestroyWidget(man_globals->This_Manpage);
524
525    XtFree( (char *) man_globals->section_name);
526    XtFree( (char *) man_globals->manpagewidgets.box);
527    XtFree( (char *) man_globals);
528
529    if ( (--man_pages_shown) == 0)
530      Quit(w, NULL, NULL, NULL);
531  }
532  else
533    XtPopdown(help_widget);
534}
535
536/*      Function Name: Search
537 *      Description: Actually performs a search.
538 *      Arguments: w - any widget in the manpage.
539 *                 event - NOT USED.
540 *                 params, num_params - NOT USED.
541 *      Returns: none.
542 */
543
544/*ARGSUSED*/
545void
546Search(Widget w, XEvent * event, String * params, Cardinal * num_params)
547{
548  ManpageGlobals * man_globals = GetGlobals(w);
549  FILE * file = NULL;
550
551  XtPopdown(  XtParent(XtParent(w)) );       /* popdown the search widget */
552
553  if ( (*num_params < 1) || (*num_params > 2) ) {
554    XtAppWarning(XtWidgetToApplicationContext(w),
555      "Xman - Search: This action routine requires one or two arguments.");
556    return;
557  }
558
559  switch(params[0][0]) {
560  case 'a':
561  case 'A':
562    file = DoSearch(man_globals,APROPOS);
563    break;
564  case 'm':
565  case 'M':
566    file = DoSearch(man_globals,MANUAL);
567    break;
568  case 'c':
569  case 'C':
570    file = NULL;
571    break;
572  default:
573    XtAppWarning(XtWidgetToApplicationContext(w),
574		 "Xman - Search: First parameter unknown.");
575    file = NULL;
576    break;
577  }
578
579  if ( *num_params == 2 )
580    switch (params[1][0]) {
581    case 'O':
582    case 'o':
583      if (file != NULL) {
584	Widget w;
585	char * label;
586
587	w = CreateManpage(file);
588	man_pages_shown++;
589
590	/* Put title into new manual page. */
591
592	label = man_globals->manpage_title;
593	man_globals = GetGlobals(w);
594	strcpy(man_globals->manpage_title, label);
595	ChangeLabel(man_globals->label, label);
596      }
597      break;
598    default:
599      XtAppWarning(XtWidgetToApplicationContext(w),
600		   "Xman - Search: Second parameter unknown.");
601      break;
602    }
603  else {
604    PutUpManpage(man_globals, file);
605  }
606  if ((file != NULL) && (file != man_globals->curr_file)) {
607    fclose(file);
608  }
609}
610
611#ifdef INCLUDE_XPRINT_SUPPORT
612static void
613printshellDestroyXtProc(Widget w, XtPointer client_data, XtPointer callData)
614{
615  ManpageGlobals *mg = GetGlobals(w);
616  XawPrintDialogClosePrinterConnection(mg->printdialog, False);
617}
618
619static void
620printOKXtProc(Widget w, XtPointer client_data, XtPointer callData)
621{
622  XawPrintDialogCallbackStruct *pdcs = (XawPrintDialogCallbackStruct *)callData;
623  Cardinal                      n;
624  Arg                           args[2];
625  ManpageGlobals               *mg = GetGlobals(w);
626  Widget                        topwindow = mg->This_Manpage;
627  FILE                         *file;
628
629  Log(("printOKXtProc: OK.\n"));
630
631  /* Get file object */
632  n = 0;
633  XtSetArg(args[n], XtNfile, &file); n++;
634  XtGetValues(mg->manpagewidgets.manpage, args, n);
635  Assertion(file != NULL, (("printOKXtProc: file == NULL.\n")));
636
637  DoPrintManpage("Xman",
638                 file, topwindow,
639                 pdcs->pdpy, pdcs->pcontext, pdcs->colorspace,
640                 printshellDestroyXtProc,
641                 mg->manpage_title,
642                 pdcs->printToFile?pdcs->printToFileName:NULL);
643
644  XtPopdown(mg->printdialog_shell);
645}
646
647static void
648printCancelXtProc(Widget w, XtPointer client_data, XtPointer callData)
649{
650    ManpageGlobals * mg = GetGlobals(w);
651
652    Log(("printCancelXtProc: cancel.\n"));
653    XtPopdown(mg->printdialog_shell);
654
655    Log(("destroying print dialog shell...\n"));
656    XtDestroyWidget(mg->printdialog_shell);
657    mg->printdialog_shell = NULL;
658    mg->printdialog       = NULL;
659    Log(("... done\n"));
660}
661
662/*      Function Name: PrintThisManpage
663 *      Description: Print the current manual page.
664 *      Arguments: mg - manpage globals
665 *      Returns: none.
666 */
667
668/*ARGSUSED*/
669void
670PrintThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params)
671{
672  ManpageGlobals *mg = GetGlobals(w);
673  Dimension       width, height;
674  Position        x, y;
675  Widget          parent    = mg->This_Manpage;
676  Widget          topwindow = mg->This_Manpage;
677  Log(("print!\n"));
678
679  if (!mg->printdialog) {
680    int n;
681    Arg args[20];
682
683    n = 0;
684    XtSetArg(args[n], XtNallowShellResize, True); n++;
685    mg->printdialog_shell = XtCreatePopupShell("printdialogshell",
686                                               transientShellWidgetClass,
687                                               topwindow, args, n);
688    n = 0;
689    mg->printdialog = XtCreateManagedWidget("printdialog", printDialogWidgetClass,
690                                            mg->printdialog_shell, args, n);
691    XtAddCallback(mg->printdialog, XawNOkCallback,     printOKXtProc,     NULL);
692    XtAddCallback(mg->printdialog, XawNCancelCallback, printCancelXtProc, NULL);
693
694    XtRealizeWidget(mg->printdialog_shell);
695  }
696
697  /* Center dialog */
698  XtVaGetValues(mg->printdialog_shell,
699      XtNwidth,  &width,
700      XtNheight, &height,
701      NULL);
702
703  x = (Position)(XWidthOfScreen( XtScreen(parent)) - width)  / 2;
704  y = (Position)(XHeightOfScreen(XtScreen(parent)) - height) / 3;
705
706  XtVaSetValues(mg->printdialog_shell,
707      XtNx, x,
708      XtNy, y,
709      NULL);
710
711  XtPopup(mg->printdialog_shell, XtGrabNonexclusive);
712}
713#endif /* INCLUDE_XPRINT_SUPPORT */
714
715/*      Function Name: ShowVersion
716 *      Description: Show current version.
717 *      Arguments: w - any widget in the manpage.
718 *                 event - NOT USED.
719 *                 params, num_params - NOT USED.
720 *      Returns: none.
721 */
722
723/*ARGSUSED*/
724void
725ShowVersion(Widget w, XEvent * event, String * params, Cardinal * num_params)
726{
727  ManpageGlobals * man_globals = GetGlobals(w);
728  ChangeLabel(man_globals->label, XMAN_VERSION);
729}
730