efl - ecore-x - work around e's badness in makeing an x image for all wins
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 27 Jul 2016 01:32:41 +0000 (10:32 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 27 Jul 2016 01:32:41 +0000 (10:32 +0900)
so e is being stupid and creating an ecore-x image forevery single
window if in x11 mode if it needs it or not. this results in having ti
allocate an actual x image and shm segments. work around this and get
bit order from somewhere else than the x image itself thus avoiding
the allocation until a real get or put is done.

@fix

src/lib/ecore_x/xcb/ecore_xcb_image.c
src/lib/ecore_x/xlib/ecore_x_image.c

index b6ac6ff..7c21781 100644 (file)
@@ -245,7 +245,6 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im)
    CHECK_XCB_CONN;
 
    vis = (xcb_visualtype_t *)im->vis;
-   if (!im->xim) _ecore_xcb_image_shm_create(im);
 
    if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) ||
         (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) &&
@@ -254,10 +253,13 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im)
        (vis->green_mask == 0x00ff00) && 
        (vis->blue_mask == 0x0000ff))
      {
+        const xcb_setup_t *setup = xcb_get_setup(_ecore_xcb_conn);
+
+        if (!setup) return EINA_FALSE;
 #ifdef WORDS_BIGENDIAN
-        if (im->xim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST) return EINA_TRUE;
+        if (setup->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST) return EINA_TRUE;
 #else
-        if (im->xim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST) return EINA_TRUE;
+        if (setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST) return EINA_TRUE;
 #endif
      }
 
index 35ee976..6ce8919 100644 (file)
@@ -305,15 +305,13 @@ ecore_x_image_get(Ecore_X_Image *im,
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    if (im->shm)
      {
-        
-        if (!im->xim)
-          _ecore_x_image_shm_create(im);
+        if (!im->xim) _ecore_x_image_shm_create(im);
 
         if (!im->xim)
           return EINA_FALSE;
 
         _ecore_x_image_err = 0;
-        
+
         ecore_x_sync();
         // optimised path
         ph = XSetErrorHandler((XErrorHandler)_ecore_x_image_error_handler);
@@ -449,12 +447,6 @@ EAPI Eina_Bool
 ecore_x_image_is_argb32_get(Ecore_X_Image *im)
 {
    Visual *vis = im->vis;
-   if (!im->xim)
-     {
-        if (im->shm) _ecore_x_image_shm_create(im);
-        else _ecore_x_image_create(im);
-        if (!im->xim) return EINA_FALSE;
-     }
    if (((vis->class == TrueColor) ||
         (vis->class == DirectColor)) &&
        (im->bpp == 4) &&
@@ -463,9 +455,9 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im)
        (vis->blue_mask == 0x0000ff))
      {
 #ifdef WORDS_BIGENDIAN
-        if (im->xim->bitmap_bit_order == MSBFirst) return EINA_TRUE;
+        if (BitmapBitOrder(_ecore_x_disp) == MSBFirst) return EINA_TRUE;
 #else
-        if (im->xim->bitmap_bit_order == LSBFirst) return EINA_TRUE;
+        if (BitmapBitOrder(_ecore_x_disp) == LSBFirst) return EINA_TRUE;
 #endif
      }
    return EINA_FALSE;