(x_set_mouse_color): Always unload the old color.

Don't allow nil as color value.
(x_set_cursor_color, x_set_background_color, x_set_foreground_color):
Always unload the old color.
This commit is contained in:
Karl Heuer 1999-07-26 19:09:56 +00:00
parent ec6d44639a
commit 51a1d2d86b

View file

@ -1314,10 +1314,7 @@ x_set_foreground_color (f, arg, oldval)
unsigned long pixel
= x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
if (f->output_data.x->foreground_pixel != f->output_data.x->mouse_pixel
&& f->output_data.x->foreground_pixel != f->output_data.x->cursor_pixel
&& f->output_data.x->foreground_pixel != f->output_data.x->cursor_foreground_pixel)
unload_color (f, f->output_data.x->foreground_pixel);
unload_color (f, f->output_data.x->foreground_pixel);
f->output_data.x->foreground_pixel = pixel;
if (FRAME_X_WINDOW (f) != 0)
@ -1345,10 +1342,7 @@ x_set_background_color (f, arg, oldval)
unsigned long pixel
= x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
if (f->output_data.x->background_pixel != f->output_data.x->mouse_pixel
&& f->output_data.x->background_pixel != f->output_data.x->cursor_pixel
&& f->output_data.x->background_pixel != f->output_data.x->cursor_foreground_pixel)
unload_color (f, f->output_data.x->background_pixel);
unload_color (f, f->output_data.x->background_pixel);
f->output_data.x->background_pixel = pixel;
if (FRAME_X_WINDOW (f) != 0)
@ -1388,23 +1382,15 @@ x_set_mouse_color (f, arg, oldval)
Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
Cursor busy_cursor;
int count;
int mask_color;
unsigned long pixel = f->output_data.x->mouse_pixel;
if (!EQ (Qnil, arg))
pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
unsigned long mask_color = f->output_data.x->background_pixel;
mask_color = f->output_data.x->background_pixel;
/* No invisible pointers. */
/* Don't let pointers be invisible. */
if (mask_color == pixel
&& mask_color == f->output_data.x->background_pixel)
pixel = f->output_data.x->foreground_pixel;
if (f->output_data.x->background_pixel != f->output_data.x->mouse_pixel
&& f->output_data.x->foreground_pixel != f->output_data.x->mouse_pixel
&& f->output_data.x->cursor_pixel != f->output_data.x->mouse_pixel
&& f->output_data.x->cursor_foreground_pixel != f->output_data.x->mouse_pixel)
unload_color (f, f->output_data.x->mouse_pixel);
unload_color (f, f->output_data.x->mouse_pixel);
f->output_data.x->mouse_pixel = pixel;
BLOCK_INPUT;
@ -1544,18 +1530,10 @@ x_set_cursor_color (f, arg, oldval)
fore_pixel = f->output_data.x->background_pixel;
}
if (f->output_data.x->background_pixel != f->output_data.x->cursor_foreground_pixel
&& f->output_data.x->foreground_pixel != f->output_data.x->cursor_foreground_pixel
&& f->output_data.x->mouse_pixel != f->output_data.x->cursor_foreground_pixel
&& f->output_data.x->cursor_pixel != f->output_data.x->cursor_foreground_pixel)
unload_color (f, f->output_data.x->cursor_foreground_pixel);
unload_color (f, f->output_data.x->cursor_foreground_pixel);
f->output_data.x->cursor_foreground_pixel = fore_pixel;
if (f->output_data.x->background_pixel != f->output_data.x->cursor_pixel
&& f->output_data.x->foreground_pixel != f->output_data.x->cursor_pixel
&& f->output_data.x->mouse_pixel != f->output_data.x->cursor_pixel
&& f->output_data.x->cursor_foreground_pixel != f->output_data.x->cursor_pixel)
unload_color (f, f->output_data.x->cursor_pixel);
unload_color (f, f->output_data.x->cursor_pixel);
f->output_data.x->cursor_pixel = pixel;
if (FRAME_X_WINDOW (f) != 0)