elm theme - make blur effects for theme ifdefed to allow turning on

you can compile the them with edje_cc -DBLUR_WINLIST and either
-DBLUR_TITLE or -DBLUR_BEHIND options passed to edje_cc ... if you
compile it by hand. either way it makes it easier to see how to do
this for theme makers.
This commit is contained in:
Carsten Haitzler 2024-02-04 11:54:51 +00:00
parent 5aefadeef3
commit 178b786f39
2 changed files with 53 additions and 12 deletions

View File

@ -1,3 +1,13 @@
// Define this to enable a demo title blur
//#define BLUR_TITLE 1
// Define this to enable a demo blue behind everythnig - conflicts with title
//#define BLUR_BEHIND 1
// Some values used if blur is enabled
#define BLUR_FORCE_ALPHA 160
#define BLUR_TITLE_AMOUNT "32"
#define BLUR_BEHIND_AMOUNT "32"
group { name: "e/widgets/border/volume";
images.image: "shadow_circle_vert.png" COMP;
parts {
@ -164,6 +174,15 @@ group { name: "e/widgets/border/default/border";
}
}
WIN_SHAD("shadow_base", "shadow_clip", "win_shad_flat.png", 21, 21, 14, 28, 0.5)
#ifdef BLUR_BEHIND
snapshot { name: "title-blur"; mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "top";
rel2.to: "bottom";
filter.code: "padding_set { 0 } blur { "BLUR_BEHIND_AMOUNT", color = '#ffff' }";
}
}
#endif
part { name: "client_clip"; type: RECT; mouse_events: 0;
description { state: "default" 0.0;
rel1.to_y: "e.swallow.client";
@ -193,12 +212,23 @@ group { name: "e/widgets/border/default/border";
rel2.offset: -1 -1;
}
}
#ifdef BLUR_TITLE
snapshot { name: "title-blur"; mouse_events: 0;
description { state: "default" 0.0;
rel.to: "top";
filter.code: "padding_set { 0 } blur { "BLUR_TITLE_AMOUNT", color = '#ffff' }";
}
}
#endif
part { name: "top"; type: RECT; mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
rel2.to_y: "e.text.title";
rel2.offset: -1 2;
color_class: "/bg/normal/titlebar";
#if defined(BLUR_TITLE) || defined(BLUR_BEHIND)
color: 255 255 255 BLUR_FORCE_ALPHA;
#endif
offscale;
}
description { state: "focused" 0.0;
@ -494,6 +524,9 @@ group { name: "e/widgets/border/default/border";
description { state: "default" 0.0;
color_class: "/bg/normal/border";
rel.to: "bottom";
#if defined(BLUR_BEHIND)
color: 255 255 255 BLUR_FORCE_ALPHA;
#endif
}
description { state: "focused" 0.0;
inherit: "default" 0.0;

View File

@ -1,3 +1,9 @@
// Define this to enable blur background to winlist
//#define BLUR_WINLIST 1
// Some values used if blur is enabled
#define BLUR_WINLIST_AMOUNT "48"
group { name: "e/widgets/winlist/main";
parts {
part { name: "base"; type: RECT; mouse_events: 0;
@ -270,27 +276,27 @@ group { name: "e/widgets/winlist/large/bg";
color: 255 255 255 255; // no cc
}
}
/*
#ifdef BLUR_WINLIST
snapshot { "bg_blur";
clip_to: "bg_clip";
description { state: "default" 0.0;
filter.code: "padding_set { 0 } blur { state.pos * 50, color = '#ffff' }";
filter.code: "padding_set { 0 } blur { state.pos * "BLUR_WINLIST_AMOUNT", color = '#ffff' }";
visible: 0;
}
desc { state: "visible" 0.0;
inherit: "default" 0.0;
filter.code: "padding_set { 0 } blur { (1.0 - state.pos) * 50, color = '#ffff' }";
filter.code: "padding_set { 0 } blur { (1.0 - state.pos) * "BLUR_WINLIST_AMOUNT", color = '#ffff' }";
visible: 1;
}
}
*/
#endif
part { name: "bg_darken"; type: RECT;
clip_to: "bg_clip";
description { state: "default" 0.0;
color_class: "/dim/normal/winlist/base";
}
}
/*
#ifdef BLUR_WINLIST
part { name: "shadow"; mouse_events: 0;
clip_to: "bg_clip";
description { state: "default" 0.0;
@ -298,26 +304,26 @@ group { name: "e/widgets/winlist/large/bg";
rel2.relative: 2.0 2.0;
image.normal: "screen_circular_shadow.png";
fill.smooth: 0;
color: 255 255 255 0; // no cc
visible: 0;
}
description { state: "visible" 0.0;
inherit;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
color: 255 255 255 255; // no cc
visible: 1;
}
}
*/
#endif
}
programs {
program { signal: "e,state,visible,on"; source: "e";
action: STATE_SET "visible" 0.0;
transition: DECELERATE 0.2 USE_DURATION_FACTOR 1 CURRENT;
target: "bg_clip";
// target: "bg_blur";
// target: "shadow";
#ifdef BLUR_WINLIST
target: "bg_blur";
target: "shadow";
#endif
after: "show2";
}
program { name: "show2";
@ -327,8 +333,10 @@ group { name: "e/widgets/winlist/large/bg";
action: STATE_SET "default" 0.0;
transition: ACCELERATE 0.2 USE_DURATION_FACTOR 1 CURRENT;
target: "bg_clip";
// target: "bg_blur";
// target: "shadow";
#ifdef BLUR_WINLIST
target: "bg_blur";
target: "shadow";
#endif
after: "hide2";
}
program { name: "hide2";