comparison src/balloon_help.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents de805c49cfc1
children
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
42 42
43 #include "xintrinsic.h" 43 #include "xintrinsic.h"
44 44
45 #include "balloon_help.h" 45 #include "balloon_help.h"
46 46
47 #ifndef max 47 #ifndef WINDOWSNT
48 #define max(x,y) (x>y?x:y) 48 #define max(x,y) (x>y?x:y)
49 #endif 49 #endif
50 50
51 #undef bool 51 #undef bool
52 #define bool int 52 #define bool int
81 81
82 static Pixmap b_mask; 82 static Pixmap b_mask;
83 static int b_maskWidth, b_maskHeight; 83 static int b_maskWidth, b_maskHeight;
84 static GC b_maskGC; 84 static GC b_maskGC;
85 85
86 static const char* b_text; 86 static CONST char* b_text;
87 static int b_width, b_height; 87 static int b_width, b_height;
88 88
89 static XtIntervalId b_timer; 89 static XtIntervalId b_timer;
90 static unsigned long b_delay; 90 static unsigned long b_delay;
91 91
212 /*============================================================================ 212 /*============================================================================
213 213
214 ============================================================================*/ 214 ============================================================================*/
215 215
216 static void 216 static void
217 text_extent (XFontStruct* fontStruct, const char* text, int len, 217 text_extent (XFontStruct* fontStruct, CONST char* text, int len,
218 int* width, int* height) 218 int* width, int* height)
219 { 219 {
220 XCharStruct extent; 220 XCharStruct extent;
221 int dummy; 221 int dummy;
222 222
225 *width = extent.width; 225 *width = extent.width;
226 *height = fontStruct->ascent + fontStruct->descent; 226 *height = fontStruct->ascent + fontStruct->descent;
227 } 227 }
228 228
229 static void 229 static void
230 get_text_size (Display* dpy, XFontStruct* fontStruct, const char* text, 230 get_text_size (Display* dpy, XFontStruct* fontStruct, CONST char* text,
231 int* max_width, int* max_height) 231 int* max_width, int* max_height)
232 { 232 {
233 int width; 233 int width;
234 int height; 234 int height;
235 const char* start; 235 CONST char* start;
236 const char* end; 236 CONST char* end;
237 237
238 *max_width = *max_height = 0; 238 *max_width = *max_height = 0;
239 239
240 start = text; 240 start = text;
241 while ((end = strchr(start, '\n'))) 241 while ((end = strchr(start, '\n')))
255 255
256 } 256 }
257 257
258 static void 258 static void
259 draw_text (Display* dpy, Window win, GC gc, XFontStruct* fontStruct, 259 draw_text (Display* dpy, Window win, GC gc, XFontStruct* fontStruct,
260 int x, int y, const char* text) 260 int x, int y, CONST char* text)
261 { 261 {
262 const char* start; 262 CONST char* start;
263 const char* end; 263 CONST char* end;
264 int font_height; 264 int font_height;
265 265
266 y += fontStruct->ascent; 266 y += fontStruct->ascent;
267 267
268 font_height = fontStruct->ascent + fontStruct->descent; 268 font_height = fontStruct->ascent + fontStruct->descent;
536 { 536 {
537 b_delay = milliseconds; 537 b_delay = milliseconds;
538 } 538 }
539 539
540 void 540 void
541 balloon_help_show (const char* text) 541 balloon_help_show (CONST char* text)
542 { 542 {
543 assert (b_dpy != NULL); 543 assert (b_dpy != NULL);
544 544
545 /* We don't copy the text */ 545 /* We don't copy the text */
546 b_text = text; 546 b_text = text;