annotate audacious/widget.c @ 351:c6e9eb0ee70b trunk

[svn] filterchain stuff
author nenolod
date Mon, 26 Dec 2005 13:56:03 -0800
parents 580529c7e0c5
children f12d7e208b43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * Based on XMMS:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #include "widget.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 #include <gdk/gdk.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 #include "debug.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 widget_init(Widget * widget, GdkPixmap * parent, GdkGC * gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 gint x, gint y, gint width, gint height, gint visible)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 widget->parent = parent;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 widget->gc = gc;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 widget_set_position(widget, x, y);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 widget_set_size(widget, width, height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 widget->visible = visible;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 widget->redraw = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 widget->mutex = g_mutex_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 widget_set_position(Widget * widget, gint x, gint y)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 widget->x = x;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 widget->y = y;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 widget_queue_redraw(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 widget_set_size(Widget * widget, gint width, gint height)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 widget->width = width;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 widget->height = height;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 widget_queue_redraw(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 widget_queue_redraw(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 widget->redraw = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 widget_contains(Widget * widget, gint x, gint y)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 return (widget->visible &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 x >= widget->x &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 y >= widget->y &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 x < widget->x + widget->width &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 y < widget->y + widget->height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 widget_show(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 {
192
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
78 if (!widget)
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
79 return;
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
80
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 widget->visible = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 widget_draw(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 widget_hide(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 {
192
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
88 if (!widget)
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
89 return;
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
90
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 widget->visible = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 widget_is_visible(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 {
192
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
97 if (!widget)
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
98 return FALSE;
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
99
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 return widget->visible;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 widget_resize(Widget * widget, gint width, gint height)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 widget_set_size(widget, width, height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 widget_move(Widget * widget, gint x, gint y)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 widget_lock(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 widget_set_position(widget, x, y);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 widget_unlock(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 widget_draw(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 widget_lock(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 WIDGET(widget)->redraw = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 widget_unlock(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 void
237
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
126 widget_draw_quick(Widget * widget)
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
127 {
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
128 widget_lock(widget);
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
129 if (WIDGET(widget)->draw != NULL)
238
580529c7e0c5 [svn] Add gdk_flush() to widget_draw_quick().
nenolod
parents: 237
diff changeset
130 {
237
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
131 WIDGET(widget)->draw(widget);
238
580529c7e0c5 [svn] Add gdk_flush() to widget_draw_quick().
nenolod
parents: 237
diff changeset
132 gdk_flush();
580529c7e0c5 [svn] Add gdk_flush() to widget_draw_quick().
nenolod
parents: 237
diff changeset
133 }
237
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
134 widget_unlock(widget);
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
135 }
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
136
02c17a5c99e3 [svn] - Implement widget_draw_quick(widget_t *) for doing an immediate draw
nenolod
parents: 192
diff changeset
137 void
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 widget_list_add(GList ** list, Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 (*list) = g_list_append(*list, widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 handle_press_cb(GList * widget_list, GtkWidget * widget,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 GdkEventButton * event)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 if (WIDGET(wl->data)->button_press_cb)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 WIDGET(wl->data)->button_press_cb(widget, event, wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 handle_release_cb(GList * widget_list, GtkWidget * widget,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 GdkEventButton * event)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 if (WIDGET(wl->data)->button_release_cb)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 WIDGET(wl->data)->button_release_cb(widget, event, wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 handle_motion_cb(GList * widget_list, GtkWidget * widget,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 GdkEventMotion * event)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 if (WIDGET(wl->data)->motion_cb)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 WIDGET(wl->data)->motion_cb(widget, event, wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 handle_scroll_cb(GList * wlist, GtkWidget * widget, GdkEventScroll * event)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 for (wl = wlist; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 if (WIDGET(wl->data)->mouse_scroll_cb)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 WIDGET(wl->data)->mouse_scroll_cb(widget, event, wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 widget_list_draw(GList * widget_list, gboolean * redraw, gboolean force)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 Widget *w;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 *redraw = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 wl = widget_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 w = WIDGET(wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 REQUIRE_LOCK(w->mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 if (!w->draw)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 if (!w->visible)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 if (w->redraw || force) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 w->draw(w);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 /* w->redraw = FALSE; */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 *redraw = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 widget_list_change_pixmap(GList * widget_list, GdkPixmap * pixmap)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 Widget *widget = wl->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 widget->parent = pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 widget_queue_redraw(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 widget_list_clear_redraw(GList * widget_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 REQUIRE_LOCK(WIDGET(wl->data)->mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 WIDGET(wl->data)->redraw = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 widget_lock(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 g_mutex_lock(WIDGET(widget)->mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 widget_unlock(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 g_mutex_unlock(WIDGET(widget)->mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 widget_list_lock(GList * widget_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 g_list_foreach(widget_list, (GFunc) widget_lock, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 widget_list_unlock(GList * widget_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 g_list_foreach(widget_list, (GFunc) widget_unlock, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263 }