~cairo-dock-team/cairo-dock-core/3.0.x

505 by fabounet
added a dialog manager and factory
1
/**
2
* This file is a part of the Cairo-Dock project
3
*
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail    : see the 'copyright' file.
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include <stdlib.h>
21
#include <string.h>
22
#include <math.h>
23
#include <gdk/gdkkeysyms.h>
931 by Matthieu Baerts
Removed gtkglext (part 2) - @fabounet: now it compiles and works with GTK2 but don't hesitate to revert anything ;)
24
#include <gdk/gdkx.h> // GDK_WINDOW_XID
505 by fabounet
added a dialog manager and factory
25
26
#include <GL/gl.h>
27
#include <GL/glu.h>
28
#include <GL/glx.h>
29
697.1.1 by Fabrice Rey
core rewriting \!
30
#include "cairo-dock-icon-factory.h"
31
#include "cairo-dock-icon-facility.h"
505 by fabounet
added a dialog manager and factory
32
#include "cairo-dock-container.h"
697.1.1 by Fabrice Rey
core rewriting \!
33
#include "cairo-dock-image-buffer.h"
505 by fabounet
added a dialog manager and factory
34
#include "cairo-dock-draw.h"
35
#include "cairo-dock-draw-opengl.h"
36
#include "cairo-dock-log.h"
37
#include "cairo-dock-desklet-factory.h"
38
#include "cairo-dock-dock-manager.h"
39
#include "cairo-dock-dock-facility.h"
546 by fabounet
some code refinement
40
#include "cairo-dock-backends-manager.h"
505 by fabounet
added a dialog manager and factory
41
#include "cairo-dock-surface-factory.h"
42
#include "cairo-dock-animations.h"
43
#include "cairo-dock-notifications.h"
44
#include "cairo-dock-callbacks.h"
45
#include "cairo-dock-launcher-manager.h"
46
#include "cairo-dock-gui-manager.h"
47
#include "cairo-dock-applications-manager.h"
48
#include "cairo-dock-X-manager.h"
566 by fabounet
removed 'keep the dock below' option and cleant the config from several useless options
49
#include "cairo-dock-X-utilities.h"
697.1.1 by Fabrice Rey
core rewriting \!
50
#include "cairo-dock-dialog-manager.h"
505 by fabounet
added a dialog manager and factory
51
#include "cairo-dock-dialog-factory.h"
52
53
extern CairoDockDesktopGeometry g_desktopGeometry;
54
extern gboolean g_bUseOpenGL;
636 by Fabrice Rey
fixed labels off-screen position in Panel view (opengl)
55
extern CairoDockHidingEffect *g_pHidingBackend;  // cairo_dock_is_hidden
505 by fabounet
added a dialog manager and factory
56
57
#define _drawn_text_width(pDialog) (pDialog->iMaxTextWidth != 0 && pDialog->iTextWidth > pDialog->iMaxTextWidth ? pDialog->iMaxTextWidth : pDialog->iTextWidth)
58
59
static void _cairo_dock_compute_dialog_sizes (CairoDialog *pDialog)
60
{
637 by Fabrice Rey
added an offset for the icon in dialogs
61
	pDialog->iMessageWidth = pDialog->iIconSize + _drawn_text_width (pDialog) + (pDialog->iTextWidth != 0 ? 2 : 0) * CAIRO_DIALOG_TEXT_MARGIN - pDialog->iIconOffsetX;  // icone + marge + texte + marge.
800 by Fabrice Rey
dialogs: fixed a small rendering bug when the dialog's icon has an offset
62
	pDialog->iMessageHeight = MAX (pDialog->iIconSize - pDialog->iIconOffsetY, pDialog->iTextHeight) + (pDialog->pInteractiveWidget != NULL ? CAIRO_DIALOG_VGAP : 0);  // (icone/texte + marge) + widget + (marge + boutons) + pointe.
505 by fabounet
added a dialog manager and factory
63
	
64
	if (pDialog->pButtons != NULL)
65
	{
697.1.1 by Fabrice Rey
core rewriting \!
66
		pDialog->iButtonsWidth = pDialog->iNbButtons * myDialogsParam.iDialogButtonWidth + (pDialog->iNbButtons - 1) * CAIRO_DIALOG_BUTTON_GAP + 2 * CAIRO_DIALOG_TEXT_MARGIN;  // marge + bouton1 + ecart + bouton2 + marge.
67
		pDialog->iButtonsHeight = CAIRO_DIALOG_VGAP + myDialogsParam.iDialogButtonHeight;  // il y'a toujours quelque chose au-dessus (texte et/out widget)
505 by fabounet
added a dialog manager and factory
68
	}
69
	
70
	pDialog->iBubbleWidth = MAX (pDialog->iInteractiveWidth, MAX (pDialog->iButtonsWidth, MAX (pDialog->iMessageWidth, pDialog->iMinFrameWidth)));
71
	pDialog->iBubbleHeight = pDialog->iMessageHeight + pDialog->iInteractiveHeight + pDialog->iButtonsHeight;
72
	if (pDialog->iBubbleWidth == 0)  // precaution.
73
		pDialog->iBubbleWidth = 20;
74
	if (pDialog->iBubbleHeight == 0)
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
75
		pDialog->iBubbleHeight = 10;
76
	
77
	pDialog->iComputedWidth = pDialog->iLeftMargin + pDialog->iBubbleWidth + pDialog->iRightMargin;
78
	pDialog->iComputedHeight = pDialog->iTopMargin + pDialog->iBubbleHeight + pDialog->iBottomMargin + pDialog->iMinBottomGap;  // all included.
79
	
80
	pDialog->container.iWidth = pDialog->iComputedWidth;
81
	pDialog->container.iHeight = pDialog->iComputedHeight;
505 by fabounet
added a dialog manager and factory
82
}
83
84
static gboolean on_expose_dialog (GtkWidget *pWidget,
936 by Fabrice Rey
port to GTK3: complete !
85
#if (GTK_MAJOR_VERSION < 3)
505 by fabounet
added a dialog manager and factory
86
	GdkEventExpose *pExpose,
936 by Fabrice Rey
port to GTK3: complete !
87
#else
88
	cairo_t *ctx,
89
#endif
505 by fabounet
added a dialog manager and factory
90
	CairoDialog *pDialog)
91
{
623 by fabounet
vfs integration : changed the mount/unmount prototype
92
	//g_print ("%s (%dx%d ; %d;%d)\n", __func__, pDialog->container.iWidth, pDialog->container.iHeight, pExpose->area.x, pExpose->area.y);
505 by fabounet
added a dialog manager and factory
93
	int x, y;
936 by Fabrice Rey
port to GTK3: complete !
94
	// OpenGL renderers are not ready for dialogs.
95
	/*if (g_bUseOpenGL && (pDialog->pDecorator == NULL || pDialog->pDecorator->render_opengl != NULL) && (pDialog->pRenderer == NULL || pDialog->pRenderer->render_opengl != NULL))
505 by fabounet
added a dialog manager and factory
96
	{
936 by Fabrice Rey
port to GTK3: complete !
97
		if (! gldi_glx_begin_draw_container (CAIRO_CONTAINER (pDialog)))
505 by fabounet
added a dialog manager and factory
98
			return FALSE;
99
		
100
		if (pDialog->pDecorator != NULL && pDialog->pDecorator->render_opengl != NULL)
101
		{
102
			glPushMatrix ();
103
			pDialog->pDecorator->render_opengl (pDialog);
104
			glPopMatrix ();
105
		}
106
		
960 by Fabrice Rey
merged some properties and notifications into the Container class -> 3.0-alpha2
107
		cairo_dock_notify_on_object (pDialog, NOTIFICATION_RENDER, pDialog, NULL);
505 by fabounet
added a dialog manager and factory
108
		
936 by Fabrice Rey
port to GTK3: complete !
109
		gldi_glx_end_draw_container (CAIRO_CONTAINER (pDialog));
505 by fabounet
added a dialog manager and factory
110
	}
111
	else
933 by Matthieu Baerts
CMakeLists.txt: Added libcurl to .pc
112
	{*/
505 by fabounet
added a dialog manager and factory
113
		cairo_t *pCairoContext;
114
		
936 by Fabrice Rey
port to GTK3: complete !
115
		GdkRectangle area;
116
		#if (GTK_MAJOR_VERSION < 3)
937 by Matthieu Baerts
Port to GTK3: now works with GTK2 too
117
		memcpy (&area, &pExpose->area, sizeof (GdkRectangle));
936 by Fabrice Rey
port to GTK3: complete !
118
		#else
119
		double x1, x2, y1, y2;
120
		cairo_clip_extents (ctx, &x1, &y1, &x2, &y2);
121
		area.x = x1;
122
		area.y = y1;
123
		area.width = x2 - x1;
124
		area.height = y2 - y1;  /// or the opposite ?...
125
		#endif
126
		
937 by Matthieu Baerts
Port to GTK3: now works with GTK2 too
127
		if (area.x != 0 || area.y != 0)
505 by fabounet
added a dialog manager and factory
128
		{
936 by Fabrice Rey
port to GTK3: complete !
129
			pCairoContext = cairo_dock_create_drawing_context_on_area (CAIRO_CONTAINER (pDialog), &area, myDialogsParam.fDialogColor);
505 by fabounet
added a dialog manager and factory
130
		}
131
		else
132
		{
133
			pCairoContext = cairo_dock_create_drawing_context_on_container (CAIRO_CONTAINER (pDialog));
134
		}
135
		
136
		if (pDialog->pDecorator != NULL)
137
		{
138
			cairo_save (pCairoContext);
139
			pDialog->pDecorator->render (pCairoContext, pDialog);
140
			cairo_restore (pCairoContext);
141
		}
142
		
960 by Fabrice Rey
merged some properties and notifications into the Container class -> 3.0-alpha2
143
		cairo_dock_notify_on_object (pDialog, NOTIFICATION_RENDER, pDialog, pCairoContext);
505 by fabounet
added a dialog manager and factory
144
		
566 by fabounet
removed 'keep the dock below' option and cleant the config from several useless options
145
		if (pDialog->fAppearanceCounter < 1.)
146
		{
147
			double fAlpha = pDialog->fAppearanceCounter * pDialog->fAppearanceCounter;
148
			cairo_rectangle (pCairoContext,
149
				0,
150
				0,
151
				pDialog->container.iWidth,
152
				pDialog->container.iHeight);
153
			cairo_set_line_width (pCairoContext, 0);
154
			cairo_set_operator (pCairoContext, CAIRO_OPERATOR_DEST_OUT);
155
			cairo_set_source_rgba (pCairoContext, 0.0, 0.0, 0.0, 1. - fAlpha);
156
			cairo_fill (pCairoContext);
157
		}
158
		
505 by fabounet
added a dialog manager and factory
159
		cairo_destroy (pCairoContext);
933 by Matthieu Baerts
CMakeLists.txt: Added libcurl to .pc
160
	//}
505 by fabounet
added a dialog manager and factory
161
	return FALSE;
162
}
163
588 by fabounet
fixed several minor bugs
164
static void _cairo_dock_set_dialog_input_shape (CairoDialog *pDialog)
165
{
936 by Fabrice Rey
port to GTK3: complete !
166
	if (pDialog->pShapeBitmap != NULL)
167
		gldi_shape_destroy (pDialog->pShapeBitmap);
168
	
169
	pDialog->pShapeBitmap = gldi_container_create_input_shape (CAIRO_CONTAINER (pDialog),
588 by fabounet
fixed several minor bugs
170
		0,
171
		0,
172
		1,
936 by Fabrice Rey
port to GTK3: complete !
173
		1);  // workaround a bug in X with fully transparent window => let 1 pixel ON.
174
175
	gldi_container_set_input_shape (CAIRO_CONTAINER (pDialog), pDialog->pShapeBitmap);
588 by fabounet
fixed several minor bugs
176
}
177
505 by fabounet
added a dialog manager and factory
178
static gboolean on_configure_dialog (GtkWidget* pWidget,
179
	GdkEventConfigure* pEvent,
180
	CairoDialog *pDialog)
181
{
742 by Fabrice Rey
dialogs: added a generic method to close/hide a dialog by clicking on it
182
	//g_print ("%s (%dx%d, %d;%d) [%d]\n", __func__, pEvent->width, pEvent->height, pEvent->x, pEvent->y, pDialog->bPositionForced);
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
183
	if (pEvent->width <= CAIRO_DIALOG_MIN_SIZE && pEvent->height <= CAIRO_DIALOG_MIN_SIZE && ! pDialog->bNoInput)
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
184
	{
185
		pDialog->container.bInside = FALSE;
505 by fabounet
added a dialog manager and factory
186
		return FALSE;
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
187
	}
505 by fabounet
added a dialog manager and factory
188
	
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
189
	//\____________ get dialog size and position.
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
190
	int iPrevWidth = pDialog->container.iWidth, iPrevHeight = pDialog->container.iHeight;
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
191
	pDialog->container.iWidth = pEvent->width;
192
	pDialog->container.iHeight = pEvent->height;
193
	pDialog->container.iWindowPositionX = pEvent->x;
194
	pDialog->container.iWindowPositionY = pEvent->y;
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
195
	
196
	//\____________ if an interactive widget is present, internal sizes may have changed.
505 by fabounet
added a dialog manager and factory
197
	if (pDialog->pInteractiveWidget != NULL)
198
	{
718 by Fabrice Rey
fixed dialogs position when they hold a widget + use new theme server address and allow redirections
199
		int w = pDialog->iInteractiveWidth, h = pDialog->iInteractiveHeight;
505 by fabounet
added a dialog manager and factory
200
		GtkRequisition requisition;
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
201
		#if (GTK_MAJOR_VERSION < 3)
505 by fabounet
added a dialog manager and factory
202
		gtk_widget_size_request (pDialog->pInteractiveWidget, &requisition);
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
203
		#else
204
		gtk_widget_get_preferred_size (pDialog->pInteractiveWidget, &requisition, NULL);
205
		#endif
505 by fabounet
added a dialog manager and factory
206
		pDialog->iInteractiveWidth = requisition.width;
207
		pDialog->iInteractiveHeight = requisition.height;
208
		//g_print ("  pInteractiveWidget : %dx%d\n", pDialog->iInteractiveWidth, pDialog->iInteractiveHeight);
209
		_cairo_dock_compute_dialog_sizes (pDialog);
718 by Fabrice Rey
fixed dialogs position when they hold a widget + use new theme server address and allow redirections
210
		
211
		if (w != pDialog->iInteractiveWidth || h != pDialog->iInteractiveHeight)
212
		{
213
			cairo_dock_replace_all_dialogs ();
214
			/*Icon *pIcon = pDialog->pIcon;
215
			if (pIcon != NULL)
216
			{
217
				CairoContainer *pContainer = cairo_dock_search_container_from_icon (pIcon);
218
				cairo_dock_place_dialog (pDialog, pContainer);
219
			}*/
220
		}
505 by fabounet
added a dialog manager and factory
221
	}
697.1.1 by Fabrice Rey
core rewriting \!
222
	//g_print ("dialog size: %dx%d / %dx%d\n", pEvent->width, pEvent->height, pDialog->iComputedWidth, pDialog->iComputedHeight);
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
223
	
224
	//\____________ set input shape if size has changed or if no shape yet.
225
	if (pDialog->bNoInput && (iPrevWidth != pEvent->width || iPrevHeight != pEvent->height || ! pDialog->pShapeBitmap))
226
	{
227
		_cairo_dock_set_dialog_input_shape (pDialog);
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
228
		pDialog->container.bInside = FALSE;
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
229
	}
230
	
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
231
	//\____________ force position for buggy WM (Compiz).
695 by Fabrice Rey
fixed dialogs position (don't use gravity since most WM are broken) + give a name (automatic) to docks in the menu + improved the GUI for small resolution (again)
232
	if (pDialog->iComputedWidth == pEvent->width && pDialog->iComputedHeight == pEvent->height && (pEvent->y != pDialog->iComputedPositionY || pEvent->x != pDialog->iComputedPositionX) && pDialog->bPositionForced == 3)
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
233
	{
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
234
		pDialog->container.bInside = FALSE;
750 by matttbe
Removed a lot of g_print
235
		cd_debug ("force to %d;%d", pDialog->iComputedPositionX, pDialog->iComputedPositionY);
695 by Fabrice Rey
fixed dialogs position (don't use gravity since most WM are broken) + give a name (automatic) to docks in the menu + improved the GUI for small resolution (again)
236
		/*gtk_window_move (GTK_WINDOW (pDialog->container.pWidget),
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
237
			pDialog->iComputedPositionX,
238
			pDialog->iComputedPositionY);
695 by Fabrice Rey
fixed dialogs position (don't use gravity since most WM are broken) + give a name (automatic) to docks in the menu + improved the GUI for small resolution (again)
239
		*/pDialog->bPositionForced ++;
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
240
	}
241
	
505 by fabounet
added a dialog manager and factory
242
	gtk_widget_queue_draw (pDialog->container.pWidget);  // les widgets internes peuvent avoir changer de taille sans que le dialogue n'en ait change, il faut donc redessiner tout le temps.
243
244
	return FALSE;
245
}
246
247
static gboolean on_unmap_dialog (GtkWidget* pWidget,
248
	GdkEvent *pEvent,
249
	CairoDialog *pDialog)
250
{
251
	//g_print ("unmap dialog (bAllowMinimize:%d, visible:%d)\n", pDialog->bAllowMinimize, GTK_WIDGET_VISIBLE (pWidget));
252
	if (! pDialog->bAllowMinimize)
253
	{
254
		if (pDialog->pUnmapTimer)
255
		{
256
			double fElapsedTime = g_timer_elapsed (pDialog->pUnmapTimer, NULL);
257
			//g_print ("fElapsedTime : %fms\n", fElapsedTime);
258
			g_timer_destroy (pDialog->pUnmapTimer);
259
			pDialog->pUnmapTimer = NULL;
260
			if (fElapsedTime < .2)
261
				return TRUE;
262
		}
263
		gtk_window_present (GTK_WINDOW (pWidget));
264
	}
265
	else
266
	{
267
		pDialog->bAllowMinimize = FALSE;
268
		if (pDialog->pUnmapTimer == NULL)
269
			pDialog->pUnmapTimer = g_timer_new ();  // starts the timer.
270
	}
271
	return TRUE;  // stops other handlers from being invoked for the event.
272
}
273
274
static GtkWidget *_cairo_dock_add_dialog_internal_box (CairoDialog *pDialog, int iWidth, int iHeight, gboolean bCanResize)
275
{
943 by Fabrice Rey
define gtk_hbox_new for GTK3 to avoid a #if/else each time
276
	GtkWidget *pBox = _gtk_hbox_new (0);
505 by fabounet
added a dialog manager and factory
277
	if (iWidth != 0 && iHeight != 0)
936 by Fabrice Rey
port to GTK3: complete !
278
		g_object_set (pBox, "height-request", iHeight, "width-request", iWidth, NULL);
505 by fabounet
added a dialog manager and factory
279
	else if (iWidth != 0)
936 by Fabrice Rey
port to GTK3: complete !
280
			g_object_set (pBox, "width-request", iWidth, NULL);
505 by fabounet
added a dialog manager and factory
281
	else if (iHeight != 0)
936 by Fabrice Rey
port to GTK3: complete !
282
			g_object_set (pBox, "height-request", iHeight, NULL);
505 by fabounet
added a dialog manager and factory
283
	gtk_box_pack_start (GTK_BOX (pDialog->pWidgetLayout),
284
		pBox,
285
		bCanResize,
286
		bCanResize,
287
		0);
288
	return pBox;
289
}
290
960 by Fabrice Rey
merged some properties and notifications into the Container class -> 3.0-alpha2
291
static gboolean _cairo_dialog_animation_loop (CairoContainer *pContainer)
292
{
293
	CairoDialog *pDialog = CAIRO_DIALOG (pContainer);
294
	gboolean bContinue = FALSE;
295
	gboolean bUpdateSlowAnimation = FALSE;
296
	pContainer->iAnimationStep ++;
297
	if (pContainer->iAnimationStep * pContainer->iAnimationDeltaT >= CAIRO_DOCK_MIN_SLOW_DELTA_T)
298
	{
299
		bUpdateSlowAnimation = TRUE;
300
		pContainer->iAnimationStep = 0;
301
		pContainer->bKeepSlowAnimation = FALSE;
302
	}
303
	
304
	if (pDialog->fAppearanceCounter < 1)
305
	{
306
		pDialog->fAppearanceCounter += .08;
307
		if (pDialog->fAppearanceCounter > .99)
308
		{
309
			pDialog->fAppearanceCounter = 1.;
310
		}
311
		else
312
		{
313
			bContinue = TRUE;
314
		}
315
	}
316
	
317
	if (bUpdateSlowAnimation)
318
	{
319
		cairo_dock_notify_on_object (pDialog, NOTIFICATION_UPDATE_SLOW, pDialog, &pContainer->bKeepSlowAnimation);
320
	}
321
	
322
	cairo_dock_notify_on_object (pDialog, NOTIFICATION_UPDATE, pDialog, &bContinue);
323
	
324
	cairo_dock_redraw_container (CAIRO_CONTAINER (pDialog));
325
	if (! bContinue && ! pContainer->bKeepSlowAnimation)
326
	{
327
		pContainer->iSidGLAnimation = 0;
328
		return FALSE;
329
	}
330
	else
331
		return TRUE;
332
}
333
505 by fabounet
added a dialog manager and factory
334
static CairoDialog *_cairo_dock_create_empty_dialog (gboolean bInteractive)
335
{
336
	//\________________ On cree un dialogue qu'on insere immediatement dans la liste.
337
	CairoDialog *pDialog = g_new0 (CairoDialog, 1);
338
	pDialog->container.iType = CAIRO_DOCK_TYPE_DIALOG;
339
	pDialog->iRefCount = 1;
340
	pDialog->container.fRatio = 1.;
341
342
	//\________________ On construit la fenetre du dialogue.
512 by Tofe
Merge with HEAD
343
	//GtkWidget* pWindow = gtk_window_new (bInteractiveWindow ? GTK_WINDOW_TOPLEVEL : GTK_WINDOW_POPUP);  // les popups ne prennent pas le focus. En fait, ils ne sont meme pas controles par le WM.
595 by fabounet
fixed a bug in the previous revision + try to remove the use of g_pMainDock
344
	GtkWidget* pWindow = cairo_dock_init_container_no_opengl (CAIRO_CONTAINER (pDialog));
966 by Fabrice Rey
Core update (work in progress): link objects to their manager => automatic notifications on the managers + make the update_dock_size function idle + changed the set_icon_size logic + optimized the initial loading
345
	///cairo_dock_install_notifications_on_object (pDialog, NB_NOTIFICATIONS_DIALOG);
346
	gldi_object_set_manager (GLDI_OBJECT (pDialog), GLDI_MANAGER (&myDialogsMgr));
505 by fabounet
added a dialog manager and factory
347
	
960 by Fabrice Rey
merged some properties and notifications into the Container class -> 3.0-alpha2
348
	pDialog->container.iface.animation_loop = _cairo_dialog_animation_loop;
349
	
505 by fabounet
added a dialog manager and factory
350
	gtk_window_set_title (GTK_WINDOW (pWindow), "cairo-dock-dialog");
351
	if (! bInteractive)
352
		gtk_window_set_type_hint (GTK_WINDOW (pDialog->container.pWidget), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);  // pour ne pas prendre le focus.
353
	
354
	gtk_widget_add_events (pWindow, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
355
	gtk_window_resize (GTK_WINDOW (pWindow), CAIRO_DIALOG_MIN_SIZE, CAIRO_DIALOG_MIN_SIZE);
356
	gtk_window_set_keep_above (GTK_WINDOW (pWindow), TRUE);
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
357
	///gtk_widget_show_all (pWindow);
505 by fabounet
added a dialog manager and factory
358
	
359
	return pDialog;
360
}
361
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
362
static cairo_surface_t *_cairo_dock_create_dialog_text_surface (const gchar *cText, CairoDockLabelDescription *pTextDescription, int *iTextWidth, int *iTextHeight)
505 by fabounet
added a dialog manager and factory
363
{
364
	if (cText == NULL)
365
		return NULL;
575 by fabounet
fixed the reload of the visibility with several main docks
366
	
972 by Fabrice Rey
per-dock icon size: fixed most of the regressions
367
	return cairo_dock_create_surface_from_text (cText,
697.1.1 by Fabrice Rey
core rewriting \!
368
		(pTextDescription ? pTextDescription : &myDialogsParam.dialogTextDescription),
505 by fabounet
added a dialog manager and factory
369
		iTextWidth,
972 by Fabrice Rey
per-dock icon size: fixed most of the regressions
370
		iTextHeight);
505 by fabounet
added a dialog manager and factory
371
}
372
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
373
static cairo_surface_t *_cairo_dock_create_dialog_icon_surface (const gchar *cImageFilePath, int iNbFrames, Icon *pIcon, CairoContainer *pContainer, int iDesiredSize, int *iIconSize)
505 by fabounet
added a dialog manager and factory
374
{
375
	if (cImageFilePath == NULL)
376
		return NULL;
377
	if (iDesiredSize == 0)
697.1.1 by Fabrice Rey
core rewriting \!
378
		iDesiredSize = myDialogsParam.iDialogIconSize;
505 by fabounet
added a dialog manager and factory
379
	cairo_surface_t *pIconBuffer = NULL;
623 by fabounet
vfs integration : changed the mount/unmount prototype
380
	if (strcmp (cImageFilePath, "same icon") == 0)
505 by fabounet
added a dialog manager and factory
381
	{
623 by fabounet
vfs integration : changed the mount/unmount prototype
382
		if (pIcon && pIcon->pIconBuffer)
383
		{
384
			if (pContainer == NULL)
385
				pContainer = cairo_dock_search_container_from_icon (pIcon);
386
			int iWidth, iHeight;
831 by Fabrice Rey
small API changes: removed the container parameter where it was not needed anymore
387
			cairo_dock_get_icon_extent (pIcon, &iWidth, &iHeight);
623 by fabounet
vfs integration : changed the mount/unmount prototype
388
			pIconBuffer = cairo_dock_duplicate_surface (pIcon->pIconBuffer,
389
				iWidth, iHeight,
390
				iDesiredSize, iDesiredSize);
391
		}
705 by Fabrice Rey
fixed a bug with urgeny hint
392
		else if (pIcon && pIcon->cFileName)
393
		{
394
			pIconBuffer = cairo_dock_create_surface_from_image_simple (pIcon->cFileName,
395
				iDesiredSize,
396
				iDesiredSize);
397
		}
505 by fabounet
added a dialog manager and factory
398
	}
399
	else
400
	{
401
		double fImageWidth = iNbFrames * iDesiredSize, fImageHeight = iDesiredSize;
402
		pIconBuffer = cairo_dock_create_surface_from_image_simple (cImageFilePath,
403
			fImageWidth,
404
			fImageHeight);
405
	}
406
	if (pIconBuffer != NULL)
407
		*iIconSize = iDesiredSize;
408
	return pIconBuffer;
409
}
410
411
static gboolean _cairo_dock_animate_dialog_icon (CairoDialog *pDialog)
412
{
413
	pDialog->iCurrentFrame ++;
414
	if (pDialog->iCurrentFrame == pDialog->iNbFrames)
415
		pDialog->iCurrentFrame = 0;
416
	cairo_dock_damage_icon_dialog (pDialog);
417
	return TRUE;
418
}
419
static gboolean _cairo_dock_animate_dialog_text (CairoDialog *pDialog)
420
{
421
	if (pDialog->iTextWidth <= pDialog->iMaxTextWidth)
422
		return FALSE;
423
	pDialog->iCurrentTextOffset += 3;
424
	if (pDialog->iCurrentTextOffset >= pDialog->iTextWidth)
425
		pDialog->iCurrentTextOffset -= pDialog->iTextWidth;
426
	cairo_dock_damage_text_dialog (pDialog);
427
	return TRUE;
428
}
742 by Fabrice Rey
dialogs: added a generic method to close/hide a dialog by clicking on it
429
static gboolean on_button_press_widget (GtkWidget *widget,
430
	GdkEventButton *pButton,
431
	CairoDialog *pDialog)
432
{
750 by matttbe
Removed a lot of g_print
433
	cd_debug ("press button on widget");
742 by Fabrice Rey
dialogs: added a generic method to close/hide a dialog by clicking on it
434
	// memorize the time when the user clicked on the widget.
435
	pDialog->iButtonPressTime = pButton->time;
436
	return FALSE;
437
}
505 by fabounet
added a dialog manager and factory
438
CairoDialog *cairo_dock_new_dialog (CairoDialogAttribute *pAttribute, Icon *pIcon, CairoContainer *pContainer)
439
{
440
	//\________________ On cree un nouveau dialogue.
441
	CairoDialog *pDialog = _cairo_dock_create_empty_dialog (pAttribute->pInteractiveWidget || pAttribute->pActionFunc);
442
	pDialog->pIcon = pIcon;
578 by fabounet
configuration-independant main docks
443
	pDialog->container.bIsHorizontal = TRUE;
566 by fabounet
removed 'keep the dock below' option and cleant the config from several useless options
444
	if (pAttribute->bForceAbove)
445
	{
446
		gtk_window_set_keep_above (GTK_WINDOW (pDialog->container.pWidget), TRUE);
936 by Fabrice Rey
port to GTK3: complete !
447
		Window Xid = gldi_container_get_Xid (CAIRO_CONTAINER (pDialog));
566 by fabounet
removed 'keep the dock below' option and cleant the config from several useless options
448
		cairo_dock_set_xwindow_type_hint (Xid, "_NET_WM_WINDOW_TYPE_DOCK");  // pour passer devant les fenetres plein ecran; depend du WM.
449
	}
505 by fabounet
added a dialog manager and factory
450
	
451
	//\________________ On cree la surface du message.
452
	if (pAttribute->cText != NULL)
453
	{
454
		pDialog->iMaxTextWidth = pAttribute->iMaxTextWidth;
455
		pDialog->pTextBuffer = _cairo_dock_create_dialog_text_surface (pAttribute->cText,
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
456
			pAttribute->pTextDescription,
505 by fabounet
added a dialog manager and factory
457
			&pDialog->iTextWidth, &pDialog->iTextHeight);
458
		///pDialog->iTextTexture = cairo_dock_create_texture_from_surface (pDialog->pTextBuffer);
459
		if (pDialog->iMaxTextWidth > 0 && pDialog->pTextBuffer != NULL && pDialog->iTextWidth > pDialog->iMaxTextWidth)
460
		{
461
			pDialog->iSidAnimateText = g_timeout_add (200, (GSourceFunc) _cairo_dock_animate_dialog_text, (gpointer) pDialog);  // multiple du timeout de l'icone animee.
462
		}
463
	}
464
465
	//\________________ On cree la surface de l'icone a afficher sur le cote.
466
	if (pAttribute->cImageFilePath != NULL)
467
	{
468
		pDialog->iNbFrames = (pAttribute->iNbFrames > 0 ? pAttribute->iNbFrames : 1);
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
469
		pDialog->pIconBuffer = _cairo_dock_create_dialog_icon_surface (pAttribute->cImageFilePath, pDialog->iNbFrames, pIcon, pContainer, pAttribute->iIconSize, &pDialog->iIconSize);
505 by fabounet
added a dialog manager and factory
470
		///pDialog->iIconTexture = cairo_dock_create_texture_from_surface (pDialog->pIconBuffer);
471
		if (pDialog->pIconBuffer != NULL && pDialog->iNbFrames > 1)
472
		{
473
			pDialog->iSidAnimateIcon = g_timeout_add (100, (GSourceFunc) _cairo_dock_animate_dialog_icon, (gpointer) pDialog);
474
		}
475
	}
476
477
	//\________________ On prend en compte le widget interactif.
478
	if (pAttribute->pInteractiveWidget != NULL)
479
	{
480
		pDialog->pInteractiveWidget = pAttribute->pInteractiveWidget;
481
		
482
		GtkRequisition requisition;
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
483
		#if (GTK_MAJOR_VERSION < 3)
505 by fabounet
added a dialog manager and factory
484
		gtk_widget_size_request (pAttribute->pInteractiveWidget, &requisition);
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
485
		#else
486
		gtk_widget_get_preferred_size (pAttribute->pInteractiveWidget, &requisition, NULL);
487
		#endif
505 by fabounet
added a dialog manager and factory
488
		pDialog->iInteractiveWidth = requisition.width;
489
		pDialog->iInteractiveHeight = requisition.height;
490
	}
491
	
492
	//\________________ On prend en compte les boutons.
493
	pDialog->pUserData = pAttribute->pUserData;
494
	pDialog->pFreeUserDataFunc = pAttribute->pFreeDataFunc;
495
	if (pAttribute->cButtonsImage != NULL && pAttribute->pActionFunc != NULL)
496
	{
497
		int i;
498
		for (i = 0; pAttribute->cButtonsImage[i] != NULL; i++);
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
499
		
505 by fabounet
added a dialog manager and factory
500
		pDialog->iNbButtons = i;
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
501
		pDialog->action_on_answer = pAttribute->pActionFunc;
505 by fabounet
added a dialog manager and factory
502
		pDialog->pButtons = g_new0 (CairoDialogButton, pDialog->iNbButtons);
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
503
		const gchar *cButtonImage;
505 by fabounet
added a dialog manager and factory
504
		for (i = 0; i < pDialog->iNbButtons; i++)
505
		{
506
			cButtonImage = pAttribute->cButtonsImage[i];
507
			if (strcmp (cButtonImage, "ok") == 0)
508
			{
509
				pDialog->pButtons[i].iDefaultType = 1;
510
			}
511
			else if (strcmp (cButtonImage, "cancel") == 0)
512
			{
513
				pDialog->pButtons[i].iDefaultType = 0;
514
			}
515
			else
516
			{
517
				gchar *cButtonPath;
518
				if (*cButtonImage != '/')
1024 by Matthieu Baerts
Icon Mgr: modified cairo_dock_search_icon_s_path: now we have to specify a desired icon size in order to not load too detailed images for tiny icons
519
					cButtonPath = cairo_dock_search_icon_s_path (cButtonImage,
520
						MAX (myDialogsParam.iDialogButtonWidth, myDialogsParam.iDialogButtonHeight));
505 by fabounet
added a dialog manager and factory
521
				else
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
522
					cButtonPath = (gchar*)cButtonImage;
505 by fabounet
added a dialog manager and factory
523
				pDialog->pButtons[i].pSurface = cairo_dock_create_surface_from_image_simple (cButtonPath,
697.1.1 by Fabrice Rey
core rewriting \!
524
					myDialogsParam.iDialogButtonWidth,
525
					myDialogsParam.iDialogButtonHeight);
505 by fabounet
added a dialog manager and factory
526
				if (cButtonPath != cButtonImage)
527
					g_free (cButtonPath);
528
				///pDialog->pButtons[i].iTexture = cairo_dock_create_texture_from_surface (pDialog->pButtons[i].pSurface);
529
			}
530
		}
531
	}
532
	else
533
	{
534
		pDialog->bNoInput = pAttribute->bNoInput;
535
	}
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
536
	
537
	//\________________ Interactive dialogs are set modal, to be fixed.
747 by Fabrice Rey
Taskbar: fxed a bug when closing a group of windows grouped above a launcher + Dialogs: set fixed position for infinite dialogs
538
	if ((pDialog->pInteractiveWidget || pDialog->pButtons || pAttribute->iTimeLength == 0) && ! pDialog->bNoInput)
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
539
	{
1069.1.3 by Fabrice Rey
Dialogs: fixed a bug where the dock could auto-hide when a modal dialog was raised
540
		gtk_window_set_modal (GTK_WINDOW (pDialog->container.pWidget), TRUE);  // Note: there is a bug in Ubuntu version of GTK: gtkscrolledwindow in dialog breaks his modality (http://www.gtkforums.com/viewtopic.php?f=3&t=55727).
767 by Fabrice Rey
no label for icon having a dialog in panel view only + prevent from removing user separators by drag'n'drop in panel view
541
		if (CAIRO_DOCK_IS_DOCK (pContainer))
542
		{
1069.1.3 by Fabrice Rey
Dialogs: fixed a bug where the dock could auto-hide when a modal dialog was raised
543
			CAIRO_DOCK (pContainer)->bHasModalWindow = TRUE;
767 by Fabrice Rey
no label for icon having a dialog in panel view only + prevent from removing user separators by drag'n'drop in panel view
544
			cairo_dock_emit_enter_signal (pContainer);  // to prevent the dock from hiding. We want to see it until the dialog is visible (a leave event will be emited when it disappears).
545
		}
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
546
	}
742 by Fabrice Rey
dialogs: added a generic method to close/hide a dialog by clicking on it
547
	pDialog->bHideOnClick = pAttribute->bHideOnClick;
741 by Fabrice Rey
dialogs: set interactive dialogs as modal
548
	
505 by fabounet
added a dialog manager and factory
549
	//\________________ On lui affecte un decorateur.
697.1.1 by Fabrice Rey
core rewriting \!
550
	cairo_dock_set_dialog_decorator_by_name (pDialog, (pAttribute->cDecoratorName ? pAttribute->cDecoratorName : myDialogsParam.cDecoratorName));
505 by fabounet
added a dialog manager and factory
551
	if (pDialog->pDecorator != NULL)
552
		pDialog->pDecorator->set_size (pDialog);
553
	
554
	//\________________ Maintenant qu'on connait tout, on calcule les tailles des divers elements.
555
	_cairo_dock_compute_dialog_sizes (pDialog);
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
556
	pDialog->container.iWidth = pDialog->iBubbleWidth + pDialog->iLeftMargin + pDialog->iRightMargin;
557
	pDialog->container.iHeight = pDialog->iBubbleHeight + pDialog->iTopMargin + pDialog->iBottomMargin + pDialog->iMinBottomGap;
505 by fabounet
added a dialog manager and factory
558
	
559
	//\________________ On definit son orientation.
560
	cairo_dock_set_dialog_orientation (pDialog, pContainer);  // renseigne aussi bDirectionUp, bIsHorizontal, et iHeight.
561
	
562
	//\________________ On reserve l'espace pour les decorations.
943 by Fabrice Rey
define gtk_hbox_new for GTK3 to avoid a #if/else each time
563
	GtkWidget *pMainHBox = _gtk_hbox_new (0);
505 by fabounet
added a dialog manager and factory
564
	gtk_container_add (GTK_CONTAINER (pDialog->container.pWidget), pMainHBox);
943 by Fabrice Rey
define gtk_hbox_new for GTK3 to avoid a #if/else each time
565
	pDialog->pLeftPaddingBox = _gtk_vbox_new (0);
936 by Fabrice Rey
port to GTK3: complete !
566
	g_object_set (pDialog->pLeftPaddingBox, "width-request", pDialog->iLeftMargin, NULL);
505 by fabounet
added a dialog manager and factory
567
	gtk_box_pack_start (GTK_BOX (pMainHBox),
568
		pDialog->pLeftPaddingBox,
569
		FALSE,
570
		FALSE,
571
		0);
941 by Matthieu Baerts
port to GTK3: now work with GTK2
572
943 by Fabrice Rey
define gtk_hbox_new for GTK3 to avoid a #if/else each time
573
	pDialog->pWidgetLayout = _gtk_vbox_new (0);
505 by fabounet
added a dialog manager and factory
574
	gtk_box_pack_start (GTK_BOX (pMainHBox),
575
		pDialog->pWidgetLayout,
576
		FALSE,
577
		FALSE,
578
		0);
941 by Matthieu Baerts
port to GTK3: now work with GTK2
579
943 by Fabrice Rey
define gtk_hbox_new for GTK3 to avoid a #if/else each time
580
	pDialog->pRightPaddingBox = _gtk_vbox_new (0);
936 by Fabrice Rey
port to GTK3: complete !
581
	g_object_set (pDialog->pRightPaddingBox, "width-request", pDialog->iRightMargin, NULL);
505 by fabounet
added a dialog manager and factory
582
	gtk_box_pack_start (GTK_BOX (pMainHBox),
583
		pDialog->pRightPaddingBox,
584
		FALSE,
585
		FALSE,
586
		0);
587
	
588
	//\________________ On reserve l'espace pour les elements.
589
	if (pDialog->container.bDirectionUp)
508 by fabounet
the Core can now be compiled with cmake : cmake CMakeLists.txt -DCMAKE_INSTALL_PREFIX=/usr
590
		pDialog->pTopWidget = _cairo_dock_add_dialog_internal_box (pDialog, 0, pDialog->iTopMargin, FALSE);
505 by fabounet
added a dialog manager and factory
591
	else
592
		pDialog->pTipWidget = _cairo_dock_add_dialog_internal_box (pDialog, 0, pDialog->iMinBottomGap + pDialog->iBottomMargin, TRUE);
593
	if (pDialog->iMessageWidth != 0 && pDialog->iMessageHeight != 0)
594
	{
595
		pDialog->pMessageWidget = _cairo_dock_add_dialog_internal_box (pDialog, pDialog->iMessageWidth, pDialog->iMessageHeight, FALSE);
596
	}
597
	if (pDialog->pInteractiveWidget != NULL)
598
	{
599
		gtk_box_pack_start (GTK_BOX (pDialog->pWidgetLayout),
600
			pDialog->pInteractiveWidget,
601
			FALSE,
602
			FALSE,
603
			0);
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
604
		cd_debug ("grab focus");
505 by fabounet
added a dialog manager and factory
605
		gtk_window_present (GTK_WINDOW (pDialog->container.pWidget));
606
		gtk_widget_grab_focus (pDialog->pInteractiveWidget);
607
	}
608
	if (pDialog->pButtons != NULL)
609
	{
610
		pDialog->pButtonsWidget = _cairo_dock_add_dialog_internal_box (pDialog, pDialog->iButtonsWidth, pDialog->iButtonsHeight, FALSE);
611
	}
612
	if (pDialog->container.bDirectionUp)
613
		pDialog->pTipWidget = _cairo_dock_add_dialog_internal_box (pDialog, 0, pDialog->iMinBottomGap + pDialog->iBottomMargin, TRUE);
614
	else
615
		pDialog->pTopWidget = _cairo_dock_add_dialog_internal_box (pDialog, 0, pDialog->iTopMargin, TRUE);
588 by fabounet
fixed several minor bugs
616
	
690 by Fabrice Rey
Dialogs: removed the tip widget from the dialogs to prevent wrong placement from some WM + fixed the reload of the shortcut for the visibility
617
	gtk_widget_show_all (pDialog->container.pWidget);
618
	
588 by fabounet
fixed several minor bugs
619
	if (pDialog->bNoInput)
620
	{
621
		_cairo_dock_set_dialog_input_shape (pDialog);
622
	}
505 by fabounet
added a dialog manager and factory
623
	//\________________ On connecte les signaux utiles.
624
	g_signal_connect (G_OBJECT (pDialog->container.pWidget),
936 by Fabrice Rey
port to GTK3: complete !
625
		#if (GTK_MAJOR_VERSION < 3)
505 by fabounet
added a dialog manager and factory
626
		"expose-event",
936 by Fabrice Rey
port to GTK3: complete !
627
		#else
628
		"draw",
629
		#endif
505 by fabounet
added a dialog manager and factory
630
		G_CALLBACK (on_expose_dialog),
631
		pDialog);
632
	g_signal_connect (G_OBJECT (pDialog->container.pWidget),
633
		"configure-event",
634
		G_CALLBACK (on_configure_dialog),
635
		pDialog);
636
	g_signal_connect (G_OBJECT (pDialog->container.pWidget),
637
		"unmap-event",
638
		G_CALLBACK (on_unmap_dialog),
639
		pDialog);
742 by Fabrice Rey
dialogs: added a generic method to close/hide a dialog by clicking on it
640
	if (pDialog->pInteractiveWidget != NULL && pDialog->pButtons == NULL)  // the dialog has no button to be closed, so it can be closed by clicking on it. But some widget (like the GTK calendar) let pass the click to their parent (= the dialog), which then close it. To prevent this, we memorize the last click on the widget.
641
		g_signal_connect (G_OBJECT (pDialog->pInteractiveWidget),
642
			"button-press-event",
643
			G_CALLBACK (on_button_press_widget),
644
			pDialog);
645
		
566 by fabounet
removed 'keep the dock below' option and cleant the config from several useless options
646
	cairo_dock_launch_animation (CAIRO_CONTAINER (pDialog));
647
	
505 by fabounet
added a dialog manager and factory
648
	return pDialog;
649
}
650
651
void cairo_dock_free_dialog (CairoDialog *pDialog)
652
{
653
	if (pDialog == NULL)
654
		return ;
655
	
656
	if (pDialog->iSidTimer > 0)
657
	{
658
		g_source_remove (pDialog->iSidTimer);
659
	}
660
	if (pDialog->iSidAnimateIcon > 0)
661
	{
662
		g_source_remove (pDialog->iSidAnimateIcon);
663
	}
664
	if (pDialog->iSidAnimateText > 0)
665
	{
666
		g_source_remove (pDialog->iSidAnimateText);
566 by fabounet
removed 'keep the dock below' option and cleant the config from several useless options
667
	}
505 by fabounet
added a dialog manager and factory
668
	
669
	cd_debug ("");
670
671
	if (pDialog->pTextBuffer != NULL)
672
		cairo_surface_destroy (pDialog->pTextBuffer);
673
	if (pDialog->pIconBuffer != NULL)
674
		cairo_surface_destroy (pDialog->pIconBuffer);
675
	if (pDialog->iIconTexture != 0)
676
		_cairo_dock_delete_texture (pDialog->iIconTexture);
677
	if (pDialog->iTextTexture != 0)
678
		_cairo_dock_delete_texture (pDialog->iTextTexture);
679
	
680
	if (pDialog->pButtons != NULL)
681
	{
682
		cairo_surface_t *pSurface;
683
		GLuint iTexture;
684
		int i;
685
		for (i = 0; i < pDialog->iNbButtons; i++)
686
		{
687
			pSurface = pDialog->pButtons[i].pSurface;
688
			if (pSurface != NULL)
689
				cairo_surface_destroy (pSurface);
690
			iTexture = pDialog->pButtons[i].iTexture;
691
			if (iTexture != 0)
692
				_cairo_dock_delete_texture (iTexture);
693
		}
694
		g_free (pDialog->pButtons);
695
	}
696
	
595 by fabounet
fixed a bug in the previous revision + try to remove the use of g_pMainDock
697
	cairo_dock_finish_container (CAIRO_CONTAINER (pDialog));
505 by fabounet
added a dialog manager and factory
698
	
699
	if (pDialog->pUnmapTimer != NULL)
700
		g_timer_destroy (pDialog->pUnmapTimer);
701
	
702
	if (pDialog->pShapeBitmap != NULL)
936 by Fabrice Rey
port to GTK3: complete !
703
		gldi_shape_destroy (pDialog->pShapeBitmap);
505 by fabounet
added a dialog manager and factory
704
	
705
	if (pDialog->pUserData != NULL && pDialog->pFreeUserDataFunc != NULL)
706
		pDialog->pFreeUserDataFunc (pDialog->pUserData);
707
	
708
	g_free (pDialog);
709
}
710
711
578 by fabounet
configuration-independant main docks
712
static void _cairo_dock_dialog_calculate_aimed_point (Icon *pIcon, CairoContainer *pContainer, int *iX, int *iY, gboolean *bRight, gboolean *bIsHorizontal, gboolean *bDirectionUp, double fAlign)
505 by fabounet
added a dialog manager and factory
713
{
804 by Fabrice Rey
Dialogs: allow to place dialog relatively to a container as well as an icon
714
	g_return_if_fail (/*pIcon != NULL && */pContainer != NULL);
715
	//g_print ("%s (%.2f, %.2f)\n", __func__, pIcon?pIcon->fXAtRest:0, pIcon?pIcon->fDrawX:0);
505 by fabounet
added a dialog manager and factory
716
	if (CAIRO_DOCK_IS_DOCK (pContainer))
717
	{
718
		CairoDock *pDock = CAIRO_DOCK (pContainer);
936 by Fabrice Rey
port to GTK3: complete !
719
		if (pDock->iRefCount > 0 && ! gldi_container_is_visible (pContainer))  // sous-dock invisible.
505 by fabounet
added a dialog manager and factory
720
		{
721
			CairoDock *pParentDock = NULL;
722
			Icon *pPointingIcon = cairo_dock_search_icon_pointing_on_dock (pDock, &pParentDock);
723
			_cairo_dock_dialog_calculate_aimed_point (pPointingIcon, CAIRO_CONTAINER (pParentDock), iX, iY, bRight, bIsHorizontal, bDirectionUp, fAlign);
724
		}
804 by Fabrice Rey
Dialogs: allow to place dialog relatively to a container as well as an icon
725
		else  // dock principal ou sous-dock visible.
505 by fabounet
added a dialog manager and factory
726
		{
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
727
			*bIsHorizontal = (pContainer->bIsHorizontal == CAIRO_DOCK_HORIZONTAL);
974 by Fabrice Rey
fixed dialog's tip position on vertical dock + fixed a crash (regression)
728
			if (! *bIsHorizontal)
729
			{
730
				int *tmp = iX;
731
				iX = iY;
732
				iY = tmp;
733
			}
505 by fabounet
added a dialog manager and factory
734
			int dy;
735
			if (pDock->iInputState == CAIRO_DOCK_INPUT_ACTIVE)
757 by Fabrice Rey
moved the 'extended mode' option with the Background options and made it per-dock + added an active zone in docks and use it in the default view + worked on the Theme-manager
736
				dy = pContainer->iHeight - pDock->iActiveHeight;
505 by fabounet
added a dialog manager and factory
737
			else if (cairo_dock_is_hidden (pDock))
693 by Fabrice Rey
improved scalability of the config panel for small screens
738
				dy = pContainer->iHeight-1;  // on laisse 1 pixels pour pouvoir sortir du dialogue avant de toucher le bord de l'ecran, et ainsi le faire se replacer, lorsqu'on fait apparaitre un dock en auto-hide.
505 by fabounet
added a dialog manager and factory
739
			else
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
740
				dy = pContainer->iHeight - pDock->iMinDockHeight;
741
			if (pContainer->bIsHorizontal)
505 by fabounet
added a dialog manager and factory
742
			{
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
743
				*bRight = (pIcon ? pIcon->fXAtRest < pDock->fFlatDockWidth / 2 : TRUE);
744
				*bDirectionUp = pContainer->bDirectionUp;
505 by fabounet
added a dialog manager and factory
745
				
746
				if (*bDirectionUp)
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
747
					*iY = pContainer->iWindowPositionY + dy;
505 by fabounet
added a dialog manager and factory
748
				else
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
749
					*iY = pContainer->iWindowPositionY + pContainer->iHeight - dy;
505 by fabounet
added a dialog manager and factory
750
			}
751
			else
752
			{
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
753
				*bRight = (pContainer->iWindowPositionY > g_desktopGeometry.iScreenWidth[CAIRO_DOCK_HORIZONTAL] / 2);
580 by fabounet
new implementation of the callback zone and the keep-below option option
754
				*bDirectionUp = (pIcon ? pIcon->fXAtRest > pDock->fFlatDockWidth / 2 : TRUE);
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
755
				*iY = (pContainer->bDirectionUp ?
756
					pContainer->iWindowPositionY + dy :
757
					pContainer->iWindowPositionY + pContainer->iHeight - dy);
505 by fabounet
added a dialog manager and factory
758
			}
759
			
760
			if (cairo_dock_is_hidden (pDock))
761
			{
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
762
				*iX = pContainer->iWindowPositionX +
763
					(pIcon ? (pIcon->fXAtRest + pIcon->fWidth/2) / pDock->fFlatDockWidth * pDock->iMaxDockWidth : 0);
505 by fabounet
added a dialog manager and factory
764
			}
765
			else
766
			{
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
767
				*iX = pContainer->iWindowPositionX +
768
					(pIcon ? pIcon->fDrawX + pIcon->fWidth * pIcon->fScale/2 : 0);
505 by fabounet
added a dialog manager and factory
769
			}
770
		}
771
	}
772
	else if (CAIRO_DOCK_IS_DESKLET (pContainer))
773
	{
774
		CairoDesklet *pDesklet = CAIRO_DESKLET (pContainer);
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
775
		*bDirectionUp = (pContainer->iWindowPositionY > g_desktopGeometry.iXScreenHeight[CAIRO_DOCK_HORIZONTAL] / 2);
695 by Fabrice Rey
fixed dialogs position (don't use gravity since most WM are broken) + give a name (automatic) to docks in the menu + improved the GUI for small resolution (again)
776
		///*bIsHorizontal = (pContainer->iWindowPositionX > 50 && pContainer->iWindowPositionX + pContainer->iHeight < g_desktopGeometry.iXScreenWidth[CAIRO_DOCK_HORIZONTAL] - 50);
777
		*bIsHorizontal = TRUE;
505 by fabounet
added a dialog manager and factory
778
		
779
		if (*bIsHorizontal)
780
		{
695 by Fabrice Rey
fixed dialogs position (don't use gravity since most WM are broken) + give a name (automatic) to docks in the menu + improved the GUI for small resolution (again)
781
			*bRight = (pContainer->iWindowPositionX + pContainer->iWidth/2 < g_desktopGeometry.iXScreenWidth[CAIRO_DOCK_HORIZONTAL] / 2);
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
782
			*iX = pContainer->iWindowPositionX + pContainer->iWidth * (*bRight ? .7 : .3);
783
			*iY = (*bDirectionUp ? pContainer->iWindowPositionY : pContainer->iWindowPositionY + pContainer->iHeight);
505 by fabounet
added a dialog manager and factory
784
		}
785
		else
786
		{
695 by Fabrice Rey
fixed dialogs position (don't use gravity since most WM are broken) + give a name (automatic) to docks in the menu + improved the GUI for small resolution (again)
787
			*bRight = (pContainer->iWindowPositionX < g_desktopGeometry.iXScreenWidth[CAIRO_DOCK_HORIZONTAL] / 2);
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
788
			*iY = pContainer->iWindowPositionX + pContainer->iWidth * (*bRight ? 1 : 0);
789
			*iX =pContainer->iWindowPositionY + pContainer->iHeight / 2;
505 by fabounet
added a dialog manager and factory
790
		}
791
	}
792
}
793
794
795
void cairo_dock_set_dialog_orientation (CairoDialog *pDialog, CairoContainer *pContainer)
796
{
804 by Fabrice Rey
Dialogs: allow to place dialog relatively to a container as well as an icon
797
	if (pContainer != NULL/* && pDialog->pIcon != NULL*/)
505 by fabounet
added a dialog manager and factory
798
	{
692 by Fabrice Rey
dialogs: rewrote the algorithm (including placement) + introduced objects to bind signals to (this is a deep change) + default theme: added preview and readme
799
		_cairo_dock_dialog_calculate_aimed_point (pDialog->pIcon, pContainer, &pDialog->iAimedX, &pDialog->iAimedY, &pDialog->bRight, &pDialog->bTopBottomDialog, &pDialog->container.bDirectionUp, pDialog->fAlign);
974 by Fabrice Rey
fixed dialog's tip position on vertical dock + fixed a crash (regression)
800
		//g_print ("%s (%d,%d %d %d %d)\n", __func__, pDialog->iAimedX, pDialog->iAimedY, pDialog->bRight, pDialog->bTopBottomDialog, pDialog->container.bDirectionUp);
505 by fabounet
added a dialog manager and factory
801
	}
802
	else
803
	{
804
		pDialog->container.bDirectionUp = TRUE;
805
	}
806
}
807
808
809
GtkWidget *cairo_dock_steal_widget_from_its_container (GtkWidget *pWidget)
810
{
811
	g_return_val_if_fail (pWidget != NULL, NULL);
812
	GtkWidget *pContainer = gtk_widget_get_parent (pWidget);
813
	if (pContainer != NULL)
814
	{
815
		g_object_ref (G_OBJECT (pWidget));
816
		gtk_container_remove (GTK_CONTAINER (pContainer), pWidget);
742 by Fabrice Rey
dialogs: added a generic method to close/hide a dialog by clicking on it
817
		
818
		// if we were monitoring the click events on the widget, stop it.
819
		g_signal_handlers_disconnect_matched (pWidget,
820
			G_SIGNAL_MATCH_FUNC,
821
			0,
822
			0,
823
			NULL,
824
			on_button_press_widget,
825
			NULL);
505 by fabounet
added a dialog manager and factory
826
	}
827
	return pWidget;
828
}
829
830
GtkWidget *cairo_dock_steal_interactive_widget_from_dialog (CairoDialog *pDialog)
831
{
832
	if (pDialog == NULL)
833
		return NULL;
834
	
835
	GtkWidget *pInteractiveWidget = pDialog->pInteractiveWidget;
836
	if (pInteractiveWidget != NULL)
837
	{
838
		pInteractiveWidget = cairo_dock_steal_widget_from_its_container (pInteractiveWidget);
839
		pDialog->pInteractiveWidget = NULL;
840
	}
841
	return pInteractiveWidget;
842
}
843
778 by Fabrice Rey
dialogs: added a method to use the same text color for GTK embedded widgets
844
void cairo_dock_set_dialog_widget_text_color (GtkWidget *pWidget)
845
{
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
846
	#if (GTK_MAJOR_VERSION < 3)
778 by Fabrice Rey
dialogs: added a method to use the same text color for GTK embedded widgets
847
	static GdkColor color;
848
	color.red = myDialogsParam.dialogTextDescription.fColorStart[0] * 65535;
849
	color.green = myDialogsParam.dialogTextDescription.fColorStart[1] * 65535;
850
	color.blue = myDialogsParam.dialogTextDescription.fColorStart[2] * 65535;
851
	gtk_widget_modify_fg (pWidget, GTK_STATE_NORMAL, &color);
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
852
	#else
853
	static GdkRGBA color;
942 by Fabrice Rey
some fixes with GTK3
854
	color.red = myDialogsParam.dialogTextDescription.fColorStart[0];
855
	color.green = myDialogsParam.dialogTextDescription.fColorStart[1];
856
	color.blue = myDialogsParam.dialogTextDescription.fColorStart[2];
857
	color.alpha = myDialogsParam.dialogTextDescription.fColorStart[3];
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
858
	gtk_widget_override_color (pWidget, GTK_STATE_NORMAL, &color);
859
	#endif
778 by Fabrice Rey
dialogs: added a method to use the same text color for GTK embedded widgets
860
}
861
800 by Fabrice Rey
dialogs: fixed a small rendering bug when the dialog's icon has an offset
862
void cairo_dock_set_dialog_widget_bg_color (GtkWidget *pWidget)
863
{
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
864
	#if (GTK_MAJOR_VERSION < 3)
800 by Fabrice Rey
dialogs: fixed a small rendering bug when the dialog's icon has an offset
865
	static GdkColor color;
866
	color.red = myDialogsParam.fDialogColor[0] * 65535;
867
	color.green = myDialogsParam.fDialogColor[1] * 65535;
868
	color.blue = myDialogsParam.fDialogColor[2] * 65535;
804 by Fabrice Rey
Dialogs: allow to place dialog relatively to a container as well as an icon
869
	gtk_widget_modify_bg (pWidget, GTK_STATE_NORMAL, &color);
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
870
	#else
871
	static GdkRGBA color;
942 by Fabrice Rey
some fixes with GTK3
872
	color.red = myDialogsParam.fDialogColor[0];
873
	color.green = myDialogsParam.fDialogColor[1];
874
	color.blue = myDialogsParam.fDialogColor[2];
875
	color.alpha = myDialogsParam.fDialogColor[3];
940 by Fabrice Rey
port to GTK3 - final part - removed all calls to any deprecated functions
876
	gtk_widget_override_color (pWidget, GTK_STATE_NORMAL, &color);
877
	#endif
800 by Fabrice Rey
dialogs: fixed a small rendering bug when the dialog's icon has an offset
878
}
879
505 by fabounet
added a dialog manager and factory
880
void cairo_dock_set_new_dialog_text_surface (CairoDialog *pDialog, cairo_surface_t *pNewTextSurface, int iNewTextWidth, int iNewTextHeight)
881
{
882
	int iPrevMessageWidth = pDialog->iMessageWidth;
883
	int iPrevMessageHeight = pDialog->iMessageHeight;
884
885
	cairo_surface_destroy (pDialog->pTextBuffer);
886
	pDialog->pTextBuffer = pNewTextSurface;
887
	if (pDialog->iTextTexture != 0)
888
		_cairo_dock_delete_texture (pDialog->iTextTexture);
889
	///pDialog->iTextTexture = cairo_dock_create_texture_from_surface (pNewTextSurface);
890
	
891
	pDialog->iTextWidth = iNewTextWidth;
892
	pDialog->iTextHeight = iNewTextHeight;
893
	_cairo_dock_compute_dialog_sizes (pDialog);
894
895
	if (pDialog->iMessageWidth != iPrevMessageWidth || pDialog->iMessageHeight != iPrevMessageHeight)
896
	{
936 by Fabrice Rey
port to GTK3: complete !
897
		g_object_set (pDialog->pMessageWidget, "width-request", pDialog->iMessageWidth, "height-request", pDialog->iMessageHeight, NULL);  // inutile de replacer le dialogue puisque sa gravite fera le boulot.
505 by fabounet
added a dialog manager and factory
898
		
899
		gtk_widget_queue_draw (pDialog->container.pWidget);
778 by Fabrice Rey
dialogs: added a method to use the same text color for GTK embedded widgets
900
		
901
		gboolean bInside = pDialog->container.bInside;
902
		pDialog->container.bInside = FALSE;  // unfortunately the gravity is really badly handled by many WMs, so we have to replace he dialog ourselves :-/
903
		cairo_dock_replace_all_dialogs ();
904
		pDialog->container.bInside = bInside;
505 by fabounet
added a dialog manager and factory
905
	}
906
	else
907
	{
908
		cairo_dock_damage_text_dialog (pDialog);
909
	}
910
911
	if (pDialog->iMaxTextWidth > 0 && pDialog->iSidAnimateText == 0 && pDialog->pTextBuffer != NULL && pDialog->iTextWidth > pDialog->iMaxTextWidth)
912
	{
913
		pDialog->iSidAnimateText = g_timeout_add (200, (GSourceFunc) _cairo_dock_animate_dialog_text, (gpointer) pDialog);  // multiple du timeout de l'icone animee.
914
	}
915
}
916
917
void cairo_dock_set_new_dialog_icon_surface (CairoDialog *pDialog, cairo_surface_t *pNewIconSurface, int iNewIconSize)
918
{
919
	int iPrevMessageWidth = pDialog->iMessageWidth;
920
	int iPrevMessageHeight = pDialog->iMessageHeight;
921
922
	cairo_surface_destroy (pDialog->pIconBuffer);
923
	
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
924
	pDialog->pIconBuffer = cairo_dock_duplicate_surface (pNewIconSurface, iNewIconSize, iNewIconSize, iNewIconSize, iNewIconSize);
505 by fabounet
added a dialog manager and factory
925
	if (pDialog->iIconTexture != 0)
926
		_cairo_dock_delete_texture (pDialog->iIconTexture);
927
	///	pDialog->iIconTexture = cairo_dock_create_texture_from_surface (pDialog->pIconBuffer);
928
	
929
	pDialog->iIconSize = iNewIconSize;
930
	_cairo_dock_compute_dialog_sizes (pDialog);
931
932
	if (pDialog->iMessageWidth != iPrevMessageWidth || pDialog->iMessageHeight != iPrevMessageHeight)
933
	{
936 by Fabrice Rey
port to GTK3: complete !
934
		g_object_set (pDialog->pMessageWidget, "width-request", pDialog->iMessageWidth, "height-request", pDialog->iMessageHeight, NULL);  // inutile de replacer le dialogue puisque sa gravite fera le boulot.
505 by fabounet
added a dialog manager and factory
935
		
936
		gtk_widget_queue_draw (pDialog->container.pWidget);
937
	}
938
	else
939
	{
940
		cairo_dock_damage_icon_dialog (pDialog);
941
	}
942
}
943
944
945
void cairo_dock_set_dialog_message (CairoDialog *pDialog, const gchar *cMessage)
946
{
947
	int iNewTextWidth=0, iNewTextHeight=0;
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
948
	cairo_surface_t *pNewTextSurface = _cairo_dock_create_dialog_text_surface (cMessage, NULL, &iNewTextWidth, &iNewTextHeight);
505 by fabounet
added a dialog manager and factory
949
	
950
	cairo_dock_set_new_dialog_text_surface (pDialog, pNewTextSurface, iNewTextWidth, iNewTextHeight);
951
}
952
void cairo_dock_set_dialog_message_printf (CairoDialog *pDialog, const gchar *cMessageFormat, ...)
953
{
954
	g_return_if_fail (cMessageFormat != NULL);
955
	va_list args;
956
	va_start (args, cMessageFormat);
957
	gchar *cMessage = g_strdup_vprintf (cMessageFormat, args);
958
	cairo_dock_set_dialog_message (pDialog, cMessage);
959
	g_free (cMessage);
960
	va_end (args);
961
}
962
963
void cairo_dock_set_dialog_icon (CairoDialog *pDialog, const gchar *cImageFilePath)
964
{
697.1.1 by Fabrice Rey
core rewriting \!
965
	cairo_surface_t *pNewIconSurface = cairo_dock_create_surface_for_square_icon (cImageFilePath, myDialogsParam.iDialogIconSize);
966
	int iNewIconSize = (pNewIconSurface != NULL ? myDialogsParam.iDialogIconSize : 0);
530 by fabounet
use libcurl instead of forking a curl process => new dependency + made an indicator manager + added a source context in cache to avoid creating it for any image loading
967
	
505 by fabounet
added a dialog manager and factory
968
	cairo_dock_set_new_dialog_icon_surface (pDialog, pNewIconSurface, iNewIconSize);
969
}
970
971
972
void cairo_dock_damage_icon_dialog (CairoDialog *pDialog)
973
{
974
	if (!pDialog->container.bUseReflect)
975
		gtk_widget_queue_draw_area (pDialog->container.pWidget,
976
			pDialog->iLeftMargin,
977
			(pDialog->container.bDirectionUp ? 
978
				pDialog->iTopMargin :
979
				pDialog->container.iHeight - (pDialog->iTopMargin + pDialog->iBubbleHeight)),
980
			pDialog->iIconSize,
981
			pDialog->iIconSize);
982
	else
983
		gtk_widget_queue_draw (pDialog->container.pWidget);
984
}
985
986
void cairo_dock_damage_text_dialog (CairoDialog *pDialog)
987
{
988
	if (!pDialog->container.bUseReflect)
989
		gtk_widget_queue_draw_area (pDialog->container.pWidget,
990
			pDialog->iLeftMargin + pDialog->iIconSize + CAIRO_DIALOG_TEXT_MARGIN,
991
			(pDialog->container.bDirectionUp ? 
992
				pDialog->iTopMargin :
993
				pDialog->container.iHeight - (pDialog->iTopMargin + pDialog->iBubbleHeight)),
994
			_drawn_text_width (pDialog),
995
			pDialog->iTextHeight);
996
	else
997
		gtk_widget_queue_draw (pDialog->container.pWidget);
998
}
999
1000
void cairo_dock_damage_interactive_widget_dialog (CairoDialog *pDialog)
1001
{
1002
	if (!pDialog->container.bUseReflect)
1003
		gtk_widget_queue_draw_area (pDialog->container.pWidget,
1004
			pDialog->iLeftMargin,
1005
			(pDialog->container.bDirectionUp ? 
1006
				pDialog->iTopMargin + pDialog->iMessageHeight :
1007
				pDialog->container.iHeight - (pDialog->iTopMargin + pDialog->iBubbleHeight) + pDialog->iMessageHeight),
1008
			pDialog->iInteractiveWidth,
1009
			pDialog->iInteractiveHeight);
1010
	else
1011
		gtk_widget_queue_draw (pDialog->container.pWidget);
1012
}