diff options
| author | Gerd Moellmann | 2001-05-16 17:33:38 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-05-16 17:33:38 +0000 |
| commit | 09393d0728891ffe2fb54c7e1c7be19b583eaa17 (patch) | |
| tree | 5713270515074e3f03009489cb018906740f07cb /src | |
| parent | 460e6bae47b1b320de89c3048a27bee38556d6ab (diff) | |
| download | emacs-09393d0728891ffe2fb54c7e1c7be19b583eaa17.tar.gz emacs-09393d0728891ffe2fb54c7e1c7be19b583eaa17.zip | |
(x_set_foreground_color): Change frame's cursor_pixel
only if its equal to the former foreground pixel color.
(x_set_foreground_color, x_set_background_color)
(x_set_mouse_color, x_set_cursor_color): Cleaned up.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xfns.c | 255 |
2 files changed, 133 insertions, 129 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f0fe97c97a6..bd46fbc6e0a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2001-05-16 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * xfns.c (x_set_foreground_color): Change frame's cursor_pixel | ||
| 4 | only if it's equal to the former foreground pixel color. | ||
| 5 | (x_set_foreground_color, x_set_background_color) | ||
| 6 | (x_set_mouse_color, x_set_cursor_color): Cleaned up. | ||
| 7 | |||
| 1 | 2001-05-16 Dave Love <fx@gnu.org> | 8 | 2001-05-16 Dave Love <fx@gnu.org> |
| 2 | 9 | ||
| 3 | * insdel.c (signal_before_change, signal_after_change): Consider a | 10 | * insdel.c (signal_before_change, signal_after_change): Consider a |
diff --git a/src/xfns.c b/src/xfns.c index 52fe0c23dff..485a2f9b4c7 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1346,30 +1346,37 @@ x_set_foreground_color (f, arg, oldval) | |||
| 1346 | struct frame *f; | 1346 | struct frame *f; |
| 1347 | Lisp_Object arg, oldval; | 1347 | Lisp_Object arg, oldval; |
| 1348 | { | 1348 | { |
| 1349 | unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1349 | struct x_output *x = f->output_data.x; |
| 1350 | unsigned long fg, old_fg; | ||
| 1350 | 1351 | ||
| 1351 | unload_color (f, f->output_data.x->foreground_pixel); | 1352 | fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
| 1352 | f->output_data.x->foreground_pixel = pixel; | 1353 | old_fg = x->foreground_pixel; |
| 1354 | x->foreground_pixel = fg; | ||
| 1353 | 1355 | ||
| 1354 | if (FRAME_X_WINDOW (f) != 0) | 1356 | if (FRAME_X_WINDOW (f) != 0) |
| 1355 | { | 1357 | { |
| 1356 | BLOCK_INPUT; | 1358 | Display *dpy = FRAME_X_DISPLAY (f); |
| 1357 | XSetForeground (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc, | ||
| 1358 | f->output_data.x->foreground_pixel); | ||
| 1359 | XSetBackground (FRAME_X_DISPLAY (f), f->output_data.x->reverse_gc, | ||
| 1360 | f->output_data.x->foreground_pixel); | ||
| 1361 | 1359 | ||
| 1362 | XSetBackground (FRAME_X_DISPLAY (f), f->output_data.x->cursor_gc, | 1360 | BLOCK_INPUT; |
| 1363 | f->output_data.x->foreground_pixel); | 1361 | XSetForeground (dpy, x->normal_gc, fg); |
| 1364 | unload_color (f, f->output_data.x->cursor_pixel); | 1362 | XSetBackground (dpy, x->reverse_gc, fg); |
| 1365 | f->output_data.x->cursor_pixel | ||
| 1366 | = x_copy_color (f, f->output_data.x->foreground_pixel); | ||
| 1367 | 1363 | ||
| 1364 | if (x->cursor_pixel == old_fg) | ||
| 1365 | { | ||
| 1366 | unload_color (f, x->cursor_pixel); | ||
| 1367 | x->cursor_pixel = x_copy_color (f, fg); | ||
| 1368 | XSetBackground (dpy, x->cursor_gc, x->cursor_pixel); | ||
| 1369 | } | ||
| 1370 | |||
| 1368 | UNBLOCK_INPUT; | 1371 | UNBLOCK_INPUT; |
| 1372 | |||
| 1369 | update_face_from_frame_parameter (f, Qforeground_color, arg); | 1373 | update_face_from_frame_parameter (f, Qforeground_color, arg); |
| 1374 | |||
| 1370 | if (FRAME_VISIBLE_P (f)) | 1375 | if (FRAME_VISIBLE_P (f)) |
| 1371 | redraw_frame (f); | 1376 | redraw_frame (f); |
| 1372 | } | 1377 | } |
| 1378 | |||
| 1379 | unload_color (f, old_fg); | ||
| 1373 | } | 1380 | } |
| 1374 | 1381 | ||
| 1375 | void | 1382 | void |
| @@ -1377,34 +1384,33 @@ x_set_background_color (f, arg, oldval) | |||
| 1377 | struct frame *f; | 1384 | struct frame *f; |
| 1378 | Lisp_Object arg, oldval; | 1385 | Lisp_Object arg, oldval; |
| 1379 | { | 1386 | { |
| 1380 | unsigned long pixel = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); | 1387 | struct x_output *x = f->output_data.x; |
| 1388 | unsigned long bg; | ||
| 1381 | 1389 | ||
| 1382 | unload_color (f, f->output_data.x->background_pixel); | 1390 | bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); |
| 1383 | f->output_data.x->background_pixel = pixel; | 1391 | unload_color (f, x->background_pixel); |
| 1392 | x->background_pixel = bg; | ||
| 1384 | 1393 | ||
| 1385 | if (FRAME_X_WINDOW (f) != 0) | 1394 | if (FRAME_X_WINDOW (f) != 0) |
| 1386 | { | 1395 | { |
| 1387 | BLOCK_INPUT; | 1396 | Display *dpy = FRAME_X_DISPLAY (f); |
| 1388 | /* The main frame area. */ | 1397 | Lisp_Object bar; |
| 1389 | XSetBackground (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc, | ||
| 1390 | f->output_data.x->background_pixel); | ||
| 1391 | XSetForeground (FRAME_X_DISPLAY (f), f->output_data.x->reverse_gc, | ||
| 1392 | f->output_data.x->background_pixel); | ||
| 1393 | XSetForeground (FRAME_X_DISPLAY (f), f->output_data.x->cursor_gc, | ||
| 1394 | f->output_data.x->background_pixel); | ||
| 1395 | 1398 | ||
| 1396 | XSetWindowBackground (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 1399 | BLOCK_INPUT; |
| 1397 | f->output_data.x->background_pixel); | 1400 | XSetBackground (dpy, x->normal_gc, bg); |
| 1398 | { | 1401 | XSetForeground (dpy, x->reverse_gc, bg); |
| 1399 | Lisp_Object bar; | 1402 | XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg); |
| 1400 | for (bar = FRAME_SCROLL_BARS (f); !NILP (bar); | 1403 | XSetForeground (dpy, x->cursor_gc, bg); |
| 1401 | bar = XSCROLL_BAR (bar)->next) | 1404 | |
| 1402 | XSetWindowBackground (FRAME_X_DISPLAY (f), | 1405 | for (bar = FRAME_SCROLL_BARS (f); |
| 1403 | SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)), | 1406 | !NILP (bar); |
| 1404 | f->output_data.x->background_pixel); | 1407 | bar = XSCROLL_BAR (bar)->next) |
| 1405 | } | 1408 | { |
| 1406 | UNBLOCK_INPUT; | 1409 | Window window = SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)); |
| 1410 | XSetWindowBackground (dpy, window, bg); | ||
| 1411 | } | ||
| 1407 | 1412 | ||
| 1413 | UNBLOCK_INPUT; | ||
| 1408 | update_face_from_frame_parameter (f, Qbackground_color, arg); | 1414 | update_face_from_frame_parameter (f, Qbackground_color, arg); |
| 1409 | 1415 | ||
| 1410 | if (FRAME_VISIBLE_P (f)) | 1416 | if (FRAME_VISIBLE_P (f)) |
| @@ -1417,149 +1423,141 @@ x_set_mouse_color (f, arg, oldval) | |||
| 1417 | struct frame *f; | 1423 | struct frame *f; |
| 1418 | Lisp_Object arg, oldval; | 1424 | Lisp_Object arg, oldval; |
| 1419 | { | 1425 | { |
| 1426 | struct x_output *x = f->output_data.x; | ||
| 1427 | Display *dpy = FRAME_X_DISPLAY (f); | ||
| 1420 | Cursor cursor, nontext_cursor, mode_cursor, cross_cursor; | 1428 | Cursor cursor, nontext_cursor, mode_cursor, cross_cursor; |
| 1421 | Cursor hourglass_cursor, horizontal_drag_cursor; | 1429 | Cursor hourglass_cursor, horizontal_drag_cursor; |
| 1422 | int count; | 1430 | int count; |
| 1423 | unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1431 | unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
| 1424 | unsigned long mask_color = f->output_data.x->background_pixel; | 1432 | unsigned long mask_color = x->background_pixel; |
| 1425 | 1433 | ||
| 1426 | /* Don't let pointers be invisible. */ | 1434 | /* Don't let pointers be invisible. */ |
| 1427 | if (mask_color == pixel | 1435 | if (mask_color == pixel) |
| 1428 | && mask_color == f->output_data.x->background_pixel) | ||
| 1429 | { | 1436 | { |
| 1430 | x_free_colors (f, &pixel, 1); | 1437 | x_free_colors (f, &pixel, 1); |
| 1431 | pixel = x_copy_color (f, f->output_data.x->foreground_pixel); | 1438 | pixel = x_copy_color (f, x->foreground_pixel); |
| 1432 | } | 1439 | } |
| 1433 | 1440 | ||
| 1434 | unload_color (f, f->output_data.x->mouse_pixel); | 1441 | unload_color (f, x->mouse_pixel); |
| 1435 | f->output_data.x->mouse_pixel = pixel; | 1442 | x->mouse_pixel = pixel; |
| 1436 | 1443 | ||
| 1437 | BLOCK_INPUT; | 1444 | BLOCK_INPUT; |
| 1438 | 1445 | ||
| 1439 | /* It's not okay to crash if the user selects a screwy cursor. */ | 1446 | /* It's not okay to crash if the user selects a screwy cursor. */ |
| 1440 | count = x_catch_errors (FRAME_X_DISPLAY (f)); | 1447 | count = x_catch_errors (dpy); |
| 1441 | 1448 | ||
| 1442 | if (!EQ (Qnil, Vx_pointer_shape)) | 1449 | if (!NILP (Vx_pointer_shape)) |
| 1443 | { | 1450 | { |
| 1444 | CHECK_NUMBER (Vx_pointer_shape, 0); | 1451 | CHECK_NUMBER (Vx_pointer_shape, 0); |
| 1445 | cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), XINT (Vx_pointer_shape)); | 1452 | cursor = XCreateFontCursor (dpy, XINT (Vx_pointer_shape)); |
| 1446 | } | 1453 | } |
| 1447 | else | 1454 | else |
| 1448 | cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_xterm); | 1455 | cursor = XCreateFontCursor (dpy, XC_xterm); |
| 1449 | x_check_errors (FRAME_X_DISPLAY (f), "bad text pointer cursor: %s"); | 1456 | x_check_errors (dpy, "bad text pointer cursor: %s"); |
| 1450 | 1457 | ||
| 1451 | if (!EQ (Qnil, Vx_nontext_pointer_shape)) | 1458 | if (!NILP (Vx_nontext_pointer_shape)) |
| 1452 | { | 1459 | { |
| 1453 | CHECK_NUMBER (Vx_nontext_pointer_shape, 0); | 1460 | CHECK_NUMBER (Vx_nontext_pointer_shape, 0); |
| 1454 | nontext_cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), | 1461 | nontext_cursor |
| 1455 | XINT (Vx_nontext_pointer_shape)); | 1462 | = XCreateFontCursor (dpy, XINT (Vx_nontext_pointer_shape)); |
| 1456 | } | 1463 | } |
| 1457 | else | 1464 | else |
| 1458 | nontext_cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_left_ptr); | 1465 | nontext_cursor = XCreateFontCursor (dpy, XC_left_ptr); |
| 1459 | x_check_errors (FRAME_X_DISPLAY (f), "bad nontext pointer cursor: %s"); | 1466 | x_check_errors (dpy, "bad nontext pointer cursor: %s"); |
| 1460 | 1467 | ||
| 1461 | if (!EQ (Qnil, Vx_hourglass_pointer_shape)) | 1468 | if (!NILP (Vx_hourglass_pointer_shape)) |
| 1462 | { | 1469 | { |
| 1463 | CHECK_NUMBER (Vx_hourglass_pointer_shape, 0); | 1470 | CHECK_NUMBER (Vx_hourglass_pointer_shape, 0); |
| 1464 | hourglass_cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), | 1471 | hourglass_cursor |
| 1465 | XINT (Vx_hourglass_pointer_shape)); | 1472 | = XCreateFontCursor (dpy, XINT (Vx_hourglass_pointer_shape)); |
| 1466 | } | 1473 | } |
| 1467 | else | 1474 | else |
| 1468 | hourglass_cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_watch); | 1475 | hourglass_cursor = XCreateFontCursor (dpy, XC_watch); |
| 1469 | x_check_errors (FRAME_X_DISPLAY (f), "bad hourglass pointer cursor: %s"); | 1476 | x_check_errors (dpy, "bad hourglass pointer cursor: %s"); |
| 1470 | 1477 | ||
| 1471 | x_check_errors (FRAME_X_DISPLAY (f), "bad nontext pointer cursor: %s"); | 1478 | x_check_errors (dpy, "bad nontext pointer cursor: %s"); |
| 1472 | if (!EQ (Qnil, Vx_mode_pointer_shape)) | 1479 | if (!NILP (Vx_mode_pointer_shape)) |
| 1473 | { | 1480 | { |
| 1474 | CHECK_NUMBER (Vx_mode_pointer_shape, 0); | 1481 | CHECK_NUMBER (Vx_mode_pointer_shape, 0); |
| 1475 | mode_cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), | 1482 | mode_cursor = XCreateFontCursor (dpy, XINT (Vx_mode_pointer_shape)); |
| 1476 | XINT (Vx_mode_pointer_shape)); | ||
| 1477 | } | 1483 | } |
| 1478 | else | 1484 | else |
| 1479 | mode_cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_xterm); | 1485 | mode_cursor = XCreateFontCursor (dpy, XC_xterm); |
| 1480 | x_check_errors (FRAME_X_DISPLAY (f), "bad modeline pointer cursor: %s"); | 1486 | x_check_errors (dpy, "bad modeline pointer cursor: %s"); |
| 1481 | 1487 | ||
| 1482 | if (!EQ (Qnil, Vx_sensitive_text_pointer_shape)) | 1488 | if (!NILP (Vx_sensitive_text_pointer_shape)) |
| 1483 | { | 1489 | { |
| 1484 | CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0); | 1490 | CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0); |
| 1485 | cross_cursor | 1491 | cross_cursor |
| 1486 | = XCreateFontCursor (FRAME_X_DISPLAY (f), | 1492 | = XCreateFontCursor (dpy, XINT (Vx_sensitive_text_pointer_shape)); |
| 1487 | XINT (Vx_sensitive_text_pointer_shape)); | ||
| 1488 | } | 1493 | } |
| 1489 | else | 1494 | else |
| 1490 | cross_cursor = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_crosshair); | 1495 | cross_cursor = XCreateFontCursor (dpy, XC_crosshair); |
| 1491 | 1496 | ||
| 1492 | if (!NILP (Vx_window_horizontal_drag_shape)) | 1497 | if (!NILP (Vx_window_horizontal_drag_shape)) |
| 1493 | { | 1498 | { |
| 1494 | CHECK_NUMBER (Vx_window_horizontal_drag_shape, 0); | 1499 | CHECK_NUMBER (Vx_window_horizontal_drag_shape, 0); |
| 1495 | horizontal_drag_cursor | 1500 | horizontal_drag_cursor |
| 1496 | = XCreateFontCursor (FRAME_X_DISPLAY (f), | 1501 | = XCreateFontCursor (dpy, XINT (Vx_window_horizontal_drag_shape)); |
| 1497 | XINT (Vx_window_horizontal_drag_shape)); | ||
| 1498 | } | 1502 | } |
| 1499 | else | 1503 | else |
| 1500 | horizontal_drag_cursor | 1504 | horizontal_drag_cursor |
| 1501 | = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_sb_h_double_arrow); | 1505 | = XCreateFontCursor (dpy, XC_sb_h_double_arrow); |
| 1502 | 1506 | ||
| 1503 | /* Check and report errors with the above calls. */ | 1507 | /* Check and report errors with the above calls. */ |
| 1504 | x_check_errors (FRAME_X_DISPLAY (f), "can't set cursor shape: %s"); | 1508 | x_check_errors (dpy, "can't set cursor shape: %s"); |
| 1505 | x_uncatch_errors (FRAME_X_DISPLAY (f), count); | 1509 | x_uncatch_errors (dpy, count); |
| 1506 | 1510 | ||
| 1507 | { | 1511 | { |
| 1508 | XColor fore_color, back_color; | 1512 | XColor fore_color, back_color; |
| 1509 | 1513 | ||
| 1510 | fore_color.pixel = f->output_data.x->mouse_pixel; | 1514 | fore_color.pixel = x->mouse_pixel; |
| 1511 | x_query_color (f, &fore_color); | 1515 | x_query_color (f, &fore_color); |
| 1512 | back_color.pixel = mask_color; | 1516 | back_color.pixel = mask_color; |
| 1513 | x_query_color (f, &back_color); | 1517 | x_query_color (f, &back_color); |
| 1514 | 1518 | ||
| 1515 | XRecolorCursor (FRAME_X_DISPLAY (f), cursor, | 1519 | XRecolorCursor (dpy, cursor, &fore_color, &back_color); |
| 1516 | &fore_color, &back_color); | 1520 | XRecolorCursor (dpy, nontext_cursor, &fore_color, &back_color); |
| 1517 | XRecolorCursor (FRAME_X_DISPLAY (f), nontext_cursor, | 1521 | XRecolorCursor (dpy, mode_cursor, &fore_color, &back_color); |
| 1518 | &fore_color, &back_color); | 1522 | XRecolorCursor (dpy, cross_cursor, &fore_color, &back_color); |
| 1519 | XRecolorCursor (FRAME_X_DISPLAY (f), mode_cursor, | 1523 | XRecolorCursor (dpy, hourglass_cursor, &fore_color, &back_color); |
| 1520 | &fore_color, &back_color); | 1524 | XRecolorCursor (dpy, horizontal_drag_cursor, &fore_color, &back_color); |
| 1521 | XRecolorCursor (FRAME_X_DISPLAY (f), cross_cursor, | ||
| 1522 | &fore_color, &back_color); | ||
| 1523 | XRecolorCursor (FRAME_X_DISPLAY (f), hourglass_cursor, | ||
| 1524 | &fore_color, &back_color); | ||
| 1525 | XRecolorCursor (FRAME_X_DISPLAY (f), horizontal_drag_cursor, | ||
| 1526 | &fore_color, &back_color); | ||
| 1527 | } | 1525 | } |
| 1528 | 1526 | ||
| 1529 | if (FRAME_X_WINDOW (f) != 0) | 1527 | if (FRAME_X_WINDOW (f) != 0) |
| 1530 | XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); | 1528 | XDefineCursor (dpy, FRAME_X_WINDOW (f), cursor); |
| 1531 | 1529 | ||
| 1532 | if (cursor != f->output_data.x->text_cursor | 1530 | if (cursor != x->text_cursor |
| 1533 | && f->output_data.x->text_cursor != 0) | 1531 | && x->text_cursor != 0) |
| 1534 | XFreeCursor (FRAME_X_DISPLAY (f), f->output_data.x->text_cursor); | 1532 | XFreeCursor (dpy, x->text_cursor); |
| 1535 | f->output_data.x->text_cursor = cursor; | 1533 | x->text_cursor = cursor; |
| 1536 | 1534 | ||
| 1537 | if (nontext_cursor != f->output_data.x->nontext_cursor | 1535 | if (nontext_cursor != x->nontext_cursor |
| 1538 | && f->output_data.x->nontext_cursor != 0) | 1536 | && x->nontext_cursor != 0) |
| 1539 | XFreeCursor (FRAME_X_DISPLAY (f), f->output_data.x->nontext_cursor); | 1537 | XFreeCursor (dpy, x->nontext_cursor); |
| 1540 | f->output_data.x->nontext_cursor = nontext_cursor; | 1538 | x->nontext_cursor = nontext_cursor; |
| 1541 | 1539 | ||
| 1542 | if (hourglass_cursor != f->output_data.x->hourglass_cursor | 1540 | if (hourglass_cursor != x->hourglass_cursor |
| 1543 | && f->output_data.x->hourglass_cursor != 0) | 1541 | && x->hourglass_cursor != 0) |
| 1544 | XFreeCursor (FRAME_X_DISPLAY (f), f->output_data.x->hourglass_cursor); | 1542 | XFreeCursor (dpy, x->hourglass_cursor); |
| 1545 | f->output_data.x->hourglass_cursor = hourglass_cursor; | 1543 | x->hourglass_cursor = hourglass_cursor; |
| 1546 | 1544 | ||
| 1547 | if (mode_cursor != f->output_data.x->modeline_cursor | 1545 | if (mode_cursor != x->modeline_cursor |
| 1548 | && f->output_data.x->modeline_cursor != 0) | 1546 | && x->modeline_cursor != 0) |
| 1549 | XFreeCursor (FRAME_X_DISPLAY (f), f->output_data.x->modeline_cursor); | 1547 | XFreeCursor (dpy, f->output_data.x->modeline_cursor); |
| 1550 | f->output_data.x->modeline_cursor = mode_cursor; | 1548 | x->modeline_cursor = mode_cursor; |
| 1551 | 1549 | ||
| 1552 | if (cross_cursor != f->output_data.x->cross_cursor | 1550 | if (cross_cursor != x->cross_cursor |
| 1553 | && f->output_data.x->cross_cursor != 0) | 1551 | && x->cross_cursor != 0) |
| 1554 | XFreeCursor (FRAME_X_DISPLAY (f), f->output_data.x->cross_cursor); | 1552 | XFreeCursor (dpy, x->cross_cursor); |
| 1555 | f->output_data.x->cross_cursor = cross_cursor; | 1553 | x->cross_cursor = cross_cursor; |
| 1556 | 1554 | ||
| 1557 | if (horizontal_drag_cursor != f->output_data.x->horizontal_drag_cursor | 1555 | if (horizontal_drag_cursor != x->horizontal_drag_cursor |
| 1558 | && f->output_data.x->horizontal_drag_cursor != 0) | 1556 | && x->horizontal_drag_cursor != 0) |
| 1559 | XFreeCursor (FRAME_X_DISPLAY (f), f->output_data.x->horizontal_drag_cursor); | 1557 | XFreeCursor (dpy, x->horizontal_drag_cursor); |
| 1560 | f->output_data.x->horizontal_drag_cursor = horizontal_drag_cursor; | 1558 | x->horizontal_drag_cursor = horizontal_drag_cursor; |
| 1561 | 1559 | ||
| 1562 | XFlush (FRAME_X_DISPLAY (f)); | 1560 | XFlush (dpy); |
| 1563 | UNBLOCK_INPUT; | 1561 | UNBLOCK_INPUT; |
| 1564 | 1562 | ||
| 1565 | update_face_from_frame_parameter (f, Qmouse_color, arg); | 1563 | update_face_from_frame_parameter (f, Qmouse_color, arg); |
| @@ -1572,6 +1570,7 @@ x_set_cursor_color (f, arg, oldval) | |||
| 1572 | { | 1570 | { |
| 1573 | unsigned long fore_pixel, pixel; | 1571 | unsigned long fore_pixel, pixel; |
| 1574 | int fore_pixel_allocated_p = 0, pixel_allocated_p = 0; | 1572 | int fore_pixel_allocated_p = 0, pixel_allocated_p = 0; |
| 1573 | struct x_output *x = f->output_data.x; | ||
| 1575 | 1574 | ||
| 1576 | if (!NILP (Vx_cursor_fore_pixel)) | 1575 | if (!NILP (Vx_cursor_fore_pixel)) |
| 1577 | { | 1576 | { |
| @@ -1580,13 +1579,13 @@ x_set_cursor_color (f, arg, oldval) | |||
| 1580 | fore_pixel_allocated_p = 1; | 1579 | fore_pixel_allocated_p = 1; |
| 1581 | } | 1580 | } |
| 1582 | else | 1581 | else |
| 1583 | fore_pixel = f->output_data.x->background_pixel; | 1582 | fore_pixel = x->background_pixel; |
| 1584 | 1583 | ||
| 1585 | pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1584 | pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
| 1586 | pixel_allocated_p = 1; | 1585 | pixel_allocated_p = 1; |
| 1587 | 1586 | ||
| 1588 | /* Make sure that the cursor color differs from the background color. */ | 1587 | /* Make sure that the cursor color differs from the background color. */ |
| 1589 | if (pixel == f->output_data.x->background_pixel) | 1588 | if (pixel == x->background_pixel) |
| 1590 | { | 1589 | { |
| 1591 | if (pixel_allocated_p) | 1590 | if (pixel_allocated_p) |
| 1592 | { | 1591 | { |
| @@ -1594,7 +1593,7 @@ x_set_cursor_color (f, arg, oldval) | |||
| 1594 | pixel_allocated_p = 0; | 1593 | pixel_allocated_p = 0; |
| 1595 | } | 1594 | } |
| 1596 | 1595 | ||
| 1597 | pixel = f->output_data.x->mouse_pixel; | 1596 | pixel = x->mouse_pixel; |
| 1598 | if (pixel == fore_pixel) | 1597 | if (pixel == fore_pixel) |
| 1599 | { | 1598 | { |
| 1600 | if (fore_pixel_allocated_p) | 1599 | if (fore_pixel_allocated_p) |
| @@ -1602,27 +1601,25 @@ x_set_cursor_color (f, arg, oldval) | |||
| 1602 | x_free_colors (f, &fore_pixel, 1); | 1601 | x_free_colors (f, &fore_pixel, 1); |
| 1603 | fore_pixel_allocated_p = 0; | 1602 | fore_pixel_allocated_p = 0; |
| 1604 | } | 1603 | } |
| 1605 | fore_pixel = f->output_data.x->background_pixel; | 1604 | fore_pixel = x->background_pixel; |
| 1606 | } | 1605 | } |
| 1607 | } | 1606 | } |
| 1608 | 1607 | ||
| 1609 | unload_color (f, f->output_data.x->cursor_foreground_pixel); | 1608 | unload_color (f, x->cursor_foreground_pixel); |
| 1610 | if (!fore_pixel_allocated_p) | 1609 | if (!fore_pixel_allocated_p) |
| 1611 | fore_pixel = x_copy_color (f, fore_pixel); | 1610 | fore_pixel = x_copy_color (f, fore_pixel); |
| 1612 | f->output_data.x->cursor_foreground_pixel = fore_pixel; | 1611 | x->cursor_foreground_pixel = fore_pixel; |
| 1613 | 1612 | ||
| 1614 | unload_color (f, f->output_data.x->cursor_pixel); | 1613 | unload_color (f, x->cursor_pixel); |
| 1615 | if (!pixel_allocated_p) | 1614 | if (!pixel_allocated_p) |
| 1616 | pixel = x_copy_color (f, pixel); | 1615 | pixel = x_copy_color (f, pixel); |
| 1617 | f->output_data.x->cursor_pixel = pixel; | 1616 | x->cursor_pixel = pixel; |
| 1618 | 1617 | ||
| 1619 | if (FRAME_X_WINDOW (f) != 0) | 1618 | if (FRAME_X_WINDOW (f) != 0) |
| 1620 | { | 1619 | { |
| 1621 | BLOCK_INPUT; | 1620 | BLOCK_INPUT; |
| 1622 | XSetBackground (FRAME_X_DISPLAY (f), f->output_data.x->cursor_gc, | 1621 | XSetBackground (FRAME_X_DISPLAY (f), x->cursor_gc, x->cursor_pixel); |
| 1623 | f->output_data.x->cursor_pixel); | 1622 | XSetForeground (FRAME_X_DISPLAY (f), x->cursor_gc, fore_pixel); |
| 1624 | XSetForeground (FRAME_X_DISPLAY (f), f->output_data.x->cursor_gc, | ||
| 1625 | fore_pixel); | ||
| 1626 | UNBLOCK_INPUT; | 1623 | UNBLOCK_INPUT; |
| 1627 | 1624 | ||
| 1628 | if (FRAME_VISIBLE_P (f)) | 1625 | if (FRAME_VISIBLE_P (f)) |