diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2020-04-12 11:58:26 +0100 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2020-04-12 11:58:26 +0100 |
commit | bccebc228cd4e9e355bc23a15685666370270a5a (patch) | |
tree | 49cee7ec0b0addafaa1caded98acdd126c4d5d19 /data/elementary/themes | |
parent | 3a53dc951ba3528a2aeca031b2e07bbfc7462c05 (diff) |
TH - make cpufreq just show freqs instantly - saves anim feedback loop
Diffstat (limited to 'data/elementary/themes')
-rw-r--r-- | data/elementary/themes/edc/cpufreq.edc | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/data/elementary/themes/edc/cpufreq.edc b/data/elementary/themes/edc/cpufreq.edc index c0a03fc588..e65fc71626 100644 --- a/data/elementary/themes/edc/cpufreq.edc +++ b/data/elementary/themes/edc/cpufreq.edc | |||
@@ -13,10 +13,11 @@ group { name: "e/modules/cpufreq/main"; | |||
13 | public available_frequencies; | 13 | public available_frequencies; |
14 | public available_governors; | 14 | public available_governors; |
15 | 15 | ||
16 | // public cur_freq_anim; | ||
17 | |||
16 | public cur_freq_old; | 18 | public cur_freq_old; |
17 | public cur_freq_new; | 19 | public cur_freq_new; |
18 | public cur_freq_now; | 20 | public cur_freq_now; |
19 | public cur_freq_anim; | ||
20 | 21 | ||
21 | public min_freq_old; | 22 | public min_freq_old; |
22 | public min_freq_new; | 23 | public min_freq_new; |
@@ -26,12 +27,10 @@ group { name: "e/modules/cpufreq/main"; | |||
26 | public max_freq_new; | 27 | public max_freq_new; |
27 | public max_freq_now; | 28 | public max_freq_now; |
28 | 29 | ||
29 | public slide_cur_freq(val, Float:v) { | 30 | public show_freq(Float:v) { |
30 | new Float:freq, Float:min_freq, Float:max_freq, Float:tf; | 31 | new Float:freq, Float:min_freq, Float:max_freq, Float:tf; |
31 | new f, f0, f1; | 32 | new f, f0, f1; |
32 | 33 | ||
33 | v = (1.0 - cos(v * 3.141592654)) / 2.0; | ||
34 | |||
35 | min_freq = fetch_int(available_frequencies, 0); | 34 | min_freq = fetch_int(available_frequencies, 0); |
36 | max_freq = fetch_int(available_frequencies, | 35 | max_freq = fetch_int(available_frequencies, |
37 | count(available_frequencies) - 1); | 36 | count(available_frequencies) - 1); |
@@ -78,12 +77,16 @@ group { name: "e/modules/cpufreq/main"; | |||
78 | set_state_val(PART:"meter_max", STATE_MAP_ROT_Z, tf); | 77 | set_state_val(PART:"meter_max", STATE_MAP_ROT_Z, tf); |
79 | set_state(PART:"meter_max", "custom", 0.0); | 78 | set_state(PART:"meter_max", "custom", 0.0); |
80 | 79 | ||
81 | if (v >= 1.0) { | ||
82 | set_int(cur_freq_anim, 0); | ||
83 | return 0; | ||
84 | } | ||
85 | return 1; | ||
86 | } | 80 | } |
81 | // public slide_cur_freq(val, Float:v) { | ||
82 | // v = (1.0 - cos(v * 3.141592654)) / 2.0; | ||
83 | // show_freq(v); | ||
84 | // if (v >= 1.0) { | ||
85 | // set_int(cur_freq_anim, 0); | ||
86 | // return 0; | ||
87 | // } | ||
88 | // return 1; | ||
89 | // } | ||
87 | 90 | ||
88 | public message(Msg_Type:type, id, ...) { | 91 | public message(Msg_Type:type, id, ...) { |
89 | if ((type == MSG_INT_SET) && (id == 1)) { // add an available freq | 92 | if ((type == MSG_INT_SET) && (id == 1)) { // add an available freq |
@@ -104,8 +107,8 @@ group { name: "e/modules/cpufreq/main"; | |||
104 | append_str(available_governors, text); | 107 | append_str(available_governors, text); |
105 | } | 108 | } |
106 | } else if ((type == MSG_INT_SET) && (id == 3)) { // avg freq | 109 | } else if ((type == MSG_INT_SET) && (id == 3)) { // avg freq |
107 | new f; | 110 | // new ani; |
108 | new ani, curf, minf, maxf; | 111 | new f, curf, minf, maxf; |
109 | new text[100]; | 112 | new text[100]; |
110 | 113 | ||
111 | f = getarg(2); | 114 | f = getarg(2); |
@@ -119,11 +122,6 @@ group { name: "e/modules/cpufreq/main"; | |||
119 | } | 122 | } |
120 | set_text(PART:"readout", text); | 123 | set_text(PART:"readout", text); |
121 | 124 | ||
122 | ani = get_int(cur_freq_anim); | ||
123 | if (ani > 0) cancel_anim(ani); | ||
124 | ani = anim(0.25, "slide_cur_freq", 0); | ||
125 | set_int(cur_freq_anim, ani); | ||
126 | |||
127 | f = getarg(2); | 125 | f = getarg(2); |
128 | curf = get_int(cur_freq_now); | 126 | curf = get_int(cur_freq_now); |
129 | set_int(cur_freq_old, curf); | 127 | set_int(cur_freq_old, curf); |
@@ -138,6 +136,13 @@ group { name: "e/modules/cpufreq/main"; | |||
138 | maxf = get_int(max_freq_now); | 136 | maxf = get_int(max_freq_now); |
139 | set_int(max_freq_old, maxf); | 137 | set_int(max_freq_old, maxf); |
140 | set_int(max_freq_new, f); | 138 | set_int(max_freq_new, f); |
139 | |||
140 | // ani = get_int(cur_freq_anim); | ||
141 | // if (ani > 0) cancel_anim(ani); | ||
142 | // ani = anim(0.2, "slide_cur_freq", 0); | ||
143 | // set_int(cur_freq_anim, ani); | ||
144 | show_freq(1.0); | ||
145 | |||
141 | } else if ((type == MSG_STRING) && (id == 4)) { | 146 | } else if ((type == MSG_STRING) && (id == 4)) { |
142 | new text[100]; | 147 | new text[100]; |
143 | snprintf(text, 100, "%s", getarg(2)); | 148 | snprintf(text, 100, "%s", getarg(2)); |