]> Dogcows Code - chaz/openbox/blobdiff - openbox/popup.c
simply the render interface by not requiring the setting of all the areas. only take...
[chaz/openbox] / openbox / popup.c
index 17462d39444ceeb7ff926fa79ecf9896c9c5865d..48c40f28a0b985e08fa76ea1afca0efa8fac3bc4 100644 (file)
@@ -34,7 +34,7 @@ Popup *popup_new(gboolean hasicon)
     self->gravity = NorthWestGravity;
     self->x = self->y = self->w = self->h = 0;
     self->mapped = FALSE;
-    stacking_add(self);
+    stacking_add(INTERNAL_AS_WINDOW(self));
     stacking_raise(INTERNAL_AS_WINDOW(self));
     return self;
 }
@@ -83,7 +83,7 @@ void popup_size_to_string(Popup *self, char *text)
 
     self->h = texth + theme_bevel * 2;
     iconw = (self->hasicon ? texth : 0);
-    self->w = textw + iconw + theme_bevel * 3;
+    self->w = textw + iconw + theme_bevel * (self->hasicon ? 3 : 2);
 }
 
 void popup_show(Popup *self, char *text, Icon *icon)
@@ -149,9 +149,9 @@ void popup_show(Popup *self, char *text, Icon *icon)
     iconw = (self->hasicon ? texth : 0);
     if (self->w) {
         w = self->w;
-        textw = w - (iconw + theme_bevel * 3);
+        textw = w - (iconw + theme_bevel * (self->hasicon ? 3 : 2));
     } else
-        w = textw + iconw + theme_bevel * 3;
+        w = textw + iconw + theme_bevel * (self->hasicon ? 3 : 2);
     /* sanity checks to avoid crashes! */
     if (w < 1) w = 1;
     if (h < 1) h = 1;
@@ -189,33 +189,29 @@ void popup_show(Popup *self, char *text, Icon *icon)
     }
 
     /* set the windows/appearances up */
-    RECT_SET(self->a_bg->area, 0, 0, w, h);
     XMoveResizeWindow(ob_display, self->bg, x, y, w, h);
 
-    RECT_SET(self->a_text->area, 0, 0, textw, texth); 
-    RECT_SET(self->a_text->texture[0].position, theme_bevel, theme_bevel,
-             textw - theme_bevel * 2, texth - theme_bevel * 2);
-    self->a_text->surface.data.planar.parent = self->a_bg;
-    self->a_text->surface.data.planar.parentx = iconw + theme_bevel * 2;
-    self->a_text->surface.data.planar.parenty = theme_bevel;
+    self->a_text->surface.parent = self->a_bg;
+    self->a_text->surface.parentx = iconw +
+        theme_bevel * (self->hasicon ? 2 : 1);
+    self->a_text->surface.parenty = theme_bevel;
     XMoveResizeWindow(ob_display, self->text,
-                      iconw + theme_bevel * 2, theme_bevel, textw, texth);
+                      iconw + theme_bevel * (self->hasicon ? 2 : 1),
+                      theme_bevel, textw, texth);
 
     if (self->hasicon) {
         if (iconw < 1) iconw = 1; /* sanity check for crashes */
-        RECT_SET(self->a_icon->area, 0, 0, iconw, texth);
-        RECT_SET(self->a_icon->texture[0].position, 0, 0, iconw, texth);
-        self->a_icon->surface.data.planar.parent = self->a_bg;
-        self->a_icon->surface.data.planar.parentx = theme_bevel;
-        self->a_icon->surface.data.planar.parenty = theme_bevel;
+        self->a_icon->surface.parent = self->a_bg;
+        self->a_icon->surface.parentx = theme_bevel;
+        self->a_icon->surface.parenty = theme_bevel;
         XMoveResizeWindow(ob_display, self->icon,
                           theme_bevel, theme_bevel, iconw, texth);
     }
 
-    paint(self->bg, self->a_bg);
-    paint(self->text, self->a_text);
+    paint(self->bg, self->a_bg, w, h);
+    paint(self->text, self->a_text, textw, texth);
     if (self->hasicon)
-        paint(self->icon, self->a_icon);
+        paint(self->icon, self->a_icon, iconw, texth);
 
     if (!self->mapped) {
         XMapWindow(ob_display, self->bg);
This page took 0.027015 seconds and 4 git commands to generate.