diff options
| author | Gerd Moellmann | 2000-03-27 14:50:47 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-03-27 14:50:47 +0000 |
| commit | d9c545daed804dea4c79782e5249ef79269f4517 (patch) | |
| tree | 737ad572f087b2a7cb81c2be85d5e6de0c84921b /src/xterm.c | |
| parent | 10168ebbc5f4f1bad0711de93c5c2a329701ad62 (diff) | |
| download | emacs-d9c545daed804dea4c79782e5249ef79269f4517.tar.gz emacs-d9c545daed804dea4c79782e5249ef79269f4517.zip | |
(x_copy_color): New function.
(x_alloc_nearest_color) [DEBUG_X_COLORS]: Call register_color.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c index a49171aab6d..216c633a584 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3207,10 +3207,38 @@ x_alloc_nearest_color (f, cmap, color) | |||
| 3207 | rc = XAllocColor (display, cmap, color); | 3207 | rc = XAllocColor (display, cmap, color); |
| 3208 | } | 3208 | } |
| 3209 | 3209 | ||
| 3210 | #ifdef DEBUG_X_COLORS | ||
| 3211 | if (rc) | ||
| 3212 | register_color (color->pixel); | ||
| 3213 | #endif /* DEBUG_X_COLORS */ | ||
| 3214 | |||
| 3210 | return rc; | 3215 | return rc; |
| 3211 | } | 3216 | } |
| 3212 | 3217 | ||
| 3213 | 3218 | ||
| 3219 | /* Allocate color PIXEL on frame F. PIXEL must already be allocated. | ||
| 3220 | It's necessary to do this instead of just using PIXEL directly to | ||
| 3221 | get color reference counts right. */ | ||
| 3222 | |||
| 3223 | unsigned long | ||
| 3224 | x_copy_color (f, pixel) | ||
| 3225 | struct frame *f; | ||
| 3226 | unsigned long pixel; | ||
| 3227 | { | ||
| 3228 | XColor color; | ||
| 3229 | |||
| 3230 | color.pixel = pixel; | ||
| 3231 | BLOCK_INPUT; | ||
| 3232 | XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); | ||
| 3233 | XAllocColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); | ||
| 3234 | UNBLOCK_INPUT; | ||
| 3235 | #ifdef DEBUG_X_COLORS | ||
| 3236 | register_color (pixel); | ||
| 3237 | #endif | ||
| 3238 | return color.pixel; | ||
| 3239 | } | ||
| 3240 | |||
| 3241 | |||
| 3214 | /* Allocate a color which is lighter or darker than *PIXEL by FACTOR | 3242 | /* Allocate a color which is lighter or darker than *PIXEL by FACTOR |
| 3215 | or DELTA. Try a color with RGB values multiplied by FACTOR first. | 3243 | or DELTA. Try a color with RGB values multiplied by FACTOR first. |
| 3216 | If this produces the same color as PIXEL, try a color where all RGB | 3244 | If this produces the same color as PIXEL, try a color where all RGB |