comparison src/gui_xmebw.c @ 161:6df0106fc595

updated for version 7.0049
author vimboss
date Mon, 07 Feb 2005 22:01:03 +0000
parents 78423945b251
children 23f82b5d2814
comparison
equal deleted inserted replaced
160:7c0820eed232 161:6df0106fc595
290 int scr; 290 int scr;
291 Display *dpy = XtDisplay(eb); 291 Display *dpy = XtDisplay(eb);
292 int x; 292 int x;
293 int y; 293 int y;
294 unsigned int height, width, border, depth; 294 unsigned int height, width, border, depth;
295 int status; 295 int status = 0;
296 Pixmap mask; 296 Pixmap mask;
297 Pixmap pix = None; 297 Pixmap pix = None;
298 Pixmap arm_pix = None; 298 Pixmap arm_pix = None;
299 Pixmap ins_pix = None; 299 Pixmap ins_pix = None;
300 Pixmap high_pix = None; 300 Pixmap high_pix = None;
301 char **data = (char **) eb->enhancedbutton.pixmap_data; 301 char **data = (char **) eb->enhancedbutton.pixmap_data;
302 char *fname = (char *) eb->enhancedbutton.pixmap_file;
302 int shift; 303 int shift;
303 GC gc; 304 GC gc;
304 305
305 /* Make sure there is a default value for the pixmap. 306 /* Make sure there is a default value for the pixmap.
306 */ 307 */
311 312
312 scr = DefaultScreen(dpy); 313 scr = DefaultScreen(dpy);
313 root = RootWindow(dpy, scr); 314 root = RootWindow(dpy, scr);
314 315
315 eb->label.pixmap = None; 316 eb->label.pixmap = None;
317
316 eb->enhancedbutton.pixmap_depth = 0; 318 eb->enhancedbutton.pixmap_depth = 0;
317 eb->enhancedbutton.pixmap_width = 0; 319 eb->enhancedbutton.pixmap_width = 0;
318 eb->enhancedbutton.pixmap_height = 0; 320 eb->enhancedbutton.pixmap_height = 0;
319 eb->enhancedbutton.normal_pixmap = None; 321 eb->enhancedbutton.normal_pixmap = None;
320 eb->enhancedbutton.armed_pixmap = None; 322 eb->enhancedbutton.armed_pixmap = None;
321 eb->enhancedbutton.highlight_pixmap = None; 323 eb->enhancedbutton.highlight_pixmap = None;
322 eb->enhancedbutton.insensitive_pixmap = None; 324 eb->enhancedbutton.insensitive_pixmap = None;
325
326 /* We use dynamic colors, get them now. */
327 motif_get_toolbar_colors(
328 &eb->core.background_pixel,
329 &eb->primitive.foreground,
330 &eb->primitive.bottom_shadow_color,
331 &eb->primitive.top_shadow_color,
332 &eb->primitive.highlight_color);
323 333
324 /* Setup color subsititution table. */ 334 /* Setup color subsititution table. */
325 color[0].pixel = eb->core.background_pixel; 335 color[0].pixel = eb->core.background_pixel;
326 color[1].pixel = eb->core.background_pixel; 336 color[1].pixel = eb->core.background_pixel;
327 color[2].pixel = eb->core.background_pixel; 337 color[2].pixel = eb->core.background_pixel;
335 attr.valuemask = XpmColorSymbols | XpmCloseness; 345 attr.valuemask = XpmColorSymbols | XpmCloseness;
336 attr.closeness = 65535; /* accuracy isn't crucial */ 346 attr.closeness = 65535; /* accuracy isn't crucial */
337 attr.colorsymbols = color; 347 attr.colorsymbols = color;
338 attr.numsymbols = XtNumber(color); 348 attr.numsymbols = XtNumber(color);
339 349
340 status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr); 350 if (fname)
341 351 status = XpmReadFileToPixmap(dpy, root, fname, &pix, &mask, &attr);
342 /* If somethin failed, we will fill in the default pixmap. */ 352 if (!fname || status != XpmSuccess)
353 status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr);
354
355 /* If something failed, we will fill in the default pixmap. */
343 if (status != XpmSuccess) 356 if (status != XpmSuccess)
344 status = XpmCreatePixmapFromData(dpy, root, blank_xpm, &pix, 357 status = XpmCreatePixmapFromData(dpy, root, blank_xpm, &pix,
345 &mask, &attr); 358 &mask, &attr);
346 359
347 XpmFreeAttributes(&attr); 360 XpmFreeAttributes(&attr);