Merge lp:~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3 into lp:ubuntu/oneiric/cairo-dock
- Oneiric (11.10)
- 2.3.0-3
- Merge into oneiric
Proposed by
Matthieu Baerts
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 19 | ||||||||
Proposed branch: | lp:~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3 | ||||||||
Merge into: | lp:ubuntu/oneiric/cairo-dock | ||||||||
Diff against target: |
1509 lines (+68/-1323) 9 files modified
.pc/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch/src/gldit/cairo-dock-dock-facility.c (+0/-1243) .pc/applied-patches (+0/-1) CMakeLists.txt (+1/-1) debian/changelog (+13/-0) debian/patches/01-default_theme_with_default_apps (+50/-50) debian/patches/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch (+0/-25) debian/patches/series (+0/-1) src/gldit/cairo-dock-class-manager.c (+3/-1) src/gldit/cairo-dock-dock-manager.c (+1/-1) |
||||||||
To merge this branch: | bzr merge lp:~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3 | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Sponsors | Pending | ||
Review via email:
|
Commit message
Description of the change
This is a bugs fixed version:
How to reproduce the bugs:
* Cairo-Dock (without the OpenGL backend, version 2.3.0~1) crashes if we group windows with the same class in a subdock and then we click on the subdock to maximise windows.
* Slowly leave the dock (version 2.3.0~1) with the cursor on the edge of it and the dock will stay zoomed and active.
* Cairo-Dock (version 2.3.0~1 and 2.3.0~2.1) crashes when the musicPlayer applet is in desklet mode and applets are separated from launchers and the music-player is launched at the same time.
Thank you
PS: please don't forget to update our plug-ins too. (LP: #799774)
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === removed directory '.pc/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch' |
2 | === removed directory '.pc/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch/src' |
3 | === removed directory '.pc/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch/src/gldit' |
4 | === removed file '.pc/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch/src/gldit/cairo-dock-dock-facility.c' |
5 | --- .pc/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch/src/gldit/cairo-dock-dock-facility.c 2011-05-21 21:03:26 +0000 |
6 | +++ .pc/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch/src/gldit/cairo-dock-dock-facility.c 1970-01-01 00:00:00 +0000 |
7 | @@ -1,1243 +0,0 @@ |
8 | -/** |
9 | -* This file is a part of the Cairo-Dock project |
10 | -* |
11 | -* Copyright : (C) see the 'copyright' file. |
12 | -* E-mail : see the 'copyright' file. |
13 | -* |
14 | -* This program is free software; you can redistribute it and/or |
15 | -* modify it under the terms of the GNU General Public License |
16 | -* as published by the Free Software Foundation; either version 3 |
17 | -* of the License, or (at your option) any later version. |
18 | -* |
19 | -* This program is distributed in the hope that it will be useful, |
20 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | -* GNU General Public License for more details. |
23 | -* You should have received a copy of the GNU General Public License |
24 | -* along with this program. If not, see <http://www.gnu.org/licenses/>. |
25 | -*/ |
26 | - |
27 | -#include <math.h> |
28 | -#include <string.h> |
29 | -#include <stdio.h> |
30 | -#include <stdlib.h> |
31 | - |
32 | -#include <glib/gstdio.h> |
33 | -#include <gtk/gtk.h> |
34 | -#include <gdk/gdkx.h> |
35 | - |
36 | -#include <cairo.h> |
37 | -#include <pango/pango.h> |
38 | -#include <librsvg/rsvg.h> |
39 | -#include <librsvg/rsvg-cairo.h> |
40 | - |
41 | -#ifdef HAVE_GLITZ |
42 | -#include <glitz-glx.h> |
43 | -#include <cairo-glitz.h> |
44 | -#endif |
45 | - |
46 | -#include <gtk/gtkgl.h> |
47 | -#include <X11/extensions/Xrender.h> |
48 | -#include <X11/extensions/shape.h> |
49 | -#include <GL/gl.h> |
50 | -#include <GL/glu.h> |
51 | -#include <GL/glx.h> |
52 | -#include <gdk/x11/gdkglx.h> |
53 | - |
54 | -#include "cairo-dock-draw.h" |
55 | -#include "cairo-dock-applications-manager.h" |
56 | -#include "cairo-dock-image-buffer.h" |
57 | -#include "cairo-dock-config.h" |
58 | -#include "cairo-dock-module-factory.h" |
59 | -#include "cairo-dock-callbacks.h" |
60 | -#include "cairo-dock-icon-factory.h" |
61 | -#include "cairo-dock-icon-facility.h" |
62 | -#include "cairo-dock-separator-factory.h" |
63 | -#include "cairo-dock-launcher-factory.h" |
64 | -#include "cairo-dock-backends-manager.h" // myBackendsParam.fSubDockSizeRatio |
65 | -#include "cairo-dock-X-utilities.h" |
66 | -#include "cairo-dock-log.h" |
67 | -#include "cairo-dock-keyfile-utilities.h" |
68 | -#include "cairo-dock-dock-manager.h" |
69 | -#include "cairo-dock-dialog-manager.h" |
70 | -#include "cairo-dock-notifications.h" |
71 | -#include "cairo-dock-indicator-manager.h" // myIndicators.bUseClassIndic |
72 | -#include "cairo-dock-class-manager.h" |
73 | -#include "cairo-dock-animations.h" |
74 | -#include "cairo-dock-emblem.h" |
75 | -#include "cairo-dock-X-manager.h" |
76 | -#include "cairo-dock-dock-facility.h" |
77 | - |
78 | -extern CairoDockDesktopGeometry g_desktopGeometry; |
79 | - |
80 | -void cairo_dock_reload_reflects_in_dock (CairoDock *pDock) |
81 | -{ |
82 | - cairo_t *pCairoContext = cairo_dock_create_drawing_context_generic (CAIRO_CONTAINER (pDock)); |
83 | - Icon *icon; |
84 | - GList *ic; |
85 | - for (ic = pDock->icons; ic != NULL; ic = ic->next) |
86 | - { |
87 | - icon = ic->data; |
88 | - if (icon->pReflectionBuffer != NULL) |
89 | - { |
90 | - cairo_dock_add_reflection_to_icon (icon, CAIRO_CONTAINER (pDock)); |
91 | - } |
92 | - } |
93 | - cairo_destroy (pCairoContext); |
94 | -} |
95 | - |
96 | - |
97 | -void cairo_dock_update_dock_size (CairoDock *pDock) // iMaxIconHeight et fFlatDockWidth doivent avoir ete mis a jour au prealable. |
98 | -{ |
99 | - //g_print ("%s ()\n", __func__); |
100 | - g_return_if_fail (pDock != NULL); |
101 | - int iPrevMaxDockHeight = pDock->iMaxDockHeight; |
102 | - int iPrevMaxDockWidth = pDock->iMaxDockWidth; |
103 | - |
104 | - if (pDock->container.fRatio != 0/* && pDock->container.fRatio != 1*/) // on remet leur taille reelle aux icones, sinon le calcul de max_dock_size sera biaise. |
105 | - { |
106 | - GList *ic; |
107 | - Icon *icon; |
108 | - pDock->fFlatDockWidth = -myIconsParam.iIconGap; |
109 | - pDock->iMaxIconHeight = 0; |
110 | - for (ic = pDock->icons; ic != NULL; ic = ic->next) |
111 | - { |
112 | - icon = ic->data; |
113 | - icon->fWidth /= pDock->container.fRatio; |
114 | - icon->fHeight /= pDock->container.fRatio; |
115 | - pDock->fFlatDockWidth += icon->fWidth + myIconsParam.iIconGap; |
116 | - if (! CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon)) |
117 | - pDock->iMaxIconHeight = MAX (pDock->iMaxIconHeight, icon->fHeight); |
118 | - } |
119 | - if (pDock->iMaxIconHeight == 0) |
120 | - pDock->iMaxIconHeight = 10; |
121 | - pDock->container.fRatio = 1.; |
122 | - } |
123 | - pDock->pRenderer->compute_size (pDock); |
124 | - |
125 | - double hmax = pDock->iMaxIconHeight; |
126 | - int iMaxAuthorizedWidth = cairo_dock_get_max_authorized_dock_width (pDock); |
127 | - int n = 0; |
128 | - do |
129 | - { |
130 | - double fPrevRatio = pDock->container.fRatio; |
131 | - //g_print (" %s (%d / %d)\n", __func__, (int)pDock->iMaxDockWidth, iMaxAuthorizedWidth); |
132 | - if (pDock->iMaxDockWidth > iMaxAuthorizedWidth) |
133 | - { |
134 | - pDock->container.fRatio *= 1. * iMaxAuthorizedWidth / pDock->iMaxDockWidth; |
135 | - } |
136 | - else |
137 | - { |
138 | - double fMaxRatio = (pDock->iRefCount == 0 ? 1 : myBackendsParam.fSubDockSizeRatio); |
139 | - if (pDock->container.fRatio < fMaxRatio) |
140 | - { |
141 | - pDock->container.fRatio *= 1. * iMaxAuthorizedWidth / pDock->iMaxDockWidth; |
142 | - pDock->container.fRatio = MIN (pDock->container.fRatio, fMaxRatio); |
143 | - } |
144 | - else |
145 | - pDock->container.fRatio = fMaxRatio; |
146 | - } |
147 | - |
148 | - if (pDock->iMaxDockHeight > g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal]) |
149 | - { |
150 | - pDock->container.fRatio = MIN (pDock->container.fRatio, fPrevRatio * g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal] / pDock->iMaxDockHeight); |
151 | - } |
152 | - |
153 | - if (fPrevRatio != pDock->container.fRatio) |
154 | - { |
155 | - //g_print (" -> changement du ratio : %.3f -> %.3f (%d, %d try)\n", fPrevRatio, pDock->container.fRatio, pDock->iRefCount, n); |
156 | - Icon *icon; |
157 | - GList *ic; |
158 | - pDock->fFlatDockWidth = -myIconsParam.iIconGap; |
159 | - for (ic = pDock->icons; ic != NULL; ic = ic->next) |
160 | - { |
161 | - icon = ic->data; |
162 | - icon->fWidth *= pDock->container.fRatio / fPrevRatio; |
163 | - icon->fHeight *= pDock->container.fRatio / fPrevRatio; |
164 | - pDock->fFlatDockWidth += icon->fWidth + myIconsParam.iIconGap; |
165 | - } |
166 | - hmax *= pDock->container.fRatio / fPrevRatio; |
167 | - |
168 | - pDock->pRenderer->compute_size (pDock); |
169 | - } |
170 | - |
171 | - //g_print ("*** ratio : %.3f -> %.3f\n", fPrevRatio, pDock->container.fRatio); |
172 | - n ++; |
173 | - } while ((pDock->iMaxDockWidth > iMaxAuthorizedWidth || pDock->iMaxDockHeight > g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal] || (pDock->container.fRatio < 1 && pDock->iMaxDockWidth < iMaxAuthorizedWidth-5)) && n < 8); |
174 | - pDock->iMaxIconHeight = hmax; |
175 | - //g_print (">>> iMaxIconHeight : %d, ratio : %.2f, fFlatDockWidth : %.2f\n", (int) pDock->iMaxIconHeight, pDock->container.fRatio, pDock->fFlatDockWidth); |
176 | - |
177 | - pDock->pRenderer->calculate_icons (pDock); // le calcul de max_dock_size a altere les fX et fY. |
178 | - |
179 | - pDock->bWMIconsNeedUpdate = TRUE; |
180 | - ///cairo_dock_trigger_set_WM_icons_geometry (pDock); |
181 | - |
182 | - cairo_dock_update_input_shape (pDock); |
183 | - |
184 | - if (GTK_WIDGET_VISIBLE (pDock->container.pWidget) && (iPrevMaxDockHeight != pDock->iMaxDockHeight || iPrevMaxDockWidth != pDock->iMaxDockWidth)) |
185 | - { |
186 | - //g_print ("*******%s (%dx%d -> %dx%d)\n", __func__, iPrevMaxDockWidth, iPrevMaxDockHeight, pDock->iMaxDockWidth, pDock->iMaxDockHeight); |
187 | - cairo_dock_move_resize_dock (pDock); |
188 | - } |
189 | - |
190 | - cairo_dock_trigger_load_dock_background (pDock); |
191 | - |
192 | - if (pDock->iRefCount == 0 && pDock->iVisibility == CAIRO_DOCK_VISI_RESERVE && iPrevMaxDockHeight != pDock->iMaxDockHeight) |
193 | - cairo_dock_reserve_space_for_dock (pDock, TRUE); |
194 | -} |
195 | - |
196 | -Icon *cairo_dock_calculate_dock_icons (CairoDock *pDock) |
197 | -{ |
198 | - Icon *pPointedIcon = pDock->pRenderer->calculate_icons (pDock); |
199 | - cairo_dock_manage_mouse_position (pDock); |
200 | - return (pDock->iMousePositionType == CAIRO_DOCK_MOUSE_INSIDE ? pPointedIcon : NULL); |
201 | -} |
202 | - |
203 | - |
204 | - |
205 | - //////////////////////////////// |
206 | - /// WINDOW SIZE AND POSITION /// |
207 | -//////////////////////////////// |
208 | - |
209 | -void cairo_dock_reserve_space_for_dock (CairoDock *pDock, gboolean bReserve) |
210 | -{ |
211 | - Window Xid = GDK_WINDOW_XID (pDock->container.pWidget->window); |
212 | - int left=0, right=0, top=0, bottom=0; |
213 | - int left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=0, bottom_start_x=0, bottom_end_x=0; |
214 | - |
215 | - if (bReserve) |
216 | - { |
217 | - int iWindowPositionX = pDock->container.iWindowPositionX, iWindowPositionY = pDock->container.iWindowPositionY; |
218 | - |
219 | - int w = pDock->iMinDockWidth; |
220 | - int h = pDock->iMinDockHeight; |
221 | - int x, y; // position qu'aurait la fenetre du dock s'il avait la taille minimale. |
222 | - cairo_dock_get_window_position_at_balance (pDock, w, h, &x, &y); |
223 | - |
224 | - if (pDock->container.bDirectionUp) |
225 | - { |
226 | - if (pDock->container.bIsHorizontal) |
227 | - { |
228 | - bottom = h + pDock->iGapY; |
229 | - bottom_start_x = x; |
230 | - bottom_end_x = x + w; |
231 | - } |
232 | - else |
233 | - { |
234 | - right = h + pDock->iGapY; |
235 | - right_start_y = x; |
236 | - right_end_y = x + w; |
237 | - } |
238 | - } |
239 | - else |
240 | - { |
241 | - if (pDock->container.bIsHorizontal) |
242 | - { |
243 | - top = h + pDock->iGapY; |
244 | - top_start_x = x; |
245 | - top_end_x = x + w; |
246 | - } |
247 | - else |
248 | - { |
249 | - left = h + pDock->iGapY; |
250 | - left_start_y = x; |
251 | - left_end_y = x + w; |
252 | - } |
253 | - } |
254 | - } |
255 | - |
256 | - cairo_dock_set_strut_partial (Xid, left, right, top, bottom, left_start_y, left_end_y, right_start_y, right_end_y, top_start_x, top_end_x, bottom_start_x, bottom_end_x); |
257 | - /*if ((bReserve && ! pDock->container.bDirectionUp) || (g_iWmHint == GDK_WINDOW_TYPE_HINT_DOCK)) // merci a Robrob pour le patch ! |
258 | - cairo_dock_set_xwindow_type_hint (Xid, "_NET_WM_WINDOW_TYPE_DOCK"); // gtk_window_set_type_hint ne marche que sur une fenetre avant de la rendre visible ! |
259 | - else if (g_iWmHint == GDK_WINDOW_TYPE_HINT_NORMAL) |
260 | - cairo_dock_set_xwindow_type_hint (Xid, "_NET_WM_WINDOW_TYPE_NORMAL"); // idem. |
261 | - else if (g_iWmHint == GDK_WINDOW_TYPE_HINT_TOOLBAR) |
262 | - cairo_dock_set_xwindow_type_hint (Xid, "_NET_WM_WINDOW_TYPE_TOOLBAR"); // idem.*/ |
263 | -} |
264 | - |
265 | -void cairo_dock_prevent_dock_from_out_of_screen (CairoDock *pDock) |
266 | -{ |
267 | - int x, y; // position du point invariant du dock. |
268 | - x = pDock->container.iWindowPositionX + pDock->container.iWidth * pDock->fAlign; |
269 | - y = (pDock->container.bDirectionUp ? pDock->container.iWindowPositionY + pDock->container.iHeight : pDock->container.iWindowPositionY); |
270 | - //cd_debug ("%s (%d;%d)", __func__, x, y); |
271 | - |
272 | - pDock->iGapX = x - g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal] * pDock->fAlign; |
273 | - pDock->iGapY = (pDock->container.bDirectionUp ? g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal] - y : y); |
274 | - //cd_debug (" -> (%d;%d)", pDock->iGapX, pDock->iGapY); |
275 | - |
276 | - if (pDock->iGapX < - g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal]/2) |
277 | - pDock->iGapX = - g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal]/2; |
278 | - if (pDock->iGapX > g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal]/2) |
279 | - pDock->iGapX = g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal]/2; |
280 | - if (pDock->iGapY < 0) |
281 | - pDock->iGapY = 0; |
282 | - if (pDock->iGapY > g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal]) |
283 | - pDock->iGapY = g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal]; |
284 | -} |
285 | - |
286 | -#define CD_VISIBILITY_MARGIN 20 |
287 | -void cairo_dock_get_window_position_at_balance (CairoDock *pDock, int iNewWidth, int iNewHeight, int *iNewPositionX, int *iNewPositionY) |
288 | -{ |
289 | - int iWindowPositionX = (g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal] - iNewWidth) * pDock->fAlign + pDock->iGapX; |
290 | - if (pDock->iRefCount == 0 && pDock->fAlign != .5) |
291 | - iWindowPositionX += (.5 - pDock->fAlign) * (pDock->iMaxDockWidth - iNewWidth); |
292 | - int iWindowPositionY = (pDock->container.bDirectionUp ? g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal] - iNewHeight - pDock->iGapY : pDock->iGapY); |
293 | - //g_print ("pDock->iGapX : %d => iWindowPositionX <- %d\n", pDock->iGapX, iWindowPositionX); |
294 | - //g_print ("iNewHeight : %d -> pDock->container.iWindowPositionY <- %d\n", iNewHeight, iWindowPositionY); |
295 | - |
296 | - if (pDock->iRefCount == 0) |
297 | - { |
298 | - if (iWindowPositionX + iNewWidth < CD_VISIBILITY_MARGIN) |
299 | - iWindowPositionX = CD_VISIBILITY_MARGIN - iNewWidth; |
300 | - else if (iWindowPositionX > g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal] - CD_VISIBILITY_MARGIN) |
301 | - iWindowPositionX = g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal] - CD_VISIBILITY_MARGIN; |
302 | - } |
303 | - else |
304 | - { |
305 | - if (iWindowPositionX < - pDock->iLeftMargin) |
306 | - iWindowPositionX = - pDock->iLeftMargin; |
307 | - else if (iWindowPositionX > g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal] - iNewWidth + pDock->iMinRightMargin) |
308 | - iWindowPositionX = g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal] - iNewWidth + pDock->iMinRightMargin; |
309 | - } |
310 | - if (iWindowPositionY < - pDock->iMaxIconHeight) |
311 | - iWindowPositionY = - pDock->iMaxIconHeight; |
312 | - else if (iWindowPositionY > g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal] - iNewHeight + pDock->iMaxIconHeight) |
313 | - iWindowPositionY = g_desktopGeometry.iScreenHeight[pDock->container.bIsHorizontal] - iNewHeight + pDock->iMaxIconHeight; |
314 | - |
315 | - if (pDock->container.bIsHorizontal) |
316 | - { |
317 | - *iNewPositionX = iWindowPositionX + pDock->iScreenOffsetX; |
318 | - *iNewPositionY = iWindowPositionY + pDock->iScreenOffsetY; |
319 | - } |
320 | - else |
321 | - { |
322 | - *iNewPositionX = iWindowPositionX + pDock->iScreenOffsetY; |
323 | - *iNewPositionY = iWindowPositionY + pDock->iScreenOffsetX; |
324 | - } |
325 | - //g_print ("POSITION : %d+%d ; %d+%d\n", iWindowPositionX, pDock->iScreenOffsetX, iWindowPositionY, pDock->iScreenOffsetY); |
326 | -} |
327 | - |
328 | -static gboolean _move_resize_dock (CairoDock *pDock) |
329 | -{ |
330 | - int iNewWidth = pDock->iMaxDockWidth; |
331 | - int iNewHeight = pDock->iMaxDockHeight; |
332 | - int iNewPositionX, iNewPositionY; |
333 | - cairo_dock_get_window_position_at_balance (pDock, iNewWidth, iNewHeight, &iNewPositionX, &iNewPositionY); // on ne peut pas intercepter le cas ou les nouvelles dimensions sont egales aux dimensions courantes de la fenetre, car il se peut qu'il y'ait 2 redimensionnements d'affilee s'annulant mutuellement (remove + insert d'une icone). Il faut donc avoir les 2 configure, sinon la taille reste bloquee aux valeurs fournies par le 1er configure. |
334 | - |
335 | - //g_print (" -> %dx%d, %d;%d\n", iNewWidth, iNewHeight, iNewPositionX, iNewPositionY); |
336 | - |
337 | - if (pDock->container.bIsHorizontal) |
338 | - { |
339 | - gdk_window_move_resize (pDock->container.pWidget->window, |
340 | - iNewPositionX, |
341 | - iNewPositionY, |
342 | - iNewWidth, |
343 | - iNewHeight); // lorsqu'on a 2 gdk_window_move_resize d'affilee, Compiz deconne et bloque le dock (il est toujours actif mais n'est plus redessine). Compiz envoit un configure de trop par rapport a Metacity. |
344 | - } |
345 | - else |
346 | - { |
347 | - gdk_window_move_resize (pDock->container.pWidget->window, |
348 | - iNewPositionY, |
349 | - iNewPositionX, |
350 | - iNewHeight, |
351 | - iNewWidth); |
352 | - } |
353 | - pDock->iSidMoveResize = 0; |
354 | - return FALSE; |
355 | -} |
356 | - |
357 | -void cairo_dock_move_resize_dock (CairoDock *pDock) |
358 | -{ |
359 | - //g_print ("*********%s (current : %dx%d, %d;%d)\n", __func__, pDock->container.iWidth, pDock->container.iHeight, pDock->container.iWindowPositionX, pDock->container.iWindowPositionY); |
360 | - if (pDock->iSidMoveResize == 0) |
361 | - { |
362 | - pDock->iSidMoveResize = g_idle_add ((GSourceFunc)_move_resize_dock, pDock); |
363 | - } |
364 | - return ; |
365 | -} |
366 | - |
367 | - |
368 | - /////////////////// |
369 | - /// INPUT SHAPE /// |
370 | -/////////////////// |
371 | - |
372 | -static GdkBitmap *_cairo_dock_create_input_shape (CairoDock *pDock, int w, int h) |
373 | -{ |
374 | - int W = pDock->iMaxDockWidth; |
375 | - int H = pDock->iMaxDockHeight; |
376 | - //g_print ("%s (%dx%d / %dx%d)\n", __func__, w, h, W, H); |
377 | - |
378 | - GdkBitmap *pShapeBitmap = (GdkBitmap*) gdk_pixmap_new (NULL, |
379 | - pDock->container.bIsHorizontal ? W : H, |
380 | - pDock->container.bIsHorizontal ? H : W, |
381 | - 1); |
382 | - |
383 | - cairo_t *pCairoContext = gdk_cairo_create (pShapeBitmap); |
384 | - cairo_set_source_rgba (pCairoContext, 0.0f, 0.0f, 0.0f, 0.0f); |
385 | - cairo_set_operator (pCairoContext, CAIRO_OPERATOR_SOURCE); |
386 | - cairo_paint (pCairoContext); |
387 | - if (w != 0 && h != 0) |
388 | - { |
389 | - if (pDock->container.bIsHorizontal) |
390 | - { |
391 | - cairo_rectangle (pCairoContext, |
392 | - (W - w) / 2, // centre en x. |
393 | - pDock->container.bDirectionUp ? H - h : 0, |
394 | - w, |
395 | - h); |
396 | - } |
397 | - else |
398 | - { |
399 | - cairo_rectangle (pCairoContext, |
400 | - pDock->container.bDirectionUp ? H - h : 0, |
401 | - (W - w) / 2, // centre en x. |
402 | - h, |
403 | - w); |
404 | - } |
405 | - cairo_set_source_rgba (pCairoContext, 1., 1., 1., 1.); |
406 | - cairo_fill (pCairoContext); |
407 | - } |
408 | - cairo_destroy (pCairoContext); |
409 | - |
410 | - return pShapeBitmap; |
411 | -} |
412 | - |
413 | -void cairo_dock_update_input_shape (CairoDock *pDock) |
414 | -{ |
415 | - //\_______________ On detruit les zones d'input actuelles. |
416 | - if (pDock->pShapeBitmap != NULL) |
417 | - { |
418 | - g_object_unref ((gpointer) pDock->pShapeBitmap); |
419 | - pDock->pShapeBitmap = NULL; |
420 | - } |
421 | - if (pDock->pHiddenShapeBitmap != NULL) |
422 | - { |
423 | - g_object_unref ((gpointer) pDock->pHiddenShapeBitmap); |
424 | - pDock->pHiddenShapeBitmap = NULL; |
425 | - } |
426 | - |
427 | - //\_______________ on definit les tailles des zones. |
428 | - int W = pDock->iMaxDockWidth; |
429 | - int H = pDock->iMaxDockHeight; |
430 | - int w = pDock->iMinDockWidth; |
431 | - int h = pDock->iMinDockHeight; |
432 | - ///int w_ = MIN (myDocksParam.iVisibleZoneWidth, pDock->iMaxDockWidth); |
433 | - ///int h_ = MIN (myDocksParam.iVisibleZoneHeight, pDock->iMaxDockHeight); |
434 | - int w_ = 1; |
435 | - int h_ = 1; |
436 | - |
437 | - //\_______________ on verifie que les conditions sont toujours remplies. |
438 | - if (w == 0 || h == 0 || pDock->iRefCount > 0 || W == 0 || H == 0) |
439 | - { |
440 | - if (pDock->iInputState != CAIRO_DOCK_INPUT_ACTIVE) |
441 | - { |
442 | - //g_print ("+++ input shape active on update input shape\n"); |
443 | - cairo_dock_set_input_shape_active (pDock); |
444 | - pDock->iInputState = CAIRO_DOCK_INPUT_ACTIVE; |
445 | - } |
446 | - return ; |
447 | - } |
448 | - |
449 | - //\_______________ on cree les zones. |
450 | - pDock->pShapeBitmap = _cairo_dock_create_input_shape (pDock, w, h); |
451 | - |
452 | - pDock->pHiddenShapeBitmap = _cairo_dock_create_input_shape (pDock, w_, h_); |
453 | -} |
454 | - |
455 | - |
456 | - |
457 | - /////////////////// |
458 | - /// LINEAR DOCK /// |
459 | -/////////////////// |
460 | - |
461 | -GList *cairo_dock_calculate_icons_positions_at_rest_linear (GList *pIconList, double fFlatDockWidth, int iXOffset) |
462 | -{ |
463 | - //g_print ("%s (%d, +%d)\n", __func__, fFlatDockWidth, iXOffset); |
464 | - double x_cumulated = iXOffset; |
465 | - double fXMin = 99999; |
466 | - GList* ic, *pFirstDrawnElement = NULL; |
467 | - Icon *icon; |
468 | - for (ic = pIconList; ic != NULL; ic = ic->next) |
469 | - { |
470 | - icon = ic->data; |
471 | - |
472 | - if (x_cumulated + icon->fWidth / 2 < 0) |
473 | - icon->fXAtRest = x_cumulated + fFlatDockWidth; |
474 | - else if (x_cumulated + icon->fWidth / 2 > fFlatDockWidth) |
475 | - icon->fXAtRest = x_cumulated - fFlatDockWidth; |
476 | - else |
477 | - icon->fXAtRest = x_cumulated; |
478 | - |
479 | - if (icon->fXAtRest < fXMin) |
480 | - { |
481 | - fXMin = icon->fXAtRest; |
482 | - pFirstDrawnElement = ic; |
483 | - } |
484 | - //g_print ("%s : fXAtRest = %.2f\n", icon->cName, icon->fXAtRest); |
485 | - |
486 | - x_cumulated += icon->fWidth + myIconsParam.iIconGap; |
487 | - } |
488 | - |
489 | - return pFirstDrawnElement; |
490 | -} |
491 | - |
492 | -double cairo_dock_calculate_max_dock_width (CairoDock *pDock, GList *pFirstDrawnElementGiven, double fFlatDockWidth, double fWidthConstraintFactor, double fExtraWidth) |
493 | -{ |
494 | - double fMaxDockWidth = 0.; |
495 | - //g_print ("%s (%d)\n", __func__, (int)fFlatDockWidth); |
496 | - GList *pIconList = pDock->icons; |
497 | - if (pIconList == NULL) |
498 | - return 2 * myDocksParam.iDockRadius + myDocksParam.iDockLineWidth + 2 * myDocksParam.iFrameMargin; |
499 | - |
500 | - //\_______________ On remet a zero les positions extremales des icones. |
501 | - GList* ic; |
502 | - Icon *icon; |
503 | - for (ic = pIconList; ic != NULL; ic = ic->next) |
504 | - { |
505 | - icon = ic->data; |
506 | - icon->fXMax = -1e4; |
507 | - icon->fXMin = 1e4; |
508 | - } |
509 | - |
510 | - //\_______________ On simule le passage du curseur sur toute la largeur du dock, et on chope la largeur maximale qui s'en degage, ainsi que les positions d'equilibre de chaque icone. |
511 | - GList *pFirstDrawnElement = (pFirstDrawnElementGiven != NULL ? pFirstDrawnElementGiven : pIconList); |
512 | - //for (int iVirtualMouseX = 0; iVirtualMouseX < fFlatDockWidth; iVirtualMouseX ++) |
513 | - GList *ic2; |
514 | - for (ic = pIconList; ic != NULL; ic = ic->next) |
515 | - { |
516 | - icon = ic->data; |
517 | - |
518 | - cairo_dock_calculate_wave_with_position_linear (pIconList, pFirstDrawnElement, icon->fXAtRest, pDock->fMagnitudeMax, fFlatDockWidth, 0, 0, 0.5, 0, pDock->container.bDirectionUp); |
519 | - ic2 = pFirstDrawnElement; |
520 | - do |
521 | - { |
522 | - icon = ic2->data; |
523 | - |
524 | - if (icon->fX + icon->fWidth * icon->fScale > icon->fXMax) |
525 | - icon->fXMax = icon->fX + icon->fWidth * icon->fScale; |
526 | - if (icon->fX < icon->fXMin) |
527 | - icon->fXMin = icon->fX; |
528 | - |
529 | - ic2 = cairo_dock_get_next_element (ic2, pDock->icons); |
530 | - } while (ic2 != pFirstDrawnElement); |
531 | - } |
532 | - cairo_dock_calculate_wave_with_position_linear (pIconList, pFirstDrawnElement, fFlatDockWidth - 1, pDock->fMagnitudeMax, fFlatDockWidth, 0, 0, pDock->fAlign, 0, pDock->container.bDirectionUp); // pDock->fFoldingFactor |
533 | - ic = pFirstDrawnElement; |
534 | - do |
535 | - { |
536 | - icon = ic->data; |
537 | - |
538 | - if (icon->fX + icon->fWidth * icon->fScale > icon->fXMax) |
539 | - icon->fXMax = icon->fX + icon->fWidth * icon->fScale; |
540 | - if (icon->fX < icon->fXMin) |
541 | - icon->fXMin = icon->fX; |
542 | - |
543 | - ic = cairo_dock_get_next_element (ic, pDock->icons); |
544 | - } while (ic != pFirstDrawnElement); |
545 | - |
546 | - fMaxDockWidth = (icon->fXMax - ((Icon *) pFirstDrawnElement->data)->fXMin) * fWidthConstraintFactor + fExtraWidth; |
547 | - fMaxDockWidth = ceil (fMaxDockWidth) + 1; |
548 | - |
549 | - for (ic = pIconList; ic != NULL; ic = ic->next) |
550 | - { |
551 | - icon = ic->data; |
552 | - icon->fXMin += fMaxDockWidth / 2; |
553 | - icon->fXMax += fMaxDockWidth / 2; |
554 | - //g_print ("%s : [%d;%d]\n", icon->cName, (int) icon->fXMin, (int) icon->fXMax); |
555 | - icon->fX = icon->fXAtRest; |
556 | - icon->fScale = 1; |
557 | - } |
558 | - |
559 | - return fMaxDockWidth; |
560 | -} |
561 | - |
562 | -Icon * cairo_dock_calculate_wave_with_position_linear (GList *pIconList, GList *pFirstDrawnElementGiven, int x_abs, gdouble fMagnitude, double fFlatDockWidth, int iWidth, int iHeight, double fAlign, double fFoldingFactor, gboolean bDirectionUp) |
563 | -{ |
564 | - //g_print (">>>>>%s (%d/%.2f, %dx%d, %.2f, %.2f)\n", __func__, x_abs, fFlatDockWidth, iWidth, iHeight, fAlign, fFoldingFactor); |
565 | - if (pIconList == NULL) |
566 | - return NULL; |
567 | - if (x_abs < 0 && iWidth > 0) // ces cas limite sont la pour empecher les icones de retrecir trop rapidement quand on sort par les cotes. |
568 | - ///x_abs = -1; |
569 | - x_abs = 0; |
570 | - else if (x_abs > fFlatDockWidth && iWidth > 0) |
571 | - ///x_abs = fFlatDockWidth+1; |
572 | - x_abs = (int) fFlatDockWidth; |
573 | - |
574 | - |
575 | - float x_cumulated = 0, fXMiddle, fDeltaExtremum; |
576 | - GList* ic, *pointed_ic; |
577 | - Icon *icon, *prev_icon; |
578 | - |
579 | - double fScale = 0.; |
580 | - double offset = 0.; |
581 | - GList *pFirstDrawnElement = (pFirstDrawnElementGiven != NULL ? pFirstDrawnElementGiven : pIconList); |
582 | - ic = pFirstDrawnElement; |
583 | - pointed_ic = (x_abs < 0 ? ic : NULL); |
584 | - do |
585 | - { |
586 | - icon = ic->data; |
587 | - x_cumulated = icon->fXAtRest; |
588 | - fXMiddle = icon->fXAtRest + icon->fWidth / 2; |
589 | - |
590 | - //\_______________ On calcule sa phase (pi/2 au niveau du curseur). |
591 | - icon->fPhase = (fXMiddle - x_abs) / myIconsParam.iSinusoidWidth * G_PI + G_PI / 2; |
592 | - if (icon->fPhase < 0) |
593 | - { |
594 | - icon->fPhase = 0; |
595 | - } |
596 | - else if (icon->fPhase > G_PI) |
597 | - { |
598 | - icon->fPhase = G_PI; |
599 | - } |
600 | - |
601 | - //\_______________ On en deduit l'amplitude de la sinusoide au niveau de cette icone, et donc son echelle. |
602 | - icon->fScale = 1 + fMagnitude * myIconsParam.fAmplitude * sin (icon->fPhase); |
603 | - if (iWidth > 0 && icon->fInsertRemoveFactor != 0) |
604 | - { |
605 | - fScale = icon->fScale; |
606 | - ///offset += (icon->fWidth * icon->fScale) * (pointed_ic == NULL ? 1 : -1); |
607 | - if (icon->fInsertRemoveFactor > 0) |
608 | - icon->fScale *= icon->fInsertRemoveFactor; |
609 | - else |
610 | - icon->fScale *= (1 + icon->fInsertRemoveFactor); |
611 | - ///offset -= (icon->fWidth * icon->fScale) * (pointed_ic == NULL ? 1 : -1); |
612 | - } |
613 | - |
614 | - icon->fY = (bDirectionUp ? iHeight - myDocksParam.iDockLineWidth - myDocksParam.iFrameMargin - icon->fScale * icon->fHeight : myDocksParam.iDockLineWidth + myDocksParam.iFrameMargin); |
615 | - //g_print ("%s fY : %d; %.2f\n", icon->cName, iHeight, icon->fHeight); |
616 | - |
617 | - //\_______________ Si on avait deja defini l'icone pointee, on peut placer l'icone courante par rapport a la precedente. |
618 | - if (pointed_ic != NULL) |
619 | - { |
620 | - if (ic == pFirstDrawnElement) // peut arriver si on est en dehors a gauche du dock. |
621 | - { |
622 | - icon->fX = x_cumulated - 1. * (fFlatDockWidth - iWidth) / 2; |
623 | - //g_print (" en dehors a gauche : icon->fX = %.2f (%.2f)\n", icon->fX, x_cumulated); |
624 | - } |
625 | - else |
626 | - { |
627 | - prev_icon = (ic->prev != NULL ? ic->prev->data : cairo_dock_get_last_icon (pIconList)); |
628 | - icon->fX = prev_icon->fX + (prev_icon->fWidth + myIconsParam.iIconGap) * prev_icon->fScale; |
629 | - |
630 | - if (icon->fX + icon->fWidth * icon->fScale > icon->fXMax - myIconsParam.fAmplitude * fMagnitude * (icon->fWidth + 1.5*myIconsParam.iIconGap) / 8 && iWidth != 0) |
631 | - { |
632 | - //g_print (" on contraint %s (fXMax=%.2f , fX=%.2f\n", prev_icon->cName, prev_icon->fXMax, prev_icon->fX); |
633 | - fDeltaExtremum = icon->fX + icon->fWidth * icon->fScale - (icon->fXMax - myIconsParam.fAmplitude * fMagnitude * (icon->fWidth + 1.5*myIconsParam.iIconGap) / 16); |
634 | - if (myIconsParam.fAmplitude != 0) |
635 | - icon->fX -= fDeltaExtremum * (1 - (icon->fScale - 1) / myIconsParam.fAmplitude) * fMagnitude; |
636 | - } |
637 | - } |
638 | - icon->fX = fAlign * iWidth + (icon->fX - fAlign * iWidth) * (1. - fFoldingFactor); |
639 | - //g_print (" a droite : icon->fX = %.2f (%.2f)\n", icon->fX, x_cumulated); |
640 | - } |
641 | - |
642 | - //\_______________ On regarde si on pointe sur cette icone. |
643 | - if (x_cumulated + icon->fWidth + .5*myIconsParam.iIconGap >= x_abs && x_cumulated - .5*myIconsParam.iIconGap <= x_abs && pointed_ic == NULL) // on a trouve l'icone sur laquelle on pointe. |
644 | - { |
645 | - pointed_ic = ic; |
646 | - ///icon->bPointed = TRUE; |
647 | - icon->bPointed = (x_abs != (int) fFlatDockWidth && x_abs != 0); |
648 | - icon->fX = x_cumulated - (fFlatDockWidth - iWidth) / 2 + (1 - icon->fScale) * (x_abs - x_cumulated + .5*myIconsParam.iIconGap); |
649 | - icon->fX = fAlign * iWidth + (icon->fX - fAlign * iWidth) * (1. - fFoldingFactor); |
650 | - //g_print (" icone pointee : fX = %.2f (%.2f, %d)\n", icon->fX, x_cumulated, icon->bPointed); |
651 | - } |
652 | - else |
653 | - icon->bPointed = FALSE; |
654 | - |
655 | - if (iWidth > 0 && icon->fInsertRemoveFactor != 0) |
656 | - { |
657 | - if (pointed_ic != ic) // bPointed peut etre false a l'extremite droite. |
658 | - offset += (icon->fWidth * (fScale - icon->fScale)) * (pointed_ic == NULL ? 1 : -1); |
659 | - else |
660 | - offset += (2*(fXMiddle - x_abs) * (fScale - icon->fScale)) * (pointed_ic == NULL ? 1 : -1); |
661 | - } |
662 | - |
663 | - ic = cairo_dock_get_next_element (ic, pIconList); |
664 | - } while (ic != pFirstDrawnElement); |
665 | - |
666 | - //\_______________ On place les icones precedant l'icone pointee par rapport a celle-ci. |
667 | - if (pointed_ic == NULL) // on est a droite des icones. |
668 | - { |
669 | - pointed_ic = (pFirstDrawnElement->prev == NULL ? g_list_last (pIconList) : pFirstDrawnElement->prev); |
670 | - icon = pointed_ic->data; |
671 | - icon->fX = x_cumulated - (fFlatDockWidth - iWidth) / 2 + (1 - icon->fScale) * (icon->fWidth + .5*myIconsParam.iIconGap); |
672 | - icon->fX = fAlign * iWidth + (icon->fX - fAlign * iWidth) * (1 - fFoldingFactor); |
673 | - //g_print (" en dehors a droite : icon->fX = %.2f (%.2f)\n", icon->fX, x_cumulated); |
674 | - } |
675 | - |
676 | - ic = pointed_ic; |
677 | - while (ic != pFirstDrawnElement) |
678 | - { |
679 | - icon = ic->data; |
680 | - |
681 | - ic = ic->prev; |
682 | - if (ic == NULL) |
683 | - ic = g_list_last (pIconList); |
684 | - |
685 | - prev_icon = ic->data; |
686 | - |
687 | - prev_icon->fX = icon->fX - (prev_icon->fWidth + myIconsParam.iIconGap) * prev_icon->fScale; |
688 | - //g_print ("fX <- %.2f; fXMin : %.2f\n", prev_icon->fX, prev_icon->fXMin); |
689 | - if (prev_icon->fX < prev_icon->fXMin + myIconsParam.fAmplitude * fMagnitude * (prev_icon->fWidth + 1.5*myIconsParam.iIconGap) / 8 && iWidth != 0 && x_abs < iWidth && fMagnitude > 0) /// && prev_icon->fPhase == 0 // on rajoute 'fMagnitude > 0' sinon il y'a un leger "saut" du aux contraintes a gauche de l'icone pointee. |
690 | - { |
691 | - //g_print (" on contraint %s (fXMin=%.2f , fX=%.2f\n", prev_icon->cName, prev_icon->fXMin, prev_icon->fX); |
692 | - fDeltaExtremum = prev_icon->fX - (prev_icon->fXMin + myIconsParam.fAmplitude * fMagnitude * (prev_icon->fWidth + 1.5*myIconsParam.iIconGap) / 16); |
693 | - if (myIconsParam.fAmplitude != 0) |
694 | - prev_icon->fX -= fDeltaExtremum * (1 - (prev_icon->fScale - 1) / myIconsParam.fAmplitude) * fMagnitude; |
695 | - } |
696 | - prev_icon->fX = fAlign * iWidth + (prev_icon->fX - fAlign * iWidth) * (1. - fFoldingFactor); |
697 | - //g_print (" prev_icon->fX : %.2f\n", prev_icon->fX); |
698 | - } |
699 | - |
700 | - if (offset != 0) |
701 | - { |
702 | - offset /= 2; |
703 | - //g_print ("offset : %.2f (pointed:%s)\n", offset, pointed_ic?((Icon*)pointed_ic->data)->cName:"none"); |
704 | - for (ic = pIconList; ic != NULL; ic = ic->next) |
705 | - { |
706 | - icon = ic->data; |
707 | - //if (ic == pIconList) |
708 | - // cd_debug ("fX : %.2f - %.2f\n", icon->fX, offset); |
709 | - icon->fX -= offset; |
710 | - } |
711 | - } |
712 | - |
713 | - icon = pointed_ic->data; |
714 | - return (icon->bPointed ? icon : NULL); |
715 | -} |
716 | - |
717 | -Icon *cairo_dock_apply_wave_effect_linear (CairoDock *pDock) |
718 | -{ |
719 | - //\_______________ On calcule la position du curseur dans le referentiel du dock a plat. |
720 | - int dx = pDock->container.iMouseX - (pDock->iOffsetForExtend * (pDock->fAlign - .5) * 2) - pDock->container.iWidth / 2; // ecart par rapport au milieu du dock a plat. |
721 | - int x_abs = dx + pDock->fFlatDockWidth / 2; // ecart par rapport a la gauche du dock minimal plat. |
722 | - //g_print ("%s (flat:%d, w:%d, x:%d)\n", __func__, (int)pDock->fFlatDockWidth, pDock->container.iWidth, pDock->container.iMouseX); |
723 | - //\_______________ On calcule l'ensemble des parametres des icones. |
724 | - double fMagnitude = cairo_dock_calculate_magnitude (pDock->iMagnitudeIndex) * pDock->fMagnitudeMax; |
725 | - Icon *pPointedIcon = cairo_dock_calculate_wave_with_position_linear (pDock->icons, pDock->pFirstDrawnElement, x_abs, fMagnitude, pDock->fFlatDockWidth, pDock->container.iWidth, pDock->container.iHeight, pDock->fAlign, pDock->fFoldingFactor, pDock->container.bDirectionUp); // iMaxDockWidth |
726 | - return pPointedIcon; |
727 | -} |
728 | - |
729 | -double cairo_dock_get_current_dock_width_linear (CairoDock *pDock) |
730 | -{ |
731 | - if (pDock->icons == NULL) |
732 | - //return 2 * myDocksParam.iDockRadius + myDocksParam.iDockLineWidth + 2 * myDocksParam.iFrameMargin; |
733 | - return 1 + 2 * myDocksParam.iFrameMargin; |
734 | - |
735 | - Icon *pLastIcon = cairo_dock_get_last_drawn_icon (pDock); |
736 | - Icon *pFirstIcon = cairo_dock_get_first_drawn_icon (pDock); |
737 | - double fWidth = pLastIcon->fX - pFirstIcon->fX + pLastIcon->fWidth * pLastIcon->fScale + 2 * myDocksParam.iFrameMargin; // + 2 * myDocksParam.iDockRadius + myDocksParam.iDockLineWidth + 2 * myDocksParam.iFrameMargin |
738 | - |
739 | - return fWidth; |
740 | -} |
741 | - |
742 | - |
743 | -void cairo_dock_check_if_mouse_inside_linear (CairoDock *pDock) |
744 | -{ |
745 | - CairoDockMousePositionType iMousePositionType; |
746 | - int iWidth = pDock->container.iWidth; |
747 | - int iHeight = (pDock->fMagnitudeMax != 0 ? pDock->container.iHeight : pDock->iMinDockHeight); |
748 | - ///int iExtraHeight = (pDock->bAtBottom ? 0 : myIconsParam.iLabelSize); |
749 | - int iExtraHeight = 0; /// il faudrait voir si on a un sous-dock ou un dialogue au dessus :-/ |
750 | - int iMouseX = pDock->container.iMouseX; |
751 | - int iMouseY = (pDock->container.bDirectionUp ? pDock->container.iHeight - pDock->container.iMouseY : pDock->container.iMouseY); |
752 | - //g_print ("%s (%dx%d, %dx%d, %f)\n", __func__, iMouseX, iMouseY, iWidth, iHeight, pDock->fFoldingFactor); |
753 | - |
754 | - //\_______________ On regarde si le curseur est dans le dock ou pas, et on joue sur la taille des icones en consequence. |
755 | - int x_abs = pDock->container.iMouseX + (pDock->fFlatDockWidth - iWidth) / 2; // abscisse par rapport a la gauche du dock minimal plat. |
756 | - gboolean bMouseInsideDock = (x_abs >= 0 && x_abs <= pDock->fFlatDockWidth && iMouseX > 0 && iMouseX < iWidth); |
757 | - //g_print ("bMouseInsideDock : %d (%d;%d/%.2f)\n", bMouseInsideDock, pDock->container.bInside, x_abs, pDock->fFlatDockWidth); |
758 | - |
759 | - if (! bMouseInsideDock) // hors du dock par les cotes. |
760 | - { |
761 | - if (/*cairo_dock_is_extended_dock (pDock) && */pDock->bAutoHide) // c'est penible de sortir du dock trop facilement avec l'auto-hide. |
762 | - { |
763 | - if (iMouseY >= 0 && iMouseY < iHeight) |
764 | - iMousePositionType = CAIRO_DOCK_MOUSE_INSIDE; |
765 | - else |
766 | - iMousePositionType = CAIRO_DOCK_MOUSE_OUTSIDE; |
767 | - } |
768 | - else |
769 | - { |
770 | - double fSideMargin = fabs (pDock->fAlign - .5) * (iWidth - pDock->fFlatDockWidth); |
771 | - if (x_abs < - fSideMargin || x_abs > pDock->fFlatDockWidth + fSideMargin) |
772 | - iMousePositionType = CAIRO_DOCK_MOUSE_OUTSIDE; |
773 | - else |
774 | - iMousePositionType = CAIRO_DOCK_MOUSE_ON_THE_EDGE; |
775 | - } |
776 | - } |
777 | - else if (iMouseY >= 0 && iMouseY < iHeight) // et en plus on est dedans en y. // && pPointedIcon != NULL |
778 | - { |
779 | - //g_print ("on est dedans en x et en y (iMouseX=%d => x_abs=%d ; iMouseY=%d/%d)\n", iMouseX, x_abs, iMouseY, iHeight); |
780 | - //pDock->container.bInside = TRUE; |
781 | - iMousePositionType = CAIRO_DOCK_MOUSE_INSIDE; |
782 | - } |
783 | - else |
784 | - iMousePositionType = CAIRO_DOCK_MOUSE_OUTSIDE; |
785 | - |
786 | - pDock->iMousePositionType = iMousePositionType; |
787 | -} |
788 | - |
789 | -void cairo_dock_manage_mouse_position (CairoDock *pDock) |
790 | -{ |
791 | - switch (pDock->iMousePositionType) |
792 | - { |
793 | - case CAIRO_DOCK_MOUSE_INSIDE : |
794 | - //g_print ("INSIDE (%d;%d;%d;%d;%d)\n", cairo_dock_entrance_is_allowed (pDock), pDock->iMagnitudeIndex, pDock->bIsGrowingUp, pDock->bIsShrinkingDown, pDock->iInputState); |
795 | - if (cairo_dock_entrance_is_allowed (pDock) && ((pDock->iMagnitudeIndex < CAIRO_DOCK_NB_MAX_ITERATIONS && ! pDock->bIsGrowingUp) || pDock->bIsShrinkingDown) && pDock->iInputState != CAIRO_DOCK_INPUT_HIDDEN && (pDock->iInputState != CAIRO_DOCK_INPUT_AT_REST || pDock->bIsDragging)) // on est dedans et la taille des icones est non maximale bien que le dock ne soit pas en train de grossir, cependant on respecte l'etat 'cache', et l'etat repos. |
796 | - { |
797 | - //g_print ("on est dedans en x et en y et la taille des icones est non maximale bien qu'aucune icone ne soit animee (%d;%d)\n", pDock->iMagnitudeIndex, pDock->container.bInside); |
798 | - if (pDock->iRefCount != 0 && !pDock->container.bInside) |
799 | - { |
800 | - |
801 | - break; |
802 | - } |
803 | - //pDock->container.bInside = TRUE; |
804 | - ///if ((pDock->bAtBottom && pDock->iRefCount == 0 && ! pDock->bAutoHide) || (pDock->container.iWidth != pDock->iMaxDockWidth || pDock->container.iHeight != pDock->iMaxDockHeight) || (!pDock->container.bInside)) // on le fait pas avec l'auto-hide, car un signal d'entree est deja emis a cause des mouvements/redimensionnements de la fenetre, et en rajouter un ici fout le boxon. // !pDock->container.bInside ajoute pour le bug du chgt de bureau. |
805 | - if ((pDock->iMagnitudeIndex == 0 && pDock->iRefCount == 0 && ! pDock->bAutoHide) || !pDock->container.bInside) |
806 | - { |
807 | - //g_print (" on emule une re-rentree (pDock->iMagnitudeIndex:%d)\n", pDock->iMagnitudeIndex); |
808 | - cairo_dock_emit_enter_signal (CAIRO_CONTAINER (pDock)); |
809 | - } |
810 | - else // on se contente de faire grossir les icones. |
811 | - { |
812 | - //g_print (" on se contente de faire grossir les icones\n"); |
813 | - cairo_dock_start_growing (pDock); |
814 | - if (pDock->bAutoHide && pDock->iRefCount == 0) |
815 | - cairo_dock_start_showing (pDock); |
816 | - } |
817 | - } |
818 | - break ; |
819 | - |
820 | - case CAIRO_DOCK_MOUSE_ON_THE_EDGE : |
821 | - if (pDock->iMagnitudeIndex > 0 && ! pDock->bIsGrowingUp) |
822 | - cairo_dock_start_shrinking (pDock); |
823 | - break ; |
824 | - |
825 | - case CAIRO_DOCK_MOUSE_OUTSIDE : |
826 | - //g_print ("en dehors du dock (bIsShrinkingDown:%d;bIsGrowingUp:%d;iMagnitudeIndex:%d)\n", pDock->bIsShrinkingDown, pDock->bIsGrowingUp, pDock->iMagnitudeIndex); |
827 | - if (! pDock->bIsGrowingUp && ! pDock->bIsShrinkingDown && pDock->iSidLeaveDemand == 0 && pDock->iMagnitudeIndex > 0 && ! pDock->bIconIsFlyingAway) |
828 | - { |
829 | - if (pDock->iRefCount > 0) |
830 | - { |
831 | - Icon *pPointingIcon = cairo_dock_search_icon_pointing_on_dock (pDock, NULL); |
832 | - if (pPointingIcon && pPointingIcon->bPointed) // sous-dock pointe, n le laisse en position haute. |
833 | - return; |
834 | - } |
835 | - //g_print ("on force a quitter (iRefCount:%d; bIsGrowingUp:%d; iMagnitudeIndex:%d)\n", pDock->iRefCount, pDock->bIsGrowingUp, pDock->iMagnitudeIndex); |
836 | - pDock->iSidLeaveDemand = g_timeout_add (MAX (myDocksParam.iLeaveSubDockDelay, 330), (GSourceFunc) cairo_dock_emit_leave_signal, (gpointer) pDock); |
837 | - } |
838 | - break ; |
839 | - } |
840 | -} |
841 | - |
842 | -#define make_icon_avoid_mouse(icon) \ |
843 | - cairo_dock_mark_icon_as_avoiding_mouse (icon);\ |
844 | - icon->fAlpha = 0.75;\ |
845 | - if (myIconsParam.fAmplitude != 0)\ |
846 | - icon->fDrawX += icon->fWidth / 2 * (icon->fScale - 1) / myIconsParam.fAmplitude * (icon->fPhase < G_PI/2 ? -1 : 1); |
847 | - |
848 | -static gboolean _cairo_dock_check_can_drop_linear (CairoDock *pDock, CairoDockIconGroup iGroup, double fMargin) |
849 | -{ |
850 | - gboolean bCanDrop = FALSE; |
851 | - Icon *icon; |
852 | - GList *pFirstDrawnElement = (pDock->pFirstDrawnElement != NULL ? pDock->pFirstDrawnElement : pDock->icons); |
853 | - GList *ic = pFirstDrawnElement; |
854 | - do |
855 | - { |
856 | - icon = ic->data; |
857 | - if (icon->bPointed) // && icon->iAnimationState != CAIRO_DOCK_FOLLOW_MOUSE |
858 | - { |
859 | - if (pDock->container.iMouseX < icon->fDrawX + icon->fWidth * icon->fScale * fMargin) // on est a gauche. // fDrawXAtRest |
860 | - { |
861 | - Icon *prev_icon = cairo_dock_get_previous_element (ic, pDock->icons) -> data; |
862 | - if ((cairo_dock_get_icon_order (icon) == cairo_dock_get_group_order (iGroup) || cairo_dock_get_icon_order (prev_icon) == cairo_dock_get_group_order (iGroup))) // && prev_icon->iAnimationType != CAIRO_DOCK_FOLLOW_MOUSE |
863 | - { |
864 | - make_icon_avoid_mouse (icon); |
865 | - make_icon_avoid_mouse (prev_icon); |
866 | - //g_print ("%s> <%s\n", prev_icon->cName, icon->cName); |
867 | - bCanDrop = TRUE; |
868 | - } |
869 | - } |
870 | - else if (pDock->container.iMouseX > icon->fDrawX + icon->fWidth * icon->fScale * (1 - fMargin)) // on est a droite. // fDrawXAtRest |
871 | - { |
872 | - Icon *next_icon = cairo_dock_get_next_element (ic, pDock->icons) -> data; |
873 | - if ((icon->iGroup == iGroup || next_icon->iGroup == iGroup)) // && next_icon->iAnimationType != CAIRO_DOCK_FOLLOW_MOUSE |
874 | - { |
875 | - make_icon_avoid_mouse (icon); |
876 | - make_icon_avoid_mouse (next_icon); |
877 | - //g_print ("%s> <%s\n", icon->cName, next_icon->cName); |
878 | - bCanDrop = TRUE; |
879 | - } |
880 | - ic = cairo_dock_get_next_element (ic, pDock->icons); // on la saute. |
881 | - if (ic == pFirstDrawnElement) |
882 | - break ; |
883 | - } // else on est dessus. |
884 | - } |
885 | - else |
886 | - cairo_dock_stop_marking_icon_as_avoiding_mouse (icon); |
887 | - |
888 | - ic = cairo_dock_get_next_element (ic, pDock->icons); |
889 | - } while (ic != pFirstDrawnElement); |
890 | - |
891 | - return bCanDrop; |
892 | -} |
893 | - |
894 | - |
895 | -void cairo_dock_check_can_drop_linear (CairoDock *pDock) |
896 | -{ |
897 | - if (pDock->icons == NULL) |
898 | - return; |
899 | - |
900 | - if (pDock->bIsDragging) |
901 | - pDock->bCanDrop = _cairo_dock_check_can_drop_linear (pDock, pDock->iAvoidingMouseIconType, pDock->fAvoidingMouseMargin); |
902 | - else |
903 | - pDock->bCanDrop = FALSE; |
904 | -} |
905 | - |
906 | -void cairo_dock_stop_marking_icons (CairoDock *pDock) |
907 | -{ |
908 | - if (pDock->icons == NULL) |
909 | - return; |
910 | - //g_print ("%s (%d)\n", __func__, iType); |
911 | - |
912 | - Icon *icon; |
913 | - GList *ic; |
914 | - for (ic = pDock->icons; ic != NULL; ic = ic->next) |
915 | - { |
916 | - icon = ic->data; |
917 | - cairo_dock_stop_marking_icon_as_avoiding_mouse (icon); |
918 | - } |
919 | -} |
920 | - |
921 | - |
922 | -void cairo_dock_set_subdock_position_linear (Icon *pPointedIcon, CairoDock *pDock) |
923 | -{ |
924 | - CairoDock *pSubDock = pPointedIcon->pSubDock; |
925 | - int iX = pPointedIcon->fXAtRest - (pDock->fFlatDockWidth - pDock->iMaxDockWidth) / 2 + pPointedIcon->fWidth / 2 + (pDock->iOffsetForExtend * (pDock->fAlign - .5) * 2); |
926 | - if (pSubDock->container.bIsHorizontal == pDock->container.bIsHorizontal) |
927 | - { |
928 | - pSubDock->fAlign = 0.5; |
929 | - pSubDock->iGapX = iX + pDock->container.iWindowPositionX - (pDock->container.bIsHorizontal ? pDock->iScreenOffsetX : pDock->iScreenOffsetY) - g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal] / 2; // ici les sous-dock ont un alignement egal a 0.5 |
930 | - pSubDock->iGapY = pDock->iGapY + pDock->iMaxDockHeight; |
931 | - } |
932 | - else |
933 | - { |
934 | - pSubDock->fAlign = (pDock->container.bDirectionUp ? 1 : 0); |
935 | - pSubDock->iGapX = (pDock->iGapY + pDock->iMaxDockHeight) * (pDock->container.bDirectionUp ? -1 : 1); |
936 | - if (pDock->container.bDirectionUp) |
937 | - pSubDock->iGapY = g_desktopGeometry.iScreenWidth[pDock->container.bIsHorizontal] - (iX + pDock->container.iWindowPositionX - (pDock->container.bIsHorizontal ? pDock->iScreenOffsetX : pDock->iScreenOffsetY)) - pSubDock->iMaxDockHeight / 2; // les sous-dock ont un alignement egal a 1. |
938 | - else |
939 | - pSubDock->iGapY = iX + pDock->container.iWindowPositionX - pSubDock->iMaxDockHeight / 2; // les sous-dock ont un alignement egal a 0. |
940 | - } |
941 | -} |
942 | - |
943 | - |
944 | -GList *cairo_dock_get_first_drawn_element_linear (GList *icons) |
945 | -{ |
946 | - Icon *icon; |
947 | - GList *ic; |
948 | - GList *pFirstDrawnElement = NULL; |
949 | - for (ic = icons; ic != NULL; ic = ic->next) |
950 | - { |
951 | - icon = ic->data; |
952 | - if (icon->bPointed) |
953 | - break ; |
954 | - } |
955 | - |
956 | - if (ic == NULL || ic->next == NULL) // derniere icone ou aucune pointee. |
957 | - pFirstDrawnElement = icons; |
958 | - else |
959 | - pFirstDrawnElement = ic->next; |
960 | - return pFirstDrawnElement; |
961 | -} |
962 | - |
963 | - |
964 | -void cairo_dock_show_subdock (Icon *pPointedIcon, CairoDock *pParentDock) |
965 | -{ |
966 | - cd_debug ("on montre le dock fils"); |
967 | - CairoDock *pSubDock = pPointedIcon->pSubDock; |
968 | - g_return_if_fail (pSubDock != NULL); |
969 | - |
970 | - if (GTK_WIDGET_VISIBLE (pSubDock->container.pWidget)) // il est deja visible. |
971 | - { |
972 | - if (pSubDock->bIsShrinkingDown) // il est en cours de diminution, on renverse le processus. |
973 | - { |
974 | - cairo_dock_start_growing (pSubDock); |
975 | - } |
976 | - return ; |
977 | - } |
978 | - |
979 | - pSubDock->pRenderer->set_subdock_position (pPointedIcon, pParentDock); |
980 | - if (pParentDock->fMagnitudeMax == 0) // son input shape n'est pas la taille max mais iMinDockHeight. |
981 | - pSubDock->iGapY -= (pParentDock->container.iHeight - pParentDock->iMinDockHeight); |
982 | - |
983 | - if (pSubDock->icons != NULL) |
984 | - { |
985 | - pSubDock->fFoldingFactor = (myDocksParam.bAnimateSubDock ? .99 : 0.); |
986 | - cairo_dock_notify_on_object (&myIconsMgr, NOTIFICATION_UNFOLD_SUBDOCK, pPointedIcon); |
987 | - cairo_dock_notify_on_object (pPointedIcon, NOTIFICATION_UNFOLD_SUBDOCK, pPointedIcon); |
988 | - } |
989 | - else |
990 | - pSubDock->fFoldingFactor = 0.; |
991 | - |
992 | - int iNewWidth = pSubDock->iMaxDockWidth; |
993 | - int iNewHeight = pSubDock->iMaxDockHeight; |
994 | - int iNewPositionX, iNewPositionY; |
995 | - cairo_dock_get_window_position_at_balance (pSubDock, iNewWidth, iNewHeight, &iNewPositionX, &iNewPositionY); |
996 | - |
997 | - gtk_window_present (GTK_WINDOW (pSubDock->container.pWidget)); |
998 | - |
999 | - if (pSubDock->container.bIsHorizontal) |
1000 | - gdk_window_move_resize (pSubDock->container.pWidget->window, |
1001 | - iNewPositionX, |
1002 | - iNewPositionY, |
1003 | - iNewWidth, |
1004 | - iNewHeight); |
1005 | - else |
1006 | - gdk_window_move_resize (pSubDock->container.pWidget->window, |
1007 | - iNewPositionY, |
1008 | - iNewPositionX, |
1009 | - iNewHeight, |
1010 | - iNewWidth); |
1011 | - |
1012 | - if (pSubDock->fFoldingFactor == 0.) |
1013 | - { |
1014 | - cd_debug (" on montre le sous-dock sans animation"); |
1015 | - gtk_widget_queue_draw (pSubDock->container.pWidget); |
1016 | - } |
1017 | - else |
1018 | - { |
1019 | - cd_debug (" on montre le sous-dock avec animation"); |
1020 | - cairo_dock_start_growing (pSubDock); // on commence a faire grossir les icones. |
1021 | - pSubDock->pRenderer->calculate_icons (pSubDock); // on recalcule les icones car sinon le 1er dessin se fait avec les parametres tels qu'ils etaient lorsque le dock s'est cache; or l'animation de pliage peut prendre plus de temps que celle de cachage. |
1022 | - } |
1023 | - //g_print (" -> Gap %d;%d -> W(%d;%d) (%d)\n", pSubDock->iGapX, pSubDock->iGapY, pSubDock->container.iWindowPositionX, pSubDock->container.iWindowPositionY, pSubDock->container.bIsHorizontal); |
1024 | - |
1025 | - ///gtk_window_set_keep_above (GTK_WINDOW (pSubDock->container.pWidget), myDocksParam.bPopUp); |
1026 | - |
1027 | - cairo_dock_replace_all_dialogs (); |
1028 | -} |
1029 | - |
1030 | - |
1031 | - |
1032 | -static gboolean _redraw_subdock_content_idle (Icon *pIcon) |
1033 | -{ |
1034 | - cd_debug ("%s()", __func__); |
1035 | - cd_debug (" %s", pIcon->cName); |
1036 | - CairoDock *pDock = cairo_dock_search_dock_from_name (pIcon->cParentDockName); |
1037 | - if (pDock != NULL) |
1038 | - { |
1039 | - if (pIcon->pSubDock != NULL) |
1040 | - { |
1041 | - cairo_dock_draw_subdock_content_on_icon (pIcon, pDock); |
1042 | - } |
1043 | - else // l'icone a pu perdre son sous-dock entre-temps (exemple : une classe d'appli contenant 2 icones, dont on enleve l'une des 2. |
1044 | - { |
1045 | - cairo_dock_reload_icon_image (pIcon, CAIRO_CONTAINER (pDock)); |
1046 | - } |
1047 | - cairo_dock_redraw_icon (pIcon, CAIRO_CONTAINER (pDock)); |
1048 | - } |
1049 | - pIcon->iSidRedrawSubdockContent = 0; |
1050 | - return FALSE; |
1051 | -} |
1052 | -void cairo_dock_trigger_redraw_subdock_content (CairoDock *pDock) |
1053 | -{ |
1054 | - Icon *pPointingIcon = cairo_dock_search_icon_pointing_on_dock (pDock, NULL); |
1055 | - if (pPointingIcon != NULL && (pPointingIcon->iSubdockViewType != 0 || (pPointingIcon->cClass != NULL && ! myIndicatorsParam.bUseClassIndic && (CAIRO_DOCK_ICON_TYPE_IS_CLASS_CONTAINER (pPointingIcon) || CAIRO_DOCK_ICON_TYPE_IS_LAUNCHER (pPointingIcon))))) |
1056 | - { |
1057 | - if (pPointingIcon->iSidRedrawSubdockContent != 0) // s'il y'a deja un redessin de prevu, on le passe a la fin de facon a ce qu'il ne se fasse pas avant le redessin de l'icone responsable de ce trigger. |
1058 | - g_source_remove (pPointingIcon->iSidRedrawSubdockContent); |
1059 | - pPointingIcon->iSidRedrawSubdockContent = g_idle_add ((GSourceFunc) _redraw_subdock_content_idle, pPointingIcon); |
1060 | - } |
1061 | -} |
1062 | - |
1063 | -void cairo_dock_trigger_redraw_subdock_content_on_icon (Icon *icon) |
1064 | -{ |
1065 | - if (icon->iSidRedrawSubdockContent == 0) |
1066 | - icon->iSidRedrawSubdockContent = g_idle_add ((GSourceFunc) _redraw_subdock_content_idle, icon); |
1067 | -} |
1068 | - |
1069 | -void cairo_dock_redraw_subdock_content (CairoDock *pDock) |
1070 | -{ |
1071 | - CairoDock *pParentDock = NULL; |
1072 | - Icon *pPointingIcon = cairo_dock_search_icon_pointing_on_dock (pDock, &pParentDock); |
1073 | - if (pPointingIcon != NULL && pPointingIcon->iSubdockViewType != 0 && pPointingIcon->iSidRedrawSubdockContent == 0 && pParentDock != NULL) |
1074 | - { |
1075 | - cairo_dock_draw_subdock_content_on_icon (pPointingIcon, pParentDock); |
1076 | - cairo_dock_redraw_icon (pPointingIcon, CAIRO_CONTAINER (pParentDock)); |
1077 | - } |
1078 | -} |
1079 | - |
1080 | -static gboolean _update_WM_icons (CairoDock *pDock) |
1081 | -{ |
1082 | - cairo_dock_set_icons_geometry_for_window_manager (pDock); |
1083 | - pDock->iSidUpdateWMIcons = 0; |
1084 | - return FALSE; |
1085 | -} |
1086 | -void cairo_dock_trigger_set_WM_icons_geometry (CairoDock *pDock) |
1087 | -{ |
1088 | - if (pDock->iSidUpdateWMIcons == 0) |
1089 | - { |
1090 | - pDock->iSidUpdateWMIcons = g_idle_add ((GSourceFunc) _update_WM_icons, pDock); |
1091 | - } |
1092 | -} |
1093 | - |
1094 | - |
1095 | - /////////////////////// |
1096 | - /// DOCK BACKGROUND /// |
1097 | -/////////////////////// |
1098 | - |
1099 | -static cairo_surface_t *_cairo_dock_make_stripes_background (int iWidth, int iHeight, double *fStripesColorBright, double *fStripesColorDark, int iNbStripes, double fStripesWidth, double fStripesAngle) |
1100 | -{ |
1101 | - cairo_pattern_t *pStripesPattern; |
1102 | - double fWidth = iWidth; |
1103 | - if (fabs (fStripesAngle) != 90) |
1104 | - pStripesPattern = cairo_pattern_create_linear (0.0f, |
1105 | - 0.0f, |
1106 | - iWidth, |
1107 | - iWidth * tan (fStripesAngle * G_PI/180.)); |
1108 | - else |
1109 | - pStripesPattern = cairo_pattern_create_linear (0.0f, |
1110 | - 0.0f, |
1111 | - 0., |
1112 | - (fStripesAngle == 90) ? iHeight : - iHeight); |
1113 | - g_return_val_if_fail (cairo_pattern_status (pStripesPattern) == CAIRO_STATUS_SUCCESS, NULL); |
1114 | - |
1115 | - cairo_pattern_set_extend (pStripesPattern, CAIRO_EXTEND_REPEAT); |
1116 | - |
1117 | - if (iNbStripes > 0) |
1118 | - { |
1119 | - gdouble fStep; |
1120 | - int i; |
1121 | - for (i = 0; i < iNbStripes+1; i ++) |
1122 | - { |
1123 | - fStep = (double)i / iNbStripes; |
1124 | - cairo_pattern_add_color_stop_rgba (pStripesPattern, |
1125 | - fStep - fStripesWidth / 2., |
1126 | - fStripesColorBright[0], |
1127 | - fStripesColorBright[1], |
1128 | - fStripesColorBright[2], |
1129 | - fStripesColorBright[3]); |
1130 | - cairo_pattern_add_color_stop_rgba (pStripesPattern, |
1131 | - fStep, |
1132 | - fStripesColorDark[0], |
1133 | - fStripesColorDark[1], |
1134 | - fStripesColorDark[2], |
1135 | - fStripesColorDark[3]); |
1136 | - cairo_pattern_add_color_stop_rgba (pStripesPattern, |
1137 | - fStep + fStripesWidth / 2., |
1138 | - fStripesColorBright[0], |
1139 | - fStripesColorBright[1], |
1140 | - fStripesColorBright[2], |
1141 | - fStripesColorBright[3]); |
1142 | - } |
1143 | - } |
1144 | - else |
1145 | - { |
1146 | - cairo_pattern_add_color_stop_rgba (pStripesPattern, |
1147 | - 0., |
1148 | - fStripesColorDark[0], |
1149 | - fStripesColorDark[1], |
1150 | - fStripesColorDark[2], |
1151 | - fStripesColorDark[3]); |
1152 | - cairo_pattern_add_color_stop_rgba (pStripesPattern, |
1153 | - 1., |
1154 | - fStripesColorBright[0], |
1155 | - fStripesColorBright[1], |
1156 | - fStripesColorBright[2], |
1157 | - fStripesColorBright[3]); |
1158 | - } |
1159 | - |
1160 | - cairo_surface_t *pNewSurface = cairo_dock_create_blank_surface ( |
1161 | - iWidth, |
1162 | - iHeight); |
1163 | - cairo_t *pImageContext = cairo_create (pNewSurface); |
1164 | - cairo_set_source (pImageContext, pStripesPattern); |
1165 | - cairo_paint (pImageContext); |
1166 | - |
1167 | - cairo_pattern_destroy (pStripesPattern); |
1168 | - cairo_destroy (pImageContext); |
1169 | - |
1170 | - return pNewSurface; |
1171 | -} |
1172 | -static void _cairo_dock_load_default_background (CairoDockImageBuffer *pImage, int iWidth, int iHeight) |
1173 | -{ |
1174 | - //g_print ("%s (%s, %d)\n", __func__, myDocksParam.cBackgroundImageFile, myDocksParam.bBackgroundImageRepeat); |
1175 | - if (myDocksParam.cBackgroundImageFile != NULL) |
1176 | - { |
1177 | - if (myDocksParam.bBackgroundImageRepeat) |
1178 | - { |
1179 | - cairo_surface_t *pBgSurface = cairo_dock_create_surface_from_pattern (myDocksParam.cBackgroundImageFile, |
1180 | - iWidth, |
1181 | - iHeight, |
1182 | - myDocksParam.fBackgroundImageAlpha); |
1183 | - cairo_dock_load_image_buffer_from_surface (pImage, |
1184 | - pBgSurface, |
1185 | - iWidth, |
1186 | - iHeight); |
1187 | - } |
1188 | - else |
1189 | - { |
1190 | - cairo_dock_load_image_buffer_full (pImage, |
1191 | - myDocksParam.cBackgroundImageFile, |
1192 | - iWidth, |
1193 | - iHeight, |
1194 | - CAIRO_DOCK_FILL_SPACE, |
1195 | - myDocksParam.fBackgroundImageAlpha); |
1196 | - } |
1197 | - } |
1198 | - if (pImage->pSurface == NULL) |
1199 | - { |
1200 | - cairo_surface_t *pBgSurface = _cairo_dock_make_stripes_background ( |
1201 | - iWidth, |
1202 | - iHeight, |
1203 | - myDocksParam.fStripesColorBright, |
1204 | - myDocksParam.fStripesColorDark, |
1205 | - myDocksParam.iNbStripes, |
1206 | - myDocksParam.fStripesWidth, |
1207 | - myDocksParam.fStripesAngle); |
1208 | - cairo_dock_load_image_buffer_from_surface (pImage, |
1209 | - pBgSurface, |
1210 | - iWidth, |
1211 | - iHeight); |
1212 | - } |
1213 | -} |
1214 | - |
1215 | -void cairo_dock_load_dock_background (CairoDock *pDock) |
1216 | -{ |
1217 | - cairo_dock_unload_image_buffer (&pDock->backgroundBuffer); |
1218 | - |
1219 | - int iWidth = pDock->iDecorationsWidth; |
1220 | - int iHeight = pDock->iDecorationsHeight; |
1221 | - |
1222 | - if (pDock->bGlobalBg || pDock->iRefCount > 0) |
1223 | - { |
1224 | - _cairo_dock_load_default_background (&pDock->backgroundBuffer, iWidth, iHeight); |
1225 | - } |
1226 | - else if (pDock->cBgImagePath != NULL) |
1227 | - { |
1228 | - cairo_dock_load_image_buffer (&pDock->backgroundBuffer, pDock->cBgImagePath, iWidth, iHeight, CAIRO_DOCK_FILL_SPACE); |
1229 | - } |
1230 | - if (pDock->backgroundBuffer.pSurface == NULL) |
1231 | - { |
1232 | - cairo_surface_t *pSurface = _cairo_dock_make_stripes_background (iWidth, iHeight, pDock->fBgColorBright, pDock->fBgColorDark, 0, 0., 90); |
1233 | - cairo_dock_load_image_buffer_from_surface (&pDock->backgroundBuffer, pSurface, iWidth, iHeight); |
1234 | - } |
1235 | -} |
1236 | - |
1237 | -static gboolean _load_background_idle (CairoDock *pDock) |
1238 | -{ |
1239 | - cairo_dock_load_dock_background (pDock); |
1240 | - |
1241 | - pDock->iSidLoadBg = 0; |
1242 | - return FALSE; |
1243 | -} |
1244 | -void cairo_dock_trigger_load_dock_background (CairoDock *pDock) |
1245 | -{ |
1246 | - if (pDock->iDecorationsWidth == pDock->backgroundBuffer.iWidth && pDock->iDecorationsHeight == pDock->backgroundBuffer.iHeight) // mise a jour inutile. |
1247 | - return; |
1248 | - if (pDock->iSidLoadBg == 0) |
1249 | - pDock->iSidLoadBg = g_idle_add ((GSourceFunc)_load_background_idle, pDock); |
1250 | -} |
1251 | |
1252 | === modified file '.pc/applied-patches' |
1253 | --- .pc/applied-patches 2011-05-21 21:03:26 +0000 |
1254 | +++ .pc/applied-patches 2011-06-20 15:05:34 +0000 |
1255 | @@ -1,2 +1,1 @@ |
1256 | 01-default_theme_with_default_apps |
1257 | -02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch |
1258 | |
1259 | === modified file 'CMakeLists.txt' |
1260 | --- CMakeLists.txt 2011-05-21 21:03:26 +0000 |
1261 | +++ CMakeLists.txt 2011-06-20 15:05:34 +0000 |
1262 | @@ -10,7 +10,7 @@ |
1263 | ########### project ############### |
1264 | |
1265 | project ("cairo-dock") |
1266 | -set (VERSION "2.3.0~2") |
1267 | +set (VERSION "2.3.0~3") |
1268 | |
1269 | add_definitions (-std=c99 -Wstrict-prototypes -Wextra -Wwrite-strings -Wuninitialized -Werror-implicit-function-declaration) #-Wunreachable-code -Wno-unused-parameter -Wall |
1270 | if (NOT ${CMAKE_BUILD_TYPE}) |
1271 | |
1272 | === modified file 'debian/changelog' |
1273 | --- debian/changelog 2011-05-21 21:03:26 +0000 |
1274 | +++ debian/changelog 2011-06-20 15:05:34 +0000 |
1275 | @@ -1,3 +1,16 @@ |
1276 | +cairo-dock (2.3.0~3-0ubuntu1) UNRELEASED; urgency=low |
1277 | + |
1278 | + * New upstream release. (LP: #799773) |
1279 | + * Upstream ChangeLog: |
1280 | + - Fixed a crash that occurs when the MP applet is in desklet |
1281 | + mode and applets separated from launchers |
1282 | + and the music-player is launched. (LP: #797273) |
1283 | + * debian/patches: |
1284 | + - Removed 02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch |
1285 | + (now in the upstream release) |
1286 | + |
1287 | + -- Matthieu Baerts (matttbe) <matttbe@gmail.com> Mon, 20 Jun 2011 16:55:12 +0200 |
1288 | + |
1289 | cairo-dock (2.3.0~2-0ubuntu1) oneiric; urgency=low |
1290 | |
1291 | * New upstream release. (LP: #786104) |
1292 | |
1293 | === modified file 'debian/patches/01-default_theme_with_default_apps' |
1294 | --- debian/patches/01-default_theme_with_default_apps 2011-03-17 14:08:48 +0000 |
1295 | +++ debian/patches/01-default_theme_with_default_apps 2011-06-20 15:05:34 +0000 |
1296 | @@ -1,7 +1,7 @@ |
1297 | Index: cairo-dock/data/default-theme/launchers/01eog.desktop |
1298 | =================================================================== |
1299 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
1300 | -+++ cairo-dock/data/default-theme/launchers/01eog.desktop 2011-04-19 22:59:04.000000000 +0200 |
1301 | ++++ cairo-dock/data/default-theme/launchers/01eog.desktop 2011-06-19 18:02:00.744393000 +0200 |
1302 | @@ -0,0 +1,54 @@ |
1303 | +#!en |
1304 | + |
1305 | @@ -60,7 +60,7 @@ |
1306 | Index: cairo-dock/data/default-theme/launchers/01evolution.desktop |
1307 | =================================================================== |
1308 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
1309 | -+++ cairo-dock/data/default-theme/launchers/01evolution.desktop 2011-04-19 22:59:04.000000000 +0200 |
1310 | ++++ cairo-dock/data/default-theme/launchers/01evolution.desktop 2011-06-19 18:02:00.744393000 +0200 |
1311 | @@ -0,0 +1,47 @@ |
1312 | +#!en |
1313 | + |
1314 | @@ -111,7 +111,7 @@ |
1315 | +X-Ubuntu-Gettext-Domain=evolution-2.32 |
1316 | Index: cairo-dock/data/default-theme/launchers/01f-spot.desktop |
1317 | =================================================================== |
1318 | ---- cairo-dock.orig/data/default-theme/launchers/01f-spot.desktop 2011-04-19 22:58:37.817058474 +0200 |
1319 | +--- cairo-dock.orig/data/default-theme/launchers/01f-spot.desktop 2011-06-19 18:02:00.744393000 +0200 |
1320 | +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 |
1321 | @@ -1,53 +0,0 @@ |
1322 | -#!en |
1323 | @@ -169,7 +169,7 @@ |
1324 | -X-GNOME-DocPath=f-spot/f-spot.xml |
1325 | Index: cairo-dock/data/default-theme/launchers/01inkscape.desktop |
1326 | =================================================================== |
1327 | ---- cairo-dock.orig/data/default-theme/launchers/01inkscape.desktop 2011-04-19 22:58:37.787058430 +0200 |
1328 | +--- cairo-dock.orig/data/default-theme/launchers/01inkscape.desktop 2011-06-19 18:02:00.744393000 +0200 |
1329 | +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 |
1330 | @@ -1,92 +0,0 @@ |
1331 | -#!en |
1332 | @@ -264,54 +264,10 @@ |
1333 | -MimeType=image/svg+xml;image/svg+xml-compressed; |
1334 | -TryExec=inkscape |
1335 | -StartupNotify=true |
1336 | -Index: cairo-dock/data/default-theme/launchers/CMakeLists.txt |
1337 | -=================================================================== |
1338 | ---- cairo-dock.orig/data/default-theme/launchers/CMakeLists.txt 2011-04-19 22:58:37.707058307 +0200 |
1339 | -+++ cairo-dock/data/default-theme/launchers/CMakeLists.txt 2011-04-19 22:59:04.000000000 +0200 |
1340 | -@@ -8,10 +8,10 @@ |
1341 | - 01gimp.desktop |
1342 | - 01firefox.desktop |
1343 | - 01gnome-terminal.desktop |
1344 | -- 01f-spot.desktop |
1345 | -- 01inkscape.desktop |
1346 | -+ 01shotwell.desktop |
1347 | -+ 01eog.desktop |
1348 | - 01separator.desktop |
1349 | -- 01thunderbird.desktop |
1350 | -+ 01evolution.desktop |
1351 | - 02separator.desktop |
1352 | - 03separator.desktop |
1353 | - DESTINATION ${pkgdatadir}/themes/_default_/launchers) |
1354 | -Index: cairo-dock/data/default-theme/plug-ins/GMenu/GMenu.conf |
1355 | -=================================================================== |
1356 | ---- cairo-dock.orig/data/default-theme/plug-ins/GMenu/GMenu.conf 2011-04-19 22:58:37.907058606 +0200 |
1357 | -+++ cairo-dock/data/default-theme/plug-ins/GMenu/GMenu.conf 2011-04-19 22:59:04.000000000 +0200 |
1358 | -@@ -17,7 +17,7 @@ |
1359 | - |
1360 | - #S+ Image filename: |
1361 | - #{Leave empty to use the default one.} |
1362 | --icon=alacarte |
1363 | -+icon=distributor-logo |
1364 | - |
1365 | - #j+[0;128] Desired icon size for this applet |
1366 | - #{Set to 0 to use the default applet size} |
1367 | -Index: cairo-dock/data/default-theme/plug-ins/musicPlayer/musicPlayer.conf |
1368 | -=================================================================== |
1369 | ---- cairo-dock.orig/data/default-theme/plug-ins/musicPlayer/musicPlayer.conf 2011-04-19 22:58:37.867058541 +0200 |
1370 | -+++ cairo-dock/data/default-theme/plug-ins/musicPlayer/musicPlayer.conf 2011-04-19 22:59:04.000000000 +0200 |
1371 | -@@ -107,7 +107,7 @@ |
1372 | - #F[Audio Player;gtk-cdrom] |
1373 | - frame_player= |
1374 | - #L[Amarok 2;Audacious;Banshee;Clementine;Exaile;Exaile 0.3;GMusicBrowser;Guayadeque;Listen;Qmmp;QuodLibet;Rhythmbox;Songbird;XMMS 2;XMMS] Player to control: |
1375 | --current-player=Rhythmbox |
1376 | -+current-player=Banshee |
1377 | - |
1378 | - #b Steal the player's icon from the taskbar? |
1379 | - #{This will prevent the player icon appearing in the taskbar. The applet's icon will then behave as a launcher, an application and an applet.} |
1380 | Index: cairo-dock/data/default-theme/launchers/01shotwell.desktop |
1381 | =================================================================== |
1382 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
1383 | -+++ cairo-dock/data/default-theme/launchers/01shotwell.desktop 2011-04-19 22:59:04.000000000 +0200 |
1384 | ++++ cairo-dock/data/default-theme/launchers/01shotwell.desktop 2011-06-19 18:02:00.744393000 +0200 |
1385 | @@ -0,0 +1,52 @@ |
1386 | +#!en |
1387 | + |
1388 | @@ -367,7 +323,7 @@ |
1389 | +X-Ayatana-Appmenu-Show-Stubs=false |
1390 | Index: cairo-dock/data/default-theme/launchers/01thunderbird.desktop |
1391 | =================================================================== |
1392 | ---- cairo-dock.orig/data/default-theme/launchers/01thunderbird.desktop 2011-04-19 22:58:37.757058386 +0200 |
1393 | +--- cairo-dock.orig/data/default-theme/launchers/01thunderbird.desktop 2011-06-19 18:02:00.744393000 +0200 |
1394 | +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 |
1395 | @@ -1,58 +0,0 @@ |
1396 | -#!en |
1397 | @@ -428,3 +384,47 @@ |
1398 | -Comment[pl]=Czytanie i wysyłanie e-maili |
1399 | -Comment[pt_BR]=Ler e escrever suas mensagens |
1400 | -Comment[sv]=Läs och skriv e-post |
1401 | +Index: cairo-dock/data/default-theme/launchers/CMakeLists.txt |
1402 | +=================================================================== |
1403 | +--- cairo-dock.orig/data/default-theme/launchers/CMakeLists.txt 2011-06-19 18:02:00.744393000 +0200 |
1404 | ++++ cairo-dock/data/default-theme/launchers/CMakeLists.txt 2011-06-19 18:02:00.744393000 +0200 |
1405 | +@@ -8,10 +8,10 @@ |
1406 | + 01gimp.desktop |
1407 | + 01firefox.desktop |
1408 | + 01gnome-terminal.desktop |
1409 | +- 01f-spot.desktop |
1410 | +- 01inkscape.desktop |
1411 | ++ 01shotwell.desktop |
1412 | ++ 01eog.desktop |
1413 | + 01separator.desktop |
1414 | +- 01thunderbird.desktop |
1415 | ++ 01evolution.desktop |
1416 | + 02separator.desktop |
1417 | + 03separator.desktop |
1418 | + DESTINATION ${pkgdatadir}/themes/_default_/launchers) |
1419 | +Index: cairo-dock/data/default-theme/plug-ins/GMenu/GMenu.conf |
1420 | +=================================================================== |
1421 | +--- cairo-dock.orig/data/default-theme/plug-ins/GMenu/GMenu.conf 2011-06-19 18:02:00.744393000 +0200 |
1422 | ++++ cairo-dock/data/default-theme/plug-ins/GMenu/GMenu.conf 2011-06-19 18:02:00.744393000 +0200 |
1423 | +@@ -17,7 +17,7 @@ |
1424 | + |
1425 | + #S+ Image filename: |
1426 | + #{Leave empty to use the default one.} |
1427 | +-icon=alacarte |
1428 | ++icon=distributor-logo |
1429 | + |
1430 | + #j+[0;128] Desired icon size for this applet |
1431 | + #{Set to 0 to use the default applet size} |
1432 | +Index: cairo-dock/data/default-theme/plug-ins/musicPlayer/musicPlayer.conf |
1433 | +=================================================================== |
1434 | +--- cairo-dock.orig/data/default-theme/plug-ins/musicPlayer/musicPlayer.conf 2011-06-19 18:02:00.744393000 +0200 |
1435 | ++++ cairo-dock/data/default-theme/plug-ins/musicPlayer/musicPlayer.conf 2011-06-19 18:02:00.744393000 +0200 |
1436 | +@@ -107,7 +107,7 @@ |
1437 | + #F[Audio Player;gtk-cdrom] |
1438 | + frame_player= |
1439 | + #L[Amarok 2;Audacious;Banshee;Clementine;Exaile;Exaile 0.3;GMusicBrowser;Guayadeque;Listen;Qmmp;QuodLibet;Rhythmbox;Songbird;XMMS 2;XMMS] Player to control: |
1440 | +-current-player=Rhythmbox |
1441 | ++current-player=Banshee |
1442 | + |
1443 | + #b Steal the player's icon from the taskbar? |
1444 | + #{This will prevent the player icon appearing in the taskbar. The applet's icon will then behave as a launcher, an application and an applet.} |
1445 | |
1446 | === removed file 'debian/patches/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch' |
1447 | --- debian/patches/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch 2011-05-21 21:03:26 +0000 |
1448 | +++ debian/patches/02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch 1970-01-01 00:00:00 +0000 |
1449 | @@ -1,25 +0,0 @@ |
1450 | -From: Matthieu Baerts <matttbe@gmail.com> |
1451 | -Subject: Fixed an annoying bug when we slowly leave the dock with the cursor on the edge of it |
1452 | -Origin: upstream, http://bazaar.launchpad.net/~cairo-dock-team/cairo-dock-core/2.3.x/revision/757 |
1453 | -Bug: http://www.glx-dock.org/tt_task.php?p=1&t=174 |
1454 | -Forwarded: yes |
1455 | - |
1456 | -Index: cairo-dock/src/gldit/cairo-dock-dock-facility.c |
1457 | -=================================================================== |
1458 | ---- cairo-dock.orig/src/gldit/cairo-dock-dock-facility.c 2011-05-21 10:52:15.504630255 +0200 |
1459 | -+++ cairo-dock/src/gldit/cairo-dock-dock-facility.c 2011-05-21 10:52:38.494663981 +0200 |
1460 | -@@ -760,11 +760,10 @@ |
1461 | - } |
1462 | - else |
1463 | - { |
1464 | -- double fSideMargin = fabs (pDock->fAlign - .5) * (iWidth - pDock->fFlatDockWidth); |
1465 | -- if (x_abs < - fSideMargin || x_abs > pDock->fFlatDockWidth + fSideMargin) |
1466 | -- iMousePositionType = CAIRO_DOCK_MOUSE_OUTSIDE; |
1467 | -- else |
1468 | -+ if (iMouseY >= 0 && iMouseY < iHeight) |
1469 | - iMousePositionType = CAIRO_DOCK_MOUSE_ON_THE_EDGE; |
1470 | -+ else |
1471 | -+ iMousePositionType = CAIRO_DOCK_MOUSE_OUTSIDE; |
1472 | - } |
1473 | - } |
1474 | - else if (iMouseY >= 0 && iMouseY < iHeight) // et en plus on est dedans en y. // && pPointedIcon != NULL |
1475 | |
1476 | === modified file 'debian/patches/series' |
1477 | --- debian/patches/series 2011-05-21 21:03:26 +0000 |
1478 | +++ debian/patches/series 2011-06-20 15:05:34 +0000 |
1479 | @@ -1,2 +1,1 @@ |
1480 | 01-default_theme_with_default_apps |
1481 | -02-mouse-leaves-on-the-edge_upstream-version-2.3.0~2.1.patch |
1482 | |
1483 | === modified file 'src/gldit/cairo-dock-class-manager.c' |
1484 | --- src/gldit/cairo-dock-class-manager.c 2011-03-17 14:08:48 +0000 |
1485 | +++ src/gldit/cairo-dock-class-manager.c 2011-06-20 15:05:34 +0000 |
1486 | @@ -1004,7 +1004,9 @@ |
1487 | if (CAIRO_DOCK_ICON_TYPE_IS_APPLET (pInhibitorIcon) && myIconsParam.iSeparateIcons) |
1488 | continue; |
1489 | pDock = cairo_dock_search_dock_from_name (pInhibitorIcon->cParentDockName); |
1490 | - if (!pDock || !pDock->bIsMainDock) |
1491 | + if (!pDock) // not inside a dock, for instance a desklet; no interest for us here. |
1492 | + continue; |
1493 | + if (pDock->iRefCount != 0) // inside a sub-dock, take the pointing icon inside the main dock. |
1494 | pInhibitorIcon = cairo_dock_search_icon_pointing_on_dock (pDock, NULL); |
1495 | pSameClassIcon = pInhibitorIcon; |
1496 | if (CAIRO_DOCK_ICON_TYPE_IS_LAUNCHER (pSameClassIcon)) // on prend les lanceurs de preference. |
1497 | |
1498 | === modified file 'src/gldit/cairo-dock-dock-manager.c' |
1499 | --- src/gldit/cairo-dock-dock-manager.c 2011-05-20 23:13:48 +0000 |
1500 | +++ src/gldit/cairo-dock-dock-manager.c 2011-06-20 15:05:34 +0000 |
1501 | @@ -372,7 +372,7 @@ |
1502 | } |
1503 | Icon *cairo_dock_search_icon_pointing_on_dock (CairoDock *pDock, CairoDock **pParentDock) // pParentDock peut etre NULL. |
1504 | { |
1505 | - if (pDock->bIsMainDock) // par definition. On n'utilise pas iRefCount, car si on est en train de detruire un dock, sa reference est deja decrementee. C'est dommage mais c'est comme ca. |
1506 | + if (pDock == NULL || pDock->bIsMainDock) // par definition. On n'utilise pas iRefCount, car si on est en train de detruire un dock, sa reference est deja decrementee. C'est dommage mais c'est comme ca. |
1507 | return NULL; |
1508 | Icon *pPointingIcon = NULL; |
1509 | gpointer data[3] = {pDock, &pPointingIcon, pParentDock}; |