From e41cc47f78f239aa16e8afcd018fc67b956d4083 Mon Sep 17 00:00:00 2001 From: Ian Osgood Date: Wed, 15 Mar 2006 10:09:47 -0800 Subject: [PATCH] Remove proto/X11 dependencies from xcb-demo. --- hypnomoire.c | 18 +++++++++--------- main.c | 15 ++++++++------- rendertest.c | 2 +- xcbrandr.c | 9 ++++----- xdpyinfo.c | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/hypnomoire.c b/hypnomoire.c index 0b47d83..ffd4a5e 100644 --- a/hypnomoire.c +++ b/hypnomoire.c @@ -60,7 +60,7 @@ int main() pthread_t thr; int i; - CARD32 mask = GCForeground | GCGraphicsExposures; + CARD32 mask = XCBGCForeground | XCBGCGraphicsExposures; CARD32 values[2]; XCBDRAWABLE rootwin; int screen_num; @@ -130,13 +130,13 @@ void *run(void *param) CARD32 values[3]; XCBRECTANGLE rect = { 0, 0, windows[idx].width, windows[idx].height }; values[0] = root->white_pixel; - values[1] = ButtonReleaseMask | ExposureMask; - values[2] = ButtonPressMask; + values[1] = XCBEventMaskButtonRelease | XCBEventMaskExposure; + values[2] = XCBEventMaskButtonPress; XCBCreateWindow(c, depth, windows[idx].w.window, root->root, /* x */ 0, /* y */ 0, windows[idx].width, windows[idx].height, - /* border */ 0, InputOutput, + /* border */ 0, XCBWindowClassInputOutput, /* visual */ root->root_visual, mask, values); @@ -155,12 +155,12 @@ void *run(void *param) { line[1].x = xo + r * cos(theta); line[1].y = yo + r * sin(theta); - XCBPolyLine(c, CoordModeOrigin, windows[idx].p, black, + XCBPolyLine(c, XCBCoordModeOrigin, windows[idx].p, black, 2, line); line[1].x = xo + r * cos(theta + LAG); line[1].y = yo + r * sin(theta + LAG); - XCBPolyLine(c, CoordModeOrigin, windows[idx].p, white, + XCBPolyLine(c, XCBCoordModeOrigin, windows[idx].p, white, 2, line); paint(idx); @@ -216,11 +216,11 @@ void *event_thread(void *param) fprintf(stderr, "ButtonRelease on unknown window!\n"); else { - if(bre->detail.id == Button1) + if(bre->detail.id == XCBButton1) windows[idx].angv = -windows[idx].angv; - else if(bre->detail.id == Button4) + else if(bre->detail.id == XCBButton4) windows[idx].angv += 0.001; - else if(bre->detail.id == Button5) + else if(bre->detail.id == XCBButton5) windows[idx].angv -= 0.001; } } diff --git a/main.c b/main.c index 0a81a57..205511b 100644 --- a/main.c +++ b/main.c @@ -87,22 +87,23 @@ int main(int argc, char **argv) values[1] = root->black_pixel; mask |= XCBCWBackingStore; - values[2] = Always; + values[2] = XCBBackingStoreAlways; mask |= XCBCWOverrideRedirect; values[3] = 0; mask |= XCBCWEventMask; - values[4] = ButtonReleaseMask | ExposureMask | StructureNotifyMask - | EnterWindowMask | LeaveWindowMask; + values[4] = XCBEventMaskButtonRelease + | XCBEventMaskExposure | XCBEventMaskStructureNotify + | XCBEventMaskEnterWindow | XCBEventMaskLeaveWindow; mask |= XCBCWDontPropagate; - values[5] = ButtonPressMask; + values[5] = XCBEventMaskButtonPress; XCBCreateWindow(c, /* depth */ 0, window, root->root, /* x */ 20, /* y */ 200, /* width */ 150, /* height */ 150, - /* border_width */ 10, /* class */ InputOutput, + /* border_width */ 10, /* class */ XCBWindowClassInputOutput, /* visual */ root->root_visual, mask, values); #ifdef TEST_ICCCM atom[0] = XCBInternAtom(c, 0, sizeof("WM_PROTOCOLS")-1, "WM_PROTOCOLS"); @@ -112,14 +113,14 @@ int main(int argc, char **argv) { XCBATOM XA_WM_NAME = { 39 }; XCBATOM XA_STRING = { 31 }; - XCBChangeProperty(c, PropModeReplace, window, XA_WM_NAME, XA_STRING, 8, strlen(argv[0]), argv[0]); + XCBChangeProperty(c, XCBPropModeReplace, window, XA_WM_NAME, XA_STRING, 8, strlen(argv[0]), argv[0]); } if(atomrep[0] && atomrep[1]) { XCBATOM WM_PROTOCOLS = atomrep[0]->atom; XCBATOM WM_DELETE_WINDOW = atomrep[1]->atom; XCBATOM XA_ATOM = { 4 }; - XCBChangeProperty(c, PropModeReplace, window, WM_PROTOCOLS, XA_ATOM, 32, 1, &WM_DELETE_WINDOW); + XCBChangeProperty(c, XCBPropModeReplace, window, WM_PROTOCOLS, XA_ATOM, 32, 1, &WM_DELETE_WINDOW); } free(atomrep[0]); free(atomrep[1]); diff --git a/rendertest.c b/rendertest.c index 9a2840d..73b0ef3 100644 --- a/rendertest.c +++ b/rendertest.c @@ -186,7 +186,7 @@ int draw_window(XCBConnection *conn, XCBRenderQueryPictFormatsRep *reply) 0, 0, /* x and y */ 600, 600, /* width and height */ 0, /* border width */ - InputOutput, /* class */ + XCBWindowClassInputOutput, /* class */ root->root_visual, /* XCBVISUALID */ value_mask, value_list); /* LISTofVALUES */ diff --git a/xcbrandr.c b/xcbrandr.c index 44b3f3e..17aab3f 100644 --- a/xcbrandr.c +++ b/xcbrandr.c @@ -137,7 +137,7 @@ main (int argc, char **argv) int width = 0, height = 0; int have_pixel_size = 0; XCBGenericError *err; - CARD16 mask = (CARD16) StructureNotifyMask; + CARD16 mask = (CARD16) XCBEventMaskStructureNotify; CARD32 values[1]; XCBRandRGetScreenInfoCookie scookie; int major_version, minor_version; @@ -409,9 +409,6 @@ main (int argc, char **argv) XRRUpdateConfiguration (&event); #endif - if (event->response_type == ConfigureNotify) - printf("Received ConfigureNotify Event!\n"); - switch (event->response_type - event_base) { case XCBRandRScreenChangeNotify: sce = (XCBRandRScreenChangeNotifyEvent *) event; @@ -437,7 +434,9 @@ main (int argc, char **argv) else printf ("new Subpixel rendering model is %s\n", order[spo]); break; default: - if (event->response_type != ConfigureNotify) + if (event->response_type == XCBConfigureNotify) + printf("Received ConfigureNotify Event!\n"); + else printf("unknown event received, type = %d!\n", event->response_type); } } diff --git a/xdpyinfo.c b/xdpyinfo.c index 3b3717d..ba45862 100644 --- a/xdpyinfo.c +++ b/xdpyinfo.c @@ -51,8 +51,8 @@ void print_setup() /* "\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); - printf("\n" "image byte order: %s", (XCBGetSetup(c)->image_byte_order == LSBFirst) ? "LSBFirst" : "MSBFirst"); + printf("\n" "bitmap unit, bit order, padding: %d, %s, %d", XCBGetSetup(c)->bitmap_format_scanline_unit, (XCBGetSetup(c)->bitmap_format_bit_order == XCBImageOrderLSBFirst) ? "LSBFirst" : "MSBFirst", XCBGetSetup(c)->bitmap_format_scanline_pad); + printf("\n" "image byte order: %s", (XCBGetSetup(c)->image_byte_order == XCBImageOrderLSBFirst) ? "LSBFirst" : "MSBFirst"); print_formats(); -- 2.34.1