comparison src/xfns.c @ 6759:e0938c42218c

(syms_of_xfns): Define Vx_cross_pointer_shape. (Vx_cross_pointer_shape): New variable. (Vx_cross_pointer_shape): Create a mouse face cursor for the mouse-face properties.
author Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
date Fri, 08 Apr 1994 16:00:13 +0000
parents 35e857d14d40
children a41377a11bf0
comparison
equal deleted inserted replaced
6758:2395a59123b8 6759:e0938c42218c
101 extern char *x_id_name; 101 extern char *x_id_name;
102 102
103 /* The background and shape of the mouse pointer, and shape when not 103 /* The background and shape of the mouse pointer, and shape when not
104 over text or in the modeline. */ 104 over text or in the modeline. */
105 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; 105 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
106 Lisp_Object Vx_cross_pointer_shape;
106 107
107 /* Color of chars displayed in cursor box. */ 108 /* Color of chars displayed in cursor box. */
108 Lisp_Object Vx_cursor_fore_pixel; 109 Lisp_Object Vx_cursor_fore_pixel;
109 110
110 /* The screen being used. */ 111 /* The screen being used. */
669 void 670 void
670 x_set_mouse_color (f, arg, oldval) 671 x_set_mouse_color (f, arg, oldval)
671 struct frame *f; 672 struct frame *f;
672 Lisp_Object arg, oldval; 673 Lisp_Object arg, oldval;
673 { 674 {
674 Cursor cursor, nontext_cursor, mode_cursor; 675 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
675 int mask_color; 676 int mask_color;
676 677
677 if (!EQ (Qnil, arg)) 678 if (!EQ (Qnil, arg))
678 f->display.x->mouse_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT); 679 f->display.x->mouse_pixel = x_decode_color (arg, BLACK_PIX_DEFAULT);
679 mask_color = f->display.x->background_pixel; 680 mask_color = f->display.x->background_pixel;
713 mode_cursor = XCreateFontCursor (x_current_display, 714 mode_cursor = XCreateFontCursor (x_current_display,
714 XINT (Vx_mode_pointer_shape)); 715 XINT (Vx_mode_pointer_shape));
715 } 716 }
716 else 717 else
717 mode_cursor = XCreateFontCursor (x_current_display, XC_xterm); 718 mode_cursor = XCreateFontCursor (x_current_display, XC_xterm);
719 x_check_errors ("bad modeline pointer cursor: %s");
720
721 if (!EQ (Qnil, Vx_cross_pointer_shape))
722 {
723 CHECK_NUMBER (Vx_cross_pointer_shape, 0);
724 cross_cursor = XCreateFontCursor (x_current_display,
725 XINT (Vx_cross_pointer_shape));
726 }
727 else
728 cross_cursor = XCreateFontCursor (x_current_display, XC_crosshair);
718 729
719 /* Check and report errors with the above calls. */ 730 /* Check and report errors with the above calls. */
720 x_check_errors ("can't set cursor shape: %s"); 731 x_check_errors ("can't set cursor shape: %s");
721 x_uncatch_errors (); 732 x_uncatch_errors ();
722 733
737 &fore_color, &back_color); 748 &fore_color, &back_color);
738 XRecolorCursor (x_current_display, nontext_cursor, 749 XRecolorCursor (x_current_display, nontext_cursor,
739 &fore_color, &back_color); 750 &fore_color, &back_color);
740 XRecolorCursor (x_current_display, mode_cursor, 751 XRecolorCursor (x_current_display, mode_cursor,
741 &fore_color, &back_color); 752 &fore_color, &back_color);
753 XRecolorCursor (x_current_display, cross_cursor,
754 &fore_color, &back_color);
742 } 755 }
743 #else /* X10 */ 756 #else /* X10 */
744 cursor = XCreateCursor (16, 16, MouseCursor, MouseMask, 757 cursor = XCreateCursor (16, 16, MouseCursor, MouseMask,
745 0, 0, 758 0, 0,
746 f->display.x->mouse_pixel, 759 f->display.x->mouse_pixel,
764 777
765 if (mode_cursor != f->display.x->modeline_cursor 778 if (mode_cursor != f->display.x->modeline_cursor
766 && f->display.x->modeline_cursor != 0) 779 && f->display.x->modeline_cursor != 0)
767 XFreeCursor (XDISPLAY f->display.x->modeline_cursor); 780 XFreeCursor (XDISPLAY f->display.x->modeline_cursor);
768 f->display.x->modeline_cursor = mode_cursor; 781 f->display.x->modeline_cursor = mode_cursor;
782 if (cross_cursor != f->display.x->cross_cursor
783 && f->display.x->cross_cursor != 0)
784 XFreeCursor (XDISPLAY f->display.x->cross_cursor);
785 f->display.x->cross_cursor = cross_cursor;
769 #endif /* HAVE_X11 */ 786 #endif /* HAVE_X11 */
770 787
771 XFlushQueue (); 788 XFlushQueue ();
772 UNBLOCK_INPUT; 789 UNBLOCK_INPUT;
773 } 790 }
4148 DEFVAR_INT ("x-mode-pointer-shape", &Vx_mode_pointer_shape, 4165 DEFVAR_INT ("x-mode-pointer-shape", &Vx_mode_pointer_shape,
4149 "The shape of the pointer when over the mode line."); 4166 "The shape of the pointer when over the mode line.");
4150 #endif 4167 #endif
4151 Vx_mode_pointer_shape = Qnil; 4168 Vx_mode_pointer_shape = Qnil;
4152 4169
4170 Vx_cross_pointer_shape = Qnil;
4171
4153 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, 4172 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
4154 "A string indicating the foreground color of the cursor box."); 4173 "A string indicating the foreground color of the cursor box.");
4155 Vx_cursor_fore_pixel = Qnil; 4174 Vx_cursor_fore_pixel = Qnil;
4156 4175
4157 DEFVAR_LISP ("mouse-grabbed", &Vmouse_depressed, 4176 DEFVAR_LISP ("mouse-grabbed", &Vmouse_depressed,