2 Copyright (c) 1997 Douglas Keller
4 This file is part of XEmacs.
6 XEmacs is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* Synched up with: Not in FSF. */
28 #include "console-x.h"
30 #include "balloon_help.h"
32 /* #### start of hack */
35 alloc_color (Display* dpy, const char* colorname, int light)
37 Colormap cmap = DEVICE_X_COLORMAP (XDEVICE(Vdefault_x_device));
38 unsigned long pixel = 0;
41 if (XParseColor(dpy, cmap, colorname, &color) && XAllocColor(dpy, cmap, &color))
49 printf ("Warning: could not allocate color \"%s\", using \"white\"\n",
51 pixel = alloc_color (dpy, "white", True);
55 printf ("Warning: could not allocate color \"%s\", using \"black\"\n",
57 pixel = alloc_color (dpy, "black", True);
64 open_font (Display* dpy, const char* font_name)
66 XFontStruct* fontStruct = NULL;
68 fontStruct = XLoadQueryFont (dpy, font_name ? font_name : "fixed");
69 if (fontStruct == NULL)
71 printf ("Warning: could not load font \"%s\", using \"fixed\".\n", font_name);
72 fontStruct = XLoadQueryFont (dpy, "fixed");
73 assert (fontStruct != NULL);
81 static int init_p = 0;
85 Pixel fg, bg, shine, shadow;
87 Display *dpy = DEVICE_X_DISPLAY (XDEVICE (Vdefault_x_device));
89 fg = alloc_color (dpy, "grey60", 1);
90 bg = alloc_color (dpy, "black", 0);
92 shine = alloc_color (dpy, "grey80", 1);
93 shadow = alloc_color (dpy, "grey40", 0);
95 font = open_font (dpy, "-adobe-helvetica-medium-r-normal--12-*");
97 balloon_help_create (dpy, bg, fg, shine, shadow, font);
102 /* #### end of hack */
104 DEFUN ("show-balloon-help", Fshow_balloon_help, 1, 1, 0, /*
110 CHECK_STRING (string);
112 p = (char *) XSTRING_DATA (string);
116 balloon_help_show (p);
121 DEFUN ("hide-balloon-help", Fhide_balloon_help, 0, 0, 0, /*
128 balloon_help_hide ();
133 DEFUN ("balloon-help-move-to-pointer", Fballoon_help_move_to_pointer, 0, 0, 0, /*
134 Move the balloon help to the place where the pointer currently resides.
140 balloon_help_move_to_pointer ();
147 /************************************************************************/
149 /************************************************************************/
152 syms_of_balloon_x (void)
154 DEFSUBR (Fshow_balloon_help);
155 DEFSUBR (Fhide_balloon_help);
156 DEFSUBR (Fballoon_help_move_to_pointer);
160 vars_of_balloon_x (void)
162 Fprovide (intern ("c-balloon-help"));