summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--data/themes/default_battery.edc50
-rw-r--r--data/themes/default_clock.edc202
-rw-r--r--data/themes/default_ibar.edc47
-rw-r--r--data/themes/default_pager.edc70
-rw-r--r--data/themes/images/e17_clock_bg.pngbin6685 -> 10270 bytes
-rw-r--r--data/themes/images/e17_clock_fg.pngbin21301 -> 17026 bytes
-rw-r--r--debian/control15
-rw-r--r--debian/enlightenment-data.install2
-rw-r--r--debian/enlightenment.install4
-rw-r--r--src/bin/e_border.c15
-rw-r--r--src/bin/e_config.c143
-rw-r--r--src/bin/e_config.h3
-rw-r--r--src/bin/e_dnd.c5
-rw-r--r--src/bin/e_gadcon.c910
-rw-r--r--src/bin/e_gadcon.h32
-rw-r--r--src/bin/e_includes.h1
-rw-r--r--src/bin/e_main.c3
-rw-r--r--src/bin/e_place.c497
-rw-r--r--src/bin/e_popup.c17
-rw-r--r--src/bin/e_resist.c32
-rw-r--r--src/bin/e_shelf.c28
-rw-r--r--src/bin/e_shelf.h1
-rw-r--r--src/modules/battery/Makefile.am3
-rw-r--r--src/modules/battery/e_mod_config.c60
-rw-r--r--src/modules/battery/e_mod_config.h8
-rw-r--r--src/modules/battery/e_mod_main.c865
-rw-r--r--src/modules/battery/e_mod_main.h57
-rw-r--r--src/modules/clock/Makefile.am4
-rw-r--r--src/modules/clock/e_mod_config.c99
-rw-r--r--src/modules/clock/e_mod_config.h8
-rw-r--r--src/modules/clock/e_mod_main.c480
-rw-r--r--src/modules/clock/e_mod_main.h44
-rw-r--r--src/modules/cpufreq/e_mod_main.c1365
-rw-r--r--src/modules/cpufreq/e_mod_main.h69
-rw-r--r--src/modules/dropshadow/e_mod_main.c2
-rw-r--r--src/modules/ibar/Makefile.am3
-rw-r--r--src/modules/ibar/e_mod_config.c177
-rw-r--r--src/modules/ibar/e_mod_config.h8
-rw-r--r--src/modules/ibar/e_mod_main.c2327
-rw-r--r--src/modules/ibar/e_mod_main.h91
-rw-r--r--src/modules/pager/Makefile.am3
-rw-r--r--src/modules/pager/e_mod_config.c117
-rw-r--r--src/modules/pager/e_mod_config.h8
-rw-r--r--src/modules/pager/e_mod_main.c2392
-rw-r--r--src/modules/pager/e_mod_main.h139
-rw-r--r--src/modules/start/e_mod_main.c32
-rw-r--r--src/modules/start/e_mod_main.h4
-rw-r--r--src/modules/temperature/Makefile.am3
-rw-r--r--src/modules/temperature/e_mod_config.c112
-rw-r--r--src/modules/temperature/e_mod_config.h8
-rw-r--r--src/modules/temperature/e_mod_main.c491
-rw-r--r--src/modules/temperature/e_mod_main.h43
53 files changed, 4589 insertions, 6512 deletions
diff --git a/Makefile.am b/Makefile.am
index 57b298f89..36aa42a53 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,7 +11,7 @@ bin_SCRIPTS = enlightenment-config
11EXTRA_DIST = README AUTHORS COPYING COPYING-PLAIN enlightenment.spec \ 11EXTRA_DIST = README AUTHORS COPYING COPYING-PLAIN enlightenment.spec \
12 debian/changelog debian/changelog.in debian/copyright \ 12 debian/changelog debian/changelog.in debian/copyright \
13 debian/rules debian/enlightenment.install \ 13 debian/rules debian/enlightenment.install \
14 debian/enlightenment.docs debian/enlightenment-data.install \ 14 debian/enlightenment.docs \
15 debian/libe.install debian/libe-dev.install debian/control \ 15 debian/libe.install debian/libe-dev.install debian/control \
16 enlightenment.spec.in 16 enlightenment.spec.in
17 17
diff --git a/data/themes/default_battery.edc b/data/themes/default_battery.edc
index 5a52a32cd..85deac42e 100644
--- a/data/themes/default_battery.edc
+++ b/data/themes/default_battery.edc
@@ -115,6 +115,31 @@ group {
115 } 115 }
116 } 116 }
117 part { 117 part {
118 name: "ac";
119 clip_to: "fade_clip";
120 description {
121 state: "default" 0.0;
122 aspect: 0.975609756 0.975609756;
123 align: 1.0 1.0;
124 max: 40 41;
125 visible: 0;
126 rel1 {
127 relative: 0.5 0.5;
128 }
129 rel2 {
130 relative: 1.0 1.0;
131 }
132 image {
133 normal: "e17_battery_ac.png";
134 }
135 }
136 description {
137 state: "active" 0.0;
138 inherit: "default" 0.0;
139 visible: 1;
140 }
141 }
142 part {
118 name: "reading"; 143 name: "reading";
119 type: TEXT; 144 type: TEXT;
120 effect: SOFT_SHADOW; 145 effect: SOFT_SHADOW;
@@ -171,31 +196,6 @@ group {
171 } 196 }
172 } 197 }
173 part { 198 part {
174 name: "ac";
175 clip_to: "fade_clip";
176 description {
177 state: "default" 0.0;
178 aspect: 0.975609756 0.975609756;
179 align: 1.0 1.0;
180 max: 40 41;
181 visible: 0;
182 rel1 {
183 relative: 0.5 0.5;
184 }
185 rel2 {
186 relative: 1.0 1.0;
187 }
188 image {
189 normal: "e17_battery_ac.png";
190 }
191 }
192 description {
193 state: "active" 0.0;
194 inherit: "default" 0.0;
195 visible: 1;
196 }
197 }
198 part {
199 name: "fade_clip"; 199 name: "fade_clip";
200 type: RECT; 200 type: RECT;
201 mouse_events: 0; 201 mouse_events: 0;
diff --git a/data/themes/default_clock.edc b/data/themes/default_clock.edc
index 7cfcf885d..abfec1912 100644
--- a/data/themes/default_clock.edc
+++ b/data/themes/default_clock.edc
@@ -1,8 +1,6 @@
1images { 1images {
2 image: "e17_clock_bg.png" COMP; 2 image: "e17_clock_bg.png" COMP;
3 image: "e17_clock_fg.png" COMP; 3 image: "e17_clock_fg.png" COMP;
4 image: "e17_ibar_over_h.png" COMP;
5 image: "e17_ibar_bg_h.png" COMP;
6 image: "e17_clock_seconds_00.png" COMP; 4 image: "e17_clock_seconds_00.png" COMP;
7 image: "e17_clock_seconds_01.png" COMP; 5 image: "e17_clock_seconds_01.png" COMP;
8 image: "e17_clock_seconds_02.png" COMP; 6 image: "e17_clock_seconds_02.png" COMP;
@@ -189,24 +187,10 @@ group {
189 script { 187 script {
190 public clock_cb(val) { 188 public clock_cb(val) {
191 new buf[11]; 189 new buf[11];
192 new digitalVal[15];
193 new hourStr[4], minuteStr[4], secondStr[4];
194 new year, month, day, yearday, weekday, hour, minute; 190 new year, month, day, yearday, weekday, hour, minute;
195 new Float:second; 191 new Float:second;
196 new v; 192 new v;
197 new isAfternoon; 193
198 new digiBuf[2];
199 new digitalStyle;
200 new DIGITAL_STYLE_NONE, DIGITAL_STYLE_NORMAL, DIGITAL_STYLE_24HOUR;
201
202 DIGITAL_STYLE_NONE = 0;
203 DIGITAL_STYLE_NORMAL = 1;
204 DIGITAL_STYLE_24HOUR = 2;
205
206 get_text(PART:"digitalStyle", digiBuf, 2);
207
208 digitalStyle = atoi(digiBuf);
209
210 date(year, month, day, yearday, weekday, hour, minute, second); 194 date(year, month, day, yearday, weekday, hour, minute, second);
211 v = round(second); 195 v = round(second);
212#if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA 196#if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA
@@ -216,7 +200,6 @@ group {
216#endif 200#endif
217#if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA 201#if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA
218 buf[0] = 0; 202 buf[0] = 0;
219 digitalVal[0] = 0;
220 if (v < 10) {snprintf(buf, 10, "0%i", v);} 203 if (v < 10) {snprintf(buf, 10, "0%i", v);}
221 else {snprintf(buf, 10, "%i", v);} 204 else {snprintf(buf, 10, "%i", v);}
222 set_state(PART:"seconds", buf, 0.0); 205 set_state(PART:"seconds", buf, 0.0);
@@ -232,59 +215,6 @@ group {
232 if (v < 10) {snprintf(buf, 10, "0%i", v);} 215 if (v < 10) {snprintf(buf, 10, "0%i", v);}
233 else {snprintf(buf, 10, "%i", v);} 216 else {snprintf(buf, 10, "%i", v);}
234 set_state(PART:"hour", buf, 0.0); 217 set_state(PART:"hour", buf, 0.0);
235
236
237 buf[0] = 0;
238 v = round(second);
239 if (v < 10) {snprintf(buf, 10, "0%i", v);}
240 else {snprintf(buf, 10, "%i", v);}
241 snprintf(secondStr, 3, "%s", buf);
242
243 buf[0] = 0;
244 if (minute < 10) {snprintf(buf, 10, "0%i", minute);}
245 else {snprintf(buf, 10, "%i", minute);}
246 snprintf(minuteStr, 3, "%s", buf);
247
248 buf[0] = 0;
249 isAfternoon = 0;
250 v = hour;
251 if (hour >= 12 && hour < 24) { isAfternoon = 1; }
252 if (digitalStyle == DIGITAL_STYLE_NORMAL) {
253 v = (v % 12);
254 if (v == 0) { v = 12; }
255 }
256 if (digitalStyle == DIGITAL_STYLE_24HOUR && v < 10) {
257 snprintf(buf, 10, "0%i", v);
258 } else {
259 snprintf(buf, 10, "%i", v);
260 }
261 snprintf(hourStr, 3, "%s", buf);
262
263 buf[0] = 0;
264
265 if (isAfternoon == 1) {
266 snprintf(buf, 10, "PM");
267 } else {
268 snprintf(buf, 10, "AM");
269 }
270
271 if (digitalStyle != DIGITAL_STYLE_NONE) {
272 if (digitalStyle == DIGITAL_STYLE_NORMAL) {
273 snprintf(digitalVal, 14, "%s:%s:%s %s", hourStr, minuteStr, secondStr, buf);
274 } else if (digitalStyle == DIGITAL_STYLE_24HOUR) {
275 snprintf(digitalVal, 14, " %s:%s:%s ", hourStr, minuteStr, secondStr);
276 }
277
278 set_text(PART:"digital", digitalVal);
279 set_state(PART:"digital", "digital", 0.0);
280 set_state(PART:"digital_bg", "digital", 0.0);
281 set_state(PART:"digital_bg_overlay", "digital", 0.0);
282 } else {
283 set_text(PART:"digital", "");
284 set_state(PART:"digital", "hidden", 0.0);
285 set_state(PART:"digital_bg", "hidden", 0.0);
286 set_state(PART:"digital_bg_overlay", "hidden", 0.0);
287 }
288 } 218 }
289 } 219 }
290 parts { 220 parts {
@@ -310,10 +240,10 @@ group {
310 state: "default" 0.0; 240 state: "default" 0.0;
311 aspect: 1.0 1.0; 241 aspect: 1.0 1.0;
312 rel1 { 242 rel1 {
313 relative: 0.1 0.1; 243 relative: 0.05 0.05;
314 } 244 }
315 rel2 { 245 rel2 {
316 relative: 0.9 0.9; 246 relative: 0.95 0.95;
317 } 247 }
318 image { 248 image {
319 normal: "e17_clock_"IND"_00.png"; 249 normal: "e17_clock_"IND"_00.png";
@@ -403,10 +333,10 @@ group {
403 state: "default" 0.0; 333 state: "default" 0.0;
404 aspect: 1.0 1.0; 334 aspect: 1.0 1.0;
405 rel1 { 335 rel1 {
406 relative: 0.1 0.1; 336 relative: 0.05 0.05;
407 } 337 }
408 rel2 { 338 rel2 {
409 relative: 0.9 0.9; 339 relative: 0.95 0.95;
410 } 340 }
411 image { 341 image {
412 normal: "e17_clock_"IND"_00.png"; 342 normal: "e17_clock_"IND"_00.png";
@@ -495,10 +425,10 @@ group {
495 state: "default" 0.0; 425 state: "default" 0.0;
496 aspect: 1.0 1.0; 426 aspect: 1.0 1.0;
497 rel1 { 427 rel1 {
498 relative: 0.2 0.2; 428 relative: 0.1 0.1;
499 } 429 }
500 rel2 { 430 rel2 {
501 relative: 0.8 0.8; 431 relative: 0.9 0.9;
502 } 432 }
503 image { 433 image {
504 normal: "e17_clock_"IND"_00.png"; 434 normal: "e17_clock_"IND"_00.png";
@@ -592,124 +522,6 @@ group {
592 } 522 }
593 } 523 }
594 } 524 }
595 part {
596 name: "digital_bg_area";
597 type: "RECT";
598 mouse_events: 0;
599 description {
600 state: "default" 0.0;
601 min: 16 16;
602 rel1 {
603 relative: 0.0 0.8;
604 }
605 rel2 {
606 relative: 1.0 1.0;
607 }
608 visible: 0;
609 }
610 }
611 part {
612 name: "digital_bg_overlay";
613 mouse_events: 0;
614 description {
615 state: "default" 0.0;
616 rel1 {
617 to: "digital_bg_area";
618 relative: 0.0 0.0;
619 }
620 rel2 {
621 to: "digital_bg_area";
622 relative: 1.0 1.0;
623 }
624 image {
625 normal: "e17_ibar_over_h.png";
626 border: 13 13 13 13;
627 }
628 fill {
629 smooth: 0;
630 }
631 color: 255 255 255 192;
632 }
633 description {
634 state: "hidden" 0.0;
635 visible: 0;
636 image {
637 normal: "e17_ibar_over_h.png";
638 border: 13 13 13 13;
639 middle: 0;
640 }
641 }
642 }
643 part {
644 name: "digital_bg";
645 mouse_events: 0;
646 description {
647 state: "default" 0.0;
648 rel1 {
649 to: "digital_bg_area";
650 relative: 0.0 0.0;
651 }
652 rel2 {
653 to: "digital_bg_area";
654 relative: 1.0 1.0;
655 }
656 image {
657 normal: "e17_ibar_bg_h.png";
658 border: 6 6 6 6;
659 }
660 fill {
661 smooth: 0;
662 }
663 color: 255 255 255 128;
664 }
665 description {
666 state: "hidden" 0.0;
667 visible: 0;
668 image {
669 normal: "e17_ibar_bg_h.png";
670 border: 6 6 6 6;
671 middle: 0;
672 }
673 }
674 }
675 part {
676 name: "digital";
677 type: TEXT;
678 effect: SOFT_SHADOW;
679 description {
680 state: "default" 0.0;
681 rel1 {
682 to: "digital_bg_area";
683 offset: 3 4;
684 }
685 rel2 {
686 to: "digital_bg_area";
687 offset: -2 -2;
688 }
689 color: 255 255 255 255;
690 color3: 0 0 0 32;
691 text {
692 text: "00:00:00 AM";
693 font: "Edje-Vera";
694 size: 15;
695 fit: 0 1;
696 align: 0.5 0.5;
697 text_class: "clock";
698 }
699 }
700 description {
701 state: "hidden" 0.0;
702 visible: 0;
703 }
704 }
705 part {
706 name: "digitalStyle";
707 type: TEXT;
708 description {
709 state: "hidden" 0.0;
710 visible: 0;
711 }
712 }
713 } 525 }
714 programs { 526 programs {
715 program { 527 program {
diff --git a/data/themes/default_ibar.edc b/data/themes/default_ibar.edc
index 44ffb5434..94915442c 100644
--- a/data/themes/default_ibar.edc
+++ b/data/themes/default_ibar.edc
@@ -621,18 +621,55 @@ group {
621 state: "default" 0.0; 621 state: "default" 0.0;
622 rel1 { 622 rel1 {
623 relative: 0.0 0.0; 623 relative: 0.0 0.0;
624 offset: 4 4; 624 offset: 2 2;
625 } 625 }
626 rel2 { 626 rel2 {
627 relative: 1.0 1.0; 627 relative: 1.0 1.0;
628 offset: -5 -5; 628 offset: -3 -3;
629 } 629 }
630 color: 0 0 0 0; 630 color: 0 0 0 0;
631 } 631 }
632 description {
633 state: "bigger" 0.0;
634 inherit: "default" 0.0;
635 rel1 {
636 relative: 0.0 0.0;
637 offset: 0 0;
638 }
639 rel2 {
640 relative: 1.0 1.0;
641 offset: -1 -1;
642 }
643 }
644 }
645 part {
646 name: "over";
647 type: RECT;
648 repeat_events: 0;
649 description {
650 state: "default" 0.0;
651 color: 0 0 0 0;
652 }
632 } 653 }
633 } 654 }
634 programs { 655 programs {
635 program { 656 program {
657 name: "hover_in";
658 signal: "mouse,in";
659 source: "over";
660 action: STATE_SET "bigger" 0.0;
661 transition: LINEAR 0.1;
662 target: "item";
663 }
664 program {
665 name: "hover_out";
666 signal: "mouse,out";
667 source: "over";
668 action: STATE_SET "default" 0.0;
669 transition: LINEAR 0.2;
670 target: "item";
671 }
672 program {
636 name: "exec_start"; 673 name: "exec_start";
637 signal: "start"; 674 signal: "start";
638 source: ""; 675 source: "";
@@ -671,12 +708,6 @@ group {
671 mouse_events: 0; 708 mouse_events: 0;
672 description { 709 description {
673 state: "default" 0.0; 710 state: "default" 0.0;
674 rel1 {
675 offset: 4 4;
676 }
677 rel2 {
678 offset: -5 -5;
679 }
680 color: 255 255 255 0; 711 color: 255 255 255 0;
681 } 712 }
682 } 713 }
diff --git a/data/themes/default_pager.edc b/data/themes/default_pager.edc
index 7542ba38b..aa6170830 100644
--- a/data/themes/default_pager.edc
+++ b/data/themes/default_pager.edc
@@ -151,10 +151,64 @@ group {
151 } 151 }
152 } 152 }
153 part { 153 part {
154 name: "pager"; 154 name: "background";
155 mouse_events: 0; 155 mouse_events: 0;
156 description {
157 state: "default" 0.0;
158 rel1 {
159 to: "overlay";
160 }
161 rel2 {
162 to: "overlay";
163 }
164 image {
165 normal: "e17_ibar_bg_h.png";
166 border: 6 6 6 6;
167 }
168 fill {
169 smooth: 0;
170 }
171 }
172 }
173 part {
174 name: "items_clip";
175 type: RECT;
176 mouse_events: 0;
177 description {
178 state: "default" 0.0;
179 rel1 {
180 to: "background";
181 offset: 4 4;
182 }
183 rel2 {
184 to: "background";
185 offset: -5 -5;
186 }
187 color: 255 255 255 255;
188 }
189 }
190 part {
191 name: "pager";
156 type: SWALLOW; 192 type: SWALLOW;
157 description { 193 mouse_events: 0;
194 clip_to: "items_clip";
195 description {
196 state: "default" 0.0;
197 rel1 {
198 to: "overlay";
199 offset: 4 4;
200 }
201 rel2 {
202 to: "overlay";
203 offset: -5 -5;
204 }
205 color: 0 0 0 0;
206 }
207 }
208 part {
209 name: "overlay";
210 mouse_events: 0;
211 description {
158 state: "default" 0.0; 212 state: "default" 0.0;
159 rel1 { 213 rel1 {
160 to_y: "title_overlay"; 214 to_y: "title_overlay";
@@ -165,7 +219,14 @@ group {
165 relative: 1.0 1.0; 219 relative: 1.0 1.0;
166 offset: -17 -17; 220 offset: -17 -17;
167 } 221 }
168 color: 0 0 0 0; 222 image {
223 normal: "e17_ibar_over_h.png";
224 border: 13 13 13 13;
225 middle: 0;
226 }
227 fill {
228 smooth: 0;
229 }
169 } 230 }
170 } 231 }
171 } 232 }
@@ -377,7 +438,8 @@ group {
377 } 438 }
378 part { 439 part {
379 name: "overlay"; 440 name: "overlay";
380 mouse_events: 0; 441 repeat_events: 1;
442// mouse_events: 0;
381 description { 443 description {
382 state: "default" 0.0; 444 state: "default" 0.0;
383 rel1 { 445 rel1 {
diff --git a/data/themes/images/e17_clock_bg.png b/data/themes/images/e17_clock_bg.png
index a1ac3ed76..d766d1327 100644
--- a/data/themes/images/e17_clock_bg.png
+++ b/data/themes/images/e17_clock_bg.png
Binary files differ
diff --git a/data/themes/images/e17_clock_fg.png b/data/themes/images/e17_clock_fg.png
index b48a591a7..9dca2c547 100644
--- a/data/themes/images/e17_clock_fg.png
+++ b/data/themes/images/e17_clock_fg.png
Binary files differ
diff --git a/debian/control b/debian/control
index f5b56689a..9067180f3 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: enlightenment
2Section: x11 2Section: x11
3Priority: optional 3Priority: optional
4Maintainer: E17 Debian Team <debian@edevelop.org> 4Maintainer: E17 Debian Team <debian@edevelop.org>
5Build-Depends: libevas-dev, libecore-dev, libeet-dev, libedje-dev, edje-bin, libembryo-dev, xlibs-dev, automake1.7 | automaken, libtool, debhelper (>= 4.0) 5Build-Depends: libevas-dev, libecore-dev, libeet-dev, libedje-dev, edje-bin, libembryo-dev, libx11-dev, x-dev, libxext-dev, automake1.7 | automaken, libtool, debhelper (>= 4.0)
6Standards-Version: 3.6.2.2 6Standards-Version: 3.6.2.2
7 7
8Package: enlightenment 8Package: enlightenment
@@ -10,24 +10,13 @@ Architecture: any
10Section: x11 10Section: x11
11Recommends: libevas-engine-xrender 11Recommends: libevas-engine-xrender
12Suggests: entrance 12Suggests: entrance
13Depends: ${shlibs:Depends}, libe, enlightenment-data (>= 0.16.999), libevas, libecore, libecore-con, libecore-evas, libecore-file, libecore-ipc, libecore-job, libecore-txt, libecore-x, libeet, libembryo, embryo-bin, edje-bin, libedje, libevas-loader-eet, libevas-loader-jpeg, libevas-loader-png, libevas-saver-eet, libevas-saver-jpeg, libevas-saver-png, libevas-engine-buffer, libevas-engine-software-x11 13Depends: ${shlibs:Depends}, libe, libevas, libecore, libecore-con, libecore-evas, libecore-file, libecore-ipc, libecore-job, libecore-txt, libecore-x, libeet, libembryo, embryo-bin, edje-bin, libedje, libevas-loader-eet, libevas-loader-jpeg, libevas-loader-png, libevas-saver-eet, libevas-saver-jpeg, libevas-saver-png, libevas-engine-buffer, libevas-engine-software-x11
14Description: Enlightenment themes, etc. 14Description: Enlightenment themes, etc.
15 Enlightenment is an advanced window manager for X11. Unique 15 Enlightenment is an advanced window manager for X11. Unique
16 features include: a fully animated background, nice drop shadows 16 features include: a fully animated background, nice drop shadows
17 around windows, backed by an extremely clean and optimized 17 around windows, backed by an extremely clean and optimized
18 foundation of APIs. 18 foundation of APIs.
19 19
20Package: enlightenment-data
21Architecture: any
22Section: x11
23Depends: enlightenment (= ${Source-Version})
24Conflicts: enlightenment-data (< 0.16.999)
25Description: Enlightenment themes, etc.
26 Enlightenment is an advanced window manager for X11. Unique
27 features include: a fully animated background, nice drop shadows
28 around windows, a unique application launcher module (ibar). All
29 backed by an extremely clean and optimized foundation of APIs.
30
31Package: libe 20Package: libe
32Section: libs 21Section: libs
33Architecture: any 22Architecture: any
diff --git a/debian/enlightenment-data.install b/debian/enlightenment-data.install
deleted file mode 100644
index 11e6d0f63..000000000
--- a/debian/enlightenment-data.install
+++ /dev/null
@@ -1,2 +0,0 @@
1debian/tmp/usr/share/enlightenment/data/themes/*.edj
2debian/tmp/usr/share/enlightenment/data/init/*.edj
diff --git a/debian/enlightenment.install b/debian/enlightenment.install
index 3aa7a7e34..d7d8f85fc 100644
--- a/debian/enlightenment.install
+++ b/debian/enlightenment.install
@@ -21,9 +21,5 @@ debian/tmp/usr/lib/enlightenment/modules/start/*.png
21debian/tmp/usr/lib/enlightenment/modules/temperature/*/*.so 21debian/tmp/usr/lib/enlightenment/modules/temperature/*/*.so
22debian/tmp/usr/lib/enlightenment/modules/temperature/*.png 22debian/tmp/usr/lib/enlightenment/modules/temperature/*.png
23debian/tmp/usr/share/enlightenment 23debian/tmp/usr/share/enlightenment
24debian/tmp/usr/share/enlightenment
25debian/tmp/usr/share/enlightenment
26debian/tmp/usr/share/enlightenment
27debian/tmp/usr/share/enlightenment
28debian/tmp/usr/share/locale 24debian/tmp/usr/share/locale
29debian/tmp/usr/share/xsessions 25debian/tmp/usr/share/xsessions
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index 43f089e5f..7ba31277f 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -5727,6 +5727,21 @@ _e_border_eval(E_Border *bd)
5727 changed = 0; 5727 changed = 0;
5728 for (i = 0; i < num; i++) 5728 for (i = 0; i < num; i++)
5729 { 5729 {
5730 if (rects[i].x < 0)
5731 {
5732 rects[i].width -= rects[i].x;
5733 rects[i].x = 0;
5734 }
5735 if ((rects[i].x + rects[i].width) > bd->w)
5736 rects[i].width = rects[i].width - rects[i].x;
5737 if (rects[i].y < 0)
5738 {
5739 rects[i].height -= rects[i].y;
5740 rects[i].y = 0;
5741 }
5742 if ((rects[i].y + rects[i].height) > bd->h)
5743 rects[i].height = rects[i].height - rects[i].y;
5744
5730 if ((orects[i].x != rects[i].x) || 5745 if ((orects[i].x != rects[i].x) ||
5731 (orects[i].y != rects[i].y) || 5746 (orects[i].y != rects[i].y) ||
5732 (orects[i].width != rects[i].width) || 5747 (orects[i].width != rects[i].width) ||
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index ca14885f1..a5f89165c 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -91,6 +91,7 @@ e_config_init(void)
91 E_CONFIG_VAL(D, T, geom.res, INT); 91 E_CONFIG_VAL(D, T, geom.res, INT);
92 E_CONFIG_VAL(D, T, style, STR); 92 E_CONFIG_VAL(D, T, style, STR);
93 E_CONFIG_VAL(D, T, autoscroll, UCHAR); 93 E_CONFIG_VAL(D, T, autoscroll, UCHAR);
94 E_CONFIG_VAL(D, T, resizable, UCHAR);
94 95
95 _e_config_gadcon_edd = E_CONFIG_DD_NEW("E_Config_Gadcon", E_Config_Gadcon); 96 _e_config_gadcon_edd = E_CONFIG_DD_NEW("E_Config_Gadcon", E_Config_Gadcon);
96#undef T 97#undef T
@@ -1016,71 +1017,111 @@ e_config_init(void)
1016 "desk_linear_flip_by", "1"); 1017 "desk_linear_flip_by", "1");
1017 } 1018 }
1018 IFCFGEND; 1019 IFCFGEND;
1019 /* yes - this causes a small leak - i know. it is for testing temporarily x*/ 1020 IFCFG(0x0093); /* the version # where this value(s) was introduced */
1021 /* FIXME: wipe previous shelves and gadcons - remove this eventually */
1020 e_config->shelves = NULL; 1022 e_config->shelves = NULL;
1021 e_config->gadcons = NULL; 1023 e_config->gadcons = NULL;
1022// IFCFG(0x008e); /* the version # where this value(s) was introduced */
1023#if 1 // this is liable to change
1024 { 1024 {
1025 E_Config_Shelf *cf_es; 1025 E_Config_Shelf *cf_es;
1026 1026
1027 cf_es = E_NEW(E_Config_Shelf, 1); 1027#define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size) \
1028 cf_es->name = evas_stringshare_add("shelf"); 1028 cf_es = E_NEW(E_Config_Shelf, 1); \
1029 cf_es->container = 0; 1029 cf_es->name = evas_stringshare_add(_name); \
1030 cf_es->zone = 0; 1030 cf_es->container = _con; \
1031 cf_es->popup = 1; 1031 cf_es->zone = _zone; \
1032 cf_es->layer = 200; 1032 cf_es->popup = _pop; \
1033 cf_es->orient = E_GADCON_ORIENT_TOP; 1033 cf_es->layer = _lay; \
1034 cf_es->fit_along = 1; 1034 cf_es->orient = _orient; \
1035 cf_es->fit_size = 0; 1035 cf_es->fit_along = _fita; \
1036 cf_es->style = evas_stringshare_add("default"); 1036 cf_es->fit_size = _fits; \
1037 cf_es->size = 40; 1037 cf_es->style = evas_stringshare_add(_style); \
1038 e_config->shelves = evas_list_append(e_config->shelves, cf_es); 1038 cf_es->size = _size; \
1039 e_config->shelves = evas_list_append(e_config->shelves, cf_es)
1040 /* shelves for 4 zones on head 0 by default */
1041 CFG_SHELF("shelf", 0, 0,
1042 1, 200, E_GADCON_ORIENT_BOTTOM,
1043 1, 0, "default", 40);
1044 CFG_SHELF("shelf", 0, 1,
1045 1, 200, E_GADCON_ORIENT_BOTTOM,
1046 1, 0, "default", 40);
1047 CFG_SHELF("shelf", 0, 2,
1048 1, 200, E_GADCON_ORIENT_BOTTOM,
1049 1, 0, "default", 40);
1050 CFG_SHELF("shelf", 0, 3,
1051 1, 200, E_GADCON_ORIENT_BOTTOM,
1052 1, 0, "default", 40);
1053 /* shelves for heada 1, 2, and 3 by default */
1054 CFG_SHELF("shelf", 1, 0,
1055 1, 200, E_GADCON_ORIENT_BOTTOM,
1056 1, 0, "default", 40);
1057 CFG_SHELF("shelf", 2, 0,
1058 1, 200, E_GADCON_ORIENT_BOTTOM,
1059 1, 0, "default", 40);
1060 CFG_SHELF("shelf", 3, 0,
1061 1, 200, E_GADCON_ORIENT_BOTTOM,
1062 1, 0, "default", 40);
1039 } 1063 }
1040 { 1064 {
1041 E_Config_Gadcon *cf_gc; 1065 E_Config_Gadcon *cf_gc;
1042 E_Config_Gadcon_Client *cf_gcc; 1066 E_Config_Gadcon_Client *cf_gcc;
1067
1068#define CFG_GADCON(_name, _id) \
1069 cf_gc = E_NEW(E_Config_Gadcon, 1);\
1070 cf_gc->name = evas_stringshare_add(_name); \
1071 cf_gc->id = evas_stringshare_add(_id); \
1072 e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc)
1073#define CFG_GADCON_CLIENT(_name, _id, _res, _size, _pos, _style, _autoscr, _resizable) \
1074 cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); \
1075 cf_gcc->name = evas_stringshare_add(_name); \
1076 cf_gcc->id = evas_stringshare_add(_id); \
1077 cf_gcc->geom.res = _res; \
1078 cf_gcc->geom.size = _size; \
1079 cf_gcc->geom.pos = _pos; \
1080 if (_style) cf_gcc->style = evas_stringshare_add(_style); \
1081 else cf_gcc->style = NULL; \
1082 cf_gcc->autoscroll = _autoscr; \
1083 cf_gcc->resizable = _resizable; \
1084 cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc)
1085
1086 /* the default shelf on the default head/zone */
1087 CFG_GADCON("shelf", "0");
1088 CFG_GADCON_CLIENT("start", "default", 800, 32,
1089 0, NULL, 0, 0);
1090 CFG_GADCON_CLIENT("pager", "default", 800, 120,
1091 32, "inset", 0, 0);
1092 CFG_GADCON_CLIENT("ibar", "default", 800, 200,
1093 400 - (16 / 2), "inset", 1, 0);
1094 CFG_GADCON_CLIENT("temperature", "default", 800, 32,
1095 800 - (4 * 32), NULL, 0, 0);
1096 CFG_GADCON_CLIENT("cpufreq", "default", 800, 32,
1097 800 - (3 * 32), NULL, 0, 0);
1098 CFG_GADCON_CLIENT("battery", "default", 800, 32,
1099 800 - (2 * 32), NULL, 0, 0);
1100 CFG_GADCON_CLIENT("clock", "default", 800, 32,
1101 800 - (1 * 32), NULL, 0, 0);
1102 /* additional shelves for up to 3 more heads by default */
1103 CFG_GADCON("shelf", "1");
1104 CFG_GADCON_CLIENT("pager", "default2", 800, 120,
1105 0, "inset", 0, 0);
1106 CFG_GADCON_CLIENT("ibar", "default2", 800, 16,
1107 400 - (16 / 2), "inset", 1, 0);
1043 1108
1044 cf_gc = E_NEW(E_Config_Gadcon, 1); 1109 CFG_GADCON("shelf", "2");
1045 cf_gc->name = evas_stringshare_add("shelf"); 1110 CFG_GADCON_CLIENT("pager", "default3", 800, 120,
1046 cf_gc->id = evas_stringshare_add("0"); 1111 0, "inset", 0, 0);
1047 e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc); 1112 CFG_GADCON_CLIENT("ibar", "default2", 800, 16,
1048 1113 400 - (16 / 2), "inset", 1, 0);
1049 cf_gcc = E_NEW(E_Config_Gadcon_Client, 1);
1050 cf_gcc->name = evas_stringshare_add("ibar");
1051 cf_gcc->id = evas_stringshare_add("default");
1052 cf_gcc->geom.res = 800;
1053 cf_gcc->geom.size = 200;
1054 cf_gcc->geom.pos = 400 - (cf_gcc->geom.size / 2);
1055 cf_gcc->style = evas_stringshare_add("inset");
1056 cf_gcc->autoscroll = 0;
1057 cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
1058
1059 cf_gcc = E_NEW(E_Config_Gadcon_Client, 1);
1060 cf_gcc->name = evas_stringshare_add("clock");
1061 cf_gcc->id = evas_stringshare_add("default");
1062 cf_gcc->geom.res = 800;
1063 cf_gcc->geom.size = 32;
1064 cf_gcc->geom.pos = 800 - (cf_gcc->geom.size);
1065 cf_gcc->style = NULL;
1066 cf_gcc->autoscroll = 0;
1067 cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
1068 1114
1069 cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); 1115 CFG_GADCON("shelf", "3");
1070 cf_gcc->name = evas_stringshare_add("start"); 1116 CFG_GADCON_CLIENT("pager", "default4", 800, 120,
1071 cf_gcc->id = evas_stringshare_add("default"); 1117 0, "inset", 0, 0);
1072 cf_gcc->geom.res = 800; 1118 CFG_GADCON_CLIENT("ibar", "default2", 800, 16,
1073 cf_gcc->geom.size = 32; 1119 400 - (16 / 2), "inset", 1, 0);
1074 cf_gcc->geom.pos = 0;
1075 cf_gcc->style = NULL;
1076 cf_gcc->autoscroll = 0;
1077 cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
1078 } 1120 }
1079#endif 1121 IFCFGEND;
1080// IFCFGEND;
1081 1122
1082#if 0 /* example of new config */ 1123#if 0 /* example of new config */
1083 IFCFG(0x008e); /* the version # where this value(s) was introduced */ 1124 IFCFG(0x0090); /* the version # where this value(s) was introduced */
1084 e_config->new_value = 10; /* set the value(s) */ 1125 e_config->new_value = 10; /* set the value(s) */
1085 IFCFGEND; 1126 IFCFGEND;
1086#endif 1127#endif
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index 1d6c10e15..0ea1cea3c 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -50,7 +50,7 @@ typedef Eet_Data_Descriptor E_Config_DD;
50/* increment this whenever a new set of configvalues are added but the users 50/* increment this whenever a new set of configvalues are added but the users
51 * config doesn't need top be wiped - simply new values need to be put in 51 * config doesn't need top be wiped - simply new values need to be put in
52 */ 52 */
53#define E_CONFIG_FILE_GENERATION 0x008e 53#define E_CONFIG_FILE_GENERATION 0x0093
54#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION) 54#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
55 55
56#define E_EVAS_ENGINE_DEFAULT 0 56#define E_EVAS_ENGINE_DEFAULT 0
@@ -317,6 +317,7 @@ struct _E_Config_Gadcon_Client
317 } geom; 317 } geom;
318 const char *style; 318 const char *style;
319 unsigned char autoscroll; 319 unsigned char autoscroll;
320 unsigned char resizable;
320}; 321};
321 322
322struct _E_Config_Shelf 323struct _E_Config_Shelf
diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index d6afa1ac9..30b09c78c 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -3,6 +3,11 @@
3 */ 3 */
4#include "e.h" 4#include "e.h"
5 5
6/* FIXME: broken when drop areas intersect
7 * (sub window has drop area on top of lower window or desktop -
8 * also shutdown is broken (walking list and deleting from the list as u go
9 * in this code is broken)
10 */
6/* 11/*
7 * TODO: 12 * TODO:
8 * - Let an internal drag work with several types. 13 * - Let an internal drag work with several types.
diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c
index e8f1c9946..776c1190c 100644
--- a/src/bin/e_gadcon.c
+++ b/src/bin/e_gadcon.c
@@ -6,8 +6,14 @@
6static void _e_gadcon_free(E_Gadcon *gc); 6static void _e_gadcon_free(E_Gadcon *gc);
7static void _e_gadcon_client_free(E_Gadcon_Client *gcc); 7static void _e_gadcon_client_free(E_Gadcon_Client *gcc);
8 8
9static void _e_gadcon_movereisze_handle(E_Gadcon_Client *gcc);
10static int _e_gadcon_cb_client_scroll_timer(void *data);
11static int _e_gadcon_cb_client_scroll_animator(void *data);
12static void _e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
13static void _e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info);
9static void _e_gadcon_client_save(E_Gadcon_Client *gcc); 14static void _e_gadcon_client_save(E_Gadcon_Client *gcc);
10 15
16static void _e_gadcon_cb_min_size_request(void *data, Evas_Object *obj, void *event_info);
11static void _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info); 17static void _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info);
12static void _e_gadcon_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); 18static void _e_gadcon_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
13static void _e_gadcon_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info); 19static void _e_gadcon_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info);
@@ -25,12 +31,6 @@ static void _e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj, con
25static void _e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source); 31static void _e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source);
26static void _e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source); 32static void _e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
27static void _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source); 33static void _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source);
28static void _e_gadcon_cb_signal_resize_up_start(void *data, Evas_Object *obj, const char *emission, const char *source);
29static void _e_gadcon_cb_signal_resize_up_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
30static void _e_gadcon_cb_signal_resize_up_go(void *data, Evas_Object *obj, const char *emission, const char *source);
31static void _e_gadcon_cb_signal_resize_down_start(void *data, Evas_Object *obj, const char *emission, const char *source);
32static void _e_gadcon_cb_signal_resize_down_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
33static void _e_gadcon_cb_signal_resize_down_go(void *data, Evas_Object *obj, const char *emission, const char *source);
34 34
35static Evas_Object *e_gadcon_layout_add(Evas *evas); 35static Evas_Object *e_gadcon_layout_add(Evas *evas);
36static void e_gadcon_layout_orientation_set(Evas_Object *obj, int horizontal); 36static void e_gadcon_layout_orientation_set(Evas_Object *obj, int horizontal);
@@ -50,69 +50,11 @@ static void e_gadcon_layout_unpack(Evas_Object *obj);
50 50
51static Evas_Hash *providers = NULL; 51static Evas_Hash *providers = NULL;
52static Evas_List *gadcons = NULL; 52static Evas_List *gadcons = NULL;
53
54static E_Gadcon_Client *
55__test(E_Gadcon *gc, char *name, char *id, char *style)
56{
57 Evas_Object *o;
58 E_Gadcon_Client *gcc;
59
60 printf("create gadcon client \"%s\" \"%s\" \"%s\" for \"%s\" \"%s\"\n",
61 name, id, style,
62 gc->name, gc->id);
63 o = evas_object_rectangle_add(gc->evas);
64 evas_object_color_set(o, rand() & 0xff, rand() & 0xff, rand() & 0xff, 150);
65 gcc = e_gadcon_client_new(gc, name, id, style, o);
66 gcc->data = NULL; // this is where a module would hook private data
67 return gcc;
68}
69
70static void
71__test2(E_Gadcon_Client *gcc)
72{
73 evas_object_del(gcc->o_base);
74}
75
76static void
77__test3(E_Gadcon_Client *gcc)
78{
79 e_gadcon_client_min_size_set(gcc, 200, 20);
80}
81
82static void
83__test4(E_Gadcon_Client *gcc)
84{
85 e_gadcon_client_min_size_set(gcc, 32, 20);
86}
87 53
88/* externally accessible functions */ 54/* externally accessible functions */
89EAPI int 55EAPI int
90e_gadcon_init(void) 56e_gadcon_init(void)
91{ 57{
92 /* FIXME: these would be provided by modules registering gadget creation
93 * classes */
94 {
95 static E_Gadcon_Client_Class cc =
96 {
97 GADCON_CLIENT_CLASS_VERSION,
98 "ibar",
99 {
100 __test, __test2, __test3
101 }
102 };
103 e_gadcon_provider_register(&cc);
104 }
105 {
106 static E_Gadcon_Client_Class cc =
107 {
108 GADCON_CLIENT_CLASS_VERSION,
109 "clock",
110 {
111 __test, __test2, __test4
112 }
113 };
114 e_gadcon_provider_register(&cc);
115 }
116 return 1; 58 return 1;
117} 59}
118 60
@@ -125,12 +67,40 @@ e_gadcon_shutdown(void)
125EAPI void 67EAPI void
126e_gadcon_provider_register(E_Gadcon_Client_Class *cc) 68e_gadcon_provider_register(E_Gadcon_Client_Class *cc)
127{ 69{
70 Evas_List *l;
71 E_Gadcon *gc;
72
128 providers = evas_hash_direct_add(providers, cc->name, cc); 73 providers = evas_hash_direct_add(providers, cc->name, cc);
74 for (l = gadcons; l; l = l->next)
75 {
76 gc = l->data;
77 e_gadcon_populate_class(gc, cc);
78 }
129} 79}
130 80
131EAPI void 81EAPI void
132e_gadcon_provider_unregister(E_Gadcon_Client_Class *cc) 82e_gadcon_provider_unregister(E_Gadcon_Client_Class *cc)
133{ 83{
84 Evas_List *l, *ll, *dlist = NULL;
85 E_Gadcon *gc;
86 E_Gadcon_Client *gcc;
87
88 for (l = gadcons; l; l = l->next)
89 {
90 gc = l->data;
91 for (ll = gc->clients; ll; ll = ll->next)
92 {
93 gcc = ll->data;
94 if (gcc->client_class == cc)
95 dlist = evas_list_append(dlist, gcc);
96 }
97 }
98 while (dlist)
99 {
100 gcc = dlist->data;
101 dlist = evas_list_remove_list(dlist, dlist);
102 e_object_del(E_OBJECT(gcc));
103 }
134 providers = evas_hash_del(providers, cc->name, cc); 104 providers = evas_hash_del(providers, cc->name, cc);
135} 105}
136 106
@@ -154,6 +124,8 @@ e_gadcon_swallowed_new(const char *name, char *id, Evas_Object *obj, char *swall
154 gc->o_container = e_gadcon_layout_add(gc->evas); 124 gc->o_container = e_gadcon_layout_add(gc->evas);
155 evas_object_smart_callback_add(gc->o_container, "size_request", 125 evas_object_smart_callback_add(gc->o_container, "size_request",
156 _e_gadcon_cb_size_request, gc); 126 _e_gadcon_cb_size_request, gc);
127 evas_object_smart_callback_add(gc->o_container, "min_size_request",
128 _e_gadcon_cb_min_size_request, gc);
157 evas_object_show(gc->o_container); 129 evas_object_show(gc->o_container);
158 edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name, 130 edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name,
159 gc->o_container); 131 gc->o_container);
@@ -173,6 +145,16 @@ e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
173} 145}
174 146
175EAPI void 147EAPI void
148e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data)
149{
150 E_OBJECT_CHECK(gc);
151 E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
152
153 gc->min_size_request.func = func;
154 gc->min_size_request.data = data;
155}
156
157EAPI void
176e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data) 158e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data)
177{ 159{
178 E_OBJECT_CHECK(gc); 160 E_OBJECT_CHECK(gc);
@@ -242,7 +224,7 @@ e_gadcon_populate(E_Gadcon *gc)
242 cf_gcc->style); 224 cf_gcc->style);
243 if (gcc) 225 if (gcc)
244 { 226 {
245 gcc->client_class = *cc; 227 gcc->client_class = cc;
246 gcc->config.pos = cf_gcc->geom.pos; 228 gcc->config.pos = cf_gcc->geom.pos;
247 gcc->config.size = cf_gcc->geom.size; 229 gcc->config.size = cf_gcc->geom.size;
248 gcc->config.res = cf_gcc->geom.res; 230 gcc->config.res = cf_gcc->geom.res;
@@ -256,8 +238,76 @@ e_gadcon_populate(E_Gadcon *gc)
256 gcc->config.pos, 238 gcc->config.pos,
257 gcc->config.size, 239 gcc->config.size,
258 gcc->config.res); 240 gcc->config.res);
259 if (gcc->client_class.func.orient) 241 e_gadcon_client_autoscroll_set(gcc, cf_gcc->autoscroll);
260 gcc->client_class.func.orient(gcc); 242 e_gadcon_client_resizable_set(gcc, cf_gcc->resizable);
243 if (gcc->client_class->func.orient)
244 gcc->client_class->func.orient(gcc);
245 }
246 }
247 }
248 }
249 e_gadcon_layout_thaw(gc->o_container);
250}
251
252EAPI void
253e_gadcon_unpopulate(E_Gadcon *gc)
254{
255 E_OBJECT_CHECK(gc);
256 E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
257 while (gc->clients) e_object_del(E_OBJECT(gc->clients->data));
258}
259
260EAPI void
261e_gadcon_populate_class(E_Gadcon *gc, E_Gadcon_Client_Class *cc)
262{
263 Evas_List *l;
264 int ok;
265 E_Config_Gadcon *cf_gc;
266 E_Config_Gadcon_Client *cf_gcc;
267
268 E_OBJECT_CHECK(gc);
269 E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
270 ok = 0;
271 e_gadcon_layout_freeze(gc->o_container);
272 for (l = e_config->gadcons; l; l = l->next)
273 {
274 cf_gc = l->data;
275 if ((!strcmp(cf_gc->name, gc->name)) &&
276 (!strcmp(cf_gc->id, gc->id)))
277 {
278 ok = 1;
279 break;
280 }
281 }
282 if (ok)
283 {
284 for (l = cf_gc->clients; l; l = l->next)
285 {
286 cf_gcc = l->data;
287 if (!strcmp(cf_gcc->name, cc->name))
288 {
289 E_Gadcon_Client *gcc;
290
291 gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id,
292 cf_gcc->style);
293 if (gcc)
294 {
295 gcc->client_class = cc;
296 gcc->config.pos = cf_gcc->geom.pos;
297 gcc->config.size = cf_gcc->geom.size;
298 gcc->config.res = cf_gcc->geom.res;
299 if (gcc->o_frame)
300 e_gadcon_layout_pack_options_set(gcc->o_frame,
301 gcc->config.pos,
302 gcc->config.size,
303 gcc->config.res);
304 else
305 e_gadcon_layout_pack_options_set(gcc->o_base,
306 gcc->config.pos,
307 gcc->config.size,
308 gcc->config.res);
309 if (gcc->client_class->func.orient)
310 gcc->client_class->func.orient(gcc);
261 } 311 }
262 } 312 }
263 } 313 }
@@ -280,8 +330,32 @@ e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient)
280 E_Gadcon_Client *gcc; 330 E_Gadcon_Client *gcc;
281 331
282 gcc = l->data; 332 gcc = l->data;
283 if (gcc->client_class.func.orient) 333 if (gcc->client_class->func.orient)
284 gcc->client_class.func.orient(gcc); 334 gcc->client_class->func.orient(gcc);
335 switch (gcc->gadcon->orient)
336 {
337 case E_GADCON_ORIENT_FLOAT:
338 case E_GADCON_ORIENT_HORIZ:
339 case E_GADCON_ORIENT_TOP:
340 case E_GADCON_ORIENT_BOTTOM:
341 case E_GADCON_ORIENT_CORNER_TL:
342 case E_GADCON_ORIENT_CORNER_TR:
343 case E_GADCON_ORIENT_CORNER_BL:
344 case E_GADCON_ORIENT_CORNER_BR:
345 e_box_orientation_set(gcc->o_box, 1);
346 break;
347 case E_GADCON_ORIENT_VERT:
348 case E_GADCON_ORIENT_LEFT:
349 case E_GADCON_ORIENT_RIGHT:
350 case E_GADCON_ORIENT_CORNER_LT:
351 case E_GADCON_ORIENT_CORNER_RT:
352 case E_GADCON_ORIENT_CORNER_LB:
353 case E_GADCON_ORIENT_CORNER_RB:
354 e_box_orientation_set(gcc->o_box, 0);
355 break;
356 default:
357 break;
358 }
285 } 359 }
286 e_gadcon_layout_thaw(gc->o_container); 360 e_gadcon_layout_thaw(gc->o_container);
287} 361}
@@ -409,9 +483,50 @@ e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, char *style, Evas_Object
409 style); 483 style);
410 if (gcc->o_frame) 484 if (gcc->o_frame)
411 { 485 {
486 gcc->inset = 1;
412 edje_object_size_min_calc(gcc->o_frame, 487 edje_object_size_min_calc(gcc->o_frame,
413 &(gcc->pad.w), &(gcc->pad.h)); 488 &(gcc->pad.w), &(gcc->pad.h));
414 edje_object_part_swallow(gcc->o_frame, "items", gcc->o_base); 489 gcc->o_box = e_box_add(gcc->gadcon->evas);
490 switch (gcc->gadcon->orient)
491 {
492 case E_GADCON_ORIENT_FLOAT:
493 case E_GADCON_ORIENT_HORIZ:
494 case E_GADCON_ORIENT_TOP:
495 case E_GADCON_ORIENT_BOTTOM:
496 case E_GADCON_ORIENT_CORNER_TL:
497 case E_GADCON_ORIENT_CORNER_TR:
498 case E_GADCON_ORIENT_CORNER_BL:
499 case E_GADCON_ORIENT_CORNER_BR:
500 e_box_orientation_set(gcc->o_box, 1);
501 break;
502 case E_GADCON_ORIENT_VERT:
503 case E_GADCON_ORIENT_LEFT:
504 case E_GADCON_ORIENT_RIGHT:
505 case E_GADCON_ORIENT_CORNER_LT:
506 case E_GADCON_ORIENT_CORNER_RT:
507 case E_GADCON_ORIENT_CORNER_LB:
508 case E_GADCON_ORIENT_CORNER_RB:
509 e_box_orientation_set(gcc->o_box, 0);
510 break;
511 default:
512 break;
513 }
514 evas_object_event_callback_add(gcc->o_box, EVAS_CALLBACK_MOVE,
515 _e_gadcon_cb_client_frame_moveresize, gcc);
516 evas_object_event_callback_add(gcc->o_box, EVAS_CALLBACK_RESIZE,
517 _e_gadcon_cb_client_frame_moveresize, gcc);
518 evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_MOVE,
519 _e_gadcon_cb_client_frame_mouse_move, gcc);
520 e_box_pack_end(gcc->o_box, gcc->o_base);
521 e_box_pack_options_set(gcc->o_base,
522 1, 1, /* fill */
523 1, 1, /* expand */
524 0.5, 0.5, /* align */
525 0, 0, /* min */
526 -1, -1 /* max */
527 );
528 edje_object_part_swallow(gcc->o_frame, "items", gcc->o_box);
529 evas_object_show(gcc->o_box);
415 evas_object_show(gcc->o_frame); 530 evas_object_show(gcc->o_frame);
416 } 531 }
417 } 532 }
@@ -444,8 +559,18 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc)
444 e_theme_edje_object_set(gcc->o_control, "base/theme/gadman", 559 e_theme_edje_object_set(gcc->o_control, "base/theme/gadman",
445 "gadman/control"); 560 "gadman/control");
446 561
447 edje_object_signal_emit(gcc->o_control, "hsize", "off"); 562 if ((gcc->autoscroll) || (gcc->resizable))
448 edje_object_signal_emit(gcc->o_control, "vsize", "off"); 563 {
564 if (e_box_orientation_get(gcc->o_box))
565 edje_object_signal_emit(gcc->o_control, "hsize", "on");
566 else
567 edje_object_signal_emit(gcc->o_control, "vsize", "on");
568 }
569 else
570 {
571 edje_object_signal_emit(gcc->o_control, "hsize", "off");
572 edje_object_signal_emit(gcc->o_control, "vsize", "off");
573 }
449 edje_object_signal_emit(gcc->o_control, "move", "on"); 574 edje_object_signal_emit(gcc->o_control, "move", "on");
450 575
451 gcc->o_event = evas_object_rectangle_add(gcc->gadcon->evas); 576 gcc->o_event = evas_object_rectangle_add(gcc->gadcon->evas);
@@ -474,17 +599,17 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc)
474 edje_object_signal_callback_add(gcc->o_control, "resize_go", "right", 599 edje_object_signal_callback_add(gcc->o_control, "resize_go", "right",
475 _e_gadcon_cb_signal_resize_right_go, gcc); 600 _e_gadcon_cb_signal_resize_right_go, gcc);
476 edje_object_signal_callback_add(gcc->o_control, "resize_start", "up", 601 edje_object_signal_callback_add(gcc->o_control, "resize_start", "up",
477 _e_gadcon_cb_signal_resize_up_start, gcc); 602 _e_gadcon_cb_signal_resize_left_start, gcc);
478 edje_object_signal_callback_add(gcc->o_control, "resize_stop", "up", 603 edje_object_signal_callback_add(gcc->o_control, "resize_stop", "up",
479 _e_gadcon_cb_signal_resize_up_stop, gcc); 604 _e_gadcon_cb_signal_resize_left_stop, gcc);
480 edje_object_signal_callback_add(gcc->o_control, "resize_go", "up", 605 edje_object_signal_callback_add(gcc->o_control, "resize_go", "up",
481 _e_gadcon_cb_signal_resize_up_go, gcc); 606 _e_gadcon_cb_signal_resize_left_go, gcc);
482 edje_object_signal_callback_add(gcc->o_control, "resize_start", "down", 607 edje_object_signal_callback_add(gcc->o_control, "resize_start", "down",
483 _e_gadcon_cb_signal_resize_down_start, gcc); 608 _e_gadcon_cb_signal_resize_right_start, gcc);
484 edje_object_signal_callback_add(gcc->o_control, "resize_stop", "down", 609 edje_object_signal_callback_add(gcc->o_control, "resize_stop", "down",
485 _e_gadcon_cb_signal_resize_down_stop, gcc); 610 _e_gadcon_cb_signal_resize_right_stop, gcc);
486 edje_object_signal_callback_add(gcc->o_control, "resize_go", "down", 611 edje_object_signal_callback_add(gcc->o_control, "resize_go", "down",
487 _e_gadcon_cb_signal_resize_down_go, gcc); 612 _e_gadcon_cb_signal_resize_right_go, gcc);
488 613
489 evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_cb_mouse_down, gcc); 614 evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_cb_mouse_down, gcc);
490 evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_UP, _e_gadcon_cb_mouse_up, gcc); 615 evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_UP, _e_gadcon_cb_mouse_up, gcc);
@@ -576,10 +701,16 @@ e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h)
576{ 701{
577 E_OBJECT_CHECK(gcc); 702 E_OBJECT_CHECK(gcc);
578 E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); 703 E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
579 if (gcc->o_frame) 704 gcc->min.w = w;
580 e_gadcon_layout_pack_min_size_set(gcc->o_frame, w + gcc->pad.w, h + gcc->pad.h); 705 gcc->min.h = h;
581 else 706 if ((!gcc->autoscroll) && (!gcc->resizable))
582 e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h); 707 {
708 if (gcc->o_frame)
709 e_gadcon_layout_pack_min_size_set(gcc->o_frame, w + gcc->pad.w, h + gcc->pad.h);
710 else
711 e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h);
712 }
713 _e_gadcon_movereisze_handle(gcc);
583} 714}
584 715
585EAPI void 716EAPI void
@@ -587,19 +718,228 @@ e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h)
587{ 718{
588 E_OBJECT_CHECK(gcc); 719 E_OBJECT_CHECK(gcc);
589 E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); 720 E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
590 if (gcc->o_frame) 721 gcc->aspect.w = w;
722 gcc->aspect.h = h;
723 if ((!gcc->autoscroll) && (!gcc->resizable))
724 {
725 if (gcc->o_frame)
726 {
727 e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h);
728 e_gadcon_layout_pack_aspect_set(gcc->o_frame, w, h);
729 }
730 else
731 e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h);
732 }
733 _e_gadcon_movereisze_handle(gcc);
734}
735
736EAPI void
737e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll)
738{
739 E_OBJECT_CHECK(gcc);
740 E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
741
742 gcc->autoscroll = autoscroll;
743 if (gcc->autoscroll)
744 {
745 if (gcc->o_frame)
746 {
747 e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h);
748 e_gadcon_layout_pack_aspect_set(gcc->o_frame, 0, 0);
749 e_gadcon_layout_pack_min_size_set(gcc->o_frame, 0, 0);
750 }
751 else
752 {
753 e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0);
754 e_gadcon_layout_pack_aspect_set(gcc->o_base, 0, 0);
755 }
756 }
757 else
758 {
759 if (gcc->o_frame)
760 {
761 e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h);
762 e_gadcon_layout_pack_aspect_set(gcc->o_frame, gcc->aspect.w, gcc->aspect.h);
763 e_gadcon_layout_pack_min_size_set(gcc->o_frame, gcc->min.w, gcc->min.h);
764 }
765 else
766 {
767 e_gadcon_layout_pack_min_size_set(gcc->o_base, gcc->min.w, gcc->min.h);
768 e_gadcon_layout_pack_aspect_set(gcc->o_base, gcc->aspect.w, gcc->aspect.h);
769 }
770 }
771}
772
773EAPI void
774e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable)
775{
776 E_OBJECT_CHECK(gcc);
777 E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
778
779 gcc->resizable = resizable;
780 if (gcc->resizable)
591 { 781 {
592 e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); 782 if (gcc->o_frame)
593 e_gadcon_layout_pack_aspect_set(gcc->o_frame, w, h); 783 {
784 e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h);
785 e_gadcon_layout_pack_aspect_set(gcc->o_frame, 0, 0);
786 e_gadcon_layout_pack_min_size_set(gcc->o_frame, 0, 0);
787 }
788 else
789 {
790 e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0);
791 e_gadcon_layout_pack_aspect_set(gcc->o_base, 0, 0);
792 }
594 } 793 }
595 else 794 else
596 e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h); 795 {
796 if (gcc->o_frame)
797 {
798 e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h);
799 e_gadcon_layout_pack_aspect_set(gcc->o_frame, gcc->aspect.w, gcc->aspect.h);
800 e_gadcon_layout_pack_min_size_set(gcc->o_frame, gcc->min.w, gcc->min.h);
801 }
802 else
803 {
804 e_gadcon_layout_pack_min_size_set(gcc->o_base, gcc->min.w, gcc->min.h);
805 e_gadcon_layout_pack_aspect_set(gcc->o_base, gcc->aspect.w, gcc->aspect.h);
806 }
807 }
808}
809
810static void
811_e_gadcon_client_cb_menu_inset(void *data, E_Menu *m, E_Menu_Item *mi)
812{
813 E_Gadcon_Client *gcc;
814 E_Gadcon *gc;
815
816 gcc = data;
817 gc = gcc->gadcon;
818 if (gcc->inset) gcc->inset = 0;
819 else gcc->inset = 1;
820 _e_gadcon_client_save(gcc);
821 e_gadcon_unpopulate(gc);
822 e_gadcon_populate(gc);
823}
824
825static void
826_e_gadcon_client_cb_menu_autoscroll(void *data, E_Menu *m, E_Menu_Item *mi)
827{
828 E_Gadcon_Client *gcc;
829 E_Gadcon *gc;
830
831 gcc = data;
832 gc = gcc->gadcon;
833 if (gcc->autoscroll) gcc->autoscroll = 0;
834 else gcc->autoscroll = 1;
835 _e_gadcon_client_save(gcc);
836 e_gadcon_unpopulate(gc);
837 e_gadcon_populate(gc);
838}
839
840static void
841_e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m, E_Menu_Item *mi)
842{
843 E_Gadcon_Client *gcc;
844 E_Gadcon *gc;
845
846 gcc = data;
847 gc = gcc->gadcon;
848 if (gcc->resizable) gcc->resizable = 0;
849 else gcc->resizable = 1;
850 _e_gadcon_client_save(gcc);
851 e_gadcon_unpopulate(gc);
852 e_gadcon_populate(gc);
853}
854
855EAPI void
856e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags)
857{
858 E_Menu_Item *mi;
859
860 E_OBJECT_CHECK(gcc);
861 E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
862
863 mi = e_menu_item_new(menu);
864 e_menu_item_label_set(mi, _("Inset appearance"));
865 e_util_menu_item_edje_icon_set(mi, "enlightenment/inset");
866 e_menu_item_check_set(mi, 1);
867 if (gcc->o_frame) e_menu_item_toggle_set(mi, 1);
868 e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_inset, gcc);
869
870 mi = e_menu_item_new(menu);
871 e_menu_item_label_set(mi, _("Automatically scroll contents"));
872 e_util_menu_item_edje_icon_set(mi, "enlightenment/autoscroll");
873 e_menu_item_check_set(mi, 1);
874 if (gcc->autoscroll) e_menu_item_toggle_set(mi, 1);
875 e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_autoscroll, gcc);
876
877 mi = e_menu_item_new(menu);
878 e_menu_item_label_set(mi, _("Able to be resized"));
879 e_util_menu_item_edje_icon_set(mi, "enlightenment/resizable");
880 e_menu_item_check_set(mi, 1);
881 if (gcc->resizable) e_menu_item_toggle_set(mi, 1);
882 e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_resizable, gcc);
883}
884
885static void
886_e_gadcon_client_cb_menu_post(void *data, E_Menu *m)
887{
888 E_Gadcon_Client *gcc;
889
890 gcc = data;
891 if (!gcc->menu) return;
892 e_object_del(E_OBJECT(gcc->menu));
893 gcc->menu = NULL;
894}
895
896static void
897_e_gadcon_client_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
898{
899 Evas_Event_Mouse_Down *ev;
900 E_Gadcon_Client *gcc;
901
902 ev = event_info;
903 gcc = data;
904 if (gcc->menu) return;
905 if (ev->button == 3)
906 {
907 E_Menu *mn;
908 int cx, cy, cw, ch;
909
910 mn = e_menu_new();
911 e_menu_post_deactivate_callback_set(mn, _e_gadcon_client_cb_menu_post,
912 gcc);
913 gcc->menu = mn;
914
915 e_gadcon_client_util_menu_items_append(gcc, mn, 0);
916
917 e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, &cw, &ch);
918 e_menu_activate_mouse(mn,
919 e_util_zone_current_get(e_manager_current_get()),
920 cx + ev->output.x, cy + ev->output.y, 1, 1,
921 E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
922 evas_event_feed_mouse_up(gcc->gadcon->evas, ev->button,
923 EVAS_BUTTON_NONE, ev->timestamp, NULL);
924 }
925}
926
927EAPI void
928e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc)
929{
930 E_OBJECT_CHECK(gcc);
931 E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
932 if (gcc->o_frame)
933 evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_client_cb_mouse_down, gcc);
934 else
935 evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_client_cb_mouse_down, gcc);
597} 936}
598 937
599/* local subsystem functions */ 938/* local subsystem functions */
600static void 939static void
601_e_gadcon_free(E_Gadcon *gc) 940_e_gadcon_free(E_Gadcon *gc)
602{ 941{
942 e_gadcon_unpopulate(gc);
603 gadcons = evas_list_remove(gadcons, gc); 943 gadcons = evas_list_remove(gadcons, gc);
604 if (gc->o_container) evas_object_del(gc->o_container); 944 if (gc->o_container) evas_object_del(gc->o_container);
605 evas_stringshare_del(gc->name); 945 evas_stringshare_del(gc->name);
@@ -611,15 +951,139 @@ _e_gadcon_free(E_Gadcon *gc)
611static void 951static void
612_e_gadcon_client_free(E_Gadcon_Client *gcc) 952_e_gadcon_client_free(E_Gadcon_Client *gcc)
613{ 953{
954 if (gcc->menu)
955 {
956 e_object_del(E_OBJECT(gcc->menu));
957 gcc->menu = NULL;
958 }
614 e_gadcon_client_edit_end(gcc); 959 e_gadcon_client_edit_end(gcc);
960 gcc->client_class->func.shutdown(gcc);
615 gcc->gadcon->clients = evas_list_remove(gcc->gadcon->clients, gcc); 961 gcc->gadcon->clients = evas_list_remove(gcc->gadcon->clients, gcc);
962 if (gcc->o_box) evas_object_del(gcc->o_box);
616 if (gcc->o_frame) evas_object_del(gcc->o_frame); 963 if (gcc->o_frame) evas_object_del(gcc->o_frame);
617 evas_stringshare_del(gcc->name); 964 evas_stringshare_del(gcc->name);
618 evas_stringshare_del(gcc->id); 965 evas_stringshare_del(gcc->id);
966 if (gcc->scroll_timer) ecore_timer_del(gcc->scroll_timer);
967 if (gcc->scroll_animator) ecore_animator_del(gcc->scroll_animator);
619 free(gcc); 968 free(gcc);
620} 969}
621 970
622static void 971static void
972_e_gadcon_movereisze_handle(E_Gadcon_Client *gcc)
973{
974 Evas_Coord x, y, w, h;
975
976 evas_object_geometry_get(gcc->o_box, &x, &y, &w, &h);
977 if ((gcc->autoscroll) || (gcc->resizable))
978 {
979 if (e_box_orientation_get(gcc->o_box))
980 {
981 if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0))
982 w = (h * gcc->aspect.w) / gcc->aspect.h;
983 else
984 w = gcc->min.w;
985 }
986 else
987 {
988 if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0))
989 h = (w * gcc->aspect.h) / gcc->aspect.w;
990 else
991 h = gcc->min.h;
992 }
993 }
994 e_box_pack_options_set(gcc->o_base,
995 1, 1, /* fill */
996 1, 1, /* expand */
997 0.5, 0.5, /* align */
998 w, h, /* min */
999 w, h /* max */
1000 );
1001}
1002
1003static int
1004_e_gadcon_cb_client_scroll_timer(void *data)
1005{
1006 E_Gadcon_Client *gcc;
1007 double d, v;
1008
1009 gcc = data;
1010 d = gcc->scroll_wanted - gcc->scroll_pos;
1011 if (d < 0) d = -d;
1012 if (d < 0.001)
1013 {
1014 gcc->scroll_pos = gcc->scroll_wanted;
1015 gcc->scroll_timer = NULL;
1016 return 0;
1017 }
1018 v = 0.05;
1019 gcc->scroll_pos = (gcc->scroll_pos * (1.0 - v)) + (gcc->scroll_wanted * v);
1020 return 1;
1021}
1022
1023static int
1024_e_gadcon_cb_client_scroll_animator(void *data)
1025{
1026 E_Gadcon_Client *gcc;
1027
1028 gcc = data;
1029 if (e_box_orientation_get(gcc->o_box))
1030 e_box_align_set(gcc->o_box, 1.0 - gcc->scroll_pos, 0.5);
1031 else
1032 e_box_align_set(gcc->o_box, 0.5, 1.0 - gcc->scroll_pos);
1033 if (!gcc->scroll_timer)
1034 {
1035 gcc->scroll_animator = NULL;
1036 return 0;
1037 }
1038 return 1;
1039}
1040
1041static void
1042_e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
1043{
1044 Evas_Event_Mouse_Move *ev;
1045 E_Gadcon_Client *gcc;
1046 Evas_Coord x, y, w, h;
1047
1048 ev = event_info;
1049 gcc = data;
1050 if (gcc->autoscroll)
1051 {
1052 double d;
1053
1054 evas_object_geometry_get(gcc->o_box, &x, &y, &w, &h);
1055 x = ev->cur.output.x - x;
1056 y = ev->cur.output.y - y;
1057 if (e_box_orientation_get(gcc->o_box))
1058 {
1059 if (w > 1) d = (double)x / (double)(w - 1);
1060 else d = 0;
1061 }
1062 else
1063 {
1064 if (h > 1) d = (double)y / (double)(h - 1);
1065 else d = 0;
1066 }
1067 if (d < 0.0) d = 0.0;
1068 else if (d > 1.0) d = 1.0;
1069 if (!gcc->scroll_timer)
1070 gcc->scroll_timer = ecore_timer_add(0.01, _e_gadcon_cb_client_scroll_timer, gcc);
1071 if (!gcc->scroll_animator)
1072 gcc->scroll_animator = ecore_animator_add(_e_gadcon_cb_client_scroll_animator, gcc);
1073 gcc->scroll_wanted = d;
1074 }
1075}
1076
1077static void
1078_e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info)
1079{
1080 E_Gadcon_Client *gcc;
1081
1082 gcc = data;
1083 _e_gadcon_movereisze_handle(gcc);
1084}
1085
1086static void
623_e_gadcon_client_save(E_Gadcon_Client *gcc) 1087_e_gadcon_client_save(E_Gadcon_Client *gcc)
624{ 1088{
625 Evas_List *l, *l2; 1089 Evas_List *l, *l2;
@@ -645,6 +1109,12 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc)
645 cf_gcc->geom.pos = gcc->config.pos; 1109 cf_gcc->geom.pos = gcc->config.pos;
646 cf_gcc->geom.size = gcc->config.size; 1110 cf_gcc->geom.size = gcc->config.size;
647 cf_gcc->geom.res = gcc->config.res; 1111 cf_gcc->geom.res = gcc->config.res;
1112 cf_gcc->autoscroll = gcc->autoscroll;
1113 if (cf_gcc->style) evas_stringshare_del(cf_gcc->style);
1114 cf_gcc->style = NULL;
1115 if (gcc->inset)
1116 cf_gcc->style = evas_stringshare_add("inset");
1117 cf_gcc->resizable = gcc->resizable;
648 ok++; 1118 ok++;
649 break; 1119 break;
650 } 1120 }
@@ -668,6 +1138,12 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc)
668 cf_gcc->geom.pos = gcc->config.pos; 1138 cf_gcc->geom.pos = gcc->config.pos;
669 cf_gcc->geom.size = gcc->config.size; 1139 cf_gcc->geom.size = gcc->config.size;
670 cf_gcc->geom.res = gcc->config.res; 1140 cf_gcc->geom.res = gcc->config.res;
1141 cf_gcc->autoscroll = gcc->autoscroll;
1142 if (cf_gcc->style) evas_stringshare_del(cf_gcc->style);
1143 cf_gcc->style = NULL;
1144 if (gcc->inset)
1145 cf_gcc->style = evas_stringshare_add("inset");
1146 cf_gcc->resizable = gcc->resizable;
671 cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc); 1147 cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
672 ok++; 1148 ok++;
673 } 1149 }
@@ -675,6 +1151,21 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc)
675} 1151}
676 1152
677static void 1153static void
1154_e_gadcon_cb_min_size_request(void *data, Evas_Object *obj, void *event_info)
1155{
1156 E_Gadcon *gc;
1157
1158 gc = data;
1159 if (gc->min_size_request.func)
1160 {
1161 Evas_Coord w, h;
1162
1163 e_gadcon_layout_min_size_get(gc->o_container, &w, &h);
1164 gc->min_size_request.func(gc->min_size_request.data, gc, w, h);
1165 }
1166}
1167
1168static void
678_e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info) 1169_e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info)
679{ 1170{
680 E_Gadcon *gc; 1171 E_Gadcon *gc;
@@ -683,8 +1174,9 @@ _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info)
683 if (gc->resize_request.func) 1174 if (gc->resize_request.func)
684 { 1175 {
685 Evas_Coord w, h; 1176 Evas_Coord w, h;
1177
1178 e_gadcon_layout_asked_size_get(gc->o_container, &w, &h);
686 1179
687 e_gadcon_layout_min_size_get(gc->o_container, &w, &h);
688 gc->resize_request.func(gc->resize_request.data, gc, w, h); 1180 gc->resize_request.func(gc->resize_request.data, gc, w, h);
689 } 1181 }
690} 1182}
@@ -771,7 +1263,10 @@ _e_gadcon_cb_signal_move_start(void *data, Evas_Object *obj, const char *emissio
771 gcc->moving = 1; 1263 gcc->moving = 1;
772 evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy); 1264 evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy);
773 evas_object_geometry_get(gcc->gadcon->o_container, &x, &y, NULL, NULL); 1265 evas_object_geometry_get(gcc->gadcon->o_container, &x, &y, NULL, NULL);
774 evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, NULL, NULL); 1266 if (gcc->o_frame)
1267 evas_object_geometry_get(gcc->o_frame, &gcc->sx, &gcc->sy, NULL, NULL);
1268 else
1269 evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, NULL, NULL);
775 gcc->sx -= x; 1270 gcc->sx -= x;
776 gcc->sy -= y; 1271 gcc->sy -= y;
777} 1272}
@@ -826,99 +1321,130 @@ _e_gadcon_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission,
826} 1321}
827 1322
828static void 1323static void
829_e_gadcon_cb_signal_resize_left_start(void *data, Evas_Object *obj, const char *emission, const char *source) 1324_e_gadcon_client_resize_start(E_Gadcon_Client *gcc)
830{
831 E_Gadcon_Client *gcc;
832
833 gcc = data;
834}
835
836static void
837_e_gadcon_cb_signal_resize_left_stop(void *data, Evas_Object *obj, const char *emission, const char *source)
838{
839 E_Gadcon_Client *gcc;
840
841 gcc = data;
842}
843
844static void
845_e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj, const char *emission, const char *source)
846{
847 E_Gadcon_Client *gcc;
848
849 gcc = data;
850}
851
852static void
853_e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source)
854{
855 E_Gadcon_Client *gcc;
856
857 gcc = data;
858}
859
860static void
861_e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source)
862{ 1325{
863 E_Gadcon_Client *gcc; 1326 Evas_Coord x, y;
864 1327
865 gcc = data; 1328 evas_object_raise(gcc->o_event);
1329 evas_object_stack_below(gcc->o_control, gcc->o_event);
1330 gcc->resizing = 1;
1331 evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy);
1332 evas_object_geometry_get(gcc->gadcon->o_container, &x, &y, NULL, NULL);
1333 if (gcc->o_frame)
1334 evas_object_geometry_get(gcc->o_frame, &gcc->sx, &gcc->sy, &gcc->sw, &gcc->sh);
1335 else
1336 evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, &gcc->sw, &gcc->sh);
1337 gcc->sx -= x;
1338 gcc->sy -= y;
866} 1339}
867 1340
868static void 1341static void
869_e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source) 1342_e_gadconclient_resize_stop(E_Gadcon_Client *gcc)
870{ 1343{
871 E_Gadcon_Client *gcc; 1344 gcc->resizing = 0;
872 1345 _e_gadcon_client_save(gcc);
873 gcc = data;
874} 1346}
875 1347
876static void 1348static void
877_e_gadcon_cb_signal_resize_up_start(void *data, Evas_Object *obj, const char *emission, const char *source) 1349_e_gadcon_cb_signal_resize_left_start(void *data, Evas_Object *obj, const char *emission, const char *source)
878{ 1350{
879 E_Gadcon_Client *gcc; 1351 _e_gadcon_client_resize_start(data);
880
881 gcc = data;
882} 1352}
883 1353
884static void 1354static void
885_e_gadcon_cb_signal_resize_up_stop(void *data, Evas_Object *obj, const char *emission, const char *source) 1355_e_gadcon_cb_signal_resize_left_stop(void *data, Evas_Object *obj, const char *emission, const char *source)
886{ 1356{
887 E_Gadcon_Client *gcc; 1357 _e_gadconclient_resize_stop(data);
888
889 gcc = data;
890} 1358}
891 1359
892static void 1360static void
893_e_gadcon_cb_signal_resize_up_go(void *data, Evas_Object *obj, const char *emission, const char *source) 1361_e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj, const char *emission, const char *source)
894{ 1362{
895 E_Gadcon_Client *gcc; 1363 E_Gadcon_Client *gcc;
1364 Evas_Coord x, y, w, h;
896 1365
897 gcc = data; 1366 gcc = data;
1367 if (!gcc->resizing) return;
1368 evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y);
1369 x = x - gcc->dx;
1370 y = y - gcc->dy;
1371 if (gcc->o_frame)
1372 evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h);
1373 else
1374 evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h);
1375 if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
1376 {
1377 if (gcc->o_frame)
1378 e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx + x, gcc->sw - x);
1379 else
1380 e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx + x, gcc->sw - x);
1381 gcc->config.pos = gcc->sx + x;
1382 gcc->config.size = gcc->sw - x;
1383 evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
1384 gcc->config.res = w;
1385 }
1386 else
1387 {
1388 if (gcc->o_frame)
1389 e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy + y, gcc->sh - y);
1390 else
1391 e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy + y, gcc->sh - y);
1392 gcc->config.pos = gcc->sy + y;
1393 gcc->config.size = gcc->sh - y;
1394 evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
1395 gcc->config.res = h;
1396 }
898} 1397}
899 1398
900static void 1399static void
901_e_gadcon_cb_signal_resize_down_start(void *data, Evas_Object *obj, const char *emission, const char *source) 1400_e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source)
902{ 1401{
903 E_Gadcon_Client *gcc; 1402 _e_gadcon_client_resize_start(data);
904
905 gcc = data;
906} 1403}
907 1404
908static void 1405static void
909_e_gadcon_cb_signal_resize_down_stop(void *data, Evas_Object *obj, const char *emission, const char *source) 1406_e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source)
910{ 1407{
911 E_Gadcon_Client *gcc; 1408 _e_gadconclient_resize_stop(data);
912
913 gcc = data;
914} 1409}
915 1410
916static void 1411static void
917_e_gadcon_cb_signal_resize_down_go(void *data, Evas_Object *obj, const char *emission, const char *source) 1412_e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source)
918{ 1413{
919 E_Gadcon_Client *gcc; 1414 E_Gadcon_Client *gcc;
1415 Evas_Coord x, y, w, h;
920 1416
921 gcc = data; 1417 gcc = data;
1418 if (!gcc->resizing) return;
1419 evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y);
1420 x = x - gcc->dx;
1421 y = y - gcc->dy;
1422 if (gcc->o_frame)
1423 evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h);
1424 else
1425 evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h);
1426 if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
1427 {
1428 if (gcc->o_frame)
1429 e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx, gcc->sw + x);
1430 else
1431 e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx, gcc->sw + x);
1432 gcc->config.pos = gcc->sx;
1433 gcc->config.size = gcc->sw + x;
1434 evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
1435 gcc->config.res = w;
1436 }
1437 else
1438 {
1439 if (gcc->o_frame)
1440 e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy, gcc->sh + y);
1441 else
1442 e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy, gcc->sh + y);
1443 gcc->config.pos = gcc->sy;
1444 gcc->config.size = gcc->sh + y;
1445 evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
1446 gcc->config.res = h;
1447 }
922} 1448}
923 1449
924 1450
@@ -940,7 +1466,7 @@ struct _E_Smart_Data
940 unsigned char redo_config : 1; 1466 unsigned char redo_config : 1;
941 Evas_List *items; 1467 Evas_List *items;
942 int frozen; 1468 int frozen;
943 Evas_Coord minw, minh; 1469 Evas_Coord minw, minh, req;
944}; 1470};
945 1471
946struct _E_Gadcon_Layout_Item 1472struct _E_Gadcon_Layout_Item
@@ -1077,6 +1603,11 @@ e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
1077 1603
1078 sd = evas_object_smart_data_get(obj); 1604 sd = evas_object_smart_data_get(obj);
1079 if (!sd) return; 1605 if (!sd) return;
1606 if (sd->horizontal)
1607 tw = sd->req;
1608 else
1609 th = sd->req;
1610/*
1080 for (l = sd->items; l; l = l->next) 1611 for (l = sd->items; l; l = l->next)
1081 { 1612 {
1082 E_Gadcon_Layout_Item *bi; 1613 E_Gadcon_Layout_Item *bi;
@@ -1093,6 +1624,7 @@ e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
1093 th += bi->ask.size; 1624 th += bi->ask.size;
1094 } 1625 }
1095 } 1626 }
1627 */
1096 if (w) *w = tw; 1628 if (w) *w = tw;
1097 if (h) *h = th; 1629 if (h) *h = th;
1098} 1630}
@@ -1338,14 +1870,9 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
1338 return; 1870 return;
1339 } 1871 }
1340 1872
1341 x = sd->x; 1873 x = sd->x; y = sd->y; w = sd->w; h = sd->h;
1342 y = sd->y; 1874 min = mino = cur = 0;
1343 w = sd->w; 1875
1344 h = sd->h;
1345
1346 min = 0;
1347 mino = 0;
1348 cur = 0;
1349 for (l = sd->items; l; l = l->next) 1876 for (l = sd->items; l; l = l->next)
1350 { 1877 {
1351 E_Gadcon_Layout_Item *bi; 1878 E_Gadcon_Layout_Item *bi;
@@ -1353,17 +1880,6 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
1353 1880
1354 obj = l->data; 1881 obj = l->data;
1355 bi = evas_object_data_get(obj, "e_gadcon_layout_data"); 1882 bi = evas_object_data_get(obj, "e_gadcon_layout_data");
1356 cur += bi->ask.size;
1357 if (sd->horizontal)
1358 {
1359 min += bi->min.w;
1360 if (bi->min.h > mino) mino = bi->min.h;
1361 }
1362 else
1363 {
1364 min += bi->min.h;
1365 if (bi->min.w > mino) mino = bi->min.w;
1366 }
1367 bi->ask.size2 = bi->ask.size; 1883 bi->ask.size2 = bi->ask.size;
1368 if ((bi->aspect.w > 0) && (bi->aspect.h > 0)) 1884 if ((bi->aspect.w > 0) && (bi->aspect.h > 0))
1369 { 1885 {
@@ -1372,20 +1888,60 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
1372 bi->ask.size2 = (((h - bi->aspect_pad.h) * bi->aspect.w) / 1888 bi->ask.size2 = (((h - bi->aspect_pad.h) * bi->aspect.w) /
1373 bi->aspect.h) + bi->aspect_pad.w; 1889 bi->aspect.h) + bi->aspect_pad.w;
1374 if (bi->ask.size2 > bi->min.w) 1890 if (bi->ask.size2 > bi->min.w)
1375 min += (bi->ask.size2 - bi->min.w); 1891 {
1892 min += bi->ask.size2;
1893 cur += bi->ask.size2;
1894 }
1895 else
1896 {
1897 cur += bi->min.w;
1898 min += bi->min.w;
1899 }
1376 } 1900 }
1377 else 1901 else
1378 { 1902 {
1379 bi->ask.size2 = (((w - bi->aspect_pad.w) * bi->aspect.h) / 1903 bi->ask.size2 = (((w - bi->aspect_pad.w) * bi->aspect.h) /
1380 bi->aspect.w) + bi->aspect_pad.h; 1904 bi->aspect.w) + bi->aspect_pad.h;
1381 if (bi->ask.size2 > bi->min.h) 1905 if (bi->ask.size2 > bi->min.h)
1382 min += (bi->ask.size2 - bi->min.h); 1906 {
1907 min += bi->ask.size2;
1908 cur += bi->ask.size2;
1909 }
1910 else
1911 {
1912 cur += bi->min.h;
1913 min += bi->min.h;
1914 }
1915 }
1916 }
1917 else
1918 {
1919 if (sd->horizontal)
1920 {
1921 min += bi->min.w;
1922 if (bi->min.h > mino) mino = bi->min.h;
1923 if (bi->ask.size < bi->min.w)
1924 cur += bi->min.w;
1925 else
1926 cur += bi->ask.size;
1927 }
1928 else
1929 {
1930 min += bi->min.h;
1931 if (bi->min.w > mino) mino = bi->min.w;
1932 if (bi->ask.size < bi->min.h)
1933 cur += bi->min.h;
1934 else
1935 cur += bi->ask.size;
1383 } 1936 }
1384 } 1937 }
1385 } 1938 }
1939
1940 printf("CUR = %i | %i %i\n", cur, min, mino);
1941
1386 if (sd->horizontal) 1942 if (sd->horizontal)
1387 { 1943 {
1388 if (cur < w) 1944 if (cur <= w)
1389 { 1945 {
1390 /* all is fine - it should all fit */ 1946 /* all is fine - it should all fit */
1391 } 1947 }
@@ -1396,6 +1952,7 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
1396 sub = cur - w; /* we need to find "sub" extra pixels */ 1952 sub = cur - w; /* we need to find "sub" extra pixels */
1397 if (min <= w) 1953 if (min <= w)
1398 { 1954 {
1955 printf("blum\n");
1399 for (l = sd->items; l; l = l->next) 1956 for (l = sd->items; l; l = l->next)
1400 { 1957 {
1401 E_Gadcon_Layout_Item *bi; 1958 E_Gadcon_Layout_Item *bi;
@@ -1407,11 +1964,13 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
1407 if (give < sub) give = sub; 1964 if (give < sub) give = sub;
1408 bi->ask.size2 = bi->ask.size - give; 1965 bi->ask.size2 = bi->ask.size - give;
1409 sub -= give; 1966 sub -= give;
1967 printf("GIVE: %i\n", give);
1410 if (sub <= 0) break; 1968 if (sub <= 0) break;
1411 } 1969 }
1412 } 1970 }
1413 else 1971 else
1414 { /* EEK - all items just cant fit at their minimum! what do we do? */ 1972 { /* EEK - all items just cant fit at their minimum! what do we do? */
1973 printf("EEK - nofit!\n");
1415 num = 0; 1974 num = 0;
1416 num = evas_list_count(sd->items); 1975 num = evas_list_count(sd->items);
1417 give = min - w; // how much give total below minw we need 1976 give = min - w; // how much give total below minw we need
@@ -1781,19 +2340,28 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
1781 } 2340 }
1782 if (sd->horizontal) 2341 if (sd->horizontal)
1783 { 2342 {
1784 if ((sd->minw < min) || (sd->minh < mino)) 2343 if ((sd->minw != min) || (sd->minh != mino))
1785 { 2344 {
1786 sd->minw = min; 2345 sd->minw = min;
1787 sd->minh = mino; 2346 sd->minh = mino;
1788 evas_object_smart_callback_call(sd->obj, "size_request", NULL); 2347 evas_object_smart_callback_call(sd->obj, "min_size_request", NULL);
1789 } 2348 }
1790 } 2349 }
1791 else 2350 else
1792 { 2351 {
1793 if ((sd->minh < min) || (sd->minw < mino)) 2352 if ((sd->minh != min) || (sd->minw != mino))
1794 { 2353 {
1795 sd->minw = mino; 2354 sd->minw = mino;
1796 sd->minh = min; 2355 sd->minh = min;
2356 evas_object_smart_callback_call(sd->obj, "min_size_request", NULL);
2357 }
2358 }
2359 if (sd->req != cur)
2360 {
2361 if (((sd->horizontal) && (cur >= sd->minw)) ||
2362 ((!sd->horizontal) && (cur >= sd->minh)))
2363 {
2364 sd->req = cur;
1797 evas_object_smart_callback_call(sd->obj, "size_request", NULL); 2365 evas_object_smart_callback_call(sd->obj, "size_request", NULL);
1798 } 2366 }
1799 } 2367 }
diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h
index 86c477785..ea6ffb11e 100644
--- a/src/bin/e_gadcon.h
+++ b/src/bin/e_gadcon.h
@@ -65,7 +65,7 @@ struct _E_Gadcon
65 struct { 65 struct {
66 void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); 66 void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
67 void *data; 67 void *data;
68 } resize_request; 68 } resize_request, min_size_request;
69 struct { 69 struct {
70 Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style); 70 Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style);
71 void *data; 71 void *data;
@@ -91,20 +91,30 @@ struct _E_Gadcon_Client
91 char *name; 91 char *name;
92 char *id; 92 char *id;
93 Evas_Object *o_base; 93 Evas_Object *o_base;
94 Evas_Object *o_box;
94 Evas_Object *o_frame; 95 Evas_Object *o_frame;
95 Evas_Object *o_control; 96 Evas_Object *o_control;
96 Evas_Object *o_event; 97 Evas_Object *o_event;
97 E_Gadcon_Client_Class client_class; 98 E_Gadcon_Client_Class *client_class;
98 void *data; 99 void *data;
99 struct { 100 struct {
100 int pos, size, res; 101 int pos, size, res;
101 } config; 102 } config;
102 struct { 103 struct {
103 Evas_Coord w, h; 104 Evas_Coord w, h;
104 } pad; 105 } pad, min, aspect;
106 unsigned char inset : 1;
107 unsigned char autoscroll : 1;
108 unsigned char resizable : 1;
109 Ecore_Timer *scroll_timer;
110 Ecore_Animator *scroll_animator;
111 double scroll_pos;
112 double scroll_wanted;
113 E_Menu *menu;
105 114
106 unsigned char moving : 1; 115 unsigned char moving : 1;
107 Evas_Coord dx, dy, sx, sy; 116 unsigned char resizing : 1;
117 Evas_Coord dx, dy, sx, sy, sw, sh;
108}; 118};
109 119
110EAPI int e_gadcon_init(void); 120EAPI int e_gadcon_init(void);
@@ -113,10 +123,13 @@ EAPI void e_gadcon_provider_register(E_Gadcon_Client_Class *cc);
113EAPI void e_gadcon_provider_unregister(E_Gadcon_Client_Class *cc); 123EAPI void e_gadcon_provider_unregister(E_Gadcon_Client_Class *cc);
114EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, char *id, Evas_Object *obj, char *swallow_name); 124EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, char *id, Evas_Object *obj, char *swallow_name);
115EAPI void e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h); 125EAPI void e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
126EAPI void e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
116EAPI void e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data); 127EAPI void e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
117EAPI void e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style), void *data); 128EAPI void e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style), void *data);
118EAPI void e_gadcon_layout_policy_set(E_Gadcon *gc, E_Gadcon_Layout_Policy layout_policy); 129EAPI void e_gadcon_layout_policy_set(E_Gadcon *gc, E_Gadcon_Layout_Policy layout_policy);
119EAPI void e_gadcon_populate(E_Gadcon *gc); 130EAPI void e_gadcon_populate(E_Gadcon *gc);
131EAPI void e_gadcon_unpopulate(E_Gadcon *gc);
132EAPI void e_gadcon_populate_class(E_Gadcon *gc, E_Gadcon_Client_Class *cc);
120EAPI void e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient); 133EAPI void e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient);
121EAPI void e_gadcon_edit_begin(E_Gadcon *gc); 134EAPI void e_gadcon_edit_begin(E_Gadcon *gc);
122EAPI void e_gadcon_edit_end(E_Gadcon *gc); 135EAPI void e_gadcon_edit_end(E_Gadcon *gc);
@@ -128,11 +141,16 @@ EAPI void e_gadcon_ecore_evas_set(E_Gadcon *gc, Ecore_Evas *ee);
128EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h); 141EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h);
129 142
130EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, char *style, Evas_Object *base_obj); 143EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, char *style, Evas_Object *base_obj);
144EAPI void e_gadcon_client_edit_begin(E_Gadcon_Client *gcc);
145EAPI void e_gadcon_client_edit_end(E_Gadcon_Client *gcc);
131EAPI void e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h); 146EAPI void e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h);
132EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h); 147EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h);
133EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h); 148EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h);
134EAPI void e_gadcon_client_edit_begin(E_Gadcon_Client *gcc); 149EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll);
135EAPI void e_gadcon_client_edit_end(E_Gadcon_Client *gcc); 150EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable);
136 151
152EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags);
153EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc);
154
137#endif 155#endif
138#endif 156#endif
diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h
index dafd26f26..052792de2 100644
--- a/src/bin/e_includes.h
+++ b/src/bin/e_includes.h
@@ -129,5 +129,6 @@
129#include "e_gadcon.h" 129#include "e_gadcon.h"
130#include "e_shelf.h" 130#include "e_shelf.h"
131#include "e_tlist.h" 131#include "e_tlist.h"
132#include "e_widget_tlist.h"
132#include "e_widget_preview.h" 133#include "e_widget_preview.h"
133#include "e_int_config_paths.h" 134#include "e_int_config_paths.h"
diff --git a/src/bin/e_main.c b/src/bin/e_main.c
index 57d0b1da5..a40c96a05 100644
--- a/src/bin/e_main.c
+++ b/src/bin/e_main.c
@@ -676,7 +676,8 @@ main(int argc, char **argv)
676 e_test(); 676 e_test();
677 677
678 /* FIXME: for testing only */ 678 /* FIXME: for testing only */
679// e_shelf_config_init(); 679//
680 e_shelf_config_init();
680 681
681 /* no longer starting up */ 682 /* no longer starting up */
682 starting = 0; 683 starting = 0;
diff --git a/src/bin/e_place.c b/src/bin/e_place.c
index f2c9c9fce..1bf7da2d2 100644
--- a/src/bin/e_place.c
+++ b/src/bin/e_place.c
@@ -64,6 +64,83 @@ _e_place_cb_sort_cmp(const void *v1, const void *v2)
64 return (*((int *)v1)) - (*((int *)v2)); 64 return (*((int *)v1)) - (*((int *)v2));
65} 65}
66 66
67static int
68_e_place_coverage_border_add(E_Zone *zone, Evas_List *skiplist, int ar, int x, int y, int w, int h)
69{
70 Evas_List *ll;
71 E_Border_List *bl;
72 E_Border *bd;
73 int x2, y2, w2, h2;
74 int ok;
75 int iw, ih;
76 int x0, x00, y0, y00;
77
78 bl = e_container_border_list_first(zone->container);
79 while ((bd = e_container_border_list_next(bl)))
80 {
81 ok = 1;
82 x2 = (bd->x - zone->x); y2 = (bd->y - zone->y); w2 = bd->w; h2 = bd->h;
83 for (ll = skiplist; ll; ll = ll->next)
84 {
85 if (ll->data == bd)
86 {
87 ok = 0;
88 break;
89 }
90 }
91 if ((ok) && (bd->visible) && E_INTERSECTS(x, y, w, h, x2, y2, w2, h2))
92 {
93 x0 = x;
94 if (x < x2) x0 = x2;
95 x00 = (x + w);
96 if ((x2 + w2) < (x + w)) x00 = (x2 + w2);
97 y0 = y;
98 if (y < y2) y0 = y2;
99 y00 = (y + h);
100 if ((y2 + h2) < (y + h)) y00 = (y2 + h2);
101 iw = x00 - x0;
102 ih = y00 - y0;
103 ar += (iw * ih);
104 }
105 }
106 e_container_border_list_free(bl);
107 return ar;
108}
109
110static int
111_e_place_coverage_shelf_add(E_Zone *zone, int ar, int x, int y, int w, int h)
112{
113 Evas_List *l;
114 E_Shelf *es;
115 int x2, y2, w2, h2;
116 int ok;
117 int iw, ih;
118 int x0, x00, y0, y00;
119
120 for (l = e_shelf_list(); l; l = l->next)
121 {
122
123 es = l->data;
124 if (es->zone != zone) continue;
125 x2 = es->x; y2 = es->y; w2 = es->w; h2 = es->h;
126 if (E_INTERSECTS(x, y, w, h, x2, y2, w2, h2))
127 {
128 x0 = x;
129 if (x < x2) x0 = x2;
130 x00 = (x + w);
131 if ((x2 + w2) < (x + w)) x00 = (x2 + w2);
132 y0 = y;
133 if (y < y2) y0 = y2;
134 y00 = (y + h);
135 if ((y2 + h2) < (y + h)) y00 = (y2 + h2);
136 iw = x00 - x0;
137 ih = y00 - y0;
138 ar += (iw * ih) * 100; /* 100 == 100 times more unlikely for overlap than a normal window */
139 }
140 }
141 return ar;
142}
143
67EAPI int 144EAPI int
68e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w, int h, int *rx, int *ry) 145e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w, int h, int *rx, int *ry)
69{ 146{
@@ -90,59 +167,9 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w
90 167
91 x -= zone->x; 168 x -= zone->x;
92 y -= zone->y; 169 y -= zone->y;
170 zw = zone->w;
171 zh = zone->h;
93 172
94 if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET)
95 {
96 Evas_List *l;
97 int cx1, cx2, cy1, cy2;
98
99 cx1 = zone->x;
100 cy1 = zone->y;
101 cx2 = zone->x + zone->w;
102 cy2 = zone->y + zone->h;
103
104 /* Find the smallest box */
105 for (l = zone->container->gadman->clients; l; l = l->next)
106 {
107 E_Gadman_Client *gmc;
108 double ax, ay;
109
110 gmc = l->data;
111 if ((gmc->zone != zone)) continue;
112
113 ax = gmc->ax;
114 ay = gmc->ay;
115
116 if (((ax == 0.0) || (ax == 1.0)) &&
117 ((ay == 0.0) || (ay == 1.0)))
118 {
119 /* corner gadget */
120 /* Fake removal from one alignment :) */
121 if (gmc->w > gmc->h)
122 ax = 0.5;
123 else
124 ay = 0.5;
125 }
126
127 if ((ax == 0.0) && (gmc->x + gmc->w) > cx1)
128 cx1 = (gmc->x + gmc->w);
129 else if ((ax == 1.0) && (gmc->x < cx2))
130 cx2 = gmc->x;
131 else if ((ay == 0.0) && ((gmc->y + gmc->h) > cy1))
132 cy1 = (gmc->y + gmc->h);
133 else if ((ay == 1.0) && (gmc->y < cy2))
134 cy2 = gmc->y;
135 }
136
137
138 zw = cx2 - cx1;
139 zh = cy2 - cy1;
140 }
141 else
142 {
143 zw = zone->w;
144 zh = zone->h;
145 }
146 u_x = calloc(zw + 1, sizeof(char)); 173 u_x = calloc(zw + 1, sizeof(char));
147 u_y = calloc(zh + 1, sizeof(char)); 174 u_y = calloc(zh + 1, sizeof(char));
148 175
@@ -150,7 +177,135 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w
150 a_x[1] = zw; 177 a_x[1] = zw;
151 a_y[0] = 0; 178 a_y[0] = 0;
152 a_y[1] = zh; 179 a_y[1] = zh;
153 180
181 if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET)
182 {
183 Evas_List *l;
184
185 for (l = zone->container->gadman->clients; l; l = l->next)
186 {
187 E_Gadman_Client *gmc;
188 int bx, by, bw, bh;
189
190 gmc = l->data;
191 if ((gmc->zone != zone)) continue;
192
193 bx = gmc->x;
194 by = gmc->y;
195 bw = gmc->w;
196 bh = gmc->h;
197 if (E_INTERSECTS(bx, by, bw, bh, 0, 0, zw, zh))
198 {
199 if ((bx > 0) && (bx <= zw) && (!u_x[bx]))
200 {
201 a_w++;
202 if (a_w > a_alloc_w)
203 {
204 a_alloc_w += 32;
205 E_REALLOC(a_x, int, a_alloc_w);
206 }
207 a_x[a_w - 1] = bx;
208 u_x[bx] = 1;
209 }
210 if (((bx + bw) > 0) && ((bx + bw) <= zw) && (!u_x[bx + bw]))
211 {
212 a_w++;
213 if (a_w > a_alloc_w)
214 {
215 a_alloc_w += 32;
216 E_REALLOC(a_x, int, a_alloc_w);
217 }
218 a_x[a_w - 1] = bx + bw;
219 u_x[bx + bw] = 1;
220 }
221 if ((by > 0) && (by <= zh) && (!u_y[by]))
222 {
223 a_h++;
224 if (a_h > a_alloc_h)
225 {
226 a_alloc_h += 32;
227 E_REALLOC(a_y, int, a_alloc_h);
228 }
229 a_y[a_h - 1] = by;
230 u_y[by] = 1;
231 }
232 if (((by + bh) > 0) && ((by + bh) <= zh) && (!u_y[by + bh]))
233 {
234 a_h++;
235 if (a_h > a_alloc_h)
236 {
237 a_alloc_h += 32;
238 E_REALLOC(a_y, int, a_alloc_h);
239 }
240 a_y[a_h - 1] = by + bh;
241 u_y[by + bh] = 1;
242 }
243 }
244 }
245 for (l = e_shelf_list(); l; l = l->next)
246 {
247 E_Shelf *es;
248
249 es = l->data;
250 if (es->zone == zone)
251 {
252 int bx, by, bw, bh;
253
254 bx = es->x;
255 by = es->y;
256 bw = es->w;
257 bh = es->h;
258 if (E_INTERSECTS(bx, by, bw, bh, 0, 0, zw, zh))
259 {
260 if ((bx > 0) && (bx <= zw) && (!u_x[bx]))
261 {
262 a_w++;
263 if (a_w > a_alloc_w)
264 {
265 a_alloc_w += 32;
266 E_REALLOC(a_x, int, a_alloc_w);
267 }
268 a_x[a_w - 1] = bx;
269 u_x[bx] = 1;
270 }
271 if (((bx + bw) > 0) && ((bx + bw) <= zw) && (!u_x[bx + bw]))
272 {
273 a_w++;
274 if (a_w > a_alloc_w)
275 {
276 a_alloc_w += 32;
277 E_REALLOC(a_x, int, a_alloc_w);
278 }
279 a_x[a_w - 1] = bx + bw;
280 u_x[bx + bw] = 1;
281 }
282 if ((by > 0) && (by <= zh) && (!u_y[by]))
283 {
284 a_h++;
285 if (a_h > a_alloc_h)
286 {
287 a_alloc_h += 32;
288 E_REALLOC(a_y, int, a_alloc_h);
289 }
290 a_y[a_h - 1] = by;
291 u_y[by] = 1;
292 }
293 if (((by + bh) > 0) && ((by + bh) <= zh) && (!u_y[by + bh]))
294 {
295 a_h++;
296 if (a_h > a_alloc_h)
297 {
298 a_alloc_h += 32;
299 E_REALLOC(a_y, int, a_alloc_h);
300 }
301 a_y[a_h - 1] = by + bh;
302 u_y[by + bh] = 1;
303 }
304 }
305 }
306 }
307 }
308
154 bl = e_container_border_list_first(zone->container); 309 bl = e_container_border_list_first(zone->container);
155 while ((bd = e_container_border_list_next(bl))) 310 while ((bd = e_container_border_list_next(bl)))
156 { 311 {
@@ -240,252 +395,72 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w
240 { 395 {
241 int ar = 0; 396 int ar = 0;
242 397
243 bl = e_container_border_list_first(zone->container); 398 ar = _e_place_coverage_border_add(zone, skiplist, ar,
244 while ((bd = e_container_border_list_next(bl))) 399 a_x[i], a_y[j],
245 { 400 w, h);
246 int x1, y1, w1, h1, x2, y2, w2, h2; 401 ar = _e_place_coverage_shelf_add(zone, ar,
247 int ok; 402 a_x[i], a_y[j],
248 403 w, h);
249 ok = 1;
250 x1 = a_x[i];
251 y1 = a_y[j];
252 w1 = w;
253 h1 = h;
254 x2 = (bd->x - zone->x);
255 y2 = (bd->y - zone->y);
256 w2 = bd->w;
257 h2 = bd->h;
258 for (ll = skiplist; ll; ll = ll->next)
259 {
260 if (ll->data == bd)
261 {
262 ok = 0;
263 break;
264 }
265 }
266 if ((ok) && (bd->visible) &&
267 E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
268 {
269 int iw, ih;
270 int x0, x00, y0, y00;
271
272 x0 = x1;
273 if (x1 < x2)
274 x0 = x2;
275 x00 = (x1 + w1);
276 if ((x2 + w2) < (x1 + w1))
277 x00 = (x2 + w2);
278
279 y0 = y1;
280 if (y1 < y2)
281 y0 = y2;
282 y00 = (y1 + h1);
283 if ((y2 + h2) < (y1 + h1))
284 y00 = (y2 + h2);
285
286 iw = x00 - x0;
287 ih = y00 - y0;
288 ar += (iw * ih);
289 }
290 }
291 e_container_border_list_free(bl);
292
293 if (ar < area) 404 if (ar < area)
294 { 405 {
295 area = ar; 406 area = ar;
296 *rx = a_x[i]; 407 *rx = a_x[i];
297 *ry = a_y[j]; 408 *ry = a_y[j];
298 if (ar == 0) 409 if (ar == 0) goto done;
299 goto done;
300 } 410 }
301 } 411 }
302 if ((a_x[i + 1] - w > 0) && (a_y[j] < (zh - h))) 412 if ((a_x[i + 1] - w > 0) && (a_y[j] < (zh - h)))
303 { 413 {
304 int ar = 0; 414 int ar = 0;
305 415
306 bl = e_container_border_list_first(zone->container); 416 ar = _e_place_coverage_border_add(zone, skiplist, ar,
307 while ((bd = e_container_border_list_next(bl))) 417 a_x[i + 1] - w, a_y[j],
308 { 418 w, h);
309 int x1, y1, w1, h1, x2, y2, w2, h2; 419 ar = _e_place_coverage_shelf_add(zone, ar,
310 int ok; 420 a_x[i + 1] - w, a_y[j],
311 421 w, h);
312 ok = 1;
313 x1 = a_x[i + 1] - w;
314 y1 = a_y[j];
315 w1 = w;
316 h1 = h;
317 x2 = (bd->x - zone->x);
318 y2 = (bd->y - zone->y);
319 w2 = bd->w;
320 h2 = bd->h;
321 for (ll = skiplist; ll; ll = ll->next)
322 {
323 if (ll->data == bd)
324 {
325 ok = 0;
326 break;
327 }
328 }
329 if ((ok) && (bd->visible) &&
330 E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
331 {
332 int iw, ih;
333 int x0, x00, y0, y00;
334
335 x0 = x1;
336 if (x1 < x2)
337 x0 = x2;
338 x00 = (x1 + w1);
339 if ((x2 + w2) < (x1 + w1))
340 x00 = (x2 + w2);
341
342 y0 = y1;
343 if (y1 < y2)
344 y0 = y2;
345 y00 = (y1 + h1);
346 if ((y2 + h2) < (y1 + h1))
347 y00 = (y2 + h2);
348
349 iw = x00 - x0;
350 ih = y00 - y0;
351 ar += (iw * ih);
352 }
353 }
354 e_container_border_list_free(bl);
355
356 if (ar < area) 422 if (ar < area)
357 { 423 {
358 area = ar; 424 area = ar;
359 *rx = a_x[i + 1] - w; 425 *rx = a_x[i + 1] - w;
360 *ry = a_y[j]; 426 *ry = a_y[j];
361 if (ar == 0) 427 if (ar == 0) goto done;
362 goto done;
363 } 428 }
364 } 429 }
365 if ((a_x[i + 1] - w > 0) && (a_y[j + 1] - h > 0)) 430 if ((a_x[i + 1] - w > 0) && (a_y[j + 1] - h > 0))
366 { 431 {
367 int ar = 0; 432 int ar = 0;
368 433
369 bl = e_container_border_list_first(zone->container); 434 ar = _e_place_coverage_border_add(zone, skiplist, ar,
370 while ((bd = e_container_border_list_next(bl))) 435 a_x[i + 1] - w, a_y[j + 1] - h,
371 { 436 w, h);
372 int x1, y1, w1, h1, x2, y2, w2, h2; 437 ar = _e_place_coverage_shelf_add(zone, ar,
373 int ok; 438 a_x[i + 1] - w, a_y[j + 1] - h,
374 439 w, h);
375 ok = 1;
376 x1 = a_x[i + 1] - w;
377 y1 = a_y[j + 1] - h;
378 w1 = w;
379 h1 = h;
380 x2 = (bd->x - zone->x);
381 y2 = (bd->y - zone->y);
382 w2 = bd->w;
383 h2 = bd->h;
384 for (ll = skiplist; ll; ll = ll->next)
385 {
386 if (ll->data == bd)
387 {
388 ok = 0;
389 break;
390 }
391 }
392 if ((ok) && (bd->visible) &&
393 E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
394 {
395 int iw, ih;
396 int x0, x00, y0, y00;
397
398 x0 = x1;
399 if (x1 < x2)
400 x0 = x2;
401 x00 = (x1 + w1);
402 if ((x2 + w2) < (x1 + w1))
403 x00 = (x2 + w2);
404
405 y0 = y1;
406 if (y1 < y2)
407 y0 = y2;
408 y00 = (y1 + h1);
409 if ((y2 + h2) < (y1 + h1))
410 y00 = (y2 + h2);
411
412 iw = x00 - x0;
413 ih = y00 - y0;
414 ar += (iw * ih);
415 }
416 }
417 e_container_border_list_free(bl);
418
419 if (ar < area) 440 if (ar < area)
420 { 441 {
421 area = ar; 442 area = ar;
422 *rx = a_x[i + 1] - w; 443 *rx = a_x[i + 1] - w;
423 *ry = a_y[j + 1] - h; 444 *ry = a_y[j + 1] - h;
424 if (ar == 0) 445 if (ar == 0) goto done;
425 goto done;
426 } 446 }
427 } 447 }
428 if ((a_x[i] < (zw - w)) && (a_y[j + 1] - h > 0)) 448 if ((a_x[i] < (zw - w)) && (a_y[j + 1] - h > 0))
429 { 449 {
430 int ar = 0; 450 int ar = 0;
431 451
432 bl = e_container_border_list_first(zone->container); 452 ar = _e_place_coverage_border_add(zone, skiplist, ar,
433 while ((bd = e_container_border_list_next(bl))) 453 a_x[i], a_y[j + 1] - h,
434 { 454 w, h);
435 int x1, y1, w1, h1, x2, y2, w2, h2; 455 ar = _e_place_coverage_shelf_add(zone, ar,
436 int ok; 456 a_x[i], a_y[j + 1] - h,
437 457 w, h);
438 ok = 1;
439 x1 = a_x[i];
440 y1 = a_y[j + 1] - h;
441 w1 = w;
442 h1 = h;
443 x2 = (bd->x - zone->x);
444 y2 = (bd->y - zone->y);
445 w2 = bd->w;
446 h2 = bd->h;
447 for (ll = skiplist; ll; ll = ll->next)
448 {
449 if (ll->data == bd)
450 {
451 ok = 0;
452 break;
453 }
454 }
455 if ((ok) && (bd->visible) &&
456 E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2))
457 {
458 int iw, ih;
459 int x0, x00, y0, y00;
460
461 x0 = x1;
462 if (x1 < x2)
463 x0 = x2;
464 x00 = (x1 + w1);
465 if ((x2 + w2) < (x1 + w1))
466 x00 = (x2 + w2);
467
468 y0 = y1;
469 if (y1 < y2)
470 y0 = y2;
471 y00 = (y1 + h1);
472 if ((y2 + h2) < (y1 + h1))
473 y00 = (y2 + h2);
474
475 iw = x00 - x0;
476 ih = y00 - y0;
477 ar += (iw * ih);
478 }
479 }
480 e_container_border_list_free(bl);
481
482 if (ar < area) 458 if (ar < area)
483 { 459 {
484 area = ar; 460 area = ar;
485 *rx = a_x[i]; 461 *rx = a_x[i];
486 *ry = a_y[j + 1] - h; 462 *ry = a_y[j + 1] - h;
487 if (ar == 0) 463 if (ar == 0) goto done;
488 goto done;
489 } 464 }
490 } 465 }
491 } 466 }
diff --git a/src/bin/e_popup.c b/src/bin/e_popup.c
index 5fa773d22..48a896b08 100644
--- a/src/bin/e_popup.c
+++ b/src/bin/e_popup.c
@@ -207,6 +207,21 @@ e_popup_idler_before(void)
207 orects = pop->shape_rects; 207 orects = pop->shape_rects;
208 for (i = 0; i < num; i++) 208 for (i = 0; i < num; i++)
209 { 209 {
210 if (rects[i].x < 0)
211 {
212 rects[i].width -= rects[i].x;
213 rects[i].x = 0;
214 }
215 if ((rects[i].x + rects[i].width) > pop->w)
216 rects[i].width = rects[i].width - rects[i].x;
217 if (rects[i].y < 0)
218 {
219 rects[i].height -= rects[i].y;
220 rects[i].y = 0;
221 }
222 if ((rects[i].y + rects[i].height) > pop->h)
223 rects[i].height = rects[i].height - rects[i].y;
224
210 if ((orects[i].x != rects[i].x) || 225 if ((orects[i].x != rects[i].x) ||
211 (orects[i].y != rects[i].y) || 226 (orects[i].y != rects[i].y) ||
212 (orects[i].width != rects[i].width) || 227 (orects[i].width != rects[i].width) ||
@@ -216,7 +231,7 @@ e_popup_idler_before(void)
216 break; 231 break;
217 } 232 }
218 } 233 }
219 changed = 0; 234// changed = 0;
220 } 235 }
221 if (changed) 236 if (changed)
222 { 237 {
diff --git a/src/bin/e_resist.c b/src/bin/e_resist.c
index e2c68b36c..6ad0732a5 100644
--- a/src/bin/e_resist.c
+++ b/src/bin/e_resist.c
@@ -92,6 +92,17 @@ e_resist_container_border_position(E_Container *con, Evas_List *skiplist,
92 gmc = l->data; 92 gmc = l->data;
93 OBSTACLE(gmc->x, gmc->y, gmc->w, gmc->h, e_config->gadget_resist); 93 OBSTACLE(gmc->x, gmc->y, gmc->w, gmc->h, e_config->gadget_resist);
94 } 94 }
95 for (l = e_shelf_list(); l; l = l->next)
96 {
97 E_Shelf *es;
98
99 es = l->data;
100 if (es->zone->container == con)
101 {
102 OBSTACLE(es->x + es->zone->x, es->y + es->zone->y, es->w, es->h,
103 e_config->gadget_resist);
104 }
105 }
95 if (rects) 106 if (rects)
96 { 107 {
97 _e_resist_rects(rects, 108 _e_resist_rects(rects,
@@ -141,17 +152,22 @@ e_resist_container_gadman_position(E_Container *con, Evas_List *skiplist,
141 } 152 }
142 if (ok) 153 if (ok)
143 { 154 {
144 r = E_NEW(E_Resist_Rect, 1); 155 OBSTACLE(gmc->x, gmc->y, gmc->w, gmc->h, e_config->gadget_resist);
145
146 r->x = gmc->x;
147 r->y = gmc->y;
148 r->w = gmc->w;
149 r->h = gmc->h;
150 r->v1 = e_config->gadget_resist;
151 rects = evas_list_append(rects, r);
152 } 156 }
153 } 157 }
154 158
159 for (l = e_shelf_list(); l; l = l->next)
160 {
161 E_Shelf *es;
162
163 es = l->data;
164 if (es->zone->container == con)
165 {
166 OBSTACLE(es->x + es->zone->x, es->y + es->zone->y, es->w, es->h,
167 e_config->gadget_resist);
168 }
169 }
170
155 if (rects) 171 if (rects)
156 { 172 {
157 _e_resist_rects(rects, 173 _e_resist_rects(rects,
diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c
index f6b1aae46..48a22f136 100644
--- a/src/bin/e_shelf.c
+++ b/src/bin/e_shelf.c
@@ -6,6 +6,7 @@
6static void _e_shelf_free(E_Shelf *es); 6static void _e_shelf_free(E_Shelf *es);
7static const char *_e_shelf_orient_string_get(E_Shelf *es); 7static const char *_e_shelf_orient_string_get(E_Shelf *es);
8static void _e_shelf_position_calc(E_Shelf *es); 8static void _e_shelf_position_calc(E_Shelf *es);
9static void _e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
9static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); 10static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
10static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style); 11static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style);
11 12
@@ -47,6 +48,8 @@ e_shelf_config_init(void)
47 if (es) 48 if (es)
48 { 49 {
49 es->cfg = cf_es; 50 es->cfg = cf_es;
51 es->fit_along = cf_es->fit_along;
52 es->fit_size = cf_es->fit_size;
50 e_shelf_orient(es, cf_es->orient); 53 e_shelf_orient(es, cf_es->orient);
51 _e_shelf_position_calc(es); 54 _e_shelf_position_calc(es);
52 e_shelf_populate(es); 55 e_shelf_populate(es);
@@ -56,6 +59,12 @@ e_shelf_config_init(void)
56 } 59 }
57} 60}
58 61
62EAPI Evas_List *
63e_shelf_list(void)
64{
65 return shelves;
66}
67
59EAPI E_Shelf * 68EAPI E_Shelf *
60e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer) 69e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer)
61{ 70{
@@ -114,6 +123,9 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
114 snprintf(buf, sizeof(buf), "%i", shelf_id); 123 snprintf(buf, sizeof(buf), "%i", shelf_id);
115 shelf_id++; 124 shelf_id++;
116 es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items"); 125 es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items");
126 e_gadcon_min_size_request_callback_set(es->gadcon,
127 _e_shelf_gadcon_min_size_request,
128 es);
117 e_gadcon_size_request_callback_set(es->gadcon, 129 e_gadcon_size_request_callback_set(es->gadcon,
118 _e_shelf_gadcon_size_request, 130 _e_shelf_gadcon_size_request,
119 es); 131 es);
@@ -466,6 +478,12 @@ _e_shelf_position_calc(E_Shelf *es)
466} 478}
467 479
468static void 480static void
481_e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
482{
483 return;
484}
485
486static void
469_e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h) 487_e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
470{ 488{
471 E_Shelf *es; 489 E_Shelf *es;
@@ -477,7 +495,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
477 nw = es->w; 495 nw = es->w;
478 nh = es->h; 496 nh = es->h;
479 ww = hh = 0; 497 ww = hh = 0;
480 printf("req min = %i %i\n", w, h); 498 printf("req = %i %i\n", w, h);
481 evas_object_geometry_get(gc->o_container, NULL, NULL, &ww, &hh); 499 evas_object_geometry_get(gc->o_container, NULL, NULL, &ww, &hh);
482 switch (gc->orient) 500 switch (gc->orient)
483 { 501 {
@@ -537,7 +555,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
537 if (!es->fit_size) nw = es->w; 555 if (!es->fit_size) nw = es->w;
538 if (nw > es->zone->w) nw = es->zone->w; 556 if (nw > es->zone->w) nw = es->zone->w;
539 if (nh > es->zone->h) nh = es->zone->h; 557 if (nh > es->zone->h) nh = es->zone->h;
540 if (nh != es->h) ny = es->y + ((es->h - nh) / 2); 558 if (nh != es->h) ny = (es->zone->h - nh) / 2;
541 nx = 0; 559 nx = 0;
542 break; 560 break;
543 case E_GADCON_ORIENT_RIGHT: 561 case E_GADCON_ORIENT_RIGHT:
@@ -545,7 +563,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
545 if (!es->fit_size) nw = es->w; 563 if (!es->fit_size) nw = es->w;
546 if (nw > es->zone->w) nw = es->zone->w; 564 if (nw > es->zone->w) nw = es->zone->w;
547 if (nh > es->zone->h) nh = es->zone->h; 565 if (nh > es->zone->h) nh = es->zone->h;
548 if (nh != es->h) ny = es->y + ((es->h - nh) / 2); 566 if (nh != es->h) ny = (es->zone->h - nh) / 2;
549 nx = es->zone->w - nw; 567 nx = es->zone->w - nw;
550 break; 568 break;
551 case E_GADCON_ORIENT_TOP: 569 case E_GADCON_ORIENT_TOP:
@@ -553,7 +571,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
553 if (!es->fit_size) nh = es->h; 571 if (!es->fit_size) nh = es->h;
554 if (nw > es->zone->w) nw = es->zone->w; 572 if (nw > es->zone->w) nw = es->zone->w;
555 if (nh > es->zone->h) nh = es->zone->h; 573 if (nh > es->zone->h) nh = es->zone->h;
556 if (nw != es->w) nx = es->x + ((es->w - nw) / 2); 574 if (nw != es->w) nx = (es->zone->w - nw) / 2;
557 ny = 0; 575 ny = 0;
558 break; 576 break;
559 case E_GADCON_ORIENT_BOTTOM: 577 case E_GADCON_ORIENT_BOTTOM:
@@ -561,7 +579,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord
561 if (!es->fit_size) nh = es->h; 579 if (!es->fit_size) nh = es->h;
562 if (nw > es->zone->w) nw = es->zone->w; 580 if (nw > es->zone->w) nw = es->zone->w;
563 if (nh > es->zone->h) nh = es->zone->h; 581 if (nh > es->zone->h) nh = es->zone->h;
564 if (nw != es->w) nx = es->x + ((es->w - nw) / 2); 582 if (nw != es->w) nx = (es->zone->w - nw) / 2;
565 ny = es->zone->h - nh; 583 ny = es->zone->h - nh;
566 break; 584 break;
567 case E_GADCON_ORIENT_CORNER_TL: 585 case E_GADCON_ORIENT_CORNER_TL:
diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h
index e6fb0cf91..17c7ff56e 100644
--- a/src/bin/e_shelf.h
+++ b/src/bin/e_shelf.h
@@ -34,6 +34,7 @@ struct _E_Shelf
34EAPI int e_shelf_init(void); 34EAPI int e_shelf_init(void);
35EAPI int e_shelf_shutdown(void); 35EAPI int e_shelf_shutdown(void);
36EAPI void e_shelf_config_init(void); 36EAPI void e_shelf_config_init(void);
37EAPI Evas_List *e_shelf_list(void);
37EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer); 38EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer);
38EAPI void e_shelf_populate(E_Shelf *es); 39EAPI void e_shelf_populate(E_Shelf *es);
39EAPI void e_shelf_show(E_Shelf *es); 40EAPI void e_shelf_show(E_Shelf *es);
diff --git a/src/modules/battery/Makefile.am b/src/modules/battery/Makefile.am
index c8225ec4e..82dbe63b0 100644
--- a/src/modules/battery/Makefile.am
+++ b/src/modules/battery/Makefile.am
@@ -21,8 +21,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
21pkg_LTLIBRARIES = module.la 21pkg_LTLIBRARIES = module.la
22module_la_SOURCES = e_mod_main.c \ 22module_la_SOURCES = e_mod_main.c \
23 e_mod_main.h \ 23 e_mod_main.h \
24 e_mod_config.c \ 24 e_mod_config.c
25 e_mod_config.h
26module_la_LIBADD = @e_libs@ @cf_libs@ @dlopen_libs@ 25module_la_LIBADD = @e_libs@ @cf_libs@ @dlopen_libs@
27module_la_LDFLAGS = -module -avoid-version 26module_la_LDFLAGS = -module -avoid-version
28module_la_DEPENDENCIES = $(top_builddir)/config.h 27module_la_DEPENDENCIES = $(top_builddir)/config.h
diff --git a/src/modules/battery/e_mod_config.c b/src/modules/battery/e_mod_config.c
index 3e5a3d6d9..7199a7a85 100644
--- a/src/modules/battery/e_mod_config.c
+++ b/src/modules/battery/e_mod_config.c
@@ -1,7 +1,5 @@
1#include "e.h" 1#include "e.h"
2#include "e_mod_main.h" 2#include "e_mod_main.h"
3#include "e_mod_config.h"
4#include "config.h"
5 3
6struct _E_Config_Dialog_Data 4struct _E_Config_Dialog_Data
7{ 5{
@@ -19,7 +17,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas,
19static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); 17static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
20 18
21void 19void
22_config_battery_module(E_Container *con, Battery *bat) 20_config_battery_module(void)
23{ 21{
24 E_Config_Dialog *cfd; 22 E_Config_Dialog *cfd;
25 E_Config_Dialog_View *v; 23 E_Config_Dialog_View *v;
@@ -33,15 +31,18 @@ _config_battery_module(E_Container *con, Battery *bat)
33 v->advanced.apply_cfdata = _advanced_apply_data; 31 v->advanced.apply_cfdata = _advanced_apply_data;
34 v->advanced.create_widgets = _advanced_create_widgets; 32 v->advanced.create_widgets = _advanced_create_widgets;
35 33
36 cfd = e_config_dialog_new(con, _("Battery Configuration"), NULL, 0, v, bat); 34 cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
37 bat->config_dialog = cfd; 35 _("Battery Monitor Configuration"),
36 NULL, 0, v, NULL);
37 battery_config->config_dialog = cfd;
38} 38}
39 39
40static void 40static void
41_fill_data(Battery *b, E_Config_Dialog_Data *cfdata) 41_fill_data(E_Config_Dialog_Data *cfdata)
42{ 42{
43 cfdata->alarm_time = b->conf->alarm; 43 if (!battery_config) return;
44 cfdata->poll_time = b->conf->poll_time; 44 cfdata->alarm_time = battery_config->alarm;
45 cfdata->poll_time = battery_config->poll_time;
45 if (cfdata->alarm_time > 0) 46 if (cfdata->alarm_time > 0)
46 cfdata->show_alert = 1; 47 cfdata->show_alert = 1;
47 else 48 else
@@ -52,21 +53,17 @@ static void *
52_create_data(E_Config_Dialog *cfd) 53_create_data(E_Config_Dialog *cfd)
53{ 54{
54 E_Config_Dialog_Data *cfdata; 55 E_Config_Dialog_Data *cfdata;
55 Battery *b;
56 56
57 b = cfd->data;
58 cfdata = E_NEW(E_Config_Dialog_Data, 1); 57 cfdata = E_NEW(E_Config_Dialog_Data, 1);
59 _fill_data(b, cfdata); 58 _fill_data(cfdata);
60 return cfdata; 59 return cfdata;
61} 60}
62 61
63static void 62static void
64_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) 63_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
65{ 64{
66 Battery *b; 65 if (!battery_config) return;
67 66 battery_config->config_dialog = NULL;
68 b = cfd->data;
69 b->config_dialog = NULL;
70 free(cfdata); 67 free(cfdata);
71} 68}
72 69
@@ -86,16 +83,13 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
86static int 83static int
87_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) 84_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
88{ 85{
89 Battery *b; 86 if (!battery_config) return;
90 87 if (cfdata->show_alert)
91 b = cfd->data; 88 battery_config->alarm = cfdata->alarm_time;
92 e_border_button_bindings_ungrab_all(); 89 else
93 b->conf->poll_time = 10.0; 90 battery_config->alarm = 0;
94 91 _battery_config_updated();
95 e_border_button_bindings_grab_all();
96 e_config_save_queue(); 92 e_config_save_queue();
97
98 _battery_face_cb_config_updated(b);
99 return 1; 93 return 1;
100} 94}
101 95
@@ -130,20 +124,14 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
130static int 124static int
131_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) 125_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
132{ 126{
133 Battery *b; 127 if (!battery_config) return;
134 128 battery_config->poll_time = cfdata->poll_time;
135 b = cfd->data;
136 e_border_button_bindings_ungrab_all();
137
138 b->conf->poll_time = cfdata->poll_time;
139 if (cfdata->show_alert) 129 if (cfdata->show_alert)
140 b->conf->alarm = cfdata->alarm_time; 130 battery_config->alarm = cfdata->alarm_time;
141 else 131 else
142 b->conf->alarm = 0; 132 battery_config->alarm = 0;
143 133 _battery_config_updated();
144 e_border_button_bindings_grab_all();
145 e_config_save_queue(); 134 e_config_save_queue();
146
147 _battery_face_cb_config_updated(b);
148 return 1; 135 return 1;
149} 136}
137
diff --git a/src/modules/battery/e_mod_config.h b/src/modules/battery/e_mod_config.h
deleted file mode 100644
index 8f0dbaaee..000000000
--- a/src/modules/battery/e_mod_config.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifdef E_TYPEDEFS
2#else
3#ifndef E_MOD_CONFIG_H
4#define E_MOD_CONFIG_H
5#include "e_mod_main.h"
6void _config_battery_module(E_Container *con, Battery *b);
7#endif
8#endif
diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c
index d7e32b3cb..0767d1cd9 100644
--- a/src/modules/battery/e_mod_main.c
+++ b/src/modules/battery/e_mod_main.c
@@ -3,7 +3,6 @@
3 */ 3 */
4#include "e.h" 4#include "e.h"
5#include "e_mod_main.h" 5#include "e_mod_main.h"
6#include "e_mod_config.h"
7 6
8#ifdef __FreeBSD__ 7#ifdef __FreeBSD__
9# include <sys/types.h> 8# include <sys/types.h>
@@ -14,7 +13,6 @@
14# endif 13# endif
15# include <stdio.h> 14# include <stdio.h>
16#endif 15#endif
17
18#ifdef HAVE_CFBASE_H 16#ifdef HAVE_CFBASE_H
19#include <CFBase.h> 17#include <CFBase.h>
20#include <CFNumber.h> 18#include <CFNumber.h>
@@ -25,445 +23,172 @@
25#include <ps/IOPowerSources.h> 23#include <ps/IOPowerSources.h>
26#endif 24#endif
27 25
28/* TODO List: 26/***************************************************************************/
29 * 27/**/
30 * which options should be in main menu, and which in face menu? 28/* gadcon requirements */
31 */ 29static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style);
32 30static void _gc_shutdown(E_Gadcon_Client *gcc);
33/* module private routines */ 31static void _gc_orient(E_Gadcon_Client *gcc);
34static Battery *_battery_new(); 32/* and actually define the gadcon class that this module provides (just 1) */
35static void _battery_shutdown(Battery *e); 33static const E_Gadcon_Client_Class _gadcon_class =
36static void _battery_config_menu_new(Battery *e);
37static int _battery_cb_check(void *data);
38static Status *_battery_linux_acpi_check(Battery *ef);
39static Status *_battery_linux_apm_check(Battery *ef);
40/* linux on powerbook */
41static Status *_battery_linux_powerbook_check(Battery *ef);
42/* Should these be #ifdef'd ? */
43#ifdef __FreeBSD__
44static Status *_battery_bsd_acpi_check(Battery *ef);
45static Status *_battery_bsd_apm_check(Battery *ef);
46#endif
47
48#ifdef HAVE_CFBASE_H
49static Status *_battery_darwin_check(Battery *ef);
50#endif
51
52static Battery_Face *_battery_face_new(Battery *bat, E_Container *con);
53static void _battery_face_free(Battery_Face *ef);
54static void _battery_face_menu_new(Battery_Face *face);
55static void _battery_face_enable(Battery_Face *face);
56static void _battery_face_disable(Battery_Face *face);
57static void _battery_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change);
58static void _battery_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
59static void _battery_face_level_set(Battery_Face *ef, double level);
60static void _battery_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
61
62static int _battery_int_get(char *buf);
63static char *_battery_string_get(char *buf);
64
65static void _battery_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
66
67static E_Config_DD *conf_edd;
68static E_Config_DD *conf_face_edd;
69
70static int battery_count;
71
72/* public module routines. all modules must have these */
73EAPI E_Module_Api e_modapi =
74{
75 E_MODULE_API_VERSION,
76 "Battery"
77};
78
79EAPI void *
80e_modapi_init(E_Module *m)
81{ 34{
82 Battery *e; 35 GADCON_CLIENT_CLASS_VERSION,
83 36 "battery",
84 /* actually init battery */
85 e = _battery_new();
86 m->config_menu = e->config_menu;
87 return e;
88}
89
90EAPI int
91e_modapi_shutdown(E_Module *m)
92{
93 Battery *e;
94 if (m->config_menu)
95 m->config_menu = NULL;
96
97 e = m->data;
98 if (e)
99 { 37 {
100 if (e->config_dialog) 38 _gc_init, _gc_shutdown, _gc_orient
101 {
102 e_object_del(E_OBJECT(e->config_dialog));
103 e->config_dialog = NULL;
104 }
105 _battery_shutdown(e);
106 }
107 return 1;
108}
109
110EAPI int
111e_modapi_save(E_Module *m)
112{
113 Battery *e;
114
115 e = m->data;
116 e_config_domain_save("module.battery", conf_edd, e->conf);
117 return 1;
118}
119
120EAPI int
121e_modapi_info(E_Module *m)
122{
123 char buf[4096];
124
125 snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m));
126 m->icon_file = strdup(buf);
127 return 1;
128}
129
130EAPI int
131e_modapi_about(E_Module *m)
132{
133 e_module_dialog_show(_("Enlightenment Battery Module"),
134 _("A basic battery meter that uses either"
135 "<hilight>ACPI</hilight> or <hilight>APM</hilight><br>"
136 "on Linux to monitor your battery and AC power adaptor<br>"
137 "status. This will work under Linux and FreeBSD and is only<br>"
138 "as accurate as your BIOS or kernel drivers."));
139 return 1;
140}
141
142EAPI int
143e_modapi_config(E_Module *m)
144{
145 Battery *e;
146 Evas_List *l;
147
148 e = m->data;
149 if (!e) return 0;
150 if (!e->faces) return 0;
151 for (l = e->faces; l; l = l->next)
152 {
153 Battery_Face *face;
154 face = l->data;
155 if (!face) return 0;
156 if (face->con == e_container_current_get(e_manager_current_get()))
157 {
158 _config_battery_module(face->con, face->battery);
159 break;
160 }
161 }
162 return 1;
163}
164
165/* module private routines */
166static Battery *
167_battery_new()
168{
169 Battery *e;
170 Evas_List *managers, *l, *l2, *cl;
171
172 E_Menu_Item *mi;
173
174 battery_count = 0;
175 e = E_NEW(Battery, 1);
176 if (!e) return NULL;
177
178 conf_face_edd = E_CONFIG_DD_NEW("Battery_Config_Face", Config_Face);
179#undef T
180#undef D
181#define T Config_Face
182#define D conf_face_edd
183 E_CONFIG_VAL(D, T, enabled, UCHAR);
184
185 conf_edd = E_CONFIG_DD_NEW("Battery_Config", Config);
186#undef T
187#undef D
188#define T Config
189#define D conf_edd
190 E_CONFIG_VAL(D, T, poll_time, DOUBLE);
191 E_CONFIG_VAL(D, T, alarm, INT);
192 E_CONFIG_LIST(D, T, faces, conf_face_edd);
193
194 e->conf = e_config_domain_load("module.battery", conf_edd);
195 if (!e->conf)
196 {
197 e->conf = E_NEW(Config, 1);
198 e->conf->poll_time = 30.0;
199 e->conf->alarm = 30;
200 }
201 E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0);
202 E_CONFIG_LIMIT(e->conf->alarm, 0, 60);
203
204 _battery_config_menu_new(e);
205
206 e->battery_check_mode = CHECK_NONE;
207 e->battery_prev_drain = 1;
208 e->battery_prev_ac = -1;
209 e->battery_prev_battery = -1;
210 e->battery_check_timer = ecore_timer_add(e->conf->poll_time, _battery_cb_check, e);
211
212 managers = e_manager_list();
213 cl = e->conf->faces;
214 for (l = managers; l; l = l->next)
215 {
216 E_Manager *man;
217
218 man = l->data;
219 for (l2 = man->containers; l2; l2 = l2->next)
220 {
221 E_Container *con;
222 Battery_Face *ef;
223
224 con = l2->data;
225 ef = _battery_face_new(e, con);
226 if (ef)
227 {
228 ef->battery = e;
229 e->faces = evas_list_append(e->faces, ef);
230
231 /* Config */
232 if (!cl)
233 {
234 ef->conf = E_NEW(Config_Face, 1);
235 ef->conf->enabled = 1;
236 e->conf->faces = evas_list_append(e->conf->faces, ef->conf);
237 }
238 else
239 {
240 ef->conf = cl->data;
241 cl = cl->next;
242 }
243
244 /* Menu */
245 /* This menu must be initialized after conf */
246 _battery_face_menu_new(ef);
247
248 /* Add main menu to face menu */
249 mi = e_menu_item_new(e->config_menu);
250 e_menu_item_label_set(mi, _("Configuration"));
251 e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
252 e_menu_item_callback_set(mi, _battery_face_cb_menu_configure, ef);
253
254 mi = e_menu_item_new(e->config_menu);
255 e_menu_item_label_set(mi, con->name);
256 e_menu_item_submenu_set(mi, ef->menu);
257
258 /* Setup */
259 if (!ef->conf->enabled)
260 _battery_face_disable(ef);
261 }
262 }
263 } 39 }
40};
41/**/
42/***************************************************************************/
264 43
265 _battery_cb_check(e); 44/***************************************************************************/
45/**/
46/* actual module specifics */
266 47
267 return e; 48typedef struct _Instance Instance;
268}
269 49
270static void 50struct _Instance
271_battery_shutdown(Battery *e)
272{ 51{
273 Evas_List *l; 52 E_Gadcon_Client *gcc;
274 53 Evas_Object *o_battery;
275 E_CONFIG_DD_FREE(conf_edd); 54};
276 E_CONFIG_DD_FREE(conf_face_edd);
277
278 for (l = e->faces; l; l = l->next)
279 _battery_face_free(l->data);
280 evas_list_free(e->faces);
281
282 e_object_del(E_OBJECT(e->config_menu));
283
284 ecore_timer_del(e->battery_check_timer);
285 55
286 evas_list_free(e->conf->faces); 56static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
287 free(e->conf); 57static void _menu_cb_post(void *data, E_Menu *m);
288 free(e); 58static Status *_battery_linux_acpi_check(void);
289} 59static Status *_battery_linux_apm_check(void);
60static Status *_battery_linux_powerbook_check(void);
61#ifdef __FreeBSD__
62static Status *_battery_bsd_acpi_check(void);
63static Status *_battery_bsd_apm_check(void);
64#endif
65#ifdef HAVE_CFBASE_H
66static Status *_battery_darwin_check(void);
67#endif
68static void _battery_face_level_set(Instance *inst, double level);
69static int _battery_int_get(char *buf);
70static char *_battery_string_get(char *buf);
71static int _battery_cb_check(void *data);
72static void _battery_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
290 73
291static void 74static E_Config_DD *conf_edd = NULL;
292_battery_config_menu_new(Battery *e)
293{
294 E_Menu *mn;
295 75
296 /* Alarm */ 76Config *battery_config = NULL;
297 mn = e_menu_new();
298 e->config_menu = mn;
299}
300 77
301static Battery_Face * 78static E_Gadcon_Client *
302_battery_face_new(Battery *bat, E_Container *con) 79_gc_init(E_Gadcon *gc, char *name, char *id, char *style)
303{ 80{
304 Evas_Object *o; 81 Evas_Object *o;
305 Battery_Face *ef; 82 E_Gadcon_Client *gcc;
306 E_Gadman_Policy policy; 83 Instance *inst;
307 84
308 ef = E_NEW(Battery_Face, 1); 85 inst = E_NEW(Instance, 1);
309 if (!ef) return NULL; 86
310 87 o = edje_object_add(gc->evas);
311 ef->con = con;
312 e_object_ref(E_OBJECT(con));
313
314 evas_event_freeze(con->bg_evas);
315 o = edje_object_add(con->bg_evas);
316 ef->bat_object = o;
317
318 e_theme_edje_object_set(o, "base/theme/modules/battery", 88 e_theme_edje_object_set(o, "base/theme/modules/battery",
319 "modules/battery/main"); 89 "modules/battery/main");
320 evas_object_show(o);
321
322 o = evas_object_rectangle_add(con->bg_evas);
323 ef->event_object = o;
324 evas_object_layer_set(o, 2);
325 evas_object_repeat_events_set(o, 1);
326 evas_object_color_set(o, 0, 0, 0, 0);
327 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _battery_face_cb_mouse_down, ef);
328 evas_object_show(o);
329
330 ef->gmc = e_gadman_client_new(con->gadman);
331 e_gadman_client_domain_set(ef->gmc, "module.battery", battery_count++);
332
333 policy = E_GADMAN_POLICY_ANYWHERE |
334 E_GADMAN_POLICY_HMOVE |
335 E_GADMAN_POLICY_VMOVE |
336 E_GADMAN_POLICY_HSIZE |
337 E_GADMAN_POLICY_VSIZE;
338 e_gadman_client_policy_set(ef->gmc, policy);
339 e_gadman_client_min_size_set(ef->gmc, 4, 4);
340 e_gadman_client_max_size_set(ef->gmc, 128, 128);
341 e_gadman_client_auto_size_set(ef->gmc, 40, 40);
342 e_gadman_client_align_set(ef->gmc, 1.0, 1.0);
343 e_gadman_client_resize(ef->gmc, 40, 40);
344 e_gadman_client_change_func_set(ef->gmc, _battery_face_cb_gmc_change, ef);
345 e_gadman_client_load(ef->gmc);
346 evas_event_thaw(con->bg_evas);
347
348 return ef;
349}
350
351static void
352_battery_face_free(Battery_Face *ef)
353{
354 e_object_unref(E_OBJECT(ef->con));
355 e_object_del(E_OBJECT(ef->gmc));
356 e_object_del(E_OBJECT(ef->menu));
357 evas_object_del(ef->bat_object);
358 evas_object_del(ef->event_object);
359
360 free(ef->conf);
361 free(ef);
362 battery_count--;
363}
364
365static void
366_battery_face_menu_new(Battery_Face *face)
367{
368 E_Menu *mn;
369 E_Menu_Item *mi;
370
371 mn = e_menu_new();
372 face->menu = mn;
373
374 /* Config */
375 mi = e_menu_item_new(mn);
376 e_menu_item_label_set(mi, _("Configuration"));
377 e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
378 e_menu_item_callback_set(mi, _battery_face_cb_menu_configure, face);
379 90
380 /* Edit */ 91 gcc = e_gadcon_client_new(gc, name, id, style, o);
381 mi = e_menu_item_new(mn); 92 gcc->data = inst;
382 e_menu_item_label_set(mi, _("Edit Mode")); 93
383 e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets"); 94 inst->gcc = gcc;
384 e_menu_item_callback_set(mi, _battery_face_cb_menu_edit, face); 95 inst->o_battery = o;
96
97 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
98 _button_cb_mouse_down, inst);
99 battery_config->instances = evas_list_append(battery_config->instances, inst);
100 battery_config->battery_check_mode = CHECK_NONE;
101 battery_config->battery_prev_drain = 1;
102 battery_config->battery_prev_ac = -1;
103 battery_config->battery_prev_battery = -1;
104 _battery_cb_check(NULL);
105 return gcc;
385} 106}
386 107
387static void 108static void
388_battery_face_enable(Battery_Face *face) 109_gc_shutdown(E_Gadcon_Client *gcc)
389{ 110{
390 face->conf->enabled = 1; 111 Instance *inst;
391 evas_object_show(face->bat_object); 112
392 evas_object_show(face->event_object); 113 inst = gcc->data;
393 e_config_save_queue(); 114 battery_config->instances = evas_list_remove(battery_config->instances, inst);
115 evas_object_del(inst->o_battery);
116 free(inst);
394} 117}
395 118
396static void 119static void
397_battery_face_disable(Battery_Face *face) 120_gc_orient(E_Gadcon_Client *gcc)
398{ 121{
399 face->conf->enabled = 0; 122 Instance *inst;
400 evas_object_hide(face->bat_object); 123
401 evas_object_hide(face->event_object); 124 inst = gcc->data;
402 e_config_save_queue(); 125 e_gadcon_client_aspect_set(gcc, 16, 16);
126 e_gadcon_client_min_size_set(gcc, 16, 16);
403} 127}
128/**/
129/***************************************************************************/
404 130
131/***************************************************************************/
132/**/
405static void 133static void
406_battery_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) 134_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
407{ 135{
408 Battery_Face *ef; 136 Instance *inst;
409 Evas_Coord x, y, w, h; 137 Evas_Event_Mouse_Down *ev;
410 138
411 ef = data; 139 inst = data;
412 switch (change) 140 ev = event_info;
141 if ((ev->button == 3) && (!battery_config->menu))
413 { 142 {
414 case E_GADMAN_CHANGE_MOVE_RESIZE: 143 E_Menu *mn;
415 e_gadman_client_geometry_get(ef->gmc, &x, &y, &w, &h); 144 E_Menu_Item *mi;
416 evas_object_move(ef->bat_object, x, y); 145 int cx, cy, cw, ch;
417 evas_object_move(ef->event_object, x, y); 146
418 evas_object_resize(ef->bat_object, w, h); 147 mn = e_menu_new();
419 evas_object_resize(ef->event_object, w, h); 148 e_menu_post_deactivate_callback_set(mn, _menu_cb_post, inst);
420 break; 149 battery_config->menu = mn;
421 case E_GADMAN_CHANGE_RAISE: 150
422 evas_object_raise(ef->bat_object); 151 mi = e_menu_item_new(mn);
423 evas_object_raise(ef->event_object); 152 e_menu_item_label_set(mi, _("Configuration"));
424 break; 153 e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
425 case E_GADMAN_CHANGE_EDGE: 154 e_menu_item_callback_set(mi, _battery_face_cb_menu_configure, NULL);
426 case E_GADMAN_CHANGE_ZONE: 155
427 /* FIXME 156 e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
428 * Must we do something here? 157
429 */ 158 e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
430 break; 159 &cx, &cy, &cw, &ch);
160 e_menu_activate_mouse(mn,
161 e_util_zone_current_get(e_manager_current_get()),
162 cx + ev->output.x, cy + ev->output.y, 1, 1,
163 E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
164 evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
165 EVAS_BUTTON_NONE, ev->timestamp, NULL);
431 } 166 }
432} 167}
433 168
434static void 169static void
435_battery_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) 170_menu_cb_post(void *data, E_Menu *m)
436{ 171{
437 Evas_Event_Mouse_Down *ev; 172 if (!battery_config->menu) return;
438 Battery_Face *ef; 173 e_object_del(E_OBJECT(battery_config->menu));
439 174 battery_config->menu = NULL;
440 ev = event_info;
441 ef = data;
442 if (ev->button == 3)
443 {
444 e_menu_activate_mouse(ef->menu, e_zone_current_get(ef->con),
445 ev->output.x, ev->output.y, 1, 1,
446 E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
447 e_util_container_fake_mouse_up_all_later(ef->con);
448 }
449} 175}
450 176
451static int 177static int
452_battery_cb_check(void *data) 178_battery_cb_check(void *data)
453{ 179{
454 Battery *ef; 180 Instance *inst;
455 Battery_Face *face;
456 Evas_List *l;
457 Status *ret = NULL; 181 Status *ret = NULL;
458 182 Evas_List *l;
459 ef = data;
460#ifdef __FreeBSD__ 183#ifdef __FreeBSD__
461 int acline; 184 int acline;
462 size_t len; 185 size_t len;