X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=obrender%2Fbutton.c;h=35437afdc961be49840e720b3d0e411808f1e637;hb=c5c924f7f794d4f8ad0890f1930e1efbeebf6e0c;hp=5d3f92035c72cae5448c8e806e2ed3443d6f26d4;hpb=6d30d66efb028fbafb58712aa5b71cadfeef2e32;p=chaz%2Fopenbox diff --git a/obrender/button.c b/obrender/button.c index 5d3f9203..35437afd 100644 --- a/obrender/button.c +++ b/obrender/button.c @@ -1,20 +1,36 @@ +/* -*- 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 #include #include -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; @@ -61,13 +77,6 @@ RrButton *RrButtonNew (const RrInstance *inst) } void RrButtonFree(RrButton *b) -{ - b->ref--; - if (b->ref <= 0) - RrButtonFreeReal(b); -} - -void RrButtonFreeReal(RrButton* b) { /* colors */ if (b->focused_unpressed_color) @@ -100,4 +109,27 @@ void RrButtonFreeReal(RrButton* b) 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); }