annotate audacious/dock.c @ 1908:179426cfdc0d trunk

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