annotate src/balloon_help.c @ 5619:75ad4969a16d

Replace the 'flush face property with the opposite 'shrink one. lisp/ChangeLog addition: 2011-12-26 Didier Verna <didier@xemacs.org> * cl-macs.el (face-flush-p): Removed. * cl-macs.el (face-shrink-p): New. * faces.el (face-flush-p): Removed. * faces.el (face-shrink-p): New. * faces.el (set-face-flush-p): Removed. * faces.el (set-face-shrink-p): New. * cus-face.el (custom-face-attributes): * faces.el (set-face-property): * faces.el (face-equal): * x-faces.el (x-init-face-from-resources): * x-faces.el (make-face-x-resource-internal): Replace the 'flush property with the opposite 'shrink one. src/ChangeLog addition: 2011-12-26 Didier Verna <didier@xemacs.org> * lisp.h: * faces.c (mark_face): * faces.c (face_equal): * faces.c (face_getprop): * faces.c (face_putprop): * faces.c (face_remprop): * faces.c (face_plist): * faces.c (reset_face): * faces.c (update_face_inheritance_mapper): * faces.c (Fmake_face): * faces.c (update_face_cachel_data): * faces.c (merge_face_cachel_data): * faces.c (Fcopy_face): * faces.c (syms_of_faces): * faces.c (vars_of_faces): * faces.c (complex_vars_of_faces): * faces.h (struct Lisp_Face): * faces.h (struct face_cachel): * faces.h (WINDOW_FACE_CACHEL_SHRINK_P): * faces.h (FACE_SHRINK_P): * fontcolor.c (face_boolean_validate): Replace the 'flush property with the opposite 'shrink one. * redisplay.c (create_text_block): * redisplay.c (create_string_text_block): Ditto. Invert the logic for storing a new clear_findex in the display lines.
author Didier Verna <didier@xemacs.org>
date Mon, 26 Dec 2011 15:04:25 +0100
parents 308d34e9f07d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Balloon Help
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (c) 1997 Douglas Keller
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2286
diff changeset
6 XEmacs is free software: you can redistribute it and/or modify it
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2286
diff changeset
8 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2286
diff changeset
9 option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2286
diff changeset
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
21 /* !!#### Needs to be Mule-ized. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 442
diff changeset
22
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 * Balloon Help
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 * Version: 1.337 (Sun Apr 13 04:52:10 1997)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 * Written by Douglas Keller <dkeller@vnet.ibm.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include <string.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include <stdlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include <assert.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include <X11/Xlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include <X11/Xutil.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include <X11/extensions/shape.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 771
diff changeset
43 #include "compiler.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #include "xintrinsic.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #include "balloon_help.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
48 #ifndef max
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #define max(x,y) (x>y?x:y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 #undef bool
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 #define bool int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 #define MARGIN_WIDTH 4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 #define POINTER_OFFSET 8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 #define BORDER_WIDTH 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 #define BORDER_WIDTH_HALF 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 #define CONE_HEIGHT 20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 #define CONE_WIDTH 50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 #define SHAPE_CONE_TOP (1<<0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 #define SHAPE_CONE_LEFT (1<<1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 #define SHAPE_CONE_TOP_LEFT (SHAPE_CONE_TOP | SHAPE_CONE_LEFT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 #define SHAPE_CONE_TOP_RIGHT (SHAPE_CONE_TOP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 #define SHAPE_CONE_BOTTOM_LEFT (SHAPE_CONE_LEFT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 #define SHAPE_CONE_BOTTOM_RIGHT (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 #define SHAPE_CONE_FREE (-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 static Display* b_dpy;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 static XFontStruct* b_fontStruct;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 static GC b_gc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 static GC b_shineGC;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 static GC b_shadowGC;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 static Window b_win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 static bool b_winMapped;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 static Pixmap b_mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 static int b_maskWidth, b_maskHeight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 static GC b_maskGC;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
87 static const char* b_text;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 static int b_width, b_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 static XtIntervalId b_timer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 static unsigned long b_delay;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 static int b_screenWidth, b_screenHeight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 static int b_lastShape;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 /*============================================================================
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 ============================================================================*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 static GC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 create_gc (Display* dpy, Window win, unsigned long fg, unsigned long bg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 XFontStruct* fontStruct)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 XGCValues gcv;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 unsigned long mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 gcv.foreground = fg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 gcv.background = bg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 gcv.font = fontStruct->fid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 gcv.join_style = JoinMiter;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 gcv.line_width = BORDER_WIDTH;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 mask = GCFont | GCBackground | GCForeground | GCJoinStyle | GCLineWidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 return XCreateGC (dpy, win, mask, &gcv);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 destroy_gc (Display* dpy, GC gc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 if (gc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 XFreeGC (dpy, gc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 /*============================================================================
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 ============================================================================*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 static Window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 create_window (Display* dpy, unsigned long bg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 Window win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 XSetWindowAttributes attr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 unsigned long attr_mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 attr_mask = CWOverrideRedirect | CWBackPixel | CWSaveUnder;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 attr.override_redirect = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 attr.background_pixel = bg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 attr.save_under = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 win =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 XCreateWindow (dpy,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 DefaultRootWindow (dpy),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 0, 0, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 CopyFromParent, InputOutput, CopyFromParent,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 attr_mask, &attr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 XSelectInput (dpy, win,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 SubstructureRedirectMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 SubstructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 ExposureMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 EnterWindowMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 LeaveWindowMask);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 return win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 destroy_window (Display* dpy, Window win)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 if (win)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 XDestroyWindow (dpy, win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 /*============================================================================
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 ============================================================================*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 get_pointer_xy (Display* dpy, int* x_return, int* y_return)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 int dummy;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 unsigned int mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 Window dummy_win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 XQueryPointer (dpy, RootWindow(dpy, DefaultScreen(dpy)), &dummy_win, &dummy_win,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 x_return, y_return, &dummy, &dummy, &mask);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 /*============================================================================
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 ============================================================================*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 create_pixmap_mask (int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 b_maskWidth = width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 b_maskHeight = height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 b_mask = XCreatePixmap (b_dpy, b_win, width, height, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 destroy_pixmap_mask(void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 XFreePixmap (b_dpy, b_mask);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 grow_pixmap_mask (int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 if (width > b_maskWidth || height > b_maskHeight)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 destroy_pixmap_mask ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 create_pixmap_mask (width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 /*============================================================================
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 ============================================================================*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
218 text_extent (XFontStruct* fontStruct, const char* text, int len,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 int* width, int* height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 XCharStruct extent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 int dummy;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 XTextExtents (fontStruct, text, len, &dummy, &dummy, &dummy, &extent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 *width = extent.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 *height = fontStruct->ascent + fontStruct->descent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 771
diff changeset
231 get_text_size (Display* UNUSED (dpy), XFontStruct* fontStruct,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 771
diff changeset
232 const char* text, int* max_width, int* max_height)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 int width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 int height;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
236 const char* start;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
237 const char* end;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 *max_width = *max_height = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 start = text;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 while ((end = strchr(start, '\n')))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 text_extent (fontStruct, start, end - start, &width, &height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 *max_width = max (width, *max_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 *max_height += height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 start = end + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 text_extent (fontStruct, start, strlen (start), &width, &height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 *max_width = max (width, *max_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 *max_height += height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 /* Min width */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 *max_width = max (*max_width, CONE_WIDTH / 2 * 3);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 draw_text (Display* dpy, Window win, GC gc, XFontStruct* fontStruct,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
261 int x, int y, const char* text)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
263 const char* start;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
264 const char* end;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 int font_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 y += fontStruct->ascent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 font_height = fontStruct->ascent + fontStruct->descent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 start = text;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 while ((end = strchr(start, '\n')))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 XDrawString (dpy, win, gc, x, y, start, end - start);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 start = end + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 y += font_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 XDrawString (dpy, win, gc, x, y, start, strlen (start));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 /*============================================================================
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 ============================================================================*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 get_shape (int last_shape, int x, int y, int width, int height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 int screen_width, int screen_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 /* Can we use last_shape? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 if (((last_shape == SHAPE_CONE_TOP_LEFT) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 (x + width < screen_width) && (y + height < screen_height)) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 ((last_shape == SHAPE_CONE_TOP_RIGHT) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 (x - width > 0) && (y + height < screen_height)) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 ((last_shape == SHAPE_CONE_BOTTOM_LEFT) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 (x + width < screen_width) && (y - height > 0)) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 ((last_shape == SHAPE_CONE_BOTTOM_RIGHT) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 (x - width > 0) && (y - height > 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 return last_shape;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 /* Try to pick a shape that will not get changed,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 e.g. if top left quadrant, top_left */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 return (x < screen_width / 2) ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 (y < screen_height / 2 ? SHAPE_CONE_TOP_LEFT: SHAPE_CONE_BOTTOM_LEFT) :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 (y < screen_height / 2 ? SHAPE_CONE_TOP_RIGHT: SHAPE_CONE_BOTTOM_RIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 771
diff changeset
309 make_mask (int shape, int UNUSED (x), int UNUSED (y), int width, int height)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 XPoint cone[ 3 ];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 grow_pixmap_mask (width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 /* Clear mask */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 XSetForeground (b_dpy, b_maskGC, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 XFillRectangle (b_dpy, b_mask, b_maskGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 0, 0, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 /* Enable text area */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 XSetForeground (b_dpy, b_maskGC, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 XFillRectangle (b_dpy, b_mask, b_maskGC, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 shape & SHAPE_CONE_TOP ? CONE_HEIGHT : 0, width, height - CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 /* Enable for cone area */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 cone[0].x = (shape & SHAPE_CONE_LEFT) ? CONE_WIDTH / 2 : width - (CONE_WIDTH / 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 cone[0].y = (shape & SHAPE_CONE_TOP) ? CONE_HEIGHT : height - CONE_HEIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 cone[1].x = (shape & SHAPE_CONE_LEFT) ? 0 : width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 cone[1].y = (shape & SHAPE_CONE_TOP) ? 0 : height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 cone[2].x = (shape & SHAPE_CONE_LEFT) ? CONE_WIDTH : width - CONE_WIDTH;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 cone[2].y = (shape & SHAPE_CONE_TOP) ? CONE_HEIGHT : height - CONE_HEIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 XFillPolygon (b_dpy, b_mask, b_maskGC, cone, 3, Nonconvex, CoordModeOrigin);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 771
diff changeset
338 show_help (XtPointer UNUSED (data), XtIntervalId* id)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 int shape;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 XPoint border[ 3 ];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 if (id == NULL || ((id && b_timer) && b_text))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 b_timer = None;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 /* size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 get_text_size (b_dpy, b_fontStruct, b_text, &b_width, &b_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 b_width += 2 * MARGIN_WIDTH + 2 * BORDER_WIDTH;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 b_height += 2 * MARGIN_WIDTH + 2 * BORDER_WIDTH + CONE_HEIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 /* origin */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 get_pointer_xy (b_dpy, &x, &y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 /* guess at shape */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 shape = get_shape(b_lastShape, x, y, b_width, b_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 b_screenWidth, b_screenHeight);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 x += (shape & SHAPE_CONE_LEFT) ? POINTER_OFFSET : -POINTER_OFFSET;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 y += (shape & SHAPE_CONE_TOP) ? POINTER_OFFSET : -POINTER_OFFSET;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 /* make sure it is still ok with offset */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 shape = get_shape (shape, x, y, b_width, b_height, b_screenWidth, b_screenHeight);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 b_lastShape = shape;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 make_mask (shape, x, y, b_width, b_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 XShapeCombineMask (b_dpy, b_win, ShapeBounding, 0, 0, b_mask, ShapeSet);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 XMoveResizeWindow(b_dpy, b_win,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 (shape & SHAPE_CONE_LEFT) ? x : x - b_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 (shape & SHAPE_CONE_TOP) ? y : y - b_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 b_width, b_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 XClearWindow (b_dpy, b_win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 XMapRaised (b_dpy, b_win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 b_winMapped = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 draw_text (b_dpy, b_win, b_gc, b_fontStruct,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 BORDER_WIDTH + MARGIN_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 BORDER_WIDTH + MARGIN_WIDTH + ((shape & SHAPE_CONE_TOP) ? CONE_HEIGHT : 0),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 b_text);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 /* 3d border */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 /* shine- top left */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 border[0].x = 0 + BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 border[0].y = ((shape & SHAPE_CONE_TOP) ? b_height : b_height - CONE_HEIGHT) - BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 border[1].x = 0 + BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 border[1].y = ((shape & SHAPE_CONE_TOP) ? CONE_HEIGHT : 0) + BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 border[2].x = b_width - BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 border[2].y = border[1].y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 XDrawLines (b_dpy, b_win, b_shineGC, border, 3, CoordModeOrigin);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 /* shadow- bottom right */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 border[0].x = 0 + BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 border[0].y = ((shape & SHAPE_CONE_TOP) ? b_height : b_height - CONE_HEIGHT) - BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 border[1].x = b_width - BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 border[1].y = border[0].y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 border[2].x = b_width - BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 border[2].y = ((shape & SHAPE_CONE_TOP) ? CONE_HEIGHT : 0) + BORDER_WIDTH_HALF;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 XDrawLines (b_dpy, b_win, b_shadowGC, border, 3, CoordModeOrigin);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 /* cone */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 if (SHAPE_CONE_TOP_LEFT == shape)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 XClearArea (b_dpy, b_win,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 CONE_WIDTH / 2 + BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 CONE_HEIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 CONE_WIDTH / 2 - BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 BORDER_WIDTH, False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 XDrawLine (b_dpy, b_win, b_shadowGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 CONE_WIDTH / 2 + BORDER_WIDTH_HALF,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 XDrawLine (b_dpy, b_win, b_shineGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 CONE_WIDTH - BORDER_WIDTH_HALF,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 else if (SHAPE_CONE_TOP_RIGHT == shape)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 XClearArea (b_dpy, b_win,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 b_width - CONE_WIDTH + BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 CONE_HEIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 CONE_WIDTH / 2 - BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 BORDER_WIDTH, False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 XDrawLine (b_dpy, b_win, b_shadowGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 b_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 b_width - CONE_WIDTH / 2 - BORDER_WIDTH_HALF,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 XDrawLine (b_dpy, b_win, b_shineGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 b_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 b_width - CONE_WIDTH + BORDER_WIDTH_HALF,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 else if (SHAPE_CONE_BOTTOM_LEFT == shape)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 XClearArea (b_dpy, b_win,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 CONE_WIDTH / 2 + BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 b_height - CONE_HEIGHT - BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 CONE_WIDTH / 2 - BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 BORDER_WIDTH, False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 XDrawLine (b_dpy, b_win, b_shadowGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 b_height - 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 CONE_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 b_height - 1 - CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 XDrawLine (b_dpy, b_win, b_shineGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 b_height - 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 CONE_WIDTH / 2 + BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 b_height - 1 - CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 else if (SHAPE_CONE_BOTTOM_RIGHT == shape)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 XClearArea (b_dpy, b_win,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 b_width - 1 - CONE_WIDTH + BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 b_height - CONE_HEIGHT - BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 CONE_WIDTH / 2 - BORDER_WIDTH - 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 BORDER_WIDTH, False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 XDrawLine (b_dpy, b_win, b_shadowGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 b_width - 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 b_height - 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 b_width - 1 - CONE_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 b_height - 1 - CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 XDrawLine (b_dpy, b_win, b_shineGC,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 b_width - 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 b_height - 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 b_width - 1 - CONE_WIDTH / 2 - BORDER_WIDTH,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 b_height - 1 - CONE_HEIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 /*============================================================================
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 ============================================================================*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 balloon_help_destroy (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 assert (b_dpy != NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 b_dpy = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 destroy_window (b_dpy, b_win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 destroy_gc (b_dpy, b_gc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 destroy_gc (b_dpy, b_shineGC);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 destroy_gc (b_dpy, b_shadowGC);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 destroy_pixmap_mask ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 destroy_gc (b_dpy, b_maskGC);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 if (b_timer) XtRemoveTimeOut (b_timer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 balloon_help_create (Display* dpy,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 Pixel fg, Pixel bg, Pixel shine, Pixel shadow,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 XFontStruct* font)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 if (b_dpy) balloon_help_destroy ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 b_dpy = dpy;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 b_fontStruct = font;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 b_win = create_window (dpy, bg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 b_gc = create_gc (dpy, b_win, fg, bg, b_fontStruct);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 b_shineGC = create_gc (dpy, b_win, shine, bg, b_fontStruct);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 b_shadowGC = create_gc (dpy, b_win, shadow, bg, b_fontStruct);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 create_pixmap_mask (1, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 b_maskGC = create_gc (dpy, b_mask, bg, fg, b_fontStruct);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 b_winMapped = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 b_timer = None;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 b_delay = 500;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 b_screenWidth = DisplayWidth (b_dpy, DefaultScreen(b_dpy));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 b_screenHeight = DisplayHeight (b_dpy, DefaultScreen(b_dpy));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 b_lastShape = SHAPE_CONE_FREE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 balloon_help_set_delay (unsigned long milliseconds)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 b_delay = milliseconds;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
542 balloon_help_show (const char* text)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 assert (b_dpy != NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 /* We don't copy the text */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 b_text = text;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 b_lastShape = SHAPE_CONE_FREE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 if (b_winMapped)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 /* If help is already being shown, don't delay just update */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 show_help (NULL, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 b_timer =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 XtAppAddTimeOut (XtDisplayToApplicationContext(b_dpy),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 b_delay, show_help, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 balloon_help_hide (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 assert (b_dpy != NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 b_text = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 XUnmapWindow (b_dpy, b_win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 b_winMapped = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 if (b_timer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 XtRemoveTimeOut (b_timer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 b_timer = None;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 balloon_help_move_to_pointer (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 assert (b_dpy != NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 if (b_winMapped)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 int shape = b_lastShape;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 get_pointer_xy (b_dpy, &x, &y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 x += (shape & SHAPE_CONE_LEFT) ? POINTER_OFFSET : -POINTER_OFFSET;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 y += (shape & SHAPE_CONE_TOP) ? POINTER_OFFSET : -POINTER_OFFSET;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 shape = get_shape (shape, x, y, b_width, b_height, b_screenWidth, b_screenHeight);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 if (shape == b_lastShape)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 XMoveWindow (b_dpy, b_win,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 shape & SHAPE_CONE_LEFT ? x : x - b_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 shape & SHAPE_CONE_TOP ? y : y - b_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 /* text would be off screen, rebuild with new shape */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 b_lastShape = SHAPE_CONE_FREE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 show_help (NULL, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 }