76
66
extern gchar *g_cCurrentLaunchersPath;
78
68
extern CairoDockGLConfig g_openglConfig;
69
extern CairoDockHidingEffect *g_pHidingBackend;
79
70
extern gboolean g_bUseOpenGL;
81
extern gboolean g_bUseGlitz;
85
static void _cairo_dock_set_icon_size (CairoContainer *pDock, Icon *icon)
87
CairoDockIconGroup iType = cairo_dock_get_icon_type (icon);
88
if (CAIRO_DOCK_ICON_TYPE_IS_APPLET (icon)) // une applet peut definir la taille de son icone elle-meme.
90
if (icon->fWidth == 0)
91
icon->fWidth = myIconsParam.tIconAuthorizedWidth[iType];
92
if (icon->fHeight == 0)
93
icon->fHeight = myIconsParam.tIconAuthorizedHeight[iType];
97
icon->fWidth = myIconsParam.tIconAuthorizedWidth[iType];
98
icon->fHeight = myIconsParam.tIconAuthorizedHeight[iType];
102
CairoDock *cairo_dock_new_dock (const gchar *cRendererName)
73
static gboolean _cairo_dock_grow_up (CairoDock *pDock)
75
//g_print ("%s (%d ; %2f ; bInside:%d)\n", __func__, pDock->iMagnitudeIndex, pDock->fFoldingFactor, pDock->container.bInside);
77
pDock->iMagnitudeIndex += myBackendsParam.iGrowUpInterval;
78
if (pDock->iMagnitudeIndex > CAIRO_DOCK_NB_MAX_ITERATIONS)
79
pDock->iMagnitudeIndex = CAIRO_DOCK_NB_MAX_ITERATIONS;
81
if (pDock->fFoldingFactor != 0)
83
int iAnimationDeltaT = cairo_dock_get_animation_delta_t (pDock);
84
pDock->fFoldingFactor -= (double) iAnimationDeltaT / myBackendsParam.iUnfoldingDuration;
85
if (pDock->fFoldingFactor < 0)
86
pDock->fFoldingFactor = 0;
89
gldi_container_update_mouse_position (CAIRO_CONTAINER (pDock));
91
Icon *pLastPointedIcon = cairo_dock_get_pointed_icon (pDock->icons);
92
Icon *pPointedIcon = cairo_dock_calculate_dock_icons (pDock);
93
if (! pDock->bIsGrowingUp)
96
if (pLastPointedIcon != pPointedIcon && pDock->container.bInside)
97
cairo_dock_on_change_icon (pLastPointedIcon, pPointedIcon, pDock);
99
if (pDock->iMagnitudeIndex == CAIRO_DOCK_NB_MAX_ITERATIONS && pDock->fFoldingFactor == 0) // fin de grossissement et de depliage.
101
/// TODO: check doing this in update_dock_size directly...
102
/**if (pDock->bWMIconsNeedUpdate)
104
cairo_dock_trigger_set_WM_icons_geometry (pDock);
105
pDock->bWMIconsNeedUpdate = FALSE;
108
cairo_dock_replace_all_dialogs ();
115
static gboolean _cairo_dock_shrink_down (CairoDock *pDock)
117
//g_print ("%s (%d, %f, %f)\n", __func__, pDock->iMagnitudeIndex, pDock->fFoldingFactor, pDock->fDecorationsOffsetX);
118
//\_________________ On fait decroitre la magnitude du dock.
119
int iPrevMagnitudeIndex = pDock->iMagnitudeIndex;
120
pDock->iMagnitudeIndex -= myBackendsParam.iShrinkDownInterval;
121
if (pDock->iMagnitudeIndex < 0)
122
pDock->iMagnitudeIndex = 0;
124
//\_________________ On replie le dock.
125
if (pDock->fFoldingFactor != 0 && pDock->fFoldingFactor != 1)
127
int iAnimationDeltaT = cairo_dock_get_animation_delta_t (pDock);
128
pDock->fFoldingFactor += (double) iAnimationDeltaT / myBackendsParam.iUnfoldingDuration;
129
if (pDock->fFoldingFactor > 1)
130
pDock->fFoldingFactor = 1;
133
//\_________________ On remet les decorations a l'equilibre.
134
pDock->fDecorationsOffsetX *= .8;
135
if (fabs (pDock->fDecorationsOffsetX) < 3)
136
pDock->fDecorationsOffsetX = 0.;
138
//\_________________ On recupere la position de la souris manuellement (car a priori on est hors du dock).
139
gldi_container_update_mouse_position (CAIRO_CONTAINER (pDock)); // ce n'est pas le motion_notify qui va nous donner des coordonnees en dehors du dock, et donc le fait d'etre dedans va nous faire interrompre le shrink_down et re-grossir, du coup il faut le faire ici. L'inconvenient, c'est que quand on sort par les cotes, il n'y a soudain plus d'icone pointee, et donc le dock devient tout plat subitement au lieu de le faire doucement. Heureusement j'ai trouve une astuce. ^_^
141
//\_________________ On recalcule les icones.
142
///if (iPrevMagnitudeIndex != 0)
144
cairo_dock_calculate_dock_icons (pDock);
145
if (! pDock->bIsShrinkingDown)
148
///cairo_dock_replace_all_dialogs ();
151
if (pDock->iMagnitudeIndex == 0 && (pDock->fFoldingFactor == 0 || pDock->fFoldingFactor == 1)) // on est arrive en bas.
153
//g_print ("equilibre atteint (%d)\n", pDock->container.bInside);
154
if (! pDock->container.bInside) // on peut etre hors des icones sans etre hors de la fenetre.
156
//g_print ("rideau !\n");
158
//\__________________ On repasse derriere si on etait devant.
159
if (pDock->iVisibility == CAIRO_DOCK_VISI_KEEP_BELOW && ! pDock->bIsBelow)
160
cairo_dock_pop_down (pDock);
162
//\__________________ On se redimensionne en taille normale.
163
if (! pDock->bAutoHide && pDock->iRefCount == 0 && ! pDock->bMenuVisible) // fin de shrink sans auto-hide => taille normale.
165
//g_print ("taille normale (%x; %d)\n", pDock->pShapeBitmap , pDock->iInputState);
166
if (pDock->pShapeBitmap && pDock->iInputState != CAIRO_DOCK_INPUT_AT_REST)
168
//g_print ("+++ input shape at rest on end shrinking\n");
169
cairo_dock_set_input_shape_at_rest (pDock);
170
pDock->iInputState = CAIRO_DOCK_INPUT_AT_REST;
171
///cairo_dock_replace_all_dialogs ();
175
//\__________________ On se cache si sous-dock.
176
if (pDock->iRefCount > 0)
178
//g_print ("on cache ce sous-dock en sortant par lui\n");
179
gtk_widget_hide (pDock->container.pWidget);
180
cairo_dock_hide_parent_dock (pDock);
182
cairo_dock_hide_after_shortcut ();
186
cairo_dock_calculate_dock_icons (pDock); // relance le grossissement si on est dedans.
188
if (!pDock->bIsGrowingUp)
189
cairo_dock_replace_all_dialogs ();
190
return (!pDock->bIsGrowingUp && (pDock->fDecorationsOffsetX != 0 || (pDock->fFoldingFactor != 0 && pDock->fFoldingFactor != 1)));
194
return (!pDock->bIsGrowingUp);
198
static gboolean _cairo_dock_hide (CairoDock *pDock)
200
//g_print ("%s (%d, %.2f, %.2f)\n", __func__, pDock->iMagnitudeIndex, pDock->fHideOffset, pDock->fPostHideOffset);
202
if (pDock->fHideOffset < 1) // the hiding animation is running.
204
pDock->fHideOffset += 1./myBackendsParam.iHideNbSteps;
205
if (pDock->fHideOffset > .99) // fin d'anim.
207
pDock->fHideOffset = 1;
209
//g_print ("on arrete le cachage\n");
210
gboolean bVisibleIconsPresent = FALSE;
213
for (ic = pDock->icons; ic != NULL; ic = ic->next)
216
if (pIcon->fInsertRemoveFactor != 0) // on accelere l'animation d'apparition/disparition.
218
if (pIcon->fInsertRemoveFactor > 0)
219
pIcon->fInsertRemoveFactor = 0.05;
221
pIcon->fInsertRemoveFactor = - 0.05;
224
if (! pIcon->bIsDemandingAttention && ! pIcon->bAlwaysVisible)
225
cairo_dock_stop_icon_animation (pIcon); // s'il y'a une autre animation en cours, on l'arrete.
227
bVisibleIconsPresent = TRUE;
230
pDock->pRenderer->calculate_icons (pDock);
231
///pDock->fFoldingFactor = (myBackendsParam.bAnimateOnAutoHide ? .99 : 0.); // on arme le depliage.
232
cairo_dock_allow_entrance (pDock);
234
cairo_dock_replace_all_dialogs ();
236
if (bVisibleIconsPresent) // il y'a des icones a montrer progressivement, on reste dans la boucle.
238
pDock->fPostHideOffset = 0.05;
243
pDock->fPostHideOffset = 1; // pour que les icones demandant l'attention plus tard soient visibles.
248
else if (pDock->fPostHideOffset > 0 && pDock->fPostHideOffset < 1) // the post-hiding animation is running.
250
pDock->fPostHideOffset += 1./myBackendsParam.iHideNbSteps;
251
if (pDock->fPostHideOffset > .99)
253
pDock->fPostHideOffset = 1.;
257
else // else no hiding animation is running.
262
static gboolean _cairo_dock_show (CairoDock *pDock)
264
pDock->fHideOffset -= 1./myBackendsParam.iUnhideNbSteps;
265
if (pDock->fHideOffset < 0.01)
267
pDock->fHideOffset = 0;
268
cairo_dock_allow_entrance (pDock);
269
cairo_dock_replace_all_dialogs (); // we need it here so that a modal dialog is replaced when the dock unhides (else it would stay behind).
275
static gboolean _cairo_dock_handle_inserting_removing_icons (CairoDock *pDock)
277
gboolean bRecalculateIcons = FALSE;
278
GList* ic = pDock->icons, *next_ic;
284
if (pIcon->fInsertRemoveFactor == (gdouble)0.05)
286
gboolean bIsAppli = CAIRO_DOCK_IS_NORMAL_APPLI (pIcon);
287
if (bIsAppli && pIcon->iLastCheckTime != -1) // c'est une icone d'appli non vieille qui disparait, elle s'est probablement cachee => on la detache juste.
289
cd_message ("cette (%s) appli est toujours valide, on la detache juste", pIcon->cName);
290
pIcon->fInsertRemoveFactor = 0.; // on le fait avant le reload, sinon l'icone n'est pas rechargee.
291
if (!pIcon->bIsHidden && myTaskbarParam.bHideVisibleApplis) // on lui remet l'image normale qui servira d'embleme lorsque l'icone sera inseree a nouveau dans le dock.
292
cairo_dock_reload_icon_image (pIcon, CAIRO_CONTAINER (pDock));
293
pDock = cairo_dock_detach_appli (pIcon);
294
if (pDock == NULL) // the dock has been destroyed (empty class sub-dock).
296
cairo_dock_free_icon (pIcon);
302
cd_message (" - %s va etre supprimee", pIcon->cName);
303
cairo_dock_remove_icon_from_dock (pDock, pIcon); // enleve le separateur automatique avec; supprime le .desktop et le sous-dock des lanceurs; stoppe les applets; marque le theme.
305
if (pIcon->cClass != NULL && pDock == cairo_dock_get_class_subdock (pIcon->cClass))
307
gboolean bEmptyClassSubDock = cairo_dock_check_class_subdock_is_empty (pDock, pIcon->cClass);
308
if (bEmptyClassSubDock)
310
cairo_dock_free_icon (pIcon);
315
cairo_dock_free_icon (pIcon);
318
else if (pIcon->fInsertRemoveFactor == (gdouble)-0.05)
320
pIcon->fInsertRemoveFactor = 0; // cela n'arrete pas l'animation, qui peut se poursuivre meme apres que l'icone ait atteint sa taille maximale.
321
bRecalculateIcons = TRUE;
323
else if (pIcon->fInsertRemoveFactor != 0)
325
bRecalculateIcons = TRUE;
330
if (bRecalculateIcons)
331
cairo_dock_calculate_dock_icons (pDock);
335
static gboolean _cairo_dock_dock_animation_loop (CairoContainer *pContainer)
337
CairoDock *pDock = CAIRO_DOCK (pContainer);
338
gboolean bContinue = FALSE;
339
gboolean bUpdateSlowAnimation = FALSE;
340
pContainer->iAnimationStep ++;
341
if (pContainer->iAnimationStep * pContainer->iAnimationDeltaT >= CAIRO_DOCK_MIN_SLOW_DELTA_T)
343
bUpdateSlowAnimation = TRUE;
344
pContainer->iAnimationStep = 0;
345
pContainer->bKeepSlowAnimation = FALSE;
348
if (pDock->bIsShrinkingDown)
350
pDock->bIsShrinkingDown = _cairo_dock_shrink_down (pDock);
351
cairo_dock_redraw_container (CAIRO_CONTAINER (pDock));
352
bContinue |= pDock->bIsShrinkingDown;
354
if (pDock->bIsGrowingUp)
356
pDock->bIsGrowingUp = _cairo_dock_grow_up (pDock);
357
cairo_dock_redraw_container (CAIRO_CONTAINER (pDock));
358
bContinue |= pDock->bIsGrowingUp;
360
if (pDock->bIsHiding)
362
//g_print ("le dock se cache\n");
363
pDock->bIsHiding = _cairo_dock_hide (pDock);
364
gtk_widget_queue_draw (pContainer->pWidget); // on n'utilise pas cairo_dock_redraw_container, sinon a la derniere iteration, le dock etant cache, la fonction ne le redessine pas.
365
bContinue |= pDock->bIsHiding;
367
if (pDock->bIsShowing)
369
pDock->bIsShowing = _cairo_dock_show (pDock);
370
cairo_dock_redraw_container (CAIRO_CONTAINER (pDock));
371
bContinue |= pDock->bIsShowing;
373
//g_print (" => %d, %d\n", pDock->bIsShrinkingDown, pDock->bIsGrowingUp);
375
double fDockMagnitude = cairo_dock_calculate_magnitude (pDock->iMagnitudeIndex);
376
gboolean bIconIsAnimating;
377
gboolean bNoMoreDemandingAttention = FALSE;
380
for (ic = pDock->icons; ic != NULL; ic = ic->next)
384
icon->fDeltaYReflection = 0;
385
if (myIconsParam.fAlphaAtRest != 1)
386
icon->fAlpha = fDockMagnitude + myIconsParam.fAlphaAtRest * (1 - fDockMagnitude);
388
bIconIsAnimating = FALSE;
389
if (bUpdateSlowAnimation)
391
cairo_dock_notify_on_object (icon, NOTIFICATION_UPDATE_ICON_SLOW, icon, pDock, &bIconIsAnimating);
392
pContainer->bKeepSlowAnimation |= bIconIsAnimating;
394
cairo_dock_notify_on_object (icon, NOTIFICATION_UPDATE_ICON, icon, pDock, &bIconIsAnimating);
396
if ((icon->bIsDemandingAttention || icon->bAlwaysVisible) && cairo_dock_is_hidden (pDock)) // animation d'une icone demandant l'attention dans un dock cache => on force le dessin qui normalement ne se fait pas.
398
gtk_widget_queue_draw (pContainer->pWidget);
401
bContinue |= bIconIsAnimating;
402
if (! bIconIsAnimating)
404
icon->iAnimationState = CAIRO_DOCK_STATE_REST;
405
if (icon->bIsDemandingAttention)
407
icon->bIsDemandingAttention = FALSE;
408
bNoMoreDemandingAttention = TRUE;
412
bContinue |= pContainer->bKeepSlowAnimation;
414
if (pDock->iVisibility == CAIRO_DOCK_VISI_KEEP_BELOW && bNoMoreDemandingAttention && ! pDock->bIsBelow && ! pContainer->bInside)
416
//g_print ("plus de raison d'etre devant\n");
417
cairo_dock_pop_down (pDock);
420
if (! _cairo_dock_handle_inserting_removing_icons (pDock))
422
cd_debug ("ce dock n'a plus de raison d'etre");
426
if (bUpdateSlowAnimation)
428
cairo_dock_notify_on_object (pDock, NOTIFICATION_UPDATE_SLOW, pDock, &pContainer->bKeepSlowAnimation);
430
cairo_dock_notify_on_object (pDock, NOTIFICATION_UPDATE, pDock, &bContinue);
432
if (! bContinue && ! pContainer->bKeepSlowAnimation)
434
pContainer->iSidGLAnimation = 0;
441
static gboolean _on_dock_destroyed (GtkWidget *menu, CairoContainer *pContainer);
442
static void _on_menu_deactivated (GtkMenuShell *menu, CairoDock *pDock)
444
//g_print ("\n+++ %s ()\n\n", __func__);
445
g_return_if_fail (CAIRO_DOCK_IS_DOCK (pDock));
446
pDock->bMenuVisible = FALSE;
447
cairo_dock_emit_leave_signal (CAIRO_CONTAINER (pDock));
449
static void _on_menu_destroyed (GtkWidget *menu, CairoDock *pDock)
451
//g_print ("\n+++ %s ()\n\n", __func__);
452
cairo_dock_remove_notification_func_on_object (pDock,
453
NOTIFICATION_DESTROY,
454
(CairoDockNotificationFunc) _on_dock_destroyed,
457
static gboolean _on_dock_destroyed (GtkWidget *menu, CairoContainer *pContainer)
459
//g_print ("\n+++ %s ()\n\n", __func__);
460
g_signal_handlers_disconnect_matched
462
G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
466
_on_menu_deactivated,
468
g_signal_handlers_disconnect_matched
470
G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
477
static void _setup_menu (CairoContainer *pContainer, Icon *pIcon, GtkWidget *pMenu)
479
// keep the dock visible
480
CAIRO_DOCK (pContainer)->bMenuVisible = TRUE;
483
if (g_signal_handler_find (pMenu,
484
G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
488
_on_menu_deactivated,
489
pContainer) == 0) // on evite de connecter 2 fois ce signal, donc la fonction est appelable plusieurs fois sur un meme menu.
491
// when the menu is deactivated, hide the dock back if necessary.
492
g_signal_connect (G_OBJECT (pMenu),
494
G_CALLBACK (_on_menu_deactivated),
496
// when the menu is destroyed, remove the 'destroyed' notification on the dock.
497
g_signal_connect (G_OBJECT (pMenu),
499
G_CALLBACK (_on_menu_destroyed),
501
// when the dock is destroyed, remove the 2 signals on the menu.
502
cairo_dock_register_notification_on_object (pContainer,
503
NOTIFICATION_DESTROY,
504
(CairoDockNotificationFunc) _on_dock_destroyed,
505
CAIRO_DOCK_RUN_AFTER, pMenu); // the menu can stay alive even if the container disappear, so we need to ensure we won't call the callbacks then.
509
CairoDock *cairo_dock_new_dock (void)
104
511
//\__________________ On cree un dock.
105
512
CairoDock *pDock = g_new0 (CairoDock, 1);
106
513
pDock->container.iType = CAIRO_DOCK_TYPE_DOCK;
108
515
pDock->iRefCount = 0; // c'est un dock racine par defaut.
109
pDock->container.fRatio = 1.;
110
516
pDock->iAvoidingMouseIconType = -1;
111
517
pDock->fFlatDockWidth = - myIconsParam.iIconGap;
112
pDock->container.iMouseX = -1; // utile ?
113
pDock->container.iMouseY = -1;
518
///pDock->container.iMouseX = -1; // utile ?
519
///pDock->container.iMouseY = -1;
114
520
pDock->fMagnitudeMax = 1.;
115
521
pDock->fPostHideOffset = 1.;
116
522
pDock->iInputState = CAIRO_DOCK_INPUT_AT_REST; // le dock est cree au repos. La zone d'input sera mis en place lors du configure.
118
pDock->container.iface.set_icon_size = _cairo_dock_set_icon_size; // warning: assignment from incompatible pointer type
524
pDock->container.iface.animation_loop = _cairo_dock_dock_animation_loop;
525
pDock->container.iface.setup_menu = _setup_menu;
120
527
//\__________________ On cree la fenetre GTK.
121
528
GtkWidget *pWindow = cairo_dock_init_container (CAIRO_CONTAINER (pDock));
122
cairo_dock_install_notifications_on_object (pDock, NB_NOTIFICATIONS_DOCKS);
529
///cairo_dock_install_notifications_on_object (pDock, NB_NOTIFICATIONS_DOCKS);
530
gldi_object_set_manager (GLDI_OBJECT (pDock), GLDI_MANAGER (&myDocksMgr));
123
531
gtk_container_set_border_width (GTK_CONTAINER (pWindow), 0);
124
532
gtk_window_set_gravity (GTK_WINDOW (pWindow), GDK_GRAVITY_STATIC);
125
533
gtk_window_set_type_hint (GTK_WINDOW (pWindow), GDK_WINDOW_TYPE_HINT_DOCK);
126
534
gtk_window_set_title (GTK_WINDOW (pWindow), "cairo-dock");
128
//\__________________ On associe un renderer.
129
cairo_dock_set_renderer (pDock, cRendererName);
131
536
//\__________________ On connecte les evenements a la fenetre.
132
537
gtk_widget_add_events (pWindow,
133
538
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
134
539
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
136
541
g_signal_connect (G_OBJECT (pWindow),
542
#if (GTK_MAJOR_VERSION < 3)
138
547
G_CALLBACK (cairo_dock_on_expose),
140
549
g_signal_connect (G_OBJECT (pWindow),
735
1097
icon->pModuleInstance->pDock = pReceivingDock;
736
1098
cairo_dock_reload_module_instance (icon->pModuleInstance, FALSE);
738
cairo_dock_launch_animation (CAIRO_CONTAINER (pReceivingDock));
741
if (pReceivingDock != NULL)
742
cairo_dock_update_dock_size (pReceivingDock);
744
1103
g_list_free (pIconsList);
1107
void cairo_dock_reload_buffers_in_dock (CairoDock *pDock, gboolean bRecursive, gboolean bUpdateIconSize)
1109
g_print ("************%s (%d, %d)\n", __func__, pDock->bIsMainDock, bRecursive);
1110
if (bUpdateIconSize && pDock->bGlobalIconSize)
1111
pDock->iIconSize = myIconsParam.iIconWidth;
1113
// for each icon, reload its buffer (size may change).
1116
for (ic = pDock->icons; ic != NULL; ic = ic->next)
1120
if (CAIRO_DOCK_IS_APPLET (icon)) // for an applet, we need to let the module know that the size or the theme has changed, so that it can reload its private buffers.
1122
cairo_dock_reload_module_instance (icon->pModuleInstance, FALSE);
1126
if (bUpdateIconSize)
1128
icon->fWidth = icon->fHeight = 0; // no request
1129
icon->iImageWidth = icon->iImageHeight = 0;
1130
cairo_dock_set_icon_size_in_dock (pDock, icon);
1132
cairo_dock_trigger_load_icon_buffers (icon);
1135
if (bRecursive && icon->pSubDock != NULL) // we handle the sub-dock for applets too, so that they don't need to care.
1137
///cairo_dock_synchronize_one_sub_dock_orientation (icon->pSubDock, pDock, FALSE); /// should probably not be here.
1138
if (bUpdateIconSize)
1139
icon->pSubDock->iIconSize = pDock->iIconSize;
1140
cairo_dock_reload_buffers_in_dock (icon->pSubDock, bRecursive, bUpdateIconSize);
1144
if (bUpdateIconSize)
1146
cairo_dock_update_dock_size (pDock);
1147
cairo_dock_calculate_dock_icons (pDock);
1149
cairo_dock_move_resize_dock (pDock);
1150
if (pDock->iVisibility == CAIRO_DOCK_VISI_RESERVE) // la position/taille a change, il faut refaire la reservation.
1151
cairo_dock_reserve_space_for_dock (pDock, TRUE);
1152
gtk_widget_queue_draw (pDock->container.pWidget);
1157
void cairo_dock_set_icon_size_in_dock (CairoDock *pDock, Icon *icon)
1159
if (pDock->pRenderer && pDock->pRenderer->set_icon_size)
1161
pDock->pRenderer->set_icon_size (icon, pDock);
1166
if (pDock->iIconSize != 0)
1168
wi = hi = pDock->iIconSize;
1170
else // same size as main dock.
1172
wi = myIconsParam.iIconWidth;
1173
hi = myIconsParam.iIconHeight;
1175
g_print (" size: %d => %dx%d\n", pDock->iIconSize, wi, hi);
1176
double fMaxScale = cairo_dock_get_max_scale (pDock);
1178
// set the visible size at rest.
1179
if (CAIRO_DOCK_ICON_TYPE_IS_APPLET (icon)) // for applets, consider (fWidth,fHeight) as a requested size, if not 0.
1181
//g_print ("%s (%s, %.1fx%.1f\n", __func__, icon->pModuleInstance->pModule->pVisitCard->cModuleName, icon->fWidth, icon->fHeight);
1182
if (icon->iImageWidth != 0)
1184
if (pDock->container.bIsHorizontal)
1185
icon->fWidth = icon->iImageWidth / fMaxScale;
1187
icon->fHeight = icon->iImageWidth / fMaxScale;
1189
if (icon->iImageHeight != 0)
1191
if (pDock->container.bIsHorizontal)
1192
icon->fHeight = icon->iImageHeight / fMaxScale;
1194
icon->fWidth = icon->iImageHeight / fMaxScale;
1196
if (icon->fWidth == 0)
1198
if (icon->fHeight == 0 || icon->fHeight > hi)
1201
else if (CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon)) // separators have their own size.
1203
icon->fWidth = myIconsParam.iSeparatorWidth;
1204
icon->fHeight = MIN (myIconsParam.iSeparatorHeight, hi);
1206
else // any other icon use the global size
1212
// texture size can be deduced then.
1213
if (pDock->container.bIsHorizontal
1214
|| (CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon) && myIconsParam.bRevolveSeparator))
1216
icon->iImageWidth = icon->fWidth * fMaxScale;
1217
icon->iImageHeight = icon->fHeight * fMaxScale;
1221
icon->iImageWidth = icon->fHeight * fMaxScale;
1222
icon->iImageHeight = icon->fWidth * fMaxScale;
748
1228
void cairo_dock_create_redirect_texture_for_dock (CairoDock *pDock)
750
1230
if (! g_openglConfig.bFboAvailable)
752
if (pDock->iRedirectedTexture != 0)
755
pDock->iRedirectedTexture = cairo_dock_load_texture_from_raw_data (NULL,
756
(pDock->container.bIsHorizontal ? pDock->container.iWidth : pDock->container.iHeight),
757
(pDock->container.bIsHorizontal ? pDock->container.iHeight : pDock->container.iWidth));
759
glGenFramebuffersEXT(1, &pDock->iFboId);
1232
if (pDock->iRedirectedTexture == 0)
1234
pDock->iRedirectedTexture = cairo_dock_create_texture_from_raw_data (NULL,
1235
(pDock->container.bIsHorizontal ? pDock->container.iWidth : pDock->container.iHeight),
1236
(pDock->container.bIsHorizontal ? pDock->container.iHeight : pDock->container.iWidth));
1238
if (pDock->iFboId == 0)
1239
glGenFramebuffersEXT(1, &pDock->iFboId);