annotate audacious/widgets/widget.c @ 2176:17b152fca694 trunk

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