]> Dogcows Code - chaz/openbox/blobdiff - render/render.c
only hilight the first entry when opening the menu with a keybind
[chaz/openbox] / render / render.c
index ecb07ada2b6ab200c27eed69ddaafc9541790e87..8623455f6c06091e6c55335ca48531eb393b8f5b 100644 (file)
@@ -40,9 +40,9 @@ static void pixel_data_to_pixmap(RrAppearance *l,
 
 Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
 {
-    gint i, transferred = 0, sw, sh, partial_w, partial_h;
+    gint i, transferred = 0, sw, sh, partial_w, partial_h, force_transfer = 0;
     RrPixel32 *source, *dest;
-    Pixmap oldp;
+    Pixmap oldp = None;
     RrRect tarea; /* area in which to draw textures */
     gboolean resized;
 
@@ -77,8 +77,10 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
                                RrVisual(a->inst), RrColormap(a->inst));
     g_assert(a->xftdraw != NULL);
 
-    g_free(a->surface.pixel_data);
-    a->surface.pixel_data = g_new(RrPixel32, w * h);
+    if (resized) {
+        g_free(a->surface.pixel_data);
+        a->surface.pixel_data = g_new(RrPixel32, w * h);
+    }
 
     if (a->surface.grad == RR_SURFACE_PARENTREL) {
         g_assert (a->surface.parent);
@@ -158,14 +160,18 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
                         &a->texture[i].data.rgba,
                         a->w, a->h,
                         &tarea);
+            force_transfer = 1;
         break;
         }
     }
 
     if (!transferred) {
         transferred = 1;
-        if ((a->surface.grad != RR_SURFACE_SOLID) || (a->surface.interlaced))
+        if ((a->surface.grad != RR_SURFACE_SOLID) || (a->surface.interlaced) ||
+            force_transfer)
+        {
             pixel_data_to_pixmap(a, 0, 0, w, h);
+        }
     }
 
     return oldp;
@@ -194,6 +200,14 @@ RrAppearance *RrAppearanceNew(const RrInstance *inst, gint numtex)
   return out;
 }
 
+void RrAppearanceAddTextures(RrAppearance *a, gint numtex)
+{
+    g_assert(a->textures == 0);
+
+    a->textures = numtex;
+    if (numtex) a->texture = g_new0(RrTexture, numtex);
+}
+
 RrAppearance *RrAppearanceCopy(RrAppearance *orig)
 {
     RrSurface *spo, *spc;
This page took 0.021983 seconds and 4 git commands to generate.