annotate audacious/widget.c @ 88:db2d1d193e56 trunk

[svn] Fix the missing separator in the playback menu. (oops)
author nenolod
date Tue, 01 Nov 2005 00:11:27 -0800
parents cb178e5ad177
children 0ee0b9b6db7e
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 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 widget->visible = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 widget_draw(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 widget_hide(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 widget->visible = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 widget_is_visible(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 return widget->visible;
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 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 widget_resize(Widget * widget, gint width, gint height)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 widget_set_size(widget, width, height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 widget_move(Widget * widget, gint x, gint y)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 widget_lock(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 widget_set_position(widget, x, y);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 widget_unlock(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 widget_draw(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 widget_lock(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 WIDGET(widget)->redraw = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 widget_unlock(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 widget_list_add(GList ** list, Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 (*list) = g_list_append(*list, widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 handle_press_cb(GList * widget_list, GtkWidget * widget,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 GdkEventButton * event)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 if (WIDGET(wl->data)->button_press_cb)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 WIDGET(wl->data)->button_press_cb(widget, event, wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 handle_release_cb(GList * widget_list, GtkWidget * widget,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 GdkEventButton * event)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 if (WIDGET(wl->data)->button_release_cb)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 WIDGET(wl->data)->button_release_cb(widget, event, wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 handle_motion_cb(GList * widget_list, GtkWidget * widget,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 GdkEventMotion * event)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 if (WIDGET(wl->data)->motion_cb)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 WIDGET(wl->data)->motion_cb(widget, event, wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 handle_scroll_cb(GList * wlist, GtkWidget * widget, GdkEventScroll * event)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 for (wl = wlist; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 if (WIDGET(wl->data)->mouse_scroll_cb)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 WIDGET(wl->data)->mouse_scroll_cb(widget, event, wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 widget_list_draw(GList * widget_list, gboolean * redraw, gboolean force)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 Widget *w;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 *redraw = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 wl = widget_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 w = WIDGET(wl->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 REQUIRE_LOCK(w->mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 if (!w->draw)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 if (!w->visible)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 if (w->redraw || force) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 w->draw(w);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 /* w->redraw = FALSE; */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 *redraw = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 widget_list_change_pixmap(GList * widget_list, GdkPixmap * pixmap)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 Widget *widget = wl->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 widget->parent = pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 widget_queue_redraw(widget);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 widget_list_clear_redraw(GList * widget_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 GList *wl;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 for (wl = widget_list; wl; wl = g_list_next(wl)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 REQUIRE_LOCK(WIDGET(wl->data)->mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 WIDGET(wl->data)->redraw = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 widget_lock(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 g_mutex_lock(WIDGET(widget)->mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 widget_unlock(Widget * widget)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 g_mutex_unlock(WIDGET(widget)->mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 widget_list_lock(GList * widget_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 g_list_foreach(widget_list, (GFunc) widget_lock, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 widget_list_unlock(GList * widget_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 g_list_foreach(widget_list, (GFunc) widget_unlock, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 }