[Xcb-commit] xcb-demo Makefile.am, 1.5, 1.6 dpms.c, 1.7, 1.8 hypnomoire.c, 1.14, 1.15 main.c, 1.22, 1.23 rendertest.c, 1.9, 1.10 xcbrandr.c, 1.3, 1.4 xdpyinfo.c, 1.7, 1.8

Bart Massey xcb-commit at lists.freedesktop.org
Sun Dec 11 14:30:19 PST 2005


Update of /cvs/xcb/xcb-demo
In directory gabe:/tmp/cvs-serv2516

Modified Files:
	Makefile.am dpms.c hypnomoire.c main.c rendertest.c xcbrandr.c 
	xdpyinfo.c 
Log Message:
Fixed deprecations, by rewriting XCBConnectBasic() and
XCBWaitEvent() calls.



Index: rendertest.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/rendertest.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- rendertest.c	24 Mar 2005 01:12:07 -0000	1.9
+++ rendertest.c	11 Dec 2005 22:30:17 -0000	1.10
@@ -1,5 +1,6 @@
 
 #include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
 #include <X11/XCB/render.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -513,11 +514,12 @@
     XCBRenderQueryPictFormatsRep *formats_reply;
     XCBRenderPICTFORMAT  rootformat;
     XCBSCREEN *root;
+    int screen_num;
     
     XCBRenderPICTFORMINFO  forminfo_query, *forminfo_result;
     
-    c = XCBConnectBasic();
-    root = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c)).data;
+    c = XCBConnect(0, &screen_num);
+    root = XCBAuxGetScreen(c, screen_num);
     
     version_cookie = XCBRenderQueryVersion(c, (CARD32)0, (CARD32)3);
     version_reply = XCBRenderQueryVersionReply(c, version_cookie, 0);

Index: xdpyinfo.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/xdpyinfo.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- xdpyinfo.c	24 Mar 2005 01:12:07 -0000	1.7
+++ xdpyinfo.c	11 Dec 2005 22:30:17 -0000	1.8
@@ -17,7 +17,7 @@
 {
     void (*ext_printer)(int, char *) = print_extension;
 
-    c = XCBConnectBasic();
+    c = XCBConnect(0, 0);
     if(!c)
     {
 	fputs("Connect failed.\n", stderr);

Index: hypnomoire.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/hypnomoire.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- hypnomoire.c	25 Jul 2004 02:25:35 -0000	1.14
+++ hypnomoire.c	11 Dec 2005 22:30:17 -0000	1.15
@@ -5,6 +5,7 @@
  */
 
 #include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
 #include "reply_formats.h"
 #include <math.h>
 #include <stdlib.h> /* for free(3) */
@@ -62,9 +63,10 @@
 	CARD32 mask = GCForeground | GCGraphicsExposures;
 	CARD32 values[2];
 	XCBDRAWABLE rootwin;
+	int screen_num;
 
-	c = XCBConnectBasic();
-	root = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c)).data;
+	c = XCBConnect(0, &screen_num);
+	root = XCBAuxGetScreen(c, screen_num);
 	get_depth();
 
 	rootwin.window = root->root;
@@ -188,7 +190,7 @@
 
 	while(1)
 	{
-		e = XCBWaitEvent(c);
+		e = XCBWaitForEvent(c);
 		if(!formatEvent(e))
 			return 0;
 		if(e->response_type == XCBExpose)

Index: xcbrandr.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/xcbrandr.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xcbrandr.c	11 Dec 2005 21:10:05 -0000	1.3
+++ xcbrandr.c	11 Dec 2005 22:30:17 -0000	1.4
@@ -30,6 +30,7 @@
 
 #include <stdio.h>
 #include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
 #include <X11/XCB/randr.h>
 #include <X11/XCB/render.h>	/* we share subpixel information */
 #include <string.h>
@@ -228,18 +229,7 @@
       fprintf (stderr, "Can't open display %s\n", display_name);
       exit (1);
   }
-  if (screen < 0)
-    screen = 0;
-
-/* TODO: Figure out a way to do this later...
-  if (screen >= ScreenCount (c)) {
-    fprintf (stderr, "Invalid screen number %d (display has %d)\n",
-	     screen, ScreenCount (c));
-    exit (1);
-  }
-*/
-		
-  root = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c)).data;
+  root = XCBAuxGetScreen(c, screen);
   XCBRandRGetScreenInfoCookie scookie;
 
   int major_version, minor_version;
@@ -400,7 +390,7 @@
       {
 	while (1) {
 	int spo;
-	event = XCBWaitEvent(c);
+	event = XCBWaitForEvent(c);
 	
 	printf ("Event received, type = %d\n", event->response_type);
 	//update Xlib's knowledge of the event

Index: Makefile.am
===================================================================
RCS file: /cvs/xcb/xcb-demo/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile.am	2 Apr 2005 14:02:47 -0000	1.5
+++ Makefile.am	11 Dec 2005 22:30:17 -0000	1.6
@@ -10,16 +10,18 @@
 
 bin_PROGRAMS = hypnomoire xdpyinfo xcb-test dpms rendertest xcbrandr
 
-hypnomoire_LDADD = $(LDADD) -lm -lpthread
+hypnomoire_LDADD = $(LDADD) $(XCBAUX_LIBS) -lm -lpthread
 hypnomoire_SOURCES = hypnomoire.c reply_formats.c
 
 xdpyinfo_SOURCES = xdpyinfo.c
 
-xcb_test_LDADD = $(LDADD) -lpthread
+xcb_test_LDADD = $(LDADD) $(XCBAUX_LIBS) -lpthread
 xcb_test_SOURCES = main.c reply_formats.c
 
 dpms_SOURCES = dpms.c
 
+rendertest_LDADD = $(XCBAUX_LIBS)
 rendertest_SOURCES = rendertest.c
 
+xcbrandr_LDADD = $(XCBAUX_LIBS)
 xcbrandr_SOURCES = xcbrandr.c

Index: dpms.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/dpms.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dpms.c	9 Apr 2005 23:39:37 -0000	1.7
+++ dpms.c	11 Dec 2005 22:30:17 -0000	1.8
@@ -12,7 +12,7 @@
 
 int main(int argc, char **argv)
 {
-	XCBConnection *c = XCBConnectBasic();
+	XCBConnection *c = XCBConnect(0, 0);
 	XCBDPMSGetVersionCookie vc;
 	XCBDPMSGetVersionRep *ver;
 	XCBDPMSCapableCookie cc;

Index: main.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/main.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- main.c	28 Mar 2005 19:55:04 -0000	1.22
+++ main.c	11 Dec 2005 22:30:17 -0000	1.23
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 
 #include <X11/XCB/xcb.h>
+#include <X11/XCB/xcb_aux.h>
 #include "reply_formats.h"
 
 #ifdef VERBOSE
@@ -60,9 +61,10 @@
 #ifdef TEST_THREADS
     pthread_t event_thread;
 #endif
+    int screen_num;
 
-    c = XCBConnectBasic();
-    root = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c)).data;
+    c = XCBConnect(0, &screen_num);
+    root = XCBAuxGetScreen(c, screen_num);
 
 #ifdef TEST_THREADS
 # ifdef VERBOSE
@@ -240,6 +242,6 @@
     printf("wait_events() thread ID: %ld\n", pthread_self());
 # endif
 #endif
-    while((e = XCBWaitEvent(c)) && show_event(e))
+    while((e = XCBWaitForEvent(c)) && show_event(e))
         /* empty statement */ ;
 }



More information about the xcb-commit mailing list