diff options
| author | Ken Raeburn | 2015-11-07 03:06:32 -0500 |
|---|---|---|
| committer | Ken Raeburn | 2015-11-12 03:58:09 -0500 |
| commit | c7f2b6ad892c93b8b848d21835a4b093c424cae6 (patch) | |
| tree | c5be79d73006eda5c724cd3e07111b60d266484a /src | |
| parent | e1c27dbd25ab22f6000d1e46259e2a60d56416c1 (diff) | |
| download | emacs-c7f2b6ad892c93b8b848d21835a4b093c424cae6.tar.gz emacs-c7f2b6ad892c93b8b848d21835a4b093c424cae6.zip | |
Detect XCB and save a connection handle
* configure.ac: If using X11, check for XCB libraries and header.
* src/Makefile.in (XCB_LIBS): Define.
(LIBX_EXTRA): Include it.
* src/xterm.h [USE_XCB]: Include X11/Xlib-xcb.h.
(struct x_display_info) [USE_XCB]: Add an XCB connection handle field.
* src/xterm.c (x_term_init) [USE_XCB]: Initialize the new field.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 3 | ||||
| -rw-r--r-- | src/xterm.c | 25 | ||||
| -rw-r--r-- | src/xterm.h | 8 |
3 files changed, 35 insertions, 1 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index f73575938d3..d667c55ee33 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -128,8 +128,9 @@ LIB_PTHREAD=@LIB_PTHREAD@ | |||
| 128 | 128 | ||
| 129 | LIBIMAGE=@LIBTIFF@ @LIBJPEG@ @LIBPNG@ @LIBGIF@ @LIBXPM@ | 129 | LIBIMAGE=@LIBTIFF@ @LIBJPEG@ @LIBPNG@ @LIBGIF@ @LIBXPM@ |
| 130 | 130 | ||
| 131 | XCB_LIBS=@XCB_LIBS@ | ||
| 131 | XFT_LIBS=@XFT_LIBS@ | 132 | XFT_LIBS=@XFT_LIBS@ |
| 132 | LIBX_EXTRA=-lX11 $(XFT_LIBS) | 133 | LIBX_EXTRA=-lX11 $(XCB_LIBS) $(XFT_LIBS) |
| 133 | 134 | ||
| 134 | FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ | 135 | FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ |
| 135 | FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ | 136 | FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ |
diff --git a/src/xterm.c b/src/xterm.c index 5756378bd3a..d1cf8e4d0c1 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -11773,6 +11773,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11773 | struct terminal *terminal; | 11773 | struct terminal *terminal; |
| 11774 | struct x_display_info *dpyinfo; | 11774 | struct x_display_info *dpyinfo; |
| 11775 | XrmDatabase xrdb; | 11775 | XrmDatabase xrdb; |
| 11776 | #ifdef USE_XCB | ||
| 11777 | xcb_connection_t *xcb_conn; | ||
| 11778 | #endif | ||
| 11776 | 11779 | ||
| 11777 | block_input (); | 11780 | block_input (); |
| 11778 | 11781 | ||
| @@ -11911,6 +11914,25 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11911 | return 0; | 11914 | return 0; |
| 11912 | } | 11915 | } |
| 11913 | 11916 | ||
| 11917 | #ifdef USE_XCB | ||
| 11918 | xcb_conn = XGetXCBConnection (dpy); | ||
| 11919 | if (xcb_conn == 0) | ||
| 11920 | { | ||
| 11921 | #ifdef USE_GTK | ||
| 11922 | xg_display_close (dpy); | ||
| 11923 | #else | ||
| 11924 | #ifdef USE_X_TOOLKIT | ||
| 11925 | XtCloseDisplay (dpy); | ||
| 11926 | #else | ||
| 11927 | XCloseDisplay (dpy); | ||
| 11928 | #endif | ||
| 11929 | #endif /* ! USE_GTK */ | ||
| 11930 | |||
| 11931 | unblock_input (); | ||
| 11932 | return 0; | ||
| 11933 | } | ||
| 11934 | #endif | ||
| 11935 | |||
| 11914 | /* We have definitely succeeded. Record the new connection. */ | 11936 | /* We have definitely succeeded. Record the new connection. */ |
| 11915 | 11937 | ||
| 11916 | dpyinfo = xzalloc (sizeof *dpyinfo); | 11938 | dpyinfo = xzalloc (sizeof *dpyinfo); |
| @@ -11961,6 +11983,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11961 | dpyinfo->name_list_element = Fcons (display_name, Qnil); | 11983 | dpyinfo->name_list_element = Fcons (display_name, Qnil); |
| 11962 | dpyinfo->display = dpy; | 11984 | dpyinfo->display = dpy; |
| 11963 | dpyinfo->connection = ConnectionNumber (dpyinfo->display); | 11985 | dpyinfo->connection = ConnectionNumber (dpyinfo->display); |
| 11986 | #ifdef USE_XCB | ||
| 11987 | dpyinfo->xcb_connection = xcb_conn; | ||
| 11988 | #endif | ||
| 11964 | 11989 | ||
| 11965 | /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html */ | 11990 | /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html */ |
| 11966 | dpyinfo->smallest_font_height = 1; | 11991 | dpyinfo->smallest_font_height = 1; |
diff --git a/src/xterm.h b/src/xterm.h index f7d2803ff29..192839b059e 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -87,6 +87,10 @@ typedef GtkWidget *xt_or_gtk_widget; | |||
| 87 | #include <X11/Xlocale.h> | 87 | #include <X11/Xlocale.h> |
| 88 | #endif | 88 | #endif |
| 89 | 89 | ||
| 90 | #ifdef USE_XCB | ||
| 91 | #include <X11/Xlib-xcb.h> | ||
| 92 | #endif | ||
| 93 | |||
| 90 | #include "dispextern.h" | 94 | #include "dispextern.h" |
| 91 | #include "termhooks.h" | 95 | #include "termhooks.h" |
| 92 | 96 | ||
| @@ -458,6 +462,10 @@ struct x_display_info | |||
| 458 | #ifdef USE_CAIRO | 462 | #ifdef USE_CAIRO |
| 459 | XExtCodes *ext_codes; | 463 | XExtCodes *ext_codes; |
| 460 | #endif | 464 | #endif |
| 465 | |||
| 466 | #ifdef USE_XCB | ||
| 467 | xcb_connection_t *xcb_connection; | ||
| 468 | #endif | ||
| 461 | }; | 469 | }; |
| 462 | 470 | ||
| 463 | #ifdef HAVE_X_I18N | 471 | #ifdef HAVE_X_I18N |