Skip to content

Commit 52c47a4

Browse files
authored
Merge pull request #196 from dkondor/icons_extra_scale
Add extra scale parameter for icons
2 parents 4fc7cad + 2eb5504 commit 52c47a4

File tree

6 files changed

+13
-1
lines changed

6 files changed

+13
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ include (GNUInstallDirs)
1313

1414
########### project ###############
1515

16-
set (VERSION "3.6.90") # no dash, only numbers, dots and maybe alpha/beta/rc, e.g.: 3.3.1 or 3.3.99.alpha1
16+
set (VERSION "3.6.91") # no dash, only numbers, dots and maybe alpha/beta/rc, e.g.: 3.3.1 or 3.3.99.alpha1
1717

1818
add_compile_options (-std=c99 -Wall -Wextra -Werror-implicit-function-declaration) # -Wextra -Wwrite-strings -Wuninitialized -Wstrict-prototypes -Wreturn-type -Wparentheses -Warray-bounds)
1919
if (NOT DEFINED CMAKE_BUILD_TYPE)

data/cairo-dock.conf.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,10 @@ launcher size = 40;40
503503
#{in pixels.}
504504
icon gap = 0
505505

506+
#e+[0.4;1;smaller;bigger] Extra icon scale :
507+
#{You can choose to make the icons smaller, leaving an extra gap around them.}
508+
extra scale = 1.
509+
506510
#F+[Zoom effect;@pkgdatadir@/icons/icon-wave.png]
507511
frame_shape =
508512
#f+[1;5] Maximum zoom of the icons :

src/gldit/cairo-dock-draw-opengl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ void cairo_dock_render_one_icon_opengl (Icon *icon, CairoDock *pDock, double fDo
347347
glTranslatef ((!pDock->container.bDirectionUp ? icon->fHeight * (- icon->fScale + 1)/2 : icon->fHeight * (icon->fScale - 1)/2), 0., 0.);
348348
}
349349
}
350+
glScalef (myIconsParam.fExtraScale, myIconsParam.fExtraScale, 1.);
350351
if (icon->fOrientation != 0)
351352
{
352353
glTranslatef (-icon->fWidth * icon->fScale/2, icon->fHeight * icon->fScale/2, 0.);

src/gldit/cairo-dock-draw.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,11 @@ void cairo_dock_render_one_icon (Icon *icon, CairoDock *pDock, cairo_t *pCairoCo
574574

575575
cairo_save (pCairoContext);
576576

577+
cairo_translate (pCairoContext,
578+
0.5 * (1.0 - myIconsParam.fExtraScale) * icon->fWidth * icon->fWidthFactor * icon->fScale,
579+
0.5 * (1.0 - myIconsParam.fExtraScale) * icon->fHeight * icon->fHeightFactor * icon->fScale);
580+
cairo_scale (pCairoContext, myIconsParam.fExtraScale, myIconsParam.fExtraScale);
581+
577582
//\_____________________ On positionne l'icone.
578583
if (icon->fOrientation != 0)
579584
cairo_rotate (pCairoContext, icon->fOrientation);

src/gldit/cairo-dock-icon-manager.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ static gboolean get_config (GKeyFile *pKeyFile, CairoIconsParam *pIcons)
481481
pIcons->iIconWidth = 48;
482482
if (pIcons->iIconHeight == 0)
483483
pIcons->iIconHeight = 48;
484+
pIcons->fExtraScale = cairo_dock_get_double_key_value (pKeyFile, "Icons", "extra scale", &bFlushConfFileNeeded, 1., NULL, NULL);
484485

485486
//\___________________ Parametres des separateurs.
486487
cairo_dock_get_size_key_value_helper (pKeyFile, "Icons", "separator ", bFlushConfFileNeeded, pIcons->iSeparatorWidth, pIcons->iSeparatorHeight);

src/gldit/cairo-dock-icon-manager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct _CairoIconsParam {
8383
gboolean bLabelForPointedIconOnly;
8484
gint iLabelSize; // taille des etiquettes des icones, en prenant en compte le contour et la marge.
8585
gdouble fLabelAlphaThreshold;
86+
gdouble fExtraScale;
8687
};
8788

8889
/// signals

0 commit comments

Comments
 (0)