annotate lisp/packages/balloon-help.el @ 114:8619ce7e4c50 r20-1b9

Import from CVS: tag r20-1b9
author cvs
date Mon, 13 Aug 2007 09:21:54 +0200
parents a145efe76779
children 6608ceec7cf8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; Balloon help for XEmacs (requires 19.12 or later)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2 ;;; Copyright (C) 1995, 1997 Kyle E. Jones
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; A copy of the GNU General Public License can be obtained from this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; program's author (send electronic mail to kyle@uunet.uu.net) or from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; Send bug reports to kyle@wonderworks.com
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; Balloon help pops up a small frame to display help text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; relating to objects that the mouse cursor passes over.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; Installation:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; Byte-compile the file balloon-help.el (with M-x byte-compile-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; and put the .elc file in a directory in your load-path. Add the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; following line to your .emacs:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; (require 'balloon-help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; For 19.12 users:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; If you are using fvwm, [tv]twm or ol[v]wm, you can also add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; the following lines to various configuration file to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; minimal decorations on the balloon help frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; In .emacs:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; (setq balloon-help-frame-name "balloon-help")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; For ol[v]wm use this in .Xdefaults:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; olvwm.NoDecor: balloon-help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; olwm.MinimalDecor: balloon-help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; For fvvm use this in your .fvwmrc:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; NoTitle balloon-help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; Style "balloon-help" NoTitle, NoHandles, BorderWidth 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; For twm use this in your .twmrc:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;; NoTitle { "balloon-help" }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; Under 19.13 and later versions the balloon-help frame uses a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; transient window that is not normally decorated by window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; managers. So the window manager directives should not be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; needed for XEmacs 19.13 and beyond.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (provide 'balloon-help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
60 (defvar balloon-help-version "1.05"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "Version string for Balloon Help.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defvar balloon-help-mode t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "*Non-nil means Balloon help mode is enabled.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defvar balloon-help-timeout 1500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 "*Display help after this many milliseconds of mouse inactivity.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (defvar balloon-help-foreground "black"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 "*The foreground color for displaying balloon help text.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defvar balloon-help-background "rgb:c0/c0/c0"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "*The background color for the balloon help frame.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (defvar balloon-help-background-pixmap ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 "*The background pixmap for the balloon help frame.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (defvar balloon-help-font "fixed"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 "*The font for displaying balloon help text.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (defvar balloon-help-border-color "black"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 "*The color for displaying balloon help frame's border.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
84 (defvar balloon-help-border-width 2
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
85 "*The width of the balloon help frame's border.")
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
86
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defvar balloon-help-use-sound nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 "*Non-nil value means play a sound to herald the appearance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 and disappearance of the help frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 `balloon-help-appears' will be played when the frame appears.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 `balloon-help-disappears' will be played when the frame disappears.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 See the documentation for the function load-sound-file to see how
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 define sounds.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (defvar balloon-help-frame-name nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 "*The frame name to use for the frame to display the balloon help.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
100 (defvar balloon-help-aggressively-follow-mouse nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
101 "*Non-nil means the balloon should move with the mouse even if the mouse
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
102 is over the same object as the last mouse motion event.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
103
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;;; End of user variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (defvar mouse-motion-hook mouse-motion-handler
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "Hooks to be run whenever the user moves the mouse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 Each hook is called with one argument, the mouse motion event.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (defun mouse-motion-hook (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 "Run the hooks attached to mouse-motion-hook."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (run-hook-with-args 'mouse-motion-hook event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (setq mouse-motion-handler 'mouse-motion-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (defvar balloon-help-frame nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 "Balloon help is displayed in this frame.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (defvar balloon-help-help-object nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 "Object that the mouse is over that has a help property, nil otherwise.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (defvar balloon-help-help-object-x nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 "Last horizontal mouse position over balloon-help-help-object.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (defvar balloon-help-help-object-y nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 "Last vertical mouse position over balloon-help-help-object.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (defvar balloon-help-buffer nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 "Buffer used to display balloon help.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (defvar balloon-help-timeout-id nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 "Timeout id for the balloon help timeout.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (defvar balloon-help-display-pending nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 "Non-nil value means the help frame will be visible as soon
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 as the X server gets around to displaying it. Nil means it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 will be invisible as soon as the X server decides to hide it.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (defun balloon-help-mode (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 "Toggle Balloon Help mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 With arg, turn Balloon Help mode on iff arg is positive.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 With Balloon Help enabled, a small frame is displayed whenever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 the mouse rests on an object that has a help property of some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 kind. The text of that help property is displayed in the frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 For extents, the 'balloon-help' property is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 checked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 For toolbar buttons, the help-string slot of the toolbar button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 is checked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 If the value is a string, it is used as the help message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 If the property's value is a symbol, it is assumed to be the name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 of a function and it will be called with one argument, the object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 under the mouse, and the return value of that function will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 used as the help message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (setq balloon-help-mode (or (and arg (> (prefix-numeric-value arg) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (and (null arg) (null balloon-help-mode))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (if (null balloon-help-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (balloon-help-undisplay-help)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (defun balloon-help-displayed ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (and (frame-live-p balloon-help-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (frame-visible-p balloon-help-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (defun balloon-help-motion-hook (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ((null balloon-help-mode) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ((button-press-event-p event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (setq balloon-help-help-object nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (if balloon-help-timeout-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (disable-timeout balloon-help-timeout-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (if (balloon-help-displayed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (balloon-help-undisplay-help)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (let* ((buffer (event-buffer event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (frame (event-frame event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (point (and buffer (event-point event)))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
184 (modeline-point (and buffer (event-modeline-position event)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
185 (modeline-extent (and modeline-point
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
186 (map-extents
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
187 (function (lambda (e ignored) e))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
188 (symbol-value-in-buffer
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
189 'generated-modeline-string
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
190 buffer)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
191 modeline-point modeline-point
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
192 nil nil
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
193 'balloon-help)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (glyph-extent (event-glyph-extent event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (glyph-extent (if (and glyph-extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (extent-property glyph-extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 'balloon-help))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 glyph-extent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (extent (and point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (extent-at point buffer 'balloon-help)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (button (event-toolbar-button event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (button (if (and button (toolbar-button-help-string button))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 nil))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
205 (object (or modeline-extent glyph-extent extent button))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (id balloon-help-timeout-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (if (null object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (if (and balloon-help-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (not (eq frame balloon-help-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (setq balloon-help-help-object nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (if id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (disable-timeout id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (if (balloon-help-displayed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (balloon-help-undisplay-help))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (let* ((params (frame-parameters frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (top (cdr (assq 'top params)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (left (cdr (assq 'left params)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (xtop-toolbar-height
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
220 (if (and (specifier-instance top-toolbar-visible-p frame)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
221 (specifier-instance top-toolbar frame))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
222 (specifier-instance top-toolbar-height frame)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (xleft-toolbar-width
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
225 (if (and (specifier-instance left-toolbar-visible-p frame)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
226 (specifier-instance left-toolbar frame))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
227 (specifier-instance left-toolbar-width frame)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 0))
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
229 (menubar-height
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
230 (if (and buffer
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
231 (specifier-instance menubar-visible-p)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
232 (save-excursion (set-buffer buffer) current-menubar))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
233 22 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (setq balloon-help-help-object-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (+ left xleft-toolbar-width (event-x-pixel event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 balloon-help-help-object-y
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (+ top xtop-toolbar-height menubar-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (event-y-pixel event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (cond ((eq frame balloon-help-frame) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ((eq object balloon-help-help-object)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
241 (if (and (balloon-help-displayed)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
242 balloon-help-aggressively-follow-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (balloon-help-move-help-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ((balloon-help-displayed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (setq balloon-help-help-object object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (balloon-help-display-help))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (setq balloon-help-help-object object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (if id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (disable-timeout id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (setq balloon-help-timeout-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (add-timeout (/ balloon-help-timeout 1000.0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (function balloon-help-display-help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 nil)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (defun balloon-help-pre-command-hook (&rest ignored)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (setq balloon-help-help-object nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (if (balloon-help-displayed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (balloon-help-undisplay-help)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (fset 'balloon-help-post-command-hook 'balloon-help-pre-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (fset 'balloon-help-mouse-leave-frame-hook 'balloon-help-pre-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (fset 'balloon-help-deselect-frame-hook 'balloon-help-pre-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (defun balloon-help-display-help (&rest ignored)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (setq balloon-help-timeout-id nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (if balloon-help-help-object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (let* ((object balloon-help-help-object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (help (or (and (extent-live-p object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (extent-property object 'balloon-help))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (and (toolbar-button-p object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (toolbar-button-help-string object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (and (stringp object) object))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;; if help is non-null and is not a string, run it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ;; function to produuce the help string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (if (or (null help) (not (symbolp help)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (condition-case data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (setq help (funcall help object))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (setq help (format "help function signaled: %S" data)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (if (stringp help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (if (not (bufferp balloon-help-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (setq balloon-help-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (get-buffer-create " *balloon-help*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (if (not (frame-live-p balloon-help-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (setq balloon-help-frame (balloon-help-make-help-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (set-buffer balloon-help-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (insert help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (if (not (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (insert ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ;; help strings longer than 2 lines have the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;; line stolen by the minibuffer, so make sure the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ;; last line is blank. Make the top line blank for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ;; some symmetry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (if (< 2 (count-lines (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 ;; add a second blank line at the end to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ;; prevent the modeline bar from clipping the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 ;; descenders of the last line of text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (insert ?\n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;; cursor will be at point-min because we're just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ;; moving point which doesn't affect window-point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 ;; when the window isn't selected. Indent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;; everything so that the cursor will be over a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;; space. The 1-pixel bar cursor will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; completely invisible this way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (indent-rigidly (point-min) (point-max) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (balloon-help-move-help-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (balloon-help-resize-help-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (balloon-help-expose-help-frame))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (defun balloon-help-undisplay-help ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (balloon-help-hide-help-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (defun balloon-help-hide-help-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (if (balloon-help-displayed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (make-frame-invisible balloon-help-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (if (and balloon-help-use-sound balloon-help-display-pending)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (play-sound 'balloon-help-disappears))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (setq balloon-help-display-pending nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (defun balloon-help-expose-help-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (if (not (balloon-help-displayed))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (make-frame-visible balloon-help-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (if (and balloon-help-use-sound (null balloon-help-display-pending))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (play-sound 'balloon-help-appears))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (setq balloon-help-display-pending t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (defun balloon-help-resize-help-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (set-buffer balloon-help-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (let ((longest 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (lines 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (window-min-height 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (window-min-width 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (setq longest (max longest (current-column))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 done (not (= 0 (forward-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (and (not done) (setq lines (1+ lines))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (set-frame-size balloon-help-frame (+ 1 longest) lines))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
353 (defun balloon-help-make-junk-frame ()
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
354 (let ((window-min-height 1)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
355 (window-min-width 1))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
356 (save-excursion
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
357 (set-buffer (generate-new-buffer "*junk-frame-buffer*"))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
358 (prog1
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
359 (make-frame '(minibuffer t initially-unmapped t width 1 height 1))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 102
diff changeset
360 (rename-buffer " *junk-frame-buffer*" t)))))
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
361
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (defun balloon-help-make-help-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (set-buffer balloon-help-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (set-buffer-menubar nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (let* ((x (balloon-help-compute-help-frame-x-location))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (y (balloon-help-compute-help-frame-y-location))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (window-min-height 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (window-min-width 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (frame (make-frame (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 '(initially-unmapped . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;; try to evade frame decorations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (cons 'name (or balloon-help-frame-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 "xclock"))
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
375 (cons 'border-width balloon-help-border-width)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (cons 'border-color balloon-help-border-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (cons 'top y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (cons 'left x)
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
379 (cons 'popup (balloon-help-make-junk-frame))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 '(width . 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 '(height . 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (set-face-font 'default balloon-help-font frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (set-face-foreground 'default balloon-help-foreground frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (set-face-background 'default balloon-help-background frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (set-face-background-pixmap 'default balloon-help-background-pixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (set-window-buffer (frame-selected-window frame) balloon-help-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (set-specifier has-modeline-p (cons frame nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (set-specifier top-toolbar-height (cons frame 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (set-specifier left-toolbar-width (cons frame 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (set-specifier right-toolbar-width (cons frame 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (set-specifier bottom-toolbar-height (cons frame 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (set-specifier top-toolbar (cons frame nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (set-specifier left-toolbar (cons frame nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (set-specifier right-toolbar (cons frame nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (set-specifier bottom-toolbar (cons frame nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (set-specifier scrollbar-width (cons frame 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (set-specifier scrollbar-height (cons frame 0))
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
399 (and (boundp 'text-cursor-visible-p)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
400 (specifierp text-cursor-visible-p)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
401 (set-specifier text-cursor-visible-p (cons frame nil)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (set-specifier modeline-shadow-thickness (cons frame 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (set-face-background 'modeline balloon-help-background frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 frame )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (defun balloon-help-compute-help-frame-x-location ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (max 0 (+ 32 balloon-help-help-object-x)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (defun balloon-help-compute-help-frame-y-location ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (max 0 (+ 48 balloon-help-help-object-y)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (defun balloon-help-move-help-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (let ((x (balloon-help-compute-help-frame-x-location))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (y (balloon-help-compute-help-frame-y-location)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (set-frame-position balloon-help-frame x y)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (add-hook 'mouse-motion-hook 'balloon-help-motion-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (add-hook 'pre-command-hook 'balloon-help-pre-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (add-hook 'post-command-hook 'balloon-help-post-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (add-hook 'mouse-leave-frame-hook 'balloon-help-mouse-leave-frame-hook)
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
421 ;; loses with ClickToFocus under fvwm
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
422 ;;(add-hook 'deselect-frame-hook 'balloon-help-deselect-frame-hook)