2313
|
1 /* Audacious - Cross-platform multimedia player
|
|
2 * Copyright (C) 2005-2007 Audacious development team
|
|
3 *
|
|
4 * Based on BMP:
|
|
5 * Copyright (C) 2003-2004 BMP development team.
|
|
6 *
|
|
7 * Based on XMMS:
|
|
8 * Copyright (C) 1998-2003 XMMS development team.
|
|
9 *
|
|
10 * This program is free software; you can redistribute it and/or modify
|
|
11 * it under the terms of the GNU General Public License as published by
|
|
12 * the Free Software Foundation; under version 2 of the License.
|
|
13 *
|
|
14 * This program is distributed in the hope that it will be useful,
|
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 * GNU General Public License for more details.
|
|
18 *
|
|
19 * You should have received a copy of the GNU General Public License
|
|
20 * along with this program; if not, write to the Free Software
|
|
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
22 */
|
|
23
|
|
24 #include "dock.h"
|
|
25
|
|
26 #include <gdk/gdk.h>
|
|
27 #include <stdlib.h>
|
|
28 #include "main.h"
|
|
29
|
|
30 #include "platform/smartinclude.h"
|
|
31
|
|
32 struct _DockedWindow {
|
|
33 GtkWindow *w;
|
|
34 gint offset_x, offset_y;
|
|
35 };
|
|
36
|
|
37 typedef struct _DockedWindow DockedWindow;
|
|
38
|
|
39
|
|
40 static gint
|
|
41 docked_list_compare(DockedWindow * a, DockedWindow * b)
|
|
42 {
|
|
43 if (a->w == b->w)
|
|
44 return 0;
|
|
45 return 1;
|
|
46 }
|
|
47
|
|
48 static void
|
|
49 snap_edge(gint * x, gint * y, gint w, gint h, gint bx, gint by,
|
|
50 gint bw, gint bh)
|
|
51 {
|
|
52 gint sd = cfg.snap_distance;
|
|
53
|
|
54 if ((*x + w > bx - sd) && (*x + w < bx + sd) &&
|
|
55 (*y > by - h - sd) && (*y < by + bh + sd)) {
|
|
56 *x = bx - w;
|
|
57 if ((*y > by - sd) && (*y < by + sd))
|
|
58 *y = by;
|
|
59 if ((*y + h > by + bh - sd) && (*y + h < by + bh + sd))
|
|
60 *y = by + bh - h;
|
|
61 }
|
|
62 if ((*x > bx + bw - sd) && (*x < bx + bw + sd) &&
|
|
63 (*y > by - h - sd) && (*y < by + bh + sd)) {
|
|
64 *x = bx + bw;
|
|
65 if ((*y > by - sd) && (*y < by + sd))
|
|
66 *y = by;
|
|
67 if ((*y + h > by + bh - sd) && (*y + h < by + bh + sd))
|
|
68 *y = by + bh - h;
|
|
69 }
|
|
70 }
|
|
71
|
|
72 static void
|
|
73 snap(gint * x, gint * y, gint w, gint h, gint bx, gint by, gint bw, gint bh)
|
|
74 {
|
|
75 snap_edge(x, y, w, h, bx, by, bw, bh);
|
|
76 snap_edge(y, x, h, w, by, bx, bh, bw);
|
|
77 }
|
|
78
|
|
79 static void
|
|
80 calc_snap_offset(GList * dlist, GList * wlist, gint x, gint y,
|
|
81 gint * off_x, gint * off_y)
|
|
82 {
|
|
83 gint nx, ny, nw, nh, sx, sy, sw, sh;
|
|
84 GtkWindow *w;
|
|
85 GList *dnode, *wnode;
|
|
86 DockedWindow temp, *dw;
|
|
87
|
|
88
|
|
89 *off_x = 0;
|
|
90 *off_y = 0;
|
|
91
|
|
92 if (!cfg.snap_windows)
|
|
93 return;
|
|
94
|
|
95 /*
|
|
96 * FIXME: Why not break out of the loop when we find someting
|
|
97 * to snap to?
|
|
98 */
|
|
99 for (dnode = dlist; dnode; dnode = g_list_next(dnode)) {
|
|
100 dw = dnode->data;
|
|
101 gtk_window_get_size(dw->w, &nw, &nh);
|
|
102
|
|
103 nx = dw->offset_x + *off_x + x;
|
|
104 ny = dw->offset_y + *off_y + y;
|
|
105
|
|
106 /* Snap to screen edges */
|
|
107 if (abs(nx) < cfg.snap_distance)
|
|
108 *off_x -= nx;
|
|
109 if (abs(ny) < cfg.snap_distance)
|
|
110 *off_y -= ny;
|
|
111 if (abs(nx + nw - gdk_screen_width()) < cfg.snap_distance)
|
|
112 *off_x -= nx + nw - gdk_screen_width();
|
|
113 if (abs(ny + nh - gdk_screen_height()) < cfg.snap_distance)
|
|
114 *off_y -= ny + nh - gdk_screen_height();
|
|
115
|
|
116 /* Snap to other windows */
|
|
117 for (wnode = wlist; wnode; wnode = g_list_next(wnode)) {
|
|
118 temp.w = wnode->data;
|
|
119 if (g_list_find_custom
|
|
120 (dlist, &temp, (GCompareFunc) docked_list_compare))
|
|
121 /* These windows are already docked */
|
|
122 continue;
|
|
123
|
|
124 w = GTK_WINDOW(wnode->data);
|
|
125 gtk_window_get_position(w, &sx, &sy);
|
|
126 gtk_window_get_size(w, &sw, &sh);
|
|
127
|
|
128 nx = dw->offset_x + *off_x + x;
|
|
129 ny = dw->offset_y + *off_y + y;
|
|
130
|
|
131 snap(&nx, &ny, nw, nh, sx, sy, sw, sh);
|
|
132
|
|
133 *off_x += nx - (dw->offset_x + *off_x + x);
|
|
134 *off_y += ny - (dw->offset_y + *off_y + y);
|
|
135 }
|
|
136 }
|
|
137 }
|
|
138
|
|
139
|
|
140 static gboolean
|
|
141 is_docked(gint a_x, gint a_y, gint a_w, gint a_h,
|
|
142 gint b_x, gint b_y, gint b_w, gint b_h)
|
|
143 {
|
|
144 if (((a_x == b_x + b_w) || (a_x + a_w == b_x)) &&
|
|
145 (b_y + b_h >= a_y) && (b_y <= a_y + a_h))
|
|
146 return TRUE;
|
|
147
|
|
148 if (((a_y == b_y + b_h) || (a_y + a_h == b_y)) &&
|
|
149 (b_x >= a_x - b_w) && (b_x <= a_x + a_w))
|
|
150 return TRUE;
|
|
151
|
|
152 return FALSE;
|
|
153 }
|
|
154
|
|
155 /*
|
|
156 * Builds a list of all windows that are docked to the window "w".
|
|
157 * Recursively adds all windows that are docked to the windows that are
|
|
158 * docked to "w" and so on...
|
|
159 * FIXME: init_off_? ?
|
|
160 */
|
|
161
|
|
162 static GList *
|
|
163 get_docked_list(GList * dlist, GList * wlist, GtkWindow * w,
|
|
164 gint init_off_x, gint init_off_y)
|
|
165 {
|
|
166 GList *node;
|
|
167 DockedWindow *dwin, temp;
|
|
168 gint w_x, w_y, w_width, w_height;
|
|
169 gint t_x, t_y, t_width, t_height;
|
|
170
|
|
171
|
|
172 gtk_window_get_position(w, &w_x, &w_y);
|
|
173 gtk_window_get_size(w, &w_width, &w_height);
|
|
174 if (!dlist) {
|
|
175 dwin = g_new0(DockedWindow, 1);
|
|
176 dwin->w = w;
|
|
177 dlist = g_list_append(dlist, dwin);
|
|
178 }
|
|
179
|
|
180 for (node = wlist; node; node = g_list_next(node)) {
|
|
181 temp.w = node->data;
|
|
182 if (g_list_find_custom
|
|
183 (dlist, &temp, (GCompareFunc) docked_list_compare))
|
|
184 continue;
|
|
185
|
|
186 gtk_window_get_position(GTK_WINDOW(node->data), &t_x, &t_y);
|
|
187 gtk_window_get_size(GTK_WINDOW(node->data), &t_width, &t_height);
|
|
188 if (is_docked
|
|
189 (w_x, w_y, w_width, w_height, t_x, t_y, t_width, t_height)) {
|
|
190 dwin = g_new0(DockedWindow, 1);
|
|
191 dwin->w = node->data;
|
|
192
|
|
193 dwin->offset_x = t_x - w_x + init_off_x;
|
|
194 dwin->offset_y = t_y - w_y + init_off_y;
|
|
195
|
|
196 dlist = g_list_append(dlist, dwin);
|
|
197
|
|
198 dlist =
|
|
199 get_docked_list(dlist, wlist, dwin->w, dwin->offset_x,
|
|
200 dwin->offset_y);
|
|
201 }
|
|
202 }
|
|
203 return dlist;
|
|
204 }
|
|
205
|
|
206 static void
|
|
207 free_docked_list(GList * dlist)
|
|
208 {
|
|
209 GList *node;
|
|
210
|
|
211 for (node = dlist; node; node = g_list_next(node))
|
|
212 g_free(node->data);
|
|
213 g_list_free(dlist);
|
|
214 }
|
|
215
|
|
216 static void
|
|
217 docked_list_move(GList * list, gint x, gint y)
|
|
218 {
|
|
219 GList *node;
|
|
220 DockedWindow *dw;
|
|
221
|
|
222 for (node = list; node; node = g_list_next(node)) {
|
|
223 dw = node->data;
|
|
224 gtk_window_move(dw->w, x + dw->offset_x, y + dw->offset_y);
|
|
225 gdk_flush();
|
|
226 }
|
|
227 }
|
|
228
|
|
229 static GList *
|
|
230 shade_move_list(GList * list, GtkWindow * widget, gint offset)
|
|
231 {
|
|
232 gint x, y, w, h;
|
|
233 GList *node;
|
|
234 DockedWindow *dw;
|
|
235
|
|
236 gtk_window_get_position(widget, &x, &y);
|
|
237 gtk_window_get_size(widget, &w, &h);
|
|
238
|
|
239
|
|
240 for (node = list; node;) {
|
|
241 gint dx, dy, dwidth, dheight;
|
|
242
|
|
243 dw = node->data;
|
|
244 gtk_window_get_position(dw->w, &dx, &dy);
|
|
245 gtk_window_get_size(dw->w, &dwidth, &dheight);
|
|
246 if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
|
|
247 ((dx + dwidth) > x && dx < (x + w))) {
|
|
248 list = g_list_remove_link(list, node);
|
|
249 g_list_free_1(node);
|
|
250
|
|
251 node = list = shade_move_list(list, dw->w, offset);
|
|
252 }
|
|
253 else
|
|
254 node = g_list_next(node);
|
|
255 }
|
|
256 gtk_window_move(widget, x, y + offset);
|
|
257 return list;
|
|
258 }
|
|
259
|
|
260 /*
|
|
261 * Builds a list of the windows in the list of DockedWindows "winlist"
|
|
262 * that are docked to the top or bottom of the window, and recursively
|
|
263 * adds all windows that are docked to the top or bottom of that window,
|
|
264 * and so on...
|
|
265 * Note: The data in "winlist" is not copied.
|
|
266 */
|
|
267 static GList *
|
|
268 find_shade_list(GtkWindow * widget, GList * winlist, GList * shade_list)
|
|
269 {
|
|
270 gint x, y, w, h;
|
|
271 gint dx, dy, dwidth, dheight;
|
|
272 GList *node;
|
|
273
|
|
274 gtk_window_get_position(widget, &x, &y);
|
|
275 gtk_window_get_size(widget, &w, &h);
|
|
276 for (node = winlist; node; node = g_list_next(node)) {
|
|
277 DockedWindow *dw = node->data;
|
|
278 if (g_list_find_custom
|
|
279 (shade_list, dw, (GCompareFunc) docked_list_compare))
|
|
280 continue;
|
|
281 gtk_window_get_position(dw->w, &dx, &dy);
|
|
282 gtk_window_get_size(dw->w, &dwidth, &dheight);
|
|
283
|
|
284 /* FIXME. Is the is_docked() necessary? */
|
|
285 if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
|
|
286 ((dx + dwidth) > x && dx < (x + w))) {
|
|
287 shade_list = g_list_append(shade_list, dw);
|
|
288 shade_list = find_shade_list(dw->w, winlist, shade_list);
|
|
289 }
|
|
290 }
|
|
291 return shade_list;
|
|
292 }
|
|
293
|
|
294 void
|
|
295 dock_window_resize(GtkWindow * widget, gint new_w, gint new_h, gint w, gint h)
|
|
296 {
|
|
297 gdk_window_set_hints(GTK_WIDGET(widget)->window, 0, 0, MIN(w, new_w),
|
|
298 MIN(h, new_h), MAX(w, new_w), MAX(h, new_h),
|
|
299 GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
|
|
300 gdk_window_resize(GTK_WIDGET(widget)->window, new_w, new_h);
|
|
301 gdk_window_set_hints(GTK_WIDGET(widget)->window, 0, 0, new_w, new_h,
|
|
302 new_w, new_h, GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
|
|
303 }
|
|
304
|
|
305 void
|
|
306 dock_shade(GList * window_list, GtkWindow * widget, gint new_h)
|
|
307 {
|
|
308 gint x, y, w, h, off_y, orig_off_y;
|
|
309 GList *node, *docked_list, *slist;
|
|
310 DockedWindow *dw;
|
|
311
|
|
312 gtk_window_get_position(widget, &x, &y);
|
|
313 gtk_window_get_size(widget, &w, &h);
|
|
314
|
|
315 if (cfg.show_wm_decorations) {
|
|
316 dock_window_resize(widget, w, new_h, w, h);
|
|
317 return;
|
|
318 }
|
|
319
|
|
320 docked_list = get_docked_list(NULL, window_list, widget, 0, 0);
|
|
321 slist = find_shade_list(widget, docked_list, NULL);
|
|
322
|
|
323 off_y = new_h - h;
|
|
324 do {
|
|
325 orig_off_y = off_y;
|
|
326 for (node = slist; node; node = g_list_next(node)) {
|
|
327 gint dx, dy, dwidth, dheight;
|
|
328
|
|
329 dw = node->data;
|
|
330 if (dw->w == widget)
|
|
331 continue;
|
|
332 gtk_window_get_position(dw->w, &dx, &dy);
|
|
333 gtk_window_get_size(dw->w, &dwidth, &dheight);
|
|
334 if ((dy >= y) && ((dy + off_y + dheight) > gdk_screen_height()))
|
|
335 off_y -= (dy + off_y + dheight) - gdk_screen_height();
|
|
336 else if ((dy >= y) && ((dy + dheight) == gdk_screen_height()))
|
|
337 off_y = 0;
|
|
338
|
|
339 if (((dy >= y) && ((dy + off_y) < 0)))
|
|
340 off_y -= dy + off_y;
|
|
341 if ((dy < y) && ((dy + (off_y - (new_h - h))) < 0))
|
|
342 off_y -= dy + (off_y - (new_h - h));
|
|
343 }
|
|
344 } while (orig_off_y != off_y);
|
|
345 if (slist) {
|
|
346 GList *mlist = g_list_copy(slist);
|
|
347
|
|
348 /* Remove this widget from the list */
|
|
349 for (node = mlist; node; node = g_list_next(node)) {
|
|
350 dw = node->data;
|
|
351 if (dw->w == widget) {
|
|
352 mlist = g_list_remove_link(mlist, node);
|
|
353 g_list_free_1(node);
|
|
354 break;
|
|
355 }
|
|
356 }
|
|
357 for (node = mlist; node;) {
|
|
358 GList *temp;
|
|
359 gint dx, dy, dwidth, dheight;
|
|
360
|
|
361 dw = node->data;
|
|
362
|
|
363 gtk_window_get_position(dw->w, &dx, &dy);
|
|
364 gtk_window_get_size(dw->w, &dwidth, &dheight);
|
|
365 /*
|
|
366 * Find windows that are directly docked to this window,
|
|
367 * move it, and any windows docked to that window again
|
|
368 */
|
|
369 if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
|
|
370 ((dx + dwidth) > x && dx < (x + w))) {
|
|
371 mlist = g_list_remove_link(mlist, node);
|
|
372 g_list_free_1(node);
|
|
373 if (dy > y)
|
|
374 temp = shade_move_list(mlist, dw->w, off_y);
|
|
375 else if (off_y - (new_h - h) != 0)
|
|
376 temp = shade_move_list(mlist, dw->w, off_y - (new_h - h));
|
|
377 else
|
|
378 temp = mlist;
|
|
379 node = mlist = temp;
|
|
380 }
|
|
381 else
|
|
382 node = g_list_next(node);
|
|
383 }
|
|
384 g_list_free(mlist);
|
|
385 }
|
|
386 g_list_free(slist);
|
|
387 free_docked_list(docked_list);
|
|
388 gtk_window_move(widget, x, y + off_y - (new_h - h));
|
|
389 dock_window_resize(widget, w, new_h, w, h);
|
|
390 }
|
|
391
|
|
392 static GList *
|
|
393 resize_move_list(GList * list, GtkWindow * widget,
|
|
394 gint offset_x, gint offset_y)
|
|
395 {
|
|
396 gint x, y, w, h;
|
|
397 GList *node;
|
|
398 DockedWindow *dw;
|
|
399
|
|
400 gtk_window_get_position(widget, &x, &y);
|
|
401 gtk_window_get_size(widget, &w, &h);
|
|
402
|
|
403
|
|
404 for (node = list; node;) {
|
|
405 gint dx, dy, dwidth, dheight;
|
|
406 dw = node->data;
|
|
407 gtk_window_get_position(dw->w, &dx, &dy);
|
|
408 gtk_window_get_size(dw->w, &dwidth, &dheight);
|
|
409 if (is_docked(x, y, w, h, dx, dy, dwidth, dheight)) {
|
|
410
|
|
411 list = g_list_remove_link(list, node);
|
|
412 g_list_free_1(node);
|
|
413 node = list = resize_move_list(list, dw->w, offset_x, offset_y);
|
|
414 }
|
|
415 else
|
|
416 node = g_list_next(node);
|
|
417 }
|
|
418 gtk_window_move(widget, x + offset_x, y + offset_y);
|
|
419 return list;
|
|
420 }
|
|
421
|
|
422 static GList *
|
|
423 resize_calc_offset(GList * list, GtkWindow * widget,
|
|
424 gint offset_x, gint offset_y,
|
|
425 gint * goffset_x, gint * goffset_y)
|
|
426 {
|
|
427 gint x, y, w, h;
|
|
428 GList *node;
|
|
429 DockedWindow *dw;
|
|
430
|
|
431 gtk_window_get_position(widget, &x, &y);
|
|
432 gtk_window_get_size(widget, &w, &h);
|
|
433
|
|
434
|
|
435 for (node = list; node;) {
|
|
436 gint dx, dy, dwidth, dheight;
|
|
437 dw = node->data;
|
|
438 gtk_window_get_position(dw->w, &dx, &dy);
|
|
439 gtk_window_get_size(dw->w, &dwidth, &dheight);
|
|
440 if (is_docked(x, y, w, h, dx, dy, dwidth, dheight)) {
|
|
441 if (dx + offset_x + dwidth > gdk_screen_width()) {
|
|
442 offset_x -= dx + offset_x + dwidth - gdk_screen_width();
|
|
443 (*goffset_x) -= dx + offset_x + dwidth - gdk_screen_width();
|
|
444 }
|
|
445 if (dy + offset_y + dheight > gdk_screen_height()) {
|
|
446 offset_y -= dy + offset_y + dheight - gdk_screen_height();
|
|
447 (*goffset_y) -= dy + offset_y + dheight - gdk_screen_height();
|
|
448 }
|
|
449 list = g_list_remove_link(list, node);
|
|
450 g_list_free_1(node);
|
|
451 node = list =
|
|
452 resize_calc_offset(list, dw->w, offset_x, offset_y,
|
|
453 goffset_x, goffset_y);
|
|
454 }
|
|
455 else
|
|
456 node = g_list_next(node);
|
|
457 }
|
|
458 return list;
|
|
459 }
|
|
460
|
|
461 void
|
|
462 dock_move_press(GList * window_list, GtkWindow * w,
|
|
463 GdkEventButton * event, gboolean move_list)
|
|
464 {
|
|
465 gint mx, my;
|
|
466 DockedWindow *dwin;
|
|
467
|
|
468 if (cfg.show_wm_decorations)
|
|
469 return;
|
|
470
|
|
471 gtk_window_present(w);
|
|
472 gdk_window_get_pointer(GTK_WIDGET(w)->window, &mx, &my, NULL);
|
|
473 gtk_object_set_data(GTK_OBJECT(w), "move_offset_x", GINT_TO_POINTER(mx));
|
|
474 gtk_object_set_data(GTK_OBJECT(w), "move_offset_y", GINT_TO_POINTER(my));
|
|
475 if (move_list)
|
|
476 gtk_object_set_data(GTK_OBJECT(w), "docked_list",
|
|
477 get_docked_list(NULL, window_list, w, 0, 0));
|
|
478 else {
|
|
479 dwin = g_new0(DockedWindow, 1);
|
|
480 dwin->w = w;
|
|
481 gtk_object_set_data(GTK_OBJECT(w), "docked_list",
|
|
482 g_list_append(NULL, dwin));
|
|
483 }
|
|
484 gtk_object_set_data(GTK_OBJECT(w), "window_list", window_list);
|
|
485 gtk_object_set_data(GTK_OBJECT(w), "is_moving", GINT_TO_POINTER(1));
|
|
486 }
|
|
487
|
|
488 void
|
|
489 dock_move_motion(GtkWindow * w, GdkEventMotion * event)
|
|
490 {
|
|
491 gint offset_x, offset_y, win_x, win_y, x, y, mx, my;
|
|
492 GList *dlist;
|
|
493 GList *window_list;
|
|
494
|
|
495 gdk_flush();
|
|
496
|
|
497 if (!gtk_object_get_data(GTK_OBJECT(w), "is_moving"))
|
|
498 return;
|
|
499
|
|
500 offset_x =
|
|
501 GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w), "move_offset_x"));
|
|
502 offset_y =
|
|
503 GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w), "move_offset_y"));
|
|
504 dlist = gtk_object_get_data(GTK_OBJECT(w), "docked_list");
|
|
505 window_list = gtk_object_get_data(GTK_OBJECT(w), "window_list");
|
|
506
|
|
507 gtk_window_get_position(w, &win_x, &win_y);
|
|
508
|
|
509 gdk_window_get_pointer(NULL, &mx, &my, NULL);
|
|
510
|
|
511 x = mx - offset_x;
|
|
512 y = my - offset_y;
|
|
513
|
|
514 calc_snap_offset(dlist, window_list, x, y, &offset_x, &offset_y);
|
|
515 x += offset_x;
|
|
516 y += offset_y;
|
|
517
|
|
518 docked_list_move(dlist, x, y);
|
|
519 }
|
|
520
|
|
521 void
|
|
522 dock_move_release(GtkWindow * w)
|
|
523 {
|
|
524 GList *dlist;
|
|
525 gtk_object_remove_data(GTK_OBJECT(w), "is_moving");
|
|
526 gtk_object_remove_data(GTK_OBJECT(w), "move_offset_x");
|
|
527 gtk_object_remove_data(GTK_OBJECT(w), "move_offset_y");
|
|
528 if ((dlist = gtk_object_get_data(GTK_OBJECT(w), "docked_list")) != NULL)
|
|
529 free_docked_list(dlist);
|
|
530 gtk_object_remove_data(GTK_OBJECT(w), "docked_list");
|
|
531 gtk_object_remove_data(GTK_OBJECT(w), "window_list");
|
|
532 }
|
|
533
|
|
534 gboolean
|
|
535 dock_is_moving(GtkWindow * w)
|
|
536 {
|
|
537 if (gtk_object_get_data(GTK_OBJECT(w), "is_moving"))
|
|
538 return TRUE;
|
|
539 return FALSE;
|
|
540 }
|
|
541
|
|
542 GList *
|
|
543 dock_add_window(GList * list, GtkWindow * window)
|
|
544 {
|
|
545 return g_list_append(list, window);
|
|
546 }
|
|
547
|
|
548 GList *
|
|
549 dock_remove_window(GList * list, GtkWindow * window)
|
|
550 {
|
|
551 return g_list_remove(list, window);
|
|
552 }
|
|
553
|
|
554 GList *
|
|
555 dock_window_set_decorated(GList * list, GtkWindow * window,
|
|
556 gboolean decorated)
|
|
557 {
|
|
558 if (gtk_window_get_decorated(window) == decorated)
|
|
559 return list;
|
|
560
|
|
561 if (decorated)
|
|
562 list = dock_remove_window(list, window);
|
|
563 else
|
|
564 list = dock_add_window(list, window);
|
|
565
|
|
566 gtk_window_set_decorated(window, decorated);
|
|
567
|
|
568 return list;
|
|
569 }
|