#include <X11/Xutil.h>
#include <string.h>
-static void RrButtonFreeReal(RrButton* b);
-
RrButton *RrButtonNew (const RrInstance *inst)
{
RrButton *out = NULL;
out = g_new(RrButton, 1);
out->inst = inst;
- out->ref = 1;
/* no need to alloc colors, set them null (for freeing later) */
out->focused_unpressed_color = NULL;
return out;
}
-void RrButtonFree(RrButton *b)
-{
- b->ref--;
- if (b->ref <= 0)
- RrButtonFreeReal(b);
-}
-
-void RrButtonFreeReal(RrButton* b)
+void RrButtonFree(RrButton* b)
{
/* colors */
if (b->focused_unpressed_color)
RrColorFree(b->toggled_unfocused_unpressed_color);
/* masks */
+ if (mask) RrPixmapMaskFree(mask);
+ if (pressed_mask) RrPixmapMaskFree(pressed_mask);
+ if (disabled_mask) RrPixmapMaskFree(disabled_mask);
+ if (hover_mask) RrPixmapMaskFree(hover_mask);
+ if (toggled_mask) RrPixmapMaskFree(toggled_mask);
+ if (toggled_hover_mask) RrPixmapMaskFree(toggled_hover_mask);
+ if (toggled_pressed_mask) RrPixmapMaskFree(toggled_pressed_mask);
+
+ /* appearances */
+ RrAppearanceFree(a_focused_unpressed);
+ RrAppearanceFree(a_unfocused_unpressed);
+ RrAppearanceFree(a_focused_pressed);
+ RrAppearanceFree(a_unfocused_pressed);
+ RrAppearanceFree(a_disabled_focused);
+ RrAppearanceFree(a_disabled_unfocused);
+ RrAppearanceFree(a_hover_focused);
+ RrAppearanceFree(a_hover_unfocused);
+ RrAppearanceFree(a_toggled_focused_unpressed);
+ RrAppearanceFree(a_toggled_unfocused_unpressed);
+ RrAppearanceFree(a_toggled_focused_pressed);
+ RrAppearanceFree(a_toggled_unfocused_pressed);
+ RrAppearanceFree(a_toggled_hover_focused);
+ RrAppearanceFree(a_toggled_hover_unfocused);
}
struct _RrAppearance {
const RrInstance *inst;
- gint ref;
-
RrSurface surface;
gint textures;
RrTexture *texture;
GC RrColorGC (RrColor *c);
RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
-RrAppearance *RrAppearanceCopyShallow (RrAppearance *a);
RrAppearance *RrAppearanceCopy (RrAppearance *a);
void RrAppearanceFree (RrAppearance *a);
void RrAppearanceRemoveTextures(RrAppearance *a);