summaryrefslogtreecommitdiff
path: root/src/skins/draw-compat.h
blob: 4c7a44cb860c21b24751361ad70ad5ff375748c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * draw-compat.h
 * Copyright 2011 John Lindgren
 *
 * This file is part of Audacious.
 *
 * Audacious 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, version 2 or version 3 of the License.
 *
 * Audacious 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.
 *
 * You should have received a copy of the GNU General Public License along with
 * Audacious. If not, see <http://www.gnu.org/licenses/>.
 *
 * The Audacious team does not consider modular code linking to Audacious or
 * using our public API to be a derived work.
 */

#ifndef SKINS_DRAW_COMPAT_H
#define SKINS_DRAW_COMPAT_H

#include <gtk/gtk.h>

static void widget_realized (GtkWidget * w)
{
    GdkWindow * window = gtk_widget_get_window (w);
    gdk_window_set_background_pattern (window, NULL);
}

#define DRAW_SIGNAL "draw"
#define DRAW_FUNC_BEGIN(n) static gboolean n (GtkWidget * wid, cairo_t * cr) { \
 g_return_val_if_fail (wid && cr, FALSE);
#define DRAW_FUNC_END return FALSE; }

#define DRAW_CONNECT(w,f) do { \
    g_signal_connect (w, "realize", (GCallback) widget_realized, NULL); \
    g_signal_connect (w, DRAW_SIGNAL, (GCallback) f, NULL); \
 } while (0);

#endif