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