[Xcb-commit] xcb-demo rendertest.c, 1.10, 1.11 xcbrandr.c, 1.5,
1.6 xdpyinfo.c, 1.8, 1.9
Bart Massey
xcb-commit at lists.freedesktop.org
Mon Dec 19 13:06:10 PST 2005
Update of /cvs/xcb/xcb-demo
In directory gabe:/tmp/cvs-serv19915
Modified Files:
rendertest.c xcbrandr.c xdpyinfo.c
Log Message:
Fixed widgy error handling in rendertest .
Made all demos compile cleanly -ansi -Wall .
Index: rendertest.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/rendertest.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- rendertest.c 11 Dec 2005 22:30:17 -0000 1.10
+++ rendertest.c 19 Dec 2005 21:06:08 -0000 1.11
@@ -18,7 +18,7 @@
XCBConnection *c;
XCBRenderPICTFORMAT pf;
-inline XCBRenderFIXED make_fixed(INT16 i, INT16 f)
+XCBRenderFIXED make_fixed(INT16 i, INT16 f)
{
return (i << 16) | (f & 0xffff);
}
@@ -547,7 +547,9 @@
rootformat = get_pictformat_from_visual(formats_reply, root->root_visual);
fprintf(stdout, "\n***** found root PICTFORMAT: %ld *****\n", rootformat.xid);
- //draw_window(c, formats_reply);
+#if 0
+ draw_window(c, formats_reply);
+#endif
/* It's very important to free the replys. We don't want memory leaks. */
free(version_reply);
Index: xcbrandr.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/xcbrandr.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xcbrandr.c 18 Dec 2005 06:45:11 -0000 1.5
+++ xcbrandr.c 19 Dec 2005 21:06:08 -0000 1.6
@@ -79,9 +79,11 @@
/*NOTREACHED*/
}
-// Same idea as xc/lib/Xrandr.c (XRRConfigRates).
-// Returns the rates for a given screen.
-// Would be nice to put in another library or something.
+/*
+ * Same idea as xc/lib/Xrandr.c (XRRConfigRates).
+ * Returns the rates for a given screen.
+ * Would be nice to put in another library or something.
+ */
short*
ConfigRates(XCBRandRGetScreenInfoRep *config, int sizeID, int *nrates)
{
@@ -135,6 +137,11 @@
int width = 0, height = 0;
int have_pixel_size = 0;
XCBGenericError *err;
+ CARD16 mask = (CARD16) StructureNotifyMask;
+ CARD32 values[1];
+ XCBRandRGetScreenInfoCookie scookie;
+ int major_version, minor_version;
+ XCBRandRQueryVersionRep *rr_version;
program_name = argv[0];
if (argc == 1) query = 1;
@@ -230,19 +237,18 @@
exit (1);
}
root = XCBAuxGetScreen(c, screen);
- XCBRandRGetScreenInfoCookie scookie;
-
- int major_version, minor_version;
- XCBRandRQueryVersionRep *rr_version;
- rr_version = XCBRandRQueryVersionReply(c, XCBRandRQueryVersion(c, 1, 1), &err);
+ rr_version = XCBRandRQueryVersionReply(c, XCBRandRQueryVersion(c, 1, 1), 0);
+ if (!rr_version) {
+ fprintf(stderr, "Can't get VersionReply.\n");
+ exit (1);
+ }
major_version = rr_version->major_version;
minor_version = rr_version->minor_version;
scookie = XCBRandRGetScreenInfo(c, root->root);
- sc = XCBRandRGetScreenInfoReply(c, scookie, &err);
-
- if (sc == NULL || err) {
- fprintf(stderr, "Can't get screen info.\n");
+ sc = XCBRandRGetScreenInfoReply(c, scookie, 0);
+ if (!sc) {
+ fprintf(stderr, "Can't get ScreenInfo.\n");
exit (1);
}
@@ -304,8 +310,11 @@
}
}
- //rotations = XRRConfigRotations(sc, ¤t_rotation);
+#if 0
+ rotations = XRRConfigRotations(sc, ¤t_rotation);
+#else
rotations = sc->rotation;
+#endif
rotation = 1 << rot ;
if (query) {
@@ -361,8 +370,6 @@
}
/* we should test configureNotify on the root window */
- CARD16 mask = (CARD16) StructureNotifyMask;
- CARD32 values[1];
values[0] = 1;
XCBConfigureWindow(c, root->root, mask, values);
@@ -370,15 +377,16 @@
if (setit) {
XCBRandRSetScreenConfigCookie sscc;
+ XCBRandRSetScreenConfigRep *config;
sscc = XCBRandRSetScreenConfig(c, root->root, CurrentTime, sc->config_timestamp, size,
(short) (rotation | reflection), rate);
- status = XCBRandRSetScreenConfigReply(c, sscc, &err)->status;
-
- if (err && status) {
+ config = XCBRandRSetScreenConfigReply(c, sscc, &err);
+ if (!config) {
fprintf(stderr, "Can't set the screen. Error Code: %i Status:%i\n",
err->error_code, status);
exit(1);
}
+ status = config->status;
}
const XCBQueryExtensionRep *qrre_rep = XCBRandRInit(c);
@@ -393,9 +401,13 @@
event = XCBWaitForEvent(c);
printf ("Event received, type = %d\n", event->response_type);
- //update Xlib's knowledge of the event
- ////Not sure what the equiv of this is or if we need it.
- //XRRUpdateConfiguration (&event);
+#if 0
+ /*
+ * update Xlib's knowledge of the event
+ * Not sure what the equiv of this is or if we need it.
+ */
+ XRRUpdateConfiguration (&event);
+#endif
if (event->response_type == ConfigureNotify)
printf("Received ConfigureNotify Event!\n");
@@ -431,7 +443,9 @@
}
}
}
- //XRRFreeScreenConfigInfo(sc);
+#if 0
+ XRRFreeScreenConfigInfo(sc);
+#endif
free(sc);
free(c);
return(0);
Index: xdpyinfo.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/xdpyinfo.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- xdpyinfo.c 11 Dec 2005 22:30:17 -0000 1.8
+++ xdpyinfo.c 19 Dec 2005 21:06:08 -0000 1.9
@@ -28,11 +28,11 @@
if(!strcmp(argv[argc], "-queryExtensions"))
ext_printer = query_extension;
- // "name of display: %s" "\n"
+ /* "name of display: %s" "\n" */
print_setup(c);
- // "\n" "focus: window 0x%x, revert to %s" (e.g. PointerRoot)
+ /* "\n" "focus: window 0x%x, revert to %s" (e.g. PointerRoot) */
list_extensions(ext_printer);
- // "\n" "default screen number: %d"
+ /* "\n" "default screen number: %d" */
list_screens();
fputs("\n", stdout);
@@ -47,7 +47,7 @@
fputs("\n" "vendor string: ", stdout);
fwrite(XCBConnSetupSuccessRepVendor(XCBGetSetup(c)), 1, XCBConnSetupSuccessRepVendorLength(XCBGetSetup(c)), stdout);
printf("\n" "vendor release number: %d", (int) XCBGetSetup(c)->release_number);
- // "\n" "XFree86 version: %d.%d.%d.%d"
+ /* "\n" "XFree86 version: %d.%d.%d.%d" */
printf("\n" "maximum request size: %d bytes", XCBGetSetup(c)->maximum_request_length * 4);
printf("\n" "motion buffer size: %d", (int)XCBGetSetup(c)->motion_buffer_size);
printf("\n" "bitmap unit, bit order, padding: %d, %s, %d", XCBGetSetup(c)->bitmap_format_scanline_unit, (XCBGetSetup(c)->bitmap_format_bit_order == LSBFirst) ? "LSBFirst" : "MSBFirst", XCBGetSetup(c)->bitmap_format_scanline_pad);
More information about the xcb-commit
mailing list