use const Rect* not Rect const*
[dana/openbox.git] / openbox / popup.c
index 90ec32d..7d59d91 100644 (file)
@@ -31,7 +31,7 @@
 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;
@@ -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,7 +498,7 @@ ObPagerPopup *pager_popup_new(void)
 {
     ObPagerPopup *self;
 
-    self = g_new(ObPagerPopup, 1);
+    self = g_slice_new(ObPagerPopup);
     self->popup = popup_new();
 
     self->desks = 0;
@@ -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);
     }
 }