| version 1.21 | | version 1.22 |
|---|
| | |
| char *rcsid_x11_xutil_c = | | char *rcsid_x11_xutil_c = |
| "$Id: xutil.c,v 1.21 2005/08/31 21:57:23 akirschbaum Exp $"; | | "$Id: xutil.c,v 1.22 2006/01/31 14:22:28 cavesomething Exp $"; |
| /* | | /* |
| Crossfire client, a client program for the crossfire program. | | Crossfire client, a client program for the crossfire program. |
| | | |
| | |
| "DodgerBlue", /* 5 */ | | "DodgerBlue", /* 5 */ |
| "DarkOrange2", /* 6 */ | | "DarkOrange2", /* 6 */ |
| "SeaGreen", /* 7 */ | | "SeaGreen", /* 7 */ |
| "DarkSeaGreen", /* 8 */ /* Used for window background color */ | | "DarkSeaGreen", /* 8 */ |
| "Grey50", /* 9 */ | | "Grey80", /* 9 */ /* Used for window background color */ |
| "Sienna", /* 10 */ | | "Sienna", /* 10 */ |
| "Gold", /* 11 */ | | "Gold", /* 11 */ |
| "Khaki" /* 12 */ | | "Khaki" /* 12 */ |
| | |
| /*#define CHECKSUM_DEBUG*/ | | /*#define CHECKSUM_DEBUG*/ |
| | | |
| | | |
| int allocate_colors(Display *disp, Window w, long screen_num, | | void allocate_colors(Display *disp, Window w, long screen_num, |
| Colormap *colormap, XColor discolor[16]) | | Colormap *colormap, XColor discolor[16]) { |
| { | | int i, tried = 0, depth=0; |
| int i, tried = 0, depth=0, iscolor; | | |
| Status status; | | Status status; |
| Visual *vis; | | Visual *vis; |
| XColor exactcolor; | | XColor exactcolor; |
| | | |
| iscolor = 1; | | |
| vis = DefaultVisual(disp,screen_num); | | vis = DefaultVisual(disp,screen_num); |
| if (vis->class >= StaticColor) { | | if (vis->class >= StaticColor) { |
| *colormap = DefaultColormap(disp,screen_num); | | *colormap = DefaultColormap(disp,screen_num); |
| | |
| } | | } |
| else { | | else { |
| *colormap = DefaultColormap(disp,screen_num); | | *colormap = DefaultColormap(disp,screen_num); |
| printf("Switching to black and white.\n"); | | |
| printf("You have a black and white terminal.\n"); | | printf("You have a black and white terminal.\n"); |
| return 0; | | printf("These are no longer supported by cfclient.\n"); |
| | | return; |
| } | | } |
| try_private: | | try_private: |
| if (depth > 3 && iscolor) { | | if (depth > 3) { |
| unsigned long pixels[13]; | | unsigned long pixels[13]; |
| for (i=0; i<13; i++){ | | for (i=0; i<13; i++){ |
| status = XLookupColor(disp,*colormap, colorname[i],&exactcolor, | | status = XLookupColor(disp,*colormap, colorname[i],&exactcolor, |
| &discolor[i]); | | &discolor[i]); |
| if (!status){ | | if (!status){ |
| printf("Can't find colour %s.\n", colorname[i]); | | printf("Can't find colour %s.\n", colorname[i]); |
| printf("Switching to black and white.\n"); | | |
| iscolor = 0; | | |
| break; | | break; |
| } | | } |
| status = XAllocColor(disp,*colormap,&discolor[i]); | | status = XAllocColor(disp,*colormap,&discolor[i]); |
| | |
| XSetWindowColormap(disp, w, *colormap); | | XSetWindowColormap(disp, w, *colormap); |
| tried = 1; | | tried = 1; |
| goto try_private; | | goto try_private; |
| } else { | | } else break; |
| printf( "Failed. Switching to black and white.\n"); | | |
| iscolor = 0; | | |
| break; | | |
| } | | |
| } | | } |
| pixels[i] = discolor[i].pixel; | | pixels[i] = discolor[i].pixel; |
| } | | } |
| } | | } |
| return iscolor; | | |
| } | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| /* Updates the keys array with the keybinding that is passed. All the | | /* Updates the keys array with the keybinding that is passed. All the |
| * arguments are pretty self explanatory. flags is the various state | | * arguments are pretty self explanatory. flags is the various state |
| * that the keyboard is in. | | * that the keyboard is in. |