diff options
-rw-r--r-- | icccm/icccm.c | 8 | ||||
-rw-r--r-- | image/xcb_image.c | 63 | ||||
-rw-r--r-- | keysyms/keysyms.c | 2 | ||||
-rw-r--r-- | property/prop.c | 6 | ||||
-rw-r--r-- | wm/manage.c | 4 | ||||
-rw-r--r-- | wm/xcbwm-test.c | 16 |
6 files changed, 49 insertions, 50 deletions
diff --git a/icccm/icccm.c b/icccm/icccm.c index 46d2c5a..90e4870 100644 --- a/icccm/icccm.c +++ b/icccm/icccm.c @@ -12,7 +12,7 @@ SetWMName (XCBConnection *c, CARD32 name_len, const char *name) { - XCBChangeProperty(c, PropModeReplace, window, WM_NAME, encoding, 8, name_len, name); + XCBChangeProperty(c, XCBPropModeReplace, window, WM_NAME, encoding, 8, name_len, name); } int @@ -63,7 +63,7 @@ SetWMIconName (XCBConnection *c, CARD32 name_len, const char *name) { - XCBChangeProperty(c, PropModeReplace, window, WM_ICON_NAME, encoding, 8, name_len, name); + XCBChangeProperty(c, XCBPropModeReplace, window, WM_ICON_NAME, encoding, 8, name_len, name); } void @@ -416,7 +416,7 @@ SetWMSizeHints (XCBConnection *c, XCBATOM property, SizeHints *hints) { - XCBChangeProperty(c, PropModeReplace, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints); + XCBChangeProperty(c, XCBPropModeReplace, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints); } int @@ -752,7 +752,7 @@ SetWMProtocols (XCBConnection *c, proto = InternAtomFast(c, 0, sizeof("WM_PROTOCOLS") - 1, "WM_PROTOCOLS"); WM_PROTOCOLS = InternAtomFastReply(c, proto, 0); - XCBChangeProperty(c, PropModeReplace, window, WM_PROTOCOLS, ATOM, 32, list_len, list); + XCBChangeProperty(c, XCBPropModeReplace, window, WM_PROTOCOLS, ATOM, 32, list_len, list); } int diff --git a/image/xcb_image.c b/image/xcb_image.c index ec0f8e1..40e4b2a 100644 --- a/image/xcb_image.c +++ b/image/xcb_image.c @@ -84,6 +84,15 @@ xcb_scanline_pad_get (XCBConnection *conn, /* return XCBGetSetup (conn)->bitmap_format_scanline_pad; */ } +static int format_invalid(CARD8 depth, CARD8 format, CARD8 xpad) +{ + return (depth == 0 || depth > 32 || + (format != XCBImageFormatXYBitmap && + format != XCBImageFormatXYPixmap && + format != XCBImageFormatZPixmap) || + (format == XCBImageFormatXYBitmap && depth != 1) || + (xpad != 8 && xpad != 16 && xpad != 32)); +} XCBImage * XCBImageCreate (XCBConnection *conn, @@ -100,10 +109,7 @@ XCBImageCreate (XCBConnection *conn, XCBConnSetupSuccessRep *rep; CARD8 bpp = 1; /* bits per pixel */ - if (depth == 0 || depth > 32 || - (format != XYBitmap && format != XYPixmap && format != ZPixmap) || - (format == XYBitmap && depth != 1) || - (xpad != 8 && xpad != 16 && xpad != 32)) + if (format_invalid(depth, format, xpad)) return (XCBImage *) NULL; image = (XCBImage *)malloc (sizeof (XCBImage)); @@ -120,7 +126,7 @@ XCBImageCreate (XCBConnection *conn, image->bitmap_format_bit_order = rep->bitmap_format_bit_order; image->bitmap_format_scanline_pad = xpad; - if (format == ZPixmap) + if (format == XCBImageFormatZPixmap) { bpp = xcb_bits_per_pixel (conn, depth); } @@ -134,7 +140,7 @@ XCBImageCreate (XCBConnection *conn, */ if (bytes_per_line == 0) { - if (format == ZPixmap) + if (format == XCBImageFormatZPixmap) image->bytes_per_line = xcb_bytes_per_line (image->bitmap_format_scanline_pad, width, bpp); @@ -154,14 +160,7 @@ XCBImageCreate (XCBConnection *conn, int XCBImageInit (XCBImage *image) { - if ((image->depth == 0 || image->depth > 32) || - (image->format != XYBitmap && - image->format != XYPixmap && - image->format != ZPixmap) || - (image->format == XYBitmap && image->depth != 1) || - (image->bitmap_format_scanline_pad != 8 && - image->bitmap_format_scanline_pad != 16 && - image->bitmap_format_scanline_pad != 32)) + if (format_invalid(image->depth, image->format, image->bitmap_format_scanline_pad)) return 0; /* @@ -169,7 +168,7 @@ XCBImageInit (XCBImage *image) */ if (image->bytes_per_line == 0) { - if (image->format == ZPixmap) + if (image->format == XCBImageFormatZPixmap) image->bytes_per_line = xcb_bytes_per_line (image->bitmap_format_scanline_pad, image->width, @@ -224,7 +223,7 @@ XCBImageGet (XCBConnection *conn, return NULL; memcpy(data, XCBGetImageData (rep), XCBGetImageDataLength (rep)); - if (format == XYPixmap) + if (format == XCBImageFormatXYPixmap) { image = XCBImageCreate (conn, Ones (plane_mask & _lomask(rep->depth)), @@ -235,11 +234,11 @@ XCBImageGet (XCBConnection *conn, xcb_scanline_pad_get (conn, rep->depth), 0); } - else /* format == ZPixmap */ + else /* format == XCBImageFormatZPixmap */ { image = XCBImageCreate (conn, rep->depth, - ZPixmap, + XCBImageFormatZPixmap, 0, data, width, height, @@ -296,7 +295,7 @@ XCBImagePut (XCBConnection *conn, if ((w <= 0) || (h <= 0)) return 0; - if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) + if ((image->bits_per_pixel == 1) || (image->format != XCBImageFormatZPixmap)) { dest_bits_per_pixel = 1; dest_scanline_pad = XCBGetSetup (conn)->bitmap_format_scanline_pad; @@ -327,7 +326,7 @@ XCBImagePut (XCBConnection *conn, img.width = width; img.height = height; img.xoffset = 0; - img.format = ZPixmap; + img.format = XCBImageFormatZPixmap; img.image_byte_order = rep->image_byte_order; img.bitmap_format_scanline_unit = rep->bitmap_format_scanline_unit; img.bitmap_format_bit_order = rep->bitmap_format_bit_order; @@ -404,7 +403,7 @@ XCBImageSHMCreate (XCBConnection *conn, image->bitmap_format_bit_order = rep->bitmap_format_bit_order; image->bitmap_format_scanline_pad = xcb_scanline_pad_get (conn, depth); - if (format == ZPixmap) + if (format == XCBImageFormatZPixmap) image->bits_per_pixel = xcb_bits_per_pixel (conn, depth); else image->bits_per_pixel = 1; @@ -487,13 +486,13 @@ XCBImageSHMGet (XCBConnection *conn, static inline int XYINDEX (int x, XCBImage *img, int *bitp) { - int mask = img->bitmap_format_scanline_unit - 1; + int mask = img->bitmap_format_scanline_unit - 1; int unit = (x + img->xoffset) & ~mask; int byte = (x + img->xoffset) & mask; - if (img->bitmap_format_bit_order == MSBFirst) + if (img->bitmap_format_bit_order == XCBImageOrderMSBFirst) byte = img->bitmap_format_scanline_unit - byte; *bitp = byte & 7; - if (img->image_byte_order == MSBFirst) + if (img->image_byte_order == XCBImageOrderMSBFirst) byte = img->bitmap_format_scanline_unit - byte; return (unit + byte) >> 3; } @@ -516,7 +515,7 @@ XCBImagePutPixel (XCBImage *image, int x, int y, CARD32 pixel) { register BYTE *src = image->data + (y * image->bytes_per_line); - if (image->format == XYPixmap || (image->bits_per_pixel | image->depth) == 1) + if (image->format == XCBImageFormatXYPixmap || (image->bits_per_pixel | image->depth) == 1) { int plane, bit; /* do least signif plane 1st */ @@ -528,7 +527,7 @@ XCBImagePutPixel (XCBImage *image, int x, int y, CARD32 pixel) } } else - if (image->format == ZPixmap) + if (image->format == XCBImageFormatZPixmap) { src += ZINDEX(x, image); if (image->bits_per_pixel == 4) @@ -538,7 +537,7 @@ XCBImagePutPixel (XCBImage *image, int x, int y, CARD32 pixel) /* if x is odd and byte order is LSB, or * if x is even and byte order is MSB, then * want high nibble; else want low nibble. */ - if ((x & 1) == (image->image_byte_order == LSBFirst)) + if ((x & 1) == (image->image_byte_order == XCBImageOrderLSBFirst)) { mask = ~mask; pixel <<= 4; @@ -548,7 +547,7 @@ XCBImagePutPixel (XCBImage *image, int x, int y, CARD32 pixel) else { int nbytes = image->bits_per_pixel >> 3; - int rev = image->image_byte_order == MSBFirst; + int rev = image->image_byte_order == XCBImageOrderMSBFirst; if(rev) src += nbytes - 1; while (--nbytes >= 0) @@ -575,7 +574,7 @@ XCBImageGetPixel (XCBImage *image, int x, int y) CARD32 pixel = 0; register BYTE *src = image->data + (y * image->bytes_per_line); - if (image->format == XYPixmap || (image->bits_per_pixel | image->depth) == 1) + if (image->format == XCBImageFormatXYPixmap || (image->bits_per_pixel | image->depth) == 1) { int plane, bit; src += XYINDEX(x, image, &bit); @@ -587,7 +586,7 @@ XCBImageGetPixel (XCBImage *image, int x, int y) } } else - if (image->format == ZPixmap) + if (image->format == XCBImageFormatZPixmap) { src += ZINDEX(x, image); if (image->bits_per_pixel == 4) @@ -596,13 +595,13 @@ XCBImageGetPixel (XCBImage *image, int x, int y) /* if x is odd and byte order is LSB, or * if x is even and byte order is MSB, then * want high nibble; else want low nibble. */ - if ((x & 1) == (image->image_byte_order == LSBFirst)) + if ((x & 1) == (image->image_byte_order == XCBImageOrderLSBFirst)) pixel >>= 4; } else { int nbytes = image->bits_per_pixel >> 3; - int rev = image->image_byte_order == MSBFirst; + int rev = image->image_byte_order == XCBImageOrderMSBFirst; if(rev) src += nbytes - 1; while (--nbytes >= 0) diff --git a/keysyms/keysyms.c b/keysyms/keysyms.c index e3012d5..926e40d 100644 --- a/keysyms/keysyms.c +++ b/keysyms/keysyms.c @@ -177,7 +177,7 @@ int XCBRefreshKeyboardMapping (XCBKeySymbols *syms, XCBMappingNotifyEvent *event) { - if (event->request == MappingKeyboard && syms) { + if (event->request == XCBMappingKeyboard && syms) { if (syms->tag == TAG_VALUE) { XCBKEYCODE min_keycode; XCBKEYCODE max_keycode; diff --git a/property/prop.c b/property/prop.c index e5375dd..cb857ca 100644 --- a/property/prop.c +++ b/property/prop.c @@ -24,7 +24,7 @@ struct PropertyHandlers { XCBGetPropertyCookie GetAnyProperty(XCBConnection *c, BOOL del, XCBWINDOW window, XCBATOM name, CARD32 long_len) { - static const XCBATOM type = { AnyPropertyType }; + static const XCBATOM type = { XCBGetPropertyTypeAny }; return XCBGetProperty(c, del, window, name, type, 0, long_len); } @@ -32,7 +32,7 @@ static int callHandler(XCBConnection *c, BYTE state, XCBWINDOW window, XCBATOM a { XCBGetPropertyRep *propr = 0; int ret; - if(state != PropertyDelete) + if(state != XCBPropertyDelete) { XCBGetPropertyCookie cookie = GetAnyProperty(c, 0, window, atom, h->long_len); propr = XCBGetPropertyReply(c, cookie, 0); @@ -129,5 +129,5 @@ int rootOfScreen(XCBConnection *c, int screen, XCBWINDOW *root) XCBVoidCookie sendToWindow(XCBConnection *c, XCBWINDOW root, const XCBClientMessageEvent *ev) { - return XCBSendEvent(c, /* propagate */ 0, root, SubstructureNotifyMask | SubstructureRedirectMask, (const char *) ev); + return XCBSendEvent(c, /* propagate */ 0, root, XCBEventMaskSubstructureNotify | XCBEventMaskSubstructureRedirect, (const char *) ev); } diff --git a/wm/manage.c b/wm/manage.c index b196055..68d85a8 100644 --- a/wm/manage.c +++ b/wm/manage.c @@ -16,7 +16,7 @@ void manageWindow(PropertyHandlers *prophs, XCBConnection *c, XCBWINDOW window, attr = XCBGetWindowAttributesReply(c, wa.u.cookie, 0); if(!attr) return; - if(attr->map_state != IsViewable) + if(attr->map_state != XCBMapStateViewable) { printf("Window 0x%08lx is not mapped. Ignoring.\n", window.xid); free(attr); @@ -48,7 +48,7 @@ void manageWindow(PropertyHandlers *prophs, XCBConnection *c, XCBWINDOW window, if(attr && geom) { reparentWindow(c, window, attr->visual, geom->root, geom->depth, geom->x, geom->y, geom->width, geom->height); - PropertyChanged(prophs, PropertyNewValue, window, WM_NAME); + PropertyChanged(prophs, XCBPropertyNewValue, window, WM_NAME); } free(attr); free(geom); diff --git a/wm/xcbwm-test.c b/wm/xcbwm-test.c index 1de4ac2..c2455a2 100644 --- a/wm/xcbwm-test.c +++ b/wm/xcbwm-test.c @@ -50,7 +50,7 @@ static int handleButtonReleaseEvent(void *data, XCBConnection *c, XCBButtonRelea } values[0] = /* x */ e->root_x; values[1] = /* y */ e->root_y; - XCBConfigureWindow(c, e->event, CWX | CWY, values); + XCBConfigureWindow(c, e->event, XCBConfigWindowX | XCBConfigWindowY, values); XCBFlush(c); move_from_x = -1; move_from_y = -1; @@ -93,19 +93,19 @@ void reparentWindow(XCBConnection *c, XCBWINDOW child, values[1] = 1; mask |= XCBCWEventMask; - values[2] = ButtonPressMask | ButtonReleaseMask - | ExposureMask /* | EnterWindowMask | LeaveWindowMask */; + values[2] = XCBEventMaskButtonPress | XCBEventMaskButtonRelease + | XCBEventMaskExposure /* | XCBEventMaskEnterWindow | XCBEventMaskLeaveWindow */; printf("Reparenting 0x%08lx under 0x%08lx.\n", child.xid, w.xid); XCBCreateWindow(c, d, w, r, x, y, width + LEFT + RIGHT, height + TOP + BOTTOM, - /* border_width */ 0, InputOutput, v, mask, values); - XCBChangeSaveSet(c, SetModeInsert, child); + /* border_width */ 0, XCBWindowClassInputOutput, v, mask, values); + XCBChangeSaveSet(c, XCBSetModeInsert, child); XCBMapWindow(c, w); titlegc = XCBGCONTEXTNew(c); - mask = GCForeground | GCBackground; + mask = XCBGCForeground | XCBGCBackground; values[0] = root->black_pixel; values[1] = root->white_pixel; drawable.window = w; @@ -115,7 +115,7 @@ void reparentWindow(XCBConnection *c, XCBWINDOW child, XCBReparentWindow(c, child, w, LEFT - 1, TOP - 1); mask = XCBCWEventMask; - values[0] = PropertyChangeMask | StructureNotifyMask; + values[0] = XCBEventMaskPropertyChange | XCBEventMaskStructureNotify; XCBChangeWindowAttributes(c, child, mask, values); XCBFlush(c); @@ -212,7 +212,7 @@ int main(int argc, char **argv) { CARD32 mask = XCBCWEventMask; - CARD32 values[] = { SubstructureNotifyMask | PropertyChangeMask }; + CARD32 values[] = { XCBEventMaskSubstructureNotify | XCBEventMaskPropertyChange }; XCBChangeWindowAttributes(c, root, mask, values); } XCBFlush(c); |