-void
-steal_focus_and_colormap (Widget dialog)
-{
- Display *dpy = XtDisplay (dialog);
- Window window = XtWindow (dialog);
- Colormap cmap = 0;
- XSetInputFocus (dpy, window, RevertToParent, CurrentTime);
-
- XtVaGetValues (dialog, XtNcolormap, &cmap, 0);
- if (cmap)
- XInstallColormap (dpy, cmap);
-}
-
-static void
-raise_screenhack_dialog (void)
-{
- XMapRaised (XtDisplay (demo_dialog), XtWindow (demo_dialog));
- if (resources_dialog)
- XMapRaised (XtDisplay (resources_dialog), XtWindow (resources_dialog));
- steal_focus_and_colormap (resources_dialog ? resources_dialog : demo_dialog);
-}
-
-static void
-destroy_screenhack_dialogs (saver_info *si)
-{
- saver_screen_info *ssi = si->default_screen;
-
- if (demo_dialog) XtDestroyWidget (demo_dialog);
- if (resources_dialog) XtDestroyWidget (resources_dialog);
- demo_dialog = resources_dialog = 0;
-
- if (ssi->demo_cmap &&
- ssi->demo_cmap != ssi->cmap &&
- ssi->demo_cmap != DefaultColormapOfScreen (ssi->screen))
- {
- XFreeColormap (si->dpy, ssi->demo_cmap);
- ssi->demo_cmap = 0;
- }
-
- /* Since we installed our colormap to display the dialogs properly, put
- the old one back, so that the screensaver_window is now displayed
- properly. */
- if (ssi->cmap)
- XInstallColormap (si->dpy, ssi->cmap);
-}
-
-
-static void
-text_cb (Widget text_widget, XtPointer client_data, XtPointer call_data)
-{
- saver_info *si = (saver_info *) client_data;
- char *line;
- line = get_text_string (text_widget);
- demo_mode_hack (si, line);
-}
-
-
-#ifdef HAVE_ATHENA
-/* Bend over backwards to make hitting Return in the text field do the
- right thing.
- */
-extern saver_info *global_si_kludge;
-static void text_enter (Widget w, XEvent *event, String *av, Cardinal *ac)
-{
- text_cb (w, global_si_kludge, 0);
-}
-
-static XtActionsRec actions[] = {{"done", text_enter}
- };
-static char translations[] = ("<Key>Return: done()\n"
- "<Key>Linefeed: done()\n"
- "Ctrl<Key>M: done()\n"
- "Ctrl<Key>J: done()\n");
-#endif /* HAVE_ATHENA */
-
-
-static void
-select_cb (Widget button, XtPointer client_data, XtPointer call_data)
-{
- saver_info *si = (saver_info *) client_data;
-
-#ifdef HAVE_ATHENA
- XawListReturnStruct *item = (XawListReturnStruct*)call_data;
- XtVaSetValues(text_line, XtNstring, item->string, 0);
-
- demo_mode_hack (si, item->string);
- if (item->list_index >= 0)
- si->default_screen->current_hack = item->list_index;
-
-#else /* HAVE_MOTIF */
- XmListCallbackStruct *lcb = (XmListCallbackStruct *) call_data;
- char *string = 0;
- if (lcb->item)
- XmStringGetLtoR (lcb->item, XmSTRING_DEFAULT_CHARSET, &string);
- set_text_string (text_line, (string ? string : ""));
- if (lcb->reason == XmCR_DEFAULT_ACTION && string)
- {
- demo_mode_hack (si, string);
- if (lcb->item_position > 0)
- si->default_screen->current_hack = lcb->item_position - 1;
- }
- if (string)
- XtFree (string);
-#endif /* HAVE_MOTIF */
- steal_focus_and_colormap (demo_dialog);
-}
-
-
-#if 0 /* configure does this now */
-#ifdef HAVE_ATHENA
-# if !defined(_Viewport_h)
- /* The R4 Athena libs don't have this function. I don't know the right
- way to tell, but I note that the R5 version of Viewport.h defines
- _XawViewport_h, while the R4 version defines _Viewport_h. So we'll
- try and key off of that... */
-# define HAVE_XawViewportSetCoordinates
-# endif
-#endif /* HAVE_ATHENA */
-#endif /* 0 */
-
-