From 8a79cd70126df3d0fdecb3b64b114fec225a9777 Mon Sep 17 00:00:00 2001 From: devilhorns Date: Sat, 20 Aug 2011 11:04:10 +0000 Subject: [PATCH] Ecore_X(cb): Use unchecked version for get_input_focus. Cache pixmap format for reuse so we don't have to keep iterating pixmap formats from the server setup (can be expensive). git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@62627 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_x/xcb/ecore_xcb.c | 3 ++- src/lib/ecore_x/xcb/ecore_xcb_image.c | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c index 25c7cee..a2362fd 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb.c +++ b/src/lib/ecore_x/xcb/ecore_xcb.c @@ -374,7 +374,8 @@ ecore_x_sync(void) LOGFN(__FILE__, __LINE__, __FUNCTION__); free(xcb_get_input_focus_reply(_ecore_xcb_conn, - xcb_get_input_focus(_ecore_xcb_conn), NULL)); + xcb_get_input_focus_unchecked(_ecore_xcb_conn), + NULL)); } EAPI void diff --git a/src/lib/ecore_x/xcb/ecore_xcb_image.c b/src/lib/ecore_x/xcb/ecore_xcb_image.c index ec2e26c..bd41f20 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_image.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_image.c @@ -621,34 +621,32 @@ _ecore_xcb_image_shm_create(Ecore_X_Image *im) static xcb_image_t * _ecore_xcb_image_create_native(int w, int h, xcb_image_format_t format, uint8_t depth, void *base, uint32_t bytes, uint8_t *data) { + static uint8_t dpth = 0; + static xcb_format_t *fmt = NULL; const xcb_setup_t *setup; - xcb_format_t *fmt = NULL; xcb_image_format_t xif; /* NB: We cannot use xcb_image_create_native as it only creates images - * using MSB_FIRST, so this routine recreates that function and checks - * endian-ness correctly */ + * using MSB_FIRST, so this routine recreates that function and uses + * the endian-ness of the server setup */ setup = xcb_get_setup(_ecore_xcb_conn); xif = format; if ((xif == XCB_IMAGE_FORMAT_Z_PIXMAP) && (depth == 1)) xif = XCB_IMAGE_FORMAT_XY_PIXMAP; - fmt = _ecore_xcb_image_find_format(setup, depth); - if (!fmt) return 0; + if (dpth != depth) + { + dpth = depth; + fmt = _ecore_xcb_image_find_format(setup, depth); + if (!fmt) return 0; + } switch (xif) { case XCB_IMAGE_FORMAT_XY_BITMAP: if (depth != 1) return 0; case XCB_IMAGE_FORMAT_XY_PIXMAP: - return xcb_image_create(w, h, xif, - fmt->scanline_pad, - fmt->depth, fmt->bits_per_pixel, - setup->bitmap_format_scanline_unit, - setup->image_byte_order, - setup->bitmap_format_bit_order, - base, bytes, data); case XCB_IMAGE_FORMAT_Z_PIXMAP: return xcb_image_create(w, h, xif, fmt->scanline_pad, -- 2.7.4