diff options
author | Ken Raeburn <raeburn@raeburn.org> | 2015-11-07 03:06:32 -0500 |
---|---|---|
committer | Ken Raeburn <raeburn@raeburn.org> | 2015-11-12 03:58:09 -0500 |
commit | c7f2b6ad892c93b8b848d21835a4b093c424cae6 (patch) | |
tree | c5be79d73006eda5c724cd3e07111b60d266484a /src/xterm.c | |
parent | e1c27dbd25ab22f6000d1e46259e2a60d56416c1 (diff) | |
download | emacs-c7f2b6ad892c93b8b848d21835a4b093c424cae6.tar.gz |
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/xterm.c')
-rw-r--r-- | src/xterm.c | 25 |
1 files changed, 25 insertions, 0 deletions
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) struct terminal *terminal; struct x_display_info *dpyinfo; XrmDatabase xrdb; +#ifdef USE_XCB + xcb_connection_t *xcb_conn; +#endif block_input (); @@ -11911,6 +11914,25 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) return 0; } +#ifdef USE_XCB + xcb_conn = XGetXCBConnection (dpy); + if (xcb_conn == 0) + { +#ifdef USE_GTK + xg_display_close (dpy); +#else +#ifdef USE_X_TOOLKIT + XtCloseDisplay (dpy); +#else + XCloseDisplay (dpy); +#endif +#endif /* ! USE_GTK */ + + unblock_input (); + return 0; + } +#endif + /* We have definitely succeeded. Record the new connection. */ dpyinfo = xzalloc (sizeof *dpyinfo); @@ -11961,6 +11983,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->name_list_element = Fcons (display_name, Qnil); dpyinfo->display = dpy; dpyinfo->connection = ConnectionNumber (dpyinfo->display); +#ifdef USE_XCB + dpyinfo->xcb_connection = xcb_conn; +#endif /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html */ dpyinfo->smallest_font_height = 1; |