comparison src/xfns.c @ 28347:ce7dddf6dfb7

(x_specified_cursor_type): New function. (x_set_cursor_type): Use it.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 27 Mar 2000 11:06:04 +0000
parents 5a0af67169a7
children 11d7a6fdad5f
comparison
equal deleted inserted replaced
28346:9ef17fa48577 28347:ce7dddf6dfb7
1607 if (FRAME_VISIBLE_P (f)) 1607 if (FRAME_VISIBLE_P (f))
1608 redraw_frame (f); 1608 redraw_frame (f);
1609 } 1609 }
1610 } 1610 }
1611 1611
1612
1613 /* Value is the internal representation of the specified cursor type
1614 ARG. If type is BAR_CURSOR, return in *WIDTH the specified width
1615 of the bar cursor. */
1616
1617 enum text_cursor_kinds
1618 x_specified_cursor_type (arg, width)
1619 Lisp_Object arg;
1620 int *width;
1621 {
1622 enum text_cursor_kinds type;
1623
1624 if (EQ (arg, Qbar))
1625 {
1626 type = BAR_CURSOR;
1627 *width = 2;
1628 }
1629 else if (CONSP (arg)
1630 && EQ (XCAR (arg), Qbar)
1631 && INTEGERP (XCDR (arg))
1632 && XINT (XCDR (arg)) >= 0)
1633 {
1634 type = BAR_CURSOR;
1635 *width = XINT (XCDR (arg));
1636 }
1637 else if (NILP (arg))
1638 type = NO_CURSOR;
1639 else
1640 /* Treat anything unknown as "box cursor".
1641 It was bad to signal an error; people have trouble fixing
1642 .Xdefaults with Emacs, when it has something bad in it. */
1643 type = FILLED_BOX_CURSOR;
1644
1645 return type;
1646 }
1647
1612 void 1648 void
1613 x_set_cursor_type (f, arg, oldval) 1649 x_set_cursor_type (f, arg, oldval)
1614 FRAME_PTR f; 1650 FRAME_PTR f;
1615 Lisp_Object arg, oldval; 1651 Lisp_Object arg, oldval;
1616 { 1652 {
1617 if (EQ (arg, Qbar)) 1653 int width;
1618 { 1654
1619 FRAME_DESIRED_CURSOR (f) = BAR_CURSOR; 1655 FRAME_DESIRED_CURSOR (f) = x_specified_cursor_type (arg, &width);
1620 f->output_data.x->cursor_width = 2; 1656 f->output_data.x->cursor_width = width;
1621 }
1622 else if (CONSP (arg)
1623 && EQ (XCAR (arg), Qbar)
1624 && INTEGERP (XCDR (arg))
1625 && XINT (XCDR (arg)) >= 0)
1626 {
1627 FRAME_DESIRED_CURSOR (f) = BAR_CURSOR;
1628 f->output_data.x->cursor_width = XINT (XCDR (arg));
1629 }
1630 else if (NILP (arg))
1631 FRAME_DESIRED_CURSOR (f) = NO_CURSOR;
1632 else
1633 /* Treat anything unknown as "box cursor".
1634 It was bad to signal an error; people have trouble fixing
1635 .Xdefaults with Emacs, when it has something bad in it. */
1636 FRAME_DESIRED_CURSOR (f) = FILLED_BOX_CURSOR;
1637 1657
1638 /* Make sure the cursor gets redrawn. This is overkill, but how 1658 /* Make sure the cursor gets redrawn. This is overkill, but how
1639 often do people change cursor types? */ 1659 often do people change cursor types? */
1640 update_mode_lines++; 1660 update_mode_lines++;
1641 } 1661 }