annotate src/balloon_help.c @ 396:6719134a07c2 r21-2-13

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