[PATCH libX11-xcb] add XCBGetXDisplay

Uli Schlachter psychon at znc.in
Wed May 27 13:18:08 PDT 2015


Hi,

Am 27.05.2015 um 14:42 schrieb Mike Blumenkrantz:
[...]
> From c5e4bf50a722670e0ac1b05509834874251c0c9c Mon Sep 17 00:00:00 2001
> From: Mike Blumenkrantz <zmike at osg.samsung.com>
> Date: Wed, 27 May 2015 08:37:05 -0400
> Subject: [PATCH] add XCBGetXDisplay
> 
> a method for creating a Display object from an xcb connection

This commit message might be improved a bit.

> Signed-off-by: Mike Blumenkrantz <zmike at osg.samsung.com>
> ---
>  include/X11/Xlib-xcb.h |   1 +
>  src/x11_xcb.c          | 562 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 563 insertions(+)
> 
> diff --git a/include/X11/Xlib-xcb.h b/include/X11/Xlib-xcb.h
> index a21e2be..240a25c 100644
> --- a/include/X11/Xlib-xcb.h
> +++ b/include/X11/Xlib-xcb.h
> @@ -11,6 +11,7 @@
>  _XFUNCPROTOBEGIN
>  
>  xcb_connection_t *XGetXCBConnection(Display *dpy);
> +Display *XCBGetXDisplay(xcb_connection_t *c);
>  
>  enum XEventQueueOwner { XlibOwnsEventQueue = 0, XCBOwnsEventQueue };
>  void XSetEventQueueOwner(Display *dpy, enum XEventQueueOwner owner);
> diff --git a/src/x11_xcb.c b/src/x11_xcb.c
> index 3ddf403..0dabf6d 100644
> --- a/src/x11_xcb.c
> +++ b/src/x11_xcb.c
> @@ -1,9 +1,78 @@
[...]

Where did you copy these more than 500 lines from and why can't it be shared
with XOpenDisplay() (I guess that is where this code comes from)?

> +	if ((display_name = getenv("DISPLAY")) == NULL) {
> +		/* Oops! No DISPLAY environment variable - error. */
> +		return(NULL);
> +	}

Why does this function require $DISPLAY? That is totally unrelated to the XCB
connection that you give it.

Also, there is no documentation for this new function and I guess calling
XCloseDisplay() on it will also close the XCB connection. That doesn't seem right.

Cheers,
Uli
-- 
Happiness can't be found -- it finds you.
 - Majic


More information about the xorg-devel mailing list