summaryrefslogtreecommitdiff
path: root/src/xfns.c
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2009-07-03 11:07:02 +0000
committerJan Djärv <jan.h.d@swipnet.se>2009-07-03 11:07:02 +0000
commite044e4fcd50c4db40c9efb40dd395bace59f287b (patch)
treeb5bae9d80138aba8501ad0d4cbb56cce5492dd09 /src/xfns.c
parent2e9b968b289df9e1237d21253c8057789fb33808 (diff)
downloademacs-e044e4fcd50c4db40c9efb40dd395bace59f287b.tar.gz
* xterm.h (struct x_display_info): Add invisible_cursor.
(struct x_output): Add current_cursor. * xterm.c (XTtoggle_invisible_pointer): New function. (x_define_frame_cursor): Don't define cursor if invisible or the same as before. Set current_cursor. (x_create_terminal): Set toggle_invisible_pointer_hook. * xfns.c (make_invisible_cursor): New function. (x_set_mouse_color): Call make_invisible_cursor. Set current_cursor. (x_window): Set current_cursor. * termhooks.h (struct terminal): Add toggle_invisible_pointer_hook. * keyboard.c (command_loop_1): Call frame_make_pointer_invisible after inserting a character. (read_avail_input): Call frame_make_pointer_visible. * frame.c (Vmake_pointer_invisible): New variable. (frame_make_pointer_invisible, frame_make_pointer_visible): New functions. (syms_of_frame): DEFVAR make-pointer-invisible, initialize to Qt. * frame.h: Declare frame_make_pointer_invisible and frame_make_pointer_visible. (struct frame): Add pointer_invisible. * cus-start.el (all): Added make-pointer-invisible.
Diffstat (limited to 'src/xfns.c')
-rw-r--r--src/xfns.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 9036ff171fa..237b1c911ee 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -941,6 +941,35 @@ x_set_background_color (f, arg, oldval)
}
}
+static Cursor
+make_invisible_cursor (f)
+ struct frame *f;
+{
+ Display *dpy = FRAME_X_DISPLAY (f);
+ static char const no_data[] = { 0 };
+ Pixmap pix;
+ XColor col;
+ Cursor c;
+
+ x_catch_errors (dpy);
+ pix = XCreateBitmapFromData (dpy, FRAME_X_DISPLAY_INFO (f)->root_window,
+ no_data, 1, 1);
+ if (! x_had_errors_p (dpy) && pix != None)
+ {
+ col.pixel = 0;
+ col.red = col.green = col.blue = 0;
+ col.flags = DoRed | DoGreen | DoBlue;
+ c = XCreatePixmapCursor (dpy, pix, pix, &col, &col, 0, 0);
+ if (x_had_errors_p (dpy) || c == None)
+ c = 0;
+ XFreePixmap (dpy, pix);
+ }
+
+ x_uncatch_errors ();
+
+ return c;
+}
+
void
x_set_mouse_color (f, arg, oldval)
struct frame *f;
@@ -1046,8 +1075,12 @@ x_set_mouse_color (f, arg, oldval)
}
if (FRAME_X_WINDOW (f) != 0)
- XDefineCursor (dpy, FRAME_X_WINDOW (f), cursor);
+ XDefineCursor (dpy, FRAME_X_WINDOW (f),
+ f->output_data.x->current_cursor = cursor);
+ if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor == 0)
+ FRAME_X_DISPLAY_INFO (f)->invisible_cursor = make_invisible_cursor (f);
+
if (cursor != x->text_cursor
&& x->text_cursor != 0)
XFreeCursor (dpy, x->text_cursor);
@@ -2671,7 +2704,7 @@ x_window (f, window_prompting, minibuffer_only)
}
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- f->output_data.x->text_cursor);
+ f->output.x->current_cursor = f->output_data.x->text_cursor);
UNBLOCK_INPUT;
@@ -2816,7 +2849,7 @@ x_window (f)
}
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- f->output_data.x->text_cursor);
+ f->output.x->current_cursor = f->output_data.x->text_cursor);
UNBLOCK_INPUT;