diff options
| author | Richard M. Stallman | 1998-04-26 22:36:29 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-04-26 22:36:29 +0000 |
| commit | a76206dcc37bf420bded365c02e89a2192422154 (patch) | |
| tree | eb75ed640eea0228609a8faa699a717288b8594e /src | |
| parent | 74c1de234c1a1952a693098083bab5a84312d32c (diff) | |
| download | emacs-a76206dcc37bf420bded365c02e89a2192422154.tar.gz emacs-a76206dcc37bf420bded365c02e89a2192422154.zip | |
(x_set_foreground_color, x_set_background_color)
(x_set_mouse_color, x_set_cursor_color): Don't call unload_color
if same pixel is used in another slot in the frame.
(x_set_foreground_color): Call unload_color on the old color.
(x_set_background_color, x_set_mouse_color): Likewise.
(x_set_cursor_color, x_set_border_pixel): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/src/xfns.c b/src/xfns.c index 68a0e631048..4f4e26fac1c 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1203,8 +1203,15 @@ x_set_foreground_color (f, arg, oldval) | |||
| 1203 | struct frame *f; | 1203 | struct frame *f; |
| 1204 | Lisp_Object arg, oldval; | 1204 | Lisp_Object arg, oldval; |
| 1205 | { | 1205 | { |
| 1206 | f->output_data.x->foreground_pixel | 1206 | unsigned long pixel |
| 1207 | = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1207 | = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
| 1208 | |||
| 1209 | if (f->output_data.x->foreground_pixel != f->output_data.x->mouse_pixel | ||
| 1210 | && f->output_data.x->foreground_pixel != f->output_data.x->cursor_pixel | ||
| 1211 | && f->output_data.x->foreground_pixel != f->output_data.x->cursor_foreground_pixel) | ||
| 1212 | unload_color (f, f->output_data.x->foreground_pixel); | ||
| 1213 | f->output_data.x->foreground_pixel = pixel; | ||
| 1214 | |||
| 1208 | if (FRAME_X_WINDOW (f) != 0) | 1215 | if (FRAME_X_WINDOW (f) != 0) |
| 1209 | { | 1216 | { |
| 1210 | BLOCK_INPUT; | 1217 | BLOCK_INPUT; |
| @@ -1227,9 +1234,15 @@ x_set_background_color (f, arg, oldval) | |||
| 1227 | Pixmap temp; | 1234 | Pixmap temp; |
| 1228 | int mask; | 1235 | int mask; |
| 1229 | 1236 | ||
| 1230 | f->output_data.x->background_pixel | 1237 | unsigned long pixel |
| 1231 | = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); | 1238 | = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); |
| 1232 | 1239 | ||
| 1240 | if (f->output_data.x->background_pixel != f->output_data.x->mouse_pixel | ||
| 1241 | && f->output_data.x->background_pixel != f->output_data.x->cursor_pixel | ||
| 1242 | && f->output_data.x->background_pixel != f->output_data.x->cursor_foreground_pixel) | ||
| 1243 | unload_color (f, f->output_data.x->background_pixel); | ||
| 1244 | f->output_data.x->background_pixel = pixel; | ||
| 1245 | |||
| 1233 | if (FRAME_X_WINDOW (f) != 0) | 1246 | if (FRAME_X_WINDOW (f) != 0) |
| 1234 | { | 1247 | { |
| 1235 | BLOCK_INPUT; | 1248 | BLOCK_INPUT; |
| @@ -1267,15 +1280,23 @@ x_set_mouse_color (f, arg, oldval) | |||
| 1267 | Cursor cursor, nontext_cursor, mode_cursor, cross_cursor; | 1280 | Cursor cursor, nontext_cursor, mode_cursor, cross_cursor; |
| 1268 | int count; | 1281 | int count; |
| 1269 | int mask_color; | 1282 | int mask_color; |
| 1270 | 1283 | unsigned long pixel = f->output_data.x->mouse_pixel; | |
| 1284 | |||
| 1271 | if (!EQ (Qnil, arg)) | 1285 | if (!EQ (Qnil, arg)) |
| 1272 | f->output_data.x->mouse_pixel | 1286 | pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
| 1273 | = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1287 | |
| 1274 | mask_color = f->output_data.x->background_pixel; | 1288 | mask_color = f->output_data.x->background_pixel; |
| 1275 | /* No invisible pointers. */ | 1289 | /* No invisible pointers. */ |
| 1276 | if (mask_color == f->output_data.x->mouse_pixel | 1290 | if (mask_color == pixel |
| 1277 | && mask_color == f->output_data.x->background_pixel) | 1291 | && mask_color == f->output_data.x->background_pixel) |
| 1278 | f->output_data.x->mouse_pixel = f->output_data.x->foreground_pixel; | 1292 | pixel = f->output_data.x->foreground_pixel; |
| 1293 | |||
| 1294 | if (f->output_data.x->background_pixel != f->output_data.x->mouse_pixel | ||
| 1295 | && f->output_data.x->foreground_pixel != f->output_data.x->mouse_pixel | ||
| 1296 | && f->output_data.x->cursor_pixel != f->output_data.x->mouse_pixel | ||
| 1297 | && f->output_data.x->cursor_foreground_pixel != f->output_data.x->mouse_pixel) | ||
| 1298 | unload_color (f, f->output_data.x->mouse_pixel); | ||
| 1299 | f->output_data.x->mouse_pixel = pixel; | ||
| 1279 | 1300 | ||
| 1280 | BLOCK_INPUT; | 1301 | BLOCK_INPUT; |
| 1281 | 1302 | ||
| @@ -1380,24 +1401,37 @@ x_set_cursor_color (f, arg, oldval) | |||
| 1380 | struct frame *f; | 1401 | struct frame *f; |
| 1381 | Lisp_Object arg, oldval; | 1402 | Lisp_Object arg, oldval; |
| 1382 | { | 1403 | { |
| 1383 | unsigned long fore_pixel; | 1404 | unsigned long fore_pixel, pixel; |
| 1384 | 1405 | ||
| 1385 | if (!EQ (Vx_cursor_fore_pixel, Qnil)) | 1406 | if (!EQ (Vx_cursor_fore_pixel, Qnil)) |
| 1386 | fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, | 1407 | fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, |
| 1387 | WHITE_PIX_DEFAULT (f)); | 1408 | WHITE_PIX_DEFAULT (f)); |
| 1388 | else | 1409 | else |
| 1389 | fore_pixel = f->output_data.x->background_pixel; | 1410 | fore_pixel = f->output_data.x->background_pixel; |
| 1390 | f->output_data.x->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1411 | pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
| 1391 | 1412 | ||
| 1392 | /* Make sure that the cursor color differs from the background color. */ | 1413 | /* Make sure that the cursor color differs from the background color. */ |
| 1393 | if (f->output_data.x->cursor_pixel == f->output_data.x->background_pixel) | 1414 | if (pixel == f->output_data.x->background_pixel) |
| 1394 | { | 1415 | { |
| 1395 | f->output_data.x->cursor_pixel = f->output_data.x->mouse_pixel; | 1416 | pixel = f->output_data.x->mouse_pixel; |
| 1396 | if (f->output_data.x->cursor_pixel == fore_pixel) | 1417 | if (pixel == fore_pixel) |
| 1397 | fore_pixel = f->output_data.x->background_pixel; | 1418 | fore_pixel = f->output_data.x->background_pixel; |
| 1398 | } | 1419 | } |
| 1420 | |||
| 1421 | if (f->output_data.x->background_pixel != f->output_data.x->cursor_foreground_pixel | ||
| 1422 | && f->output_data.x->foreground_pixel != f->output_data.x->cursor_foreground_pixel | ||
| 1423 | && f->output_data.x->mouse_pixel != f->output_data.x->cursor_foreground_pixel | ||
| 1424 | && f->output_data.x->cursor_pixel != f->output_data.x->cursor_foreground_pixel) | ||
| 1425 | unload_color (f, f->output_data.x->cursor_foreground_pixel); | ||
| 1399 | f->output_data.x->cursor_foreground_pixel = fore_pixel; | 1426 | f->output_data.x->cursor_foreground_pixel = fore_pixel; |
| 1400 | 1427 | ||
| 1428 | if (f->output_data.x->background_pixel != f->output_data.x->cursor_pixel | ||
| 1429 | && f->output_data.x->foreground_pixel != f->output_data.x->cursor_pixel | ||
| 1430 | && f->output_data.x->mouse_pixel != f->output_data.x->cursor_pixel | ||
| 1431 | && f->output_data.x->cursor_foreground_pixel != f->output_data.x->cursor_pixel) | ||
| 1432 | unload_color (f, f->output_data.x->cursor_pixel); | ||
| 1433 | f->output_data.x->cursor_pixel = pixel; | ||
| 1434 | |||
| 1401 | if (FRAME_X_WINDOW (f) != 0) | 1435 | if (FRAME_X_WINDOW (f) != 0) |
| 1402 | { | 1436 | { |
| 1403 | BLOCK_INPUT; | 1437 | BLOCK_INPUT; |
| @@ -1451,6 +1485,7 @@ x_set_border_pixel (f, pix) | |||
| 1451 | struct frame *f; | 1485 | struct frame *f; |
| 1452 | int pix; | 1486 | int pix; |
| 1453 | { | 1487 | { |
| 1488 | unload_color (f, f->output_data.x->border_pixel); | ||
| 1454 | f->output_data.x->border_pixel = pix; | 1489 | f->output_data.x->border_pixel = pix; |
| 1455 | 1490 | ||
| 1456 | if (FRAME_X_WINDOW (f) != 0 && f->output_data.x->border_width > 0) | 1491 | if (FRAME_X_WINDOW (f) != 0 && f->output_data.x->border_width > 0) |