use const Rect* not Rect const*
[dana/openbox.git] / openbox / popup.c
index 47d0d0f..7d59d91 100644 (file)
 #include "stacking.h"
 #include "event.h"
 #include "screen.h"
-#include "render/render.h"
-#include "render/theme.h"
+#include "obrender/render.h"
+#include "obrender/theme.h"
 
 ObPopup *popup_new(void)
 {
     XSetWindowAttributes attrib;
-    ObPopup *self = g_new0(ObPopup, 1);
+    ObPopup *self = g_slice_new0(ObPopup);
 
     self->obwin.type = OB_WINDOW_CLASS_INTERNAL;
     self->gravity = NorthWestGravity;
     self->x = self->y = self->textw = self->h = 0;
-    self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
+    self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_bg);
     self->a_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
     self->iconwm = self->iconhm = 1;
 
@@ -72,7 +72,7 @@ void popup_free(ObPopup *self)
         RrAppearanceFree(self->a_text);
         window_remove(self->bg);
         stacking_remove(self);
-        g_free(self);
+        g_slice_free(ObPopup, self);
     }
 }
 
@@ -158,7 +158,8 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *text)
     gint emptyx, emptyy; /* empty space between elements */
     gint textx, texty, textw, texth;
     gint iconx, icony, iconw, iconh;
-    Rect *area, mon;
+    const Rect *area;
+    Rect mon;
     gboolean hasicon = self->hasicon;
 
     /* when there is no icon and the text is not parent relative, then
@@ -259,8 +260,6 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *text)
     x=MAX(MIN(x, area->x+area->width-w),area->x);
     y=MAX(MIN(y, area->y+area->height-h),area->y);
 
-    g_free(area);
-
     if (m == screen_num_monitors) {
         RECT_SET(mon, x, y, w, h);
         m = screen_find_monitor(&mon);
@@ -270,8 +269,6 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *text)
 
         x=MAX(MIN(x, area->x+area->width-w),area->x);
         y=MAX(MIN(y, area->y+area->height-h),area->y);
-
-        g_free(area);
     }
 
     /* set the windows/appearances up */
@@ -342,7 +339,7 @@ ObIconPopup *icon_popup_new(void)
 {
     ObIconPopup *self;
 
-    self = g_new0(ObIconPopup, 1);
+    self = g_slice_new0(ObIconPopup);
     self->popup = popup_new();
     self->a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex);
     self->icon = XCreateWindow(obt_display, self->popup->bg,
@@ -364,7 +361,7 @@ void icon_popup_free(ObIconPopup *self)
         XDestroyWindow(obt_display, self->icon);
         RrAppearanceFree(self->a_icon);
         popup_free(self->popup);
-        g_free(self);
+        g_slice_free(ObIconPopup, self);
     }
 }
 
@@ -501,13 +498,13 @@ ObPagerPopup *pager_popup_new(void)
 {
     ObPagerPopup *self;
 
-    self = g_new(ObPagerPopup, 1);
+    self = g_slice_new(ObPagerPopup);
     self->popup = popup_new();
 
     self->desks = 0;
     self->wins = g_new(Window, self->desks);
-    self->hilight = RrAppearanceCopy(ob_rr_theme->osd_hilite_fg);
-    self->unhilight = RrAppearanceCopy(ob_rr_theme->osd_unhilite_fg);
+    self->hilight = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
+    self->unhilight = RrAppearanceCopy(ob_rr_theme->osd_unhilite_bg);
 
     self->popup->hasicon = TRUE;
     self->popup->draw_icon = pager_popup_draw_icon;
@@ -527,7 +524,7 @@ void pager_popup_free(ObPagerPopup *self)
         RrAppearanceFree(self->hilight);
         RrAppearanceFree(self->unhilight);
         popup_free(self->popup);
-        g_free(self);
+        g_slice_free(ObPagerPopup, self);
     }
 }