[Xcb-commit] xcb/src xcb.h, 1.5, 1.6 xcb_conn.c, 1.24,
1.25 xcb_util.c, 1.8, 1.9
Jamey Sharp
xcb-commit at lists.freedesktop.org
Wed Dec 7 21:51:22 PST 2005
Update of /cvs/xcb/xcb/src
In directory gabe:/tmp/cvs-serv21145/src
Modified Files:
xcb.h xcb_conn.c xcb_util.c
Log Message:
Rename XCBConnect to XCBConnectToFD, and implement XCBConnect
and XCBConnectToDisplayWithAuthInfo, as specified by the XcbApi
documentation. Provide a trivial implementation of deprecated
XCBConnectBasic for backwards compatibility. Fix XCBParseDisplay
to accept a null screen pointer.
Index: xcb.h
===================================================================
RCS file: /cvs/xcb/xcb/src/xcb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xcb.h 10 Apr 2005 18:24:57 -0000 1.5
+++ xcb.h 8 Dec 2005 05:51:19 -0000 1.6
@@ -133,7 +133,7 @@
XCBConnSetupSuccessRep *XCBGetSetup(XCBConnection *c);
int XCBGetFileDescriptor(XCBConnection *c);
-XCBConnection *XCBConnect(int fd, XCBAuthInfo *auth_info);
+XCBConnection *XCBConnectToFD(int fd, XCBAuthInfo *auth_info);
void XCBDisconnect(XCBConnection *c);
@@ -144,7 +144,9 @@
int XCBOpenTCP(const char *host, unsigned short port);
int XCBOpenUnix(const char *file);
-XCBConnection *XCBConnectBasic(void);
+XCBConnection *XCBConnectBasic(void); /* deprecated */
+XCBConnection *XCBConnect(const char *displayname, int *screenp);
+XCBConnection *XCBConnectToDisplayWithAuthInfo(const char *display, XCBAuthInfo *auth, int *screen);
int XCBSync(XCBConnection *c, XCBGenericError **e);
Index: xcb_util.c
===================================================================
RCS file: /cvs/xcb/xcb/src/xcb_util.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- xcb_util.c 7 Nov 2004 04:59:32 -0000 1.8
+++ xcb_util.c 8 Dec 2005 05:51:19 -0000 1.9
@@ -52,6 +52,9 @@
int XCBParseDisplay(const char *name, char **host, int *display, int *screen)
{
char *colon;
+ int dummy_screen;
+ if(!screen)
+ screen = &dummy_screen;
*screen = *display = 0;
if(!name || !*name)
name = getenv("DISPLAY");
@@ -128,39 +131,52 @@
return fd;
}
-XCBConnection *XCBConnectBasic()
+XCBConnection *XCBConnect(const char *displayname, int *screenp)
{
- int fd, display = 0, screen = 0;
+ int fd, display = 0;
char *host;
XCBConnection *c;
XCBAuthInfo auth;
- if(!XCBParseDisplay(0, &host, &display, &screen))
- {
- fprintf(stderr, "Invalid DISPLAY\n");
- abort();
- }
+ if(!XCBParseDisplay(displayname, &host, &display, screenp))
+ return 0;
fd = XCBOpen(host, display);
free(host);
if(fd == -1)
- {
- perror("XCBOpen");
- abort();
- }
+ return 0;
XCBGetAuthInfo(fd, &auth);
- c = XCBConnect(fd, &auth);
- if(!c)
- {
- perror("XCBConnect");
- abort();
- }
-
+ c = XCBConnectToFD(fd, &auth);
free(auth.name);
free(auth.data);
return c;
}
+XCBConnection *XCBConnectToDisplayWithAuthInfo(const char *displayname, XCBAuthInfo *auth, int *screenp)
+{
+ int fd, display = 0;
+ char *host;
+
+ if(!XCBParseDisplay(displayname, &host, &display, screenp))
+ return 0;
+ fd = XCBOpen(host, display);
+ free(host);
+ if(fd == -1)
+ return 0;
+
+ return XCBConnectToFD(fd, auth);
+}
+
+/* backwards compatible interface: remove before 1.0 release */
+XCBConnection *XCBConnectBasic()
+{
+ XCBConnection *c = XCBConnect(0, 0);
+ if(c)
+ return c;
+ perror("XCBConnect");
+ abort();
+}
+
int XCBSync(XCBConnection *c, XCBGenericError **e)
{
XCBGetInputFocusRep *reply = XCBGetInputFocusReply(c, XCBGetInputFocus(c), e);
Index: xcb_conn.c
===================================================================
RCS file: /cvs/xcb/xcb/src/xcb_conn.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- xcb_conn.c 3 Aug 2005 16:17:37 -0000 1.24
+++ xcb_conn.c 8 Dec 2005 05:51:19 -0000 1.25
@@ -130,7 +130,7 @@
return c->fd;
}
-XCBConnection *XCBConnect(int fd, XCBAuthInfo *auth_info)
+XCBConnection *XCBConnectToFD(int fd, XCBAuthInfo *auth_info)
{
XCBConnection* c;
More information about the xcb-commit
mailing list