From fbd972cdb9542663483c2f221e5424aebd286839 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 20 Apr 2006 11:30:25 +0000 Subject: [PATCH] e packages build again - also not much point having an enlightenment-data as it's built as an arch specific package and it is intrinsically required by e and cannot work without it nor is the data shared betwene e and other apps unless e itself is installed too SVN revision: 22260 --- Makefile.am | 2 +- data/themes/default_battery.edc | 50 +- data/themes/default_clock.edc | 202 +- data/themes/default_ibar.edc | 47 +- data/themes/default_pager.edc | 70 +- data/themes/images/e17_clock_bg.png | Bin 6685 -> 10270 bytes data/themes/images/e17_clock_fg.png | Bin 21301 -> 17026 bytes debian/control | 15 +- debian/enlightenment-data.install | 2 - debian/enlightenment.install | 4 - src/bin/e_border.c | 15 + src/bin/e_config.c | 143 +- src/bin/e_config.h | 3 +- src/bin/e_dnd.c | 5 + src/bin/e_gadcon.c | 916 ++++-- src/bin/e_gadcon.h | 32 +- src/bin/e_includes.h | 1 + src/bin/e_main.c | 3 +- src/bin/e_place.c | 497 ++- src/bin/e_popup.c | 17 +- src/bin/e_resist.c | 32 +- src/bin/e_shelf.c | 28 +- src/bin/e_shelf.h | 1 + src/modules/battery/Makefile.am | 3 +- src/modules/battery/e_mod_config.c | 60 +- src/modules/battery/e_mod_config.h | 8 - src/modules/battery/e_mod_main.c | 879 ++---- src/modules/battery/e_mod_main.h | 57 +- src/modules/clock/Makefile.am | 4 +- src/modules/clock/e_mod_config.c | 99 - src/modules/clock/e_mod_config.h | 8 - src/modules/clock/e_mod_main.c | 480 +-- src/modules/clock/e_mod_main.h | 44 - src/modules/cpufreq/e_mod_main.c | 1961 ++++++------ src/modules/cpufreq/e_mod_main.h | 69 +- src/modules/dropshadow/e_mod_main.c | 2 +- src/modules/ibar/Makefile.am | 3 +- src/modules/ibar/e_mod_config.c | 181 +- src/modules/ibar/e_mod_config.h | 8 - src/modules/ibar/e_mod_main.c | 2427 ++++++--------- src/modules/ibar/e_mod_main.h | 91 +- src/modules/pager/Makefile.am | 3 +- src/modules/pager/e_mod_config.c | 117 +- src/modules/pager/e_mod_config.h | 8 - src/modules/pager/e_mod_main.c | 3920 +++++++++++------------- src/modules/pager/e_mod_main.h | 139 +- src/modules/start/e_mod_main.c | 32 +- src/modules/start/e_mod_main.h | 4 +- src/modules/temperature/Makefile.am | 3 +- src/modules/temperature/e_mod_config.c | 112 +- src/modules/temperature/e_mod_config.h | 8 - src/modules/temperature/e_mod_main.c | 515 ++-- src/modules/temperature/e_mod_main.h | 43 +- 53 files changed, 5725 insertions(+), 7648 deletions(-) delete mode 100644 debian/enlightenment-data.install delete mode 100644 src/modules/battery/e_mod_config.h delete mode 100644 src/modules/clock/e_mod_config.c delete mode 100644 src/modules/clock/e_mod_config.h delete mode 100644 src/modules/ibar/e_mod_config.h delete mode 100644 src/modules/pager/e_mod_config.h delete mode 100644 src/modules/temperature/e_mod_config.h 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 EXTRA_DIST = README AUTHORS COPYING COPYING-PLAIN enlightenment.spec \ debian/changelog debian/changelog.in debian/copyright \ debian/rules debian/enlightenment.install \ - debian/enlightenment.docs debian/enlightenment-data.install \ + debian/enlightenment.docs \ debian/libe.install debian/libe-dev.install debian/control \ enlightenment.spec.in 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 @@ -114,6 +114,31 @@ group { } } } + part { + name: "ac"; + clip_to: "fade_clip"; + description { + state: "default" 0.0; + aspect: 0.975609756 0.975609756; + align: 1.0 1.0; + max: 40 41; + visible: 0; + rel1 { + relative: 0.5 0.5; + } + rel2 { + relative: 1.0 1.0; + } + image { + normal: "e17_battery_ac.png"; + } + } + description { + state: "active" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } part { name: "reading"; type: TEXT; @@ -170,31 +195,6 @@ group { } } } - part { - name: "ac"; - clip_to: "fade_clip"; - description { - state: "default" 0.0; - aspect: 0.975609756 0.975609756; - align: 1.0 1.0; - max: 40 41; - visible: 0; - rel1 { - relative: 0.5 0.5; - } - rel2 { - relative: 1.0 1.0; - } - image { - normal: "e17_battery_ac.png"; - } - } - description { - state: "active" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } part { name: "fade_clip"; type: RECT; 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 @@ images { image: "e17_clock_bg.png" COMP; image: "e17_clock_fg.png" COMP; - image: "e17_ibar_over_h.png" COMP; - image: "e17_ibar_bg_h.png" COMP; image: "e17_clock_seconds_00.png" COMP; image: "e17_clock_seconds_01.png" COMP; image: "e17_clock_seconds_02.png" COMP; @@ -189,24 +187,10 @@ group { script { public clock_cb(val) { new buf[11]; - new digitalVal[15]; - new hourStr[4], minuteStr[4], secondStr[4]; new year, month, day, yearday, weekday, hour, minute; new Float:second; new v; - new isAfternoon; - new digiBuf[2]; - new digitalStyle; - new DIGITAL_STYLE_NONE, DIGITAL_STYLE_NORMAL, DIGITAL_STYLE_24HOUR; - - DIGITAL_STYLE_NONE = 0; - DIGITAL_STYLE_NORMAL = 1; - DIGITAL_STYLE_24HOUR = 2; - - get_text(PART:"digitalStyle", digiBuf, 2); - - digitalStyle = atoi(digiBuf); - + date(year, month, day, yearday, weekday, hour, minute, second); v = round(second); #if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA @@ -216,7 +200,6 @@ group { #endif #if E17_PROFILE != HIRES_PDA && E17_PROFILE != LOWRES_PDA && E17_PROFILE != MEDIUMRES_PDA buf[0] = 0; - digitalVal[0] = 0; if (v < 10) {snprintf(buf, 10, "0%i", v);} else {snprintf(buf, 10, "%i", v);} set_state(PART:"seconds", buf, 0.0); @@ -232,59 +215,6 @@ group { if (v < 10) {snprintf(buf, 10, "0%i", v);} else {snprintf(buf, 10, "%i", v);} set_state(PART:"hour", buf, 0.0); - - - buf[0] = 0; - v = round(second); - if (v < 10) {snprintf(buf, 10, "0%i", v);} - else {snprintf(buf, 10, "%i", v);} - snprintf(secondStr, 3, "%s", buf); - - buf[0] = 0; - if (minute < 10) {snprintf(buf, 10, "0%i", minute);} - else {snprintf(buf, 10, "%i", minute);} - snprintf(minuteStr, 3, "%s", buf); - - buf[0] = 0; - isAfternoon = 0; - v = hour; - if (hour >= 12 && hour < 24) { isAfternoon = 1; } - if (digitalStyle == DIGITAL_STYLE_NORMAL) { - v = (v % 12); - if (v == 0) { v = 12; } - } - if (digitalStyle == DIGITAL_STYLE_24HOUR && v < 10) { - snprintf(buf, 10, "0%i", v); - } else { - snprintf(buf, 10, "%i", v); - } - snprintf(hourStr, 3, "%s", buf); - - buf[0] = 0; - - if (isAfternoon == 1) { - snprintf(buf, 10, "PM"); - } else { - snprintf(buf, 10, "AM"); - } - - if (digitalStyle != DIGITAL_STYLE_NONE) { - if (digitalStyle == DIGITAL_STYLE_NORMAL) { - snprintf(digitalVal, 14, "%s:%s:%s %s", hourStr, minuteStr, secondStr, buf); - } else if (digitalStyle == DIGITAL_STYLE_24HOUR) { - snprintf(digitalVal, 14, " %s:%s:%s ", hourStr, minuteStr, secondStr); - } - - set_text(PART:"digital", digitalVal); - set_state(PART:"digital", "digital", 0.0); - set_state(PART:"digital_bg", "digital", 0.0); - set_state(PART:"digital_bg_overlay", "digital", 0.0); - } else { - set_text(PART:"digital", ""); - set_state(PART:"digital", "hidden", 0.0); - set_state(PART:"digital_bg", "hidden", 0.0); - set_state(PART:"digital_bg_overlay", "hidden", 0.0); - } } } parts { @@ -310,10 +240,10 @@ group { state: "default" 0.0; aspect: 1.0 1.0; rel1 { - relative: 0.1 0.1; + relative: 0.05 0.05; } rel2 { - relative: 0.9 0.9; + relative: 0.95 0.95; } image { normal: "e17_clock_"IND"_00.png"; @@ -403,10 +333,10 @@ group { state: "default" 0.0; aspect: 1.0 1.0; rel1 { - relative: 0.1 0.1; + relative: 0.05 0.05; } rel2 { - relative: 0.9 0.9; + relative: 0.95 0.95; } image { normal: "e17_clock_"IND"_00.png"; @@ -495,10 +425,10 @@ group { state: "default" 0.0; aspect: 1.0 1.0; rel1 { - relative: 0.2 0.2; + relative: 0.1 0.1; } rel2 { - relative: 0.8 0.8; + relative: 0.9 0.9; } image { normal: "e17_clock_"IND"_00.png"; @@ -592,124 +522,6 @@ group { } } } - part { - name: "digital_bg_area"; - type: "RECT"; - mouse_events: 0; - description { - state: "default" 0.0; - min: 16 16; - rel1 { - relative: 0.0 0.8; - } - rel2 { - relative: 1.0 1.0; - } - visible: 0; - } - } - part { - name: "digital_bg_overlay"; - mouse_events: 0; - description { - state: "default" 0.0; - rel1 { - to: "digital_bg_area"; - relative: 0.0 0.0; - } - rel2 { - to: "digital_bg_area"; - relative: 1.0 1.0; - } - image { - normal: "e17_ibar_over_h.png"; - border: 13 13 13 13; - } - fill { - smooth: 0; - } - color: 255 255 255 192; - } - description { - state: "hidden" 0.0; - visible: 0; - image { - normal: "e17_ibar_over_h.png"; - border: 13 13 13 13; - middle: 0; - } - } - } - part { - name: "digital_bg"; - mouse_events: 0; - description { - state: "default" 0.0; - rel1 { - to: "digital_bg_area"; - relative: 0.0 0.0; - } - rel2 { - to: "digital_bg_area"; - relative: 1.0 1.0; - } - image { - normal: "e17_ibar_bg_h.png"; - border: 6 6 6 6; - } - fill { - smooth: 0; - } - color: 255 255 255 128; - } - description { - state: "hidden" 0.0; - visible: 0; - image { - normal: "e17_ibar_bg_h.png"; - border: 6 6 6 6; - middle: 0; - } - } - } - part { - name: "digital"; - type: TEXT; - effect: SOFT_SHADOW; - description { - state: "default" 0.0; - rel1 { - to: "digital_bg_area"; - offset: 3 4; - } - rel2 { - to: "digital_bg_area"; - offset: -2 -2; - } - color: 255 255 255 255; - color3: 0 0 0 32; - text { - text: "00:00:00 AM"; - font: "Edje-Vera"; - size: 15; - fit: 0 1; - align: 0.5 0.5; - text_class: "clock"; - } - } - description { - state: "hidden" 0.0; - visible: 0; - } - } - part { - name: "digitalStyle"; - type: TEXT; - description { - state: "hidden" 0.0; - visible: 0; - } - } } programs { 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,17 +621,54 @@ group { state: "default" 0.0; rel1 { relative: 0.0 0.0; - offset: 4 4; + offset: 2 2; } rel2 { relative: 1.0 1.0; - offset: -5 -5; + offset: -3 -3; } color: 0 0 0 0; } + description { + state: "bigger" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + part { + name: "over"; + type: RECT; + repeat_events: 0; + description { + state: "default" 0.0; + color: 0 0 0 0; + } } } programs { + program { + name: "hover_in"; + signal: "mouse,in"; + source: "over"; + action: STATE_SET "bigger" 0.0; + transition: LINEAR 0.1; + target: "item"; + } + program { + name: "hover_out"; + signal: "mouse,out"; + source: "over"; + action: STATE_SET "default" 0.0; + transition: LINEAR 0.2; + target: "item"; + } program { name: "exec_start"; signal: "start"; @@ -671,12 +708,6 @@ group { mouse_events: 0; description { state: "default" 0.0; - rel1 { - offset: 4 4; - } - rel2 { - offset: -5 -5; - } color: 255 255 255 0; } } 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 { } } part { - name: "pager"; + name: "background"; mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + to: "overlay"; + } + rel2 { + to: "overlay"; + } + image { + normal: "e17_ibar_bg_h.png"; + border: 6 6 6 6; + } + fill { + smooth: 0; + } + } + } + part { + name: "items_clip"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + to: "background"; + offset: 4 4; + } + rel2 { + to: "background"; + offset: -5 -5; + } + color: 255 255 255 255; + } + } + part { + name: "pager"; type: SWALLOW; - description { + mouse_events: 0; + clip_to: "items_clip"; + description { + state: "default" 0.0; + rel1 { + to: "overlay"; + offset: 4 4; + } + rel2 { + to: "overlay"; + offset: -5 -5; + } + color: 0 0 0 0; + } + } + part { + name: "overlay"; + mouse_events: 0; + description { state: "default" 0.0; rel1 { to_y: "title_overlay"; @@ -165,7 +219,14 @@ group { relative: 1.0 1.0; offset: -17 -17; } - color: 0 0 0 0; + image { + normal: "e17_ibar_over_h.png"; + border: 13 13 13 13; + middle: 0; + } + fill { + smooth: 0; + } } } } @@ -377,7 +438,8 @@ group { } part { name: "overlay"; - mouse_events: 0; + repeat_events: 1; +// mouse_events: 0; description { state: "default" 0.0; rel1 { diff --git a/data/themes/images/e17_clock_bg.png b/data/themes/images/e17_clock_bg.png index a1ac3ed767bbd7ae9029e21fbc31a5f8d523cfe8..d766d1327b630ee1594824985e26b38c2c9269f7 100644 GIT binary patch literal 10270 zcmV+(DB;(MP)JY z0A>feN^JlD010qNS#tmY3ljhU3ljkVnw%H_000McNliru)&vI!HYzs^h0Oo}AOJ~3 zK~#9!?R`&(=2yAq^OR$d0U0-f)m7=Xa~&t0bf>!edZh=!%>}a%geZ)f+2}^m-iU}G zToG4-TrO@Bx!GJdw{-#zw=df z`hTnvOj2E4-}n8_d)`0K`@GK!9DE&o9ef>p9en+je(}xtp;oKay8s*m@Lmu{Ashy< zN${P5-U0CKB;F?Bt=xSAe*y4k0Dl7T2LQhZ@EU;M68N>iD*#^n+rK^iy8{Eb`wsgp z06qxd0|4F+;55K3K<*P#1gQQEr4P^X54ArPNJ0=G0>D)g&jb1yz@Gy6$?4OlUq3K_ z+kfcq0q|h}j{^960QZfLA`sj?VEgHoGvwqcaQQ=F*G@z&CIE2$n682NF@+xq_~Gf( zr(ZcRfLnLy+WzjY$_{nDg zedpAv)Bkp00B`Kz&jR=yfQQqYUR?F=*$j7I#r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Z_D(0O#!`%jXgd7(*pd{E&$;eL7kE%g`thy zLa_h? z7l5!;*h(NGij|O;3VamJI}Nmu05tj^>2k5bK(f(HOOrf=tpFEzMmC;2ivsW -Build-Depends: libevas-dev, libecore-dev, libeet-dev, libedje-dev, edje-bin, libembryo-dev, xlibs-dev, automake1.7 | automaken, libtool, debhelper (>= 4.0) +Build-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) Standards-Version: 3.6.2.2 Package: enlightenment @@ -10,24 +10,13 @@ Architecture: any Section: x11 Recommends: libevas-engine-xrender Suggests: entrance -Depends: ${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 +Depends: ${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 Description: Enlightenment themes, etc. Enlightenment is an advanced window manager for X11. Unique features include: a fully animated background, nice drop shadows around windows, backed by an extremely clean and optimized foundation of APIs. -Package: enlightenment-data -Architecture: any -Section: x11 -Depends: enlightenment (= ${Source-Version}) -Conflicts: enlightenment-data (< 0.16.999) -Description: Enlightenment themes, etc. - Enlightenment is an advanced window manager for X11. Unique - features include: a fully animated background, nice drop shadows - around windows, a unique application launcher module (ibar). All - backed by an extremely clean and optimized foundation of APIs. - Package: libe Section: libs Architecture: 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 @@ -debian/tmp/usr/share/enlightenment/data/themes/*.edj -debian/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 debian/tmp/usr/lib/enlightenment/modules/temperature/*/*.so debian/tmp/usr/lib/enlightenment/modules/temperature/*.png debian/tmp/usr/share/enlightenment -debian/tmp/usr/share/enlightenment -debian/tmp/usr/share/enlightenment -debian/tmp/usr/share/enlightenment -debian/tmp/usr/share/enlightenment debian/tmp/usr/share/locale debian/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) changed = 0; for (i = 0; i < num; i++) { + if (rects[i].x < 0) + { + rects[i].width -= rects[i].x; + rects[i].x = 0; + } + if ((rects[i].x + rects[i].width) > bd->w) + rects[i].width = rects[i].width - rects[i].x; + if (rects[i].y < 0) + { + rects[i].height -= rects[i].y; + rects[i].y = 0; + } + if ((rects[i].y + rects[i].height) > bd->h) + rects[i].height = rects[i].height - rects[i].y; + if ((orects[i].x != rects[i].x) || (orects[i].y != rects[i].y) || (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) E_CONFIG_VAL(D, T, geom.res, INT); E_CONFIG_VAL(D, T, style, STR); E_CONFIG_VAL(D, T, autoscroll, UCHAR); + E_CONFIG_VAL(D, T, resizable, UCHAR); _e_config_gadcon_edd = E_CONFIG_DD_NEW("E_Config_Gadcon", E_Config_Gadcon); #undef T @@ -1016,71 +1017,111 @@ e_config_init(void) "desk_linear_flip_by", "1"); } IFCFGEND; - /* yes - this causes a small leak - i know. it is for testing temporarily x*/ + IFCFG(0x0093); /* the version # where this value(s) was introduced */ + /* FIXME: wipe previous shelves and gadcons - remove this eventually */ e_config->shelves = NULL; e_config->gadcons = NULL; -// IFCFG(0x008e); /* the version # where this value(s) was introduced */ -#if 1 // this is liable to change { E_Config_Shelf *cf_es; - cf_es = E_NEW(E_Config_Shelf, 1); - cf_es->name = evas_stringshare_add("shelf"); - cf_es->container = 0; - cf_es->zone = 0; - cf_es->popup = 1; - cf_es->layer = 200; - cf_es->orient = E_GADCON_ORIENT_TOP; - cf_es->fit_along = 1; - cf_es->fit_size = 0; - cf_es->style = evas_stringshare_add("default"); - cf_es->size = 40; - e_config->shelves = evas_list_append(e_config->shelves, cf_es); +#define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size) \ + cf_es = E_NEW(E_Config_Shelf, 1); \ + cf_es->name = evas_stringshare_add(_name); \ + cf_es->container = _con; \ + cf_es->zone = _zone; \ + cf_es->popup = _pop; \ + cf_es->layer = _lay; \ + cf_es->orient = _orient; \ + cf_es->fit_along = _fita; \ + cf_es->fit_size = _fits; \ + cf_es->style = evas_stringshare_add(_style); \ + cf_es->size = _size; \ + e_config->shelves = evas_list_append(e_config->shelves, cf_es) + /* shelves for 4 zones on head 0 by default */ + CFG_SHELF("shelf", 0, 0, + 1, 200, E_GADCON_ORIENT_BOTTOM, + 1, 0, "default", 40); + CFG_SHELF("shelf", 0, 1, + 1, 200, E_GADCON_ORIENT_BOTTOM, + 1, 0, "default", 40); + CFG_SHELF("shelf", 0, 2, + 1, 200, E_GADCON_ORIENT_BOTTOM, + 1, 0, "default", 40); + CFG_SHELF("shelf", 0, 3, + 1, 200, E_GADCON_ORIENT_BOTTOM, + 1, 0, "default", 40); + /* shelves for heada 1, 2, and 3 by default */ + CFG_SHELF("shelf", 1, 0, + 1, 200, E_GADCON_ORIENT_BOTTOM, + 1, 0, "default", 40); + CFG_SHELF("shelf", 2, 0, + 1, 200, E_GADCON_ORIENT_BOTTOM, + 1, 0, "default", 40); + CFG_SHELF("shelf", 3, 0, + 1, 200, E_GADCON_ORIENT_BOTTOM, + 1, 0, "default", 40); } { E_Config_Gadcon *cf_gc; E_Config_Gadcon_Client *cf_gcc; + +#define CFG_GADCON(_name, _id) \ + cf_gc = E_NEW(E_Config_Gadcon, 1);\ + cf_gc->name = evas_stringshare_add(_name); \ + cf_gc->id = evas_stringshare_add(_id); \ + e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc) +#define CFG_GADCON_CLIENT(_name, _id, _res, _size, _pos, _style, _autoscr, _resizable) \ + cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); \ + cf_gcc->name = evas_stringshare_add(_name); \ + cf_gcc->id = evas_stringshare_add(_id); \ + cf_gcc->geom.res = _res; \ + cf_gcc->geom.size = _size; \ + cf_gcc->geom.pos = _pos; \ + if (_style) cf_gcc->style = evas_stringshare_add(_style); \ + else cf_gcc->style = NULL; \ + cf_gcc->autoscroll = _autoscr; \ + cf_gcc->resizable = _resizable; \ + cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc) + + /* the default shelf on the default head/zone */ + CFG_GADCON("shelf", "0"); + CFG_GADCON_CLIENT("start", "default", 800, 32, + 0, NULL, 0, 0); + CFG_GADCON_CLIENT("pager", "default", 800, 120, + 32, "inset", 0, 0); + CFG_GADCON_CLIENT("ibar", "default", 800, 200, + 400 - (16 / 2), "inset", 1, 0); + CFG_GADCON_CLIENT("temperature", "default", 800, 32, + 800 - (4 * 32), NULL, 0, 0); + CFG_GADCON_CLIENT("cpufreq", "default", 800, 32, + 800 - (3 * 32), NULL, 0, 0); + CFG_GADCON_CLIENT("battery", "default", 800, 32, + 800 - (2 * 32), NULL, 0, 0); + CFG_GADCON_CLIENT("clock", "default", 800, 32, + 800 - (1 * 32), NULL, 0, 0); + /* additional shelves for up to 3 more heads by default */ + CFG_GADCON("shelf", "1"); + CFG_GADCON_CLIENT("pager", "default2", 800, 120, + 0, "inset", 0, 0); + CFG_GADCON_CLIENT("ibar", "default2", 800, 16, + 400 - (16 / 2), "inset", 1, 0); - cf_gc = E_NEW(E_Config_Gadcon, 1); - cf_gc->name = evas_stringshare_add("shelf"); - cf_gc->id = evas_stringshare_add("0"); - e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc); + CFG_GADCON("shelf", "2"); + CFG_GADCON_CLIENT("pager", "default3", 800, 120, + 0, "inset", 0, 0); + CFG_GADCON_CLIENT("ibar", "default2", 800, 16, + 400 - (16 / 2), "inset", 1, 0); - cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); - cf_gcc->name = evas_stringshare_add("ibar"); - cf_gcc->id = evas_stringshare_add("default"); - cf_gcc->geom.res = 800; - cf_gcc->geom.size = 200; - cf_gcc->geom.pos = 400 - (cf_gcc->geom.size / 2); - cf_gcc->style = evas_stringshare_add("inset"); - cf_gcc->autoscroll = 0; - cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc); - - cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); - cf_gcc->name = evas_stringshare_add("clock"); - cf_gcc->id = evas_stringshare_add("default"); - cf_gcc->geom.res = 800; - cf_gcc->geom.size = 32; - cf_gcc->geom.pos = 800 - (cf_gcc->geom.size); - cf_gcc->style = NULL; - cf_gcc->autoscroll = 0; - cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc); - - cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); - cf_gcc->name = evas_stringshare_add("start"); - cf_gcc->id = evas_stringshare_add("default"); - cf_gcc->geom.res = 800; - cf_gcc->geom.size = 32; - cf_gcc->geom.pos = 0; - cf_gcc->style = NULL; - cf_gcc->autoscroll = 0; - cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc); + CFG_GADCON("shelf", "3"); + CFG_GADCON_CLIENT("pager", "default4", 800, 120, + 0, "inset", 0, 0); + CFG_GADCON_CLIENT("ibar", "default2", 800, 16, + 400 - (16 / 2), "inset", 1, 0); } -#endif -// IFCFGEND; + IFCFGEND; #if 0 /* example of new config */ - IFCFG(0x008e); /* the version # where this value(s) was introduced */ + IFCFG(0x0090); /* the version # where this value(s) was introduced */ e_config->new_value = 10; /* set the value(s) */ IFCFGEND; #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; /* increment this whenever a new set of configvalues are added but the users * config doesn't need top be wiped - simply new values need to be put in */ -#define E_CONFIG_FILE_GENERATION 0x008e +#define E_CONFIG_FILE_GENERATION 0x0093 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION) #define E_EVAS_ENGINE_DEFAULT 0 @@ -317,6 +317,7 @@ struct _E_Config_Gadcon_Client } geom; const char *style; unsigned char autoscroll; + unsigned char resizable; }; struct _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 @@ */ #include "e.h" +/* FIXME: broken when drop areas intersect + * (sub window has drop area on top of lower window or desktop - + * also shutdown is broken (walking list and deleting from the list as u go + * in this code is broken) + */ /* * TODO: * - 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 @@ static void _e_gadcon_free(E_Gadcon *gc); static void _e_gadcon_client_free(E_Gadcon_Client *gcc); +static void _e_gadcon_movereisze_handle(E_Gadcon_Client *gcc); +static int _e_gadcon_cb_client_scroll_timer(void *data); +static int _e_gadcon_cb_client_scroll_animator(void *data); +static void _e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_gadcon_client_save(E_Gadcon_Client *gcc); +static void _e_gadcon_cb_min_size_request(void *data, Evas_Object *obj, void *event_info); static void _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info); static void _e_gadcon_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); static 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 static void _e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source); static void _e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source); static void _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_up_start(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_up_stop(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_up_go(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_down_start(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_down_stop(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_down_go(void *data, Evas_Object *obj, const char *emission, const char *source); static Evas_Object *e_gadcon_layout_add(Evas *evas); static void e_gadcon_layout_orientation_set(Evas_Object *obj, int horizontal); @@ -50,69 +50,11 @@ static void e_gadcon_layout_unpack(Evas_Object *obj); static Evas_Hash *providers = NULL; static Evas_List *gadcons = NULL; - -static E_Gadcon_Client * -__test(E_Gadcon *gc, char *name, char *id, char *style) -{ - Evas_Object *o; - E_Gadcon_Client *gcc; - - printf("create gadcon client \"%s\" \"%s\" \"%s\" for \"%s\" \"%s\"\n", - name, id, style, - gc->name, gc->id); - o = evas_object_rectangle_add(gc->evas); - evas_object_color_set(o, rand() & 0xff, rand() & 0xff, rand() & 0xff, 150); - gcc = e_gadcon_client_new(gc, name, id, style, o); - gcc->data = NULL; // this is where a module would hook private data - return gcc; -} - -static void -__test2(E_Gadcon_Client *gcc) -{ - evas_object_del(gcc->o_base); -} - -static void -__test3(E_Gadcon_Client *gcc) -{ - e_gadcon_client_min_size_set(gcc, 200, 20); -} - -static void -__test4(E_Gadcon_Client *gcc) -{ - e_gadcon_client_min_size_set(gcc, 32, 20); -} /* externally accessible functions */ EAPI int e_gadcon_init(void) { - /* FIXME: these would be provided by modules registering gadget creation - * classes */ - { - static E_Gadcon_Client_Class cc = - { - GADCON_CLIENT_CLASS_VERSION, - "ibar", - { - __test, __test2, __test3 - } - }; - e_gadcon_provider_register(&cc); - } - { - static E_Gadcon_Client_Class cc = - { - GADCON_CLIENT_CLASS_VERSION, - "clock", - { - __test, __test2, __test4 - } - }; - e_gadcon_provider_register(&cc); - } return 1; } @@ -125,12 +67,40 @@ e_gadcon_shutdown(void) EAPI void e_gadcon_provider_register(E_Gadcon_Client_Class *cc) { + Evas_List *l; + E_Gadcon *gc; + providers = evas_hash_direct_add(providers, cc->name, cc); + for (l = gadcons; l; l = l->next) + { + gc = l->data; + e_gadcon_populate_class(gc, cc); + } } EAPI void e_gadcon_provider_unregister(E_Gadcon_Client_Class *cc) { + Evas_List *l, *ll, *dlist = NULL; + E_Gadcon *gc; + E_Gadcon_Client *gcc; + + for (l = gadcons; l; l = l->next) + { + gc = l->data; + for (ll = gc->clients; ll; ll = ll->next) + { + gcc = ll->data; + if (gcc->client_class == cc) + dlist = evas_list_append(dlist, gcc); + } + } + while (dlist) + { + gcc = dlist->data; + dlist = evas_list_remove_list(dlist, dlist); + e_object_del(E_OBJECT(gcc)); + } providers = evas_hash_del(providers, cc->name, cc); } @@ -154,6 +124,8 @@ e_gadcon_swallowed_new(const char *name, char *id, Evas_Object *obj, char *swall gc->o_container = e_gadcon_layout_add(gc->evas); evas_object_smart_callback_add(gc->o_container, "size_request", _e_gadcon_cb_size_request, gc); + evas_object_smart_callback_add(gc->o_container, "min_size_request", + _e_gadcon_cb_min_size_request, gc); evas_object_show(gc->o_container); edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name, gc->o_container); @@ -172,6 +144,16 @@ e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h) } } +EAPI 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) +{ + E_OBJECT_CHECK(gc); + E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); + + gc->min_size_request.func = func; + gc->min_size_request.data = data; +} + EAPI 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) { @@ -242,7 +224,7 @@ e_gadcon_populate(E_Gadcon *gc) cf_gcc->style); if (gcc) { - gcc->client_class = *cc; + gcc->client_class = cc; gcc->config.pos = cf_gcc->geom.pos; gcc->config.size = cf_gcc->geom.size; gcc->config.res = cf_gcc->geom.res; @@ -256,8 +238,76 @@ e_gadcon_populate(E_Gadcon *gc) gcc->config.pos, gcc->config.size, gcc->config.res); - if (gcc->client_class.func.orient) - gcc->client_class.func.orient(gcc); + e_gadcon_client_autoscroll_set(gcc, cf_gcc->autoscroll); + e_gadcon_client_resizable_set(gcc, cf_gcc->resizable); + if (gcc->client_class->func.orient) + gcc->client_class->func.orient(gcc); + } + } + } + } + e_gadcon_layout_thaw(gc->o_container); +} + +EAPI void +e_gadcon_unpopulate(E_Gadcon *gc) +{ + E_OBJECT_CHECK(gc); + E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); + while (gc->clients) e_object_del(E_OBJECT(gc->clients->data)); +} + +EAPI void +e_gadcon_populate_class(E_Gadcon *gc, E_Gadcon_Client_Class *cc) +{ + Evas_List *l; + int ok; + E_Config_Gadcon *cf_gc; + E_Config_Gadcon_Client *cf_gcc; + + E_OBJECT_CHECK(gc); + E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); + ok = 0; + e_gadcon_layout_freeze(gc->o_container); + for (l = e_config->gadcons; l; l = l->next) + { + cf_gc = l->data; + if ((!strcmp(cf_gc->name, gc->name)) && + (!strcmp(cf_gc->id, gc->id))) + { + ok = 1; + break; + } + } + if (ok) + { + for (l = cf_gc->clients; l; l = l->next) + { + cf_gcc = l->data; + if (!strcmp(cf_gcc->name, cc->name)) + { + E_Gadcon_Client *gcc; + + gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id, + cf_gcc->style); + if (gcc) + { + gcc->client_class = cc; + gcc->config.pos = cf_gcc->geom.pos; + gcc->config.size = cf_gcc->geom.size; + gcc->config.res = cf_gcc->geom.res; + if (gcc->o_frame) + e_gadcon_layout_pack_options_set(gcc->o_frame, + gcc->config.pos, + gcc->config.size, + gcc->config.res); + else + e_gadcon_layout_pack_options_set(gcc->o_base, + gcc->config.pos, + gcc->config.size, + gcc->config.res); + if (gcc->client_class->func.orient) + gcc->client_class->func.orient(gcc); } } } @@ -280,8 +330,32 @@ e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient) E_Gadcon_Client *gcc; gcc = l->data; - if (gcc->client_class.func.orient) - gcc->client_class.func.orient(gcc); + if (gcc->client_class->func.orient) + gcc->client_class->func.orient(gcc); + switch (gcc->gadcon->orient) + { + case E_GADCON_ORIENT_FLOAT: + case E_GADCON_ORIENT_HORIZ: + case E_GADCON_ORIENT_TOP: + case E_GADCON_ORIENT_BOTTOM: + case E_GADCON_ORIENT_CORNER_TL: + case E_GADCON_ORIENT_CORNER_TR: + case E_GADCON_ORIENT_CORNER_BL: + case E_GADCON_ORIENT_CORNER_BR: + e_box_orientation_set(gcc->o_box, 1); + break; + case E_GADCON_ORIENT_VERT: + case E_GADCON_ORIENT_LEFT: + case E_GADCON_ORIENT_RIGHT: + case E_GADCON_ORIENT_CORNER_LT: + case E_GADCON_ORIENT_CORNER_RT: + case E_GADCON_ORIENT_CORNER_LB: + case E_GADCON_ORIENT_CORNER_RB: + e_box_orientation_set(gcc->o_box, 0); + break; + default: + break; + } } e_gadcon_layout_thaw(gc->o_container); } @@ -409,9 +483,50 @@ e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, char *style, Evas_Object style); if (gcc->o_frame) { + gcc->inset = 1; edje_object_size_min_calc(gcc->o_frame, &(gcc->pad.w), &(gcc->pad.h)); - edje_object_part_swallow(gcc->o_frame, "items", gcc->o_base); + gcc->o_box = e_box_add(gcc->gadcon->evas); + switch (gcc->gadcon->orient) + { + case E_GADCON_ORIENT_FLOAT: + case E_GADCON_ORIENT_HORIZ: + case E_GADCON_ORIENT_TOP: + case E_GADCON_ORIENT_BOTTOM: + case E_GADCON_ORIENT_CORNER_TL: + case E_GADCON_ORIENT_CORNER_TR: + case E_GADCON_ORIENT_CORNER_BL: + case E_GADCON_ORIENT_CORNER_BR: + e_box_orientation_set(gcc->o_box, 1); + break; + case E_GADCON_ORIENT_VERT: + case E_GADCON_ORIENT_LEFT: + case E_GADCON_ORIENT_RIGHT: + case E_GADCON_ORIENT_CORNER_LT: + case E_GADCON_ORIENT_CORNER_RT: + case E_GADCON_ORIENT_CORNER_LB: + case E_GADCON_ORIENT_CORNER_RB: + e_box_orientation_set(gcc->o_box, 0); + break; + default: + break; + } + evas_object_event_callback_add(gcc->o_box, EVAS_CALLBACK_MOVE, + _e_gadcon_cb_client_frame_moveresize, gcc); + evas_object_event_callback_add(gcc->o_box, EVAS_CALLBACK_RESIZE, + _e_gadcon_cb_client_frame_moveresize, gcc); + evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_MOVE, + _e_gadcon_cb_client_frame_mouse_move, gcc); + e_box_pack_end(gcc->o_box, gcc->o_base); + e_box_pack_options_set(gcc->o_base, + 1, 1, /* fill */ + 1, 1, /* expand */ + 0.5, 0.5, /* align */ + 0, 0, /* min */ + -1, -1 /* max */ + ); + edje_object_part_swallow(gcc->o_frame, "items", gcc->o_box); + evas_object_show(gcc->o_box); evas_object_show(gcc->o_frame); } } @@ -444,8 +559,18 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc) e_theme_edje_object_set(gcc->o_control, "base/theme/gadman", "gadman/control"); - edje_object_signal_emit(gcc->o_control, "hsize", "off"); - edje_object_signal_emit(gcc->o_control, "vsize", "off"); + if ((gcc->autoscroll) || (gcc->resizable)) + { + if (e_box_orientation_get(gcc->o_box)) + edje_object_signal_emit(gcc->o_control, "hsize", "on"); + else + edje_object_signal_emit(gcc->o_control, "vsize", "on"); + } + else + { + edje_object_signal_emit(gcc->o_control, "hsize", "off"); + edje_object_signal_emit(gcc->o_control, "vsize", "off"); + } edje_object_signal_emit(gcc->o_control, "move", "on"); gcc->o_event = evas_object_rectangle_add(gcc->gadcon->evas); @@ -474,17 +599,17 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc) edje_object_signal_callback_add(gcc->o_control, "resize_go", "right", _e_gadcon_cb_signal_resize_right_go, gcc); edje_object_signal_callback_add(gcc->o_control, "resize_start", "up", - _e_gadcon_cb_signal_resize_up_start, gcc); + _e_gadcon_cb_signal_resize_left_start, gcc); edje_object_signal_callback_add(gcc->o_control, "resize_stop", "up", - _e_gadcon_cb_signal_resize_up_stop, gcc); + _e_gadcon_cb_signal_resize_left_stop, gcc); edje_object_signal_callback_add(gcc->o_control, "resize_go", "up", - _e_gadcon_cb_signal_resize_up_go, gcc); + _e_gadcon_cb_signal_resize_left_go, gcc); edje_object_signal_callback_add(gcc->o_control, "resize_start", "down", - _e_gadcon_cb_signal_resize_down_start, gcc); + _e_gadcon_cb_signal_resize_right_start, gcc); edje_object_signal_callback_add(gcc->o_control, "resize_stop", "down", - _e_gadcon_cb_signal_resize_down_stop, gcc); + _e_gadcon_cb_signal_resize_right_stop, gcc); edje_object_signal_callback_add(gcc->o_control, "resize_go", "down", - _e_gadcon_cb_signal_resize_down_go, gcc); + _e_gadcon_cb_signal_resize_right_go, gcc); evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_cb_mouse_down, gcc); 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) { E_OBJECT_CHECK(gcc); E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); - if (gcc->o_frame) - e_gadcon_layout_pack_min_size_set(gcc->o_frame, w + gcc->pad.w, h + gcc->pad.h); - else - e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h); + gcc->min.w = w; + gcc->min.h = h; + if ((!gcc->autoscroll) && (!gcc->resizable)) + { + if (gcc->o_frame) + e_gadcon_layout_pack_min_size_set(gcc->o_frame, w + gcc->pad.w, h + gcc->pad.h); + else + e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h); + } + _e_gadcon_movereisze_handle(gcc); } EAPI void @@ -587,19 +718,228 @@ e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h) { E_OBJECT_CHECK(gcc); E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); - if (gcc->o_frame) + gcc->aspect.w = w; + gcc->aspect.h = h; + if ((!gcc->autoscroll) && (!gcc->resizable)) { - e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); - e_gadcon_layout_pack_aspect_set(gcc->o_frame, w, h); + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); + e_gadcon_layout_pack_aspect_set(gcc->o_frame, w, h); + } + else + e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h); + } + _e_gadcon_movereisze_handle(gcc); +} + +EAPI void +e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll) +{ + E_OBJECT_CHECK(gcc); + E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); + + gcc->autoscroll = autoscroll; + if (gcc->autoscroll) + { + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); + e_gadcon_layout_pack_aspect_set(gcc->o_frame, 0, 0); + e_gadcon_layout_pack_min_size_set(gcc->o_frame, 0, 0); + } + else + { + e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0); + e_gadcon_layout_pack_aspect_set(gcc->o_base, 0, 0); + } } else - e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h); + { + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); + e_gadcon_layout_pack_aspect_set(gcc->o_frame, gcc->aspect.w, gcc->aspect.h); + e_gadcon_layout_pack_min_size_set(gcc->o_frame, gcc->min.w, gcc->min.h); + } + else + { + e_gadcon_layout_pack_min_size_set(gcc->o_base, gcc->min.w, gcc->min.h); + e_gadcon_layout_pack_aspect_set(gcc->o_base, gcc->aspect.w, gcc->aspect.h); + } + } +} + +EAPI void +e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable) +{ + E_OBJECT_CHECK(gcc); + E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); + + gcc->resizable = resizable; + if (gcc->resizable) + { + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); + e_gadcon_layout_pack_aspect_set(gcc->o_frame, 0, 0); + e_gadcon_layout_pack_min_size_set(gcc->o_frame, 0, 0); + } + else + { + e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0); + e_gadcon_layout_pack_aspect_set(gcc->o_base, 0, 0); + } + } + else + { + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); + e_gadcon_layout_pack_aspect_set(gcc->o_frame, gcc->aspect.w, gcc->aspect.h); + e_gadcon_layout_pack_min_size_set(gcc->o_frame, gcc->min.w, gcc->min.h); + } + else + { + e_gadcon_layout_pack_min_size_set(gcc->o_base, gcc->min.w, gcc->min.h); + e_gadcon_layout_pack_aspect_set(gcc->o_base, gcc->aspect.w, gcc->aspect.h); + } + } +} + +static void +_e_gadcon_client_cb_menu_inset(void *data, E_Menu *m, E_Menu_Item *mi) +{ + E_Gadcon_Client *gcc; + E_Gadcon *gc; + + gcc = data; + gc = gcc->gadcon; + if (gcc->inset) gcc->inset = 0; + else gcc->inset = 1; + _e_gadcon_client_save(gcc); + e_gadcon_unpopulate(gc); + e_gadcon_populate(gc); +} + +static void +_e_gadcon_client_cb_menu_autoscroll(void *data, E_Menu *m, E_Menu_Item *mi) +{ + E_Gadcon_Client *gcc; + E_Gadcon *gc; + + gcc = data; + gc = gcc->gadcon; + if (gcc->autoscroll) gcc->autoscroll = 0; + else gcc->autoscroll = 1; + _e_gadcon_client_save(gcc); + e_gadcon_unpopulate(gc); + e_gadcon_populate(gc); +} + +static void +_e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m, E_Menu_Item *mi) +{ + E_Gadcon_Client *gcc; + E_Gadcon *gc; + + gcc = data; + gc = gcc->gadcon; + if (gcc->resizable) gcc->resizable = 0; + else gcc->resizable = 1; + _e_gadcon_client_save(gcc); + e_gadcon_unpopulate(gc); + e_gadcon_populate(gc); +} + +EAPI void +e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags) +{ + E_Menu_Item *mi; + + E_OBJECT_CHECK(gcc); + E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); + + mi = e_menu_item_new(menu); + e_menu_item_label_set(mi, _("Inset appearance")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/inset"); + e_menu_item_check_set(mi, 1); + if (gcc->o_frame) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_inset, gcc); + + mi = e_menu_item_new(menu); + e_menu_item_label_set(mi, _("Automatically scroll contents")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/autoscroll"); + e_menu_item_check_set(mi, 1); + if (gcc->autoscroll) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_autoscroll, gcc); + + mi = e_menu_item_new(menu); + e_menu_item_label_set(mi, _("Able to be resized")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/resizable"); + e_menu_item_check_set(mi, 1); + if (gcc->resizable) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_resizable, gcc); +} + +static void +_e_gadcon_client_cb_menu_post(void *data, E_Menu *m) +{ + E_Gadcon_Client *gcc; + + gcc = data; + if (!gcc->menu) return; + e_object_del(E_OBJECT(gcc->menu)); + gcc->menu = NULL; +} + +static void +_e_gadcon_client_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *ev; + E_Gadcon_Client *gcc; + + ev = event_info; + gcc = data; + if (gcc->menu) return; + if (ev->button == 3) + { + E_Menu *mn; + int cx, cy, cw, ch; + + mn = e_menu_new(); + e_menu_post_deactivate_callback_set(mn, _e_gadcon_client_cb_menu_post, + gcc); + gcc->menu = mn; + + e_gadcon_client_util_menu_items_append(gcc, mn, 0); + + e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, &cw, &ch); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + evas_event_feed_mouse_up(gcc->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); + } +} + +EAPI void +e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc) +{ + E_OBJECT_CHECK(gcc); + E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); + if (gcc->o_frame) + evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_client_cb_mouse_down, gcc); + else + evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_client_cb_mouse_down, gcc); } /* local subsystem functions */ static void _e_gadcon_free(E_Gadcon *gc) { + e_gadcon_unpopulate(gc); gadcons = evas_list_remove(gadcons, gc); if (gc->o_container) evas_object_del(gc->o_container); evas_stringshare_del(gc->name); @@ -611,14 +951,138 @@ _e_gadcon_free(E_Gadcon *gc) static void _e_gadcon_client_free(E_Gadcon_Client *gcc) { + if (gcc->menu) + { + e_object_del(E_OBJECT(gcc->menu)); + gcc->menu = NULL; + } e_gadcon_client_edit_end(gcc); + gcc->client_class->func.shutdown(gcc); gcc->gadcon->clients = evas_list_remove(gcc->gadcon->clients, gcc); + if (gcc->o_box) evas_object_del(gcc->o_box); if (gcc->o_frame) evas_object_del(gcc->o_frame); evas_stringshare_del(gcc->name); evas_stringshare_del(gcc->id); + if (gcc->scroll_timer) ecore_timer_del(gcc->scroll_timer); + if (gcc->scroll_animator) ecore_animator_del(gcc->scroll_animator); free(gcc); } +static void +_e_gadcon_movereisze_handle(E_Gadcon_Client *gcc) +{ + Evas_Coord x, y, w, h; + + evas_object_geometry_get(gcc->o_box, &x, &y, &w, &h); + if ((gcc->autoscroll) || (gcc->resizable)) + { + if (e_box_orientation_get(gcc->o_box)) + { + if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0)) + w = (h * gcc->aspect.w) / gcc->aspect.h; + else + w = gcc->min.w; + } + else + { + if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0)) + h = (w * gcc->aspect.h) / gcc->aspect.w; + else + h = gcc->min.h; + } + } + e_box_pack_options_set(gcc->o_base, + 1, 1, /* fill */ + 1, 1, /* expand */ + 0.5, 0.5, /* align */ + w, h, /* min */ + w, h /* max */ + ); +} + +static int +_e_gadcon_cb_client_scroll_timer(void *data) +{ + E_Gadcon_Client *gcc; + double d, v; + + gcc = data; + d = gcc->scroll_wanted - gcc->scroll_pos; + if (d < 0) d = -d; + if (d < 0.001) + { + gcc->scroll_pos = gcc->scroll_wanted; + gcc->scroll_timer = NULL; + return 0; + } + v = 0.05; + gcc->scroll_pos = (gcc->scroll_pos * (1.0 - v)) + (gcc->scroll_wanted * v); + return 1; +} + +static int +_e_gadcon_cb_client_scroll_animator(void *data) +{ + E_Gadcon_Client *gcc; + + gcc = data; + if (e_box_orientation_get(gcc->o_box)) + e_box_align_set(gcc->o_box, 1.0 - gcc->scroll_pos, 0.5); + else + e_box_align_set(gcc->o_box, 0.5, 1.0 - gcc->scroll_pos); + if (!gcc->scroll_timer) + { + gcc->scroll_animator = NULL; + return 0; + } + return 1; +} + +static void +_e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Move *ev; + E_Gadcon_Client *gcc; + Evas_Coord x, y, w, h; + + ev = event_info; + gcc = data; + if (gcc->autoscroll) + { + double d; + + evas_object_geometry_get(gcc->o_box, &x, &y, &w, &h); + x = ev->cur.output.x - x; + y = ev->cur.output.y - y; + if (e_box_orientation_get(gcc->o_box)) + { + if (w > 1) d = (double)x / (double)(w - 1); + else d = 0; + } + else + { + if (h > 1) d = (double)y / (double)(h - 1); + else d = 0; + } + if (d < 0.0) d = 0.0; + else if (d > 1.0) d = 1.0; + if (!gcc->scroll_timer) + gcc->scroll_timer = ecore_timer_add(0.01, _e_gadcon_cb_client_scroll_timer, gcc); + if (!gcc->scroll_animator) + gcc->scroll_animator = ecore_animator_add(_e_gadcon_cb_client_scroll_animator, gcc); + gcc->scroll_wanted = d; + } +} + +static void +_e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + E_Gadcon_Client *gcc; + + gcc = data; + _e_gadcon_movereisze_handle(gcc); +} + static void _e_gadcon_client_save(E_Gadcon_Client *gcc) { @@ -645,6 +1109,12 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc) cf_gcc->geom.pos = gcc->config.pos; cf_gcc->geom.size = gcc->config.size; cf_gcc->geom.res = gcc->config.res; + cf_gcc->autoscroll = gcc->autoscroll; + if (cf_gcc->style) evas_stringshare_del(cf_gcc->style); + cf_gcc->style = NULL; + if (gcc->inset) + cf_gcc->style = evas_stringshare_add("inset"); + cf_gcc->resizable = gcc->resizable; ok++; break; } @@ -668,12 +1138,33 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc) cf_gcc->geom.pos = gcc->config.pos; cf_gcc->geom.size = gcc->config.size; cf_gcc->geom.res = gcc->config.res; + cf_gcc->autoscroll = gcc->autoscroll; + if (cf_gcc->style) evas_stringshare_del(cf_gcc->style); + cf_gcc->style = NULL; + if (gcc->inset) + cf_gcc->style = evas_stringshare_add("inset"); + cf_gcc->resizable = gcc->resizable; cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc); ok++; } e_config_save_queue(); } +static void +_e_gadcon_cb_min_size_request(void *data, Evas_Object *obj, void *event_info) +{ + E_Gadcon *gc; + + gc = data; + if (gc->min_size_request.func) + { + Evas_Coord w, h; + + e_gadcon_layout_min_size_get(gc->o_container, &w, &h); + gc->min_size_request.func(gc->min_size_request.data, gc, w, h); + } +} + static void _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info) { @@ -683,8 +1174,9 @@ _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info) if (gc->resize_request.func) { Evas_Coord w, h; + + e_gadcon_layout_asked_size_get(gc->o_container, &w, &h); - e_gadcon_layout_min_size_get(gc->o_container, &w, &h); gc->resize_request.func(gc->resize_request.data, gc, w, h); } } @@ -771,7 +1263,10 @@ _e_gadcon_cb_signal_move_start(void *data, Evas_Object *obj, const char *emissio gcc->moving = 1; evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy); evas_object_geometry_get(gcc->gadcon->o_container, &x, &y, NULL, NULL); - evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, NULL, NULL); + if (gcc->o_frame) + evas_object_geometry_get(gcc->o_frame, &gcc->sx, &gcc->sy, NULL, NULL); + else + evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, NULL, NULL); gcc->sx -= x; gcc->sy -= y; } @@ -825,100 +1320,131 @@ _e_gadcon_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, } } +static void +_e_gadcon_client_resize_start(E_Gadcon_Client *gcc) +{ + Evas_Coord x, y; + + evas_object_raise(gcc->o_event); + evas_object_stack_below(gcc->o_control, gcc->o_event); + gcc->resizing = 1; + evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy); + evas_object_geometry_get(gcc->gadcon->o_container, &x, &y, NULL, NULL); + if (gcc->o_frame) + evas_object_geometry_get(gcc->o_frame, &gcc->sx, &gcc->sy, &gcc->sw, &gcc->sh); + else + evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, &gcc->sw, &gcc->sh); + gcc->sx -= x; + gcc->sy -= y; +} + +static void +_e_gadconclient_resize_stop(E_Gadcon_Client *gcc) +{ + gcc->resizing = 0; + _e_gadcon_client_save(gcc); +} + static void _e_gadcon_cb_signal_resize_left_start(void *data, Evas_Object *obj, const char *emission, const char *source) { - E_Gadcon_Client *gcc; - - gcc = data; + _e_gadcon_client_resize_start(data); } static void _e_gadcon_cb_signal_resize_left_stop(void *data, Evas_Object *obj, const char *emission, const char *source) { - E_Gadcon_Client *gcc; - - gcc = data; + _e_gadconclient_resize_stop(data); } static void _e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj, const char *emission, const char *source) { E_Gadcon_Client *gcc; + Evas_Coord x, y, w, h; gcc = data; + if (!gcc->resizing) return; + evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y); + x = x - gcc->dx; + y = y - gcc->dy; + if (gcc->o_frame) + evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h); + else + evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h); + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) + { + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx + x, gcc->sw - x); + else + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx + x, gcc->sw - x); + gcc->config.pos = gcc->sx + x; + gcc->config.size = gcc->sw - x; + evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); + gcc->config.res = w; + } + else + { + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy + y, gcc->sh - y); + else + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy + y, gcc->sh - y); + gcc->config.pos = gcc->sy + y; + gcc->config.size = gcc->sh - y; + evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); + gcc->config.res = h; + } } static void _e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source) { - E_Gadcon_Client *gcc; - - gcc = data; + _e_gadcon_client_resize_start(data); } static void _e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source) { - E_Gadcon_Client *gcc; - - gcc = data; + _e_gadconclient_resize_stop(data); } static void _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source) { E_Gadcon_Client *gcc; + Evas_Coord x, y, w, h; gcc = data; -} - -static void -_e_gadcon_cb_signal_resize_up_start(void *data, Evas_Object *obj, const char *emission, const char *source) -{ - E_Gadcon_Client *gcc; - - gcc = data; -} - -static void -_e_gadcon_cb_signal_resize_up_stop(void *data, Evas_Object *obj, const char *emission, const char *source) -{ - E_Gadcon_Client *gcc; - - gcc = data; -} - -static void -_e_gadcon_cb_signal_resize_up_go(void *data, Evas_Object *obj, const char *emission, const char *source) -{ - E_Gadcon_Client *gcc; - - gcc = data; -} - -static void -_e_gadcon_cb_signal_resize_down_start(void *data, Evas_Object *obj, const char *emission, const char *source) -{ - E_Gadcon_Client *gcc; - - gcc = data; -} - -static void -_e_gadcon_cb_signal_resize_down_stop(void *data, Evas_Object *obj, const char *emission, const char *source) -{ - E_Gadcon_Client *gcc; - - gcc = data; -} - -static void -_e_gadcon_cb_signal_resize_down_go(void *data, Evas_Object *obj, const char *emission, const char *source) -{ - E_Gadcon_Client *gcc; - - gcc = data; + if (!gcc->resizing) return; + evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y); + x = x - gcc->dx; + y = y - gcc->dy; + if (gcc->o_frame) + evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h); + else + evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h); + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) + { + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx, gcc->sw + x); + else + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx, gcc->sw + x); + gcc->config.pos = gcc->sx; + gcc->config.size = gcc->sw + x; + evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); + gcc->config.res = w; + } + else + { + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy, gcc->sh + y); + else + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy, gcc->sh + y); + gcc->config.pos = gcc->sy; + gcc->config.size = gcc->sh + y; + evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); + gcc->config.res = h; + } } @@ -940,7 +1466,7 @@ struct _E_Smart_Data unsigned char redo_config : 1; Evas_List *items; int frozen; - Evas_Coord minw, minh; + Evas_Coord minw, minh, req; }; struct _E_Gadcon_Layout_Item @@ -1077,6 +1603,11 @@ e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) sd = evas_object_smart_data_get(obj); if (!sd) return; + if (sd->horizontal) + tw = sd->req; + else + th = sd->req; +/* for (l = sd->items; l; l = l->next) { E_Gadcon_Layout_Item *bi; @@ -1093,6 +1624,7 @@ e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) th += bi->ask.size; } } + */ if (w) *w = tw; if (h) *h = th; } @@ -1338,14 +1870,9 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) return; } - x = sd->x; - y = sd->y; - w = sd->w; - h = sd->h; - - min = 0; - mino = 0; - cur = 0; + x = sd->x; y = sd->y; w = sd->w; h = sd->h; + min = mino = cur = 0; + for (l = sd->items; l; l = l->next) { E_Gadcon_Layout_Item *bi; @@ -1353,17 +1880,6 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) obj = l->data; bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - cur += bi->ask.size; - if (sd->horizontal) - { - min += bi->min.w; - if (bi->min.h > mino) mino = bi->min.h; - } - else - { - min += bi->min.h; - if (bi->min.w > mino) mino = bi->min.w; - } bi->ask.size2 = bi->ask.size; if ((bi->aspect.w > 0) && (bi->aspect.h > 0)) { @@ -1372,20 +1888,60 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) bi->ask.size2 = (((h - bi->aspect_pad.h) * bi->aspect.w) / bi->aspect.h) + bi->aspect_pad.w; if (bi->ask.size2 > bi->min.w) - min += (bi->ask.size2 - bi->min.w); + { + min += bi->ask.size2; + cur += bi->ask.size2; + } + else + { + cur += bi->min.w; + min += bi->min.w; + } } else { bi->ask.size2 = (((w - bi->aspect_pad.w) * bi->aspect.h) / bi->aspect.w) + bi->aspect_pad.h; if (bi->ask.size2 > bi->min.h) - min += (bi->ask.size2 - bi->min.h); + { + min += bi->ask.size2; + cur += bi->ask.size2; + } + else + { + cur += bi->min.h; + min += bi->min.h; + } + } + } + else + { + if (sd->horizontal) + { + min += bi->min.w; + if (bi->min.h > mino) mino = bi->min.h; + if (bi->ask.size < bi->min.w) + cur += bi->min.w; + else + cur += bi->ask.size; + } + else + { + min += bi->min.h; + if (bi->min.w > mino) mino = bi->min.w; + if (bi->ask.size < bi->min.h) + cur += bi->min.h; + else + cur += bi->ask.size; } } } + + printf("CUR = %i | %i %i\n", cur, min, mino); + if (sd->horizontal) { - if (cur < w) + if (cur <= w) { /* all is fine - it should all fit */ } @@ -1396,6 +1952,7 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) sub = cur - w; /* we need to find "sub" extra pixels */ if (min <= w) { + printf("blum\n"); for (l = sd->items; l; l = l->next) { E_Gadcon_Layout_Item *bi; @@ -1407,11 +1964,13 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) if (give < sub) give = sub; bi->ask.size2 = bi->ask.size - give; sub -= give; + printf("GIVE: %i\n", give); if (sub <= 0) break; } } else { /* EEK - all items just cant fit at their minimum! what do we do? */ + printf("EEK - nofit!\n"); num = 0; num = evas_list_count(sd->items); give = min - w; // how much give total below minw we need @@ -1781,19 +2340,28 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) } if (sd->horizontal) { - if ((sd->minw < min) || (sd->minh < mino)) + if ((sd->minw != min) || (sd->minh != mino)) { sd->minw = min; sd->minh = mino; - evas_object_smart_callback_call(sd->obj, "size_request", NULL); + evas_object_smart_callback_call(sd->obj, "min_size_request", NULL); } } else { - if ((sd->minh < min) || (sd->minw < mino)) + if ((sd->minh != min) || (sd->minw != mino)) { sd->minw = mino; sd->minh = min; + evas_object_smart_callback_call(sd->obj, "min_size_request", NULL); + } + } + if (sd->req != cur) + { + if (((sd->horizontal) && (cur >= sd->minw)) || + ((!sd->horizontal) && (cur >= sd->minh))) + { + sd->req = cur; evas_object_smart_callback_call(sd->obj, "size_request", NULL); } } 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 struct { void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); void *data; - } resize_request; + } resize_request, min_size_request; struct { Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style); void *data; @@ -91,20 +91,30 @@ struct _E_Gadcon_Client char *name; char *id; Evas_Object *o_base; + Evas_Object *o_box; Evas_Object *o_frame; Evas_Object *o_control; Evas_Object *o_event; - E_Gadcon_Client_Class client_class; + E_Gadcon_Client_Class *client_class; void *data; struct { int pos, size, res; } config; struct { Evas_Coord w, h; - } pad; + } pad, min, aspect; + unsigned char inset : 1; + unsigned char autoscroll : 1; + unsigned char resizable : 1; + Ecore_Timer *scroll_timer; + Ecore_Animator *scroll_animator; + double scroll_pos; + double scroll_wanted; + E_Menu *menu; unsigned char moving : 1; - Evas_Coord dx, dy, sx, sy; + unsigned char resizing : 1; + Evas_Coord dx, dy, sx, sy, sw, sh; }; EAPI int e_gadcon_init(void); @@ -113,10 +123,13 @@ EAPI void e_gadcon_provider_register(E_Gadcon_Client_Class *cc); EAPI void e_gadcon_provider_unregister(E_Gadcon_Client_Class *cc); EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, char *id, Evas_Object *obj, char *swallow_name); EAPI void e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h); +EAPI 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); EAPI 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); EAPI void e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style), void *data); EAPI void e_gadcon_layout_policy_set(E_Gadcon *gc, E_Gadcon_Layout_Policy layout_policy); EAPI void e_gadcon_populate(E_Gadcon *gc); +EAPI void e_gadcon_unpopulate(E_Gadcon *gc); +EAPI void e_gadcon_populate_class(E_Gadcon *gc, E_Gadcon_Client_Class *cc); EAPI void e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient); EAPI void e_gadcon_edit_begin(E_Gadcon *gc); EAPI 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); EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h); EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, char *style, Evas_Object *base_obj); +EAPI void e_gadcon_client_edit_begin(E_Gadcon_Client *gcc); +EAPI void e_gadcon_client_edit_end(E_Gadcon_Client *gcc); EAPI void e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h); EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h); EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h); -EAPI void e_gadcon_client_edit_begin(E_Gadcon_Client *gcc); -EAPI void e_gadcon_client_edit_end(E_Gadcon_Client *gcc); - +EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll); +EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable); + +EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags); +EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc); + #endif #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 @@ #include "e_gadcon.h" #include "e_shelf.h" #include "e_tlist.h" +#include "e_widget_tlist.h" #include "e_widget_preview.h" #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) e_test(); /* FIXME: for testing only */ -// e_shelf_config_init(); +// + e_shelf_config_init(); /* no longer starting up */ 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) return (*((int *)v1)) - (*((int *)v2)); } +static int +_e_place_coverage_border_add(E_Zone *zone, Evas_List *skiplist, int ar, int x, int y, int w, int h) +{ + Evas_List *ll; + E_Border_List *bl; + E_Border *bd; + int x2, y2, w2, h2; + int ok; + int iw, ih; + int x0, x00, y0, y00; + + bl = e_container_border_list_first(zone->container); + while ((bd = e_container_border_list_next(bl))) + { + ok = 1; + x2 = (bd->x - zone->x); y2 = (bd->y - zone->y); w2 = bd->w; h2 = bd->h; + for (ll = skiplist; ll; ll = ll->next) + { + if (ll->data == bd) + { + ok = 0; + break; + } + } + if ((ok) && (bd->visible) && E_INTERSECTS(x, y, w, h, x2, y2, w2, h2)) + { + x0 = x; + if (x < x2) x0 = x2; + x00 = (x + w); + if ((x2 + w2) < (x + w)) x00 = (x2 + w2); + y0 = y; + if (y < y2) y0 = y2; + y00 = (y + h); + if ((y2 + h2) < (y + h)) y00 = (y2 + h2); + iw = x00 - x0; + ih = y00 - y0; + ar += (iw * ih); + } + } + e_container_border_list_free(bl); + return ar; +} + +static int +_e_place_coverage_shelf_add(E_Zone *zone, int ar, int x, int y, int w, int h) +{ + Evas_List *l; + E_Shelf *es; + int x2, y2, w2, h2; + int ok; + int iw, ih; + int x0, x00, y0, y00; + + for (l = e_shelf_list(); l; l = l->next) + { + + es = l->data; + if (es->zone != zone) continue; + x2 = es->x; y2 = es->y; w2 = es->w; h2 = es->h; + if (E_INTERSECTS(x, y, w, h, x2, y2, w2, h2)) + { + x0 = x; + if (x < x2) x0 = x2; + x00 = (x + w); + if ((x2 + w2) < (x + w)) x00 = (x2 + w2); + y0 = y; + if (y < y2) y0 = y2; + y00 = (y + h); + if ((y2 + h2) < (y + h)) y00 = (y2 + h2); + iw = x00 - x0; + ih = y00 - y0; + ar += (iw * ih) * 100; /* 100 == 100 times more unlikely for overlap than a normal window */ + } + } + return ar; +} + EAPI int e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w, int h, int *rx, int *ry) { @@ -90,59 +167,9 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w x -= zone->x; y -= zone->y; + zw = zone->w; + zh = zone->h; - if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET) - { - Evas_List *l; - int cx1, cx2, cy1, cy2; - - cx1 = zone->x; - cy1 = zone->y; - cx2 = zone->x + zone->w; - cy2 = zone->y + zone->h; - - /* Find the smallest box */ - for (l = zone->container->gadman->clients; l; l = l->next) - { - E_Gadman_Client *gmc; - double ax, ay; - - gmc = l->data; - if ((gmc->zone != zone)) continue; - - ax = gmc->ax; - ay = gmc->ay; - - if (((ax == 0.0) || (ax == 1.0)) && - ((ay == 0.0) || (ay == 1.0))) - { - /* corner gadget */ - /* Fake removal from one alignment :) */ - if (gmc->w > gmc->h) - ax = 0.5; - else - ay = 0.5; - } - - if ((ax == 0.0) && (gmc->x + gmc->w) > cx1) - cx1 = (gmc->x + gmc->w); - else if ((ax == 1.0) && (gmc->x < cx2)) - cx2 = gmc->x; - else if ((ay == 0.0) && ((gmc->y + gmc->h) > cy1)) - cy1 = (gmc->y + gmc->h); - else if ((ay == 1.0) && (gmc->y < cy2)) - cy2 = gmc->y; - } - - - zw = cx2 - cx1; - zh = cy2 - cy1; - } - else - { - zw = zone->w; - zh = zone->h; - } u_x = calloc(zw + 1, sizeof(char)); u_y = calloc(zh + 1, sizeof(char)); @@ -150,7 +177,135 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w a_x[1] = zw; a_y[0] = 0; a_y[1] = zh; - + + if (e_config->window_placement_policy == E_WINDOW_PLACEMENT_ANTIGADGET) + { + Evas_List *l; + + for (l = zone->container->gadman->clients; l; l = l->next) + { + E_Gadman_Client *gmc; + int bx, by, bw, bh; + + gmc = l->data; + if ((gmc->zone != zone)) continue; + + bx = gmc->x; + by = gmc->y; + bw = gmc->w; + bh = gmc->h; + if (E_INTERSECTS(bx, by, bw, bh, 0, 0, zw, zh)) + { + if ((bx > 0) && (bx <= zw) && (!u_x[bx])) + { + a_w++; + if (a_w > a_alloc_w) + { + a_alloc_w += 32; + E_REALLOC(a_x, int, a_alloc_w); + } + a_x[a_w - 1] = bx; + u_x[bx] = 1; + } + if (((bx + bw) > 0) && ((bx + bw) <= zw) && (!u_x[bx + bw])) + { + a_w++; + if (a_w > a_alloc_w) + { + a_alloc_w += 32; + E_REALLOC(a_x, int, a_alloc_w); + } + a_x[a_w - 1] = bx + bw; + u_x[bx + bw] = 1; + } + if ((by > 0) && (by <= zh) && (!u_y[by])) + { + a_h++; + if (a_h > a_alloc_h) + { + a_alloc_h += 32; + E_REALLOC(a_y, int, a_alloc_h); + } + a_y[a_h - 1] = by; + u_y[by] = 1; + } + if (((by + bh) > 0) && ((by + bh) <= zh) && (!u_y[by + bh])) + { + a_h++; + if (a_h > a_alloc_h) + { + a_alloc_h += 32; + E_REALLOC(a_y, int, a_alloc_h); + } + a_y[a_h - 1] = by + bh; + u_y[by + bh] = 1; + } + } + } + for (l = e_shelf_list(); l; l = l->next) + { + E_Shelf *es; + + es = l->data; + if (es->zone == zone) + { + int bx, by, bw, bh; + + bx = es->x; + by = es->y; + bw = es->w; + bh = es->h; + if (E_INTERSECTS(bx, by, bw, bh, 0, 0, zw, zh)) + { + if ((bx > 0) && (bx <= zw) && (!u_x[bx])) + { + a_w++; + if (a_w > a_alloc_w) + { + a_alloc_w += 32; + E_REALLOC(a_x, int, a_alloc_w); + } + a_x[a_w - 1] = bx; + u_x[bx] = 1; + } + if (((bx + bw) > 0) && ((bx + bw) <= zw) && (!u_x[bx + bw])) + { + a_w++; + if (a_w > a_alloc_w) + { + a_alloc_w += 32; + E_REALLOC(a_x, int, a_alloc_w); + } + a_x[a_w - 1] = bx + bw; + u_x[bx + bw] = 1; + } + if ((by > 0) && (by <= zh) && (!u_y[by])) + { + a_h++; + if (a_h > a_alloc_h) + { + a_alloc_h += 32; + E_REALLOC(a_y, int, a_alloc_h); + } + a_y[a_h - 1] = by; + u_y[by] = 1; + } + if (((by + bh) > 0) && ((by + bh) <= zh) && (!u_y[by + bh])) + { + a_h++; + if (a_h > a_alloc_h) + { + a_alloc_h += 32; + E_REALLOC(a_y, int, a_alloc_h); + } + a_y[a_h - 1] = by + bh; + u_y[by + bh] = 1; + } + } + } + } + } + bl = e_container_border_list_first(zone->container); while ((bd = e_container_border_list_next(bl))) { @@ -240,252 +395,72 @@ e_place_zone_region_smart(E_Zone *zone, Evas_List *skiplist, int x, int y, int w { int ar = 0; - bl = e_container_border_list_first(zone->container); - while ((bd = e_container_border_list_next(bl))) - { - int x1, y1, w1, h1, x2, y2, w2, h2; - int ok; - - ok = 1; - x1 = a_x[i]; - y1 = a_y[j]; - w1 = w; - h1 = h; - x2 = (bd->x - zone->x); - y2 = (bd->y - zone->y); - w2 = bd->w; - h2 = bd->h; - for (ll = skiplist; ll; ll = ll->next) - { - if (ll->data == bd) - { - ok = 0; - break; - } - } - if ((ok) && (bd->visible) && - E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2)) - { - int iw, ih; - int x0, x00, y0, y00; - - x0 = x1; - if (x1 < x2) - x0 = x2; - x00 = (x1 + w1); - if ((x2 + w2) < (x1 + w1)) - x00 = (x2 + w2); - - y0 = y1; - if (y1 < y2) - y0 = y2; - y00 = (y1 + h1); - if ((y2 + h2) < (y1 + h1)) - y00 = (y2 + h2); - - iw = x00 - x0; - ih = y00 - y0; - ar += (iw * ih); - } - } - e_container_border_list_free(bl); - + ar = _e_place_coverage_border_add(zone, skiplist, ar, + a_x[i], a_y[j], + w, h); + ar = _e_place_coverage_shelf_add(zone, ar, + a_x[i], a_y[j], + w, h); if (ar < area) { area = ar; *rx = a_x[i]; *ry = a_y[j]; - if (ar == 0) - goto done; + if (ar == 0) goto done; } } if ((a_x[i + 1] - w > 0) && (a_y[j] < (zh - h))) { int ar = 0; - bl = e_container_border_list_first(zone->container); - while ((bd = e_container_border_list_next(bl))) - { - int x1, y1, w1, h1, x2, y2, w2, h2; - int ok; - - ok = 1; - x1 = a_x[i + 1] - w; - y1 = a_y[j]; - w1 = w; - h1 = h; - x2 = (bd->x - zone->x); - y2 = (bd->y - zone->y); - w2 = bd->w; - h2 = bd->h; - for (ll = skiplist; ll; ll = ll->next) - { - if (ll->data == bd) - { - ok = 0; - break; - } - } - if ((ok) && (bd->visible) && - E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2)) - { - int iw, ih; - int x0, x00, y0, y00; - - x0 = x1; - if (x1 < x2) - x0 = x2; - x00 = (x1 + w1); - if ((x2 + w2) < (x1 + w1)) - x00 = (x2 + w2); - - y0 = y1; - if (y1 < y2) - y0 = y2; - y00 = (y1 + h1); - if ((y2 + h2) < (y1 + h1)) - y00 = (y2 + h2); - - iw = x00 - x0; - ih = y00 - y0; - ar += (iw * ih); - } - } - e_container_border_list_free(bl); - + ar = _e_place_coverage_border_add(zone, skiplist, ar, + a_x[i + 1] - w, a_y[j], + w, h); + ar = _e_place_coverage_shelf_add(zone, ar, + a_x[i + 1] - w, a_y[j], + w, h); if (ar < area) { area = ar; *rx = a_x[i + 1] - w; *ry = a_y[j]; - if (ar == 0) - goto done; + if (ar == 0) goto done; } } if ((a_x[i + 1] - w > 0) && (a_y[j + 1] - h > 0)) { int ar = 0; - bl = e_container_border_list_first(zone->container); - while ((bd = e_container_border_list_next(bl))) - { - int x1, y1, w1, h1, x2, y2, w2, h2; - int ok; - - ok = 1; - x1 = a_x[i + 1] - w; - y1 = a_y[j + 1] - h; - w1 = w; - h1 = h; - x2 = (bd->x - zone->x); - y2 = (bd->y - zone->y); - w2 = bd->w; - h2 = bd->h; - for (ll = skiplist; ll; ll = ll->next) - { - if (ll->data == bd) - { - ok = 0; - break; - } - } - if ((ok) && (bd->visible) && - E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2)) - { - int iw, ih; - int x0, x00, y0, y00; - - x0 = x1; - if (x1 < x2) - x0 = x2; - x00 = (x1 + w1); - if ((x2 + w2) < (x1 + w1)) - x00 = (x2 + w2); - - y0 = y1; - if (y1 < y2) - y0 = y2; - y00 = (y1 + h1); - if ((y2 + h2) < (y1 + h1)) - y00 = (y2 + h2); - - iw = x00 - x0; - ih = y00 - y0; - ar += (iw * ih); - } - } - e_container_border_list_free(bl); - + ar = _e_place_coverage_border_add(zone, skiplist, ar, + a_x[i + 1] - w, a_y[j + 1] - h, + w, h); + ar = _e_place_coverage_shelf_add(zone, ar, + a_x[i + 1] - w, a_y[j + 1] - h, + w, h); if (ar < area) { area = ar; *rx = a_x[i + 1] - w; *ry = a_y[j + 1] - h; - if (ar == 0) - goto done; + if (ar == 0) goto done; } } if ((a_x[i] < (zw - w)) && (a_y[j + 1] - h > 0)) { int ar = 0; - bl = e_container_border_list_first(zone->container); - while ((bd = e_container_border_list_next(bl))) - { - int x1, y1, w1, h1, x2, y2, w2, h2; - int ok; - - ok = 1; - x1 = a_x[i]; - y1 = a_y[j + 1] - h; - w1 = w; - h1 = h; - x2 = (bd->x - zone->x); - y2 = (bd->y - zone->y); - w2 = bd->w; - h2 = bd->h; - for (ll = skiplist; ll; ll = ll->next) - { - if (ll->data == bd) - { - ok = 0; - break; - } - } - if ((ok) && (bd->visible) && - E_INTERSECTS(x1, y1, w1, h1, x2, y2, w2, h2)) - { - int iw, ih; - int x0, x00, y0, y00; - - x0 = x1; - if (x1 < x2) - x0 = x2; - x00 = (x1 + w1); - if ((x2 + w2) < (x1 + w1)) - x00 = (x2 + w2); - - y0 = y1; - if (y1 < y2) - y0 = y2; - y00 = (y1 + h1); - if ((y2 + h2) < (y1 + h1)) - y00 = (y2 + h2); - - iw = x00 - x0; - ih = y00 - y0; - ar += (iw * ih); - } - } - e_container_border_list_free(bl); - + ar = _e_place_coverage_border_add(zone, skiplist, ar, + a_x[i], a_y[j + 1] - h, + w, h); + ar = _e_place_coverage_shelf_add(zone, ar, + a_x[i], a_y[j + 1] - h, + w, h); if (ar < area) { area = ar; *rx = a_x[i]; *ry = a_y[j + 1] - h; - if (ar == 0) - goto done; + if (ar == 0) goto done; } } } 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) orects = pop->shape_rects; for (i = 0; i < num; i++) { + if (rects[i].x < 0) + { + rects[i].width -= rects[i].x; + rects[i].x = 0; + } + if ((rects[i].x + rects[i].width) > pop->w) + rects[i].width = rects[i].width - rects[i].x; + if (rects[i].y < 0) + { + rects[i].height -= rects[i].y; + rects[i].y = 0; + } + if ((rects[i].y + rects[i].height) > pop->h) + rects[i].height = rects[i].height - rects[i].y; + if ((orects[i].x != rects[i].x) || (orects[i].y != rects[i].y) || (orects[i].width != rects[i].width) || @@ -216,7 +231,7 @@ e_popup_idler_before(void) break; } } - changed = 0; +// changed = 0; } if (changed) { 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, gmc = l->data; OBSTACLE(gmc->x, gmc->y, gmc->w, gmc->h, e_config->gadget_resist); } + for (l = e_shelf_list(); l; l = l->next) + { + E_Shelf *es; + + es = l->data; + if (es->zone->container == con) + { + OBSTACLE(es->x + es->zone->x, es->y + es->zone->y, es->w, es->h, + e_config->gadget_resist); + } + } if (rects) { _e_resist_rects(rects, @@ -141,17 +152,22 @@ e_resist_container_gadman_position(E_Container *con, Evas_List *skiplist, } if (ok) { - r = E_NEW(E_Resist_Rect, 1); - - r->x = gmc->x; - r->y = gmc->y; - r->w = gmc->w; - r->h = gmc->h; - r->v1 = e_config->gadget_resist; - rects = evas_list_append(rects, r); + OBSTACLE(gmc->x, gmc->y, gmc->w, gmc->h, e_config->gadget_resist); } } + for (l = e_shelf_list(); l; l = l->next) + { + E_Shelf *es; + + es = l->data; + if (es->zone->container == con) + { + OBSTACLE(es->x + es->zone->x, es->y + es->zone->y, es->w, es->h, + e_config->gadget_resist); + } + } + if (rects) { _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 @@ static void _e_shelf_free(E_Shelf *es); static const char *_e_shelf_orient_string_get(E_Shelf *es); static void _e_shelf_position_calc(E_Shelf *es); +static void _e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style); @@ -47,6 +48,8 @@ e_shelf_config_init(void) if (es) { es->cfg = cf_es; + es->fit_along = cf_es->fit_along; + es->fit_size = cf_es->fit_size; e_shelf_orient(es, cf_es->orient); _e_shelf_position_calc(es); e_shelf_populate(es); @@ -56,6 +59,12 @@ e_shelf_config_init(void) } } +EAPI Evas_List * +e_shelf_list(void) +{ + return shelves; +} + EAPI E_Shelf * e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer) { @@ -114,6 +123,9 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i snprintf(buf, sizeof(buf), "%i", shelf_id); shelf_id++; es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items"); + e_gadcon_min_size_request_callback_set(es->gadcon, + _e_shelf_gadcon_min_size_request, + es); e_gadcon_size_request_callback_set(es->gadcon, _e_shelf_gadcon_size_request, es); @@ -465,6 +477,12 @@ _e_shelf_position_calc(E_Shelf *es) e_shelf_move_resize(es, es->x, es->y, es->w, es->h); } +static void +_e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h) +{ + return; +} + static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h) { @@ -477,7 +495,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord nw = es->w; nh = es->h; ww = hh = 0; - printf("req min = %i %i\n", w, h); + printf("req = %i %i\n", w, h); evas_object_geometry_get(gc->o_container, NULL, NULL, &ww, &hh); switch (gc->orient) { @@ -537,7 +555,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord if (!es->fit_size) nw = es->w; if (nw > es->zone->w) nw = es->zone->w; if (nh > es->zone->h) nh = es->zone->h; - if (nh != es->h) ny = es->y + ((es->h - nh) / 2); + if (nh != es->h) ny = (es->zone->h - nh) / 2; nx = 0; break; case E_GADCON_ORIENT_RIGHT: @@ -545,7 +563,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord if (!es->fit_size) nw = es->w; if (nw > es->zone->w) nw = es->zone->w; if (nh > es->zone->h) nh = es->zone->h; - if (nh != es->h) ny = es->y + ((es->h - nh) / 2); + if (nh != es->h) ny = (es->zone->h - nh) / 2; nx = es->zone->w - nw; break; case E_GADCON_ORIENT_TOP: @@ -553,7 +571,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord if (!es->fit_size) nh = es->h; if (nw > es->zone->w) nw = es->zone->w; if (nh > es->zone->h) nh = es->zone->h; - if (nw != es->w) nx = es->x + ((es->w - nw) / 2); + if (nw != es->w) nx = (es->zone->w - nw) / 2; ny = 0; break; case E_GADCON_ORIENT_BOTTOM: @@ -561,7 +579,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord if (!es->fit_size) nh = es->h; if (nw > es->zone->w) nw = es->zone->w; if (nh > es->zone->h) nh = es->zone->h; - if (nw != es->w) nx = es->x + ((es->w - nw) / 2); + if (nw != es->w) nx = (es->zone->w - nw) / 2; ny = es->zone->h - nh; break; 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 EAPI int e_shelf_init(void); EAPI int e_shelf_shutdown(void); EAPI void e_shelf_config_init(void); +EAPI Evas_List *e_shelf_list(void); EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer); EAPI void e_shelf_populate(E_Shelf *es); EAPI 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 pkg_LTLIBRARIES = module.la module_la_SOURCES = e_mod_main.c \ e_mod_main.h \ - e_mod_config.c \ - e_mod_config.h + e_mod_config.c module_la_LIBADD = @e_libs@ @cf_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version module_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 @@ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" -#include "config.h" struct _E_Config_Dialog_Data { @@ -19,7 +17,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); void -_config_battery_module(E_Container *con, Battery *bat) +_config_battery_module(void) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -33,15 +31,18 @@ _config_battery_module(E_Container *con, Battery *bat) v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.create_widgets = _advanced_create_widgets; - cfd = e_config_dialog_new(con, _("Battery Configuration"), NULL, 0, v, bat); - bat->config_dialog = cfd; + cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()), + _("Battery Monitor Configuration"), + NULL, 0, v, NULL); + battery_config->config_dialog = cfd; } static void -_fill_data(Battery *b, E_Config_Dialog_Data *cfdata) +_fill_data(E_Config_Dialog_Data *cfdata) { - cfdata->alarm_time = b->conf->alarm; - cfdata->poll_time = b->conf->poll_time; + if (!battery_config) return; + cfdata->alarm_time = battery_config->alarm; + cfdata->poll_time = battery_config->poll_time; if (cfdata->alarm_time > 0) cfdata->show_alert = 1; else @@ -52,21 +53,17 @@ static void * _create_data(E_Config_Dialog *cfd) { E_Config_Dialog_Data *cfdata; - Battery *b; - b = cfd->data; cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(b, cfdata); + _fill_data(cfdata); return cfdata; } static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Battery *b; - - b = cfd->data; - b->config_dialog = NULL; + if (!battery_config) return; + battery_config->config_dialog = NULL; free(cfdata); } @@ -86,16 +83,13 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Battery *b; - - b = cfd->data; - e_border_button_bindings_ungrab_all(); - b->conf->poll_time = 10.0; - - e_border_button_bindings_grab_all(); + if (!battery_config) return; + if (cfdata->show_alert) + battery_config->alarm = cfdata->alarm_time; + else + battery_config->alarm = 0; + _battery_config_updated(); e_config_save_queue(); - - _battery_face_cb_config_updated(b); return 1; } @@ -130,20 +124,14 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Battery *b; - - b = cfd->data; - e_border_button_bindings_ungrab_all(); - - b->conf->poll_time = cfdata->poll_time; + if (!battery_config) return; + battery_config->poll_time = cfdata->poll_time; if (cfdata->show_alert) - b->conf->alarm = cfdata->alarm_time; + battery_config->alarm = cfdata->alarm_time; else - b->conf->alarm = 0; - - e_border_button_bindings_grab_all(); + battery_config->alarm = 0; + _battery_config_updated(); e_config_save_queue(); - - _battery_face_cb_config_updated(b); return 1; } + 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 @@ -#ifdef E_TYPEDEFS -#else -#ifndef E_MOD_CONFIG_H -#define E_MOD_CONFIG_H -#include "e_mod_main.h" -void _config_battery_module(E_Container *con, Battery *b); -#endif -#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 @@ */ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" #ifdef __FreeBSD__ # include @@ -14,7 +13,6 @@ # endif # include #endif - #ifdef HAVE_CFBASE_H #include #include @@ -25,445 +23,172 @@ #include #endif -/* TODO List: - * - * which options should be in main menu, and which in face menu? - */ - -/* module private routines */ -static Battery *_battery_new(); -static void _battery_shutdown(Battery *e); -static void _battery_config_menu_new(Battery *e); -static int _battery_cb_check(void *data); -static Status *_battery_linux_acpi_check(Battery *ef); -static Status *_battery_linux_apm_check(Battery *ef); -/* linux on powerbook */ -static Status *_battery_linux_powerbook_check(Battery *ef); -/* Should these be #ifdef'd ? */ -#ifdef __FreeBSD__ -static Status *_battery_bsd_acpi_check(Battery *ef); -static Status *_battery_bsd_apm_check(Battery *ef); -#endif - -#ifdef HAVE_CFBASE_H -static Status *_battery_darwin_check(Battery *ef); -#endif - -static Battery_Face *_battery_face_new(Battery *bat, E_Container *con); -static void _battery_face_free(Battery_Face *ef); -static void _battery_face_menu_new(Battery_Face *face); -static void _battery_face_enable(Battery_Face *face); -static void _battery_face_disable(Battery_Face *face); -static void _battery_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _battery_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _battery_face_level_set(Battery_Face *ef, double level); -static void _battery_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); - -static int _battery_int_get(char *buf); -static char *_battery_string_get(char *buf); - -static void _battery_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); - -static E_Config_DD *conf_edd; -static E_Config_DD *conf_face_edd; - -static int battery_count; - -/* public module routines. all modules must have these */ -EAPI E_Module_Api e_modapi = +/***************************************************************************/ +/**/ +/* gadcon requirements */ +static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient(E_Gadcon_Client *gcc); +/* and actually define the gadcon class that this module provides (just 1) */ +static const E_Gadcon_Client_Class _gadcon_class = { - E_MODULE_API_VERSION, - "Battery" + GADCON_CLIENT_CLASS_VERSION, + "battery", + { + _gc_init, _gc_shutdown, _gc_orient + } +}; +/**/ +/***************************************************************************/ + +/***************************************************************************/ +/**/ +/* actual module specifics */ + +typedef struct _Instance Instance; + +struct _Instance +{ + E_Gadcon_Client *gcc; + Evas_Object *o_battery; }; -EAPI void * -e_modapi_init(E_Module *m) -{ - Battery *e; +static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _menu_cb_post(void *data, E_Menu *m); +static Status *_battery_linux_acpi_check(void); +static Status *_battery_linux_apm_check(void); +static Status *_battery_linux_powerbook_check(void); +#ifdef __FreeBSD__ +static Status *_battery_bsd_acpi_check(void); +static Status *_battery_bsd_apm_check(void); +#endif +#ifdef HAVE_CFBASE_H +static Status *_battery_darwin_check(void); +#endif +static void _battery_face_level_set(Instance *inst, double level); +static int _battery_int_get(char *buf); +static char *_battery_string_get(char *buf); +static int _battery_cb_check(void *data); +static void _battery_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); - /* actually init battery */ - e = _battery_new(); - m->config_menu = e->config_menu; - return e; -} +static E_Config_DD *conf_edd = NULL; -EAPI int -e_modapi_shutdown(E_Module *m) -{ - Battery *e; - if (m->config_menu) - m->config_menu = NULL; +Config *battery_config = NULL; - e = m->data; - if (e) - { - if (e->config_dialog) - { - e_object_del(E_OBJECT(e->config_dialog)); - e->config_dialog = NULL; - } - _battery_shutdown(e); - } - return 1; -} - -EAPI int -e_modapi_save(E_Module *m) -{ - Battery *e; - - e = m->data; - e_config_domain_save("module.battery", conf_edd, e->conf); - return 1; -} - -EAPI int -e_modapi_info(E_Module *m) -{ - char buf[4096]; - - snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m)); - m->icon_file = strdup(buf); - return 1; -} - -EAPI int -e_modapi_about(E_Module *m) -{ - e_module_dialog_show(_("Enlightenment Battery Module"), - _("A basic battery meter that uses either" - "ACPI or APM
" - "on Linux to monitor your battery and AC power adaptor
" - "status. This will work under Linux and FreeBSD and is only
" - "as accurate as your BIOS or kernel drivers.")); - return 1; -} - -EAPI int -e_modapi_config(E_Module *m) -{ - Battery *e; - Evas_List *l; - - e = m->data; - if (!e) return 0; - if (!e->faces) return 0; - for (l = e->faces; l; l = l->next) - { - Battery_Face *face; - face = l->data; - if (!face) return 0; - if (face->con == e_container_current_get(e_manager_current_get())) - { - _config_battery_module(face->con, face->battery); - break; - } - } - return 1; -} - -/* module private routines */ -static Battery * -_battery_new() -{ - Battery *e; - Evas_List *managers, *l, *l2, *cl; - - E_Menu_Item *mi; - - battery_count = 0; - e = E_NEW(Battery, 1); - if (!e) return NULL; - - conf_face_edd = E_CONFIG_DD_NEW("Battery_Config_Face", Config_Face); -#undef T -#undef D -#define T Config_Face -#define D conf_face_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); - - conf_edd = E_CONFIG_DD_NEW("Battery_Config", Config); -#undef T -#undef D -#define T Config -#define D conf_edd - E_CONFIG_VAL(D, T, poll_time, DOUBLE); - E_CONFIG_VAL(D, T, alarm, INT); - E_CONFIG_LIST(D, T, faces, conf_face_edd); - - e->conf = e_config_domain_load("module.battery", conf_edd); - if (!e->conf) - { - e->conf = E_NEW(Config, 1); - e->conf->poll_time = 30.0; - e->conf->alarm = 30; - } - E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0); - E_CONFIG_LIMIT(e->conf->alarm, 0, 60); - - _battery_config_menu_new(e); - - e->battery_check_mode = CHECK_NONE; - e->battery_prev_drain = 1; - e->battery_prev_ac = -1; - e->battery_prev_battery = -1; - e->battery_check_timer = ecore_timer_add(e->conf->poll_time, _battery_cb_check, e); - - managers = e_manager_list(); - cl = e->conf->faces; - for (l = managers; l; l = l->next) - { - E_Manager *man; - - man = l->data; - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - Battery_Face *ef; - - con = l2->data; - ef = _battery_face_new(e, con); - if (ef) - { - ef->battery = e; - e->faces = evas_list_append(e->faces, ef); - - /* Config */ - if (!cl) - { - ef->conf = E_NEW(Config_Face, 1); - ef->conf->enabled = 1; - e->conf->faces = evas_list_append(e->conf->faces, ef->conf); - } - else - { - ef->conf = cl->data; - cl = cl->next; - } - - /* Menu */ - /* This menu must be initialized after conf */ - _battery_face_menu_new(ef); - - /* Add main menu to face menu */ - mi = e_menu_item_new(e->config_menu); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _battery_face_cb_menu_configure, ef); - - mi = e_menu_item_new(e->config_menu); - e_menu_item_label_set(mi, con->name); - e_menu_item_submenu_set(mi, ef->menu); - - /* Setup */ - if (!ef->conf->enabled) - _battery_face_disable(ef); - } - } - } - - _battery_cb_check(e); - - return e; -} - -static void -_battery_shutdown(Battery *e) -{ - Evas_List *l; - - E_CONFIG_DD_FREE(conf_edd); - E_CONFIG_DD_FREE(conf_face_edd); - - for (l = e->faces; l; l = l->next) - _battery_face_free(l->data); - evas_list_free(e->faces); - - e_object_del(E_OBJECT(e->config_menu)); - - ecore_timer_del(e->battery_check_timer); - - evas_list_free(e->conf->faces); - free(e->conf); - free(e); -} - -static void -_battery_config_menu_new(Battery *e) -{ - E_Menu *mn; - - /* Alarm */ - mn = e_menu_new(); - e->config_menu = mn; -} - -static Battery_Face * -_battery_face_new(Battery *bat, E_Container *con) +static E_Gadcon_Client * +_gc_init(E_Gadcon *gc, char *name, char *id, char *style) { Evas_Object *o; - Battery_Face *ef; - E_Gadman_Policy policy; - - ef = E_NEW(Battery_Face, 1); - if (!ef) return NULL; - - ef->con = con; - e_object_ref(E_OBJECT(con)); - - evas_event_freeze(con->bg_evas); - o = edje_object_add(con->bg_evas); - ef->bat_object = o; - + E_Gadcon_Client *gcc; + Instance *inst; + + inst = E_NEW(Instance, 1); + + o = edje_object_add(gc->evas); e_theme_edje_object_set(o, "base/theme/modules/battery", "modules/battery/main"); - evas_object_show(o); - - o = evas_object_rectangle_add(con->bg_evas); - ef->event_object = o; - evas_object_layer_set(o, 2); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _battery_face_cb_mouse_down, ef); - evas_object_show(o); - - ef->gmc = e_gadman_client_new(con->gadman); - e_gadman_client_domain_set(ef->gmc, "module.battery", battery_count++); - - policy = E_GADMAN_POLICY_ANYWHERE | - E_GADMAN_POLICY_HMOVE | - E_GADMAN_POLICY_VMOVE | - E_GADMAN_POLICY_HSIZE | - E_GADMAN_POLICY_VSIZE; - e_gadman_client_policy_set(ef->gmc, policy); - e_gadman_client_min_size_set(ef->gmc, 4, 4); - e_gadman_client_max_size_set(ef->gmc, 128, 128); - e_gadman_client_auto_size_set(ef->gmc, 40, 40); - e_gadman_client_align_set(ef->gmc, 1.0, 1.0); - e_gadman_client_resize(ef->gmc, 40, 40); - e_gadman_client_change_func_set(ef->gmc, _battery_face_cb_gmc_change, ef); - e_gadman_client_load(ef->gmc); - evas_event_thaw(con->bg_evas); - - return ef; -} - -static void -_battery_face_free(Battery_Face *ef) -{ - e_object_unref(E_OBJECT(ef->con)); - e_object_del(E_OBJECT(ef->gmc)); - e_object_del(E_OBJECT(ef->menu)); - evas_object_del(ef->bat_object); - evas_object_del(ef->event_object); - - free(ef->conf); - free(ef); - battery_count--; -} - -static void -_battery_face_menu_new(Battery_Face *face) -{ - E_Menu *mn; - E_Menu_Item *mi; - - mn = e_menu_new(); - face->menu = mn; - - /* Config */ - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _battery_face_cb_menu_configure, face); - /* Edit */ - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Edit Mode")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets"); - e_menu_item_callback_set(mi, _battery_face_cb_menu_edit, face); + gcc = e_gadcon_client_new(gc, name, id, style, o); + gcc->data = inst; + + inst->gcc = gcc; + inst->o_battery = o; + + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _button_cb_mouse_down, inst); + battery_config->instances = evas_list_append(battery_config->instances, inst); + battery_config->battery_check_mode = CHECK_NONE; + battery_config->battery_prev_drain = 1; + battery_config->battery_prev_ac = -1; + battery_config->battery_prev_battery = -1; + _battery_cb_check(NULL); + return gcc; } static void -_battery_face_enable(Battery_Face *face) +_gc_shutdown(E_Gadcon_Client *gcc) { - face->conf->enabled = 1; - evas_object_show(face->bat_object); - evas_object_show(face->event_object); - e_config_save_queue(); + Instance *inst; + + inst = gcc->data; + battery_config->instances = evas_list_remove(battery_config->instances, inst); + evas_object_del(inst->o_battery); + free(inst); } static void -_battery_face_disable(Battery_Face *face) +_gc_orient(E_Gadcon_Client *gcc) { - face->conf->enabled = 0; - evas_object_hide(face->bat_object); - evas_object_hide(face->event_object); - e_config_save_queue(); + Instance *inst; + + inst = gcc->data; + e_gadcon_client_aspect_set(gcc, 16, 16); + e_gadcon_client_min_size_set(gcc, 16, 16); } +/**/ +/***************************************************************************/ +/***************************************************************************/ +/**/ static void -_battery_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) -{ - Battery_Face *ef; - Evas_Coord x, y, w, h; - - ef = data; - switch (change) - { - case E_GADMAN_CHANGE_MOVE_RESIZE: - e_gadman_client_geometry_get(ef->gmc, &x, &y, &w, &h); - evas_object_move(ef->bat_object, x, y); - evas_object_move(ef->event_object, x, y); - evas_object_resize(ef->bat_object, w, h); - evas_object_resize(ef->event_object, w, h); - break; - case E_GADMAN_CHANGE_RAISE: - evas_object_raise(ef->bat_object); - evas_object_raise(ef->event_object); - break; - case E_GADMAN_CHANGE_EDGE: - case E_GADMAN_CHANGE_ZONE: - /* FIXME - * Must we do something here? - */ - break; - } -} - -static void -_battery_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { + Instance *inst; Evas_Event_Mouse_Down *ev; - Battery_Face *ef; - + + inst = data; ev = event_info; - ef = data; - if (ev->button == 3) + if ((ev->button == 3) && (!battery_config->menu)) { - e_menu_activate_mouse(ef->menu, e_zone_current_get(ef->con), - ev->output.x, ev->output.y, 1, 1, + E_Menu *mn; + E_Menu_Item *mi; + int cx, cy, cw, ch; + + mn = e_menu_new(); + e_menu_post_deactivate_callback_set(mn, _menu_cb_post, inst); + battery_config->menu = mn; + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Configuration")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); + e_menu_item_callback_set(mi, _battery_face_cb_menu_configure, NULL); + + e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0); + + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, + &cx, &cy, &cw, &ch); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - e_util_container_fake_mouse_up_all_later(ef->con); + evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); } } +static void +_menu_cb_post(void *data, E_Menu *m) +{ + if (!battery_config->menu) return; + e_object_del(E_OBJECT(battery_config->menu)); + battery_config->menu = NULL; +} + static int _battery_cb_check(void *data) { - Battery *ef; - Battery_Face *face; - Evas_List *l; + Instance *inst; Status *ret = NULL; - - ef = data; + Evas_List *l; #ifdef __FreeBSD__ int acline; size_t len; int apm_fd = -1; int acline_mib[3] = {-1}; - - if (ef->battery_check_mode == 0) +#endif + +#ifdef __FreeBSD__ + if (battery_config->battery_check_mode == 0) { len = sizeof(acline); if (sysctlbyname("hw.acpi.acline", &acline, &len, NULL, 0) == 0) @@ -482,177 +207,153 @@ _battery_cb_check(void *data) switch (ef->battery_check_mode) { case CHECK_ACPI: - ret = _battery_bsd_acpi_check(ef); + ret = _battery_bsd_acpi_check(); break; case CHECK_APM: - ret = _battery_bsd_apm_check(ef); + ret = _battery_bsd_apm_check(); break; default: break; } #elif defined(HAVE_CFBASE_H) /* OS X */ - ret = _battery_darwin_check(ef); + ret = _battery_darwin_check(); #else - if (ef->battery_check_mode == 0) + if (battery_config->battery_check_mode == 0) { if (ecore_file_is_dir("/proc/acpi")) - ef->battery_check_mode = CHECK_ACPI; + battery_config->battery_check_mode = CHECK_ACPI; else if (ecore_file_exists("/proc/apm")) - ef->battery_check_mode = CHECK_APM; + battery_config->battery_check_mode = CHECK_APM; else if (ecore_file_is_dir("/proc/pmu")) - ef->battery_check_mode = CHECK_PMU; + battery_config->battery_check_mode = CHECK_PMU; } - switch (ef->battery_check_mode) + switch (battery_config->battery_check_mode) { case CHECK_ACPI: - ret = _battery_linux_acpi_check(ef); + ret = _battery_linux_acpi_check(); break; case CHECK_APM: - ret = _battery_linux_apm_check(ef); + ret = _battery_linux_apm_check(); break; case CHECK_PMU: - ret = _battery_linux_powerbook_check(ef); + ret = _battery_linux_powerbook_check(); break; default: break; } #endif - if (ret) + for (l = battery_config->instances; l; l = l->next) { - if (ret->has_battery) + Instance *inst; + + inst = l->data; + if (ret) { - if (ret->state == BATTERY_STATE_CHARGING) + if (ret->has_battery) { - for (l = ef->faces; l; l = l->next) + if (ret->state == BATTERY_STATE_CHARGING) { - face = l->data; - if (ef->battery_prev_ac != 1) - edje_object_signal_emit(face->bat_object, "charge", ""); - edje_object_signal_emit(face->bat_object, "pulsestop", ""); - edje_object_part_text_set(face->bat_object, "reading", ret->reading); - edje_object_part_text_set(face->bat_object, "time", ret->time); - _battery_face_level_set(face, ret->level); - + if (battery_config->battery_prev_ac != 1) + edje_object_signal_emit(inst->o_battery, "charge", ""); + edje_object_signal_emit(inst->o_battery, "pulsestop", ""); + edje_object_part_text_set(inst->o_battery, "reading", ret->reading); + edje_object_part_text_set(inst->o_battery, "time", ret->time); + _battery_face_level_set(inst, ret->level); + battery_config->battery_prev_ac = 1; } - ef->battery_prev_ac = 1; - } - else if (ret->state == BATTERY_STATE_DISCHARGING) - { - for (l = ef->faces; l; l = l->next) + else if (ret->state == BATTERY_STATE_DISCHARGING) { - face = l->data; - if (ef->battery_prev_ac != 0) - edje_object_signal_emit(face->bat_object, "discharge", ""); + if (battery_config->battery_prev_ac != 0) + edje_object_signal_emit(inst->o_battery, "discharge", ""); if (ret->alarm) { - if (!ef->alarm_triggered) + if (!battery_config->alarm_triggered) { E_Dialog *dia; - + dia = e_dialog_new(e_container_current_get(e_manager_current_get())); if (!dia) return 0; e_dialog_title_set(dia, "Enlightenment Battery Module"); e_dialog_icon_set(dia, "enlightenment/e", 64); - e_dialog_text_set(dia, _("Battery Running Low
" - "Your battery is running low.
" - "You may wish to switch to an AC source.")); + e_dialog_text_set(dia, + _("Battery Running Low
" + "Your battery is running low.
" + "You may wish to switch to an AC source.")); e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL); e_win_centered_set(dia->win, 1); e_dialog_show(dia); } - edje_object_signal_emit(face->bat_object, "pulse", ""); + edje_object_signal_emit(inst->o_battery, "pulse", ""); } - edje_object_part_text_set(face->bat_object, "reading", ret->reading); - edje_object_part_text_set(face->bat_object, "time", ret->time); - _battery_face_level_set(face, ret->level); - + edje_object_part_text_set(inst->o_battery, "reading", ret->reading); + edje_object_part_text_set(inst->o_battery, "time", ret->time); + _battery_face_level_set(inst, ret->level); + battery_config->battery_prev_ac = 0; + if (ret->alarm) + battery_config->alarm_triggered = 1; + } + else + { + /* ret->state == BATTERY_STATE_NONE */ + if (battery_config->battery_prev_ac != 1) + edje_object_signal_emit(inst->o_battery, "charge", ""); + if (battery_config->battery_prev_battery == 0) + edje_object_signal_emit(inst->o_battery, "charge", ""); + edje_object_part_text_set(inst->o_battery, "reading", ret->reading); + edje_object_part_text_set(inst->o_battery, "time", ret->time); + _battery_face_level_set(inst, ret->level); + battery_config->battery_prev_ac = 1; + battery_config->battery_prev_battery = 1; } - ef->battery_prev_ac = 0; - if (ret->alarm) - ef->alarm_triggered = 1; } else { - /* ret->state == BATTERY_STATE_NONE */ - for (l = ef->faces; l; l = l->next) - { - face = l->data; - if (ef->battery_prev_ac != 1) - edje_object_signal_emit(face->bat_object, "charge", ""); - if (ef->battery_prev_battery == 0) - edje_object_signal_emit(face->bat_object, "charge", ""); - edje_object_part_text_set(face->bat_object, "reading", ret->reading); - edje_object_part_text_set(face->bat_object, "time", ret->time); - _battery_face_level_set(face, ret->level); - - } - ef->battery_prev_ac = 1; - ef->battery_prev_battery = 1; + /* Hasn't battery */ + if (battery_config->battery_prev_battery != 0) + edje_object_signal_emit(inst->o_battery, "unknown", ""); + edje_object_part_text_set(inst->o_battery, "reading", ret->reading); + edje_object_part_text_set(inst->o_battery, "time", ret->time); + _battery_face_level_set(inst, ret->level); + battery_config->battery_prev_battery = 0; } + free(ret->reading); + free(ret->time); + free(ret); } else { - /* Hasn't battery */ - for (l = ef->faces; l; l = l->next) - { - face = l->data; - if (ef->battery_prev_battery != 0) - edje_object_signal_emit(face->bat_object, "unknown", ""); - edje_object_part_text_set(face->bat_object, "reading", ret->reading); - edje_object_part_text_set(face->bat_object, "time", ret->time); - _battery_face_level_set(face, ret->level); - - } - ef->battery_prev_battery = 0; + /* Error reading status */ + if (battery_config->battery_prev_battery != -2) + edje_object_signal_emit(inst->o_battery, "unknown", ""); + edje_object_part_text_set(inst->o_battery, "reading", _("NO INFO")); + edje_object_part_text_set(inst->o_battery, "time", "--:--"); + _battery_face_level_set(inst, (double)(rand() & 0xff) / 255.0); + battery_config->battery_prev_battery = -2; + battery_config->battery_check_mode = CHECK_NONE; } - free(ret->reading); - free(ret->time); - free(ret); - } - else - { - /* Error reading status */ - for (l = ef->faces; l; l = l->next) - { - face = l->data; - - if (ef->battery_prev_battery != -2) - edje_object_signal_emit(face->bat_object, "unknown", ""); - edje_object_part_text_set(face->bat_object, "reading", _("NO INFO")); - edje_object_part_text_set(face->bat_object, "time", "--:--"); - _battery_face_level_set(face, (double)(rand() & 0xff) / 255.0); - } - ef->battery_prev_battery = -2; - ef->battery_check_mode = CHECK_NONE; } return 1; } static Status * -_battery_linux_acpi_check(Battery *ef) +_battery_linux_acpi_check(void) { Ecore_List *bats; char buf[4096], buf2[4096]; char *name; - int bat_max = 0; int bat_filled = 0; int bat_level = 0; int bat_drain = 1; - int bat_val = 0; - int discharging = 0; int charging = 0; int battery = 0; - int design_cap_unknown = 0; int last_full_unknown = 0; int rate_unknown = 0; int level_unknown = 0; - int hours, minutes; - Status *stat; stat = E_NEW(Status, 1); @@ -767,9 +468,9 @@ _battery_linux_acpi_check(Battery *ef) ecore_list_destroy(bats); } - if (ef->battery_prev_drain < 1) ef->battery_prev_drain = 1; - if (bat_drain < 1) bat_drain = ef->battery_prev_drain; - ef->battery_prev_drain = bat_drain; + if (battery_config->battery_prev_drain < 1) battery_config->battery_prev_drain = 1; + if (bat_drain < 1) bat_drain = battery_config->battery_prev_drain; + battery_config->battery_prev_drain = bat_drain; if (bat_filled > 0) bat_val = (100 * bat_level) / bat_filled; else bat_val = 100; @@ -799,19 +500,19 @@ _battery_linux_acpi_check(Battery *ef) } else if ((charging) || (discharging)) { - ef->battery_prev_battery = 1; + battery_config->battery_prev_battery = 1; stat->has_battery = 1; if (charging) { stat->state = BATTERY_STATE_CHARGING; - ef->alarm_triggered = 0; + battery_config->alarm_triggered = 0; } else if (discharging) { stat->state = BATTERY_STATE_DISCHARGING; if (stat->level < 0.1) { - if (((hours * 60) + minutes) <= ef->conf->alarm) + if (((hours * 60) + minutes) <= battery_config->alarm) stat->alarm = 1; } } @@ -849,7 +550,7 @@ _battery_linux_acpi_check(Battery *ef) } static Status * -_battery_linux_apm_check(Battery *ef) +_battery_linux_apm_check(void) { FILE *f; char s[256], s1[32], s2[32], s3[32], buf[4096]; @@ -888,7 +589,7 @@ _battery_linux_apm_check(Battery *ef) } - ef->battery_prev_battery = 1; + battery_config->battery_prev_battery = 1; stat->has_battery = 1; if (bat_val >= 0) { @@ -936,7 +637,7 @@ _battery_linux_apm_check(Battery *ef) stat->time = strdup(buf); if (stat->level < 0.1) { - if (((hours * 60) + minutes) <= ef->conf->alarm) + if (((hours * 60) + minutes) <= battery_config->alarm) stat->alarm = 1; } } @@ -981,7 +682,7 @@ axtoi(char *arg) } static Status * -_battery_linux_powerbook_check(Battery *ef) +_battery_linux_powerbook_check(void) { Ecore_List *bats; char buf[4096], buf2[4096]; @@ -1116,14 +817,14 @@ _battery_linux_powerbook_check(Battery *ef) if (charging) { stat->state = BATTERY_STATE_CHARGING; - ef->alarm_triggered = 0; + battery_config->alarm_triggered = 0; } else if (discharging) { stat->state = BATTERY_STATE_DISCHARGING; if (stat->level < 0.1) { - if (((hours * 60) + minutes) <= ef->conf->alarm) + if (((hours * 60) + minutes) <= battery_config->alarm) stat->alarm = 1; } } @@ -1151,7 +852,7 @@ _battery_linux_powerbook_check(Battery *ef) #ifdef __FreeBSD__ static Status * -_battery_bsd_acpi_check(Battery *ef) +_battery_bsd_acpi_check(void) { /* Assumes only a single battery - I don't know how multiple batts * are represented in sysctl */ @@ -1225,13 +926,13 @@ _battery_bsd_acpi_check(Battery *ef) /* ERROR */ batteries = 1; - if (ef->battery_prev_drain < 1) - ef->battery_prev_drain = 1; + if (battery_config->battery_prev_drain < 1) + battery_config->battery_prev_drain = 1; if (bat_drain < 1) - bat_drain = ef->battery_prev_drain; + bat_drain = battery_config->battery_prev_drain; - ef->battery_prev_drain = bat_drain; + battery_config->battery_prev_drain = bat_drain; /*if (bat_filled > 0) bat_val = (100 * bat_level) / bat_filled; @@ -1267,19 +968,19 @@ _battery_bsd_acpi_check(Battery *ef) else if ((state == BATTERY_STATE_CHARGING) || (state == BATTERY_STATE_DISCHARGING)) { - ef->battery_prev_battery = 1; + battery_config->battery_prev_battery = 1; stat->has_battery = 1; if (state == BATTERY_STATE_CHARGING) { stat->state = BATTERY_STATE_CHARGING; - ef->alarm_triggered = 0; + battery_config->alarm_triggered = 0; } else if (state == BATTERY_STATE_DISCHARGING) { stat->state = BATTERY_STATE_DISCHARGING; if (stat->level < 0.1) /* Why this if condition */ { - if (((hours * 60) + minutes) <= ef->conf->alarm) + if (((hours * 60) + minutes) <= battery_config->alarm) stat->alarm = 1; } } @@ -1317,7 +1018,7 @@ _battery_bsd_acpi_check(Battery *ef) } static Status * -_battery_bsd_apm_check(Battery *ef) +_battery_bsd_apm_check(void) { #ifdef __i386__ int ac_stat, bat_stat, bat_val, time_val; @@ -1358,7 +1059,7 @@ _battery_bsd_apm_check(Battery *ef) } - ef->battery_prev_battery = 1; + battery_config->battery_prev_battery = 1; stat->has_battery = 1; if (ac_stat) /* Wallpowered */ @@ -1402,7 +1103,7 @@ _battery_bsd_apm_check(Battery *ef) if (stat->level < 0.1) /* Why this if condition? */ { - if (((hours * 60) + minutes) <= ef->conf->alarm) + if (((hours * 60) + minutes) <= battery_config->alarm) stat->alarm = 1; } } @@ -1419,7 +1120,7 @@ _battery_bsd_apm_check(Battery *ef) * There is a good chance this will work with a UPS as well as a battery. */ static Status * -_battery_darwin_check(Battery *ef) +_battery_darwin_check(void) { const void *values; int device_num; @@ -1496,7 +1197,7 @@ _battery_darwin_check(Battery *ef) /* * A battery was found so move along based on that assumption. */ - ef->battery_prev_battery = 1; + battery_config->battery_prev_battery = 1; stat->has_battery = 1; /* @@ -1540,7 +1241,7 @@ _battery_darwin_check(Battery *ef) /* * Check if an alarm should be raised. */ - if (currentval <= ef->conf->alarm) + if (currentval <= battery_config->alarm) stat->alarm = 1; } else @@ -1574,23 +1275,14 @@ _battery_darwin_check(Battery *ef) #endif static void -_battery_face_level_set(Battery_Face *ef, double level) +_battery_face_level_set(Instance *inst, double level) { Edje_Message_Float msg; if (level < 0.0) level = 0.0; else if (level > 1.0) level = 1.0; msg.val = level; - edje_object_message_send(ef->bat_object, EDJE_MESSAGE_FLOAT, 1, &msg); -} - -static void -_battery_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Battery_Face *face; - - face = data; - e_gadman_mode_set(face->gmc->gadman, E_GADMAN_MODE_EDIT); + edje_object_message_send(inst->o_battery, EDJE_MESSAGE_FLOAT, 1, &msg); } static int @@ -1626,18 +1318,113 @@ _battery_string_get(char *buf) static void _battery_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi) { - Battery_Face *face; - - face = data; - if (!face) return; - _config_battery_module(face->con, face->battery); + if (!battery_config) return; + if (battery_config->config_dialog) return; + _config_battery_module(); } -void -_battery_face_cb_config_updated(Battery *bat) +void +_battery_config_updated(void) { - /* Update Poll Time */ - ecore_timer_del(bat->battery_check_timer); - bat->battery_check_timer = ecore_timer_add(bat->conf->poll_time, _battery_cb_check, bat); + if (!battery_config) return; + ecore_timer_del(battery_config->battery_check_timer); + battery_config->battery_check_timer = ecore_timer_add(battery_config->poll_time, + _battery_cb_check, NULL); + _battery_cb_check(NULL); } +/***************************************************************************/ +/**/ +/* module setup */ +EAPI E_Module_Api e_modapi = +{ + E_MODULE_API_VERSION, + "Battery" +}; + +EAPI void * +e_modapi_init(E_Module *m) +{ + conf_edd = E_CONFIG_DD_NEW("Battery_Config", Config); +#undef T +#undef D +#define T Config +#define D conf_edd + E_CONFIG_VAL(D, T, poll_time, DOUBLE); + E_CONFIG_VAL(D, T, alarm, INT); + + battery_config = e_config_domain_load("module.battery", conf_edd); + if (!battery_config) + { + battery_config = E_NEW(Config, 1); + battery_config->poll_time = 30.0; + battery_config->alarm = 30; + } + E_CONFIG_LIMIT(battery_config->poll_time, 0.5, 1000.0); + E_CONFIG_LIMIT(battery_config->alarm, 0, 60); + + battery_config->battery_check_mode = CHECK_NONE; + battery_config->battery_prev_drain = 1; + battery_config->battery_prev_ac = -1; + battery_config->battery_prev_battery = -1; + battery_config->battery_check_timer = ecore_timer_add(battery_config->poll_time, + _battery_cb_check, NULL); + e_gadcon_provider_register(&_gadcon_class); + return 1; +} + +EAPI int +e_modapi_shutdown(E_Module *m) +{ + e_gadcon_provider_unregister(&_gadcon_class); + + if (battery_config->config_dialog) + e_object_del(E_OBJECT(battery_config->config_dialog)); + if (battery_config->battery_check_timer) + ecore_timer_del(battery_config->battery_check_timer); + if (battery_config->menu) e_object_del(E_OBJECT(battery_config->menu)); + free(battery_config); + battery_config = NULL; + E_CONFIG_DD_FREE(conf_edd); + return 1; +} + +EAPI int +e_modapi_save(E_Module *m) +{ + e_config_domain_save("module.battery", conf_edd, battery_config); + return 1; +} + +EAPI int +e_modapi_info(E_Module *m) +{ + char buf[4096]; + + snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m)); + m->icon_file = strdup(buf); + return 1; +} + +EAPI int +e_modapi_about(E_Module *m) +{ + e_module_dialog_show(_("Enlightenment Battery Module"), + _("A basic battery meter that uses either" + "ACPI or APM
" + "on Linux to monitor your battery and AC power adaptor
" + "status. This will work under Linux and FreeBSD and is only
" + "as accurate as your BIOS or kernel drivers.")); + return 1; +} + +EAPI int +e_modapi_config(E_Module *m) +{ + if (!battery_config) return 0; + if (battery_config->config_dialog) return 0; + _config_battery_module(); + return 1; +} +/**/ +/***************************************************************************/ diff --git a/src/modules/battery/e_mod_main.h b/src/modules/battery/e_mod_main.h index 6420821cf..f16fde742 100644 --- a/src/modules/battery/e_mod_main.h +++ b/src/modules/battery/e_mod_main.h @@ -5,10 +5,6 @@ #define E_MOD_MAIN_H typedef struct _Config Config; -typedef struct _Config_Face Config_Face; -typedef struct _Battery Battery; -typedef struct _Battery_Face Battery_Face; - typedef struct _Status Status; #define CHECK_NONE 0 @@ -18,44 +14,19 @@ typedef struct _Status Status; struct _Config { - double poll_time; - int alarm; - Evas_List *faces; -}; - -struct _Config_Face -{ - unsigned char enabled; -}; - -struct _Battery -{ - E_Menu *config_menu; - Evas_List *faces; - - Config *conf; - int alarm_triggered; - - int battery_check_mode; - Ecore_Timer *battery_check_timer; - int battery_prev_drain; - int battery_prev_ac; - int battery_prev_battery; + /* saved * loaded config values */ + double poll_time; + int alarm; + /* just config state */ E_Config_Dialog *config_dialog; -}; - -struct _Battery_Face -{ - Battery *battery; - E_Container *con; - - E_Menu *menu; - Config_Face *conf; - - Evas_Object *bat_object; - Evas_Object *event_object; - - E_Gadman_Client *gmc; + Evas_List *instances; + E_Menu *menu; + int alarm_triggered; + int battery_check_mode; + Ecore_Timer *battery_check_timer; + int battery_prev_drain; + int battery_prev_ac; + int battery_prev_battery; }; #ifdef __FreeBSD__ @@ -95,6 +66,8 @@ EAPI int e_modapi_info (E_Module *m); EAPI int e_modapi_about (E_Module *m); EAPI int e_modapi_config (E_Module *m); -void _battery_face_cb_config_updated(Battery *bat); +void _config_battery_module(void); +void _battery_config_updated(void); +extern Config *battery_config; #endif diff --git a/src/modules/clock/Makefile.am b/src/modules/clock/Makefile.am index 782c308ca..20a027de4 100644 --- a/src/modules/clock/Makefile.am +++ b/src/modules/clock/Makefile.am @@ -19,9 +19,7 @@ INCLUDES = -I. \ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) pkg_LTLIBRARIES = module.la module_la_SOURCES = e_mod_main.c \ - e_mod_main.h \ - e_mod_config.c \ - e_mod_config.h + e_mod_main.h module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/src/modules/clock/e_mod_config.c b/src/modules/clock/e_mod_config.c deleted file mode 100644 index c6fa3ad06..000000000 --- a/src/modules/clock/e_mod_config.c +++ /dev/null @@ -1,99 +0,0 @@ -#include "e.h" -#include "e_mod_main.h" -#include "e_mod_config.h" -#include "config.h" - -struct _E_Config_Dialog_Data -{ - int digital_style; -}; - -/* Protos */ -static void *_create_data(E_Config_Dialog *cfd); -static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); -static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); -static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); - -void -_config_clock_module(E_Container *con, Clock_Face *c) -{ - E_Config_Dialog *cfd; - E_Config_Dialog_View *v; - - v = E_NEW(E_Config_Dialog_View, 1); - - /* Dialog Methods */ - v->create_cfdata = _create_data; - v->free_cfdata = _free_data; - v->basic.apply_cfdata = _basic_apply_data; - v->basic.create_widgets = _basic_create_widgets; - - /* Create The Dialog */ - cfd = e_config_dialog_new(con, _("Clock Configuration"), NULL, 0, v, c); - c->config_dialog = cfd; -} - -static void -_fill_data(Clock_Face *clk, E_Config_Dialog_Data *cfdata) -{ - cfdata->digital_style = clk->conf->digitalStyle; -} - -static void * -_create_data(E_Config_Dialog *cfd) -{ - E_Config_Dialog_Data *cfdata; - Clock_Face *cf; - - cf = cfd->data; - cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(cf, cfdata); - return cfdata; -} - -static void -_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) -{ - Clock_Face *c; - - c = cfd->data; - c->config_dialog = NULL; - free(cfdata); -} - -static Evas_Object * -_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) -{ - Evas_Object *o, *of, *ob; - E_Radio_Group *rg; - - o = e_widget_list_add(evas, 0, 0); - of = e_widget_framelist_add(evas, _("General Settings"), 0); - rg = e_widget_radio_group_new(&(cfdata->digital_style)); - ob = e_widget_radio_add(evas, _("No Digital Display"), 0, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("12 Hour Display"), 1, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("24 Hour Display"), 2, rg); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - return o; -} - -static int -_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) -{ - Clock_Face *clk; - - clk = cfd->data; - e_border_button_bindings_ungrab_all(); - clk->conf->digitalStyle = cfdata->digital_style; - - e_border_button_bindings_grab_all(); - e_config_save_queue(); - - _clock_face_cb_config_updated(clk); - return 1; -} - diff --git a/src/modules/clock/e_mod_config.h b/src/modules/clock/e_mod_config.h deleted file mode 100644 index 7c53bdcce..000000000 --- a/src/modules/clock/e_mod_config.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifdef E_TYPEDEFS -#else -#ifndef E_MOD_CONFIG_H -#define E_MOD_CONFIG_H -#include "e_mod_main.h" -void _config_clock_module(E_Container *con, Clock_Face *c); -#endif -#endif diff --git a/src/modules/clock/e_mod_main.c b/src/modules/clock/e_mod_main.c index bfa485c5b..b86b89b34 100644 --- a/src/modules/clock/e_mod_main.c +++ b/src/modules/clock/e_mod_main.c @@ -3,39 +3,93 @@ */ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" -/* TODO List: - * - */ +/***************************************************************************/ +/**/ +/* gadcon requirements */ +static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient(E_Gadcon_Client *gcc); +/* and actually define the gadcon class that this module provides (just 1) */ +static const E_Gadcon_Client_Class _gadcon_class = +{ + GADCON_CLIENT_CLASS_VERSION, + "clock", + { + _gc_init, _gc_shutdown, _gc_orient + } +}; +/**/ +/***************************************************************************/ -/* module private routines */ -static Clock *_clock_new(); -static void _clock_shutdown(Clock *clock); -static void _clock_config_menu_new(Clock *clock); +/***************************************************************************/ +/**/ +/* actual module specifics */ -static Clock_Face *_clock_face_new(Clock *clock, E_Container *con); -static void _clock_face_free(Clock_Face *face); -/* static void _clock_face_enable(Clock_Face *face); */ -static void _clock_face_disable(Clock_Face *face); -static void _clock_face_menu_new(Clock_Face *face); -static void _clock_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _clock_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _clock_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); -static void _clock_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); +typedef struct _Instance Instance; -static int _clock_count; +struct _Instance +{ + E_Gadcon_Client *gcc; + Evas_Object *o_clock; +}; -static E_Config_DD *conf_edd; -static E_Config_DD *conf_face_edd; +static E_Gadcon_Client * +_gc_init(E_Gadcon *gc, char *name, char *id, char *style) +{ + Evas_Object *o; + E_Gadcon_Client *gcc; + Instance *inst; + + inst = E_NEW(Instance, 1); + + o = edje_object_add(gc->evas); + e_theme_edje_object_set(o, "base/theme/modules/clock", + "modules/clock/main"); + evas_object_show(o); + + gcc = e_gadcon_client_new(gc, name, id, style, o); + gcc->data = inst; + + inst->gcc = gcc; + inst->o_clock = o; + + e_gadcon_client_util_menu_attach(gcc); + + return gcc; +} -const int - DIGITAL_STYLE_NONE = 0, - DIGITAL_STYLE_12HOUR = 1, - DIGITAL_STYLE_24HOUR = 2 - ; +static void +_gc_shutdown(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + evas_object_del(inst->o_clock); + free(inst); +} -/* public module routines. all modules must have these */ +static void +_gc_orient(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + e_gadcon_client_aspect_set(gcc, 16, 16); + e_gadcon_client_min_size_set(gcc, 16, 16); +} +/**/ +/***************************************************************************/ + +/***************************************************************************/ +/**/ + +/**/ +/***************************************************************************/ + +/***************************************************************************/ +/**/ +/* module setup */ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, @@ -45,37 +99,20 @@ EAPI E_Module_Api e_modapi = EAPI void * e_modapi_init(E_Module *module) { - Clock *clock; - - /* actually init clock */ - clock = _clock_new(); - module->config_menu = clock->config_menu; - return clock; + e_gadcon_provider_register(&_gadcon_class); + return 1; } EAPI int e_modapi_shutdown(E_Module *module) { - Clock *clock; - - if (module->config_menu) - module->config_menu = NULL; - - clock = module->data; - if (clock) - { - _clock_shutdown(clock); - } + e_gadcon_provider_unregister(&_gadcon_class); return 1; } EAPI int e_modapi_save(E_Module *module) { - Clock *clock; - - clock = module->data; - e_config_domain_save("module.clock", conf_edd, clock->conf); return 1; } @@ -96,354 +133,3 @@ e_modapi_about(E_Module *module) _("A simple module to give E17 a clock.")); return 1; } - -EAPI int -e_modapi_config(E_Module *m) -{ - Clock *e; - Clock_Face *face; - - e = m->data; - if (!e) return 0; - if (!e->faces) return 0; - face = e->faces->data; - if (!face) return 0; - _config_clock_module(face->con, face); - return 1; -} - -/* module private routines */ -static Clock * -_clock_new() -{ - Clock *clock; - Evas_List *managers, *l, *l2, *cl; - E_Menu_Item *mi; - - _clock_count = 0; - clock = E_NEW(Clock, 1); - if (!clock) return NULL; - - conf_face_edd = E_CONFIG_DD_NEW("Clock_Config_Face", Config_Face); -#undef T -#undef D -#define T Config_Face -#define D conf_face_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); - E_CONFIG_VAL(D, T, digitalStyle, INT); - - conf_edd = E_CONFIG_DD_NEW("Clock_Config", Config); -#undef T -#undef D -#define T Config -#define D conf_edd - E_CONFIG_LIST(D, T, faces, conf_face_edd); - - clock->conf = e_config_domain_load("module.clock", conf_edd); - if (!clock->conf) - { - clock->conf = E_NEW(Config, 1); - } - - _clock_config_menu_new(clock); - - managers = e_manager_list(); - cl = clock->conf->faces; - for (l = managers; l; l = l->next) - { - E_Manager *man; - - man = l->data; - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - Clock_Face *face; - - con = l2->data; - face = _clock_face_new(clock, con); - if (face) - { - face->clock = clock; - clock->faces = evas_list_append(clock->faces, face); - /* Config */ - if (!cl) - { - face->conf = E_NEW(Config_Face, 1); - face->conf->enabled = 1; - face->conf->digitalStyle = DIGITAL_STYLE_NONE; - clock->conf->faces = evas_list_append(clock->conf->faces, face->conf); - } - else - { - face->conf = cl->data; - cl = cl->next; - } - - _clock_face_cb_config_updated(face); - - /* Menu */ - /* This menu must be initialized after conf */ - _clock_face_menu_new(face); - - mi = e_menu_item_new(clock->config_menu); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _clock_face_cb_menu_configure, face); - - mi = e_menu_item_new(clock->config_menu); - e_menu_item_label_set(mi, con->name); - - e_menu_item_submenu_set(mi, face->menu); - - /* Setup */ - if (!face->conf->enabled) - _clock_face_disable(face); - } - } - } - return clock; -} - -static void -_clock_shutdown(Clock *clock) -{ - Evas_List *list; - - E_CONFIG_DD_FREE(conf_edd); - E_CONFIG_DD_FREE(conf_face_edd); - - for (list = clock->faces; list; list = list->next) - _clock_face_free(list->data); - evas_list_free(clock->faces); - - e_object_del(E_OBJECT(clock->config_menu)); - - evas_list_free(clock->conf->faces); - free(clock->conf); - free(clock); -} - -static void -_clock_config_menu_new(Clock *clock) -{ - clock->config_menu = e_menu_new(); -} - -static Clock_Face * -_clock_face_new(Clock *clock, E_Container *con) -{ - Clock_Face *face; - Evas_Object *o; - Evas_Coord x, y, w, h; - E_Gadman_Policy policy; - - face = E_NEW(Clock_Face, 1); - if (!face) return NULL; - - face->con = con; - e_object_ref(E_OBJECT(con)); - - evas_event_freeze(con->bg_evas); - o = edje_object_add(con->bg_evas); - face->clock_object = o; - - e_theme_edje_object_set(o, "base/theme/modules/clock", - "modules/clock/main"); - evas_object_show(o); - - o = evas_object_rectangle_add(con->bg_evas); - face->event_object = o; - evas_object_layer_set(o, 2); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _clock_face_cb_mouse_down, face); - evas_object_show(o); - - evas_object_resize(face->clock_object, 200, 200); - edje_object_calc_force(face->clock_object); - edje_object_part_geometry_get(face->clock_object, "main", &x, &y, &w, &h); - face->inset.l = x; - face->inset.r = 200 - (x + w); - face->inset.t = y; - face->inset.b = 200 - (y + h); - - face->gmc = e_gadman_client_new(con->gadman); - e_gadman_client_domain_set(face->gmc, "module.clock", _clock_count++); - - policy = E_GADMAN_POLICY_ANYWHERE | - E_GADMAN_POLICY_HMOVE | - E_GADMAN_POLICY_VMOVE | - E_GADMAN_POLICY_HSIZE | - E_GADMAN_POLICY_VSIZE; - - e_gadman_client_policy_set(face->gmc, policy); - e_gadman_client_min_size_set(face->gmc, 4, 4); - e_gadman_client_max_size_set(face->gmc, 512, 512); - e_gadman_client_auto_size_set(face->gmc, - 40 + (face->inset.l + face->inset.r), - 40 + (face->inset.t + face->inset.b)); - e_gadman_client_align_set(face->gmc, 1.0, 1.0); - e_gadman_client_aspect_set(face->gmc, 1.0, 1.0); - e_gadman_client_padding_set(face->gmc, - face->inset.l, face->inset.r, - face->inset.t, face->inset.b); - e_gadman_client_resize(face->gmc, - 40 + (face->inset.l + face->inset.r), - 40 + (face->inset.t + face->inset.b)); - e_gadman_client_change_func_set(face->gmc, _clock_face_cb_gmc_change, face); - e_gadman_client_load(face->gmc); - - evas_event_thaw(con->bg_evas); - - return face; -} - -static void -_clock_face_free(Clock_Face *face) -{ - if (face->config_dialog) - { - e_object_del(E_OBJECT(face->config_dialog)); - face->config_dialog = NULL; - } - e_object_unref(E_OBJECT(face->con)); - e_object_del(E_OBJECT(face->gmc)); - evas_object_del(face->clock_object); - evas_object_del(face->event_object); - e_object_del(E_OBJECT(face->menu)); - - free(face->conf); - free(face); - _clock_count--; -} - -/* -static void -_clock_face_enable(Clock_Face *face) -{ - face->conf->enabled = 1; - evas_object_show(face->clock_object); - evas_object_show(face->event_object); - e_config_save_queue(); -} -*/ - -static void -_clock_face_disable(Clock_Face *face) -{ - face->conf->enabled = 0; - evas_object_hide(face->clock_object); - evas_object_hide(face->event_object); - e_config_save_queue(); -} - -static void -_clock_face_menu_new(Clock_Face *face) -{ - E_Menu *mn; - E_Menu_Item *mi; - - mn = e_menu_new(); - face->menu = mn; - - /* Enabled */ - /* - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Enabled")); - e_menu_item_check_set(mi, 1); - if (face->conf->enabled) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _clock_face_cb_menu_enabled, face); - */ - - /* Config */ - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _clock_face_cb_menu_configure, face); - - /* Edit */ - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Edit Mode")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets"); - e_menu_item_callback_set(mi, _clock_face_cb_menu_edit, face); -} - -static void -_clock_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) -{ - Clock_Face *face; - Evas_Coord x, y, w, h; - - face = data; - switch (change) - { - case E_GADMAN_CHANGE_MOVE_RESIZE: - e_gadman_client_geometry_get(face->gmc, &x, &y, &w, &h); - evas_object_move(face->clock_object, x, y); - evas_object_move(face->event_object, x, y); - evas_object_resize(face->clock_object, w, h); - evas_object_resize(face->event_object, w, h); - break; - case E_GADMAN_CHANGE_RAISE: - evas_object_raise(face->clock_object); - evas_object_raise(face->event_object); - break; - case E_GADMAN_CHANGE_EDGE: - case E_GADMAN_CHANGE_ZONE: - /* FIXME - * Must we do something here? - */ - break; - } -} - -static void -_clock_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Clock_Face *face; - Evas_Event_Mouse_Down *ev; - - face = data; - ev = event_info; - if (ev->button == 3) - { - e_menu_activate_mouse(face->menu, e_zone_current_get(face->con), - ev->output.x, ev->output.y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - e_util_container_fake_mouse_up_all_later(face->con); - } -} - -static void -_clock_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Clock_Face *face; - - face = data; - e_gadman_mode_set(face->gmc->gadman, E_GADMAN_MODE_EDIT); -} - -static void -_clock_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Clock_Face *face; - - face = data; - if (!face) return; - _config_clock_module(face->con, face); -} - -void -_clock_face_cb_config_updated(void *data) -{ - Clock_Face *face; - char buf[2]; - - face = data; - - memset(buf, 0, sizeof(buf)); - snprintf(buf, sizeof(buf), "%i", face->conf->digitalStyle); - edje_object_part_text_set(face->clock_object, "digitalStyle", buf); - -} - diff --git a/src/modules/clock/e_mod_main.h b/src/modules/clock/e_mod_main.h index 891f453c6..29677a219 100644 --- a/src/modules/clock/e_mod_main.h +++ b/src/modules/clock/e_mod_main.h @@ -4,48 +4,6 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -typedef struct _Config Config; -typedef struct _Config_Face Config_Face; -typedef struct _Clock Clock; -typedef struct _Clock_Face Clock_Face; - -struct _Config -{ - Evas_List *faces; -}; - -struct _Config_Face -{ - unsigned char enabled; - int digitalStyle; -}; - -struct _Clock -{ - Evas_List *faces; - E_Menu *config_menu; - - Config *conf; -}; - -struct _Clock_Face -{ - E_Container *con; - E_Menu *menu; - Config_Face *conf; - Clock *clock; - - struct { - Evas_Coord l, r, t, b; - } inset; - - Evas_Object *clock_object; - Evas_Object *event_object; - - E_Gadman_Client *gmc; - E_Config_Dialog *config_dialog; -}; - EAPI extern E_Module_Api e_modapi; EAPI void *e_modapi_init (E_Module *module); @@ -55,6 +13,4 @@ EAPI int e_modapi_info (E_Module *module); EAPI int e_modapi_about (E_Module *module); EAPI int e_modapi_config (E_Module *module); -void _clock_face_cb_config_updated(void *data); - #endif diff --git a/src/modules/cpufreq/e_mod_main.c b/src/modules/cpufreq/e_mod_main.c index b5b7f3f66..d2a79813d 100644 --- a/src/modules/cpufreq/e_mod_main.c +++ b/src/modules/cpufreq/e_mod_main.c @@ -1,99 +1,896 @@ /* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ -#include -#include -#include +#include "e.h" #include "e_mod_main.h" -#include "config.h" #ifdef __FreeBSD__ #include #include #endif -/* FIXME: check permissions (can execute) setfreq before trying - * FIXME: display throttling state ??? - * FIXME: handle multiple cpu's (yes it's likely rare - but possible) - */ +/***************************************************************************/ +/**/ +/* gadcon requirements */ +static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient(E_Gadcon_Client *gcc); +/* and actually define the gadcon class that this module provides (just 1) */ +static const E_Gadcon_Client_Class _gadcon_class = +{ + GADCON_CLIENT_CLASS_VERSION, + "cpufreq", + { + _gc_init, _gc_shutdown, _gc_orient + } +}; +/**/ +/***************************************************************************/ -static Cpufreq *_cpufreq_new(E_Module *module); -static void _cpufreq_free(Cpufreq *cpufreq); -static void _cpufreq_set_governor(Cpufreq *cpufreq, const char *governor); -static void _cpufreq_menu_fast(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_menu_medium(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_menu_normal(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_menu_slow(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_menu_restore_governor(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_menu_governor(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_menu_frequency(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_config_menu_new(Cpufreq *cpufreq); -static int _cpufreq_cb_check(void *data); +/***************************************************************************/ +/**/ +/* actual module specifics */ -static Status * _cpufreq_status_new(); -static void _cpufreq_status_free(Status *e); -static int _cpufreq_status_check_available(Status *e); -static int _cpufreq_status_check_current(Status *e); -static int _cpufreq_cb_sort(void *item1, void *item2); +typedef struct _Instance Instance; -static Cpufreq_Face *_cpufreq_face_new(E_Container *con, Cpufreq *owner); -static void _cpufreq_face_free(Cpufreq_Face *face); -static void _cpufreq_face_menu_new(Cpufreq_Face *face); -static void _cpufreq_face_enable(Cpufreq_Face *face); -static void _cpufreq_face_disable(Cpufreq_Face *face); -static void _cpufreq_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _cpufreq_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); -static void _cpufreq_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _cpufreq_face_update_available(Cpufreq_Face *face); -static void _cpufreq_face_update_current(Cpufreq_Face *face); -static void _cpufreq_face_cb_set_frequency(void *data, Evas_Object *o, const char *emission, const char *source); -static void _cpufreq_face_cb_set_governor(void *data, Evas_Object *o, const char *emission, const char *source); +struct _Instance +{ + E_Gadcon_Client *gcc; + Evas_Object *o_cpu; +}; -static E_Config_DD *conf_edd; -static E_Config_DD *conf_face_edd; +static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _menu_cb_post(void *data, E_Menu *m); +static void _cpufreq_set_governor(const char *governor); +static void _cpufreq_set_frequency(int frequency); +static int _cpufreq_cb_check(void *data); +static Status *_cpufreq_status_new(); +static void _cpufreq_status_free(Status *s); +static int _cpufreq_status_check_available(Status *s); +static int _cpufreq_status_check_current(Status *s); +static int _cpufreq_cb_sort(void *item1, void *item2); +static void _cpufreq_face_update_available(Instance *inst); +static void _cpufreq_face_update_current(Instance *inst); +static void _cpufreq_face_cb_set_frequency(void *data, Evas_Object *o, const char *emission, const char *source); +static void _cpufreq_face_cb_set_governor(void *data, Evas_Object *o, const char *emission, const char *source); -static int cpufreq_count; +static void _cpufreq_menu_fast(void *data, E_Menu *m, E_Menu_Item *mi); +static void _cpufreq_menu_medium(void *data, E_Menu *m, E_Menu_Item *mi); +static void _cpufreq_menu_normal(void *data, E_Menu *m, E_Menu_Item *mi); +static void _cpufreq_menu_slow(void *data, E_Menu *m, E_Menu_Item *mi); +static void _cpufreq_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi); +static void _cpufreq_menu_restore_governor(void *data, E_Menu *m, E_Menu_Item *mi); +static void _cpufreq_menu_governor(void *data, E_Menu *m, E_Menu_Item *mi); +static void _cpufreq_menu_frequency(void *data, E_Menu *m, E_Menu_Item *mi); -/* public module routines */ +static E_Config_DD *conf_edd = NULL; + +Config *cpufreq_config = NULL; + +static E_Gadcon_Client * +_gc_init(E_Gadcon *gc, char *name, char *id, char *style) +{ + Evas_Object *o; + E_Gadcon_Client *gcc; + Instance *inst; + + inst = E_NEW(Instance, 1); + + o = edje_object_add(gc->evas); + e_theme_edje_object_set(o, "base/theme/modules/cpufreq", + "modules/cpufreq/main"); + edje_object_signal_callback_add(o, "next_governor", "governor", _cpufreq_face_cb_set_governor, NULL); + edje_object_signal_callback_add(o, "increase_frequency", "frequency", _cpufreq_face_cb_set_frequency, NULL); + edje_object_signal_callback_add(o, "decrease_frequency", "frequency", _cpufreq_face_cb_set_frequency, NULL); + + gcc = e_gadcon_client_new(gc, name, id, style, o); + gcc->data = inst; + + inst->gcc = gcc; + inst->o_cpu = o; + + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _button_cb_mouse_down, inst); + cpufreq_config->instances = evas_list_append(cpufreq_config->instances, inst); + if (cpufreq_config->status) _cpufreq_status_free(cpufreq_config->status); + cpufreq_config->status = _cpufreq_status_new(); + _cpufreq_cb_check(NULL); + _cpufreq_face_update_available(inst); + return gcc; +} + +static void +_gc_shutdown(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + cpufreq_config->instances = evas_list_remove(cpufreq_config->instances, inst); + evas_object_del(inst->o_cpu); + free(inst); +} + +static void +_gc_orient(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + e_gadcon_client_aspect_set(gcc, 16, 16); + e_gadcon_client_min_size_set(gcc, 16, 16); +} +/**/ +/***************************************************************************/ + +/***************************************************************************/ +/**/ +static void +_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Instance *inst; + Evas_Event_Mouse_Down *ev; + + inst = data; + ev = event_info; + if ((ev->button == 3) && (!cpufreq_config->menu)) + { + E_Menu *mn; + E_Menu_Item *mi; + int cx, cy, cw, ch; + Evas_List *l; + char buf[256]; + + mn = e_menu_new(); + cpufreq_config->menu_poll = mn; + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Fast (0.5 sec)")); + e_menu_item_radio_set(mi, 1); + e_menu_item_radio_group_set(mi, 1); + if (cpufreq_config->poll_time <= 0.5) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _cpufreq_menu_fast, NULL); + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Medium (1 sec)")); + e_menu_item_radio_set(mi, 1); + e_menu_item_radio_group_set(mi, 1); + if (cpufreq_config->poll_time > 0.5) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _cpufreq_menu_medium, NULL); + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Normal (2 sec)")); + e_menu_item_radio_set(mi, 1); + e_menu_item_radio_group_set(mi, 1); + if (cpufreq_config->poll_time >= 2.0) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _cpufreq_menu_normal, NULL); + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Slow (5 sec)")); + e_menu_item_radio_set(mi, 1); + e_menu_item_radio_group_set(mi, 1); + if (cpufreq_config->poll_time >= 5.0) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _cpufreq_menu_slow, NULL); + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Very Slow (30 sec)")); + e_menu_item_radio_set(mi, 1); + e_menu_item_radio_group_set(mi, 1); + if (cpufreq_config->poll_time >= 30.0) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _cpufreq_menu_very_slow, NULL); + + if (cpufreq_config->status->governors) + { + mn = e_menu_new(); + cpufreq_config->menu_governor = mn; + + for (l = cpufreq_config->status->governors; l; l = l->next) + { + mi = e_menu_item_new(mn); + if (!strcmp(l->data, "userspace")) + e_menu_item_label_set(mi, _("Manual")); + else if (!strcmp(l->data, "ondemand")) + e_menu_item_label_set(mi, _("Automatic")); + else if (!strcmp(l->data, "conservative")) + e_menu_item_label_set(mi, _("Lower Power Automatic")); + else if (!strcmp(l->data, "powersave")) + e_menu_item_label_set(mi, _("Minimum Speed")); + else if (!strcmp(l->data, "performance")) + e_menu_item_label_set(mi, _("Maximum Speed")); + e_menu_item_radio_set(mi, 1); + e_menu_item_radio_group_set(mi, 1); + e_object_data_set(E_OBJECT(mi), l->data); + if (!strcmp(cpufreq_config->status->cur_governor, l->data)) + e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _cpufreq_menu_governor, NULL); + } + } + + if ((cpufreq_config->status->frequencies) && + (cpufreq_config->status->can_set_frequency)) + { + mn = e_menu_new(); + cpufreq_config->menu_frequency = mn; + + for (l = cpufreq_config->status->frequencies; l; l = l->next) + { + int frequency; + + frequency = (int)l->data; + mi = e_menu_item_new(mn); + if (frequency < 1000000) + snprintf(buf, sizeof(buf), _("%i MHz"), frequency / 1000); + else + snprintf(buf, sizeof(buf), _("%i.%i GHz"), + frequency / 1000000, (frequency % 1000000) / 100000); + buf[sizeof(buf) - 1] = 0; + e_menu_item_label_set(mi, buf); + e_menu_item_radio_set(mi, 1); + e_menu_item_radio_group_set(mi, 1); + e_object_data_set(E_OBJECT(mi), l->data); + if (cpufreq_config->status->cur_frequency == frequency) + e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _cpufreq_menu_frequency, NULL); + } + } + + mn = e_menu_new(); + cpufreq_config->menu = mn; + e_menu_post_deactivate_callback_set(mn, _menu_cb_post, inst); + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Time Between Updates")); + e_menu_item_submenu_set(mi, cpufreq_config->menu_poll); + + if (cpufreq_config->menu_governor) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Restore CPU Power Policy")); + e_menu_item_check_set(mi, 1); + e_menu_item_toggle_set(mi, cpufreq_config->restore_governor); + e_menu_item_callback_set(mi, _cpufreq_menu_restore_governor, NULL); + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Set CPU Power Policy")); + e_menu_item_submenu_set(mi, cpufreq_config->menu_governor); + } + + if (cpufreq_config->menu_frequency) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Set CPU Speed")); + e_menu_item_submenu_set(mi, cpufreq_config->menu_frequency); + } + + e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0); + + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, + &cx, &cy, &cw, &ch); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); + } + +} + +static void +_menu_cb_post(void *data, E_Menu *m) +{ + if (!cpufreq_config->menu) return; + e_object_del(E_OBJECT(cpufreq_config->menu)); + cpufreq_config->menu = NULL; + if (cpufreq_config->menu_poll) e_object_del(E_OBJECT(cpufreq_config->menu_poll)); + cpufreq_config->menu_poll = NULL; + if (cpufreq_config->menu_governor) e_object_del(E_OBJECT(cpufreq_config->menu_governor)); + cpufreq_config->menu_governor = NULL; + if (cpufreq_config->menu_frequency) e_object_del(E_OBJECT(cpufreq_config->menu_frequency)); + cpufreq_config->menu_frequency = NULL; +} + +static void +_cpufreq_set_governor(const char *governor) +{ + char buf[4096]; + int ret; + + snprintf(buf, sizeof(buf), + "%s %s %s", cpufreq_config->set_exe_path, "governor", governor); + ret = system(buf); + if (ret != 0) + { + E_Dialog *dia; + + dia = e_dialog_new(e_container_current_get(e_manager_current_get())); + if (!dia) return; + e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); + e_dialog_icon_set(dia, "enlightenment/e", 64); + e_dialog_text_set(dia, _("There was an error trying to set the
" + "cpu frequency governor via the module's
" + "setfreq utility.")); + e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL); + e_win_centered_set(dia->win, 1); + e_dialog_show(dia); + } +} + +static void +_cpufreq_set_frequency(int frequency) +{ + char buf[4096]; + int ret; + +#ifdef __FreeBSD__ + frequency /= 1000; +#endif + if (!cpufreq_config->status->can_set_frequency) + { + E_Dialog *dia; + + dia = e_dialog_new(e_container_current_get(e_manager_current_get())); + if (!dia) return; + e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); + e_dialog_icon_set(dia, "enlightenment/e", 64); + e_dialog_text_set(dia, _("Your kernel does not support setting the
" + "CPU frequency at all. You may be missing
" + "Kernel modules or features, or your CPU
" + "simply does not support this feature.")); + e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL); + e_win_centered_set(dia->win, 1); + e_dialog_show(dia); + return; + } + snprintf(buf, sizeof(buf), + "%s %s %i", cpufreq_config->set_exe_path, "frequency", frequency); + ret = system(buf); + if (ret != 0) + { + E_Dialog *dia; + + dia = e_dialog_new(e_container_current_get(e_manager_current_get())); + if (!dia) return; + e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); + e_dialog_icon_set(dia, "enlightenment/e", 64); + e_dialog_text_set(dia, _("There was an error trying to set the
" + "cpu frequency setting via the module's
" + "setfreq utility.")); + e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL); + e_win_centered_set(dia->win, 1); + e_dialog_show(dia); + } +} + +static int +_cpufreq_cb_check(void *data) +{ + Instance *inst; + Evas_List *l; + int active; + + active = cpufreq_config->status->active; + if (_cpufreq_status_check_current(cpufreq_config->status)) + { + for (l = cpufreq_config->instances; l; l = l->next) + { + inst = l->data; + _cpufreq_face_update_current(inst); + } + } + if (active != cpufreq_config->status->active) + { + for (l = cpufreq_config->instances; l; l = l->next) + { + inst = l->data; + if (cpufreq_config->status->active == 0) + edje_object_signal_emit(inst->o_cpu, "passive", ""); + else if (cpufreq_config->status->active == 1) + edje_object_signal_emit(inst->o_cpu, "active", ""); + } + } + + return 1; +} + +static Status * +_cpufreq_status_new() +{ + Status *s; + + s = E_NEW(Status, 1); + if (!s) return NULL; + s->active = -1; + return s; +} + +static void +_cpufreq_status_free(Status *s) +{ + Evas_List *l; + + if (s->frequencies) evas_list_free(s->frequencies); + if (s->governors) + { + for (l = s->governors; l; l = l->next) free(l->data); + evas_list_free(s->governors); + } + if (s->cur_governor) free(s->cur_governor); + free(s); +} + +static int +_cpufreq_cb_sort(void *item1, void *item2) +{ + int a, b; + + a = (int)item1; + b = (int)item2; + if (a < b) return -1; + else if (a > b) return 1; + return 0; +} + +static int +_cpufreq_status_check_available(Status *s) +{ + char buf[4096]; + Evas_List *l; +#ifdef __FreeBSD__ + int freq, i; + size_t len = 0; + char *freqs, *pos, *q; + + /* read freq_levels sysctl and store it in freq */ + len = sizeof(buf); + if (sysctlbyname("dev.cpu.0.freq_levels", buf, &len, NULL, 0) == 0) + { + /* sysctl returns 0 on success */ + if (s->frequencies) + { + evas_list_free(s->frequencies); + s->frequencies = NULL; + } + + /* parse freqs and store the frequencies in s->frequencies */ + pos = buf; + while (pos) + { + q = strchr(pos, '/'); + if (!q) break; + + *q = '\0'; + freq = atoi(pos); + freq *= 1000; + s->frequencies = evas_list_append(s->frequencies, (void *)freq); + + pos = q + 1; + pos = strchr(pos, ' '); + } + } + + /* sort is not necessary because freq_levels is already sorted */ + /* freebsd doesn't have governors */ + if (s->governors) + { + for (l = s->governors; l; l = l->next) free(l->data); + evas_list_free(s->governors); + s->governors = NULL; + } +#else + FILE *f; + + f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", "r"); + if (f) + { + char *freq; + + if (s->frequencies) + { + evas_list_free(s->frequencies); + s->frequencies = NULL; + } + + fgets(buf, sizeof(buf), f); + buf[sizeof(buf) - 1] = 0; + fclose(f); + + freq = strtok(buf, " "); + do + { + if (atoi(freq) != 0) + { + s->frequencies = evas_list_append(s->frequencies, + (void *) atoi(freq)); + } + freq = strtok(NULL, " "); + } + while (freq != NULL); + + s->frequencies = evas_list_sort(s->frequencies, + evas_list_count(s->frequencies), + _cpufreq_cb_sort); + } + + f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors", "r"); + if (f) + { + char *gov; + + if (s->governors) + { + for (l = s->governors; l; l = l->next) + free(l->data); + evas_list_free(s->governors); + s->governors = NULL; + } + + fgets(buf, sizeof(buf), f); + buf[sizeof(buf) - 1] = 0; + fclose(f); + + gov = strtok(buf, " "); + do + { + while ((*gov) && (isspace(*gov))) gov++; + if (strlen(gov) != 0) + s->governors = evas_list_append(s->governors, strdup(gov)); + gov = strtok(NULL, " "); + } + while (gov != NULL); + + s->governors = evas_list_sort(s->governors, + evas_list_count(s->governors), + (int (*)(void *, void *))strcmp); + } +#endif + return 1; +} + +static int +_cpufreq_status_check_current(Status *s) +{ + char buf[4096]; + int i; + FILE *f; + int ret = 0; + int frequency = 0; +#ifdef __FreeBSD__ + int len = 4; + + s->active = 0; + /* frequency is stored in dev.cpu.0.freq */ + if (sysctlbyname("dev.cpu.0.freq", &frequency, &len, NULL, 0) == 0) + { + frequency *= 1000; + if (frequency != s->cur_frequency) ret = 1; + s->cur_frequency = frequency; + s->active = 1; + } + + /* hardcoded for testing */ + s->can_set_frequency = 1; + s->cur_governor = NULL; +#else + s->active = 0; + + f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r"); + if (f) + { + fgets(buf, sizeof(buf), f); + buf[sizeof(buf) - 1] = 0; + fclose(f); + + frequency = atoi(buf); + if (frequency != s->cur_frequency) + ret = 1; + s->cur_frequency = frequency; + s->active = 1; + } + + f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed", "r"); + if (f) + { + s->can_set_frequency = 1; + fclose(f); + } + else + { + s->can_set_frequency = 0; + } + + f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "r"); + if (f) + { + fgets(buf, sizeof(buf), f); + buf[sizeof(buf) - 1] = 0; + fclose(f); + + if ((s->cur_governor == NULL) || (strcmp(buf, s->cur_governor))) + { + ret = 1; + + if (s->cur_governor) + free(s->cur_governor); + s->cur_governor = strdup(buf); + + for (i = strlen(s->cur_governor) - 1; i >= 0; i--) + { + if (isspace(s->cur_governor[i])) + s->cur_governor[i] = 0; + else + break; + } + } + } +#endif + return ret; +} + +static void +_cpufreq_face_update_available(Instance *inst) +{ + Edje_Message_Int_Set *frequency_msg; + Edje_Message_String_Set *governor_msg; + Evas_List *l; + int i; + int count; + + count = evas_list_count(cpufreq_config->status->frequencies); + frequency_msg = malloc(sizeof(Edje_Message_Int_Set) + (count - 1) * sizeof(int)); + frequency_msg->count = count; + for (l = cpufreq_config->status->frequencies, i = 0; l; l = l->next, i++) + frequency_msg->val[i] = (int)l->data; + edje_object_message_send(inst->o_cpu, EDJE_MESSAGE_INT_SET, 1, frequency_msg); + free(frequency_msg); + + count = evas_list_count(cpufreq_config->status->governors); + governor_msg = malloc(sizeof(Edje_Message_String_Set) + (count - 1) * sizeof(char *)); + governor_msg->count = count; + for (l = cpufreq_config->status->governors, i = 0; l; l = l->next, i++) + governor_msg->str[i] = (char *)l->data; + edje_object_message_send(inst->o_cpu, EDJE_MESSAGE_STRING_SET, 2, governor_msg); + free(governor_msg); +} + +static void +_cpufreq_face_update_current(Instance *inst) +{ + Edje_Message_Int_Set *frequency_msg; + Edje_Message_String governor_msg; + + frequency_msg = malloc(sizeof(Edje_Message_Int_Set) + sizeof(int)); + frequency_msg->count = 2; + frequency_msg->val[0] = cpufreq_config->status->cur_frequency; + frequency_msg->val[1] = cpufreq_config->status->can_set_frequency; + edje_object_message_send(inst->o_cpu, EDJE_MESSAGE_INT_SET, 3, + frequency_msg); + free(frequency_msg); + + /* BSD crashes here without the if-condition + * since it has no governors (yet) */ + if (cpufreq_config->status->cur_governor != NULL) + { + governor_msg.str = cpufreq_config->status->cur_governor; + edje_object_message_send(inst->o_cpu, EDJE_MESSAGE_STRING, 4, + &governor_msg); + } +} + +static void +_cpufreq_face_cb_set_frequency(void *data, Evas_Object *obj, const char *emission, const char *src) +{ + Evas_List *l; + int next_frequency = 0; + + for (l = cpufreq_config->status->frequencies; l; l = l->next) + { + if (cpufreq_config->status->cur_frequency == (int)l->data) + { + if (!strcmp(emission, "increase_frequency")) + { + if (l->next) next_frequency = (int)l->next->data; + break; + } + else if (!strcmp(emission, "decrease_frequency")) + { + if (l->prev) next_frequency = (int)l->prev->data; + break; + } + else + break; + } + } + if (next_frequency != 0) _cpufreq_set_frequency(next_frequency); +} + +static void +_cpufreq_face_cb_set_governor(void *data, Evas_Object *obj, const char *emission, const char *src) +{ + Evas_List *l; + char *next_governor = NULL; + + for (l = cpufreq_config->status->governors; l; l = l->next) + { + if (!strcmp(l->data, cpufreq_config->status->cur_governor)) + { + if (l->next) + next_governor = l->next->data; + else + next_governor = cpufreq_config->status->governors->data; + break; + } + } + if (next_governor != NULL) _cpufreq_set_governor(next_governor); +} + +static void +_cpufreq_menu_fast(void *data, E_Menu *m, E_Menu_Item *mi) +{ + cpufreq_config->poll_time = 0.5; + ecore_timer_del(cpufreq_config->frequency_check_timer); + cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL); + e_config_save_queue(); +} + +static void +_cpufreq_menu_medium(void *data, E_Menu *m, E_Menu_Item *mi) +{ + cpufreq_config->poll_time = 1.0; + ecore_timer_del(cpufreq_config->frequency_check_timer); + cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL); + e_config_save_queue(); +} + +static void +_cpufreq_menu_normal(void *data, E_Menu *m, E_Menu_Item *mi) +{ + cpufreq_config->poll_time = 2.0; + ecore_timer_del(cpufreq_config->frequency_check_timer); + cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL); + e_config_save_queue(); +} + +static void +_cpufreq_menu_slow(void *data, E_Menu *m, E_Menu_Item *mi) +{ + cpufreq_config->poll_time = 5.0; + ecore_timer_del(cpufreq_config->frequency_check_timer); + cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL); + e_config_save_queue(); +} + +static void +_cpufreq_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi) +{ + cpufreq_config->poll_time = 30.0; + ecore_timer_del(cpufreq_config->frequency_check_timer); + cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, _cpufreq_cb_check, NULL); + e_config_save_queue(); +} + +static void +_cpufreq_menu_restore_governor(void *data, E_Menu *m, E_Menu_Item *mi) +{ + cpufreq_config->restore_governor = e_menu_item_toggle_get(mi); + if ((!cpufreq_config->governor) || + (strcmp(cpufreq_config->status->cur_governor, cpufreq_config->governor))) + { + if (cpufreq_config->governor) evas_stringshare_del(cpufreq_config->governor); + cpufreq_config->governor = evas_stringshare_add(cpufreq_config->status->cur_governor); + } + e_config_save_queue(); +} + +static void +_cpufreq_menu_governor(void *data, E_Menu *m, E_Menu_Item *mi) +{ + char *governor; + + governor = e_object_data_get(E_OBJECT(mi)); + if (governor) + { + _cpufreq_set_governor(governor); + if (cpufreq_config->governor) evas_stringshare_del(cpufreq_config->governor); + cpufreq_config->governor = evas_stringshare_add(governor); + } + e_config_save_queue(); +} + +static void +_cpufreq_menu_frequency(void * data, E_Menu *m, E_Menu_Item *mi) +{ + int frequency; + + frequency = (int)e_object_data_get(E_OBJECT(mi)); + if (frequency > 0) + { + _cpufreq_set_frequency(frequency); + } +} + +/***************************************************************************/ +/**/ +/* module setup */ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, - "Cpufreq" + "Cpufreq" }; EAPI void * e_modapi_init(E_Module *module) { - Cpufreq *freq; + char buf[4096]; + Evas_List *l; - freq = _cpufreq_new(module); - module->config_menu = freq->config_menu; - return freq; + conf_edd = E_CONFIG_DD_NEW("Cpufreq_Config", Config); +#undef T +#undef D +#define T Config +#define D conf_edd + E_CONFIG_VAL(D, T, poll_time, DOUBLE); + E_CONFIG_VAL(D, T, restore_governor, INT); + E_CONFIG_VAL(D, T, governor, STR); + + cpufreq_config = e_config_domain_load("module.cpufreq", conf_edd); + if (!cpufreq_config) + { + cpufreq_config = E_NEW(Config, 1); + cpufreq_config->poll_time = 2.0; + cpufreq_config->restore_governor = 0; + cpufreq_config->governor = NULL; + } + E_CONFIG_LIMIT(cpufreq_config->poll_time, 0.5, 60.0); + + snprintf(buf, sizeof(buf), "%s/%s/freqset", + e_module_dir_get(module), MODULE_ARCH); + cpufreq_config->set_exe_path = strdup(buf); + cpufreq_config->frequency_check_timer = ecore_timer_add(cpufreq_config->poll_time, + _cpufreq_cb_check, NULL); + cpufreq_config->status = _cpufreq_status_new(); + + _cpufreq_status_check_available(cpufreq_config->status); + if ((cpufreq_config->restore_governor) && (cpufreq_config->governor)) + { + /* If the governor is available, restore it */ + for (l = cpufreq_config->status->governors; l; l = l->next) + { + if (!strcmp(l->data, cpufreq_config->governor)) + { + _cpufreq_set_governor(cpufreq_config->governor); + break; + } + } + } + + e_gadcon_provider_register(&_gadcon_class); + return 1; } EAPI int e_modapi_shutdown(E_Module *module) { - Cpufreq *cpufreq; - - if (module->config_menu) - module->config_menu = NULL; - - cpufreq = module->data; - if (cpufreq) - _cpufreq_free(cpufreq); + e_gadcon_provider_unregister(&_gadcon_class); + if (cpufreq_config->frequency_check_timer) + ecore_timer_del(cpufreq_config->frequency_check_timer); + if (cpufreq_config->menu) e_object_del(E_OBJECT(cpufreq_config->menu)); + if (cpufreq_config->menu_poll) e_object_del(E_OBJECT(cpufreq_config->menu_poll)); + if (cpufreq_config->menu_governor) e_object_del(E_OBJECT(cpufreq_config->menu_governor)); + if (cpufreq_config->menu_frequency) e_object_del(E_OBJECT(cpufreq_config->menu_frequency)); + if (cpufreq_config->status) _cpufreq_status_free(cpufreq_config->status); + if (cpufreq_config->governor) + evas_stringshare_del(cpufreq_config->governor); + free(cpufreq_config); + cpufreq_config = NULL; + E_CONFIG_DD_FREE(conf_edd); return 1; } EAPI int e_modapi_save(E_Module *module) { - Cpufreq *e; - - e = module->data; - e_config_domain_save("module.cpufreq", conf_edd, e->conf); + e_config_domain_save("module.cpufreq", conf_edd, cpufreq_config); return 1; } @@ -115,1047 +912,5 @@ e_modapi_about(E_Module *module) "This is especially useful to save power on laptops.")); return 1; } - -static Cpufreq * -_cpufreq_new(E_Module *module) -{ - Cpufreq *e; - Evas_List *managers, *l, *l2, *cl; - E_Menu_Item *mi; - char buf[4096]; - - cpufreq_count = 0; - e = E_NEW(Cpufreq, 1); - if (!e) return NULL; - - conf_face_edd = E_CONFIG_DD_NEW("Cpufreq_Config_Face", Config_Face); -#undef T -#undef D -#define T Config_Face -#define D conf_face_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); - - conf_edd = E_CONFIG_DD_NEW("Cpufreq_Config", Config); -#undef T -#undef D -#define T Config -#define D conf_edd - E_CONFIG_VAL(D, T, poll_time, DOUBLE); - E_CONFIG_LIST(D, T, faces, conf_face_edd); - E_CONFIG_VAL(D, T, restore_governor, INT); - E_CONFIG_VAL(D, T, governor, STR); - - e->conf = e_config_domain_load("module.cpufreq", conf_edd); - if (!e->conf) - { - e->conf = E_NEW(Config, 1); - e->conf->poll_time = 2.0; - e->conf->restore_governor = 0; - e->conf->governor = NULL; - } - E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 60.0); -#ifdef __FreeBSD__ - /* does e_module_dir_get(module) work correctly in linux??? - yes it does... what's wrong in bsd? */ - snprintf(buf, sizeof(buf), "%s/%s/cpufreq/freqset", e_module_dir_get(module), MODULE_ARCH); -#else - snprintf(buf, sizeof(buf), "%s/%s/freqset", e_module_dir_get(module), MODULE_ARCH); -#endif - buf[sizeof(buf) - 1] = 0; - e->set_exe_path = strdup(buf); - e->frequency_check_timer = ecore_timer_add(e->conf->poll_time, _cpufreq_cb_check, e); - e->status = _cpufreq_status_new(); - - _cpufreq_status_check_available(e->status); - if ((e->conf->restore_governor) && (e->conf->governor)) - { - /* If the governor is available, restore it */ - for (l = e->status->governors; l; l = l->next) - { - if (!strcmp(l->data, e->conf->governor)) - _cpufreq_set_governor(e, e->conf->governor); - } - } - _cpufreq_config_menu_new(e); - - managers = e_manager_list(); - cl = e->conf->faces; - for (l = managers; l; l = l->next) - { - E_Manager *man; - - man = l->data; - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - Cpufreq_Face *ef; - - con = l2->data; - ef = _cpufreq_face_new(con, e); - if (ef) - { - e->faces = evas_list_append(e->faces, ef); - - if (!cl) - { - ef->conf = E_NEW(Config_Face, 1); - ef->conf->enabled = 1; - e->conf->faces = evas_list_append(e->conf->faces, ef->conf); - } - else - { - ef->conf = cl->data; - cl = cl->next; - } - - _cpufreq_face_menu_new(ef); - - /* Add poll time menu to this face */ - mi = e_menu_item_new(ef->menu); - e_menu_item_label_set(mi, _("Set Poll Time")); - e_menu_item_submenu_set(mi, e->config_menu_poll); - - if (e->menu_governor) - { - mi = e_menu_item_new(ef->menu); - e_menu_item_label_set(mi, _("Restore Controller on Startup")); - e_menu_item_check_set(mi, 1); - e_menu_item_toggle_set(mi, e->conf->restore_governor); - e_menu_item_callback_set(mi, _cpufreq_menu_restore_governor, e); - - /* Add governors menu to this face */ - mi = e_menu_item_new(ef->menu); - e_menu_item_label_set(mi, _("Set Controller")); - e_menu_item_submenu_set(mi, e->menu_governor); - } - - if (e->menu_frequency) - { - /* Add frequency menu to this face */ - mi = e_menu_item_new(ef->menu); - e_menu_item_label_set(mi, _("Set Speed")); - e_menu_item_submenu_set(mi, e->menu_frequency); - } - - /* Add this face to the main menu */ - mi = e_menu_item_new(e->config_menu); - e_menu_item_label_set(mi, con->name); - e_menu_item_submenu_set(mi, ef->menu); - - if (!ef->conf->enabled) - _cpufreq_face_disable(ef); - } - } - } - - _cpufreq_cb_check(e); - - return e; -} - -static void -_cpufreq_free(Cpufreq *e) -{ - Evas_List *l; - - E_CONFIG_DD_FREE(conf_edd); - E_CONFIG_DD_FREE(conf_face_edd); - - for (l = e->faces; l; l = l->next) - _cpufreq_face_free(l->data); - evas_list_free(e->faces); - - e_object_del(E_OBJECT(e->config_menu)); - e_object_del(E_OBJECT(e->config_menu_poll)); - if (e->menu_governor) - e_object_del(E_OBJECT(e->menu_governor)); - if (e->menu_frequency) - e_object_del(E_OBJECT(e->menu_frequency)); - - ecore_timer_del(e->frequency_check_timer); - - _cpufreq_status_free(e->status); - - evas_list_free(e->conf->faces); - free(e->set_exe_path); - if (e->conf->governor) evas_stringshare_del(e->conf->governor); - free(e->conf); - free(e); -} - -static void -_cpufreq_set_governor(Cpufreq *e, const char *governor) -{ - /* TODO: Use ecore_exe */ - char buf[4096]; - int ret; - - snprintf(buf, sizeof(buf), - "%s %s %s", e->set_exe_path, "governor", governor); - ret = system(buf); - if (ret != 0) - { - E_Dialog *dia; - - dia = e_dialog_new(e_container_current_get(e_manager_current_get())); - if (!dia) return; - e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); - e_dialog_icon_set(dia, "enlightenment/e", 64); - e_dialog_text_set(dia, _("There was an error trying to set the cpu frequency
" - "governor via the module's setfreq utility.")); - e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL); - e_win_centered_set(dia->win, 1); - e_dialog_show(dia); - } -} - -static void -_cpufreq_set_frequency(Cpufreq *e, int frequency) -{ - char buf[4096]; - int ret; - -#ifdef __FreeBSD__ - frequency /= 1000; -#endif - snprintf(buf, sizeof(buf), - "%s %s %i", e->set_exe_path, "frequency", frequency); - ret = system(buf); - if (ret != 0) - { - E_Dialog *dia; - - dia = e_dialog_new(e_container_current_get(e_manager_current_get())); - if (!dia) return; - e_dialog_title_set(dia, "Enlightenment Cpufreq Module"); - e_dialog_icon_set(dia, "enlightenment/e", 64); - e_dialog_text_set(dia, _("There was an error trying to set the cpu frequency
" - "setting via the module's setfreq utility.")); - e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL); - e_win_centered_set(dia->win, 1); - e_dialog_show(dia); - } -} - -static void -_cpufreq_menu_fast(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Cpufreq *e; - - e = data; - e->conf->poll_time = 0.5; - ecore_timer_del(e->frequency_check_timer); - e->frequency_check_timer = ecore_timer_add(e->conf->poll_time, _cpufreq_cb_check, e); - e_config_save_queue(); -} - -static void -_cpufreq_menu_medium(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Cpufreq *e; - - e = data; - e->conf->poll_time = 1.0; - ecore_timer_del(e->frequency_check_timer); - e->frequency_check_timer = ecore_timer_add(e->conf->poll_time, _cpufreq_cb_check, e); - e_config_save_queue(); -} - -static void -_cpufreq_menu_normal(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Cpufreq *e; - - e = data; - e->conf->poll_time = 2.0; - ecore_timer_del(e->frequency_check_timer); - e->frequency_check_timer = ecore_timer_add(e->conf->poll_time, _cpufreq_cb_check, e); - e_config_save_queue(); -} - -static void -_cpufreq_menu_slow(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Cpufreq *e; - - e = data; - e->conf->poll_time = 5.0; - ecore_timer_del(e->frequency_check_timer); - e->frequency_check_timer = ecore_timer_add(e->conf->poll_time, _cpufreq_cb_check, e); - e_config_save_queue(); -} - -static void -_cpufreq_menu_very_slow(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Cpufreq *e; - - e = data; - e->conf->poll_time = 30.0; - ecore_timer_del(e->frequency_check_timer); - e->frequency_check_timer = ecore_timer_add(e->conf->poll_time, _cpufreq_cb_check, e); - e_config_save_queue(); -} - -static void -_cpufreq_menu_restore_governor(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Cpufreq *e; - - e = data; - e->conf->restore_governor = e_menu_item_toggle_get(mi); - if ((!e->conf->governor) || strcmp(e->status->cur_governor, e->conf->governor)) - { - if (e->conf->governor) evas_stringshare_del(e->conf->governor); - e->conf->governor = evas_stringshare_add(e->status->cur_governor); - } - e_config_save_queue(); -} - -static void -_cpufreq_menu_governor(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Cpufreq *e; - char *governor; - - e = data; - governor = e_object_data_get(E_OBJECT(mi)); - if (governor) - { - _cpufreq_set_governor(e, governor); - if (e->conf->governor) evas_stringshare_del(e->conf->governor); - e->conf->governor = evas_stringshare_add(governor); - } - e_config_save_queue(); -} - -static void -_cpufreq_menu_frequency(void * data, E_Menu *m, E_Menu_Item *mi) -{ - int frequency; - - frequency = (int) e_object_data_get(E_OBJECT(mi)); - if (frequency > 0) - { - _cpufreq_set_frequency(data, frequency); - } -} - -static void -_cpufreq_config_menu_new(Cpufreq *e) -{ - E_Menu *mn; - E_Menu_Item *mi; - Evas_List *l; - char buf[256]; - - mn = e_menu_new(); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Check Fast (0.5 sec)")); - e_menu_item_radio_set(mi, 1); - e_menu_item_radio_group_set(mi, 1); - if (e->conf->poll_time <= 0.5) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _cpufreq_menu_fast, e); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Check Medium (1 sec)")); - e_menu_item_radio_set(mi, 1); - e_menu_item_radio_group_set(mi, 1); - if (e->conf->poll_time > 0.5) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _cpufreq_menu_medium, e); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Check Normal (2 sec)")); - e_menu_item_radio_set(mi, 1); - e_menu_item_radio_group_set(mi, 1); - if (e->conf->poll_time >= 2.0) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _cpufreq_menu_normal, e); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Check Slow (5 sec)")); - e_menu_item_radio_set(mi, 1); - e_menu_item_radio_group_set(mi, 1); - if (e->conf->poll_time >= 5.0) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _cpufreq_menu_slow, e); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Check Very Slow (30 sec)")); - e_menu_item_radio_set(mi, 1); - e_menu_item_radio_group_set(mi, 1); - if (e->conf->poll_time >= 30.0) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _cpufreq_menu_very_slow, e); - - e->config_menu_poll = mn; - - if (e->status->governors) - { - mn = e_menu_new(); - - for (l = e->status->governors; l; l = l->next) - { - mi = e_menu_item_new(mn); - if (!strcmp(l->data, "userspace")) - e_menu_item_label_set(mi, _("Manual")); - else if (!strcmp(l->data, "ondemand")) - e_menu_item_label_set(mi, _("Automatic")); - else if (!strcmp(l->data, "conservative")) - e_menu_item_label_set(mi, _("Lower Power Automatic")); - else if (!strcmp(l->data, "powersave")) - e_menu_item_label_set(mi, _("Minimum Speed")); - else if (!strcmp(l->data, "performance")) - e_menu_item_label_set(mi, _("Maximum Speed")); - e_menu_item_radio_set(mi, 1); - e_menu_item_radio_group_set(mi, 1); - e_object_data_set(E_OBJECT(mi), l->data); - e_menu_item_callback_set(mi, _cpufreq_menu_governor, e); - } - - e->menu_governor = mn; - } - - if (e->status->frequencies) - { - mn = e_menu_new(); - - /* FIXME: sotring ints in pointers for freq's? BAD! */ - for (l = e->status->frequencies; l; l = l->next) - { - int frequency; - - frequency = (int)l->data; - mi = e_menu_item_new(mn); - if (frequency < 1000000) - snprintf(buf, sizeof(buf), _("%i MHz"), - frequency / 1000); - else - snprintf(buf, sizeof(buf), _("%i.%i GHz"), - frequency / 1000000, (frequency % 1000000) / 100000); - buf[sizeof(buf) - 1] = 0; - e_menu_item_label_set(mi, buf); - e_menu_item_radio_set(mi, 1); - e_menu_item_radio_group_set(mi, 1); - e_object_data_set(E_OBJECT(mi), l->data); - e_menu_item_callback_set(mi, _cpufreq_menu_frequency, e); - } - e->menu_frequency = mn; - } - - mn = e_menu_new(); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Set Poll Time")); - e_menu_item_submenu_set(mi, e->config_menu_poll); - - if (e->menu_governor) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Restore Governor on Startup")); - e_menu_item_check_set(mi, 1); - e_menu_item_toggle_set(mi, e->conf->restore_governor); - e_menu_item_callback_set(mi, _cpufreq_menu_restore_governor, e); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Set Controller")); - e_menu_item_submenu_set(mi, e->menu_governor); - } - - if (e->menu_frequency) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Set Speed")); - e_menu_item_submenu_set(mi, e->menu_frequency); - } - - e->config_menu = mn; -} - -static int -_cpufreq_cb_check(void *data) -{ - Cpufreq *e; - Cpufreq_Face *face; - Evas_List *l; - int active; - - e = data; - active = e->status->active; - if (_cpufreq_status_check_current(e->status)) - { - for (l = e->faces; l; l = l->next) - { - face = l->data; - _cpufreq_face_update_current(face); - } - } - if (active != e->status->active) - { - for (l = e->faces; l; l = l->next) - { - face = l->data; - if (e->status->active == 0) - edje_object_signal_emit(face->freq_object, "passive", ""); - else if (e->status->active == 1) - edje_object_signal_emit(face->freq_object, "active", ""); - } - } - - return 1; -} - -static Status * -_cpufreq_status_new() -{ - Status *e; - - e = E_NEW(Status, 1); - if (!e) return NULL; - - e->frequencies = NULL; - e->governors = NULL; - e->cur_frequency = 0; - e->can_set_frequency = 0; - e->cur_governor = NULL; - e->active = -1; - - return e; -} - -static void -_cpufreq_status_free(Status *e) -{ - Evas_List *l; - - if (e->frequencies) - evas_list_free(e->frequencies); - if (e->governors) - { - for (l = e->governors; l; l = l->next) - free(l->data); - evas_list_free(e->governors); - } - if (e->cur_governor) - free(e->cur_governor); - - free(e); -} - -static int -_cpufreq_cb_sort(void *item1, void *item2) -{ - int a, b; - - a = (int) item1; - b = (int) item2; - if (a < b) - return -1; - else if (a > b) - return 1; - else - return 0; -} - -static int -_cpufreq_status_check_available(Status *e) -{ - char buf[4096]; - Evas_List *l; -#ifdef __FreeBSD__ - int freq, i; - size_t len = 0; - char *freqs, *pos, *q; - - /* read freq_levels sysctl and store it in freq */ - len = sizeof(buf); - if (sysctlbyname("dev.cpu.0.freq_levels", buf, &len, NULL, 0) == 0) - { - /* sysctl returns 0 on success */ - if (e->frequencies) - { - evas_list_free(e->frequencies); - e->frequencies = NULL; - } - - /* parse freqs and store the frequencies in e->frequencies */ - pos = buf; - while (pos) - { - q = strchr(pos, '/'); - if (!q) break; - - *q = '\0'; - freq = atoi(pos); - freq *= 1000; - e->frequencies = evas_list_append(e->frequencies, (void *)freq); - - pos = q + 1; - pos = strchr(pos, ' '); - } - } - - /* sort is not necessary because freq_levels is already sorted */ - /* freebsd doesn't have governors */ - if (e->governors) - { - for (l = e->governors; l; l = l->next) free(l->data); - evas_list_free(e->governors); - e->governors = NULL; - } -#else - FILE *f; - - f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", "r"); - if (f) - { - char *freq; - - if (e->frequencies) - { - evas_list_free(e->frequencies); - e->frequencies = NULL; - } - - fgets(buf, sizeof(buf), f); - buf[sizeof(buf) - 1] = 0; - fclose(f); - - freq = strtok(buf, " "); - do - { - if (atoi(freq) != 0) - { - e->frequencies = evas_list_append(e->frequencies, - (void *) atoi(freq)); - } - freq = strtok(NULL, " "); - } - while (freq != NULL); - - // sort list - e->frequencies = evas_list_sort(e->frequencies, evas_list_count(e->frequencies), - _cpufreq_cb_sort); - } - - f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors", "r"); - if (f) - { - char *gov; - - if (e->governors) - { - for (l = e->governors; l; l = l->next) - free(l->data); - evas_list_free(e->governors); - e->governors = NULL; - } - - fgets(buf, sizeof(buf), f); - buf[sizeof(buf) - 1] = 0; - fclose(f); - - gov = strtok(buf, " "); - do - { - while ((*gov) && (isspace(*gov))) gov++; - if (strlen(gov) != 0) - { -// if ((!strcmp(gov, "ondemand")) || -// (!strcmp(gov, "userspace")) || -// (!strcmp(gov, "powersave")) || -// (!strcmp(gov, "performance")) -// ) - e->governors = evas_list_append(e->governors, strdup(gov)); - } - gov = strtok(NULL, " "); - } - while (gov != NULL); - - e->governors = evas_list_sort(e->governors, evas_list_count(e->governors), - (int (*)(void *, void *))strcmp); - } -#endif - return 1; -} - -static int -_cpufreq_status_check_current(Status *e) -{ - char buf[4096]; - int i; - FILE *f; - int ret = 0; - int frequency = 0; -#ifdef __FreeBSD__ - int len = 4; - - e->active = 0; - /* frequency is stored in dev.cpu.0.freq */ - if (sysctlbyname("dev.cpu.0.freq", &frequency, &len, NULL, 0) == 0) - { - frequency *= 1000; - if (frequency != e->cur_frequency) ret = 1; - e->cur_frequency = frequency; - e->active = 1; - } - - /* hardcoded for testing */ - e->can_set_frequency = 1; - e->cur_governor = NULL; -#else - e->active = 0; - - f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r"); - if (f) - { - fgets(buf, sizeof(buf), f); - buf[sizeof(buf) - 1] = 0; - fclose(f); - - frequency = atoi(buf); - if (frequency != e->cur_frequency) - ret = 1; - e->cur_frequency = frequency; - e->active = 1; - } - - f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed", "r"); - if (f) - { - e->can_set_frequency = 1; - fclose(f); - } - else - { - e->can_set_frequency = 0; - } - - f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "r"); - if (f) - { - fgets(buf, sizeof(buf), f); - buf[sizeof(buf) - 1] = 0; - fclose(f); - - if ((e->cur_governor == NULL) || (strcmp(buf, e->cur_governor))) - { - ret = 1; - - if (e->cur_governor) - free(e->cur_governor); - e->cur_governor = strdup(buf); - - for (i = strlen(e->cur_governor) - 1; i >= 0; i--) - { - if (isspace(e->cur_governor[i])) - e->cur_governor[i] = 0; - else - break; - } - } - } -#endif - return ret; -} - -static Cpufreq_Face * -_cpufreq_face_new(E_Container *con, Cpufreq *owner) -{ - Evas_Object *o; - Cpufreq_Face *ef; - E_Gadman_Policy policy; - - ef = E_NEW(Cpufreq_Face, 1); - if (!ef) return NULL; - - ef->con = con; - e_object_ref(E_OBJECT(con)); - ef->owner = owner; - - evas_event_freeze(con->bg_evas); - - o = edje_object_add(con->bg_evas); - ef->freq_object = o; - e_theme_edje_object_set(o, "base/theme/modules/cpufreq", - "modules/cpufreq/main"); - edje_object_signal_callback_add(o, "next_governor", "governor", _cpufreq_face_cb_set_governor, owner); - edje_object_signal_callback_add(o, "increase_frequency", "frequency", _cpufreq_face_cb_set_frequency, owner); - edje_object_signal_callback_add(o, "decrease_frequency", "frequency", _cpufreq_face_cb_set_frequency, owner); - evas_object_show(o); - - o = evas_object_rectangle_add(con->bg_evas); - ef->event_object = o; - evas_object_layer_set(o, 0); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _cpufreq_face_cb_mouse_down, ef); - evas_object_show(o); - - ef->gmc = e_gadman_client_new(ef->con->gadman); - e_gadman_client_domain_set(ef->gmc, "module.cpufreq", cpufreq_count++); - - policy = E_GADMAN_POLICY_ANYWHERE | - E_GADMAN_POLICY_HMOVE | - E_GADMAN_POLICY_VMOVE | - E_GADMAN_POLICY_HSIZE | - E_GADMAN_POLICY_VSIZE; - - e_gadman_client_policy_set(ef->gmc, policy); - e_gadman_client_min_size_set(ef->gmc, 4, 4); - e_gadman_client_max_size_set(ef->gmc, 128, 128); - /* This module needs a slightly higher min size */ - e_gadman_client_auto_size_set(ef->gmc, 40, 40); - e_gadman_client_align_set(ef->gmc, 1.0, 1.0); - e_gadman_client_resize(ef->gmc, 40, 40); - e_gadman_client_change_func_set(ef->gmc, _cpufreq_face_cb_gmc_change, ef); - e_gadman_client_load(ef->gmc); - - _cpufreq_face_update_available(ef); - - evas_event_thaw(con->bg_evas); - - return ef; -} - -static void -_cpufreq_face_free(Cpufreq_Face *ef) -{ - e_object_unref(E_OBJECT(ef->con)); - e_object_del(E_OBJECT(ef->gmc)); - e_object_del(E_OBJECT(ef->menu)); - evas_object_del(ef->freq_object); - evas_object_del(ef->event_object); - - free(ef->conf); - free(ef); - cpufreq_count--; -} - -static void -_cpufreq_face_menu_new(Cpufreq_Face *face) -{ - E_Menu *mn; - E_Menu_Item *mi; - - mn = e_menu_new(); - face->menu = mn; - - /* Edit */ - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Edit Mode")); - e_menu_item_callback_set(mi, _cpufreq_face_cb_menu_edit, face); -} - -static void -_cpufreq_face_enable(Cpufreq_Face *face) -{ - face->conf->enabled = 1; - evas_object_show(face->freq_object); - evas_object_show(face->event_object); - e_config_save_queue(); -} - -static void -_cpufreq_face_disable(Cpufreq_Face *face) -{ - face->conf->enabled = 0; - evas_object_hide(face->freq_object); - evas_object_hide(face->event_object); - e_config_save_queue(); -} - -static void -_cpufreq_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) -{ - Cpufreq_Face *ef; - Evas_Coord x, y, w, h; - - ef = data; - switch (change) - { - case E_GADMAN_CHANGE_MOVE_RESIZE: - e_gadman_client_geometry_get(ef->gmc, &x, &y, &w, &h); - evas_object_move(ef->freq_object, x, y); - evas_object_move(ef->event_object, x, y); - evas_object_resize(ef->freq_object, w, h); - evas_object_resize(ef->event_object, w, h); - break; - case E_GADMAN_CHANGE_RAISE: - evas_object_raise(ef->freq_object); - evas_object_raise(ef->event_object); - break; - case E_GADMAN_CHANGE_EDGE: - case E_GADMAN_CHANGE_ZONE: - break; - } -} - -static void -_cpufreq_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Cpufreq_Face *face; - - face = data; - e_gadman_mode_set(face->gmc->gadman, E_GADMAN_MODE_EDIT); -} - -static void -_cpufreq_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Down *ev; - Cpufreq_Face *ef; - - ev = event_info; - ef = data; - if (ev->button == 3) - { - e_menu_activate_mouse(ef->menu, e_zone_current_get(ef->con), - ev->output.x, ev->output.y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - e_util_container_fake_mouse_up_all_later(ef->con); - } -} - -static void -_cpufreq_face_update_available(Cpufreq_Face *face) -{ - Edje_Message_Int_Set *frequency_msg; - Edje_Message_String_Set *governor_msg; - Evas_List *l; - int i; - int count; - - count = evas_list_count(face->owner->status->frequencies); - frequency_msg = malloc(sizeof(Edje_Message_Int_Set) + (count - 1) * sizeof(int)); - frequency_msg->count = count; - for (l = face->owner->status->frequencies, i = 0; l; l = l->next, i++) - { - frequency_msg->val[i] = (int) l->data; - } - edje_object_message_send(face->freq_object, EDJE_MESSAGE_INT_SET, 1, frequency_msg); - free(frequency_msg); - - count = evas_list_count(face->owner->status->governors); - governor_msg = malloc(sizeof(Edje_Message_String_Set) + (count - 1) * sizeof(char *)); - governor_msg->count = count; - for (l = face->owner->status->governors, i = 0; l; l = l->next, i++) - governor_msg->str[i] = (char *) l->data; - edje_object_message_send(face->freq_object, EDJE_MESSAGE_STRING_SET, 2, governor_msg); - free(governor_msg); -} - -static void -_cpufreq_face_update_current(Cpufreq_Face *face) -{ - Edje_Message_Int_Set *frequency_msg; - Edje_Message_String governor_msg; - - frequency_msg = malloc(sizeof(Edje_Message_Int_Set) + sizeof(int)); - frequency_msg->count = 2; - frequency_msg->val[0] = face->owner->status->cur_frequency; - frequency_msg->val[1] = face->owner->status->can_set_frequency; - edje_object_message_send(face->freq_object, EDJE_MESSAGE_INT_SET, 3, frequency_msg); - free(frequency_msg); - - /* BSD crashes here without the if-condition - * since it has no governors (yet) */ - if (face->owner->status->cur_governor != NULL) - { - governor_msg.str = face->owner->status->cur_governor; - edje_object_message_send(face->freq_object, EDJE_MESSAGE_STRING, 4, &governor_msg); - } - - if (face->owner->menu_frequency) - { - Evas_List *l; - - for (l = face->owner->menu_frequency->items; l; l = l->next) - { - E_Menu_Item *mi; - int freq; - - mi = l->data; - freq = (int)e_object_data_get(E_OBJECT(mi)); - if (freq == face->owner->status->cur_frequency) - { - e_menu_item_toggle_set(mi, 1); - break; - } - } - } - if (face->owner->menu_governor) - { - Evas_List *l; - - for (l = face->owner->menu_governor->items; l; l = l->next) - { - E_Menu_Item *mi; - char *gov; - - mi = l->data; - gov = (char *)e_object_data_get(E_OBJECT(mi)); - if (!strcmp(face->owner->status->cur_governor, gov)) - { - e_menu_item_toggle_set(mi, 1); - break; - } - } - } -} - -static void -_cpufreq_face_cb_set_frequency(void *data, Evas_Object *obj, const char *emission, const char *src) -{ - Cpufreq *e; - Evas_List *l; - int next_frequency = 0; - - e = data; - - for (l = e->status->frequencies; l; l = l->next) - { - if (e->status->cur_frequency == (int) l->data) - { - if (!strcmp(emission, "increase_frequency")) - { - if (l->next) - next_frequency = (int) l->next->data; - break; - } - else if (!strcmp(emission, "decrease_frequency")) - { - if (l->prev) - next_frequency = (int) l->prev->data; - break; - } - else - break; - } - } - - if (next_frequency != 0) - _cpufreq_set_frequency(e, next_frequency); -} - -static void -_cpufreq_face_cb_set_governor(void *data, Evas_Object *obj, const char *emission, const char *src) -{ - Cpufreq *e; - Evas_List *l; - char *next_governor = NULL; - - e = data; - - for (l = e->status->governors; l; l = l->next) - { - if (!strcmp(l->data, e->status->cur_governor)) - { - if (l->next) - next_governor = l->next->data; - else - next_governor = e->status->governors->data; - break; - } - } - - if (next_governor != NULL) - _cpufreq_set_governor(e, next_governor); -} +/**/ +/***************************************************************************/ diff --git a/src/modules/cpufreq/e_mod_main.h b/src/modules/cpufreq/e_mod_main.h index 57baf322e..fb24d6966 100644 --- a/src/modules/cpufreq/e_mod_main.h +++ b/src/modules/cpufreq/e_mod_main.h @@ -1,67 +1,34 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -#include -#include - typedef struct _Status Status; typedef struct _Config Config; -typedef struct _Config_Face Config_Face; -typedef struct _Cpufreq Cpufreq; -typedef struct _Cpufreq_Face Cpufreq_Face; struct _Status { - Evas_List *frequencies; - Evas_List *governors; - int cur_frequency; - int can_set_frequency; - char *cur_governor; - unsigned char active; + Evas_List *frequencies; + Evas_List *governors; + int cur_frequency; + int can_set_frequency; + char *cur_governor; + unsigned char active; }; struct _Config { - double poll_time; - Evas_List *faces; - - int restore_governor; - char *governor; -}; - -struct _Config_Face -{ - unsigned char enabled; -}; - -struct _Cpufreq -{ - E_Menu *config_menu; - E_Menu *config_menu_poll; - E_Menu *menu_governor; - E_Menu *menu_frequency; - Evas_List *faces; - - Config *conf; - Status *status; - - char *set_exe_path; - - Ecore_Timer *frequency_check_timer; -}; - -struct _Cpufreq_Face -{ - E_Container *con; - + /* saved * loaded config values */ + double poll_time; + int restore_governor; + char *governor; + /* just config state */ + Evas_List *instances; E_Menu *menu; - Config_Face *conf; - Cpufreq *owner; - - Evas_Object *freq_object; - Evas_Object *event_object; - - E_Gadman_Client *gmc; + E_Menu *menu_poll; + E_Menu *menu_governor; + E_Menu *menu_frequency; + Status *status; + char *set_exe_path; + Ecore_Timer *frequency_check_timer; }; EAPI extern E_Module_Api e_modapi; diff --git a/src/modules/dropshadow/e_mod_main.c b/src/modules/dropshadow/e_mod_main.c index 2bcd6be83..3ad62583b 100644 --- a/src/modules/dropshadow/e_mod_main.c +++ b/src/modules/dropshadow/e_mod_main.c @@ -694,7 +694,7 @@ static void _ds_shadow_resize(Shadow *sh, int w, int h) { unsigned char toosmall = 0; - + _ds_shadow_obj_init(sh); if ((w < ((sh->ds->conf->blur_size * 2) + 2)) || (h < ((sh->ds->conf->blur_size * 2) + 2))) diff --git a/src/modules/ibar/Makefile.am b/src/modules/ibar/Makefile.am index cc7461136..7aade0e37 100644 --- a/src/modules/ibar/Makefile.am +++ b/src/modules/ibar/Makefile.am @@ -20,8 +20,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH pkg_LTLIBRARIES = module.la module_la_SOURCES = e_mod_main.c \ e_mod_main.h \ - e_mod_config.c \ - e_mod_config.h + e_mod_config.c module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/src/modules/ibar/e_mod_config.c b/src/modules/ibar/e_mod_config.c index a1fdc4ac0..6d71bb12d 100644 --- a/src/modules/ibar/e_mod_config.c +++ b/src/modules/ibar/e_mod_config.c @@ -1,15 +1,12 @@ -#include +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" -#include "config.h" struct _E_Config_Dialog_Data { - int autofit; - int follower; - int iconsize; - double follow_speed; - double autoscroll_speed; + char *dir; }; /* Protos */ @@ -21,156 +18,110 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); void -_config_ibar_module(E_Container *con, IBar *ibar) +_config_ibar_module(Config_Item *ci) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; v = E_NEW(E_Config_Dialog_View, 1); - + /* Dialog Methods */ v->create_cfdata = _create_data; v->free_cfdata = _free_data; v->basic.apply_cfdata = _basic_apply_data; v->basic.create_widgets = _basic_create_widgets; - v->advanced.apply_cfdata = _advanced_apply_data; - v->advanced.create_widgets = _advanced_create_widgets; - + v->advanced.apply_cfdata = NULL; + v->advanced.create_widgets = NULL; + /* Create The Dialog */ - cfd = e_config_dialog_new(con, _("IBar Configuration"), NULL, 0, v, ibar); - ibar->config_dialog = cfd; + cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()), + _("IBar Configuration"), NULL, 0, v, ci); + ibar_config->config_dialog = cfd; } static void -_fill_data(IBar *ib, E_Config_Dialog_Data *cfdata) +_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata) { - cfdata->autofit = (ib->conf->width == IBAR_WIDTH_AUTO); - cfdata->follower = ib->conf->follower; - cfdata->iconsize = ib->conf->iconsize; - cfdata->follow_speed = ib->conf->follow_speed; - cfdata->autoscroll_speed = ib->conf->autoscroll_speed; + if (ci->dir) + cfdata->dir = strdup(ci->dir); + else + cfdata->dir = strdup(""); } static void * _create_data(E_Config_Dialog *cfd) { E_Config_Dialog_Data *cfdata; - IBar *ib; + Config_Item *ci; - ib = cfd->data; + ci = cfd->data; cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(ib, cfdata); + _fill_data(ci, cfdata); return cfdata; } static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - IBar *ib; - - ib = cfd->data; - ib->config_dialog = NULL; + if (cfdata->dir) free(cfdata->dir); + ibar_config->config_dialog = NULL; free(cfdata); } static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { - Evas_Object *o, *ob; + Evas_Object *o, *of, *ol; + Ecore_List *dirs; + char *home, buf[4096], *file; + int selnum = -1; + + o = e_widget_framelist_add(evas, _("Selected Bar Source"), 0); + + ol = e_widget_tlist_add(evas, &(cfdata->dir)); + e_widget_min_size_set(ol, 160, 200); + e_widget_framelist_object_append(o, ol); - o = e_widget_list_add(evas, 0, 0); - ob = e_widget_check_add(evas, _("Show Follower"), &(cfdata->follower)); - e_widget_list_object_append(o, ob, 1, 1, 0.5); - ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->autofit)); - e_widget_list_object_append(o, ob, 1, 1, 0.5); + home = e_user_homedir_get(); + snprintf(buf, sizeof(buf), "%s/.e/e/applications", home); + dirs = ecore_file_ls(buf); + + if (dirs) + { + int i; + + i = 0; + while ((file = ecore_list_next(dirs))) + { + if (file[0] == '.') continue; + snprintf(buf, sizeof(buf), "%s/.e/e/applications/%s", home, file); + if (ecore_file_is_dir(buf)) + { + e_widget_tlist_append(ol, file, NULL, NULL, file); + if ((cfdata->dir) && (!strcmp(cfdata->dir, file))) + selnum = i; + i++; + } + } + ecore_list_destroy(dirs); + } + free(home); + e_widget_tlist_go(ol); + if (selnum >= 0) + e_widget_tlist_selected_set(ol, selnum); return o; } static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - IBar *ib; + Config_Item *ci; - ib = cfd->data; - e_border_button_bindings_ungrab_all(); - if ((cfdata->follower) && (!ib->conf->follower)) - ib->conf->follower = 1; - else if (!(cfdata->follower) && (ib->conf->follower)) - ib->conf->follower = 0; - - if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED)) - ib->conf->width = IBAR_WIDTH_AUTO; - else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO)) - ib->conf->width = IBAR_WIDTH_FIXED; - - e_border_button_bindings_grab_all(); + ci = cfd->data; + if (ci->dir) evas_stringshare_del(ci->dir); + ci->dir = NULL; + if (cfdata->dir) ci->dir = evas_stringshare_add(cfdata->dir); + _ibar_config_update(); e_config_save_queue(); - - _ibar_bar_cb_config_updated(ib); return 1; } - -static Evas_Object * -_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) -{ - Evas_Object *o, *of, *ob; - - o = e_widget_list_add(evas, 0, 0); - - of = e_widget_framelist_add(evas, _("Follower"), 0); - ob = e_widget_check_add(evas, _("Visible"), &(cfdata->follower)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Follow Speed")); - e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0, &(cfdata->follow_speed), NULL,200); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - of = e_widget_framelist_add(evas, _("Icon Size"), 0); - ob = e_widget_slider_add(evas, 1, 0, _("%3.0f pixels"), 8.0, 128.0, 1.0, 0, NULL, &(cfdata->iconsize), 200); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - of = e_widget_framelist_add(evas, _("Width"), 0); - ob = e_widget_check_add(evas, _("Auto Fit"), &(cfdata->autofit)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Autoscroll Speed:")); - e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0, &(cfdata->autoscroll_speed), NULL,200); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - return o; -} - -static int -_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) -{ - IBar *ib; - - ib = cfd->data; - e_border_button_bindings_ungrab_all(); - if ((cfdata->follower) && (!ib->conf->follower)) - ib->conf->follower = 1; - else if (!(cfdata->follower) && (ib->conf->follower)) - ib->conf->follower = 0; - - if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED)) - ib->conf->width = IBAR_WIDTH_AUTO; - else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO)) - ib->conf->width = IBAR_WIDTH_FIXED; - - if (cfdata->iconsize != ib->conf->iconsize) - ib->conf->iconsize = cfdata->iconsize; - if (cfdata->follow_speed != ib->conf->follow_speed) - ib->conf->follow_speed = cfdata->follow_speed; - if (cfdata->autoscroll_speed != ib->conf->autoscroll_speed) - ib->conf->autoscroll_speed = cfdata->autoscroll_speed; - - e_border_button_bindings_grab_all(); - e_config_save_queue(); - - _ibar_bar_cb_config_updated(ib); - return 1; -} - diff --git a/src/modules/ibar/e_mod_config.h b/src/modules/ibar/e_mod_config.h deleted file mode 100644 index 261cf1ae5..000000000 --- a/src/modules/ibar/e_mod_config.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifdef E_TYPEDEFS -#else -#ifndef E_MOD_CONFIG_H -#define E_MOD_CONFIG_H -#include "e_mod_main.h" -void _config_ibar_module(E_Container *con, IBar *ibar); -#endif -#endif diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index c99693575..3a3fdb25e 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -3,1001 +3,306 @@ */ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" -/* TODO List: - * - * * Listen to change of main e_app! - * - * * Create separate config for each bar - * * Fix menu - * - * * icon labels & label tooltips supported for the name of the app - * * use part list to know how many icons & where to put in the overlay of an icon - * * description bubbles/tooltips for icons - * * support dynamic iconsize change on the fly - * * app subdirs - need to somehow handle these... - * * use overlay object and repeat events for doing auto hide/show - * * emit signals on hide/show due to autohide/show - * * virtualise autoshow/hide to later allow for key bindings, mouse events elsewhere, ipc and other singals to show/hide - * - */ - -static int bar_count; -static E_Config_DD *conf_edd; -static E_Config_DD *conf_bar_edd; - -static int drag, drag_start; -static int drag_x, drag_y; - -/* const strings */ -static const char *_ibar_main_orientation[] = -{"left", "right", "top", "bottom"}; - -/* module private routines */ -static IBar *_ibar_new(); -static void _ibar_free(IBar *ib); -static void _ibar_app_change(void *data, E_App *a, E_App_Change ch); -static void _ibar_config_menu_new(IBar *ib); - -static IBar_Bar *_ibar_bar_new(IBar *ib, E_Container *con); -static void _ibar_bar_free(IBar_Bar *ibb); -static void _ibar_bar_menu_new(IBar_Bar *ibb); -/* static void _ibar_bar_enable(IBar_Bar *ibb); */ -static void _ibar_bar_disable(IBar_Bar *ibb); -static void _ibar_bar_frame_resize(IBar_Bar *ibb); -static void _ibar_bar_edge_change(IBar_Bar *ibb, int edge); -static void _ibar_bar_update_policy(IBar_Bar *ibb); -static void _ibar_bar_motion_handle(IBar_Bar *ibb, Evas_Coord mx, Evas_Coord my); -static void _ibar_bar_timer_handle(IBar_Bar *ibb); -static void _ibar_bar_follower_reset(IBar_Bar *ibb); - -static IBar_Icon *_ibar_icon_new(IBar_Bar *ibb, E_App *a); -static void _ibar_icon_free(IBar_Icon *ic); -static IBar_Icon *_ibar_icon_find(IBar_Bar *ibb, E_App *a); -static IBar_Icon *_ibar_icon_pos_find(IBar_Bar *ibb, int x, int y); -static void _ibar_icon_reorder_after(IBar_Icon *ic, IBar_Icon *after); - -static void _ibar_bar_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _ibar_bar_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y); -static void _ibar_bar_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); -static void _ibar_bar_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _ibar_bar_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _ibar_bar_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _ibar_bar_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _ibar_bar_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); -static int _ibar_bar_cb_timer(void *data); -static int _ibar_bar_cb_animator(void *data); - -static void _ibar_bar_cb_enter(void *data, const char *type, void *event); -static void _ibar_bar_cb_move(void *data, const char *type, void *event); -static void _ibar_bar_cb_leave(void *data, const char *type, void *event); - -static void _ibar_bar_cb_drop(void *data, const char *type, void *event); -static void _ibar_bar_cb_finished(E_Drag *drag, int dropped); - -static void _ibar_icon_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y); -static void _ibar_icon_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); -static void _ibar_icon_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _ibar_icon_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _ibar_icon_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _ibar_icon_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _ibar_icon_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); - -#if 0 -static void _ibar_icon_reorder_before(IBar_Icon *ic, IBar_Icon *before); -#endif - -static void _ibar_bar_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); -static void _ibar_bar_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); -static void _ibar_drag_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y); -static void _ibar_drag_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); - -/* Config Updated Function Protos */ -static void _ibar_bar_cb_width_auto(void *data); -static void _ibar_bar_cb_follower(void *data); -static void _ibar_bar_cb_iconsize_change(void *data); - -/* public module routines. all modules must have these */ -EAPI E_Module_Api e_modapi = +/***************************************************************************/ +/**/ +/* gadcon requirements */ +static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient(E_Gadcon_Client *gcc); +/* and actually define the gadcon class that this module provides (just 1) */ +static const E_Gadcon_Client_Class _gadcon_class = { - E_MODULE_API_VERSION, - "IBar" + GADCON_CLIENT_CLASS_VERSION, + "ibar", + { + _gc_init, _gc_shutdown, _gc_orient + } +}; +/**/ +/***************************************************************************/ + +/***************************************************************************/ +/**/ +/* actual module specifics */ + +typedef struct _Instance Instance; + +typedef struct _IBar IBar; +typedef struct _IBar_Icon IBar_Icon; + +struct _Instance +{ + E_Gadcon_Client *gcc; + Evas_Object *o_ibar; + IBar *ibar; + E_Drop_Handler *drop_handler; + Ecore_Timer *drop_recalc_timer; + char *dir; }; -EAPI void * -e_modapi_init(E_Module *m) +struct _IBar { - IBar *ib; + Instance *inst; + Evas_Object *o_box; + Evas_Object *o_drop; + Evas_Object *o_drop_over; + IBar_Icon *ic_drop_before; + int drop_before; + E_App *apps; + Evas_List *icons; +}; - /* actually init ibar */ - ib = _ibar_new(); - m->config_menu = ib->config_menu; - return ib; -} - -EAPI int -e_modapi_shutdown(E_Module *m) +struct _IBar_Icon { - IBar *ib; + IBar *ibar; + Evas_Object *o_holder; + Evas_Object *o_icon; + Evas_Object *o_holder2; + Evas_Object *o_icon2; + E_App *app; + struct { + unsigned char start : 1; + unsigned char dnd : 1; + int x, y; + int dx, dy; + } drag; +}; - if (m->config_menu) - m->config_menu = NULL; +static IBar *_ibar_new(Evas *evas, char *dir); +static void _ibar_free(IBar *b); +static void _ibar_fill(IBar *b); +static void _ibar_empty(IBar *b); +static void _ibar_orient_set(IBar *b, int horizontal); +static void _ibar_resize_handle(IBar *b); +static void _ibar_instance_drop_zone_recalc(Instance *inst); +static Config_Item *_ibar_config_item_get(char *id); +static IBar_Icon *_ibar_icon_find(IBar *b, E_App *a); +static IBar_Icon *_ibar_icon_at_coord(IBar *b, Evas_Coord x, Evas_Coord y); +static IBar_Icon *_ibar_icon_new(IBar *b, E_App *a); +static void _ibar_icon_free(IBar_Icon *ic); +static void _ibar_icon_fill(IBar_Icon *ic); +static void _ibar_icon_empty(IBar_Icon *ic); +static void _ibar_cb_app_change(void *data, E_App *a, E_App_Change ch); +static int _ibar_cb_timer_drop_recalc(void *data); +static void _ibar_cb_obj_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _ibar_cb_menu_icon_properties(void *data, E_Menu *m, E_Menu_Item *mi); +static void _ibar_cb_menu_icon_remove(void *data, E_Menu *m, E_Menu_Item *mi); +static void _ibar_cb_menu_configuration(void *data, E_Menu *m, E_Menu_Item *mi); +static void _ibar_cb_menu_post(void *data, E_Menu *m); +static void _ibar_cb_icon_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _ibar_cb_icon_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _ibar_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _ibar_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _ibar_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _ibar_cb_icon_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _ibar_cb_icon_resize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _ibar_cb_drag_finished(E_Drag *drag, int dropped); +static void _ibar_inst_cb_enter(void *data, const char *type, void *event_info); +static void _ibar_inst_cb_move(void *data, const char *type, void *event_info); +static void _ibar_inst_cb_leave(void *data, const char *type, void *event_info); +static void _ibar_inst_cb_drop(void *data, const char *type, void *event_info); - ib = m->data; - if (ib) - { - if (ib->config_dialog) - { - e_object_del(E_OBJECT(ib->config_dialog)); - ib->config_dialog = NULL; - } - _ibar_free(ib); - } - return 1; -} +static E_Config_DD *conf_edd = NULL; +static E_Config_DD *conf_item_edd = NULL; -EAPI int -e_modapi_save(E_Module *m) +Config *ibar_config = NULL; + +static E_Gadcon_Client * +_gc_init(E_Gadcon *gc, char *name, char *id, char *style) { - IBar *ib; - - ib = m->data; - e_config_domain_save("module.ibar", conf_edd, ib->conf); - return 1; -} - -EAPI int -e_modapi_info(E_Module *m) -{ - char buf[4096]; - - snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m)); - m->icon_file = strdup(buf); - return 1; -} - -EAPI int -e_modapi_about(E_Module *m) -{ - e_module_dialog_show(_("Enlightenment IBar Module"), - _("This is the IBar Application Launcher bar module for Enlightenment.
" - "It is a first example module and is being used to flesh out several
" - "interfaces in Enlightenment 0.17.0. It is under heavy development,
" - "so expect it to break often and change as it improves.")); - return 1; -} - -EAPI int -e_modapi_config(E_Module *m) -{ - IBar *ib; + IBar *b; + Evas_Object *o; + E_Gadcon_Client *gcc; + Instance *inst; + Evas_Coord x, y, w, h; + int cx, cy, cw, ch; + const char *drop[] = { "enlightenment/eapp", "enlightenment/border", "text/uri-list" }; Evas_List *l; + Config_Item *ci; - ib = m->data; - if (!ib) return 0; - if (!ib->bars) return 0; - for (l = ib->bars; l; l = l->next) - { - IBar_Bar *ibb; - - ibb = l->data; - if (!ibb) return 0; - if (ibb->con == e_container_current_get(e_manager_current_get())) - { - _config_ibar_module(ibb->con, ib); - break; - } - } - return 1; + inst = E_NEW(Instance, 1); + + ci = _ibar_config_item_get(id); + if (!ci->dir) ci->dir = evas_stringshare_add("bar"); + inst->dir = evas_stringshare_add(ci->dir); + b = _ibar_new(gc->evas, ci->dir); + b->inst = inst; + inst->ibar = b; + o = b->o_box; + gcc = e_gadcon_client_new(gc, name, id, style, o); + gcc->data = inst; + + inst->gcc = gcc; + inst->o_ibar = o; + + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + evas_object_geometry_get(o, &x, &y, &w, &h); + inst->drop_handler = + e_drop_handler_add(inst, + _ibar_inst_cb_enter, _ibar_inst_cb_move, + _ibar_inst_cb_leave, _ibar_inst_cb_drop, + drop, 3, cx + x, cy + y, w, h); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, + _ibar_cb_obj_moveresize, inst); + evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, + _ibar_cb_obj_moveresize, inst); + ibar_config->instances = evas_list_append(ibar_config->instances, inst); + /* FIXME: HACK!!!! */ + inst->drop_recalc_timer = ecore_timer_add(1.0, _ibar_cb_timer_drop_recalc, + inst); + return gcc; } -/* module private routines */ -static IBar * -_ibar_new() +static void +_gc_shutdown(E_Gadcon_Client *gcc) { - IBar *ib; - char buf[4096]; - Evas_List *managers, *l, *l2, *cl; + Instance *inst; + + inst = gcc->data; + evas_stringshare_del(inst->dir); + ecore_timer_del(inst->drop_recalc_timer); + ibar_config->instances = evas_list_remove(ibar_config->instances, inst); + e_drop_handler_del(inst->drop_handler); + _ibar_free(inst->ibar); + free(inst); +} - bar_count = 0; - ib = E_NEW(IBar, 1); - if (!ib) return NULL; - - conf_bar_edd = E_CONFIG_DD_NEW("IBar_Config_Bar", Config_Bar); -#undef T -#undef D -#define T Config_Bar -#define D conf_bar_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); - - conf_edd = E_CONFIG_DD_NEW("IBar_Config", Config); -#undef T -#undef D -#define T Config -#define D conf_edd - E_CONFIG_VAL(D, T, appdir, STR); - E_CONFIG_VAL(D, T, follower, INT); - E_CONFIG_VAL(D, T, follow_speed, DOUBLE); - E_CONFIG_VAL(D, T, autoscroll_speed, DOUBLE); - E_CONFIG_VAL(D, T, iconsize, INT); - E_CONFIG_VAL(D, T, width, INT); - E_CONFIG_LIST(D, T, bars, conf_bar_edd); - - ib->conf = e_config_domain_load("module.ibar", conf_edd); - if (!ib->conf) +static void +_gc_orient(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + switch (gcc->gadcon->orient) { - ib->conf = E_NEW(Config, 1); - ib->conf->appdir = evas_stringshare_add("bar"); - ib->conf->follower = 1; - ib->conf->follow_speed = 0.9; - ib->conf->autoscroll_speed = 0.95; - ib->conf->iconsize = 24; - ib->conf->width = IBAR_WIDTH_AUTO; + case E_GADCON_ORIENT_FLOAT: + case E_GADCON_ORIENT_HORIZ: + case E_GADCON_ORIENT_TOP: + case E_GADCON_ORIENT_BOTTOM: + case E_GADCON_ORIENT_CORNER_TL: + case E_GADCON_ORIENT_CORNER_TR: + case E_GADCON_ORIENT_CORNER_BL: + case E_GADCON_ORIENT_CORNER_BR: + e_gadcon_client_aspect_set(gcc, evas_list_count(inst->ibar->icons), 1); + break; + case E_GADCON_ORIENT_VERT: + case E_GADCON_ORIENT_LEFT: + case E_GADCON_ORIENT_RIGHT: + case E_GADCON_ORIENT_CORNER_LT: + case E_GADCON_ORIENT_CORNER_RT: + case E_GADCON_ORIENT_CORNER_LB: + case E_GADCON_ORIENT_CORNER_RB: + e_gadcon_client_aspect_set(gcc, 1, evas_list_count(inst->ibar->icons)); + break; + default: + break; } - E_CONFIG_LIMIT(ib->conf->follow_speed, 0.01, 1.0); - E_CONFIG_LIMIT(ib->conf->autoscroll_speed, 0.01, 1.0); - E_CONFIG_LIMIT(ib->conf->iconsize, 2, 400); - E_CONFIG_LIMIT(ib->conf->width, -2, -1); + if (evas_list_count(inst->ibar->icons) < 1) + e_gadcon_client_aspect_set(gcc, 1, 1); + e_gadcon_client_min_size_set(gcc, 16, 16); +} +/**/ +/***************************************************************************/ - _ibar_config_menu_new(ib); +/***************************************************************************/ +/**/ - if (ib->conf->appdir[0] != '/') +// FIXME: ibar specific calls here +static IBar * +_ibar_new(Evas *evas, char *dir) +{ + IBar *b; + char buf[4096]; + + b = E_NEW(IBar, 1); + b->o_box = e_box_add(evas); + e_box_homogenous_set(b->o_box, 1); + e_box_orientation_set(b->o_box, 1); + e_box_align_set(b->o_box, 0.5, 0.5); + if (dir[0] != '/') { char *homedir; homedir = e_user_homedir_get(); if (homedir) { - snprintf(buf, sizeof(buf), "%s/.e/e/applications/%s", homedir, ib->conf->appdir); + snprintf(buf, sizeof(buf), "%s/.e/e/applications/%s", homedir, dir); free(homedir); } } else - strcpy(buf, ib->conf->appdir); - - ib->apps = e_app_new(buf, 0); - if (ib->apps) e_app_subdir_scan(ib->apps, 0); - e_app_change_callback_add(_ibar_app_change, ib); - - managers = e_manager_list(); - cl = ib->conf->bars; - for (l = managers; l; l = l->next) - { - E_Manager *man; - - man = l->data; - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - IBar_Bar *ibb; - /* Config */ - con = l2->data; - ibb = _ibar_bar_new(ib, con); - if (ibb) - { - E_Menu_Item *mi; - - if (!cl) - { - ibb->conf = E_NEW(Config_Bar, 1); - ibb->conf->enabled = 1; - ib->conf->bars = evas_list_append(ib->conf->bars, ibb->conf); - } - else - { - ibb->conf = cl->data; - cl = cl->next; - } - /* Menu */ - _ibar_bar_menu_new(ibb); - - mi = e_menu_item_new(ib->config_menu); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _ibar_bar_cb_menu_configure, ibb); - - mi = e_menu_item_new(ib->config_menu); - e_menu_item_label_set(mi, con->name); - e_menu_item_submenu_set(mi, ibb->menu); - - /* Setup */ - if (!ibb->conf->enabled) - _ibar_bar_disable(ibb); - - } - } - } - return ib; + snprintf(buf, sizeof(buf), dir); + b->apps = e_app_new(buf, 0); + if (b->apps) e_app_subdir_scan(b->apps, 0); + e_app_change_callback_add(_ibar_cb_app_change, b); + _ibar_fill(b); + return b; } static void -_ibar_free(IBar *ib) +_ibar_free(IBar *b) { - E_CONFIG_DD_FREE(conf_edd); - E_CONFIG_DD_FREE(conf_bar_edd); - - while (ib->bars) - _ibar_bar_free(ib->bars->data); - if (ib->apps) - e_object_unref(E_OBJECT(ib->apps)); - - if (ib->conf->appdir) evas_stringshare_del(ib->conf->appdir); - e_app_change_callback_del(_ibar_app_change, ib); - e_object_del(E_OBJECT(ib->config_menu)); - evas_list_free(ib->conf->bars); - free(ib->conf); - free(ib); + _ibar_empty(b); + evas_object_del(b->o_box); + if (b->o_drop) evas_object_del(b->o_drop); + if (b->o_drop_over) evas_object_del(b->o_drop_over); + e_object_unref(E_OBJECT(b->apps)); + e_app_change_callback_del(_ibar_cb_app_change, b); + free(b); } static void -_ibar_app_change(void *data, E_App *a, E_App_Change ch) -{ - IBar *ib; - Evas_List *l, *ll; - - ib = data; - for (l = ib->bars; l; l = l->next) - { - IBar_Bar *ibb; - - ibb = l->data; - switch (ch) - { - case E_APP_ADD: - if (e_app_is_parent(ib->apps, a)) - { - IBar_Icon *ic; - - if (e_app_valid_exe_get(a) || (!a->exe)) - { - ic = _ibar_icon_new(ibb, a); - if (ic) - { - for (ll = ib->apps->subapps; ll; ll = ll->next) - { - E_App *a2; - - a2 = ll->data; - ic = _ibar_icon_find(ibb, a2); - if (ic) _ibar_icon_reorder_after(ic, NULL); - } - _ibar_bar_frame_resize(ibb); - } - } - } - break; - case E_APP_DEL: - if (e_app_is_parent(ib->apps, a)) - { - IBar_Icon *ic; - - ic = _ibar_icon_find(ibb, a); - if (ic) _ibar_icon_free(ic); - _ibar_bar_frame_resize(ibb); - } - break; - case E_APP_CHANGE: - if (e_app_is_parent(ib->apps, a)) - { - IBar_Icon *ic; - - ic = _ibar_icon_find(ibb, a); - if (ic) _ibar_icon_free(ic); - evas_image_cache_flush(ibb->evas); - evas_image_cache_reload(ibb->evas); - ic = _ibar_icon_new(ibb, a); - if (ic) - { - for (ll = ib->apps->subapps; ll; ll = ll->next) - { - E_App *a2; - - a2 = ll->data; - ic = _ibar_icon_find(ibb, a2); - if (ic) _ibar_icon_reorder_after(ic, NULL); - } - _ibar_bar_frame_resize(ibb); - } - } - break; - case E_APP_ORDER: - if (a == ib->apps) - { - for (ll = ib->apps->subapps; ll; ll = ll->next) - { - IBar_Icon *ic; - E_App *a2; - - a2 = ll->data; - ic = _ibar_icon_find(ibb, a2); - if (ic) _ibar_icon_reorder_after(ic, NULL); - } - } - break; - case E_APP_EXEC: - if (e_app_is_parent(ib->apps, a)) - { - IBar_Icon *ic; - - ic = _ibar_icon_find(ibb, a); - if (ic) - { - if (a->startup_notify) - { - edje_object_signal_emit(ic->icon_object, "start", ""); - for (ll = ic->extra_icons; ll; ll = ll->next) edje_object_signal_emit(ll->data, "start", ""); - edje_object_signal_emit(ic->bg_object, "start", ""); - edje_object_signal_emit(ic->overlay_object, "start", ""); - if (ic->ibb->overlay_object) - edje_object_signal_emit(ic->ibb->overlay_object, "start", ""); - } - else - { - edje_object_signal_emit(ic->icon_object, "exec", ""); - for (ll = ic->extra_icons; ll; ll = ll->next) edje_object_signal_emit(ll->data, "exec", ""); - edje_object_signal_emit(ic->bg_object, "exec", ""); - edje_object_signal_emit(ic->overlay_object, "exec", ""); - if (ic->ibb->overlay_object) - edje_object_signal_emit(ic->ibb->overlay_object, "exec", ""); - } - } - } - break; - case E_APP_READY: - case E_APP_READY_EXPIRE: - case E_APP_EXIT: - if (e_app_is_parent(ib->apps, a)) - { - if (a->startup_notify) - { - IBar_Icon *ic; - - ic = _ibar_icon_find(ibb, a); - if (ic) - { - edje_object_signal_emit(ic->icon_object, "stop", ""); - for (ll = ic->extra_icons; ll; ll = ll->next) edje_object_signal_emit(ll->data, "stop", ""); - edje_object_signal_emit(ic->bg_object, "stop", ""); - edje_object_signal_emit(ic->overlay_object, "stop", ""); - if (ic->ibb->overlay_object) - edje_object_signal_emit(ic->ibb->overlay_object, "stop", ""); - } - } - } - break; - default: - break; - } - } -} - -static IBar_Bar * -_ibar_bar_new(IBar *ib, E_Container *con) -{ - IBar_Bar *ibb; - Evas_List *l; - Evas_Object *o; - E_Gadman_Policy policy; - Evas_Coord x, y, w, h; - const char *drop[] = { "enlightenment/eapp", "enlightenment/border", "text/uri-list" }; - - ibb = E_NEW(IBar_Bar, 1); - if (!ibb) return NULL; - ibb->ibar = ib; - ib->bars = evas_list_append(ib->bars, ibb); - - ibb->con = con; - e_object_ref(E_OBJECT(con)); - ibb->evas = con->bg_evas; - - ibb->x = ibb->y = ibb->w = ibb->h = -1; - - evas_event_freeze(ibb->evas); - o = edje_object_add(ibb->evas); - ibb->bar_object = o; - e_theme_edje_object_set(o, "base/theme/modules/ibar", - "modules/ibar/main"); - evas_object_show(o); - - if (ibb->ibar->conf->follower) - { - o = edje_object_add(ibb->evas); - ibb->overlay_object = o; - evas_object_layer_set(o, 2); - e_theme_edje_object_set(o, "base/theme/modules/ibar", - "modules/ibar/follower"); - evas_object_show(o); - } - - o = evas_object_rectangle_add(ibb->evas); - ibb->event_object = o; - evas_object_layer_set(o, 3); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _ibar_bar_cb_mouse_in, ibb); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _ibar_bar_cb_mouse_out, ibb); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _ibar_bar_cb_mouse_down, ibb); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _ibar_bar_cb_mouse_up, ibb); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _ibar_bar_cb_mouse_move, ibb); - evas_object_show(o); - - o = e_box_add(ibb->evas); - ibb->box_object = o; - evas_object_intercept_move_callback_add(o, _ibar_bar_cb_intercept_move, ibb); - evas_object_intercept_resize_callback_add(o, _ibar_bar_cb_intercept_resize, ibb); - e_box_freeze(o); - edje_object_part_swallow(ibb->bar_object, "items", o); - evas_object_show(o); - - if (ibb->ibar->apps) - { - for (l = ibb->ibar->apps->subapps; l; l = l->next) - { - E_App *a; - IBar_Icon *ic; - - a = l->data; - if (e_app_valid_exe_get(a) || (!a->exe)) - { - ic = _ibar_icon_new(ibb, a); - } - } - } - ibb->align_req = 0.5; - ibb->align = 0.5; - e_box_align_set(ibb->box_object, 0.5, 0.5); - - e_box_thaw(ibb->box_object); - - evas_object_resize(ibb->bar_object, 1000, 1000); - edje_object_calc_force(ibb->bar_object); - edje_object_part_geometry_get(ibb->bar_object, "items", &x, &y, &w, &h); - ibb->bar_inset.l = x; - ibb->bar_inset.r = 1000 - (x + w); - ibb->bar_inset.t = y; - ibb->bar_inset.b = 1000 - (y + h); - - o = edje_object_add(ibb->evas); - e_theme_edje_object_set(o, "base/theme/modules/ibar", - "modules/ibar/icon"); - evas_object_resize(o, 100, 100); - edje_object_calc_force(o); - edje_object_part_geometry_get(o, "item", &x, &y, &w, &h); - ibb->icon_inset.l = x; - ibb->icon_inset.r = 100 - (x + w); - ibb->icon_inset.t = y; - ibb->icon_inset.b = 100 - (y + h); - evas_object_del(o); - - ibb->drop_handler = e_drop_handler_add(ibb, - _ibar_bar_cb_enter, _ibar_bar_cb_move, - _ibar_bar_cb_leave, _ibar_bar_cb_drop, - drop, 3, - ibb->x + ibb->bar_inset.l, ibb->y + ibb->bar_inset.t, - ibb->w - (ibb->bar_inset.l + ibb->bar_inset.r), - ibb->h - (ibb->bar_inset.t + ibb->bar_inset.b)); - - ibb->gmc = e_gadman_client_new(ibb->con->gadman); - e_gadman_client_domain_set(ibb->gmc, "module.ibar", bar_count++); - policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE; - if (ibb->ibar->conf->width == IBAR_WIDTH_FIXED) - policy |= E_GADMAN_POLICY_HSIZE; - - e_gadman_client_policy_set(ibb->gmc, policy); - e_gadman_client_min_size_set(ibb->gmc, 8, 8); - e_gadman_client_max_size_set(ibb->gmc, 3200, 3200); - e_gadman_client_auto_size_set(ibb->gmc, -1, -1); - e_gadman_client_align_set(ibb->gmc, 0.5, 1.0); - e_gadman_client_resize(ibb->gmc, 400, 40); - e_gadman_client_change_func_set(ibb->gmc, _ibar_bar_cb_gmc_change, ibb); - e_gadman_client_edge_set(ibb->gmc, E_GADMAN_EDGE_BOTTOM); - e_gadman_client_load(ibb->gmc); - - evas_event_thaw(ibb->evas); - - /* We need to resize, if the width is auto and the number - * of apps has changed since last startup */ - _ibar_bar_frame_resize(ibb); - - /* - edje_object_signal_emit(ibb->bar_object, "passive", ""); - edje_object_signal_emit(ibb->overlay_object, "passive", ""); - */ - - return ibb; -} - -static void -_ibar_bar_free(IBar_Bar *ibb) -{ - e_object_unref(E_OBJECT(ibb->con)); - - e_object_del(E_OBJECT(ibb->menu)); - - while (ibb->icons) - _ibar_icon_free(ibb->icons->data); - - e_drop_handler_del(ibb->drop_handler); - - if (ibb->timer) ecore_timer_del(ibb->timer); - if (ibb->animator) ecore_animator_del(ibb->animator); - evas_object_del(ibb->bar_object); - if (ibb->overlay_object) evas_object_del(ibb->overlay_object); - evas_object_del(ibb->box_object); - evas_object_del(ibb->event_object); - if (ibb->drag_object) evas_object_del(ibb->drag_object); - ibb->drag_object = NULL; - if (ibb->drag_object_overlay) evas_object_del(ibb->drag_object_overlay); - ibb->drag_object_overlay = NULL; - - e_gadman_client_save(ibb->gmc); - e_object_del(E_OBJECT(ibb->gmc)); - - ibb->ibar->bars = evas_list_remove(ibb->ibar->bars, ibb); - - free(ibb->conf); - free(ibb); - bar_count--; -} - -static void -_ibar_bar_menu_new(IBar_Bar *ibb) -{ - E_Menu *mn; - E_Menu_Item *mi; - - mn = e_menu_new(); - ibb->menu = mn; - - /* Config */ - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _ibar_bar_cb_menu_configure, ibb); - - /* Edit */ - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Edit Mode")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets"); - e_menu_item_callback_set(mi, _ibar_bar_cb_menu_edit, ibb); -} - -static void -_ibar_bar_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi) -{ - IBar_Bar *ibb; - - ibb = data; - if (!ibb) return; - _config_ibar_module(ibb->con, ibb->ibar); -} - -/* -static void -_ibar_bar_enable(IBar_Bar *ibb) -{ - ibb->conf->enabled = 1; - evas_object_show(ibb->bar_object); - if (ibb->overlay_object) evas_object_show(ibb->overlay_object); - evas_object_show(ibb->box_object); - evas_object_show(ibb->event_object); - e_config_save_queue(); -} -*/ - -static void -_ibar_bar_disable(IBar_Bar *ibb) -{ - ibb->conf->enabled = 0; - evas_object_hide(ibb->bar_object); - if (ibb->overlay_object) evas_object_hide(ibb->overlay_object); - evas_object_hide(ibb->box_object); - evas_object_hide(ibb->event_object); - e_config_save_queue(); -} - -static IBar_Icon * -_ibar_icon_new(IBar_Bar *ibb, E_App *a) +_ibar_fill(IBar *b) { IBar_Icon *ic; - // char *str; - Evas_Object *o; - Evas_Coord w, h; + Evas_List *l; + E_App *a; - ic = E_NEW(IBar_Icon, 1); - if (!ic) return NULL; - ic->ibb = ibb; - ic->app = a; - e_object_ref(E_OBJECT(a)); - ibb->icons = evas_list_append(ibb->icons, ic); - - o = evas_object_rectangle_add(ibb->evas); - ic->event_object = o; - evas_object_layer_set(o, 1); - evas_object_clip_set(o, evas_object_clip_get(ibb->box_object)); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_repeat_events_set(o, 1); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _ibar_icon_cb_mouse_in, ic); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _ibar_icon_cb_mouse_out, ic); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _ibar_icon_cb_mouse_down, ic); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _ibar_icon_cb_mouse_up, ic); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _ibar_icon_cb_mouse_move, ic); - evas_object_show(o); - - o = edje_object_add(ibb->evas); - ic->bg_object = o; - evas_object_intercept_move_callback_add(o, _ibar_icon_cb_intercept_move, ic); - evas_object_intercept_resize_callback_add(o, _ibar_icon_cb_intercept_resize, ic); - e_theme_edje_object_set(o, "base/theme/modules/ibar", - "modules/ibar/icon"); - evas_object_show(o); - - o = edje_object_add(ibb->evas); - ic->icon_object = o; - evas_object_resize(o, ibb->ibar->conf->iconsize, ibb->ibar->conf->iconsize); - edje_object_file_set(o, ic->app->path, "icon"); - edje_object_part_swallow(ic->bg_object, "item", o); - evas_object_pass_events_set(o, 1); - evas_object_show(o); - - o = edje_object_add(ibb->evas); - ic->overlay_object = o; - evas_object_intercept_move_callback_add(o, _ibar_icon_cb_intercept_move, ic); - evas_object_intercept_resize_callback_add(o, _ibar_icon_cb_intercept_resize, ic); - e_theme_edje_object_set(o, "base/theme/modules/ibar", - "modules/ibar/icon_overlay"); - evas_object_show(o); - - o = edje_object_add(ibb->evas); - ic->extra_icons = evas_list_append(ic->extra_icons, o); - edje_object_file_set(o, ic->app->path, "icon"); - edje_object_part_swallow(ic->overlay_object, "item", o); - evas_object_pass_events_set(o, 1); - evas_object_show(o); - - evas_object_raise(ic->event_object); - - w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r; - h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b; - e_box_pack_end(ibb->box_object, ic->bg_object); - e_box_pack_options_set(ic->bg_object, - 1, 1, /* fill */ - 0, 0, /* expand */ - 0.5, 0.5, /* align */ - w, h, /* min */ - w, h /* max */ - ); - -/* - str = (char *)edje_object_data_get(ic->icon_object, "raise_on_hilight"); - if (str) + for (l = b->apps->subapps; l; l = l->next) { - if (atoi(str) == 1) ic->raise_on_hilight = 1; + a = l->data; + ic = _ibar_icon_new(b, a); + b->icons = evas_list_append(b->icons, ic); + e_box_pack_end(b->o_box, ic->o_holder); } -*/ - edje_object_signal_emit(ic->bg_object, "passive", ""); - edje_object_signal_emit(ic->overlay_object, "passive", ""); - return ic; + _ibar_resize_handle(b); } static void -_ibar_icon_free(IBar_Icon *ic) +_ibar_empty(IBar *b) { - ic->ibb->icons = evas_list_remove(ic->ibb->icons, ic); - if (ic->bg_object) evas_object_del(ic->bg_object); - if (ic->overlay_object) evas_object_del(ic->overlay_object); - if (ic->icon_object) evas_object_del(ic->icon_object); - if (ic->event_object) evas_object_del(ic->event_object); - while (ic->extra_icons) + while (b->icons) { - Evas_Object *o; - - o = ic->extra_icons->data; - ic->extra_icons = evas_list_remove_list(ic->extra_icons, ic->extra_icons); - evas_object_del(o); + _ibar_icon_free(b->icons->data); + b->icons = evas_list_remove_list(b->icons, b->icons); } - e_object_unref(E_OBJECT(ic->app)); - free(ic); } -static IBar_Icon * -_ibar_icon_find(IBar_Bar *ibb, E_App *a) +static void +_ibar_orient_set(IBar *b, int horizontal) +{ + e_box_orientation_set(b->o_box, horizontal); + e_box_align_set(b->o_box, 0.5, 0.5); +} + +static void +_ibar_resize_handle(IBar *b) { Evas_List *l; - - for (l = ibb->icons; l; l = l->next) - { - IBar_Icon *ic; - - ic = l->data; - if (e_app_equals(ic->app, a)) - return ic; - } - return NULL; -} - -static IBar_Icon * -_ibar_icon_pos_find(IBar_Bar *ibb, int x, int y) -{ IBar_Icon *ic; - double pos, iw; - int w, h; - - x = x - (ibb->x + ibb->bar_inset.l); - y = y - (ibb->y + ibb->bar_inset.t); - w = ibb->w - (ibb->bar_inset.l + ibb->bar_inset.r); - h = ibb->h - (ibb->bar_inset.t + ibb->bar_inset.b); - - if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP)) - { - iw = w / (double) e_box_pack_count_get(ibb->box_object); - pos = x / iw; - } - else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT)) - { - iw = h / (double) e_box_pack_count_get(ibb->box_object); - pos = y / iw; - } - - ic = evas_list_nth(ibb->icons, pos); - return ic; -} - -void -_ibar_config_menu_new(IBar *ib) -{ - E_Menu *mn; - - mn = e_menu_new(); - ib->config_menu = mn; -} - -#if 0 -static void -_ibar_icon_reorder_before(IBar_Icon *ic, IBar_Icon *before) -{ - Evas_Coord bw, bh; - - e_box_freeze(ic->ibb->box_object); - e_box_unpack(ic->bg_object); - ic->ibb->icons = evas_list_remove(ic->ibb->icons, ic); - if (before) - { - ic->ibb->icons = evas_list_prepend_relative(ic->ibb->icons, ic, before); - e_box_pack_before(ic->ibb->box_object, ic->bg_object, before->bg_object); - } - else - { - ic->ibb->icons = evas_list_prepend(ic->ibb->icons, ic); - e_box_pack_start(ic->ibb->box_object, ic->bg_object); - } - edje_object_size_min_calc(ic->bg_object, &bw, &bh); - e_box_pack_options_set(ic->bg_object, - 1, 1, /* fill */ - 0, 0, /* expand */ - 0.5, 0.5, /* align */ - bw, bh, /* min */ - bw, bh /* max */ - ); - e_box_thaw(ic->ibb->box_object); -} -#endif - -static void -_ibar_icon_reorder_after(IBar_Icon *ic, IBar_Icon *after) -{ Evas_Coord w, h; - - e_box_freeze(ic->ibb->box_object); - e_box_unpack(ic->bg_object); - ic->ibb->icons = evas_list_remove(ic->ibb->icons, ic); - if (after) - { - ic->ibb->icons = evas_list_append_relative(ic->ibb->icons, ic, after); - e_box_pack_after(ic->ibb->box_object, ic->bg_object, after->bg_object); - } + + evas_object_geometry_get(b->o_box, NULL, NULL, &w, &h); + if (e_box_orientation_get(b->o_box)) + w = h; else + h = w; + e_box_freeze(b->o_box); + for (l = b->icons; l; l = l->next) { - ic->ibb->icons = evas_list_append(ic->ibb->icons, ic); - e_box_pack_end(ic->ibb->box_object, ic->bg_object); - } - w = ic->ibb->ibar->conf->iconsize + ic->ibb->icon_inset.l + ic->ibb->icon_inset.r; - h = ic->ibb->ibar->conf->iconsize + ic->ibb->icon_inset.t + ic->ibb->icon_inset.b; - e_box_pack_options_set(ic->bg_object, - 1, 1, /* fill */ - 0, 0, /* expand */ - 0.5, 0.5, /* align */ - w, h, /* min */ - w, h /* max */ - ); - e_box_thaw(ic->ibb->box_object); -} - -static void -_ibar_bar_frame_resize(IBar_Bar *ibb) -{ - Evas_Coord w, h, bw, bh; - /* Not finished loading config yet! */ - if ((ibb->x == -1) || (ibb->y == -1) || - (ibb->w == -1) || (ibb->h == -1)) - return; - - evas_event_freeze(ibb->evas); - e_box_freeze(ibb->box_object); - - e_box_min_size_get(ibb->box_object, &w, &h); - edje_extern_object_min_size_set(ibb->box_object, w, h); - edje_object_part_swallow(ibb->bar_object, "items", ibb->box_object); - edje_object_size_min_calc(ibb->bar_object, &bw, &bh); - edje_extern_object_min_size_set(ibb->box_object, 0, 0); - edje_object_part_swallow(ibb->bar_object, "items", ibb->box_object); - - e_box_thaw(ibb->box_object); - evas_event_thaw(ibb->evas); - - if (ibb->ibar->conf->width == IBAR_WIDTH_AUTO) - { - e_gadman_client_resize(ibb->gmc, bw, bh); - } - else - { - if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT)) - { - /* h is the width of the bar */ - e_gadman_client_resize(ibb->gmc, bw, ibb->h); - } - else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM)) - { - /* w is the width of the bar */ - e_gadman_client_resize(ibb->gmc, ibb->w, bh); - } - } -} - -static void -_ibar_bar_edge_change(IBar_Bar *ibb, int edge) -{ - Evas_List *l; - Evas_Coord w, h, tmp; - Evas_Object *o; - E_Gadman_Policy policy; - int changed; - - evas_event_freeze(ibb->evas); - o = ibb->bar_object; - edje_object_signal_emit(o, "set_orientation", _ibar_main_orientation[edge]); - edje_object_message_signal_process(o); - - if (ibb->overlay_object) - { - o = ibb->overlay_object; - edje_object_signal_emit(o, "set_orientation", _ibar_main_orientation[edge]); - edje_object_message_signal_process(o); - } - - e_box_freeze(ibb->box_object); - - for (l = ibb->icons; l; l = l->next) - { - IBar_Icon *ic; - ic = l->data; - o = ic->bg_object; - edje_object_signal_emit(o, "set_orientation", _ibar_main_orientation[edge]); - edje_object_message_signal_process(o); - - o = ic->overlay_object; - edje_object_signal_emit(o, "set_orientation", _ibar_main_orientation[edge]); - edje_object_message_signal_process(o); - - w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r; - h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b; - e_box_pack_options_set(ic->bg_object, + e_box_pack_options_set(ic->o_holder, 1, 1, /* fill */ 0, 0, /* expand */ 0.5, 0.5, /* align */ @@ -1005,273 +310,488 @@ _ibar_bar_edge_change(IBar_Bar *ibb, int edge) w, h /* max */ ); } - - ibb->align_req = 0.5; - ibb->align = 0.5; - e_box_align_set(ibb->box_object, 0.5, 0.5); - - policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE; - if ((edge == E_GADMAN_EDGE_BOTTOM) || - (edge == E_GADMAN_EDGE_TOP)) - { - changed = (e_box_orientation_get(ibb->box_object) != 1); - if (changed) - { - e_box_orientation_set(ibb->box_object, 1); - if (ibb->ibar->conf->width == IBAR_WIDTH_FIXED) - policy |= E_GADMAN_POLICY_HSIZE; - e_gadman_client_policy_set(ibb->gmc, policy); - tmp = ibb->w; - ibb->w = ibb->h; - ibb->h = tmp; - } - } - else if ((edge == E_GADMAN_EDGE_LEFT) || - (edge == E_GADMAN_EDGE_RIGHT)) - { - changed = (e_box_orientation_get(ibb->box_object) != 0); - if (changed) - { - e_box_orientation_set(ibb->box_object, 0); - if (ibb->ibar->conf->width == IBAR_WIDTH_FIXED) - policy |= E_GADMAN_POLICY_VSIZE; - e_gadman_client_policy_set(ibb->gmc, policy); - tmp = ibb->w; - ibb->w = ibb->h; - ibb->h = tmp; - } - } - - e_box_thaw(ibb->box_object); - evas_event_thaw(ibb->evas); - - _ibar_bar_frame_resize(ibb); + e_box_thaw(b->o_box); } static void -_ibar_bar_update_policy(IBar_Bar *ibb) -{ - E_Gadman_Policy policy; - - policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE; - - if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP)) - { - if (ibb->ibar->conf->width == IBAR_WIDTH_FIXED) - policy |= E_GADMAN_POLICY_HSIZE; - e_gadman_client_policy_set(ibb->gmc, policy); - } - else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT)) - { - if (ibb->ibar->conf->width == IBAR_WIDTH_FIXED) - policy |= E_GADMAN_POLICY_VSIZE; - e_gadman_client_policy_set(ibb->gmc, policy); - } -} - -static void -_ibar_bar_motion_handle(IBar_Bar *ibb, Evas_Coord mx, Evas_Coord my) +_ibar_instance_drop_zone_recalc(Instance *inst) { Evas_Coord x, y, w, h; - double relx, rely; + int cx, cy, cw, ch; + + evas_object_geometry_get(inst->o_ibar, &x, &y, &w, &h); + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + e_drop_handler_geometry_set(inst->drop_handler, cx + x, cy + y, w, h); +} - evas_object_geometry_get(ibb->box_object, &x, &y, &w, &h); - if (w > 0) relx = (double)(mx - x) / (double)w; - else relx = 0.0; - if (h > 0) rely = (double)(my - y) / (double)h; - else rely = 0.0; - if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP)) +static Config_Item * +_ibar_config_item_get(char *id) +{ + Evas_List *l; + Config_Item *ci; + + for (l = ibar_config->items; l; l = l->next) { - ibb->align_req = 1.0 - relx; - ibb->follow_req = relx; - } - else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT)) - { - ibb->align_req = 1.0 - rely; - ibb->follow_req = rely; + ci = l->data; + if ((ci->id) && (ci->dir) && (!strcmp(ci->id, id))) + return ci; } + ci = E_NEW(Config_Item, 1); + ci->id = evas_stringshare_add(id); + ibar_config->items = evas_list_append(ibar_config->items, ci); + return ci; } -static void -_ibar_bar_timer_handle(IBar_Bar *ibb) +void +_ibar_config_update(void) { - if (!ibb->timer) - ibb->timer = ecore_timer_add(0.01, _ibar_bar_cb_timer, ibb); - if (!ibb->animator) - ibb->animator = ecore_animator_add(_ibar_bar_cb_animator, ibb); -} - -static void -_ibar_bar_follower_reset(IBar_Bar *ibb) -{ - Evas_Coord ww, hh, bx, by, bw, bh, d1, d2, mw, mh; - - if (!ibb->overlay_object) return; - - evas_output_viewport_get(ibb->evas, NULL, NULL, &ww, &hh); - evas_object_geometry_get(ibb->box_object, &bx, &by, &bw, &bh); - edje_object_size_min_get(ibb->overlay_object, &mw, &mh); - if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP)) + Evas_List *l; + + for (l = ibar_config->instances; l; l = l->next) { - d1 = bx; - d2 = ww - (bx + bw); - if (bw > 0) + Instance *inst; + Config_Item *ci; + + inst = l->data; + ci = _ibar_config_item_get(inst->gcc->id); + if ((inst->dir) && (ci->dir) && (strcmp(ci->dir, inst->dir))) { - if (d1 < d2) - ibb->follow_req = -((double)(d1 + (mw * 4)) / (double)bw); + char buf[4096]; + + evas_stringshare_del(inst->dir); + inst->dir = evas_stringshare_add(ci->dir); + _ibar_empty(inst->ibar); + e_object_unref(E_OBJECT(inst->ibar->apps)); + if (inst->dir[0] != '/') + { + char *homedir; + + homedir = e_user_homedir_get(); + if (homedir) + { + snprintf(buf, sizeof(buf), "%s/.e/e/applications/%s", homedir, inst->dir); + free(homedir); + } + } else - ibb->follow_req = 1.0 + ((double)(d2 + (mw * 4)) / (double)bw); - } - } - else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT)) - { - d1 = by; - d2 = hh - (by + bh); - if (bh > 0) - { - if (d1 < d2) - ibb->follow_req = -((double)(d1 + (mh * 4)) / (double)bh); - else - ibb->follow_req = 1.0 + ((double)(d2 + (mh * 4)) / (double)bh); + snprintf(buf, sizeof(buf), inst->dir); + inst->ibar->apps = e_app_new(buf, 0); + if (inst->ibar->apps) e_app_subdir_scan(inst->ibar->apps, 0); + _ibar_fill(inst->ibar); + _ibar_resize_handle(inst->ibar); + _gc_orient(inst->gcc); } } } -static void -_ibar_icon_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y) +static IBar_Icon * +_ibar_icon_find(IBar *b, E_App *a) +{ + Evas_List *l; + IBar_Icon *ic; + + for (l = b->icons; l; l = l->next) + { + ic = l->data; + + if (ic->app == a) return ic; + } + return NULL; +} + +static IBar_Icon * +_ibar_icon_at_coord(IBar *b, Evas_Coord x, Evas_Coord y) +{ + Evas_List *l; + IBar_Icon *ic; + + for (l = b->icons; l; l = l->next) + { + Evas_Coord dx, dy, dw, dh; + ic = l->data; + + evas_object_geometry_get(ic->o_holder, &dx, &dy, &dw, &dh); + if (E_INSIDE(x, y, dx, dy, dw, dh)) return ic; + } + return NULL; +} + +static IBar_Icon * +_ibar_icon_new(IBar *b, E_App *a) { IBar_Icon *ic; - - ic = data; - evas_object_move(o, x, y); - evas_object_move(ic->event_object, x, y); - evas_object_move(ic->overlay_object, x, y); + + ic = E_NEW(IBar_Icon, 1); + e_object_ref(E_OBJECT(a)); + ic->ibar = b; + ic->app = a; + ic->o_holder = edje_object_add(evas_object_evas_get(b->o_box)); + e_theme_edje_object_set(ic->o_holder, "base/theme/modules/ibar", + "modules/ibar/icon"); + evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_IN, _ibar_cb_icon_mouse_in, ic); + evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_OUT, _ibar_cb_icon_mouse_out, ic); + evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_DOWN, _ibar_cb_icon_mouse_down, ic); + evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_UP, _ibar_cb_icon_mouse_up, ic); + evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_MOVE, _ibar_cb_icon_mouse_move, ic); + evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOVE, _ibar_cb_icon_move, ic); + evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_RESIZE, _ibar_cb_icon_resize, ic); + evas_object_show(ic->o_holder); + + ic->o_holder2 = edje_object_add(evas_object_evas_get(b->o_box)); + e_theme_edje_object_set(ic->o_holder2, "base/theme/modules/ibar", + "modules/ibar/icon_overlay"); + evas_object_layer_set(ic->o_holder2, 9999); + evas_object_pass_events_set(ic->o_holder2, 1); + evas_object_show(ic->o_holder2); + + _ibar_icon_fill(ic); + return ic; } static void -_ibar_icon_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h) +_ibar_icon_free(IBar_Icon *ic) +{ + Evas_Object *o; + + if (ibar_config->menu) + { + e_object_del(E_OBJECT(ibar_config->menu)); + ibar_config->menu = NULL; + } + if (ic->ibar->ic_drop_before == ic) + ic->ibar->ic_drop_before = NULL; + _ibar_icon_empty(ic); + evas_object_del(ic->o_holder); + evas_object_del(ic->o_holder2); + e_object_unref(E_OBJECT(ic->app)); + free(ic); +} + +static void +_ibar_icon_fill(IBar_Icon *ic) +{ + ic->o_icon = edje_object_add(evas_object_evas_get(ic->ibar->o_box)); + edje_object_file_set(ic->o_icon, ic->app->path, "icon"); + edje_object_part_swallow(ic->o_holder, "item", ic->o_icon); + evas_object_pass_events_set(ic->o_icon, 1); + evas_object_show(ic->o_icon); + ic->o_icon2 = edje_object_add(evas_object_evas_get(ic->ibar->o_box)); + edje_object_file_set(ic->o_icon2, ic->app->path, "icon"); + edje_object_part_swallow(ic->o_holder2, "item", ic->o_icon2); + evas_object_pass_events_set(ic->o_icon2, 1); + evas_object_show(ic->o_icon2); +} + +static void +_ibar_icon_empty(IBar_Icon *ic) +{ + evas_object_del(ic->o_icon); + evas_object_del(ic->o_icon2); + ic->o_icon = NULL; +} + +static void +_ibar_icon_signal_emit(IBar_Icon *ic, char *sig, char *src) +{ + edje_object_signal_emit(ic->o_holder, sig, src); + edje_object_signal_emit(ic->o_icon, sig, src); + edje_object_signal_emit(ic->o_holder2, sig, src); + edje_object_signal_emit(ic->o_icon2, sig, src); +} + +static void +_ibar_cb_app_change(void *data, E_App *a, E_App_Change ch) +{ + IBar *b; + + b = data; + switch (ch) + { + case E_APP_ADD: + printf("ADD! %3.4f\n", ecore_time_get()); + if (e_app_is_parent(b->apps, a)) + { + E_App *a2, *a_before = NULL; + IBar_Icon *ic2 = NULL, *ic; + Evas_List *l; + + ic = _ibar_icon_find(b, a); + if (!ic) + { + for (l = b->apps->subapps; l; l = l->next) + { + a2 = l->data; + if ((a2 == a) && (l->next)) + { + a_before = l->next->data; + break; + } + } + ic = _ibar_icon_new(b, a); + if (a_before) ic2 = _ibar_icon_find(b, a_before); + if (ic2) + { + b->icons = evas_list_prepend_relative(b->icons, ic, ic2); + e_box_pack_before(b->o_box, ic->o_holder, ic2->o_holder); + } + else + { + b->icons = evas_list_append(b->icons, ic); + e_box_pack_end(b->o_box, ic->o_holder); + } + _ibar_resize_handle(b); + _gc_orient(b->inst->gcc); + } + else + { + /* FIXME: complain */ + } + } + break; + case E_APP_DEL: + printf("DEL! %3.4f\n", ecore_time_get()); + if (e_app_is_parent(b->apps, a)) + { + IBar_Icon *ic; + + ic = _ibar_icon_find(b, a); + if (ic) + { + b->icons = evas_list_remove(b->icons, ic); + _ibar_icon_free(ic); + } + _ibar_resize_handle(b); + _gc_orient(b->inst->gcc); + } + break; + case E_APP_CHANGE: + printf("CHANGE! %3.4f\n", ecore_time_get()); + if (e_app_is_parent(b->apps, a)) + { + IBar_Icon *ic; + + ic = _ibar_icon_find(b, a); + if (ic) + { + _ibar_icon_empty(ic); + _ibar_icon_fill(ic); + } + _ibar_resize_handle(b); + _gc_orient(b->inst->gcc); + } + break; + case E_APP_ORDER: + printf("ORDER! %3.4f\n", ecore_time_get()); + if (a == b->apps) + { + _ibar_empty(b); + _ibar_fill(b); + _ibar_resize_handle(b); + _gc_orient(b->inst->gcc); + } + break; + case E_APP_EXEC: + if (e_app_is_parent(b->apps, a)) + { + IBar_Icon *ic; + + ic = _ibar_icon_find(b, a); + if (ic) + { + if (a->startup_notify) + _ibar_icon_signal_emit(ic, "start", ""); + else + _ibar_icon_signal_emit(ic, "exec", ""); + } + } + break; + case E_APP_READY: + case E_APP_READY_EXPIRE: + case E_APP_EXIT: + if (e_app_is_parent(b->apps, a)) + { + IBar_Icon *ic; + + ic = _ibar_icon_find(b, a); + if (ic) _ibar_icon_signal_emit(ic, "stop", ""); + } + break; + default: + break; + } +} + +static int +_ibar_cb_timer_drop_recalc(void *data) +{ + Instance *inst; + + inst = data; + _ibar_instance_drop_zone_recalc(inst); + return 1; +} + +static void +_ibar_cb_obj_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Instance *inst; + + inst = data; + _ibar_resize_handle(inst->ibar); + _ibar_instance_drop_zone_recalc(inst); +} + +static void +_ibar_cb_menu_icon_properties(void *data, E_Menu *m, E_Menu_Item *mi) { IBar_Icon *ic; - + ic = data; - evas_object_resize(o, w, h); - evas_object_resize(ic->event_object, w, h); - evas_object_resize(ic->overlay_object, w, h); + /* FIXME: - show eap editor on the ic->app */ } static void -_ibar_bar_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y) +_ibar_cb_menu_icon_remove(void *data, E_Menu *m, E_Menu_Item *mi) { - IBar_Bar *ibb; - - ibb = data; - evas_object_move(o, x, y); - evas_object_move(ibb->event_object, x, y); + IBar_Icon *ic; + + ic = data; + ic->ibar->icons = evas_list_remove(ic->ibar->icons, ic); + _ibar_resize_handle(ic->ibar); + _gc_orient(ic->ibar->inst->gcc); + e_app_remove(ic->app); + _ibar_icon_free(ic); } static void -_ibar_bar_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h) +_ibar_cb_menu_configuration(void *data, E_Menu *m, E_Menu_Item *mi) { - IBar_Bar *ibb; - - ibb = data; - - evas_object_resize(o, w, h); - evas_object_resize(ibb->event_object, w, h); + IBar_Icon *ic; + Config_Item *ci; + + ic = data; + ci = _ibar_config_item_get(ic->ibar->inst->gcc->id); + _config_ibar_module(ci); } static void -_ibar_icon_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_menu_post(void *data, E_Menu *m) +{ + if (!ibar_config->menu) return; + e_object_del(E_OBJECT(ibar_config->menu)); + ibar_config->menu = NULL; +} + +static void +_ibar_cb_icon_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_In *ev; IBar_Icon *ic; - + ev = event_info; ic = data; - evas_event_freeze(ic->ibb->evas); - evas_object_raise(ic->event_object); - if (ic->raise_on_hilight) - evas_object_stack_below(ic->bg_object, ic->event_object); - evas_object_stack_below(ic->overlay_object, ic->event_object); - evas_event_thaw(ic->ibb->evas); - edje_object_signal_emit(ic->bg_object, "active", ""); - edje_object_signal_emit(ic->overlay_object, "active", ""); - if (ic->ibb->overlay_object) - edje_object_signal_emit(ic->ibb->overlay_object, "active", ""); + _ibar_icon_signal_emit(ic, "active", ""); } static void -_ibar_icon_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_icon_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Out *ev; IBar_Icon *ic; - + ev = event_info; ic = data; - edje_object_signal_emit(ic->bg_object, "passive", ""); - edje_object_signal_emit(ic->overlay_object, "passive", ""); - if (ic->ibb->overlay_object) - edje_object_signal_emit(ic->ibb->overlay_object, "passive", ""); + _ibar_icon_signal_emit(ic, "passive", ""); } static void -_ibar_icon_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Down *ev; IBar_Icon *ic; - + ev = event_info; ic = data; if (ev->button == 1) { - drag_x = ev->output.x; - drag_y = ev->output.y; - drag_start = 1; - drag = 0; + ic->drag.x = ev->output.x; + ic->drag.y = ev->output.y; + ic->drag.start = 1; + ic->drag.dnd = 0; + } + else if ((ev->button == 3) && (!ibar_config->menu)) + { + E_Menu *mn; + E_Menu_Item *mi; + int cx, cy, cw, ch; + + mn = e_menu_new(); + e_menu_post_deactivate_callback_set(mn, _ibar_cb_menu_post, NULL); + ibar_config->menu = mn; + + /* FIXME: other icon options go here too */ + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Change Icon Properties")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/properties"); + e_menu_item_callback_set(mi, _ibar_cb_menu_icon_properties, ic); + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Remove Icon")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/delete"); + e_menu_item_callback_set(mi, _ibar_cb_menu_icon_remove, ic); + + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Configuration")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); + e_menu_item_callback_set(mi, _ibar_cb_menu_configuration, ic); + + e_gadcon_client_util_menu_items_append(ic->ibar->inst->gcc, mn, 0); + + e_gadcon_canvas_zone_geometry_get(ic->ibar->inst->gcc->gadcon, + &cx, &cy, &cw, &ch); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + evas_event_feed_mouse_up(ic->ibar->inst->gcc->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); } } static void -_ibar_icon_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Up *ev; IBar_Icon *ic; - + ev = event_info; ic = data; - if (ev->button == 1) + if ((ev->button == 1) && (!ic->drag.dnd)) { - if (!drag) - { - e_zone_app_exec(ic->ibb->gmc->zone, ic->app); - e_exehist_add("ibar", ic->app->exe); - } - drag = 0; - drag_start = 0; + e_zone_app_exec(ic->ibar->inst->gcc->gadcon->zone, ic->app); + e_exehist_add("ibar", ic->app->exe); + ic->drag.start = 0; + ic->drag.dnd = 0; } } static void -_ibar_icon_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Move *ev; IBar_Icon *ic; - + ev = event_info; ic = data; - - if (drag_start) + if (ic->drag.start) { int dx, dy; - dx = ev->cur.output.x - drag_x; - dy = ev->cur.output.y - drag_y; + dx = ev->cur.output.x - ic->drag.x; + dy = ev->cur.output.y - ic->drag.y; if (((dx * dx) + (dy * dy)) > (e_config->drag_resist * e_config->drag_resist)) { @@ -1280,298 +800,217 @@ _ibar_icon_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info Evas_Coord x, y, w, h; const char *drag_types[] = { "enlightenment/eapp" }; - drag = 1; - drag_start = 0; + ic->drag.dnd = 1; + ic->drag.start = 0; - evas_object_geometry_get(ic->icon_object, - &x, &y, &w, &h); - d = e_drag_new(ic->ibb->con, x, y, drag_types, 1, - ic->app, -1, _ibar_bar_cb_finished); + evas_object_geometry_get(ic->o_icon, &x, &y, &w, &h); + d = e_drag_new(ic->ibar->inst->gcc->gadcon->zone->container, + x, y, drag_types, 1, + ic->app, -1, _ibar_cb_drag_finished); o = edje_object_add(e_drag_evas_get(d)); edje_object_file_set(o, ic->app->path, "icon"); e_drag_object_set(d, o); e_drag_resize(d, w, h); - e_drag_start(d, drag_x, drag_y); - evas_event_feed_mouse_up(ic->ibb->evas, 1, EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_drag_start(d, ic->drag.x, ic->drag.y); + evas_event_feed_mouse_up(ic->ibar->inst->gcc->gadcon->evas, + 1, EVAS_BUTTON_NONE, + ecore_x_current_time_get(), NULL); + e_object_ref(E_OBJECT(ic->app)); + ic->ibar->icons = evas_list_remove(ic->ibar->icons, ic); + _ibar_resize_handle(ic->ibar); + _gc_orient(ic->ibar->inst->gcc); e_app_remove(ic->app); + _ibar_icon_free(ic); } } } static void -_ibar_bar_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_icon_move(void *data, Evas *e, Evas_Object *obj, void *event_info) { - Evas_Event_Mouse_In *ev; - IBar_Bar *ibb; - - ev = event_info; - ibb = data; - if (ibb->overlay_object) - edje_object_signal_emit(ibb->overlay_object, "active", ""); - _ibar_bar_motion_handle(ibb, ev->canvas.x, ev->canvas.y); - _ibar_bar_timer_handle(ibb); + IBar_Icon *ic; + Evas_Coord x, y; + + ic = data; + evas_object_geometry_get(ic->o_holder, &x, &y, NULL, NULL); + evas_object_move(ic->o_holder2, x, y); + evas_object_raise(ic->o_holder2); } static void -_ibar_bar_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_icon_resize(void *data, Evas *e, Evas_Object *obj, void *event_info) { - Evas_Event_Mouse_Out *ev; - IBar_Bar *ibb; - - ev = event_info; - ibb = data; - if (ibb->overlay_object) - edje_object_signal_emit(ibb->overlay_object, "passive", ""); - _ibar_bar_follower_reset(ibb); - _ibar_bar_timer_handle(ibb); + IBar_Icon *ic; + Evas_Coord w, h; + + ic = data; + evas_object_geometry_get(ic->o_holder, NULL, NULL, &w, &h); + evas_object_resize(ic->o_holder2, w, h); + evas_object_raise(ic->o_holder2); } static void -_ibar_bar_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_drag_finished(E_Drag *drag, int dropped) { - Evas_Event_Mouse_Down *ev; - IBar_Bar *ibb; - - ev = event_info; - ibb = data; - if (ev->button == 3) - { - e_menu_activate_mouse(ibb->menu, e_zone_current_get(ibb->con), - ev->output.x, ev->output.y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - e_util_container_fake_mouse_up_later(ibb->con, 3); - } + e_object_unref(E_OBJECT(drag->data)); } static void -_ibar_bar_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_drop_move(void *data, Evas *e, Evas_Object *obj, void *event_info) { - Evas_Event_Mouse_Up *ev; - IBar_Bar *ibb; - - ev = event_info; - ibb = data; + IBar *b; + Evas_Coord x, y; + + b = data; + evas_object_geometry_get(b->o_drop, &x, &y, NULL, NULL); + evas_object_move(b->o_drop_over, x, y); } static void -_ibar_bar_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) +_ibar_cb_drop_resize(void *data, Evas *e, Evas_Object *obj, void *event_info) { - Evas_Event_Mouse_Move *ev; - IBar_Bar *ibb; - - ev = event_info; - ibb = data; - _ibar_bar_motion_handle(ibb, ev->cur.canvas.x, ev->cur.canvas.y); - _ibar_bar_timer_handle(ibb); -} - -static int -_ibar_bar_cb_timer(void *data) -{ - IBar_Bar *ibb; - double dif, dif2; - double v; - - ibb = data; - v = ibb->ibar->conf->autoscroll_speed; - ibb->align = (ibb->align_req * (1.0 - v)) + (ibb->align * v); - v = ibb->ibar->conf->follow_speed; - ibb->follow = (ibb->follow_req * (1.0 - v)) + (ibb->follow * v); - - dif = ibb->align - ibb->align_req; - if (dif < 0) dif = -dif; - if (dif < 0.001) ibb->align = ibb->align_req; - - dif2 = ibb->follow - ibb->follow_req; - if (dif2 < 0) dif2 = -dif2; - if (dif2 < 0.001) ibb->follow = ibb->follow_req; - - if ((dif < 0.001) && (dif2 < 0.001)) - { - ibb->timer = NULL; - return 0; - } - return 1; -} - -static int -_ibar_bar_cb_animator(void *data) -{ - IBar_Bar *ibb; - Evas_Coord x, y, w, h, mw, mh; - - ibb = data; - - if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP)) - { - e_box_min_size_get(ibb->box_object, &mw, &mh); - evas_object_geometry_get(ibb->box_object, NULL, NULL, &w, &h); - if (mw > w) - e_box_align_set(ibb->box_object, ibb->align, 0.5); - else - e_box_align_set(ibb->box_object, 0.5, 0.5); - - if (ibb->overlay_object) - { - evas_object_geometry_get(ibb->box_object, &x, &y, &w, &h); - edje_object_size_min_get(ibb->overlay_object, &mw, &mh); - evas_object_resize(ibb->overlay_object, mw, h); - evas_object_move(ibb->overlay_object, x + (w * ibb->follow) - (mw / 2), y); - } - } - else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) || - (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT)) - { - e_box_min_size_get(ibb->box_object, &mw, &mh); - evas_object_geometry_get(ibb->box_object, NULL, NULL, &w, &h); - if (mh > h) - e_box_align_set(ibb->box_object, 0.5, ibb->align); - else - e_box_align_set(ibb->box_object, 0.5, 0.5); - - if (ibb->overlay_object) - { - evas_object_geometry_get(ibb->box_object, &x, &y, &w, &h); - edje_object_size_min_get(ibb->overlay_object, &mw, &mh); - evas_object_resize(ibb->overlay_object, w, mh); - evas_object_move(ibb->overlay_object, x, y + (h * ibb->follow) - (mh / 2)); - } - } - if (ibb->timer) return 1; - ibb->animator = NULL; - return 0; + IBar *b; + Evas_Coord w, h; + + b = data; + evas_object_geometry_get(b->o_drop, NULL, NULL, &w, &h); + evas_object_resize(b->o_drop_over, w, h); } static void -_ibar_bar_cb_enter(void *data, const char *type, void *event) +_ibar_inst_cb_enter(void *data, const char *type, void *event_info) { E_Event_Dnd_Enter *ev; + Instance *inst; Evas_Object *o, *o2; - IBar_Bar *ibb; IBar_Icon *ic; - int w, h; - - ev = event; - ibb = data; - - o = edje_object_add(ibb->evas); - ibb->drag_object = o; - o2 = edje_object_add(ibb->evas); - ibb->drag_object_overlay = o2; - evas_object_intercept_move_callback_add(o, _ibar_drag_cb_intercept_move, o2); - evas_object_intercept_resize_callback_add(o, _ibar_drag_cb_intercept_resize, o2); + int cx, cy, cw, ch; + + ev = event_info; + inst = data; + o = edje_object_add(evas_object_evas_get(inst->ibar->o_box)); + inst->ibar->o_drop = o; + o2 = edje_object_add(evas_object_evas_get(inst->ibar->o_box)); + inst->ibar->o_drop_over = o2; + evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _ibar_cb_drop_move, inst->ibar); + evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _ibar_cb_drop_resize, inst->ibar); e_theme_edje_object_set(o, "base/theme/modules/ibar", "modules/ibar/drop"); e_theme_edje_object_set(o2, "base/theme/modules/ibar", "modules/ibar/drop_overlay"); - edje_object_signal_emit(o, "set_orientation", - _ibar_main_orientation[e_gadman_client_edge_get(ibb->gmc)]); - edje_object_signal_emit(o2, "set_orientation", - _ibar_main_orientation[e_gadman_client_edge_get(ibb->gmc)]); - evas_object_resize(o, ibb->ibar->conf->iconsize, ibb->ibar->conf->iconsize); - - ic = _ibar_icon_pos_find(ibb, ev->x, ev->y); - - e_box_freeze(ibb->box_object); - evas_object_show(ibb->drag_object); - evas_object_show(ibb->drag_object_overlay); + evas_object_layer_set(o2, 19999); + evas_object_show(o); + evas_object_show(o2); + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + ic = _ibar_icon_at_coord(inst->ibar, ev->x - cx, ev->y - cy); + inst->ibar->ic_drop_before = ic; if (ic) { - /* Add new eapp before this icon */ - e_box_pack_before(ibb->box_object, ibb->drag_object, ic->bg_object); + Evas_Coord ix, iy, iw, ih; + int before = 0; + + evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); + if (e_box_orientation_get(inst->ibar->o_box)) + { + if ((ev->x - cx) < (ix + (iw / 2))) before = 1; + } + else + { + if ((ev->y - cy) < (iy + (ih / 2))) before = 1; + } + if (before) + e_box_pack_before(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder); + else + e_box_pack_after(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder); + inst->ibar->drop_before = before; } - else - { - /* Add at the end */ - e_box_pack_end(ibb->box_object, ibb->drag_object); - } - w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r; - h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b; - e_box_pack_options_set(ibb->drag_object, + else e_box_pack_end(inst->ibar->o_box, o); + e_box_pack_options_set(o, 1, 1, /* fill */ 0, 0, /* expand */ 0.5, 0.5, /* align */ - w, h, /* min */ - w, h /* max */ + 1, 1, /* min */ + -1, -1 /* max */ ); - e_box_thaw(ibb->box_object); - - _ibar_bar_frame_resize(ibb); + _ibar_resize_handle(inst->ibar); + _gc_orient(inst->gcc); } static void -_ibar_bar_cb_move(void *data, const char *type, void *event) +_ibar_inst_cb_move(void *data, const char *type, void *event_info) { E_Event_Dnd_Move *ev; - IBar_Bar *ibb; + Instance *inst; IBar_Icon *ic; - int w, h; - - ev = event; - ibb = data; - - ic = _ibar_icon_pos_find(ibb, ev->x, ev->y); - - e_box_freeze(ibb->box_object); - evas_object_show(ibb->drag_object); - e_box_unpack(ibb->drag_object); + int cx, cy, cw, ch; + + ev = event_info; + inst = data; + e_box_unpack(inst->ibar->o_drop); + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + ic = _ibar_icon_at_coord(inst->ibar, ev->x - cx, ev->y - cy); + inst->ibar->ic_drop_before = ic; if (ic) { - /* Add new eapp before this icon */ - e_box_pack_before(ibb->box_object, ibb->drag_object, ic->bg_object); + Evas_Coord ix, iy, iw, ih; + int before = 0; + + evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); + if (e_box_orientation_get(inst->ibar->o_box)) + { + if ((ev->x - cx) < (ix + (iw / 2))) before = 1; + } + else + { + if ((ev->y - cy) < (iy + (ih / 2))) before = 1; + } + if (before) + e_box_pack_before(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder); + else + e_box_pack_after(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder); + inst->ibar->drop_before = before; } - else - { - /* Add at the end */ - e_box_pack_end(ibb->box_object, ibb->drag_object); - } - w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r; - h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b; - e_box_pack_options_set(ibb->drag_object, + else e_box_pack_end(inst->ibar->o_box, inst->ibar->o_drop); + e_box_pack_options_set(inst->ibar->o_drop, 1, 1, /* fill */ 0, 0, /* expand */ 0.5, 0.5, /* align */ - w, h, /* min */ - w, h /* max */ + 1, 1, /* min */ + -1, -1 /* max */ ); - e_box_thaw(ibb->box_object); - - _ibar_bar_frame_resize(ibb); + _ibar_resize_handle(inst->ibar); + _gc_orient(inst->gcc); } static void -_ibar_bar_cb_leave(void *data, const char *type, void *event) +_ibar_inst_cb_leave(void *data, const char *type, void *event_info) { E_Event_Dnd_Leave *ev; - IBar_Bar *ibb; - - ev = event; - ibb = data; - - e_box_freeze(ibb->box_object); - e_box_unpack(ibb->drag_object); - evas_object_del(ibb->drag_object); - ibb->drag_object = NULL; - evas_object_del(ibb->drag_object_overlay); - ibb->drag_object_overlay = NULL; - e_box_thaw(ibb->box_object); - - _ibar_bar_frame_resize(ibb); + Instance *inst; + + ev = event_info; + inst = data; + inst->ibar->ic_drop_before = NULL; + evas_object_del(inst->ibar->o_drop); + inst->ibar->o_drop = NULL; + evas_object_del(inst->ibar->o_drop_over); + inst->ibar->o_drop_over = NULL; + _ibar_resize_handle(inst->ibar); + _gc_orient(inst->gcc); } static void -_ibar_bar_cb_drop(void *data, const char *type, void *event) +_ibar_inst_cb_drop(void *data, const char *type, void *event_info) { E_Event_Dnd_Drop *ev; + Instance *inst; E_App *app = NULL; Evas_List *l = NULL; - IBar_Bar *ibb; IBar_Icon *ic; - - ev = event; - ibb = data; + + ev = event_info; + inst = data; if (!strcmp(type, "enlightenment/eapp")) { app = ev->data; @@ -1599,15 +1038,6 @@ _ibar_bar_cb_drop(void *data, const char *type, void *event) { E_Dialog *dia; - e_box_freeze(ibb->box_object); - e_box_unpack(ibb->drag_object); - evas_object_del(ibb->drag_object); - ibb->drag_object = NULL; - evas_object_del(ibb->drag_object_overlay); - ibb->drag_object_overlay = NULL; - e_box_thaw(ibb->box_object); - _ibar_bar_frame_resize(ibb); - dia = e_dialog_new(e_container_current_get(e_manager_current_get())); e_dialog_title_set(dia, _("Cannot add icon")); e_dialog_text_set(dia, @@ -1627,24 +1057,26 @@ _ibar_bar_cb_drop(void *data, const char *type, void *event) { l = ev->data; } - - /* add dropped element */ - ic = _ibar_icon_pos_find(ibb, ev->x, ev->y); - - /* remove drag marker */ - e_box_freeze(ibb->box_object); - e_box_unpack(ibb->drag_object); - evas_object_del(ibb->drag_object); - ibb->drag_object = NULL; - evas_object_del(ibb->drag_object_overlay); - ibb->drag_object_overlay = NULL; - e_box_thaw(ibb->box_object); - - _ibar_bar_frame_resize(ibb); - + + ic = inst->ibar->ic_drop_before; if (ic) { /* Add new eapp before this icon */ + if (!inst->ibar->drop_before) + { + for (l = inst->ibar->icons; l; l = l->next) + { + if (l->data == ic) + { + if (l->next) + ic = l->next->data; + else + ic = NULL; + break; + } + } + } + if (!ic) goto atend; if (app) e_app_list_prepend_relative(app, ic->app); else if (l) @@ -1652,186 +1084,139 @@ _ibar_bar_cb_drop(void *data, const char *type, void *event) } else { - /* Add at the end */ + atend: if (app) - e_app_list_append(app, ibb->ibar->apps); + e_app_list_append(app, inst->ibar->apps); else if (l) - e_app_files_list_append(l, ibb->ibar->apps); + e_app_files_list_append(l, inst->ibar->apps); } + + evas_object_del(inst->ibar->o_drop); + inst->ibar->o_drop = NULL; + evas_object_del(inst->ibar->o_drop_over); + inst->ibar->o_drop_over = NULL; + _ibar_resize_handle(inst->ibar); + _gc_orient(inst->gcc); } -static void -_ibar_bar_cb_finished(E_Drag *drag, int dropped) +/***************************************************************************/ +/**/ +/* module setup */ +EAPI E_Module_Api e_modapi = { - /* Unref the object so it will be deleted. */ - if (!dropped) - e_object_unref(E_OBJECT(drag->data)); -} + E_MODULE_API_VERSION, + "IBar" +}; -static void -_ibar_bar_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) +EAPI void * +e_modapi_init(E_Module *module) { - IBar_Bar *ibb; - - ibb = data; - switch (change) + conf_item_edd = E_CONFIG_DD_NEW("IBar_Config_Item", Config_Item); +#undef T +#undef D +#define T Config_Item +#define D conf_item_edd + E_CONFIG_VAL(D, T, id, STR); + E_CONFIG_VAL(D, T, dir, STR); + + conf_edd = E_CONFIG_DD_NEW("IBar_Config", Config); +#undef T +#undef D +#define T Config +#define D conf_edd + E_CONFIG_LIST(D, T, items, conf_item_edd); + + ibar_config = e_config_domain_load("module.ibar", conf_edd); + + if (!ibar_config) { - case E_GADMAN_CHANGE_MOVE_RESIZE: - e_gadman_client_geometry_get(ibb->gmc, &ibb->x, &ibb->y, &ibb->w, &ibb->h); - - edje_extern_object_min_size_set(ibb->box_object, 0, 0); - edje_object_part_swallow(ibb->bar_object, "items", ibb->box_object); - - evas_object_move(ibb->bar_object, ibb->x, ibb->y); - evas_object_resize(ibb->bar_object, ibb->w, ibb->h); - - _ibar_bar_follower_reset(ibb); - _ibar_bar_timer_handle(ibb); - - e_drop_handler_geometry_set(ibb->drop_handler, - ibb->x + ibb->bar_inset.l, ibb->y + ibb->bar_inset.t, - ibb->w - (ibb->bar_inset.l + ibb->bar_inset.r), - ibb->h - (ibb->bar_inset.t + ibb->bar_inset.b)); - break; - case E_GADMAN_CHANGE_EDGE: - _ibar_bar_edge_change(ibb, e_gadman_client_edge_get(ibb->gmc)); - break; - case E_GADMAN_CHANGE_RAISE: - case E_GADMAN_CHANGE_ZONE: - /* FIXME - * Must we do something here? - */ - break; + Config_Item *ci; + + ibar_config = E_NEW(Config, 1); + + ci = E_NEW(Config_Item, 1); + ci->id = evas_stringshare_add("0"); + ci->dir = evas_stringshare_add("bar"); + + ibar_config->items = evas_list_append(ibar_config->items, ci); } + + e_gadcon_provider_register(&_gadcon_class); + return 1; } -void -_ibar_bar_cb_config_updated(void *data) -{ - /* Call Any Needed Funcs To Let Module Handle Config Changes */ - _ibar_bar_cb_follower(data); - _ibar_bar_cb_width_auto(data); - _ibar_bar_cb_iconsize_change(data); -} - -static void -_ibar_bar_cb_width_auto(void *data) +EAPI int +e_modapi_shutdown(E_Module *module) { - IBar *ib; - IBar_Bar *ibb; - Evas_List *l; - - ib = data; - for (l = ib->bars; l; l = l->next) + e_gadcon_provider_unregister(&_gadcon_class); + + if (ibar_config->config_dialog) + e_object_del(E_OBJECT(ibar_config->config_dialog)); + while (ibar_config->handlers) { - ibb = l->data; - _ibar_bar_update_policy(ibb); - _ibar_bar_frame_resize(ibb); + ecore_event_handler_del(ibar_config->handlers->data); + ibar_config->handlers = evas_list_remove_list(ibar_config->handlers, ibar_config->handlers); } -} - -static void -_ibar_bar_cb_follower(void *data) -{ - IBar *ib; - IBar_Bar *ibb; - unsigned char enabled; - Evas_List *l; - - ib = data; - enabled = ib->conf->follower; - if (enabled) + if (ibar_config->menu) e_object_del(E_OBJECT(ibar_config->menu)); + while (ibar_config->items) { - for (l = ib->bars; l; l = l->next) - { - Evas_Object *o; - - ibb = l->data; - if (ibb->overlay_object) continue; - o = edje_object_add(ibb->evas); - ibb->overlay_object = o; - evas_object_layer_set(o, 2); - e_theme_edje_object_set(o, "base/theme/modules/ibar", - "modules/ibar/follower"); - - edje_object_signal_emit(o, "set_orientation", _ibar_main_orientation[e_gadman_client_edge_get(ibb->gmc)]); - edje_object_message_signal_process(o); - - evas_object_show(o); - } + Config_Item *ci; + + ci = ibar_config->items->data; + ibar_config->items = evas_list_remove_list(ibar_config->items, ibar_config->items); + if (ci->id) evas_stringshare_del(ci->id); + if (ci->dir) evas_stringshare_del(ci->dir); + free(ci); } - else if (!enabled) + free(ibar_config); + ibar_config = NULL; + E_CONFIG_DD_FREE(conf_item_edd); + E_CONFIG_DD_FREE(conf_edd); + return 1; +} + +EAPI int +e_modapi_save(E_Module *module) +{ + Evas_List *l, *l2; + + for (l = ibar_config->instances; l; l = l->next) { - for (l = ib->bars; l; l = l->next) - { - ibb = l->data; - if (!ibb->overlay_object) continue; - evas_object_del(ibb->overlay_object); - ibb->overlay_object = NULL; - } + Instance *inst; + int found; + Config_Item *ci; + + inst = l->data; + found = 0; + ci = _ibar_config_item_get(inst->gcc->id); + if (ci->dir) evas_stringshare_del(ci->dir); + /* FIXME: path should be recorded from setup */ + ci->dir = evas_stringshare_add(inst->dir); } + e_config_domain_save("module.ibar", conf_edd, ibar_config); + return 1; } -static void -_ibar_bar_cb_iconsize_change(void *data) +EAPI int +e_modapi_info(E_Module *module) { - IBar *ib; - Evas_List *l, *ll; - - ib = data; - for (l = ib->bars; l; l = l->next) - { - IBar_Bar *ibb; - - ibb = l->data; - - e_box_freeze(ibb->box_object); - for (ll = ibb->icons; ll; ll = ll->next) - { - IBar_Icon *ic; - Evas_Object *o; - Evas_Coord w, h; - - ic = ll->data; - o = ic->icon_object; - - evas_object_resize(o, ibb->ibar->conf->iconsize, ibb->ibar->conf->iconsize); - edje_object_part_swallow(ic->bg_object, "item", o); - - w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r; - h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b; - e_box_pack_options_set(ic->bg_object, - 1, 1, /* fill */ - 0, 0, /* expand */ - 0.5, 0.5, /* align */ - w, h, /* min */ - w, h /* max */ - ); - } - e_box_thaw(ibb->box_object); - _ibar_bar_frame_resize(ibb); - } + char buf[4096]; + + snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(module)); + module->icon_file = strdup(buf); + return 1; } -static void -_ibar_bar_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) +EAPI int +e_modapi_about(E_Module *module) { - IBar_Bar *ibb; - - ibb = data; - e_gadman_mode_set(ibb->gmc->gadman, E_GADMAN_MODE_EDIT); + e_module_dialog_show(_("Enlightenment IBar Module"), + _("This is the IBar Application Launcher bar module for Enlightenment.
" + "It is a first example module and is being used to flesh out several
" + "interfaces in Enlightenment 0.17.0. It is under heavy development,
" + "so expect it to break often and change as it improves.")); + return 1; } -static void -_ibar_drag_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y) -{ - evas_object_move(o, x, y); - evas_object_move(data, x, y); -} - -static void -_ibar_drag_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h) -{ - evas_object_resize(o, w, h); - evas_object_resize(data, w, h); -} +/**/ +/***************************************************************************/ diff --git a/src/modules/ibar/e_mod_main.h b/src/modules/ibar/e_mod_main.h index c3b7943aa..6837ea8f2 100644 --- a/src/modules/ibar/e_mod_main.h +++ b/src/modules/ibar/e_mod_main.h @@ -5,87 +5,23 @@ #define E_MOD_MAIN_H typedef struct _Config Config; -typedef struct _Config_Bar Config_Bar; -typedef struct _IBar IBar; -typedef struct _IBar_Bar IBar_Bar; -typedef struct _IBar_Icon IBar_Icon; - -#define IBAR_WIDTH_AUTO -1 -#define IBAR_WIDTH_FIXED -2 +typedef struct _Config_Item Config_Item; struct _Config { - const char *appdir; - int follower; - double follow_speed; - double autoscroll_speed; - int iconsize; - int width; - Evas_List *bars; + /* saved * loaded config values */ + Evas_List *items; + /* just config state */ + E_Config_Dialog *config_dialog; + Evas_List *instances; + E_Menu *menu; + Evas_List *handlers; }; -struct _Config_Bar +struct _Config_Item { - unsigned char enabled; -}; - -struct _IBar -{ - E_App *apps; - Evas_List *bars; - E_Menu *config_menu; - - Config *conf; - E_Config_Dialog *config_dialog; -}; - -struct _IBar_Bar -{ - IBar *ibar; - E_Container *con; - Evas *evas; - E_Menu *menu; - - Evas_Object *bar_object; - Evas_Object *overlay_object; - Evas_Object *box_object; - Evas_Object *event_object; - Evas_Object *drag_object; - Evas_Object *drag_object_overlay; - - Evas_List *icons; - - double align, align_req; - double follow, follow_req; - Ecore_Timer *timer; - Ecore_Animator *animator; - - Evas_Coord x, y, w, h; - struct { - Evas_Coord l, r, t, b; - } bar_inset; - struct { - Evas_Coord l, r, t, b; - } icon_inset; - - E_Gadman_Client *gmc; - - Config_Bar *conf; - - E_Drop_Handler *drop_handler; -}; - -struct _IBar_Icon -{ - IBar_Bar *ibb; - E_App *app; - Evas_Object *bg_object; - Evas_Object *overlay_object; - Evas_Object *icon_object; - Evas_Object *event_object; - Evas_List *extra_icons; - - unsigned char raise_on_hilight : 1; + char *id; + char *dir; }; EAPI extern E_Module_Api e_modapi; @@ -95,8 +31,9 @@ EAPI int e_modapi_shutdown (E_Module *m); EAPI int e_modapi_save (E_Module *m); EAPI int e_modapi_info (E_Module *m); EAPI int e_modapi_about (E_Module *m); -/* EAPI int e_modapi_config (E_Module *m); */ -void _ibar_bar_cb_config_updated(void *data); +void _ibar_config_update(void); +void _config_ibar_module(Config_Item *ci); +extern Config *ibar_config; #endif diff --git a/src/modules/pager/Makefile.am b/src/modules/pager/Makefile.am index db9b53528..369b2a075 100644 --- a/src/modules/pager/Makefile.am +++ b/src/modules/pager/Makefile.am @@ -20,8 +20,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH pkg_LTLIBRARIES = module.la module_la_SOURCES = e_mod_main.c \ e_mod_main.h \ - e_mod_config.c \ - e_mod_config.h + e_mod_config.c module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/src/modules/pager/e_mod_config.c b/src/modules/pager/e_mod_config.c index 236b2b011..d75ab0d17 100644 --- a/src/modules/pager/e_mod_config.c +++ b/src/modules/pager/e_mod_config.c @@ -1,12 +1,8 @@ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" -#include "config.h" struct _E_Config_Dialog_Data { - int show_name; - int name_pos; int show_popup; double popup_speed; int drag_resist; @@ -21,7 +17,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); void -_config_pager_module(E_Container *con, Pager *pager) +_config_pager_module(Config_Item *ci) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -35,49 +31,36 @@ _config_pager_module(E_Container *con, Pager *pager) v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.create_widgets = _advanced_create_widgets; - cfd = e_config_dialog_new(con, _("Pager Configuration"), NULL, 0, v, pager); - pager->config_dialog = cfd; + cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()), + _("Pager Configuration"), NULL, 0, v, ci); + pager_config->config_dialog = cfd; } static void -_fill_data(Pager *p, E_Config_Dialog_Data *cfdata) +_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata) { - /* Name Pos, Show Popup, popup_speed */ - cfdata->name_pos = p->conf->deskname_pos; - if (cfdata->name_pos == PAGER_DESKNAME_NONE) - { - cfdata->show_name = 0; - cfdata->name_pos = PAGER_DESKNAME_TOP; - } - else - { - cfdata->show_name = 1; - } - - cfdata->show_popup = p->conf->popup; - cfdata->popup_speed = p->conf->popup_speed; - cfdata->drag_resist = p->conf->drag_resist; + /* FIXME: configure zone config item */ + cfdata->show_popup = pager_config->popup; + cfdata->popup_speed = pager_config->popup_speed; + cfdata->drag_resist = pager_config->drag_resist; } static void * _create_data(E_Config_Dialog *cfd) { E_Config_Dialog_Data *cfdata; - Pager *p; + Config_Item *ci; - p = cfd->data; + ci = cfd->data; cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(p, cfdata); + _fill_data(ci, cfdata); return cfdata; } static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Pager *p; - - p = cfd->data; - p->config_dialog = NULL; + pager_config->config_dialog = NULL; free(cfdata); } @@ -91,43 +74,17 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf of = e_widget_framelist_add(evas, _("General Settings"), 0); ob = e_widget_check_add(evas, _("Show Popup"), &(cfdata->show_popup)); e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Show Desktop Name"), &(cfdata->show_name)); - e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - of = e_widget_framelist_add(evas, _("Desktop Name Position"), 0); - rg = e_widget_radio_group_new(&(cfdata->name_pos)); - ob = e_widget_radio_add(evas, _("Top"), PAGER_DESKNAME_TOP, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("Bottom"), PAGER_DESKNAME_BOTTOM, rg); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - /* Not Supported Yet ?? - ob = e_widget_radio_add(evas, _("Left"), PAGER_DESKNAME_LEFT, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("Right"), PAGER_DESKNAME_RIGHT, rg); - e_widget_framelist_object_append(of, ob); - */ - return o; } static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Pager *p; - - p = cfd->data; - p->conf->popup = cfdata->show_popup; - - p->conf->deskname_pos = cfdata->name_pos; - if (!cfdata->show_name) - p->conf->deskname_pos = PAGER_DESKNAME_NONE; - + pager_config->popup = cfdata->show_popup; + _pager_cb_config_updated(); e_config_save_queue(); - - _pager_cb_config_updated(p); return 1; } @@ -138,33 +95,14 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data E_Radio_Group *rg; o = e_widget_list_add(evas, 0, 0); - of = e_widget_framelist_add(evas, _("General Settings"), 0); - ob = e_widget_check_add(evas, _("Show Popup"), &(cfdata->show_popup)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Show Desktop Name"), &(cfdata->show_name)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Resistance to Dragging Windows:")); - e_widget_framelist_object_append(of, ob); + of = e_widget_framelist_add(evas, _("Resistance to Dragging Windows:"), 0); ob = e_widget_slider_add(evas, 1, 0, _("%.0f px"), 0.0, 10.0, 1.0, 0, NULL, &(cfdata->drag_resist), 200); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - of = e_widget_framelist_add(evas, _("Desktop Name Position"), 0); - rg = e_widget_radio_group_new(&(cfdata->name_pos)); - ob = e_widget_radio_add(evas, _("Top"), PAGER_DESKNAME_TOP, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("Bottom"), PAGER_DESKNAME_BOTTOM, rg); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - /* Not Supported Yet ?? - ob = e_widget_radio_add(evas, _("Left"), PAGER_DESKNAME_LEFT, rg); - e_widget_framelist_object_append(of, ob); - ob = e_widget_radio_add(evas, _("Right"), PAGER_DESKNAME_RIGHT, rg); - e_widget_framelist_object_append(of, ob); - */ - of = e_widget_framelist_add(evas, _("Popup Settings"), 0); + ob = e_widget_check_add(evas, _("Show Popup"), &(cfdata->show_popup)); + e_widget_framelist_object_append(of, ob); ob = e_widget_label_add(evas, _("Popup Speed")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.1, 10.0, 0.1, 0, &(cfdata->popup_speed), NULL, 200); @@ -177,21 +115,10 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Pager *p; - - p = cfd->data; - e_border_button_bindings_ungrab_all(); - p->conf->popup = cfdata->show_popup; - - p->conf->deskname_pos = cfdata->name_pos; - if (!cfdata->show_name) - p->conf->deskname_pos = PAGER_DESKNAME_NONE; - p->conf->popup_speed = cfdata->popup_speed; - p->conf->drag_resist = cfdata->drag_resist; - - e_border_button_bindings_grab_all(); + pager_config->popup = cfdata->show_popup; + pager_config->popup_speed = cfdata->popup_speed; + pager_config->drag_resist = cfdata->drag_resist; + _pager_cb_config_updated(); e_config_save_queue(); - - _pager_cb_config_updated(p); return 1; } diff --git a/src/modules/pager/e_mod_config.h b/src/modules/pager/e_mod_config.h deleted file mode 100644 index 05648c975..000000000 --- a/src/modules/pager/e_mod_config.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifdef E_TYPEDEFS -#else -#ifndef E_MOD_CONFIG_H -#define E_MOD_CONFIG_H -#include "e_mod_main.h" -void _config_pager_module(E_Container *con, Pager *pager); -#endif -#endif diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index db0245ec7..569dad791 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -3,142 +3,1760 @@ */ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" -/* TODO - * which options should be in main menu, and which in face menu? - * check if a new desk is in the current zone - * check if padding changes on resize - * include deskname in padding - */ +/***************************************************************************/ +/**/ +/* gadcon requirements */ +static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient(E_Gadcon_Client *gcc); +/* and actually define the gadcon class that this module provides (just 1) */ +static const E_Gadcon_Client_Class _gadcon_class = +{ + GADCON_CLIENT_CLASS_VERSION, + "pager", + { + _gc_init, _gc_shutdown, _gc_orient + } +}; +/**/ +/***************************************************************************/ -/* module private routines */ -static Pager *_pager_new(void); -static void _pager_free(Pager *pager); -static void _pager_config_menu_new(Pager *pager); +/***************************************************************************/ +/**/ +/* actual module specifics */ -static Pager_Face *_pager_face_new(Pager *pager, E_Zone *zone, Evas *evas, int use_gmc); -static void _pager_face_free(Pager_Face *face); -static void _pager_face_menu_new(Pager_Face *face); -static void _pager_face_disable(Pager_Face *face); -static void _pager_face_zone_set(Pager_Face *face, E_Zone *zone); -static void _pager_face_zone_unset(Pager_Face *face); +typedef struct _Instance Instance; -static Pager_Desk *_pager_desk_new(Pager_Face *face, E_Desk *desk, int x, int y); -static void _pager_desk_free(Pager_Desk *pd); +typedef struct _Pager Pager; +typedef struct _Pager_Desk Pager_Desk; +typedef struct _Pager_Win Pager_Win; +typedef struct _Pager_Popup Pager_Popup; -static Pager_Win *_pager_window_new(Pager_Desk *pd, E_Border *border); -static void _pager_window_free(Pager_Win *pw); -static void _pager_window_move(Pager_Face *face, Pager_Win *pw); +struct _Instance +{ + E_Gadcon_Client *gcc; + Evas_Object *o_pager; // table + Pager *pager; + E_Drop_Handler *drop_handler; + Ecore_Timer *drop_recalc_timer; +}; -static Pager_Win *_pager_face_border_find(Pager_Face *face, E_Border *border); -static Pager_Win *_pager_desk_border_find(Pager_Desk *pd, E_Border *border); -static Pager_Desk *_pager_face_desk_find(Pager_Face *face, E_Desk *desk); -static Pager_Desk *_pager_face_desk_at_coord(Pager_Face *face, Evas_Coord x, Evas_Coord y); -static void _pager_face_desk_select(Pager_Desk *pd); -static void _pager_popup_free(Pager_Popup *pp); +struct _Pager +{ + Instance *inst; + Evas_Object *o_table; + E_Zone *zone; + int xnum, ynum; + Evas_List *desks; + Pager_Popup *popup; + E_Drag *drag; + unsigned char dragging : 1; + unsigned char just_dragged : 1; +}; -static int _pager_cb_event_border_resize(void *data, int type, void *event); -static int _pager_cb_event_border_move(void *data, int type, void *event); -static int _pager_cb_event_border_add(void *data, int type, void *event); -static int _pager_cb_event_border_remove(void *data, int type, void *event); -static int _pager_cb_event_border_iconify(void *data, int type, void *event); -static int _pager_cb_event_border_uniconify(void *data, int type, void *event); -static int _pager_cb_event_border_stick(void *data, int type, void *event); -static int _pager_cb_event_border_unstick(void *data, int type, void *event); -static int _pager_cb_event_border_desk_set(void *data, int type, void *event); -static int _pager_cb_event_border_stack(void *data, int type, void *event); -static int _pager_cb_event_border_icon_change(void *data, int type, void *event); -static int _pager_cb_event_zone_desk_count_set(void *data, int type, void *event); -static int _pager_cb_event_desk_show(void *data, int type, void *event); -static int _pager_cb_event_desk_name_change(void *data, int type, void *event); +struct _Pager_Desk +{ + Pager *pager; + E_Desk *desk; + Evas_List *wins; + Evas_Object *o_desk; + Evas_Object *o_layout; + int xpos, ypos; + int current : 1; +}; -static void _pager_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _pager_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); +struct _Pager_Win +{ + E_Border *border; + Pager_Desk *desk; + Evas_Object *o_window; + Evas_Object *o_icon; + struct { + Pager *from_pager; + unsigned char start : 1; + unsigned char in_pager : 1; + unsigned char no_place : 1; + int x, y; + int dx, dy; + int button; + } drag; +}; -static void _pager_desk_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_desk_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_desk_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_desk_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_desk_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info); +struct _Pager_Popup +{ + E_Popup *popup; + Pager *pager, *src_pager; + Evas_Object *o_bg; + Ecore_Timer *timer; +}; -static void _pager_desk_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y); -static void _pager_desk_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); +static int _pager_cb_timer_drop_recalc(void *data); +static void _pager_cb_obj_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _menu_cb_post(void *data, E_Menu *m); +static void _pager_inst_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); +static void _pager_instance_drop_zone_recalc(Instance *inst); +static int _pager_cb_event_border_resize(void *data, int type, void *event); +static int _pager_cb_event_border_move(void *data, int type, void *event); +static int _pager_cb_event_border_add(void *data, int type, void *event); +static int _pager_cb_event_border_remove(void *data, int type, void *event); +static int _pager_cb_event_border_iconify(void *data, int type, void *event); +static int _pager_cb_event_border_uniconify(void *data, int type, void *event); +static int _pager_cb_event_border_stick(void *data, int type, void *event); +static int _pager_cb_event_border_unstick(void *data, int type, void *event); +static int _pager_cb_event_border_desk_set(void *data, int type, void *event); +static int _pager_cb_event_border_stack(void *data, int type, void *event); +static int _pager_cb_event_border_icon_change(void *data, int type, void *event); +static int _pager_cb_event_zone_desk_count_set(void *data, int type, void *event); +static int _pager_cb_event_desk_show(void *data, int type, void *event); +static int _pager_cb_event_desk_name_change(void *data, int type, void *event); +static void _pager_window_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _pager_window_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _pager_window_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _pager_window_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _pager_window_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _pager_window_cb_drag_finished(E_Drag *drag, int dropped); +static void _pager_inst_cb_enter(void *data, const char *type, void *event_info); +static void _pager_inst_cb_move(void *data, const char *type, void *event_info); +static void _pager_inst_cb_leave(void *data, const char *type, void *event_info); +static void _pager_inst_cb_drop(void *data, const char *type, void *event_info); +static void _pager_desk_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _pager_desk_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _pager_desk_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info); +static int _pager_popup_cb_timeout(void *data); +static Pager *_pager_new(Evas *evas, E_Zone *zone); +static void _pager_free(Pager *p); +static void _pager_fill(Pager *p); +static void _pager_empty(Pager *p); +static Pager_Desk *_pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos); +static void _pager_desk_free(Pager_Desk *pd); +static Pager_Desk *_pager_desk_at_coord(Pager *p, Evas_Coord x, Evas_Coord y); +static void _pager_desk_select(Pager_Desk *pd); +static Pager_Desk *_pager_desk_find(Pager *p, E_Desk *desk); +static Pager_Win *_pager_window_new(Pager_Desk *pd, E_Border *border); +static void _pager_window_free(Pager_Win *pw); +static void _pager_window_move(Pager_Win *pw); +static Pager_Win *_pager_window_find(Pager *p, E_Border *border); +static Pager_Win *_pager_desk_window_find(Pager_Desk *pd, E_Border *border); +static Pager_Popup *_pager_popup_new(Pager *p); +static void _pager_popup_free(Pager_Popup *pp); -static void _pager_window_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_window_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_window_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_window_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _pager_window_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static E_Config_DD *conf_edd = NULL; -static void _pager_window_cb_drag_finished(E_Drag *drag, int dropped); +Config *pager_config = NULL; -static void _pager_face_cb_enter(void *data, const char *type, void *drop); -static void _pager_face_cb_move(void *data, const char *type, void *drop); -static void _pager_face_cb_leave(void *data, const char *type, void *drop); -static void _pager_face_cb_drop(void *data, const char *type, void *drop); +static E_Gadcon_Client * +_gc_init(E_Gadcon *gc, char *name, char *id, char *style) +{ + Pager *p; + Evas_Object *o; + E_Gadcon_Client *gcc; + Instance *inst; + Evas_Coord x, y, w, h; + int cx, cy, cw, ch; + const char *drop[] = { "enlightenment/border", "enlightenment/pager_win" }; + + inst = E_NEW(Instance, 1); + + p = _pager_new(gc->evas, gc->zone); + p->inst = inst; + inst->pager = p; + o = p->o_table; + gcc = e_gadcon_client_new(gc, name, id, style, o); + gcc->data = inst; + + inst->gcc = gcc; + inst->o_pager = o; -static void _pager_face_deskname_position_change(Pager_Face *face); -static int _pager_popup_cb_timeout(void *data); + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + evas_object_geometry_get(o, &x, &y, &w, &h); + inst->drop_handler = + e_drop_handler_add(inst, + _pager_inst_cb_enter, _pager_inst_cb_move, + _pager_inst_cb_leave, _pager_inst_cb_drop, + drop, 2, cx + x, cy + y, w, h); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, + _pager_cb_obj_moveresize, inst); + evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, + _pager_cb_obj_moveresize, inst); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _button_cb_mouse_down, inst); + pager_config->instances = evas_list_append(pager_config->instances, inst); + /* FIXME: HACK!!!! */ + inst->drop_recalc_timer = ecore_timer_add(1.0, _pager_cb_timer_drop_recalc, + inst); + return gcc; +} -static void _pager_menu_cb_aspect_keep_height(void *data, E_Menu *m, E_Menu_Item *mi); -static void _pager_menu_cb_aspect_keep_width(void *data, E_Menu *m, E_Menu_Item *mi); -static void _pager_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi); +static void +_gc_shutdown(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + ecore_timer_del(inst->drop_recalc_timer); + pager_config->instances = evas_list_remove(pager_config->instances, inst); + e_drop_handler_del(inst->drop_handler); + _pager_free(inst->pager); + free(inst); +} -static int _pager_count; +static void +_gc_orient(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + e_gadcon_client_aspect_set(gcc, + inst->pager->xnum * inst->pager->zone->w, + inst->pager->ynum * inst->pager->zone->h); + e_gadcon_client_min_size_set(gcc, 16, 16); +} +/**/ +/***************************************************************************/ -static E_Config_DD *_conf_edd; -static E_Config_DD *_conf_face_edd; +/***************************************************************************/ +/**/ +static Pager * +_pager_new(Evas *evas, E_Zone *zone) +{ + Pager *p; + + p = E_NEW(Pager, 1); + p->o_table = e_table_add(evas); + e_table_homogenous_set(p->o_table, 1); + p->zone = zone; + _pager_fill(p); + return p; +} -/* public module routines. all modules must have these */ +static void +_pager_free(Pager *p) +{ + if (p->drag) e_object_del(E_OBJECT(p->drag)); + _pager_empty(p); + evas_object_del(p->o_table); + free(p); +} + +static void +_pager_fill(Pager *p) +{ + int x, y; + + e_zone_desk_count_get(p->zone, &(p->xnum), &(p->ynum)); + for (x = 0; x < p->xnum; x++) + { + for (y = 0; y < p->ynum; y++) + { + Pager_Desk *pd; + E_Desk *desk; + + desk = e_desk_at_xy_get(p->zone, x, y); + pd = _pager_desk_new(p, desk, x, y); + if (pd) + { + p->desks = evas_list_append(p->desks, pd); + if (desk == e_desk_current_get(desk->zone)) + _pager_desk_select(pd); + } + } + } +} + +static void +_pager_empty(Pager *p) +{ + if (p->popup) + { + _pager_popup_free(p->popup); + p->popup = NULL; + } + while (p->desks) + { + _pager_desk_free(p->desks->data); + p->desks = evas_list_remove_list(p->desks, p->desks); + } +} + +static Pager_Desk * +_pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos) +{ + Pager_Desk *pd; + Evas_Object *o; + E_Border_List *bl; + E_Border *bd; + + pd = E_NEW(Pager_Desk, 1); + if (!pd) return NULL; + + pd->xpos = xpos; + pd->ypos = ypos; + + pd->desk = desk; + e_object_ref(E_OBJECT(desk)); + pd->pager = p; + + o = edje_object_add(evas_object_evas_get(p->o_table)); + pd->o_desk = o; + e_theme_edje_object_set(o, "base/theme/modules/pager", + "modules/pager/desk"); + edje_object_part_text_set(o, "label", desk->name); + e_table_pack(p->o_table, o, xpos, ypos, 1, 1); + e_table_pack_options_set(o, 1, 1, 1, 1, 0.5, 0.5, 0, 0, -1, -1); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _pager_desk_cb_mouse_down, pd); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _pager_desk_cb_mouse_up, pd); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _pager_desk_cb_mouse_move, pd); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _pager_desk_cb_mouse_wheel, pd); + evas_object_show(o); + + o = e_layout_add(evas_object_evas_get(p->o_table)); + pd->o_layout = o; + + e_layout_virtual_size_set(o, desk->zone->w, desk->zone->h); + edje_object_part_swallow(pd->o_desk, "items", pd->o_layout); + evas_object_show(o); + + bl = e_container_border_list_first(desk->zone->container); + while ((bd = e_container_border_list_next(bl))) + { + Pager_Win *pw; + + if ((bd->new_client) || ((bd->desk != desk) && (!bd->sticky))) continue; + pw = _pager_window_new(pd, bd); + if (pw) pd->wins = evas_list_append(pd->wins, pw); + } + e_container_border_list_free(bl); + return pd; +} + +static void +_pager_desk_free(Pager_Desk *pd) +{ + Evas_List *l; + + evas_object_del(pd->o_desk); + evas_object_del(pd->o_layout); + for (l = pd->wins; l; l = l->next) _pager_window_free(l->data); + evas_list_free(pd->wins); + e_object_unref(E_OBJECT(pd->desk)); + free(pd); +} + +static Pager_Desk * +_pager_desk_at_coord(Pager *p, Evas_Coord x, Evas_Coord y) +{ + Evas_List *l; + + for (l = p->desks; l; l = l->next) + { + Pager_Desk *pd; + Evas_Coord dx, dy, dw, dh; + + pd = l->data; + evas_object_geometry_get(pd->o_desk, &dx, &dy, &dw, &dh); + if (E_INSIDE(x, y, dx, dy, dw, dh)) return pd; + } + return NULL; +} + +static void +_pager_desk_select(Pager_Desk *pd) +{ + Evas_List *l; + + if (pd->current) return; + for (l = pd->pager->desks; l; l = l->next) + { + Pager_Desk *pd2; + + pd2 = l->data; + if (pd == pd2) + { + pd2->current = 1; + edje_object_signal_emit(pd2->o_desk, "active", ""); + } + else + { + if (pd2->current) + { + pd2->current = 0; + edje_object_signal_emit(pd2->o_desk, "passive", ""); + } + } + } +} + +static Pager_Desk * +_pager_desk_find(Pager *p, E_Desk *desk) +{ + Evas_List *l; + + for (l = p->desks; l; l = l->next) + { + Pager_Desk *pd; + + pd = l->data; + if (pd->desk == desk) return pd; + } + return NULL; +} + +static Pager_Win * +_pager_window_new(Pager_Desk *pd, E_Border *border) +{ + Pager_Win *pw; + Evas_Object *o; + int visible; + + if ((!border) || (border->client.netwm.state.skip_pager)) return NULL; + pw = E_NEW(Pager_Win, 1); + if (!pw) return NULL; + + pw->border = border; + e_object_ref(E_OBJECT(border)); + + visible = !border->iconic; + pw->desk = pd; + + o = edje_object_add(evas_object_evas_get(pd->pager->o_table)); + pw->o_window = o; + e_theme_edje_object_set(o, "base/theme/modules/pager", + "modules/pager/window"); + if (visible) evas_object_show(o); + + e_layout_pack(pd->o_layout, pw->o_window); + e_layout_child_raise(pw->o_window); + + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _pager_window_cb_mouse_in, pw); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _pager_window_cb_mouse_out, pw); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _pager_window_cb_mouse_down, pw); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _pager_window_cb_mouse_up, pw); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _pager_window_cb_mouse_move, pw); + + o = e_border_icon_add(border, evas_object_evas_get(pd->pager->o_table)); + if (o) + { + pw->o_icon = o; + evas_object_show(o); + edje_object_part_swallow(pw->o_window, "icon", o); + } + + evas_object_show(o); + + _pager_window_move(pw); + return pw; +} + +static void +_pager_window_free(Pager_Win *pw) +{ + if ((pw->drag.from_pager) && (pw->desk->pager->dragging)) + { + if (pw->desk->pager->drag) + e_object_del(E_OBJECT(pw->desk->pager->drag)); + pw->desk->pager->drag = NULL; + pw->desk->pager->dragging = 0; + } + if (pw->o_window) evas_object_del(pw->o_window); + if (pw->o_icon) evas_object_del(pw->o_icon); + e_object_unref(E_OBJECT(pw->border)); + free(pw); +} + +static void +_pager_window_move(Pager_Win *pw) +{ + e_layout_child_move(pw->o_window, + pw->border->x - pw->desk->desk->zone->x, + pw->border->y - pw->desk->desk->zone->y); + e_layout_child_resize(pw->o_window, + pw->border->w, + pw->border->h); +} + +static Pager_Win * +_pager_window_find(Pager *p, E_Border *border) +{ + Evas_List *l; + + for (l = p->desks; l; l = l->next) + { + Pager_Desk *pd; + Pager_Win *pw; + + pd = l->data; + pw = _pager_desk_window_find(pd, border); + if (pw) return pw; + } + return NULL; +} + +static Pager_Win * +_pager_desk_window_find(Pager_Desk *pd, E_Border *border) +{ + Evas_List *l; + + for (l = pd->wins; l; l = l->next) + { + Pager_Win *pw; + + pw = l->data; + if (pw->border == border) return pw; + } + return NULL; +} + +static Pager_Popup * +_pager_popup_new(Pager *p) +{ + Pager_Popup *pp; + Evas_Coord w, h; + E_Desk *desk; + + pp = E_NEW(Pager_Popup, 1); + if (!pp) return NULL; + + /* Show popup */ + pp->popup = e_popup_new(p->zone, 0, 0, 1, 1); + if (!pp->popup) + { + free(pp); + return NULL; + } + e_popup_layer_set(pp->popup, 999); + pp->src_pager = p; + + p->popup = pp; + + evas_object_geometry_get(p->o_table, NULL, NULL, &w, &h); + + pp->pager = _pager_new(pp->popup->evas, p->zone); + evas_object_move(pp->pager->o_table, 0, 0); + evas_object_resize(pp->pager->o_table, w, h); + + pp->o_bg = edje_object_add(pp->popup->evas); + e_theme_edje_object_set(pp->o_bg, + "base/theme/modules/pager", + "widgets/pager/popup"); + desk = e_desk_current_get(p->zone); + if (desk) + edje_object_part_text_set(pp->o_bg, "text", desk->name); + evas_object_show(pp->o_bg); + edje_extern_object_min_size_set(pp->pager->o_table, w, h); + edje_object_part_swallow(pp->o_bg, "pager", pp->pager->o_table); + edje_object_size_min_calc(pp->o_bg, &w, &h); + + evas_object_move(pp->o_bg, 0, 0); + evas_object_resize(pp->o_bg, w, h); + e_popup_edje_bg_object_set(pp->popup, pp->o_bg); + e_popup_ignore_events_set(pp->popup, 1); + e_popup_move_resize(pp->popup, ((p->zone->w - w) / 2), + ((p->zone->h - h) / 2), w, h); + e_bindings_mouse_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); + e_bindings_wheel_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); + e_popup_show(pp->popup); + + pp->timer = ecore_timer_add(pager_config->popup_speed, + _pager_popup_cb_timeout, pp); +} + +static void +_pager_popup_free(Pager_Popup *pp) +{ + pp->src_pager->popup = NULL; + if (pp->timer) ecore_timer_del(pp->timer); + evas_object_del(pp->o_bg); + _pager_free(pp->pager); + e_bindings_mouse_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); + e_bindings_wheel_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); + e_object_del(E_OBJECT(pp->popup)); + free(pp); +} + +static int +_pager_cb_timer_drop_recalc(void *data) +{ + Instance *inst; + + inst = data; + _pager_instance_drop_zone_recalc(inst); + return 1; +} + +static void +_pager_cb_obj_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Instance *inst; + + inst = data; + _pager_instance_drop_zone_recalc(inst); +} + +static void +_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Instance *inst; + Evas_Event_Mouse_Down *ev; + + inst = data; + ev = event_info; + if ((ev->button == 3) && (!pager_config->menu)) + { + E_Menu *mn; + E_Menu_Item *mi; + int cx, cy, cw, ch; + + mn = e_menu_new(); + e_menu_post_deactivate_callback_set(mn, _menu_cb_post, inst); + pager_config->menu = mn; + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Configuration")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); + e_menu_item_callback_set(mi, _pager_inst_cb_menu_configure, NULL); + + e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0); + + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, + &cx, &cy, &cw, &ch); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); + } +} + +static void +_menu_cb_post(void *data, E_Menu *m) +{ + if (!pager_config->menu) return; + e_object_del(E_OBJECT(pager_config->menu)); + pager_config->menu = NULL; +} + +static void +_pager_inst_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi) +{ + if (!pager_config) return; + if (pager_config->config_dialog) return; + /* FIXME: pass zone config item */ + _config_pager_module(NULL); +} + +static void +_pager_instance_drop_zone_recalc(Instance *inst) +{ + Evas_Coord x, y, w, h; + int cx, cy, cw, ch; + + evas_object_geometry_get(inst->o_pager, &x, &y, &w, &h); + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + e_drop_handler_geometry_set(inst->drop_handler, cx + x, cy + y, w, h); +} + +void +_pager_cb_config_updated(void) +{ + if (!pager_config) return; +} + +static int +_pager_cb_event_border_resize(void *data, int type, void *event) +{ + E_Event_Border_Resize *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + Pager_Win *pw; + + pd = l2->data; + pw = _pager_desk_window_find(pd, ev->border); + if (pw) _pager_window_move(pw); + } + } + return 1; +} + +static int +_pager_cb_event_border_move(void *data, int type, void *event) +{ + E_Event_Border_Move *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + Pager_Win *pw; + + pd = l2->data; + pw = _pager_desk_window_find(pd, ev->border); + if (pw) _pager_window_move(pw); + } + } + return 1; +} + +static int +_pager_cb_event_border_add(void *data, int type, void *event) +{ + E_Event_Border_Add *ev; + Evas_List *l; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + Pager_Desk *pd; + + inst = l->data; + if ((inst->pager->zone != ev->border->zone) || + (_pager_window_find(inst->pager, ev->border))) + continue; + pd = _pager_desk_find(inst->pager, ev->border->desk); + if (pd) + { + Pager_Win *pw; + + pw = _pager_window_new(pd, ev->border); + if (pw) pd->wins = evas_list_append(pd->wins, pw); + } + } + return 1; +} + +static int +_pager_cb_event_border_remove(void *data, int type, void *event) +{ + E_Event_Border_Remove *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + Pager_Win *pw; + + pd = l2->data; + pw = _pager_desk_window_find(pd, ev->border); + if (pw) + { + pd->wins = evas_list_remove(pd->wins, pw); + _pager_window_free(pw); + } + } + } + return 1; +} + +static int +_pager_cb_event_border_iconify(void *data, int type, void *event) +{ + E_Event_Border_Hide *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + Pager_Win *pw; + + pd = l2->data; + pw = _pager_desk_window_find(pd, ev->border); + if (pw) + { + if ((pw->drag.from_pager) && (pw->desk->pager->dragging)) + { + if (pw->desk->pager->drag) + e_object_del(E_OBJECT(pw->desk->pager->drag)); + pw->desk->pager->drag = NULL; + pw->desk->pager->dragging = 0; + } + evas_object_hide(pw->o_window); + } + } + } + return 1; +} + +static int +_pager_cb_event_border_uniconify(void *data, int type, void *event) +{ + E_Event_Border_Show *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + Pager_Win *pw; + + pd = l2->data; + pw = _pager_desk_window_find(pd, ev->border); + if (pw) evas_object_show(pw->o_window); + } + } + return 1; +} + +static int +_pager_cb_event_border_stick(void *data, int type, void *event) +{ + E_Event_Border_Stick *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + Pager_Win *pw; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + pw = _pager_window_find(inst->pager, ev->border); + if (!pw) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + + pd = l2->data; + if (ev->border->desk != pd->desk) + { + pw = _pager_window_new(pd, ev->border); + if (pw) pd->wins = evas_list_append(pd->wins, pw); + } + } + } + return 1; +} + +static int +_pager_cb_event_border_unstick(void *data, int type, void *event) +{ + E_Event_Border_Unstick *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + + pd = l2->data; + if (ev->border->desk != pd->desk) + { + Pager_Win *pw; + + pw = _pager_desk_window_find(pd, ev->border); + if (pw) + { + pd->wins = evas_list_remove(pd->wins, pw); + _pager_window_free(pw); + } + } + } + } + return 1; +} + +static int +_pager_cb_event_border_desk_set(void *data, int type, void *event) +{ + E_Event_Border_Desk_Set *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + Pager_Win *pw; + Pager_Desk *pd; + + inst = l->data; + /* if this pager is not for the zone of the border */ + if (inst->pager->zone != ev->border->zone) + { + /* look at all desks in the pager */ + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + pd = l2->data; + /* find this border in this desk */ + pw = _pager_desk_window_find(pd, ev->border); + if (pw) + { + /* if it is found - remove it. it does not belong in this + * pager as it probably moves zones */ + pd->wins = evas_list_remove(pd->wins, pw); + _pager_window_free(pw); + } + } + continue; + } + /* and this pager zone is for this border */ + /* see if the window is in this pager at all */ + pw = _pager_window_find(inst->pager, ev->border); + if (pw) + { + /* is it sticky */ + if (ev->border->sticky) + { + /* if its sticky and in this pager - its already everywhere, so abort + * doing anything else */ + continue; + } + /* move it to the right desk */ + /* find the pager desk of the target desk */ + pd = _pager_desk_find(inst->pager, ev->border->desk); + if (pd) + { + Pager_Win *pw2 = NULL; + E_Border *bd; + + /* remove it from whatever desk it was on */ + pw->desk->wins = evas_list_remove(pw->desk->wins, pw); + e_layout_unpack(pw->o_window); + + /* add it to the one its MEANT to be on */ + pw->desk = pd; + pd->wins = evas_list_append(pd->wins, pw); + e_layout_pack(pd->o_layout, pw->o_window); + + bd = e_util_desk_border_above(pw->border); + if (bd) + pw2 = _pager_desk_window_find(pd, bd); + if (pw2) + e_layout_child_lower_below(pw->o_window, pw2->o_window); + else + e_layout_child_raise(pw->o_window); + + _pager_window_move(pw); + } + } + /* the border isnt in this pager at all - it must have moved zones */ + else + { + if (!ev->border->sticky) + { + /* find the pager desk it needs to go to */ + pd = _pager_desk_find(inst->pager, ev->border->desk); + if (pd) + { + /* create it and add it */ + pw = _pager_window_new(pd, ev->border); + if (pw) + { + Pager_Win *pw2 = NULL; + E_Border *bd; + + pd->wins = evas_list_append(pd->wins, pw); + bd = e_util_desk_border_above(pw->border); + if (bd) + pw2 = _pager_desk_window_find(pd, bd); + if (pw2) + e_layout_child_lower_below(pw->o_window, pw2->o_window); + else + e_layout_child_raise(pw->o_window); + + _pager_window_move(pw); + } + } + } + else + { + /* go through all desks */ + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + pd = l2->data; + /* create it and add it */ + pw = _pager_window_new(pd, ev->border); + if (pw) + { + Pager_Win *pw2 = NULL; + E_Border *bd; + + pd->wins = evas_list_append(pd->wins, pw); + bd = e_util_desk_border_above(pw->border); + if (bd) + pw2 = _pager_desk_window_find(pd, bd); + if (pw2) + e_layout_child_lower_below(pw->o_window, pw2->o_window); + else + e_layout_child_raise(pw->o_window); + + _pager_window_move(pw); + } + } + } + } + } + return 1; +} + +static int +_pager_cb_event_border_stack(void *data, int type, void *event) +{ + E_Event_Border_Stack *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + Pager_Win *pw, *pw2 = NULL; + + pd = l2->data; + pw = _pager_desk_window_find(pd, ev->border); + if (pw) + { + if (ev->stack) + { + pw2 = _pager_desk_window_find(pd, ev->stack); + if (!pw2) + { + /* This border is on another desk... */ + E_Border *bd = NULL; + + if (ev->type == E_STACKING_ABOVE) + bd = e_util_desk_border_below(ev->border); + else if (ev->type == E_STACKING_BELOW) + bd = e_util_desk_border_above(ev->border); + if (bd) pw2 = _pager_desk_window_find(pd, bd); + } + } + if (ev->type == E_STACKING_ABOVE) + { + if (pw2) + e_layout_child_raise_above(pw->o_window, pw2->o_window); + else + /* If we aren't above any window, we are at the bottom */ + e_layout_child_lower(pw->o_window); + } + else if (ev->type == E_STACKING_BELOW) + { + if (pw2) + e_layout_child_lower_below(pw->o_window, pw2->o_window); + else + /* If we aren't below any window, we are at the top */ + e_layout_child_raise(pw->o_window); + } + } + } + } + return 1; +} + +static int +_pager_cb_event_border_icon_change(void *data, int type, void *event) +{ + E_Event_Border_Icon_Change *ev; + Evas_List *l, *l2; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (inst->pager->zone != ev->border->zone) continue; + for (l2 = inst->pager->desks; l2; l2 = l2->next) + { + Pager_Desk *pd; + Pager_Win *pw; + + pd = l2->data; + pw = _pager_desk_window_find(pd, ev->border); + if (pw) + { + Evas_Object *o; + + if (pw->o_icon) + { + evas_object_del(pw->o_icon); + pw->o_icon = NULL; + } + o = e_border_icon_add + (ev->border, evas_object_evas_get(inst->pager->o_table)); + if (o) + { + pw->o_icon = o; + evas_object_show(o); + edje_object_part_swallow(pw->o_window, "icon", o); + } + } + } + } + return 1; +} + +static int +_pager_cb_event_zone_desk_count_set(void *data, int type, void *event) +{ + Evas_List *l; + Instance *inst; + + for (l = pager_config->instances; l; l = l->next) + { + inst = l->data; + _pager_empty(inst->pager); + _pager_fill(inst->pager); + _gc_orient(inst->gcc); + } + return 1; +} + +static int +_pager_cb_event_desk_show(void *data, int type, void *event) +{ + E_Event_Desk_Show *ev; + Evas_List *l; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + Pager_Desk *pd; + + inst = l->data; + if (inst->pager->zone != ev->desk->zone) continue; + + pd = _pager_desk_find(inst->pager, ev->desk); + if (pd) + { + _pager_desk_select(pd); + if (pd->pager->popup) _pager_popup_free(pd->pager->popup); + if (pager_config->popup) + { + Pager_Popup *pp; + + pp = _pager_popup_new(pd->pager); + } + } + } + return 1; +} + +static int +_pager_cb_event_desk_name_change(void *data, int type, void *event) +{ + E_Event_Desk_Name_Change *ev; + Evas_List *l; + + ev = event; + for (l = pager_config->instances; l; l = l->next) + { + Instance *inst; + Pager_Desk *pd; + + inst = l->data; + if (inst->pager->zone != ev->desk->zone) continue; + pd = _pager_desk_find(inst->pager, ev->desk); + if (pd) + edje_object_part_text_set(pd->o_desk, "label", ev->desk->name); + } + return 1; +} + +static void +_pager_window_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_In *ev; + Pager_Win *pw; + + ev = event_info; + pw = data; + /* FIXME: display window title in some tooltip thing */ +} + +static void +_pager_window_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Out *ev; + Pager_Win *pw; + + ev = event_info; + pw = data; + /* FIXME: close tooltip */ +} + +static void +_pager_window_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *ev; + Pager_Win *pw; + + ev = event_info; + pw = data; + if (!pw) return; + /* FIXME: make this configurable */ + if ((ev->button == 1) || (ev->button == 2)) + { + Evas_Coord ox, oy; + + evas_object_geometry_get(pw->o_window, &ox, &oy, NULL, NULL); + pw->drag.in_pager = 1; + pw->drag.x = ev->canvas.x; + pw->drag.y = ev->canvas.y; + pw->drag.dx = ox - ev->canvas.x; + pw->drag.dy = oy - ev->canvas.y; + pw->drag.start = 1; + pw->drag.no_place = 0; + pw->drag.button = ev->button; + if (ev->button == 2) pw->drag.no_place = 1; + } +} + +static void +_pager_window_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev; + Pager_Win *pw; + + ev = event_info; + pw = data; + if (!pw) return; + /* FIXME: make this configurable as above */ + if ((ev->button == 1) || (ev->button == 2)) + { + if (!pw->drag.from_pager) + { + if (!pw->drag.start) pw->desk->pager->just_dragged = 1; + pw->drag.in_pager = 0; + pw->drag.start = 0; + pw->desk->pager->dragging = 0; + } + } +} + +static void +_pager_window_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Move *ev; + Pager_Win *pw; + + ev = event_info; + pw = data; + if (!pw) return; + /* prevent drag for a few pixels */ + if (pw->drag.start) + { + Evas_Coord dx, dy; + unsigned int resist = 0; + + dx = pw->drag.x - ev->cur.output.x; + dy = pw->drag.y - ev->cur.output.y; + if (pw->desk && pw->desk->pager && pw->desk->pager->inst) + resist = pager_config->drag_resist; + + if (((dx * dx) + (dy * dy)) <= (resist * resist)) return; + + pw->desk->pager->dragging = 1; + pw->drag.start = 0; + } + + /* dragging this win around inside the pager */ + if (pw->drag.in_pager) + { + Evas_Coord mx, my, vx, vy; + Pager_Desk *pd; + + /* m for mouse */ + mx = ev->cur.canvas.x; + my = ev->cur.canvas.y; + + /* find desk at pointer */ + pd = _pager_desk_at_coord(pw->desk->pager, mx, my); + if ((pd) && (!pw->drag.no_place)) + { + e_layout_coord_canvas_to_virtual(pd->o_layout, + mx + pw->drag.dx, + my + pw->drag.dy, &vx, &vy); + if (pd != pw->desk) + e_border_desk_set(pw->border, pd->desk); + e_border_move(pw->border, + vx + pd->desk->zone->x, + vy + pd->desk->zone->y); + } + else + { + E_Drag *drag; + Evas_Object *o, *oo; + Evas_Coord x, y, w, h; + const char *file = NULL, *part = NULL; + const char *drag_types[] = { "enlightenment/pager_win" }; + + evas_object_geometry_get(pw->o_window, &x, &y, &w, &h); + evas_object_hide(pw->o_window); + + drag = e_drag_new(pw->desk->pager->inst->gcc->gadcon->zone->container, + x, y, drag_types, 1, pw, -1, + _pager_window_cb_drag_finished); + pw->desk->pager->drag = drag; + + o = edje_object_add(drag->evas); + edje_object_file_get(pw->o_window, &file, &part); + edje_object_file_set(o, file, part); + + oo = o; + o = edje_object_add(drag->evas); + edje_object_file_get(pw->o_icon, &file, &part); + edje_object_file_set(o, file, part); + edje_object_part_swallow(oo, "icon", o); + e_drag_object_set(drag, oo); + e_drag_resize(drag, w, h); + e_drag_start(drag, x - pw->drag.dx, y - pw->drag.dy); + + /* this prevents the desk from switching on drags */ + pw->drag.from_pager = pw->desk->pager; + pw->drag.from_pager->dragging = 1; + pw->drag.in_pager = 0; + evas_event_feed_mouse_up(evas_object_evas_get(pw->desk->pager->o_table), + pw->drag.button, EVAS_BUTTON_NONE, + ecore_x_current_time_get(), NULL); + } + } +} + +static void +_pager_window_cb_drag_finished(E_Drag *drag, int dropped) +{ + Pager_Win *pw; + + pw = drag->data; + if (!pw) return; + evas_object_show(pw->o_window); + pw->desk->pager->drag = NULL; + if (!dropped) + { + /* wasn't dropped (on pager). move it to position of mouse on screen */ + int x, y, dx, dy; + E_Container *cont; + E_Zone *zone; + E_Desk *desk; + + cont = e_container_current_get(e_manager_current_get()); + zone = e_zone_current_get(cont); + desk = e_desk_current_get(zone); + + e_border_zone_set(pw->border, zone); + e_border_desk_set(pw->border, desk); + + ecore_x_pointer_last_xy_get(&x, &y); + + dx = (pw->border->w / 2); + dy = (pw->border->h / 2); + + /* offset so that center of window is on mouse, but keep within desk bounds */ + if (dx < x) + { + x -= dx; + if ((pw->border->w < zone->w) && + (x + pw->border->w > zone->x + zone->w)) + x -= x + pw->border->w - (zone->x + zone->w); + } + else x = 0; + + if (dy < y) + { + y -= dy; + if ((pw->border->h < zone->h) && + (y + pw->border->h > zone->y + zone->h)) + y -= y + pw->border->h - (zone->y + zone->h); + } + else y = 0; + e_border_move(pw->border, x, y); + } + if (pw && pw->drag.from_pager) pw->drag.from_pager->dragging = 0; + pw->drag.from_pager = NULL; + pw->drag.in_pager = 0; + pw->drag.start = 0; +} + +static void +_pager_inst_cb_enter(void *data, const char *type, void *event_info) +{ + E_Event_Dnd_Enter *ev; + Instance *inst; + + ev = event_info; + inst = data; +} + +static void +_pager_inst_cb_move(void *data, const char *type, void *event_info) +{ + E_Event_Dnd_Move *ev; + Instance *inst; + Pager_Desk *pd, *pd2; + Evas_List *l; + int cx, cy, cw, ch; + + ev = event_info; + inst = data; + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + pd = _pager_desk_at_coord(inst->pager, ev->x - cx, ev->y - cy); + /* FIXME: keep track which one its over so we only emit drag in/out + * when it actually goes form one desk to another */ + for (l = inst->pager->desks; l; l = l->next) + { + pd2 = l->data; + if (pd == pd2) + edje_object_signal_emit(pd2->o_desk, "drag", "in"); + else + edje_object_signal_emit(pd2->o_desk, "drag", "out"); + } +} + +static void +_pager_inst_cb_leave(void *data, const char *type, void *event_info) +{ + E_Event_Dnd_Leave *ev; + Instance *inst; + Evas_List *l; + + ev = event_info; + inst = data; + /* FIXME: keep track which one its over so we only emit drag in/out + * when it actually goes form one desk to another */ + for (l = inst->pager->desks; l; l = l->next) + { + Pager_Desk *pd; + + pd = l->data; + edje_object_signal_emit(pd->o_desk, "drag", "out"); + } +} + +static void +_pager_inst_cb_drop(void *data, const char *type, void *event_info) +{ + E_Event_Dnd_Drop *ev; + Instance *inst; + Pager_Desk *pd; + E_Border *bd = NULL; + Evas_List *l; + int dx = 0, dy = 0; + int cx, cy, cw, ch; + Pager_Win *pw = NULL; + + ev = event_info; + inst = data; + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + pd = _pager_desk_at_coord(inst->pager, ev->x - cx, ev->y - cy); + if (pd) + { + if (!strcmp(type, "enlightenment/pager_win")) + { + pw = (Pager_Win *)(ev->data); + if (pw) + { + bd = pw->border; + dx = pw->drag.dx; + dy = pw->drag.dy; + } + } + else if (!strcmp(type, "enlightenment/border")) + { + Evas_Coord wx, wy, wx2, wy2; + + bd = ev->data; + e_layout_coord_virtual_to_canvas(pd->o_layout, bd->x, bd->y, &wx, &wy); + e_layout_coord_virtual_to_canvas(pd->o_layout, bd->x + bd->w, bd->y + bd->h, &wx2, &wy2); + dx = (wx - wx2) / 2; + dy = (wy - wy2) / 2; + } + else + return; + + if (bd) + { + Evas_Coord nx, ny; + + e_border_desk_set(bd, pd->desk); + if ((!pw) || ((pw) && (!pw->drag.no_place))) + { + e_layout_coord_canvas_to_virtual(pd->o_layout, + ev->x - cx + dx, ev->y - cy + dy, + &nx, &ny); + e_border_move(bd, nx + pd->desk->zone->x, ny + pd->desk->zone->y); + } + } + } + /* FIXME: keep track which one its over so we only emit drag in/out + * when it actually goes form one desk to another */ + for (l = inst->pager->desks; l; l = l->next) + { + pd = l->data; + edje_object_signal_emit(pd->o_desk, "drag", "out"); + } +} + +static void +_pager_desk_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *ev; + Pager_Desk *pd; + + ev = event_info; + pd = data; + if (ev->button == 1) + { + } +} + +static void +_pager_desk_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev; + Pager_Desk *pd; + + ev = event_info; + pd = data; + /* FIXME: pd->pager->dragging is 0 when finishing a drag from desk to desk */ + if ((ev->button == 1) && (!pd->pager->dragging) && + (!pd->pager->just_dragged)) + { + e_desk_show(pd->desk); + } + pd->pager->just_dragged = 0; +} + +static void +_pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Move *ev; + Pager_Desk *pd; + + ev = event_info; + pd = data; +} + +static void +_pager_desk_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Wheel *ev; + Pager_Desk *pd; + Evas_List *l; + + ev = event_info; + pd = data; + for (l = pd->pager->desks; l; l = l->next) + { + Pager_Desk *pd; + + pd = l->data; + if (pd->current) + { + /* Mouse wheel up, scroll back through desks */ + if (ev->z < 0) + { + if (l->prev) + { + pd = l->prev->data; + e_desk_show(pd->desk); + } + else + { + /* We've looped around, go to the last desk. Not sure if there's a better way. */ + Evas_List *l2; + + l2 =evas_list_last(pd->pager->desks); + if (l2) + { + pd = l2->data; + e_desk_show(pd->desk); + } + } + } + /* Mouse wheel down, scroll forward through desks */ + else if (ev->z > 0) + { + if (l->next) + { + pd = l->next->data; + e_desk_show(pd->desk); + } + else + { + /* We've looped around, start back at the first desk */ + pd = pd->pager->desks->data; + e_desk_show(pd->desk); + } + } + break; + } + } +} + +static int +_pager_popup_cb_timeout(void *data) +{ + Pager_Popup *pp; + + pp = data; + _pager_popup_free(pp); + return 0; +} + +/***************************************************************************/ +/**/ +/* module setup */ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, - "Pager" + "Pager" }; EAPI void * e_modapi_init(E_Module *module) { - Pager *pager = NULL; + conf_edd = E_CONFIG_DD_NEW("Pager_Config", Config); +#undef T +#undef D +#define T Config +#define D conf_edd + E_CONFIG_VAL(D, T, popup_speed, DOUBLE); + E_CONFIG_VAL(D, T, popup, UINT); + E_CONFIG_VAL(D, T, drag_resist, UINT); + E_CONFIG_VAL(D, T, scale, UCHAR); + E_CONFIG_VAL(D, T, resize, UCHAR); - /* actually init pager */ - pager = _pager_new(); - module->config_menu = pager->config_menu; + pager_config = e_config_domain_load("module.pager", conf_edd); - return pager; + if (!pager_config) + { + pager_config = E_NEW(Config, 1); + pager_config->popup_speed = 1.0; + pager_config->popup = 1; + pager_config->drag_resist = 3; + pager_config->scale = 1; + pager_config->resize = PAGER_RESIZE_BOTH; + } + E_CONFIG_LIMIT(pager_config->popup_speed, 0.1, 10.0); + E_CONFIG_LIMIT(pager_config->popup, 0, 1); + E_CONFIG_LIMIT(pager_config->drag_resist, 0, 50); + E_CONFIG_LIMIT(pager_config->scale, 0, 1); + E_CONFIG_LIMIT(pager_config->resize, PAGER_RESIZE_HORZ, PAGER_RESIZE_BOTH); + + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_RESIZE, _pager_cb_event_border_resize, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_MOVE, _pager_cb_event_border_move, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_ADD, _pager_cb_event_border_add, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_REMOVE, _pager_cb_event_border_remove, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_ICONIFY, _pager_cb_event_border_iconify, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_UNICONIFY, _pager_cb_event_border_uniconify, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_STICK, _pager_cb_event_border_stick, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_UNSTICK, _pager_cb_event_border_unstick, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_DESK_SET, _pager_cb_event_border_desk_set, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_STACK, _pager_cb_event_border_stack, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_BORDER_ICON_CHANGE, _pager_cb_event_border_icon_change, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_ZONE_DESK_COUNT_SET, _pager_cb_event_zone_desk_count_set, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_DESK_SHOW, _pager_cb_event_desk_show, NULL)); + pager_config->handlers = evas_list_append + (pager_config->handlers, ecore_event_handler_add + (E_EVENT_DESK_NAME_CHANGE, _pager_cb_event_desk_name_change, NULL)); + + e_gadcon_provider_register(&_gadcon_class); + return 1; } EAPI int e_modapi_shutdown(E_Module *module) { - Pager *pager; - - if (module->config_menu) - module->config_menu = NULL; - - pager = module->data; - if (pager) + e_gadcon_provider_unregister(&_gadcon_class); + + if (pager_config->config_dialog) + e_object_del(E_OBJECT(pager_config->config_dialog)); + while (pager_config->handlers) { - if (pager->config_dialog) - { - e_object_del(E_OBJECT(pager->config_dialog)); - pager->config_dialog = NULL; - } - _pager_free(pager); + ecore_event_handler_del(pager_config->handlers->data); + pager_config->handlers = evas_list_remove_list(pager_config->handlers, pager_config->handlers); } + + if (pager_config->menu) e_object_del(E_OBJECT(pager_config->menu)); + free(pager_config); + pager_config = NULL; + E_CONFIG_DD_FREE(conf_edd); return 1; } EAPI int e_modapi_save(E_Module *module) { - Pager *pager; - - pager = module->data; - e_config_domain_save("module.pager", _conf_edd, pager->conf); - + e_config_domain_save("module.pager", conf_edd, pager_config); return 1; } @@ -160,2113 +1778,5 @@ e_modapi_about(E_Module *module) return 1; } -EAPI int -e_modapi_config(E_Module *m) -{ - Pager *e; - Evas_List *l; - E_Zone *zone; - E_Container *con; - - e = m->data; - if (!e) return 0; - if (!e->faces) return 0; - con = e_container_current_get(e_manager_current_get()); - zone = e_zone_current_get(con); - for (l = e->faces; l; l = l->next) - { - Pager_Face *face; - face = l->data; - if (!face) return 0; - if (face->zone == zone) - { - _config_pager_module(con, e); - break; - } - } - return 1; -} - -/* module private routines */ -static Pager * -_pager_new(void) -{ - Pager *pager; - Pager_Face *face; - - Evas_List *managers, *l, *l2, *l3, *cl; - E_Manager *man; - E_Container *con; - E_Zone *zone; - E_Menu *mn; - E_Menu_Item *mi; - - _pager_count = 0; - - pager = E_NEW(Pager, 1); - if (!pager) return NULL; - - _conf_face_edd = E_CONFIG_DD_NEW("Pager_Config_Face", Config_Face); -#undef T -#undef D -#define T Config_Face -#define D _conf_face_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); - E_CONFIG_VAL(D, T, scale, UCHAR); - E_CONFIG_VAL(D, T, resize, UCHAR); - - _conf_edd = E_CONFIG_DD_NEW("Pager_Config", Config); -#undef T -#undef D -#define T Config -#define D _conf_edd - E_CONFIG_LIST(D, T, faces, _conf_face_edd); - E_CONFIG_VAL(D, T, deskname_pos, UINT); - E_CONFIG_VAL(D, T, popup_speed, DOUBLE); - E_CONFIG_VAL(D, T, popup, UINT); - E_CONFIG_VAL(D, T, drag_resist, UINT); - - pager->conf = e_config_domain_load("module.pager", _conf_edd); - - if (!pager->conf) - { - pager->conf = E_NEW(Config, 1); - pager->conf->deskname_pos = PAGER_DESKNAME_NONE; - pager->conf->popup_speed = 1.0; - pager->conf->popup = 1; - pager->conf->drag_resist = 3; - } - E_CONFIG_LIMIT(pager->conf->deskname_pos, PAGER_DESKNAME_NONE, PAGER_DESKNAME_RIGHT); - E_CONFIG_LIMIT(pager->conf->popup_speed, 0.1, 10.0); - E_CONFIG_LIMIT(pager->conf->popup, 0, 1); - - _pager_config_menu_new(pager); - - managers = e_manager_list(); - cl = pager->conf->faces; - for (l = managers; l; l = l->next) - { - man = l->data; - - for (l2 = man->containers; l2; l2 = l2->next) - { - con = l2->data; - - mi = e_menu_item_new(pager->config_menu); - e_menu_item_label_set(mi, con->name); - - mn = e_menu_new(); - e_menu_item_submenu_set(mi, mn); - pager->menus = evas_list_append(pager->menus, mn); - - for (l3 = con->zones; l3; l3 = l3->next) - { - zone = l3->data; - - face = _pager_face_new(pager, zone, zone->container->bg_evas, - 1); - if (face) - { - pager->faces = evas_list_append(pager->faces, face); - - /* Config */ - if (!cl) - { - face->conf = E_NEW(Config_Face, 1); - face->conf->enabled = 1; - face->conf->resize = PAGER_RESIZE_BOTH; - face->conf->scale = 1; - pager->conf->faces = evas_list_append(pager->conf->faces, face->conf); - } - else - { - face->conf = cl->data; - cl = cl->next; - } - - /* Menu */ - /* This menu must be initialized after conf */ - _pager_face_menu_new(face); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, zone->name); - e_menu_item_submenu_set(mi, face->menu); - - /* Setup */ - if (!face->conf->enabled) - _pager_face_disable(face); - } - } - } - } - - /* set up event handles for when windows change and desktops */ - pager->ev_handler_border_resize = - ecore_event_handler_add(E_EVENT_BORDER_RESIZE, - _pager_cb_event_border_resize, pager); - pager->ev_handler_border_move = - ecore_event_handler_add(E_EVENT_BORDER_MOVE, - _pager_cb_event_border_move, pager); - pager->ev_handler_border_add = - ecore_event_handler_add(E_EVENT_BORDER_ADD, - _pager_cb_event_border_add, pager); - pager->ev_handler_border_remove = - ecore_event_handler_add(E_EVENT_BORDER_REMOVE, - _pager_cb_event_border_remove, pager); - pager->ev_handler_border_iconify = - ecore_event_handler_add(E_EVENT_BORDER_ICONIFY, - _pager_cb_event_border_iconify, pager); - pager->ev_handler_border_uniconify = - ecore_event_handler_add(E_EVENT_BORDER_UNICONIFY, - _pager_cb_event_border_uniconify, pager); - pager->ev_handler_border_stick = - ecore_event_handler_add(E_EVENT_BORDER_STICK, - _pager_cb_event_border_stick, pager); - pager->ev_handler_border_unstick = - ecore_event_handler_add(E_EVENT_BORDER_UNSTICK, - _pager_cb_event_border_unstick, pager); - pager->ev_handler_border_desk_set = - ecore_event_handler_add(E_EVENT_BORDER_DESK_SET, - _pager_cb_event_border_desk_set, pager); - pager->ev_handler_border_stack = - ecore_event_handler_add(E_EVENT_BORDER_STACK, - _pager_cb_event_border_stack, pager); - pager->ev_handler_border_icon_change = - ecore_event_handler_add(E_EVENT_BORDER_ICON_CHANGE, - _pager_cb_event_border_icon_change, pager); - pager->ev_handler_zone_desk_count_set = - ecore_event_handler_add(E_EVENT_ZONE_DESK_COUNT_SET, - _pager_cb_event_zone_desk_count_set, pager); - pager->ev_handler_desk_show = - ecore_event_handler_add(E_EVENT_DESK_SHOW, - _pager_cb_event_desk_show, pager); - pager->ev_handler_desk_name_change = - ecore_event_handler_add(E_EVENT_DESK_NAME_CHANGE, - _pager_cb_event_desk_name_change, pager); - return pager; -} - -static void -_pager_free(Pager *pager) -{ - Evas_List *l; - - E_CONFIG_DD_FREE(_conf_edd); - E_CONFIG_DD_FREE(_conf_face_edd); - - for (l = pager->faces; l; l = l->next) - _pager_face_free(l->data); - evas_list_free(pager->faces); - - for (l = pager->menus; l; l = l->next) - e_object_del(E_OBJECT(l->data)); - evas_list_free(pager->menus); - e_object_del(E_OBJECT(pager->config_menu)); - - if (pager->ev_handler_border_resize) - ecore_event_handler_del(pager->ev_handler_border_resize); - if (pager->ev_handler_border_move) - ecore_event_handler_del(pager->ev_handler_border_move); - if (pager->ev_handler_border_add) - ecore_event_handler_del(pager->ev_handler_border_add); - if (pager->ev_handler_border_remove) - ecore_event_handler_del(pager->ev_handler_border_remove); - if (pager->ev_handler_border_iconify) - ecore_event_handler_del(pager->ev_handler_border_iconify); - if (pager->ev_handler_border_uniconify) - ecore_event_handler_del(pager->ev_handler_border_uniconify); - if (pager->ev_handler_border_stick) - ecore_event_handler_del(pager->ev_handler_border_stick); - if (pager->ev_handler_border_unstick) - ecore_event_handler_del(pager->ev_handler_border_unstick); - if (pager->ev_handler_border_desk_set) - ecore_event_handler_del(pager->ev_handler_border_desk_set); - if (pager->ev_handler_border_stack) - ecore_event_handler_del(pager->ev_handler_border_stack); - if (pager->ev_handler_border_icon_change) - ecore_event_handler_del(pager->ev_handler_border_icon_change); - if (pager->ev_handler_zone_desk_count_set) - ecore_event_handler_del(pager->ev_handler_zone_desk_count_set); - if (pager->ev_handler_desk_show) - ecore_event_handler_del(pager->ev_handler_desk_show); - if (pager->ev_handler_desk_name_change) - ecore_event_handler_del(pager->ev_handler_desk_name_change); - - evas_list_free(pager->conf->faces); - free(pager->conf); - free(pager); -} - -static void -_pager_config_menu_new(Pager *pager) -{ - E_Menu *mn; - E_Menu_Item *mi; - - mn = e_menu_new(); - pager->config_menu = mn; - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _pager_menu_cb_configure, pager); - - mi = e_menu_item_new(pager->config_menu); - e_menu_item_label_set(mi, _("Fix Aspect (Keep Height)")); - e_menu_item_callback_set(mi, _pager_menu_cb_aspect_keep_height, pager); - - mi = e_menu_item_new(pager->config_menu); - e_menu_item_label_set(mi, _("Fix Aspect (Keep Width)")); - e_menu_item_callback_set(mi, _pager_menu_cb_aspect_keep_width, pager); -} - -static Pager_Face * -_pager_face_new(Pager *pager, E_Zone *zone, Evas *evas, int use_gmc) -{ - Pager_Face *face; - Evas_Object *o; - Evas_Coord x, y, w, h; - double aspect; - const char *drop[] = { "enlightenment/border", "enlightenment/pager_win" }; - E_Gadman_Policy policy; - - face = E_NEW(Pager_Face, 1); - if (!face) return NULL; - - face->pager = pager; - - /* store what evas we live in */ - face->evas = evas; - - /* the bg */ - o = edje_object_add(face->evas); - face->pager_object = o; - e_theme_edje_object_set(o, "base/theme/modules/pager", - "modules/pager/main"); - evas_object_show(o); - - o = e_table_add(face->evas); - face->table_object = o; - e_table_homogenous_set(o, 1); - edje_object_part_swallow(face->pager_object, "items", face->table_object); - evas_object_show(o); - - evas_object_resize(face->pager_object, 1000, 1000); - edje_object_calc_force(face->pager_object); - edje_object_part_geometry_get(face->pager_object, "items", &x, &y, &w, &h); - face->inset.l = x; - face->inset.r = 1000 - (x + w); - face->inset.t = y; - face->inset.b = 1000 - (y + h); - - face->drop_handler = e_drop_handler_add(face, - _pager_face_cb_enter, _pager_face_cb_move, - _pager_face_cb_leave, _pager_face_cb_drop, - drop, 2, - face->fx, face->fy, face->fw, face->fh); - - _pager_face_zone_set(face, zone); - _pager_face_deskname_position_change(face); - - /* popup does not want a gadman entry! */ - if (!use_gmc) - return face; - - face->gmc = e_gadman_client_new(zone->container->gadman); - - e_gadman_client_domain_set(face->gmc, "module.pager", _pager_count++); - e_gadman_client_zone_set(face->gmc, face->zone); - - policy = E_GADMAN_POLICY_ANYWHERE | - E_GADMAN_POLICY_HMOVE | - E_GADMAN_POLICY_VMOVE | - E_GADMAN_POLICY_HSIZE | - // E_GADMAN_POLICY_FIXED_ZONE | - E_GADMAN_POLICY_VSIZE; - - e_gadman_client_policy_set(face->gmc, policy); - - e_gadman_client_min_size_set(face->gmc, 8, 8); - e_gadman_client_max_size_set(face->gmc, 600, 600); - e_gadman_client_auto_size_set(face->gmc, - (face->xnum * 40) + (face->inset.l + face->inset.r), - (face->ynum * 30) + (face->inset.t + face->inset.b)); - e_gadman_client_align_set(face->gmc, 0.0, 1.0); - aspect = (double)(face->xnum * face->zone->w) / (double)(face->ynum * face->zone->h); - e_gadman_client_aspect_set(face->gmc, aspect, aspect); - e_gadman_client_padding_set(face->gmc, - face->inset.l, face->inset.r, - face->inset.t, face->inset.b); - e_gadman_client_resize(face->gmc, - (face->xnum * 40) + (face->inset.l + face->inset.r), - (face->ynum * 30) + (face->inset.t + face->inset.b)); - e_gadman_client_change_func_set(face->gmc, _pager_face_cb_gmc_change, face); - e_gadman_client_load(face->gmc); - - Evas_Coord g, z; - e_gadman_client_geometry_get(face->gmc, NULL, NULL, &g, &z); - - return face; -} - -void -_pager_face_free(Pager_Face *face) -{ - if (face->pager_object) evas_object_del(face->pager_object); - if (face->table_object) evas_object_del(face->table_object); - if (face->gmc) - { - e_gadman_client_save(face->gmc); - e_object_del(E_OBJECT(face->gmc)); - } - - e_drop_handler_del(face->drop_handler); - - _pager_face_zone_unset(face); - - if (face->current_popup) - _pager_popup_free(face->current_popup); - - if (face->menu) - e_object_del(E_OBJECT(face->menu)); - - free(face->conf); - free(face); - - _pager_count--; -} - -static void -_pager_face_menu_new(Pager_Face *face) -{ - E_Menu *mn; - E_Menu_Item *mi; - - mn = e_menu_new(); - face->menu = mn; - - /* Config */ - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _pager_menu_cb_configure, face->pager); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Edit Mode")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets"); - e_menu_item_callback_set(mi, _pager_face_cb_menu_edit, face); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Fix Aspect (Keep Height)")); - e_menu_item_callback_set(mi, _pager_menu_cb_aspect_keep_height, face->pager); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Fix Aspect (Keep Width)")); - e_menu_item_callback_set(mi, _pager_menu_cb_aspect_keep_width, face->pager); -} - -static void -_pager_face_disable(Pager_Face *face) -{ - Evas_List *l; - - face->conf->enabled = 0; - evas_object_hide(face->pager_object); - for (l = face->desks; l; l = l->next) - { - Pager_Desk *pd; - - pd = l->data; - evas_object_hide(pd->event_object); - } - e_config_save_queue(); -} - -static void -_pager_face_zone_set(Pager_Face *face, E_Zone *zone) -{ - int desks_x, desks_y, x, y; - - face->zone = zone; - e_object_ref(E_OBJECT(zone)); - e_zone_desk_count_get(zone, &desks_x, &desks_y); - face->xnum = desks_x; - face->ynum = desks_y; - for (x = 0; x < desks_x; x++) - { - for (y = 0; y < desks_y; y++) - { - Pager_Desk *pd; - E_Desk *desk; - - desk = e_desk_at_xy_get(zone, x, y); - pd = _pager_desk_new(face, desk, x, y); - if (pd) - { - face->desks = evas_list_append(face->desks, pd); - if (desk == e_desk_current_get(desk->zone)) - _pager_face_desk_select(pd); - } - } - } -} - -static void -_pager_face_zone_unset(Pager_Face *face) -{ - Evas_List *list; - - e_object_unref(E_OBJECT(face->zone)); - for (list = face->desks; list; list = list->next) - _pager_desk_free(list->data); - evas_list_free(face->desks); -} - -static Pager_Desk * -_pager_desk_new(Pager_Face *face, E_Desk *desk, int xpos, int ypos) -{ - Pager_Desk *pd; - Evas_Object *o; - E_Border_List *bl; - E_Border *bd; - - pd = E_NEW(Pager_Desk, 1); - if (!pd) return NULL; - - pd->xpos = xpos; - pd->ypos = ypos; - - pd->desk = desk; - e_object_ref(E_OBJECT(desk)); - pd->face = face; - - o = edje_object_add(face->evas); - pd->desk_object = o; - e_theme_edje_object_set(o, "base/theme/modules/pager", - "modules/pager/desk"); - e_table_pack(face->table_object, o, xpos, ypos, 1, 1); - e_table_pack_options_set(o, 1, 1, 1, 1, 0.5, 0.5, 0, 0, -1, -1); - evas_object_show(o); - - o = e_layout_add(face->evas); - pd->layout_object = o; - evas_object_intercept_move_callback_add(o, _pager_desk_cb_intercept_move, pd); - evas_object_intercept_resize_callback_add(o, _pager_desk_cb_intercept_resize, pd); - - e_layout_virtual_size_set(o, desk->zone->w, desk->zone->h); - edje_object_part_swallow(pd->desk_object, "items", pd->layout_object); - evas_object_show(o); - - o = evas_object_rectangle_add(face->evas); - pd->event_object = o; - evas_object_layer_set(o, 1); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _pager_desk_cb_mouse_in, pd); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _pager_desk_cb_mouse_out, pd); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _pager_desk_cb_mouse_down, pd); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _pager_desk_cb_mouse_up, pd); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _pager_desk_cb_mouse_move, pd); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _pager_desk_cb_mouse_wheel, pd); - evas_object_show(o); - - bl = e_container_border_list_first(desk->zone->container); - while ((bd = e_container_border_list_next(bl))) - { - Pager_Win *pw; - - if ((bd->new_client) || ((bd->desk != desk) && (!bd->sticky))) continue; - pw = _pager_window_new(pd, bd); - if (pw) - pd->wins = evas_list_append(pd->wins, pw); - } - e_container_border_list_free(bl); - - return pd; -} - -static void -_pager_desk_free(Pager_Desk *pd) -{ - Evas_List *l; - - if (pd->desk_object) evas_object_del(pd->desk_object); - if (pd->layout_object) evas_object_del(pd->layout_object); - if (pd->event_object) evas_object_del(pd->event_object); - - for (l = pd->wins; l; l = l->next) - _pager_window_free(l->data); - pd->wins = evas_list_free(pd->wins); - e_object_unref(E_OBJECT(pd->desk)); - free(pd); -} - -static Pager_Win * -_pager_window_new(Pager_Desk *pd, E_Border *border) -{ - Pager_Win *pw; - Evas_Object *o; - int visible; - - if ((!border) || (border->client.netwm.state.skip_pager)) return NULL; - pw = E_NEW(Pager_Win, 1); - if (!pw) return NULL; - - pw->border = border; - e_object_ref(E_OBJECT(border)); - - visible = !border->iconic; - pw->desk = pd; - - o = edje_object_add(pd->face->evas); - pw->window_object = o; - e_theme_edje_object_set(o, "base/theme/modules/pager", - "modules/pager/window"); - if (visible) evas_object_show(o); - - e_layout_pack(pd->layout_object, pw->window_object); - e_layout_child_raise(pw->window_object); - o = e_border_icon_add(border, pd->face->evas); - if (o) - { - pw->icon_object = o; - evas_object_show(o); - edje_object_part_swallow(pw->window_object, "icon", o); - } - - /* add an event object */ - - o = evas_object_rectangle_add(pd->face->evas); - pw->event_object = o; - - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 0, 0, 0, 0); -// evas_object_color_set(o, rand()%255, rand()%255, rand()%255, 255); - - - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _pager_window_cb_mouse_in, pw); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _pager_window_cb_mouse_out, pw); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _pager_window_cb_mouse_down, pw); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _pager_window_cb_mouse_up, pw); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _pager_window_cb_mouse_move, pw); - - evas_object_show(o); - e_layout_pack(pd->layout_object, pw->event_object); - e_layout_child_raise(pw->event_object); - - - _pager_window_move(pd->face, pw); - return pw; -} - -static void -_pager_window_free(Pager_Win *pw) -{ - if (pw->window_object) evas_object_del(pw->window_object); - if (pw->icon_object) evas_object_del(pw->icon_object); - if (pw->event_object) evas_object_del(pw->event_object); - e_object_unref(E_OBJECT(pw->border)); - free(pw); -} - -static void -_pager_window_move(Pager_Face *face, Pager_Win *pw) -{ - e_layout_child_move(pw->window_object, - pw->border->x - pw->desk->desk->zone->x, - pw->border->y - pw->desk->desk->zone->y); - e_layout_child_resize(pw->window_object, - pw->border->w, - pw->border->h); - e_layout_child_move(pw->event_object, - pw->border->x - pw->desk->desk->zone->x, - pw->border->y - pw->desk->desk->zone->y); - e_layout_child_resize(pw->event_object, - pw->border->w, - pw->border->h); -} - -static Pager_Win * -_pager_face_border_find(Pager_Face *face, E_Border *border) -{ - Evas_List *l; - - for (l = face->desks; l; l = l->next) - { - Pager_Desk *pd; - Pager_Win *pw; - - pd = l->data; - pw = _pager_desk_border_find(pd, border); - if (pw) return pw; - } - return NULL; -} - -static Pager_Win * -_pager_desk_border_find(Pager_Desk *pd, E_Border *border) -{ - Evas_List *l; - - for (l = pd->wins; l; l = l->next) - { - Pager_Win *pw; - - pw = l->data; - if (pw->border == border) return pw; - } - return NULL; -} - -static Pager_Desk * -_pager_face_desk_find(Pager_Face *face, E_Desk *desk) -{ - Evas_List *l; - - for (l = face->desks; l; l = l->next) - { - Pager_Desk *pd; - - pd = l->data; - if (pd->desk == desk) return pd; - } - return NULL; -} - -/** - * Return Pager_Desk at canvas coord x, y - */ -static Pager_Desk * -_pager_face_desk_at_coord(Pager_Face *face, Evas_Coord x, Evas_Coord y) -{ - Evas_List *l; - - for (l = face->desks; l; l = l->next) - { - Pager_Desk *pd; - Evas_Coord dx, dy, dw, dh; - - pd = l->data; - evas_object_geometry_get(pd->desk_object, &dx, &dy, &dw, &dh); - if (E_INSIDE(x, y, dx, dy, dw, dh)) - { - return pd; - } - } - return NULL; -} - -static void -_pager_face_desk_select(Pager_Desk *pd) -{ - Evas_List *l; - - if (pd->current) return; - for (l = pd->face->desks; l; l = l->next) - { - Pager_Desk *pd2; - - pd2 = l->data; - if (pd == pd2) - { - pd2->current = 1; - edje_object_signal_emit(pd2->desk_object, "active", ""); - } - else - { - if (pd2->current) - { - pd2->current = 0; - edje_object_signal_emit(pd2->desk_object, "passive", ""); - } - } - } - edje_object_part_text_set(pd->face->pager_object, "desktop_name", pd->desk->name); -} - -static void -_pager_popup_free(Pager_Popup *pp) -{ - pp->src_face->current_popup = NULL; - if (pp->timer) ecore_timer_del(pp->timer); - pp->face->pager->faces = evas_list_remove(pp->face->pager->faces, pp->face); - evas_object_del(pp->bg_object); - _pager_face_free(pp->face); - e_bindings_mouse_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); - e_bindings_wheel_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); - e_object_del(E_OBJECT(pp->popup)); - free(pp); -} - -static void -_pager_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) -{ - Pager_Face *face; - Evas_Coord x, y, w, h; - - face = data; - e_gadman_client_geometry_get(face->gmc, &x, &y, &w, &h); - - face->fx = x; - face->fy = y; - face->fw = w; - face->fh = h; - e_drop_handler_geometry_set(face->drop_handler, - face->fx + face->inset.l, face->fy + face->inset.t, - face->fw - (face->inset.l + face->inset.r), - face->fh - (face->inset.t + face->inset.b)); - switch (change) - { - case E_GADMAN_CHANGE_MOVE_RESIZE: - evas_object_move(face->pager_object, face->fx, face->fy); - evas_object_resize(face->pager_object, face->fw, face->fh); - break; - case E_GADMAN_CHANGE_RAISE: - evas_object_raise(face->pager_object); - break; - default: - break; - } -} - -static int -_pager_cb_event_border_resize(void *data, int type, void *event) -{ - E_Event_Border_Resize *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->border->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - Pager_Win *pw; - - pd = l2->data; - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - _pager_window_move(face, pw); - } - } - return 1; -} - -static int -_pager_cb_event_border_move(void *data, int type, void *event) -{ - E_Event_Border_Move *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->border->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - Pager_Win *pw; - - pd = l2->data; - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - _pager_window_move(face, pw); - } - } - return 1; -} - -static int -_pager_cb_event_border_add(void *data, int type, void *event) -{ - E_Event_Border_Add *ev; - Pager *pager; - Evas_List *l; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - Pager_Desk *pd; - - face = l->data; - if ((face->zone != ev->border->zone) || - (_pager_face_border_find(face, ev->border))) - continue; - - pd = _pager_face_desk_find(face, ev->border->desk); - if (pd) - { - Pager_Win *pw; - - pw = _pager_window_new(pd, ev->border); - if (pw) - pd->wins = evas_list_append(pd->wins, pw); - } - } - return 1; -} - -static int -_pager_cb_event_border_remove(void *data, int type, void *event) -{ - E_Event_Border_Remove *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->border->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - Pager_Win *pw; - - pd = l2->data; - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - { - pd->wins = evas_list_remove(pd->wins, pw); - _pager_window_free(pw); - } - } - } - return 1; -} - -static int -_pager_cb_event_border_iconify(void *data, int type, void *event) -{ - E_Event_Border_Hide *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->border->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - Pager_Win *pw; - - pd = l2->data; - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - { - evas_object_hide(pw->window_object); - evas_object_hide(pw->event_object); - } - } - } - return 1; -} - -static int -_pager_cb_event_border_uniconify(void *data, int type, void *event) -{ - E_Event_Border_Show *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->border->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - Pager_Win *pw; - - pd = l2->data; - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - { - evas_object_show(pw->window_object); - evas_object_show(pw->event_object); - } - } - } - return 1; -} - -static int -_pager_cb_event_border_stick(void *data, int type, void *event) -{ - E_Event_Border_Stick *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - Pager_Win *pw; - - face = l->data; - if (face->zone != ev->border->zone) continue; - pw = _pager_face_border_find(face, ev->border); - if (!pw) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - - pd = l2->data; - if (ev->border->desk != pd->desk) - { - pw = _pager_window_new(pd, ev->border); - if (pw) - pd->wins = evas_list_append(pd->wins, pw); - } - } - } - return 1; -} - -static int -_pager_cb_event_border_unstick(void *data, int type, void *event) -{ - E_Event_Border_Unstick *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->border->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - - pd = l2->data; - if (ev->border->desk != pd->desk) - { - Pager_Win *pw; - - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - { - pd->wins = evas_list_remove(pd->wins, pw); - _pager_window_free(pw); - } - } - } - } - return 1; -} - -static int -_pager_cb_event_border_desk_set(void *data, int type, void *event) -{ - E_Event_Border_Desk_Set *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - Pager_Win *pw; - Pager_Desk *pd; - - face = l->data; - - /* if this pager is not for the zone of the border */ - if (face->zone != ev->border->zone) - { - /* look at all desks in the pager */ - for (l2 = face->desks; l2; l2 = l2->next) - { - pd = l2->data; - /* find this border in this desk */ - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - { - /* if it is found - remove it. it does not belong in this - * pager as it probably moves zones */ - pd->wins = evas_list_remove(pd->wins, pw); - _pager_window_free(pw); - } - } - continue; - } - /* and this pager zone is for this border */ - /* see if the window is in this pager at all */ - pw = _pager_face_border_find(face, ev->border); - if (pw) - { - /* is it sticky */ - if (ev->border->sticky) - { - /* if its sticky and in this pager - its already everywhere, so abort - * doing anything else */ - continue; - } - /* move it to the right desk */ - /* find the pager desk of the target desk */ - pd = _pager_face_desk_find(face, ev->border->desk); - if (pd) - { - Pager_Win *pw2 = NULL; - E_Border *bd; - - /* remove it from whatever desk it was on */ - pw->desk->wins = evas_list_remove(pw->desk->wins, pw); - e_layout_unpack(pw->window_object); - e_layout_unpack(pw->event_object); - - /* add it to the one its MEANT to be on */ - pw->desk = pd; - pd->wins = evas_list_append(pd->wins, pw); - e_layout_pack(pd->layout_object, pw->window_object); - e_layout_pack(pd->layout_object, pw->event_object); - - bd = e_util_desk_border_above(pw->border); - if (bd) - pw2 = _pager_desk_border_find(pd, bd); - if (pw2) - { - e_layout_child_lower_below(pw->window_object, pw2->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - else - { - e_layout_child_raise(pw->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - - _pager_window_move(face, pw); - } - } - /* the border isnt in this pager at all - it must have moved zones */ - else - { - if (!ev->border->sticky) - { - /* find the pager desk it needs to go to */ - pd = _pager_face_desk_find(face, ev->border->desk); - if (pd) - { - /* create it and add it */ - pw = _pager_window_new(pd, ev->border); - if (pw) - { - Pager_Win *pw2 = NULL; - E_Border *bd; - - pd->wins = evas_list_append(pd->wins, pw); - bd = e_util_desk_border_above(pw->border); - if (bd) - pw2 = _pager_desk_border_find(pd, bd); - if (pw2) - { - e_layout_child_lower_below(pw->window_object, pw2->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - else - { - e_layout_child_raise(pw->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - - _pager_window_move(face, pw); - } - } - } - else - { - /* go through all desks */ - for (l2 = face->desks; l2; l2 = l2->next) - { - pd = l2->data; - /* create it and add it */ - pw = _pager_window_new(pd, ev->border); - if (pw) - { - Pager_Win *pw2 = NULL; - E_Border *bd; - - pd->wins = evas_list_append(pd->wins, pw); - bd = e_util_desk_border_above(pw->border); - if (bd) - pw2 = _pager_desk_border_find(pd, bd); - if (pw2) - { - e_layout_child_lower_below(pw->window_object, pw2->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - else - { - e_layout_child_raise(pw->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - - _pager_window_move(face, pw); - } - } - } - } - } - return 1; -} - -static int -_pager_cb_event_border_stack(void *data, int type, void *event) -{ - E_Event_Border_Stack *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->border->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - Pager_Win *pw, *pw2 = NULL; - - pd = l2->data; - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - { - if (ev->stack) - { - pw2 = _pager_desk_border_find(pd, ev->stack); - if (!pw2) - { - /* This border is on another desk... */ - E_Border *bd = NULL; - - if (ev->type == E_STACKING_ABOVE) - bd = e_util_desk_border_below(ev->border); - else if (ev->type == E_STACKING_BELOW) - bd = e_util_desk_border_above(ev->border); - - if (bd) - pw2 = _pager_desk_border_find(pd, bd); - } - } - if (ev->type == E_STACKING_ABOVE) - { - if (pw2) - { - e_layout_child_raise_above(pw->window_object, pw2->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - e_layout_child_raise_above(pw2->event_object, pw2->window_object); - } - else - { - /* If we aren't above any window, we are at the bottom */ - e_layout_child_lower(pw->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - } - else if (ev->type == E_STACKING_BELOW) - { - if (pw2) - { - e_layout_child_lower_below(pw->window_object, pw2->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - else - { - /* If we aren't below any window, we are at the top */ - e_layout_child_raise(pw->window_object); - e_layout_child_raise_above(pw->event_object, pw->window_object); - } - } - } - } - } - return 1; -} - -static int -_pager_cb_event_border_icon_change(void *data, int type, void *event) -{ - E_Event_Border_Icon_Change *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->border->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - Pager_Win *pw; - - pd = l2->data; - pw = _pager_desk_border_find(pd, ev->border); - if (pw) - { - Evas_Object *o; - - if (pw->icon_object) - { - evas_object_del(pw->icon_object); - pw->icon_object = NULL; - } - o = e_border_icon_add(ev->border, pd->face->evas); - if (o) - { - pw->icon_object = o; - evas_object_show(o); - edje_object_part_swallow(pw->window_object, "icon", o); - } - } - } - } - return 1; -} - -static int -_pager_cb_event_zone_desk_count_set(void *data, int type, void *event) -{ - E_Event_Zone_Desk_Count_Set *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - Pager_Desk *pd, *pd2; - E_Desk *desk; - int desks_x, desks_y; - int x, y; - Evas_Coord lw, lh, dw, dh; - double aspect; - - face = l->data; - - if (face->zone != ev->zone) continue; - e_zone_desk_count_get(ev->zone, &desks_x, &desks_y); - if ((face->xnum == desks_x) && (face->ynum == desks_y)) continue; - - evas_object_geometry_get(face->table_object, NULL, NULL, &lw, &lh); - if (face->xnum > 0) dw = lw / face->xnum; - else dw = 0; - dw *= (desks_x - face->xnum); - if (face->ynum > 0) dh = lh / face->ynum; - else dh = 0; - dh *= (desks_y - face->ynum); - - /* Loop to add new desks */ - for (x = 0; x < desks_x; x++) - { - for (y = 0; y < desks_y; y++) - { - if ((x >= face->xnum) || (y >= face->ynum)) - { - /* add desk */ - desk = e_desk_at_xy_get(ev->zone, x, y); - pd = _pager_desk_new(face, desk, x, y); - if (pd) - face->desks = evas_list_append(face->desks, pd); - } - } - } - /* Loop to remove extra desks */ - for (l2 = face->desks; l2;) - { - pd = l2->data; - l2 = l2->next; - if ((pd->xpos >= desks_x) || (pd->ypos >= desks_y)) - { - /* remove desk */ - if (pd->current) - { - desk = e_desk_current_get(ev->zone); - pd2 = _pager_face_desk_find(face, desk); - _pager_face_desk_select(pd2); - } - face->desks = evas_list_remove(face->desks, pd); - _pager_desk_free(pd); - } - } - - face->xnum = desks_x; - face->ynum = desks_y; - aspect = (double)(face->xnum * face->zone->w) / (double)(face->ynum * face->zone->h); - e_gadman_client_aspect_set(face->gmc, aspect, aspect); - e_gadman_client_resize(face->gmc, face->fw + dw, face->fh + dh); - } - return 1; -} - -static int -_pager_cb_event_desk_show(void *data, int type, void *event) -{ - E_Event_Desk_Show *ev; - Pager *pager; - Pager_Popup *pp = NULL; - Evas_List *l; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - Pager_Desk *pd; - - face = l->data; - if (face->zone != ev->desk->zone) continue; - - pd = _pager_face_desk_find(face, ev->desk); - if (pd) - { - Evas_Coord w, h; - - _pager_face_desk_select(pd); - - /* If the popup is defined, we don't want another */ - if ((!face->pager->conf->popup) || (pp)) continue; - - pp = face->current_popup; - face->current_popup = NULL; - if (pp) _pager_popup_free(pp); - - pp = E_NEW(Pager_Popup, 1); - if (!pp) continue; - - /* Show popup */ - pp->popup = e_popup_new(face->zone, 0, 0, 1, 1); - if (!pp->popup) - { - free(pp); - continue; - } - e_popup_layer_set(pp->popup, 999); - pp->src_face = face; - - face->current_popup = pp; - - evas_object_geometry_get(face->pager_object, NULL, NULL, &w, &h); - - pp->face = _pager_face_new(face->pager, face->zone, - pp->popup->evas, 0); - evas_object_move(pp->face->pager_object, 0, 0); - evas_object_resize(pp->face->pager_object, w, h); - - pp->bg_object = edje_object_add(pp->face->evas); - e_theme_edje_object_set(pp->bg_object, "base/theme/modules/pager", - "widgets/pager/popup"); - edje_object_part_text_set(pp->bg_object, "text", pd->desk->name); - evas_object_show(pp->bg_object); - edje_extern_object_min_size_set(pp->face->pager_object, w, h); - edje_object_part_swallow(pp->bg_object, "pager", pp->face->pager_object); - edje_object_calc_force(pp->face->pager_object); - edje_object_size_min_calc(pp->bg_object, &w, &h); - - evas_object_move(pp->bg_object, 0, 0); - evas_object_resize(pp->bg_object, w, h); - e_popup_edje_bg_object_set(pp->popup, pp->bg_object); - e_popup_ignore_events_set(pp->popup, 1); - e_popup_move_resize(pp->popup, - ((pp->popup->zone->w - w) / 2), - ((pp->popup->zone->h - h) / 2), - w, h); - e_bindings_mouse_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); - e_bindings_wheel_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); - e_popup_show(pp->popup); - - pp->timer = ecore_timer_add(face->pager->conf->popup_speed, - _pager_popup_cb_timeout, pp); - } - } - - return 1; -} - -static int -_pager_popup_cb_timeout(void *data) -{ - Pager_Popup *pp; - - pp = data; - _pager_popup_free(pp); - return 0; -} - -static int -_pager_cb_event_desk_name_change(void *data, int type, void *event) -{ - E_Event_Desk_Show *ev; - Pager *pager; - Evas_List *l, *l2; - - pager = data; - ev = event; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - if (face->zone != ev->desk->zone) continue; - for (l2 = face->desks; l2; l2 = l2->next) - { - Pager_Desk *pd; - pd = l2->data; - - if ((pd->desk == ev->desk) && (pd->current)) - { - edje_object_part_text_set(pd->face->pager_object, "desktop_name", ev->desk->name); - break; - } - - } - } - return 1; -} - -static void -_pager_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Pager_Face *face; - - face = data; - e_gadman_mode_set(face->gmc->gadman, E_GADMAN_MODE_EDIT); -} - -/*****/ - -static void -_pager_desk_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_In *ev; - Pager_Desk *desk; - - ev = event_info; - desk = data; - - edje_object_part_text_set(desk->face->pager_object, "desktop_name", desk->desk->name); -} - -static void -_pager_desk_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Out *ev; - Pager_Desk *desk; - Evas_List *l; - - ev = event_info; - desk = data; - - for (l = desk->face->desks; l; l = l->next) - { - Pager_Desk *pd; - pd = l->data; - if (pd->current) - { - edje_object_part_text_set(pd->face->pager_object, "desktop_name", pd->desk->name); - break; - } - } -} - -static void -_pager_desk_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Down *ev; - Pager_Desk *pd; - - ev = event_info; - pd = data; - if ((ev->button == 3) && (pd->face->menu)) - { - e_menu_activate_mouse(pd->face->menu, pd->face->zone, - ev->output.x, ev->output.y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - e_util_container_fake_mouse_up_later(pd->face->zone->container, 3); - } -} - -static void -_pager_desk_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Up *ev; - Pager_Desk *desk; - - ev = event_info; - desk = data; - - if ((ev->button == 1) && (!desk->face->dragging)) - { - e_desk_show(desk->desk); - } -} - -static void -_pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Move *ev; - Pager_Desk *desk; - - ev = event_info; - desk = data; -} - -/*****/ - -static void -_pager_desk_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y) -{ - Pager_Desk *desk; - - desk = data; - evas_object_move(o, x, y); - evas_object_move(desk->event_object, x, y); -} - -static void -_pager_desk_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h) -{ - Pager_Desk *desk; - - desk = data; - evas_object_resize(o, w, h); - evas_object_resize(desk->event_object, w, h); -} - - -/*****/ - -static void -_pager_window_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_In *ev; - Pager_Win *pw; - - ev = event_info; - pw = data; - -} - -static void -_pager_window_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Out *ev; - Pager_Win *pw; - - ev = event_info; - pw = data; - -} - -static void -_pager_window_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Down *ev; - Pager_Win *pw; - - ev = event_info; - pw = data; - if (!pw) return; - - /* make this configurable */ - if (ev->button == 1) - { - Evas_Coord ox, oy; - - evas_object_geometry_get(pw->window_object, &ox, &oy, NULL, NULL); - pw->drag.in_pager = 1; - - pw->drag.x = ev->canvas.x; - pw->drag.y = ev->canvas.y; - pw->drag.dx = ox - ev->canvas.x; - pw->drag.dy = oy - ev->canvas.y; - pw->drag.start = 1; - } -} - -static void -_pager_window_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Up *ev; - Pager_Win *pw; - - ev = event_info; - pw = data; - if (!pw) return; - - pw->drag.in_pager = 0; - pw->drag.start = 0; - pw->desk->face->dragging = 0; -} - -static void -_pager_window_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Move *ev; - Pager_Win *pw; - - ev = event_info; - pw = data; - - if (!pw) return; - - /* prevent drag for a few pixels */ - if (pw->drag.start) - { - Evas_Coord dx, dy; - unsigned int resist = 0; - - dx = pw->drag.x - ev->cur.output.x; - dy = pw->drag.y - ev->cur.output.y; - if (pw->desk && pw->desk->face && pw->desk->face->pager) - resist = pw->desk->face->pager->conf->drag_resist; - - if (((dx * dx) + (dy * dy)) <= (resist * resist)) return; - - pw->desk->face->dragging = 1; - pw->drag.start = 0; - } - - /* dragging this win around inside the pager */ - if (pw->drag.in_pager) - { - Evas_Coord mx, my, vx, vy; - Pager_Desk *desk; - - /* m for mouse */ - mx = ev->cur.canvas.x; - my = ev->cur.canvas.y; - - /* find desk at pointer */ - desk = _pager_face_desk_at_coord(pw->desk->face, mx, my); - - if (desk) - { - e_layout_coord_canvas_to_virtual(desk->layout_object, mx + pw->drag.dx, my + pw->drag.dy, &vx, &vy); - - if (desk != pw->desk) e_border_desk_set(pw->border, desk->desk); - e_border_move(pw->border, vx + desk->desk->zone->x, vy + desk->desk->zone->y); - } - else - { - /* not over a desk, start dnd drag */ - if (pw->window_object) - { - E_Drag *drag; - Evas_Object *o, *oo; - Evas_Coord x, y, w, h; - const char *file, *part; - const char *drag_types[] = { "enlightenment/pager_win" }; - - evas_object_geometry_get(pw->window_object, - &x, &y, &w, &h); - - /* XXX this relies on screen and canvas coords matching. is this a valid assumption? */ - drag = e_drag_new(pw->desk->face->zone->container, x, y, - drag_types, 1, pw, -1, - _pager_window_cb_drag_finished); - - - o = edje_object_add(drag->evas); - edje_object_file_get(pw->window_object, &file, &part); - edje_object_file_set(o, file, part); - - oo = o; - - o = edje_object_add(drag->evas); - edje_object_file_get(pw->icon_object, &file, &part); - edje_object_file_set(o, file, part); - edje_object_part_swallow(oo, "icon", o); - - e_drag_object_set(drag, oo); - - e_drag_resize(drag, w, h); - e_drag_start(drag, x - pw->drag.dx, y - pw->drag.dy); - - /* this prevents the desk from switching on drags */ - pw->drag.from_face = pw->desk->face; - pw->drag.from_face->dragging = 1; - evas_event_feed_mouse_up(pw->desk->face->evas, 1, - EVAS_BUTTON_NONE, ecore_time_get(), NULL); - } - pw->drag.in_pager = 0; - } - } -} - -static void -_pager_window_cb_drag_finished(E_Drag *drag, int dropped) -{ - Pager_Win *pw; - - pw = drag->data; - - if (!pw) return; - - if (!dropped) - { - /* wasn't dropped (on pager). move it to position of mouse on screen */ - int x, y, dx, dy; - E_Container *cont; - E_Zone *zone; - E_Desk *desk; - - cont = e_container_current_get(e_manager_current_get()); - zone = e_zone_current_get(cont); - desk = e_desk_current_get(zone); - - e_border_zone_set(pw->border, zone); - e_border_desk_set(pw->border, desk); - - ecore_x_pointer_last_xy_get(&x, &y); - x = x + zone->x; - y = y + zone->y; - - dx = (pw->border->w / 2); - dy = (pw->border->h / 2); - - /* offset so that center of window is on mouse, but keep within desk bounds */ - if (dx < x) - { - x -= dx; - if ((pw->border->w < zone->w) && (x + pw->border->w > zone->x + zone->w)) - { - x -= x + pw->border->w - (zone->x + zone->w); - } - } - else x = 0; - - if (dy < y) - { - y -= dy; - if ((pw->border->h < zone->h) && (y + pw->border->h > zone->y + zone->h)) - { - y -= y + pw->border->h - (zone->y + zone->h); - } - } - else y = 0; - - e_border_move(pw->border, x, y); - - } - if (pw && pw->drag.from_face) - { - pw->drag.from_face->dragging = 0; - } - -} - -static void -_pager_desk_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Mouse_Wheel *ev; - Evas_List *l; - Pager_Desk *desk; - Pager_Face *face; - - ev = event_info; - desk = data; - face = desk->face; - l = face->desks; - - for (l = face->desks; l; l = l->next) - { - Pager_Desk *pd; - pd = l->data; - if (pd->current) - { - /* Mouse wheel up, scroll back through desks */ - if (ev->z < 0) - { - if (l->prev) - { - pd = l->prev->data; - e_desk_show(pd->desk); - } - else - { - /* We've looped around, go to the last desk. Not sure if there's a better way. */ - Evas_List *l2; - for (l2 = face->desks; l2->next; l2 = l2->next); - pd = l2->data; - e_desk_show(pd->desk); - } - } - /* Mouse wheel down, scroll forward through desks */ - else if (ev->z > 0) - { - if (l->next) - { - pd = l->next->data; - e_desk_show(pd->desk); - } - else - { - /* We've looped around, start back at the first desk */ - pd = face->desks->data; - e_desk_show(pd->desk); - } - } - break; - } - } -} -/*****/ - -static void -_pager_face_cb_enter(void *data, const char *type, void *event_info) -{ - E_Event_Dnd_Enter *ev; - Pager_Face *face; - - ev = event_info; - face = data; -} - -static void -_pager_face_cb_move(void *data, const char *type, void *event_info) -{ - E_Event_Dnd_Move *ev; - Pager_Face *face; - Pager_Desk *pd; - int x, y; - double w, h; - Evas_List *l; - - ev = event_info; - face = data; - - w = (face->fw - (face->inset.l + face->inset.r)) / (double) face->xnum; - h = (face->fh - (face->inset.t + face->inset.b)) / (double) face->ynum; - - x = (ev->x - (face->fx + face->inset.l)) / w; - y = (ev->y - (face->fy + face->inset.t)) / h; - - for (l = face->desks; l; l = l->next) - { - pd = l->data; - if ((pd->xpos == x) && (pd->ypos == y)) - edje_object_signal_emit(pd->desk_object, "drag", "in"); - else - edje_object_signal_emit(pd->desk_object, "drag", "out"); - } -} - -static void -_pager_face_cb_leave(void *data, const char *type, void *event_info) -{ - E_Event_Dnd_Leave *ev; - Pager_Face *face; - Evas_List *l; - - ev = event_info; - face = data; - - for (l = face->desks; l; l = l->next) - { - Pager_Desk *pd; - pd = l->data; - edje_object_signal_emit(pd->desk_object, "drag", "out"); - } -} - -static void -_pager_face_cb_drop(void *data, const char *type, void *event_info) -{ - E_Event_Dnd_Drop *ev; - Pager_Face *face; - Pager_Desk *desk; - E_Border *bd; - Evas_List *l; - int dx = 0, dy = 0; - - ev = event_info; - face = data; - - /* XXX convert screen -> evas coords? */ - desk = _pager_face_desk_at_coord(face, ev->x, ev->y); - if (desk) - { - if (!strcmp(type, "enlightenment/pager_win")) - { - Pager_Win *pw; - pw = (Pager_Win *)(ev->data); - if (pw) - { - bd = pw->border; - dx = pw->drag.dx; - dy = pw->drag.dy; - } - } - else if (!strcmp(type, "enlightenment/border")) - { - Evas_Coord wx, wy, wx2, wy2; - bd = ev->data; - e_layout_coord_virtual_to_canvas(desk->layout_object, bd->x, bd->y, &wx, &wy); - e_layout_coord_virtual_to_canvas(desk->layout_object, bd->x + bd->w, bd->y + bd->h, &wx2, &wy2); - dx = (wx - wx2) / 2; - dy = (wy - wy2) / 2; - } - else - { - return; - } - - if ((bd) && (desk)) - { - Evas_Coord nx, ny; - e_border_desk_set(bd, desk->desk); - e_layout_coord_canvas_to_virtual(desk->layout_object, ev->x + dx, ev->y + dy, &nx, &ny); - - e_border_move(bd, nx + desk->desk->zone->x, ny + desk->desk->zone->y); - } - - } - - for (l = face->desks; l; l = l->next) - { - Pager_Desk *pd; - pd = l->data; - edje_object_signal_emit(pd->desk_object, "drag", "out"); - } -} - -static void -_pager_face_deskname_position_change(Pager_Face *face) -{ - switch (face->pager->conf->deskname_pos) - { - case PAGER_DESKNAME_NONE: - edje_object_signal_emit(face->pager_object, "desktop_name,none", ""); - break; - case PAGER_DESKNAME_TOP: - edje_object_signal_emit(face->pager_object, "desktop_name,top", ""); - break; - case PAGER_DESKNAME_BOTTOM: - edje_object_signal_emit(face->pager_object, "desktop_name,bottom", ""); - break; - case PAGER_DESKNAME_LEFT: - edje_object_signal_emit(face->pager_object, "desktop_name,left", ""); - break; - case PAGER_DESKNAME_RIGHT: - edje_object_signal_emit(face->pager_object, "desktop_name,right", ""); - break; - } -} - -static void -_pager_menu_cb_aspect_keep_height(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Pager *pager; - Evas_List *l; - - pager = data; - - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - int w, h; - - face = l->data; - - h = ((face->fh - (face->inset.t + face->inset.b)) / face->ynum); - - w = h * face->zone->w / (double)face->zone->h; - w *= face->xnum; - w += (face->inset.l + face->inset.r); - - e_gadman_client_resize(face->gmc, w, face->fh); - } -} - -static void -_pager_menu_cb_aspect_keep_width(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Pager *pager; - Evas_List *l; - - pager = data; - - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - int w, h; - - face = l->data; - - w = ((face->fw - (face->inset.l + face->inset.r)) / face->xnum); - - h = w * face->zone->h / (double)face->zone->w; - h *= face->ynum; - h += (face->inset.t + face->inset.b); - - e_gadman_client_resize(face->gmc, face->fw, h); - } -} - -static void -_pager_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi) -{ - Pager *p; - - p = data; - if (!p) return; - _config_pager_module(e_container_current_get(e_manager_current_get()), p); -} - -void -_pager_cb_config_updated(void *data) -{ - Pager *pager; - Evas_List *l; - - /* Handle Desktop Name Position Change */ - pager = data; - for (l = pager->faces; l; l = l->next) - { - Pager_Face *face; - - face = l->data; - _pager_face_deskname_position_change(face); - } -} - +/**/ +/***************************************************************************/ diff --git a/src/modules/pager/e_mod_main.h b/src/modules/pager/e_mod_main.h index b04b8f0e9..fa0584712 100644 --- a/src/modules/pager/e_mod_main.h +++ b/src/modules/pager/e_mod_main.h @@ -5,12 +5,7 @@ #define E_MOD_MAIN_H typedef struct _Config Config; -typedef struct _Config_Face Config_Face; -typedef struct _Pager Pager; -typedef struct _Pager_Face Pager_Face; -typedef struct _Pager_Desk Pager_Desk; -typedef struct _Pager_Win Pager_Win; -typedef struct _Pager_Popup Pager_Popup; +typedef struct _Config_Item Config_Item; #define PAGER_RESIZE_NONE 0 #define PAGER_RESIZE_HORZ 1 @@ -25,125 +20,24 @@ typedef struct _Pager_Popup Pager_Popup; struct _Config { - Evas_List *faces; - /* Position of desktop name */ - unsigned int deskname_pos; - /* How the popup is shown on desk change */ - double popup_speed; - /* Show popup? */ - unsigned int popup; - - unsigned int drag_resist; -}; - -struct _Config_Face -{ - /* Show face */ - unsigned char enabled; - /* Keep scale of desktops */ - unsigned char scale; - /* Resize pager when adding/removing desktops */ - unsigned char resize; -}; - -struct _Pager -{ - Evas_List *faces; - E_Menu *config_menu; - E_Menu *config_menu_deskname; - E_Menu *config_menu_speed; - Evas_List *menus; - - Config *conf; - - Ecore_Event_Handler *ev_handler_border_resize; - Ecore_Event_Handler *ev_handler_border_move; - Ecore_Event_Handler *ev_handler_border_add; - Ecore_Event_Handler *ev_handler_border_remove; - Ecore_Event_Handler *ev_handler_border_iconify; - Ecore_Event_Handler *ev_handler_border_uniconify; - Ecore_Event_Handler *ev_handler_border_stick; - Ecore_Event_Handler *ev_handler_border_unstick; - Ecore_Event_Handler *ev_handler_border_desk_set; - Ecore_Event_Handler *ev_handler_border_stack; - Ecore_Event_Handler *ev_handler_border_icon_change; - Ecore_Event_Handler *ev_handler_zone_desk_count_set; - Ecore_Event_Handler *ev_handler_desk_show; - Ecore_Event_Handler *ev_handler_desk_name_change; - + /* saved * loaded config values */ + double popup_speed; + unsigned int popup; + unsigned int drag_resist; + unsigned char scale; + unsigned char resize; + Evas_List *items; /* FIXME: save/load this */ + /* just config state */ E_Config_Dialog *config_dialog; -}; - -struct _Pager_Face -{ - Pager *pager; - E_Gadman_Client *gmc; + Evas_List *instances; E_Menu *menu; - Evas *evas; - - E_Zone *zone; - Evas_List *desks; - - Evas_Object *pager_object; - Evas_Object *table_object; - - Evas_Coord fx, fy, fw, fh; - struct { - Evas_Coord l, r, t, b; - } inset; - - /* Current nr. of desktops */ - int xnum, ynum; - - Config_Face *conf; - - E_Drop_Handler *drop_handler; - - Pager_Popup *current_popup; - - unsigned char dragging:1; + Evas_List *handlers; }; -struct _Pager_Desk +struct _Config_Item { - E_Desk *desk; - Pager_Face *face; - Evas_List *wins; - - Evas_Object *desk_object; - Evas_Object *layout_object; - Evas_Object *event_object; - - int xpos, ypos; - - int current : 1; -}; - -struct _Pager_Win -{ - E_Border *border; - Pager_Desk *desk; - - Evas_Object *window_object; - Evas_Object *icon_object; - Evas_Object *event_object; - - struct { - Pager_Face *from_face; - unsigned char start : 1; - unsigned char in_pager : 1; - unsigned char dnd : 1; - int x, y; - int dx, dy; - } drag; -}; - -struct _Pager_Popup -{ - E_Popup *popup; - Pager_Face *src_face, *face; - Evas_Object *bg_object; - Ecore_Timer *timer; + char *id; + int zone_num; }; EAPI extern E_Module_Api e_modapi; @@ -153,8 +47,9 @@ EAPI int e_modapi_shutdown (E_Module *module); EAPI int e_modapi_save (E_Module *module); EAPI int e_modapi_info (E_Module *module); EAPI int e_modapi_about (E_Module *module); -EAPI int e_modapi_config (E_Module *module); -void _pager_cb_config_updated(void *data); +void _pager_cb_config_updated(void); +void _config_pager_module(Config_Item *ci); +extern Config *pager_config; #endif diff --git a/src/modules/start/e_mod_main.c b/src/modules/start/e_mod_main.c index cbe5ecf7d..e5b5bee99 100644 --- a/src/modules/start/e_mod_main.c +++ b/src/modules/start/e_mod_main.c @@ -45,7 +45,6 @@ _gc_init(E_Gadcon *gc, char *name, char *id, char *style) E_Gadcon_Client *gcc; Instance *inst; - printf("CREATE START GADCON %s %s\n", name, id); inst = E_NEW(Instance, 1); o = edje_object_add(gc->evas); @@ -59,13 +58,10 @@ _gc_init(E_Gadcon *gc, char *name, char *id, char *style) inst->o_button = o; inst->main_menu = NULL; + e_gadcon_client_util_menu_attach(gcc); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _button_cb_mouse_down, inst); - /* FIXME: add callback to resize - and based off one dimension, request - * another to be the same */ - e_gadcon_client_size_request(gcc, 32, 32); - e_gadcon_client_min_size_set(gcc, 16, 16); - e_gadcon_client_aspect_set(gcc, 1, 1); return gcc; } @@ -75,6 +71,7 @@ _gc_shutdown(E_Gadcon_Client *gcc) Instance *inst; inst = gcc->data; + evas_object_del(inst->o_button); free(inst); } @@ -84,9 +81,8 @@ _gc_orient(E_Gadcon_Client *gcc) Instance *inst; inst = gcc->data; - printf("OREINT to %i\n", gcc->gadcon->orient); - e_gadcon_client_aspect_set(gcc, 20, 20); - e_gadcon_client_min_size_set(gcc, 20, 20); + e_gadcon_client_aspect_set(gcc, 16, 16); + e_gadcon_client_min_size_set(gcc, 16, 16); } /**/ /***************************************************************************/ @@ -105,15 +101,12 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Coord x, y, w, h; int cx, cy, cw, ch; - E_Zone *zone; evas_object_geometry_get(inst->o_button, &x, &y, &w, &h); - e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, + &cx, &cy, &cw, &ch); x += cx; y += cy; - zone = e_gadcon_zone_get(inst->gcc->gadcon); - if (!zone) - zone = e_util_zone_current_get(e_manager_current_get()); if (!inst->main_menu) inst->main_menu = e_int_menus_main_new(); if (inst->main_menu) @@ -152,7 +145,8 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) x, y, w, h, dir, ev->timestamp); edje_object_signal_emit(inst->o_button, "active", ""); - evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, EVAS_BUTTON_NONE, ev->timestamp, NULL); + evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); } } } @@ -184,7 +178,7 @@ EAPI void * e_modapi_init(E_Module *m) { e_gadcon_provider_register(&_gadcon_class); - return NULL; + return 1; } EAPI int @@ -217,11 +211,5 @@ e_modapi_about(E_Module *m) _("Experimental Button module for E17")); return 1; } - -int -e_modapi_config(E_Module *m) -{ - return 0; -} /**/ /***************************************************************************/ diff --git a/src/modules/start/e_mod_main.h b/src/modules/start/e_mod_main.h index 4e5acc824..f00a37985 100644 --- a/src/modules/start/e_mod_main.h +++ b/src/modules/start/e_mod_main.h @@ -1,7 +1,9 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -/* standard module api calls e looks for */ EAPI extern E_Module_Api e_modapi; EAPI void *e_modapi_init (E_Module *m); diff --git a/src/modules/temperature/Makefile.am b/src/modules/temperature/Makefile.am index 1d6544048..f0a8236d9 100644 --- a/src/modules/temperature/Makefile.am +++ b/src/modules/temperature/Makefile.am @@ -20,8 +20,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH pkg_LTLIBRARIES = module.la module_la_SOURCES = e_mod_main.c \ e_mod_main.h \ - e_mod_config.c \ - e_mod_config.h + e_mod_config.c module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/src/modules/temperature/e_mod_config.c b/src/modules/temperature/e_mod_config.c index 0abde2aa7..c35a0be4d 100644 --- a/src/modules/temperature/e_mod_config.c +++ b/src/modules/temperature/e_mod_config.c @@ -3,8 +3,6 @@ */ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" -#include "config.h" /* celsius */ #define TEMP_LOW_LOW 32 @@ -42,7 +40,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); void -_config_temperature_module(E_Container *con, Temperature *temp) +_config_temperature_module(void) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -56,22 +54,23 @@ _config_temperature_module(E_Container *con, Temperature *temp) v->advanced.apply_cfdata = _advanced_apply_data; v->advanced.create_widgets = _advanced_create_widgets; - cfd = e_config_dialog_new(con, _("Temperature Configuration"), NULL, 0, v, temp); - temp->config_dialog = cfd; + cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()), + _("Temperature Configuration"), NULL, 0, v, NULL); + temperature_config->config_dialog = cfd; } static void -_fill_data(Temperature *t, E_Config_Dialog_Data *cfdata) +_fill_data(E_Config_Dialog_Data *cfdata) { double p; - cfdata->units = t->conf->units; - if (t->conf->units == CELCIUS) + cfdata->units = temperature_config->units; + if (temperature_config->units == CELCIUS) cfdata->unit_method = 0; else cfdata->unit_method = 1; - p = t->conf->poll_time; + p = temperature_config->poll_time; cfdata->poll_time = p; if ((p >= 0) && (p <= 5)) cfdata->poll_method = 1; //Fast @@ -82,7 +81,7 @@ _fill_data(Temperature *t, E_Config_Dialog_Data *cfdata) else if (p > 30) cfdata->poll_method = 60; //Very Slow - p = t->conf->low; + p = temperature_config->low; if (cfdata->units == FAHRENHEIT) p = FAR_2_CEL(p - 1); // -1 so the conversion doesn't make mid go hi cfdata->low_temp = p; @@ -93,7 +92,7 @@ _fill_data(Temperature *t, E_Config_Dialog_Data *cfdata) else if (p > TEMP_LOW_MID) cfdata->low_method = TEMP_LOW_HIGH; - p = t->conf->high; + p = temperature_config->high; if (cfdata->units == FAHRENHEIT) p = FAR_2_CEL(p - 1); cfdata->high_temp = p; @@ -104,11 +103,11 @@ _fill_data(Temperature *t, E_Config_Dialog_Data *cfdata) else if (p > TEMP_HIGH_MID) cfdata->high_method = TEMP_HIGH_HIGH; - if (!strcmp(t->conf->sensor_name, "temp1")) + if (!strcmp(temperature_config->sensor_name, "temp1")) cfdata->sensor = 0; - else if (!strcmp(t->conf->sensor_name, "temp2")) + else if (!strcmp(temperature_config->sensor_name, "temp2")) cfdata->sensor = 1; - else if (!strcmp(t->conf->sensor_name, "temp3")) + else if (!strcmp(temperature_config->sensor_name, "temp3")) cfdata->sensor = 2; } @@ -116,21 +115,16 @@ static void * _create_data(E_Config_Dialog *cfd) { E_Config_Dialog_Data *cfdata; - Temperature *t; - t = cfd->data; cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(t, cfdata); + _fill_data(cfdata); return cfdata; } static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Temperature *t; - - t = cfd->data; - t->config_dialog = NULL; + temperature_config->config_dialog = NULL; free(cfdata); } @@ -217,33 +211,23 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Temperature *t; - - t = cfd->data; - e_border_button_bindings_ungrab_all(); if (cfdata->unit_method == 0) - t->conf->units = CELCIUS; + temperature_config->units = CELCIUS; else - t->conf->units = FAHRENHEIT; - - t->conf->poll_time = (double)cfdata->poll_method; - - if (t->conf->units == FAHRENHEIT) + temperature_config->units = FAHRENHEIT; + temperature_config->poll_time = (double)cfdata->poll_method; + if (temperature_config->units == FAHRENHEIT) { - t->conf->low = CEL_2_FAR(cfdata->low_method); - t->conf->high = CEL_2_FAR(cfdata->high_method); + temperature_config->low = CEL_2_FAR(cfdata->low_method); + temperature_config->high = CEL_2_FAR(cfdata->high_method); } else { - t->conf->low = cfdata->low_method; - t->conf->high = cfdata->high_method; + temperature_config->low = cfdata->low_method; + temperature_config->high = cfdata->high_method; } - - e_border_button_bindings_grab_all(); + _temperature_face_cb_config_updated(); e_config_save_queue(); - - /* Call Config Update */ - _temperature_face_cb_config_updated(t); return 1; } @@ -252,9 +236,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data { Evas_Object *o, *of, *ob; E_Radio_Group *rg; - Temperature *t; - - t = cfd->data; o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("Display Units"), 0); @@ -312,10 +293,10 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - cfdata->low_temp = t->conf->low; - cfdata->high_temp = t->conf->high; +// cfdata->low_temp = temperature_config->low; +// cfdata->high_temp = temperature_config->high; - if (t->conf->units == FAHRENHEIT) + if (cfdata->units == FAHRENHEIT) { /* round-off to closest 5 */ if (cfdata->high_temp % 5 > 3) @@ -357,14 +338,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Temperature *t; - - t = cfd->data; - - e_border_button_bindings_ungrab_all(); - - /* Check if Display Units has been toggled */ - if (cfdata->unit_method != t->conf->units) + if (cfdata->unit_method != temperature_config->units) { if (cfdata->unit_method == 0) { @@ -377,35 +351,29 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) cfdata->low_temp = CEL_2_FAR(cfdata->low_temp); } } - if (cfdata->unit_method == 0) - t->conf->units = CELCIUS; + temperature_config->units = CELCIUS; else - t->conf->units = FAHRENHEIT; - - t->conf->poll_time = cfdata->poll_time; - - t->conf->low = cfdata->low_temp; - t->conf->high = cfdata->high_temp; - + temperature_config->units = FAHRENHEIT; + temperature_config->poll_time = cfdata->poll_time; + temperature_config->low = cfdata->low_temp; + temperature_config->high = cfdata->high_temp; + if (temperature_config->sensor_name) + evas_stringshare_del(temperature_config->sensor_name); + temperature_config->sensor_name = NULL; switch (cfdata->sensor) { case 0: - t->conf->sensor_name = strdup("temp1"); + temperature_config->sensor_name = evas_stringshare_add("temp1"); break; case 1: - t->conf->sensor_name = strdup("temp2"); + temperature_config->sensor_name = evas_stringshare_add("temp2"); break; case 2: - t->conf->sensor_name = strdup("temp3"); + temperature_config->sensor_name = evas_stringshare_add("temp3"); break; } - - e_border_button_bindings_grab_all(); + _temperature_face_cb_config_updated(); e_config_save_queue(); - - /* Call Config Update */ - _temperature_face_cb_config_updated(t); - return 1; } diff --git a/src/modules/temperature/e_mod_config.h b/src/modules/temperature/e_mod_config.h deleted file mode 100644 index 22b42db6d..000000000 --- a/src/modules/temperature/e_mod_config.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifdef E_TYPEDEFS -#else -#ifndef E_MOD_CONFIG_H -#define E_MOD_CONFIG_H -#include "e_mod_main.h" -void _config_temperature_module(E_Container *con, Temperature *temp); -#endif -#endif diff --git a/src/modules/temperature/e_mod_main.c b/src/modules/temperature/e_mod_main.c index 1ad5a57da..9cde248f0 100644 --- a/src/modules/temperature/e_mod_main.c +++ b/src/modules/temperature/e_mod_main.c @@ -3,255 +3,153 @@ */ #include "e.h" #include "e_mod_main.h" -#include "e_mod_config.h" #ifdef __FreeBSD__ #include #include #endif -/* TODO List: - * - * which options should be in main menu, and which in face menu? - */ - -/* module private routines */ -static Temperature *_temperature_new(); -static void _temperature_free(Temperature *e); -static int _temperature_cb_check(void *data); - -static void _temperature_face_init(void *data, E_Gadget_Face *face); -static void _temperature_face_free(void *data, E_Gadget_Face *face); - -static void _temperature_face_level_set(E_Gadget_Face *face, double level); - -static E_Config_DD *conf_edd; -static E_Config_DD *conf_face_edd; - -/* public module routines. all modules must have these */ -EAPI E_Module_Api e_modapi = +/***************************************************************************/ +/**/ +/* gadcon requirements */ +static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient(E_Gadcon_Client *gcc); +/* and actually define the gadcon class that this module provides (just 1) */ +static const E_Gadcon_Client_Class _gadcon_class = { - E_MODULE_API_VERSION, - "Temperature" + GADCON_CLIENT_CLASS_VERSION, + "temperature", + { + _gc_init, _gc_shutdown, _gc_orient + } +}; +/**/ +/***************************************************************************/ + +/***************************************************************************/ +/**/ +/* actual module specifics */ + +typedef struct _Instance Instance; + +struct _Instance +{ + E_Gadcon_Client *gcc; + Evas_Object *o_temp; }; -EAPI void * -e_modapi_init(E_Module *m) +static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _menu_cb_post(void *data, E_Menu *m); +static int _temperature_cb_check(void *data); +static void _temperature_face_level_set(Instance *inst, double level); +static void _temperature_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); + +static E_Config_DD *conf_edd = NULL; + +Config *temperature_config = NULL; + +static E_Gadcon_Client * +_gc_init(E_Gadcon *gc, char *name, char *id, char *style) { - E_Gadget *gad = NULL; - E_Gadget_Api *api; - Temperature *e; - - e = _temperature_new(); - - /* set up our actual gadget */ - api = E_NEW(E_Gadget_Api, 1); - api->module = m; - api->name = "temperature"; - api->func_face_init = _temperature_face_init; - api->func_face_free = _temperature_face_free; - api->data = e; - - gad = e_gadget_new(api); - E_FREE(api); - - /* start the timer */ - e->gad = gad; - e->temperature_check_timer = ecore_timer_add(e->conf->poll_time, _temperature_cb_check, gad); - return gad; -} - -EAPI int -e_modapi_shutdown(E_Module *m) -{ - E_Gadget *gad; - Temperature *e; - - E_CONFIG_DD_FREE(conf_edd); - E_CONFIG_DD_FREE(conf_face_edd); - - gad = m->data; - if (!gad) return 0; - e = gad->data; - if (e) - { - if (e->config_dialog) - { - e_object_del(E_OBJECT(e->config_dialog)); - e->config_dialog = NULL; - } - _temperature_free(e); - } - e_object_del(E_OBJECT(gad)); - return 1; -} - -EAPI int -e_modapi_save(E_Module *m) -{ - E_Gadget *gad; - Temperature *e; - - gad = m->data; - if (!gad) return 0; - e = gad->data; - if (!e) return 0; - e_config_domain_save("module.temperature", conf_edd, e->conf); - return 1; -} - -EAPI int -e_modapi_info(E_Module *m) -{ - char buf[4096]; - - snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m)); - m->icon_file = strdup(buf); - return 1; -} - -EAPI int -e_modapi_about(E_Module *m) -{ - e_module_dialog_show(_("Enlightenment Temperature Module"), - _("A module to measure the ACPI Thermal sensor on Linux.
" - "It is especially useful for modern Laptops with high speed
" - "CPUs that generate a lot of heat.")); - return 1; -} - -EAPI int -e_modapi_config(E_Module *m) -{ - E_Gadget *gad; - Temperature *e; + Evas_Object *o; + E_Gadcon_Client *gcc; + Instance *inst; - gad = m->data; - if (!gad) return 0; - e = gad->data; - _config_temperature_module(e_container_current_get(e_manager_current_get()), e); - - return 1; -} - - - -/* module private routines */ -static Temperature * -_temperature_new() -{ - Temperature *e; - - e = E_NEW(Temperature, 1); - if (!e) return NULL; - - /* create the config edd */ - conf_face_edd = E_CONFIG_DD_NEW("Temperature_Config_Face", Config_Face); -#undef T -#undef D -#define T Config_Face -#define D conf_face_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); - - conf_edd = E_CONFIG_DD_NEW("Temperature_Config", Config); -#undef T -#undef D -#define T Config -#define D conf_edd - E_CONFIG_VAL(D, T, poll_time, DOUBLE); - E_CONFIG_VAL(D, T, low, INT); - E_CONFIG_VAL(D, T, high, INT); - E_CONFIG_LIST(D, T, faces, conf_face_edd); - E_CONFIG_VAL(D, T, sensor_name, STR); - E_CONFIG_VAL(D, T, units, INT); - - e->conf = e_config_domain_load("module.temperature", conf_edd); - if (!e->conf) - { - e->conf = E_NEW(Config, 1); - e->conf->poll_time = 10.0; - e->conf->low = 30; - e->conf->high = 80; - e->conf->sensor_name = "temp1"; - e->conf->units = CELCIUS; - } - E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0); - E_CONFIG_LIMIT(e->conf->low, 0, 100); - E_CONFIG_LIMIT(e->conf->high, 0, 220); - E_CONFIG_LIMIT(e->conf->units, CELCIUS, FAHRENHEIT); - - e->have_temp = -1; - - return e; -} - -void _temperature_face_init(void *data, E_Gadget_Face *face) -{ - Temperature *e; - Temperature_Face *ef; - E_Gadman_Policy policy; - - e = data; - - ef = E_NEW(Temperature_Face, 1); - if (!ef) return; - - e_gadget_face_theme_set(face, "base/theme/modules/temperature", + inst = E_NEW(Instance, 1); + + o = edje_object_add(gc->evas); + e_theme_edje_object_set(o, "base/theme/modules/temperature", "modules/temperature/main"); + + gcc = e_gadcon_client_new(gc, name, id, style, o); + gcc->data = inst; + + inst->gcc = gcc; + inst->o_temp = o; + + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _button_cb_mouse_down, inst); + temperature_config->instances = evas_list_append(temperature_config->instances, inst); + temperature_config->have_temp = -1; + _temperature_cb_check(NULL); + return gcc; +} - policy = E_GADMAN_POLICY_ANYWHERE | - E_GADMAN_POLICY_HMOVE | - E_GADMAN_POLICY_VMOVE | - E_GADMAN_POLICY_HSIZE | - E_GADMAN_POLICY_VSIZE; +static void +_gc_shutdown(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + temperature_config->instances = evas_list_remove(temperature_config->instances, inst); + evas_object_del(inst->o_temp); + free(inst); +} - e_gadman_client_policy_set(face->gmc, policy); +static void +_gc_orient(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + e_gadcon_client_aspect_set(gcc, 16, 16); + e_gadcon_client_min_size_set(gcc, 16, 16); +} +/**/ +/***************************************************************************/ - ef->conf = evas_list_nth(e->conf->faces, face->face_num); - if (!ef->conf) +/***************************************************************************/ +/**/ +static void +_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Instance *inst; + Evas_Event_Mouse_Down *ev; + + inst = data; + ev = event_info; + if ((ev->button == 3) && (!temperature_config->menu)) { - ef->conf = E_NEW(Config_Face, 1); - ef->conf->enabled = 1; - e->conf->faces = evas_list_append(e->conf->faces, ef->conf); + E_Menu *mn; + E_Menu_Item *mi; + int cx, cy, cw, ch; + + mn = e_menu_new(); + e_menu_post_deactivate_callback_set(mn, _menu_cb_post, inst); + temperature_config->menu = mn; + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Configuration")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); + e_menu_item_callback_set(mi, _temperature_face_cb_menu_configure, NULL); + + e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0); + + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, + &cx, &cy, &cw, &ch); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); } - - face->data = ef; - - _temperature_cb_check(face->gad); - - return; } static void -_temperature_free(Temperature *e) +_menu_cb_post(void *data, E_Menu *m) { - Evas_List *l; - - ecore_timer_del(e->temperature_check_timer); - - for (l = e->conf->faces; l; l = l->next) - free(l->data); - evas_list_free(e->conf->faces); - free(e->conf); - free(e); -} - -static void -_temperature_face_free(void *data, E_Gadget_Face *face) -{ - Temperature_Face *ef; - ef = face->data; - - free(ef); + if (!temperature_config->menu) return; + e_object_del(E_OBJECT(temperature_config->menu)); + temperature_config->menu = NULL; } static int _temperature_cb_check(void *data) { - E_Gadget *gad; - E_Gadget_Face *face; - Temperature *t; int ret = 0; + Instance *inst; Ecore_List *therms; Evas_List *l; int temp = 0; @@ -261,11 +159,6 @@ _temperature_cb_check(void *data) int len; #endif - gad = data; - if (!gad) return 0; - t = gad->data; - if (!t) return 0; - #ifdef __FreeBSD__ if (mib[0] == -1) { @@ -305,7 +198,7 @@ _temperature_cb_check(void *data) { char *name, *sensor; - sensor = t->conf->sensor_name; + sensor = temperature_config->sensor_name; if (!sensor) sensor = "temp1"; while ((name = ecore_list_next(therms))) @@ -370,77 +263,183 @@ _temperature_cb_check(void *data) } #endif - if (t->conf->units == FAHRENHEIT) - temp = (temp * 9.0 / 5.0) + 32; + if (temperature_config->units == FAHRENHEIT) + temp = (temp * 9.0 / 5.0) + 32; if (ret) { char *utf8; - if (t->have_temp != 1) + if (temperature_config->have_temp != 1) { /* enable therm object */ - for (l = gad->faces; l; l = l->next) + for (l = temperature_config->instances; l; l = l->next) { - face = l->data; - edje_object_signal_emit(face->main_obj, "known", ""); + inst = l->data; + edje_object_signal_emit(inst->o_temp, "known", ""); } - t->have_temp = 1; + temperature_config->have_temp = 1; } - if (t->conf->units == FAHRENHEIT) + if (temperature_config->units == FAHRENHEIT) snprintf(buf, sizeof(buf), "%i°F", temp); else snprintf(buf, sizeof(buf), "%i°C", temp); utf8 = ecore_txt_convert("iso-8859-1", "utf-8", buf); - for (l = gad->faces; l; l = l->next) + for (l = temperature_config->instances; l; l = l->next) { - face = l->data; - _temperature_face_level_set(face, - (double)(temp - t->conf->low) / - (double)(t->conf->high - t->conf->low)); - - edje_object_part_text_set(face->main_obj, "reading", utf8); + inst = l->data; + _temperature_face_level_set(inst, + (double)(temp - temperature_config->low) / + (double)(temperature_config->high - temperature_config->low)); + edje_object_part_text_set(inst->o_temp, "reading", utf8); } free(utf8); } else { - if (t->have_temp != 0) + if (temperature_config->have_temp != 0) { /* disable therm object */ - for (l = gad->faces; l; l = l->next) - + for (l = temperature_config->instances; l; l = l->next) { - face = l->data; - edje_object_signal_emit(face->main_obj, "unknown", ""); - edje_object_part_text_set(face->main_obj, "reading", "NO TEMP"); - _temperature_face_level_set(face, 0.5); + inst = l->data; + edje_object_signal_emit(inst->o_temp, "unknown", ""); + edje_object_part_text_set(inst->o_temp, "reading", "NO TEMP"); + _temperature_face_level_set(inst, 0.5); } - t->have_temp = 0; + temperature_config->have_temp = 0; } } return 1; } static void -_temperature_face_level_set(E_Gadget_Face *face, double level) +_temperature_face_level_set(Instance *inst, double level) { Edje_Message_Float msg; if (level < 0.0) level = 0.0; else if (level > 1.0) level = 1.0; msg.val = level; - edje_object_message_send(face->main_obj, EDJE_MESSAGE_FLOAT, 1, &msg); + edje_object_message_send(inst->o_temp, EDJE_MESSAGE_FLOAT, 1, &msg); +} + +static void +_temperature_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi) +{ + if (!temperature_config) return; + if (temperature_config->config_dialog) return; + _config_temperature_module(); } void -_temperature_face_cb_config_updated(Temperature *temp) +_temperature_face_cb_config_updated(void) { - /* Call all funcs needed to handle update */ - ecore_timer_del(temp->temperature_check_timer); - temp->temperature_check_timer = ecore_timer_add(temp->conf->poll_time, _temperature_cb_check, temp->gad); - + ecore_timer_del(temperature_config->temperature_check_timer); + temperature_config->temperature_check_timer = + ecore_timer_add(temperature_config->poll_time, _temperature_cb_check, + NULL); } +/***************************************************************************/ +/**/ +/* module setup */ +EAPI E_Module_Api e_modapi = +{ + E_MODULE_API_VERSION, + "Temperature" +}; + +EAPI void * +e_modapi_init(E_Module *m) +{ + conf_edd = E_CONFIG_DD_NEW("Temperature_Config", Config); +#undef T +#undef D +#define T Config +#define D conf_edd + E_CONFIG_VAL(D, T, poll_time, DOUBLE); + E_CONFIG_VAL(D, T, low, INT); + E_CONFIG_VAL(D, T, high, INT); + E_CONFIG_VAL(D, T, sensor_name, STR); + E_CONFIG_VAL(D, T, units, INT); + + temperature_config = e_config_domain_load("module.temperature", conf_edd); + if (!temperature_config) + { + temperature_config = E_NEW(Config, 1); + temperature_config->poll_time = 10.0; + temperature_config->low = 30; + temperature_config->high = 80; + temperature_config->sensor_name = evas_stringshare_add("temp1"); + temperature_config->units = CELCIUS; + } + E_CONFIG_LIMIT(temperature_config->poll_time, 0.5, 1000.0); + E_CONFIG_LIMIT(temperature_config->low, 0, 100); + E_CONFIG_LIMIT(temperature_config->high, 0, 220); + E_CONFIG_LIMIT(temperature_config->units, CELCIUS, FAHRENHEIT); + + temperature_config->have_temp = -1; + temperature_config->temperature_check_timer = + ecore_timer_add(temperature_config->poll_time, _temperature_cb_check, + NULL); + e_gadcon_provider_register(&_gadcon_class); + return 1; +} + +EAPI int +e_modapi_shutdown(E_Module *m) +{ + e_gadcon_provider_unregister(&_gadcon_class); + + if (temperature_config->config_dialog) + e_object_del(E_OBJECT(temperature_config->config_dialog)); + if (temperature_config->temperature_check_timer) + ecore_timer_del(temperature_config->temperature_check_timer); + if (temperature_config->sensor_name) + evas_stringshare_del(temperature_config->sensor_name); + free(temperature_config); + temperature_config = NULL; + E_CONFIG_DD_FREE(conf_edd); + return 1; +} + +EAPI int +e_modapi_save(E_Module *m) +{ + e_config_domain_save("module.temperature", conf_edd, temperature_config); + return 1; +} + +EAPI int +e_modapi_info(E_Module *m) +{ + char buf[4096]; + + snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m)); + m->icon_file = strdup(buf); + return 1; +} + +EAPI int +e_modapi_about(E_Module *m) +{ + e_module_dialog_show(_("Enlightenment Temperature Module"), + _("A module to measure the ACPI Thermal sensor on Linux.
" + "It is especially useful for modern Laptops with high speed
" + "CPUs that generate a lot of heat.")); + return 1; +} + +EAPI int +e_modapi_config(E_Module *m) +{ + if (!temperature_config) return 0; + if (temperature_config->config_dialog) return 0; + _config_temperature_module(); + return 1; +} +/**/ +/***************************************************************************/ diff --git a/src/modules/temperature/e_mod_main.h b/src/modules/temperature/e_mod_main.h index b766f16bf..187125c9c 100644 --- a/src/modules/temperature/e_mod_main.h +++ b/src/modules/temperature/e_mod_main.h @@ -5,9 +5,6 @@ #define E_MOD_MAIN_H typedef struct _Config Config; -typedef struct _Config_Face Config_Face; -typedef struct _Temperature Temperature; -typedef struct _Temperature_Face Temperature_Face; typedef enum _Unit { @@ -17,32 +14,17 @@ typedef enum _Unit struct _Config { - double poll_time; - int low, high; - Evas_List *faces; - char *sensor_name; - Unit units; -}; - -struct _Config_Face -{ - unsigned char enabled; -}; - -struct _Temperature -{ - Config *conf; - Ecore_Timer *temperature_check_timer; - E_Config_Dialog *config_dialog; + /* saved * loaded config values */ + double poll_time; + int low, high; + char *sensor_name; + Unit units; + /* just config state */ + E_Config_Dialog *config_dialog; + Evas_List *instances; + E_Menu *menu; + Ecore_Timer *temperature_check_timer; unsigned char have_temp; - E_Gadget *gad; -}; - -struct _Temperature_Face -{ - Temperature *temp; - Config_Face *conf; - }; EAPI extern E_Module_Api e_modapi; @@ -54,6 +36,9 @@ EAPI int e_modapi_info (E_Module *m); EAPI int e_modapi_about (E_Module *m); EAPI int e_modapi_config (E_Module *m); -void _temperature_face_cb_config_updated(Temperature *temp); +void _config_temperature_module(void); +void _temperature_face_cb_config_updated(void); +extern Config *temperature_config; + #endif