[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117096: If available, use Xfixes extension to do po
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] trunk r117096: If available, use Xfixes extension to do pointer blanking. |
Date: |
Tue, 13 May 2014 14:21:25 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117096
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-05-13 18:18:54 +0400
message:
If available, use Xfixes extension to do pointer blanking.
* configure.ac (HAVE_XFIXES): Define if available.
(XFIXES_CFLAGS, XFIXES_LIBS): New AC_SUBSTs.
* src/Makefile.in (XFIXES_CFLAGS, XFIXES_LIBS): New var.
* src/xfns.c (x_set_mouse_color): Do not call make_invisible_cursor here.
(make_invisible_cursor): Move to...
* src/xterm.c (make_invisible_cursor): ...here.
(x_probe_xfixes_extension, xfixes_toggle_visible_pointer)
(x_toggle_visible_pointer, x_setup_pointer_blanking): New functions.
(x_term_init): Call to x_setup_pointer_blanking.
(XTtoggle_invisible_pointer): Use blanking specific to this display.
* src/xterm.h (struct x_display_info): New member toggle_visible_pointer.
modified:
ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1538
configure.ac
configure.in-20091113204419-o5vbwnq5f7feedwu-783
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/Makefile.in makefile.in-20091113204419-o5vbwnq5f7feedwu-631
src/xfns.c xfns.c-20091113204419-o5vbwnq5f7feedwu-274
src/xterm.c xterm.c-20091113204419-o5vbwnq5f7feedwu-244
src/xterm.h xterm.h-20091113204419-o5vbwnq5f7feedwu-228
=== modified file 'ChangeLog'
--- a/ChangeLog 2014-05-13 11:12:05 +0000
+++ b/ChangeLog 2014-05-13 14:18:54 +0000
@@ -1,6 +1,8 @@
2014-05-13 Dmitry Antipov <address@hidden>
- * configure.ac (--enable-link-time-optimization): Add clang support.
+ * configure.ac (HAVE_XFIXES): Define if available.
+ (XFIXES_CFLAGS, XFIXES_LIBS): New AC_SUBSTs.
+ (--enable-link-time-optimization): Add clang support.
* INSTALL: Mention it.
2014-05-12 Katsumi Yamaoka <address@hidden>
=== modified file 'configure.ac'
--- a/configure.ac 2014-05-13 11:12:05 +0000
+++ b/configure.ac 2014-05-13 14:18:54 +0000
@@ -3304,6 +3304,26 @@
AC_SUBST(XINERAMA_CFLAGS)
AC_SUBST(XINERAMA_LIBS)
+### Use Xfixes (-lXfixes) if available
+HAVE_XFIXES=no
+if test "${HAVE_X11}" = "yes"; then
+ XFIXES_REQUIRED=4.0.0
+ XFIXES_MODULES="xfixes >= $XFIXES_REQUIRED"
+ EMACS_CHECK_MODULES([XFIXES], [$XFIXES_MODULES])
+ if test $HAVE_XFIXES = no; then
+ # Test old way in case pkg-config doesn't have it (older machines).
+ AC_CHECK_HEADER(X11/extensions/Xfixes.h,
+ [AC_CHECK_LIB(Xfixes, XFixesHideCursor, HAVE_XFIXES=yes)])
+ if test $HAVE_XFIXES = yes; then
+ XFIXES_LIBS=-lXfixes
+ fi
+ fi
+ if test $HAVE_XFIXES = yes; then
+ AC_DEFINE(HAVE_XFIXES, 1, [Define to 1 if you have the Xfixes extension.])
+ fi
+fi
+AC_SUBST(XFIXES_CFLAGS)
+AC_SUBST(XFIXES_LIBS)
### Use libxml (-lxml2) if available
### mingw32 doesn't use -lxml2, since it loads the library dynamically.
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-05-12 08:57:59 +0000
+++ b/src/ChangeLog 2014-05-13 14:18:54 +0000
@@ -1,3 +1,16 @@
+2014-05-13 Dmitry Antipov <address@hidden>
+
+ If available, use Xfixes extension to do pointer blanking.
+ * Makefile.in (XFIXES_CFLAGS, XFIXES_LIBS): New var.
+ * xfns.c (x_set_mouse_color): Do not call make_invisible_cursor here.
+ (make_invisible_cursor): Move to...
+ * xterm.c (make_invisible_cursor): ...here.
+ (x_probe_xfixes_extension, xfixes_toggle_visible_pointer)
+ (x_toggle_visible_pointer, x_setup_pointer_blanking): New functions.
+ (x_term_init): Call to x_setup_pointer_blanking.
+ (XTtoggle_invisible_pointer): Use blanking specific to this display.
+ * xterm.h (struct x_display_info): New member toggle_visible_pointer.
+
2014-05-12 YAMAMOTO Mitsuharu <address@hidden>
* xdisp.c (draw_glyphs): Set clipping to highlight boundaries.
=== modified file 'src/Makefile.in'
--- a/src/Makefile.in 2014-05-04 21:28:08 +0000
+++ b/src/Makefile.in 2014-05-13 14:18:54 +0000
@@ -231,6 +231,9 @@
XINERAMA_LIBS = @XINERAMA_LIBS@
XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
+XFIXES_LIBS = @XFIXES_LIBS@
+XFIXES_CFLAGS = @XFIXES_CFLAGS@
+
## widget.o if USE_X_TOOLKIT, otherwise empty.
address@hidden@
@@ -326,8 +329,8 @@
-I$(lib) -I$(srcdir)/../lib \
$(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
$(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
- $(PNG_CFLAGS) \
- $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) \
+ $(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
+ $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) $(XFIXES_CFLAGS) \
$(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
$(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \
$(LIBGNUTLS_CFLAGS) $(GFILENOTIFY_CFLAGS) \
@@ -407,7 +410,7 @@
$(LIBX_OTHER) $(LIBSOUND) \
$(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \
$(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
- $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) \
+ $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \
$(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
$(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
$(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
=== modified file 'src/xfns.c'
--- a/src/xfns.c 2014-04-03 20:46:04 +0000
+++ b/src/xfns.c 2014-05-13 14:18:54 +0000
@@ -577,35 +577,6 @@
}
}
-static Cursor
-make_invisible_cursor (struct frame *f)
-{
- Display *dpy = FRAME_X_DISPLAY (f);
- static char const no_data[] = { 0 };
- Pixmap pix;
- XColor col;
- Cursor c = 0;
-
- x_catch_errors (dpy);
- pix = XCreateBitmapFromData (dpy, FRAME_DISPLAY_INFO (f)->root_window,
- no_data, 1, 1);
- if (! x_had_errors_p (dpy) && pix != None)
- {
- Cursor pixc;
- col.pixel = 0;
- col.red = col.green = col.blue = 0;
- col.flags = DoRed | DoGreen | DoBlue;
- pixc = XCreatePixmapCursor (dpy, pix, pix, &col, &col, 0, 0);
- if (! x_had_errors_p (dpy) && pixc != None)
- c = pixc;
- XFreePixmap (dpy, pix);
- }
-
- x_uncatch_errors ();
-
- return c;
-}
-
static void
x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
@@ -723,9 +694,6 @@
XDefineCursor (dpy, FRAME_X_WINDOW (f),
f->output_data.x->current_cursor = cursor);
- if (FRAME_DISPLAY_INFO (f)->invisible_cursor == 0)
- FRAME_DISPLAY_INFO (f)->invisible_cursor = make_invisible_cursor (f);
-
if (cursor != x->text_cursor
&& x->text_cursor != 0)
XFreeCursor (dpy, x->text_cursor);
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2014-04-18 23:36:51 +0000
+++ b/src/xterm.c 2014-05-13 14:18:54 +0000
@@ -32,6 +32,11 @@
#include "xterm.h"
#include <X11/cursorfont.h>
+/* If we have Xfixes extension, use it for pointer blanking. */
+#ifdef HAVE_XFIXES
+#include <X11/extensions/Xfixes.h>
+#endif
+
/* Load sys/types.h if not already loaded.
In some systems loading it twice is suicidal. */
#ifndef makedev
@@ -3096,16 +3101,7 @@
XTtoggle_invisible_pointer (struct frame *f, int invisible)
{
block_input ();
- if (invisible)
- {
- if (FRAME_DISPLAY_INFO (f)->invisible_cursor != 0)
- XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- FRAME_DISPLAY_INFO (f)->invisible_cursor);
- }
- else
- XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- f->output_data.x->current_cursor);
- f->pointer_invisible = invisible;
+ FRAME_DISPLAY_INFO (f)->toggle_visible_pointer (f, invisible);
unblock_input ();
}
@@ -9720,6 +9716,94 @@
}
#endif
+/* Create invisible cursor on X display referred by DPYINFO. */
+
+static Cursor
+make_invisible_cursor (struct x_display_info *dpyinfo)
+{
+ Display *dpy = dpyinfo->display;
+ static char const no_data[] = { 0 };
+ Pixmap pix;
+ XColor col;
+ Cursor c = 0;
+
+ x_catch_errors (dpy);
+ pix = XCreateBitmapFromData (dpy, dpyinfo->root_window, no_data, 1, 1);
+ if (! x_had_errors_p (dpy) && pix != None)
+ {
+ Cursor pixc;
+ col.pixel = 0;
+ col.red = col.green = col.blue = 0;
+ col.flags = DoRed | DoGreen | DoBlue;
+ pixc = XCreatePixmapCursor (dpy, pix, pix, &col, &col, 0, 0);
+ if (! x_had_errors_p (dpy) && pixc != None)
+ c = pixc;
+ XFreePixmap (dpy, pix);
+ }
+
+ x_uncatch_errors ();
+
+ return c;
+}
+
+/* True if DPY supports Xfixes extension >= 4. */
+
+static bool
+x_probe_xfixes_extension (Display *dpy)
+{
+#ifdef HAVE_XFIXES
+ int major, minor;
+ return XFixesQueryVersion (dpy, &major, &minor) && major >= 4;
+#else
+ return false;
+#endif /* HAVE_XFIXES */
+}
+
+/* Toggle mouse pointer visibility on frame F by using Xfixes functions. */
+
+static void
+xfixes_toggle_visible_pointer (struct frame *f, bool invisible)
+{
+#ifdef HAVE_XFIXES
+ if (invisible)
+ XFixesHideCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
+ else
+ XFixesShowCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
+ f->pointer_invisible = invisible;
+#else
+ emacs_abort ();
+#endif /* HAVE_XFIXES */
+}
+
+/* Toggle mouse pointer visibility on frame F by using invisible cursor. */
+
+static void
+x_toggle_visible_pointer (struct frame *f, bool invisible)
+{
+ eassert (FRAME_DISPLAY_INFO (f)->invisible_cursor != 0);
+ if (invisible)
+ XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ FRAME_DISPLAY_INFO (f)->invisible_cursor);
+ else
+ XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ f->output_data.x->current_cursor);
+ f->pointer_invisible = invisible;
+}
+
+/* Setup pointer blanking, prefer Xfixes if available. */
+
+static void
+x_setup_pointer_blanking (struct x_display_info *dpyinfo)
+{
+ if (x_probe_xfixes_extension (dpyinfo->display))
+ dpyinfo->toggle_visible_pointer = xfixes_toggle_visible_pointer;
+ else
+ {
+ dpyinfo->toggle_visible_pointer = x_toggle_visible_pointer;
+ dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo);
+ }
+}
+
/* Current X display connection identifier. Incremented for each next
connection established. */
static unsigned x_display_id;
@@ -10148,6 +10232,8 @@
gray_bits, gray_width, gray_height,
1, 0, 1);
+ x_setup_pointer_blanking (dpyinfo);
+
#ifdef HAVE_X_I18N
xim_initialize (dpyinfo, resource_name);
#endif
=== modified file 'src/xterm.h'
--- a/src/xterm.h 2014-04-05 19:30:36 +0000
+++ b/src/xterm.h 2014-05-13 14:18:54 +0000
@@ -174,9 +174,13 @@
/* The cursor to use for vertical scroll bars. */
Cursor vertical_scroll_bar_cursor;
- /* The invisible cursor used for pointer blanking. */
+ /* The invisible cursor used for pointer blanking.
+ Unused if this display supports Xfixes extension. */
Cursor invisible_cursor;
+ /* Function used to toggle pointer visibility on this display. */
+ void (*toggle_visible_pointer) (struct frame *, bool);
+
#ifdef USE_GTK
/* The GDK cursor for scroll bars and popup menus. */
GdkCursor *xg_cursor;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117096: If available, use Xfixes extension to do pointer blanking.,
Dmitry Antipov <=