annotate src/balloon_help.c @ 329:58bac07dfa74 r21-0-62

Import from CVS: tag r21-0-62
author cvs
date Mon, 13 Aug 2007 10:48:41 +0200
parents c5d627a313b1
children 8626e4521993
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 <stdio.h>
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
36 #include <stdlib.h>
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 int b_lastX, b_lastY;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
90
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
91 static XtIntervalId b_timer;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
92 static unsigned long b_delay;
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_screenWidth, b_screenHeight;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
95
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
96 static int b_lastShape;
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
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
100 ============================================================================*/
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
101
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
102 static GC
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
103 create_gc (Display* dpy, Window win, unsigned long fg, unsigned long bg,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
104 XFontStruct* fontStruct)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
105 {
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
106 XGCValues gcv;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
107 unsigned long mask;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
108
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
109 gcv.foreground = fg;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
110 gcv.background = bg;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
111 gcv.font = fontStruct->fid;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
112 gcv.join_style = JoinMiter;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
113 gcv.line_width = BORDER_WIDTH;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
114
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
115 mask = GCFont | GCBackground | GCForeground | GCJoinStyle | GCLineWidth;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
116
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
117 return XCreateGC (dpy, win, mask, &gcv);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
118 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
119
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
120 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
121 destroy_gc (Display* dpy, GC gc)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
122 {
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
123 if (gc)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
124 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
125 XFreeGC (dpy, gc);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
126 }
134
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
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
131 ============================================================================*/
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
132
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
133 static Window
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
134 create_window (Display* dpy, unsigned long bg)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
135 {
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
136 Window win;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
137 XSetWindowAttributes attr;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
138 unsigned long attr_mask;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
139
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
140 attr_mask = CWOverrideRedirect | CWBackPixel | CWSaveUnder;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
141 attr.override_redirect = True;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
142 attr.background_pixel = bg;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
143 attr.save_under = True;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
144
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
145 win =
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
146 XCreateWindow (dpy,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
147 DefaultRootWindow (dpy),
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
148 0, 0, 1, 1,
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
149 0,
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
150 CopyFromParent, InputOutput, CopyFromParent,
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
151 attr_mask, &attr);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
152
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
153 XSelectInput (dpy, win,
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
154 SubstructureRedirectMask |
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
155 SubstructureNotifyMask |
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
156 ExposureMask |
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
157 EnterWindowMask |
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
158 LeaveWindowMask);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
159 return win;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
160 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
161
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
162 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
163 destroy_window (Display* dpy, Window win)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
164 {
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
165 if (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 XDestroyWindow (dpy, win);
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 ============================================================================*/
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
174
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
175 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
176 get_pointer_xy (Display* dpy, int* x_return, int* y_return)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
177 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
178 int dummy;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
179 unsigned int mask;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
180 Window dummy_win;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
181
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
182 XQueryPointer (dpy, RootWindow(dpy, DefaultScreen(dpy)), &dummy_win, &dummy_win,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
183 x_return, y_return, &dummy, &dummy, &mask);
134
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
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
188 ============================================================================*/
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
189
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
190 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
191 create_pixmap_mask (int width, int height)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
192 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
193 b_maskWidth = width;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
194 b_maskHeight = height;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
195 b_mask = XCreatePixmap (b_dpy, b_win, width, height, 1);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
196 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
197
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
198 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
199 destroy_pixmap_mask(void)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
200 {
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
201 XFreePixmap (b_dpy, b_mask);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
202 }
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
203
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
204 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
205 grow_pixmap_mask (int width, int height)
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 if (width > b_maskWidth || height > b_maskHeight)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
208 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
209 destroy_pixmap_mask ();
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
210 create_pixmap_mask (width, height);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
211 }
134
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
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
216 ============================================================================*/
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
217
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
218 static void
203
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 169
diff changeset
219 text_extent (XFontStruct* fontStruct, CONST char* text, int len,
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
220 int* width, int* height)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
221 {
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
222 XCharStruct extent;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
223 int dummy;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
224
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
225 XTextExtents (fontStruct, text, len, &dummy, &dummy, &dummy, &extent);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
226
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
227 *width = extent.width;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
228 *height = fontStruct->ascent + fontStruct->descent;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
229 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
230
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
231 static void
203
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 169
diff changeset
232 get_text_size (Display* dpy, XFontStruct* fontStruct, CONST char* text,
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
233 int* max_width, int* max_height)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
234 {
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
235 int width;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
236 int height;
203
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 169
diff changeset
237 CONST char* start;
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 169
diff changeset
238 CONST char* end;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
239
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
240 *max_width = *max_height = 0;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
241
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
242 start = text;
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
243 while ((end = strchr(start, '\n')))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
244 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
245 text_extent (fontStruct, start, end - start, &width, &height);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
246 *max_width = max (width, *max_width);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
247 *max_height += height;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
248
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
249 start = end + 1;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
250 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
251 text_extent (fontStruct, start, strlen (start), &width, &height);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
252 *max_width = max (width, *max_width);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
253 *max_height += height;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
254
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
255 /* Min width */
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
256 *max_width = max (*max_width, CONE_WIDTH / 2 * 3);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
257
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
258 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
259
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
260 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
261 draw_text (Display* dpy, Window win, GC gc, XFontStruct* fontStruct,
203
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 169
diff changeset
262 int x, int y, CONST char* text)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
263 {
203
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 169
diff changeset
264 CONST char* start;
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 169
diff changeset
265 CONST char* end;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
266 int font_height;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
267
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
268 y += fontStruct->ascent;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
269
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
270 font_height = fontStruct->ascent + fontStruct->descent;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
271
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
272 start = text;
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
273 while ((end = strchr(start, '\n')))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
274 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
275 XDrawString (dpy, win, gc, x, y, start, end - start);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
276
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
277 start = end + 1;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
278 y += font_height;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
279 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
280 XDrawString (dpy, win, gc, x, y, start, strlen (start));
134
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
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
285 ============================================================================*/
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
286
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
287 static int
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
288 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
289 int screen_width, int screen_height)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
290 {
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
291 /* Can we use last_shape? */
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
292 if (((last_shape == SHAPE_CONE_TOP_LEFT) &&
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
293 (x + width < screen_width) && (y + height < screen_height)) ||
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
294 ((last_shape == SHAPE_CONE_TOP_RIGHT) &&
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
295 (x - width > 0) && (y + height < screen_height)) ||
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
296 ((last_shape == SHAPE_CONE_BOTTOM_LEFT) &&
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
297 (x + width < screen_width) && (y - height > 0)) ||
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
298 ((last_shape == SHAPE_CONE_BOTTOM_RIGHT) &&
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
299 (x - width > 0) && (y - height > 0)))
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
300 return last_shape;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
301
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
302 /* Try to pick a shape that will not get changed,
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
303 e.g. if top left quadrant, top_left */
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
304 return (x < screen_width / 2) ?
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
305 (y < screen_height / 2 ? SHAPE_CONE_TOP_LEFT: SHAPE_CONE_BOTTOM_LEFT) :
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 155
diff changeset
306 (y < screen_height / 2 ? SHAPE_CONE_TOP_RIGHT: SHAPE_CONE_BOTTOM_RIGHT);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
307 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
308
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
309 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
310 make_mask (int shape, int x, int y, int width, int height)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
311 {
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
312 XPoint cone[ 3 ];
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
313
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
314 grow_pixmap_mask (width, height);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
315
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
316 /* Clear mask */
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
317 XSetForeground (b_dpy, b_maskGC, 0);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
318 XFillRectangle (b_dpy, b_mask, b_maskGC,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
319 0, 0, width, height);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
320
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
321 /* Enable text area */
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
322 XSetForeground (b_dpy, b_maskGC, 1);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
323 XFillRectangle (b_dpy, b_mask, b_maskGC, 0,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
324 shape & SHAPE_CONE_TOP ? CONE_HEIGHT : 0, width, height - CONE_HEIGHT);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
325
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
326 /* Enable for cone area */
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
327 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
328 cone[0].y = (shape & SHAPE_CONE_TOP) ? CONE_HEIGHT : height - CONE_HEIGHT;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
329 cone[1].x = (shape & SHAPE_CONE_LEFT) ? 0 : width;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
330 cone[1].y = (shape & SHAPE_CONE_TOP) ? 0 : height;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
331 cone[2].x = (shape & SHAPE_CONE_LEFT) ? CONE_WIDTH : width - CONE_WIDTH;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
332 cone[2].y = (shape & SHAPE_CONE_TOP) ? CONE_HEIGHT : height - CONE_HEIGHT;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
333
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
334 XFillPolygon (b_dpy, b_mask, b_maskGC, cone, 3, Nonconvex, CoordModeOrigin);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
335
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
336 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
337
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
338 static void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
339 show_help (XtPointer data, XtIntervalId* id)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
340 {
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
341 int x, y;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
342 int shape;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
343 XPoint border[ 3 ];
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
344
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 157
diff changeset
345 if (id == NULL || ((id && b_timer) && b_text))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
346 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
347 b_timer = None;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
348
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
349 /* size */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
350 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
351 b_width += 2 * MARGIN_WIDTH + 2 * BORDER_WIDTH;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
352 b_height += 2 * MARGIN_WIDTH + 2 * BORDER_WIDTH + CONE_HEIGHT;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
353
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
354 /* origin */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
355 get_pointer_xy (b_dpy, &x, &y);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
356
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
357 /* guess at shape */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
358 shape = get_shape(b_lastShape, x, y, b_width, b_height,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
359 b_screenWidth, b_screenHeight);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
360
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
361 x += (shape & SHAPE_CONE_LEFT) ? POINTER_OFFSET : -POINTER_OFFSET;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
362 y += (shape & SHAPE_CONE_TOP) ? POINTER_OFFSET : -POINTER_OFFSET;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
363
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
364 /* make sure it is still ok with offset */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
365 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
366
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
367 b_lastX = x;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
368 b_lastY = y;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
369 b_lastShape = shape;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
370
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
371
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
372 make_mask (shape, x, y, b_width, b_height);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
373
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
374 XShapeCombineMask (b_dpy, b_win, ShapeBounding, 0, 0, b_mask, ShapeSet);
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 XMoveResizeWindow(b_dpy, b_win,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
377 (shape & SHAPE_CONE_LEFT) ? x : x - b_width,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
378 (shape & SHAPE_CONE_TOP) ? y : y - b_height,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
379 b_width, b_height);
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 XClearWindow (b_dpy, b_win);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
382
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
383 XMapRaised (b_dpy, b_win);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
384 b_winMapped = True;
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 draw_text (b_dpy, b_win, b_gc, b_fontStruct,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
387 BORDER_WIDTH + MARGIN_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
388 BORDER_WIDTH + MARGIN_WIDTH + ((shape & SHAPE_CONE_TOP) ? CONE_HEIGHT : 0),
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
389 b_text);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
390
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
391 /* 3d border */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
392 /* shine- top left */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
393 border[0].x = 0 + BORDER_WIDTH_HALF;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
394 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
395 border[1].x = 0 + BORDER_WIDTH_HALF;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
396 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
397 border[2].x = b_width - BORDER_WIDTH_HALF;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
398 border[2].y = border[1].y;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
399 XDrawLines (b_dpy, b_win, b_shineGC, border, 3, CoordModeOrigin);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
400
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
401 /* shadow- bottom right */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
402 border[0].x = 0 + BORDER_WIDTH_HALF;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
403 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
404 border[1].x = b_width - BORDER_WIDTH_HALF;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
405 border[1].y = border[0].y;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
406 border[2].x = b_width - BORDER_WIDTH_HALF;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
407 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
408 XDrawLines (b_dpy, b_win, b_shadowGC, border, 3, CoordModeOrigin);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
409
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
410 /* cone */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
411 if (SHAPE_CONE_TOP_LEFT == shape)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
412 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
413 XClearArea (b_dpy, b_win,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
414 CONE_WIDTH / 2 + BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
415 CONE_HEIGHT,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
416 CONE_WIDTH / 2 - BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
417 BORDER_WIDTH, False);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
418 XDrawLine (b_dpy, b_win, b_shadowGC,
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 / 2 + 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 XDrawLine (b_dpy, b_win, b_shineGC,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
424 0,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
425 0,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
426 CONE_WIDTH - BORDER_WIDTH_HALF,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
427 CONE_HEIGHT);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
428 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
429 else if (SHAPE_CONE_TOP_RIGHT == shape)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
430 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
431 XClearArea (b_dpy, b_win,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
432 b_width - CONE_WIDTH + BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
433 CONE_HEIGHT,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
434 CONE_WIDTH / 2 - BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
435 BORDER_WIDTH, False);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
436 XDrawLine (b_dpy, b_win, b_shadowGC,
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 / 2 - 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 XDrawLine (b_dpy, b_win, b_shineGC,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
442 b_width,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
443 0,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
444 b_width - CONE_WIDTH + BORDER_WIDTH_HALF,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
445 CONE_HEIGHT);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
446 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
447 else if (SHAPE_CONE_BOTTOM_LEFT == shape)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
448 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
449 XClearArea (b_dpy, b_win,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
450 CONE_WIDTH / 2 + BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
451 b_height - CONE_HEIGHT - BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
452 CONE_WIDTH / 2 - BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
453 BORDER_WIDTH, False);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
454 XDrawLine (b_dpy, b_win, b_shadowGC,
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,
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 XDrawLine (b_dpy, b_win, b_shineGC,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
460 0,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
461 b_height - 1,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
462 CONE_WIDTH / 2 + BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
463 b_height - 1 - CONE_HEIGHT);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
464 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
465 else if (SHAPE_CONE_BOTTOM_RIGHT == shape)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
466 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
467 XClearArea (b_dpy, b_win,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
468 b_width - 1 - CONE_WIDTH + BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
469 b_height - CONE_HEIGHT - BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
470 CONE_WIDTH / 2 - BORDER_WIDTH - 1,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
471 BORDER_WIDTH, False);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
472 XDrawLine (b_dpy, b_win, b_shadowGC,
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,
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 XDrawLine (b_dpy, b_win, b_shineGC,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
478 b_width - 1,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
479 b_height - 1,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
480 b_width - 1 - CONE_WIDTH / 2 - BORDER_WIDTH,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
481 b_height - 1 - CONE_HEIGHT);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
482 }
134
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 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
486
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
487 /*============================================================================
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
488
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
489 ============================================================================*/
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
490
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
491 static void
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
492 balloon_help_destroy (void)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
493 {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
494 assert (b_dpy != NULL);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
495 b_dpy = NULL;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
496
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
497 destroy_window (b_dpy, b_win);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
498 destroy_gc (b_dpy, b_gc);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
499
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
500 destroy_gc (b_dpy, b_shineGC);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
501 destroy_gc (b_dpy, b_shadowGC);
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 destroy_pixmap_mask ();
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
504 destroy_gc (b_dpy, b_maskGC);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
505
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
506 if (b_timer) XtRemoveTimeOut (b_timer);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
507 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
508
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
509 void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
510 balloon_help_create (Display* dpy,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
511 Pixel fg, Pixel bg, Pixel shine, Pixel shadow,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
512 XFontStruct* font)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
513 {
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
514 if (b_dpy) balloon_help_destroy ();
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
515
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
516 b_dpy = dpy;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
517
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
518 b_fontStruct = font;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
519
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
520 b_win = create_window (dpy, bg);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
521 b_gc = create_gc (dpy, b_win, fg, bg, b_fontStruct);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
522
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
523 b_shineGC = create_gc (dpy, b_win, shine, bg, b_fontStruct);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
524 b_shadowGC = create_gc (dpy, b_win, shadow, bg, b_fontStruct);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
525
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
526 create_pixmap_mask (1, 1);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
527 b_maskGC = create_gc (dpy, b_mask, bg, fg, b_fontStruct);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
528
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
529 b_winMapped = False;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
530 b_timer = None;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
531 b_delay = 500;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
532
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
533 b_screenWidth = DisplayWidth (b_dpy, DefaultScreen(b_dpy));
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
534 b_screenHeight = DisplayHeight (b_dpy, DefaultScreen(b_dpy));
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
535
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
536 b_lastShape = SHAPE_CONE_FREE;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
537 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
538
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
539 void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
540 balloon_help_set_delay (unsigned long milliseconds)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
541 {
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
542 b_delay = milliseconds;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
543 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
544
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
545 void
203
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 169
diff changeset
546 balloon_help_show (CONST char* text)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
547 {
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
548 assert (b_dpy != NULL);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
549
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
550 /* We don't copy the text */
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
551 b_text = text;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
552 b_lastShape = SHAPE_CONE_FREE;
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
553
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
554 if (b_winMapped)
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 /* If help is already being shown, don't delay just update */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
557 show_help (NULL, NULL);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
558 }
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
559 else
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
560 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
561 b_timer =
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
562 XtAppAddTimeOut (XtDisplayToApplicationContext(b_dpy),
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
563 b_delay, show_help, NULL);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
564 }
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
565 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
566
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
567 void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
568 balloon_help_hide (void)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
569 {
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
570 assert (b_dpy != NULL);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
571
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
572 b_text = NULL;
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
573 XUnmapWindow (b_dpy, b_win);
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
574 b_winMapped = False;
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
575 if (b_timer)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
576 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
577 XtRemoveTimeOut (b_timer);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
578 b_timer = None;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
579 }
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
580 }
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 void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
583 balloon_help_move_to_pointer (void)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
584 {
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
585 assert (b_dpy != NULL);
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 if (b_winMapped)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
588 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
589 int x, y;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
590 int shape = b_lastShape;
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 get_pointer_xy (b_dpy, &x, &y);
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 x += (shape & SHAPE_CONE_LEFT) ? POINTER_OFFSET : -POINTER_OFFSET;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
595 y += (shape & SHAPE_CONE_TOP) ? POINTER_OFFSET : -POINTER_OFFSET;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
596
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
597 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
598
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
599 if (shape == b_lastShape)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
600 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
601 b_lastX = x;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
602 b_lastY = y;
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
603
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
604 XMoveWindow (b_dpy, b_win,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
605 shape & SHAPE_CONE_LEFT ? x : x - b_width,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
606 shape & SHAPE_CONE_TOP ? y : y - b_height);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
607 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
608 else
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
609 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
610 /* text would be off screen, rebuild with new shape */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
611 b_lastShape = SHAPE_CONE_FREE;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
612 show_help (NULL, NULL);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 134
diff changeset
613 }
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
614 }
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents:
diff changeset
615 }