+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+ button.c for the Openbox window manager
+ Copyright (c) 2012 Mikael Magnusson
+ Copyright (c) 2012 Dana Jansens
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ See the COPYING file for a copy of the GNU General Public License.
+*/
+
#include "render.h"
-#include "button.h"
#include "instance.h"
+#include "mask.h"
#include <X11/Xlib.h>
#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;
}
void RrButtonFree(RrButton *b)
-{
- b->ref--;
- if (b->ref <= 0)
- RrButtonFreeReal(b);
-}
-
-void RrButtonFreeReal(RrButton* b)
{
/* colors */
if (b->focused_unpressed_color)
RrColorFree(b->toggled_unfocused_unpressed_color);
/* masks */
+ if (b->mask) RrPixmapMaskFree(b->mask);
+ if (b->pressed_mask) RrPixmapMaskFree(b->pressed_mask);
+ if (b->disabled_mask) RrPixmapMaskFree(b->disabled_mask);
+ if (b->hover_mask) RrPixmapMaskFree(b->hover_mask);
+ if (b->toggled_mask) RrPixmapMaskFree(b->toggled_mask);
+ if (b->toggled_hover_mask) RrPixmapMaskFree(b->toggled_hover_mask);
+ if (b->toggled_pressed_mask) RrPixmapMaskFree(b->toggled_pressed_mask);
+
+ /* appearances */
+ RrAppearanceFree(b->a_focused_unpressed);
+ RrAppearanceFree(b->a_unfocused_unpressed);
+ RrAppearanceFree(b->a_focused_pressed);
+ RrAppearanceFree(b->a_unfocused_pressed);
+ RrAppearanceFree(b->a_disabled_focused);
+ RrAppearanceFree(b->a_disabled_unfocused);
+ RrAppearanceFree(b->a_hover_focused);
+ RrAppearanceFree(b->a_hover_unfocused);
+ RrAppearanceFree(b->a_toggled_focused_unpressed);
+ RrAppearanceFree(b->a_toggled_unfocused_unpressed);
+ RrAppearanceFree(b->a_toggled_focused_pressed);
+ RrAppearanceFree(b->a_toggled_unfocused_pressed);
+ RrAppearanceFree(b->a_toggled_hover_focused);
+ RrAppearanceFree(b->a_toggled_hover_unfocused);
}