annotate src/skins/ui_dock.c @ 3158:8b97f9560dc3

More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
author John Lindgren <john.lindgren@tds.net>
date Fri, 01 May 2009 16:59:54 -0400
parents 9978be206b93
children 1ffcad5f406c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Copyright (C) 2005-2007 Audacious development team
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 * Based on BMP:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Based on XMMS:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; under version 3 of the License.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * GNU General Public License for more details.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses>.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 * The Audacious team does not consider modular code linking to
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 * Audacious or using our public API to be a derived work.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26 #include "ui_dock.h"
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
27 #include "skins_cfg.h"
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #include <gdk/gdk.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include <stdlib.h>
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2583
diff changeset
30 #include <audlegacy/plugin.h>
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 #include "ui_skinned_window.h"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 #include "platform/smartinclude.h"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 static GList *dock_window_list = NULL;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 struct _DockedWindow {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 GtkWindow *w;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 gint offset_x, offset_y;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 };
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 typedef struct _DockedWindow DockedWindow;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 static gint
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 docked_list_compare(DockedWindow * a, DockedWindow * b)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 if (a->w == b->w)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 return 0;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 return 1;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 snap_edge(gint * x, gint * y, gint w, gint h, gint bx, gint by,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 gint bw, gint bh)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 {
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
57 gint sd = config.snap_distance;
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 if ((*x + w > bx - sd) && (*x + w < bx + sd) &&
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 (*y > by - h - sd) && (*y < by + bh + sd)) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 *x = bx - w;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 if ((*y > by - sd) && (*y < by + sd))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 *y = by;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 if ((*y + h > by + bh - sd) && (*y + h < by + bh + sd))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 *y = by + bh - h;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 if ((*x > bx + bw - sd) && (*x < bx + bw + sd) &&
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 (*y > by - h - sd) && (*y < by + bh + sd)) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 *x = bx + bw;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 if ((*y > by - sd) && (*y < by + sd))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 *y = by;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 if ((*y + h > by + bh - sd) && (*y + h < by + bh + sd))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 *y = by + bh - h;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 static void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 snap(gint * x, gint * y, gint w, gint h, gint bx, gint by, gint bw, gint bh)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 snap_edge(x, y, w, h, bx, by, bw, bh);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 snap_edge(y, x, h, w, by, bx, bh, bw);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 static void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 calc_snap_offset(GList * dlist, GList * wlist, gint x, gint y,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 gint * off_x, gint * off_y)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 gint nx, ny, nw, nh, sx, sy, sw, sh;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 GtkWindow *w;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 GList *dnode, *wnode;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 DockedWindow temp, *dw;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 *off_x = 0;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 *off_y = 0;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
97 if (!config.snap_windows)
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 return;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 /*
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 * FIXME: Why not break out of the loop when we find someting
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 * to snap to?
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 for (dnode = dlist; dnode; dnode = g_list_next(dnode)) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 dw = dnode->data;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 gtk_window_get_size(dw->w, &nw, &nh);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 nx = dw->offset_x + *off_x + x;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109 ny = dw->offset_y + *off_y + y;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 /* Snap to screen edges */
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
112 if (abs(nx) < config.snap_distance)
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 *off_x -= nx;
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
114 if (abs(ny) < config.snap_distance)
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115 *off_y -= ny;
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
116 if (abs(nx + nw - gdk_screen_width()) < config.snap_distance)
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 *off_x -= nx + nw - gdk_screen_width();
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
118 if (abs(ny + nh - gdk_screen_height()) < config.snap_distance)
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 *off_y -= ny + nh - gdk_screen_height();
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 /* Snap to other windows */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 for (wnode = wlist; wnode; wnode = g_list_next(wnode)) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123 temp.w = wnode->data;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 if (g_list_find_custom
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 (dlist, &temp, (GCompareFunc) docked_list_compare))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 /* These windows are already docked */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 continue;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 w = GTK_WINDOW(wnode->data);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 gtk_window_get_position(w, &sx, &sy);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 gtk_window_get_size(w, &sw, &sh);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 nx = dw->offset_x + *off_x + x;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 ny = dw->offset_y + *off_y + y;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 snap(&nx, &ny, nw, nh, sx, sy, sw, sh);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 *off_x += nx - (dw->offset_x + *off_x + x);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 *off_y += ny - (dw->offset_y + *off_y + y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 static gboolean
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 is_docked(gint a_x, gint a_y, gint a_w, gint a_h,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 gint b_x, gint b_y, gint b_w, gint b_h)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 if (((a_x == b_x + b_w) || (a_x + a_w == b_x)) &&
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 (b_y + b_h >= a_y) && (b_y <= a_y + a_h))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 return TRUE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 if (((a_y == b_y + b_h) || (a_y + a_h == b_y)) &&
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 (b_x >= a_x - b_w) && (b_x <= a_x + a_w))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 return TRUE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 return FALSE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 /*
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 * Builds a list of all windows that are docked to the window "w".
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 * Recursively adds all windows that are docked to the windows that are
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 * docked to "w" and so on...
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 * FIXME: init_off_? ?
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167 static GList *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 get_docked_list(GList * dlist, GList * wlist, GtkWindow * w,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 gint init_off_x, gint init_off_y)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 GList *node;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 DockedWindow *dwin, temp;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 gint w_x, w_y, w_width, w_height;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 gint t_x, t_y, t_width, t_height;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 gtk_window_get_position(w, &w_x, &w_y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178 gtk_window_get_size(w, &w_width, &w_height);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 if (!dlist) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180 dwin = g_new0(DockedWindow, 1);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 dwin->w = w;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 dlist = g_list_append(dlist, dwin);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 for (node = wlist; node; node = g_list_next(node)) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 temp.w = node->data;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187 if (g_list_find_custom
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 (dlist, &temp, (GCompareFunc) docked_list_compare))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 continue;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 gtk_window_get_position(GTK_WINDOW(node->data), &t_x, &t_y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192 gtk_window_get_size(GTK_WINDOW(node->data), &t_width, &t_height);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 if (is_docked
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194 (w_x, w_y, w_width, w_height, t_x, t_y, t_width, t_height)) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 dwin = g_new0(DockedWindow, 1);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196 dwin->w = node->data;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 dwin->offset_x = t_x - w_x + init_off_x;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 dwin->offset_y = t_y - w_y + init_off_y;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201 dlist = g_list_append(dlist, dwin);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 dlist =
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 get_docked_list(dlist, wlist, dwin->w, dwin->offset_x,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 dwin->offset_y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 return dlist;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 static void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212 free_docked_list(GList * dlist)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 GList *node;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 for (node = dlist; node; node = g_list_next(node))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217 g_free(node->data);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218 g_list_free(dlist);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221 static void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 docked_list_move(GList * list, gint x, gint y)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224 GList *node;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225 DockedWindow *dw;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227 for (node = list; node; node = g_list_next(node)) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 dw = node->data;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 gtk_window_move(dw->w, x + dw->offset_x, y + dw->offset_y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231 SkinnedWindow *window = SKINNED_WINDOW(dw->w);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 if (window) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 switch(window->type) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 case WINDOW_MAIN:
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
236 config.player_x = x + dw->offset_x;
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
237 config.player_y = y + dw->offset_y;
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239 case WINDOW_EQ:
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
240 config.equalizer_x = x + dw->offset_x;
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
241 config.equalizer_y = y + dw->offset_y;
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 case WINDOW_PLAYLIST:
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
244 config.playlist_x = x + dw->offset_x;
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
245 config.playlist_y = y + dw->offset_y;
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 window->x = x + dw->offset_x;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 window->y = y + dw->offset_y;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254
3158
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
255 void dock_window_resize (GtkWindow * widget, int width, int height) {
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
256 GdkGeometry hints;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
257 hints.min_width = width;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
258 hints.min_height = height;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
259 hints.max_width = width;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
260 hints.max_height = height;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
261 gtk_window_resize (widget, width, height);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
262 gtk_window_set_geometry_hints (widget, 0, & hints,
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
263 GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265
3158
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
266 static void move_attached (GtkWindow * window, GList * * others, int offset) {
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
267 int x, y, width, height, x2, y2;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
268 GList * move, * scan, * next;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
269 gtk_window_get_position (window, & x, & y);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
270 gtk_window_get_size (window, & width, & height);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
271 move = 0;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
272 for (scan = * others; scan; scan = next) {
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
273 next = g_list_next (scan);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
274 gtk_window_get_position (scan->data, & x2, & y2);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
275 if (y2 == y + height) {
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
276 * others = g_list_remove_link (* others, scan);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
277 move = g_list_concat (move, scan);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
278 }
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
279 }
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
280 for (; move; move = g_list_delete_link (move, move))
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
281 move_attached (move->data, others, offset);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
282 gtk_window_move (window, x, y + offset);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
283 }
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284
3158
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
285 void dock_shade (GList * window_list, GtkWindow * window, int new_height) {
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
286 int x, y, width, height, x2, y2;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
287 GList * move, * others, * scan, * next;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
288 if (! config.show_wm_decorations) {
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
289 gtk_window_get_position (window, & x, & y);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
290 gtk_window_get_size (window, & width, & height);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
291 others = g_list_copy (window_list);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
292 others = g_list_remove (others, window);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
293 move = 0;
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
294 for (scan = others; scan; scan = next) {
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
295 next = g_list_next (scan);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
296 gtk_window_get_position (scan->data, & x2, & y2);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
297 if (y2 == y + height) {
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
298 others = g_list_remove_link (others, scan);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
299 move = g_list_concat (move, scan);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
300 }
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
301 }
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
302 for (; move; move = g_list_delete_link (move, move))
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
303 move_attached (move->data, & others, new_height - height);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
304 g_list_free (others);
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
305 }
8b97f9560dc3 More clean-up of roll-up code (should fix bug #37; if not, it's a WM problem).
John Lindgren <john.lindgren@tds.net>
parents: 3108
diff changeset
306 dock_window_resize (window, width, new_height);
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
308
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309 void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310 dock_move_press(GList * window_list, GtkWindow * w,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311 GdkEventButton * event, gboolean move_list)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 gint mx, my;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314 DockedWindow *dwin;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315
2583
294232665cb0 more work on config
Tomasz Mon <desowin@gmail.com>
parents: 2572
diff changeset
316 if (config.show_wm_decorations)
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317 return;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319 gtk_window_present(w);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320 mx = event->x;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 my = event->y;
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
322 g_object_set_data(G_OBJECT(w), "move_offset_x", GINT_TO_POINTER(mx));
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
323 g_object_set_data(G_OBJECT(w), "move_offset_y", GINT_TO_POINTER(my));
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324 if (move_list)
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
325 g_object_set_data(G_OBJECT(w), "docked_list",
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
326 get_docked_list(NULL, window_list, w, 0, 0));
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 else {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328 dwin = g_new0(DockedWindow, 1);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329 dwin->w = w;
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
330 g_object_set_data(G_OBJECT(w), "docked_list",
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
331 g_list_append(NULL, dwin));
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 }
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
333 g_object_set_data(G_OBJECT(w), "window_list", window_list);
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
334 g_object_set_data(G_OBJECT(w), "is_moving", GINT_TO_POINTER(1));
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
336
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338 dock_move_motion(GtkWindow * w, GdkEventMotion * event)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
339 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
340 gint offset_x, offset_y, x, y;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
341 GList *dlist;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
342 GList *window_list;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
343
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
344 if (!g_object_get_data(G_OBJECT(w), "is_moving"))
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
345 return;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
346
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
347 offset_x =
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
348 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), "move_offset_x"));
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
349 offset_y =
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
350 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), "move_offset_y"));
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
351 dlist = g_object_get_data(G_OBJECT(w), "docked_list");
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
352 window_list = g_object_get_data(G_OBJECT(w), "window_list");
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
353
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
354 x = event->x_root - offset_x;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
355 y = event->y_root - offset_y;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
356
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
357 calc_snap_offset(dlist, window_list, x, y, &offset_x, &offset_y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
358 x += offset_x;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
359 y += offset_y;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
360
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
361 docked_list_move(dlist, x, y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
362 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
363
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
364 void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
365 dock_move_release(GtkWindow * w)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
366 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
367 GList *dlist;
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
368 g_object_set_data(G_OBJECT(w), "is_moving", NULL);
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
369 g_object_set_data(G_OBJECT(w), "move_offset_x", NULL);
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
370 g_object_set_data(G_OBJECT(w), "move_offset_y", NULL);
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
371 if ((dlist = g_object_get_data(G_OBJECT(w), "docked_list")) != NULL)
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
372 free_docked_list(dlist);
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
373 g_object_set_data(G_OBJECT(w), "docked_list", NULL);
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
374 g_object_set_data(G_OBJECT(w), "window_list", NULL);
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
375 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
376
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
377 gboolean
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
378 dock_is_moving(GtkWindow * w)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
379 {
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
380 if (g_object_get_data(G_OBJECT(w), "is_moving"))
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
381 return TRUE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
382 return FALSE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
383 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
384
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
385 GList *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
386 dock_add_window(GList * list, GtkWindow * window)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
387 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
388 return g_list_append(list, window);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
389 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
390
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
391 GList *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
392 dock_remove_window(GList * list, GtkWindow * window)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
393 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
394 return g_list_remove(list, window);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
395 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
396
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
397 GList *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
398 dock_window_set_decorated(GList * list, GtkWindow * window,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
399 gboolean decorated)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
400 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
401 if (gtk_window_get_decorated(window) == decorated)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
402 return list;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
403
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
404 if (decorated)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
405 list = dock_remove_window(list, window);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
406 else
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
407 list = dock_add_window(list, window);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
408
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
409 gtk_window_set_decorated(window, decorated);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
410
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
411 return list;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
412 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
413
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
414 GList *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
415 get_dock_window_list() {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
416 return dock_window_list;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
417 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
418
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
419 void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
420 set_dock_window_list(GList * list) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
421 dock_window_list = list;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
422 }