BUGS / FIXES
-------------------------------------------------------------------------------
+* BUG: edge flip for desktops still active if turned off when dragging a window
+ off the desktop - either a separate config value (recommended) or turn it
+ off for window dragging too
* BUG: general settings is too... general
* BUG: desktop settings is missing preview
* BUG: modules need to destroy config dialogs on shutdown (otherwise - segv!)
"NICE TO HAVE" FEATURES
-------------------------------------------------------------------------------
+* winlist and exebuf can let the mouse select items
* option to NOT raise on focus in click to focus
* switch to desktop of a new window if it opens on another desktop than the
current one
src/modules/temperature/Makefile
src/modules/cpufreq/Makefile
src/modules/ibox/Makefile
+src/modules/itray/Makefile
src/modules/start/Makefile
src/modules/randr/Makefile
src/preload/Makefile
default_error.edc \
default_cpufreq.edc \
default_ibox.edc \
+default_itray.edc \
default_start.edc \
default_winlist.edc \
default_transitions.edc \
#include "default_error.edc"
#include "default_cpufreq.edc"
#include "default_ibox.edc"
+#include "default_itray.edc"
#include "default_start.edc"
#include "default_winlist.edc"
#include "default_transitions.edc"
--- /dev/null
+images {
+ image: "e17_ibar_bg_h.png" COMP;
+ image: "e17_ibar_bg_v.png" COMP;
+ image: "e17_ibar_lamp_d.png" COMP;
+ image: "e17_ibar_lamp_l.png" COMP;
+ image: "e17_ibar_lamp_r.png" COMP;
+ image: "e17_ibar_lamp_u.png" COMP;
+ image: "e17_ibar_over_h.png" COMP;
+ image: "e17_ibar_over_v.png" COMP;
+}
+group {
+ name: "modules/itray/main";
+ data {
+ // item: "item_list", "item item2 item3";
+ }
+ script {
+ public orient;
+ }
+ parts {
+ part {
+ name: "background";
+ mouse_events: 1;
+ 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;
+ }
+ }
+ description {
+ state: "vert" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "e17_ibar_bg_v.png";
+ }
+ }
+ }
+ 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: "items";
+ type: SWALLOW;
+ mouse_events: 0;
+ clip_to: "items_clip";
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1 {
+ offset: 4 4;
+ }
+ rel2 {
+ offset: -5 -5;
+ }
+ color: 0 0 0 0;
+ }
+ description {
+ state: "top" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "left" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "right" 0.0;
+ inherit: "default" 0.0;
+ }
+ }
+ part {
+ name: "tray";
+ type: SWALLOW;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1 { offset: 7 6; }
+ rel2 { offset: -7 -6; }
+ color: 0 0 255 64;
+ }
+ }
+ part {
+ name: "overlay";
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ image {
+ normal: "e17_ibar_over_h.png";
+ border: 13 13 13 13;
+ middle: 0;
+ }
+ fill {
+ smooth: 0;
+ }
+ }
+ description {
+ state: "top" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "left" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "right" 0.0;
+ inherit: "default" 0.0;
+ }
+ }
+ part {
+ name: "inn";
+ type: RECT;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "orient";
+ signal: "set_orientation";
+ source: "*";
+ script {
+ // sig, src
+ if (!strcmp(src, "left")) {
+ set_int(orient, 0);
+ set_state(PART:"background", "vert", 0.0);
+ set_state(PART:"overlay", "left", 0.0);
+ set_state(PART:"items", "left", 0.0);
+ }
+ else if (!strcmp(src, "right")) {
+ set_int(orient, 1);
+ set_state(PART:"background", "vert", 0.0);
+ set_state(PART:"overlay", "right", 0.0);
+ set_state(PART:"items", "right", 0.0);
+ }
+ else if (!strcmp(src, "top")) {
+ set_int(orient, 2);
+ set_state(PART:"background", "default", 0.0);
+ set_state(PART:"overlay", "top", 0.0);
+ set_state(PART:"items", "top", 0.0);
+ }
+ else if (!strcmp(src, "bottom")) {
+ set_int(orient, 3);
+ set_state(PART:"background", "default", 0.0);
+ set_state(PART:"overlay", "default", 0.0);
+ set_state(PART:"items", "default", 0.0);
+ }
+ }
+ }
+ }
+}
+
+group {
+ name: "modules/itray/follower";
+ min: 56 56;
+ data {
+ // item: "item_list", "item item2 item3";
+ }
+ parts {
+ part {
+ name: "top";
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ offset: 0 -14;
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ offset: -1 26;
+ }
+ image {
+ normal: "e17_ibar_lamp_d.png";
+ }
+ }
+ description {
+ state: "top" 0.0;
+ rel1 {
+ relative: 0.0 1.0;
+ offset: 0 -26;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: -1 14;
+ }
+ image {
+ normal: "e17_ibar_lamp_u.png";
+ }
+ }
+ description {
+ state: "right" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ offset: -14 0;
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ offset: 26 -1;
+ }
+ image {
+ normal: "e17_ibar_lamp_r.png";
+ }
+ }
+ description {
+ state: "left" 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ offset: -26 0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: 14 -1;
+ }
+ image {
+ normal: "e17_ibar_lamp_l.png";
+ }
+ }
+ }
+ program {
+ name: "orient";
+ signal: "set_orientation";
+ source: "bottom";
+ action: STATE_SET "default" 0.0;
+ target: "top";
+ }
+ program {
+ name: "orient2";
+ signal: "set_orientation";
+ source: "top";
+ action: STATE_SET "top" 0.0;
+ target: "top";
+ }
+ program {
+ name: "orient3";
+ signal: "set_orientation";
+ source: "left";
+ action: STATE_SET "left" 0.0;
+ target: "top";
+ }
+ program {
+ name: "orient4";
+ signal: "set_orientation";
+ source: "right";
+ action: STATE_SET "right" 0.0;
+ target: "top";
+ }
+ }
+}
+
if ((bd->shaded) || (bd->shading)) return;
if (bd->fullscreen)
e_border_unfullscreen(bd);
- if( bd->maximized == E_MAXIMIZE_VERTICAL && max == E_MAXIMIZE_VERTICAL )
+ if (bd->maximized == E_MAXIMIZE_VERTICAL && max == E_MAXIMIZE_VERTICAL)
; // ignore. we are already maximized vertical.
- else if( bd->maximized == E_MAXIMIZE_HORIZONTAL && max == E_MAXIMIZE_HORIZONTAL )
+ else if (bd->maximized == E_MAXIMIZE_HORIZONTAL && max == E_MAXIMIZE_HORIZONTAL)
; // ignore. we are already maximized horizontaly.
- else if ( ( bd->maximized == E_MAXIMIZE_NONE ||
- bd->maximized == E_MAXIMIZE_VERTICAL ||
- bd->maximized == E_MAXIMIZE_HORIZONTAL )
- )
+ else if (( bd->maximized == E_MAXIMIZE_NONE ||
+ bd->maximized == E_MAXIMIZE_VERTICAL ||
+ bd->maximized == E_MAXIMIZE_HORIZONTAL))
{
int x1, y1, x2, y2;
int w, h;
return;
}
- if( !bd->maximized ) // E_MAXIMIZE_NONE
- {
- bd->saved.x = bd->x;
- bd->saved.y = bd->y;
- bd->saved.w = bd->w;
- bd->saved.h = bd->h;
- }
+ if (!bd->maximized) // E_MAXIMIZE_NONE
+ {
+ bd->saved.x = bd->x;
+ bd->saved.y = bd->y;
+ bd->saved.w = bd->w;
+ bd->saved.h = bd->h;
+ }
e_hints_window_size_set(bd);
e_border_raise(bd);
e_border_move_resize(bd, x1, y1, w, h);
break;
case E_MAXIMIZE_VERTICAL:
- x1 = bd->zone->x;
+ x1 = bd->x;
y1 = bd->zone->y;
- x2 = bd->zone->x + bd->zone->w;
+ x2 = bd->x + bd->w;
y2 = bd->zone->y + bd->zone->h;
/* walk through all gadgets */
- e_maximize_border_gadman_fill(bd, &x1, &y1, &x2, &y2);
+ e_maximize_border_gadman_fit(bd, &x1, &y1, &x2, &y2);
/* walk through docks and toolbars */
//e_maximize_border_dock_fit(bd, &x1, &y1, &x2, &y2);
break;
case E_MAXIMIZE_HORIZONTAL:
x1 = bd->zone->x;
- y1 = bd->zone->y;
+ y1 = bd->y;
x2 = bd->zone->x + bd->zone->w;
- y2 = bd->zone->y + bd->zone->h;
+ y2 = bd->y + bd->h;
/* walk through all gadgets */
- e_maximize_border_gadman_fill(bd, &x1, &y1, &x2, &y2);
+ e_maximize_border_gadman_fit(bd, &x1, &y1, &x2, &y2);
/* walk through docks and toolbars */
//e_maximize_border_dock_fit(bd, &x1, &y1, &x2, &y2);
e_border_move_resize(bd,x1,y1,w,h);
break;
}
- if( (bd->maximized == E_MAXIMIZE_HORIZONTAL && max == E_MAXIMIZE_VERTICAL) ||
- (bd->maximized == E_MAXIMIZE_VERTICAL && max == E_MAXIMIZE_HORIZONTAL) )
+ if ((bd->maximized == E_MAXIMIZE_HORIZONTAL && max == E_MAXIMIZE_VERTICAL) ||
+ (bd->maximized == E_MAXIMIZE_VERTICAL && max == E_MAXIMIZE_HORIZONTAL))
bd->maximized = e_config->maximize_policy;
else
bd->maximized = max;
case E_MAXIMIZE_SMART:
case E_MAXIMIZE_EXPAND:
case E_MAXIMIZE_FILL:
- if( max == E_MAXIMIZE_VERTICAL )
- {
- bd->maximized = E_MAXIMIZE_NONE;
- e_hints_window_maximized_set(bd, 0);
+ if (max == E_MAXIMIZE_VERTICAL)
+ {
+ bd->maximized = E_MAXIMIZE_NONE;
+ e_hints_window_maximized_set(bd, 0);
- bd->maximized = E_MAXIMIZE_HORIZONTAL;
- e_hints_window_maximized_set(bd, 1);
+ bd->maximized = E_MAXIMIZE_HORIZONTAL;
+ e_hints_window_maximized_set(bd, 1);
- e_border_move_resize( bd, bd->x, bd->saved.y, bd->w, bd->saved.h);
- e_hints_window_size_unset(bd);
+ e_border_move_resize(bd, bd->x, bd->saved.y, bd->w, bd->saved.h);
+ e_hints_window_size_unset(bd);
- //edje_object_signal_emit(bd->bg_object, "unmaximize", "");
- }
- if( max == E_MAXIMIZE_HORIZONTAL )
- {
- bd->maximized = E_MAXIMIZE_NONE;
- e_hints_window_maximized_set(bd, 0);
+ //edje_object_signal_emit(bd->bg_object, "unmaximize", "");
+ }
+ if (max == E_MAXIMIZE_HORIZONTAL)
+ {
+ bd->maximized = E_MAXIMIZE_NONE;
+ e_hints_window_maximized_set(bd, 0);
- bd->maximized = E_MAXIMIZE_VERTICAL;
- e_hints_window_maximized_set(bd, 1);
+ bd->maximized = E_MAXIMIZE_VERTICAL;
+ e_hints_window_maximized_set(bd, 1);
- e_border_move_resize( bd, bd->saved.x, bd->y, bd->saved.w, bd->h);
- e_hints_window_size_unset(bd);
+ e_border_move_resize(bd, bd->saved.x, bd->y, bd->saved.w, bd->h);
+ e_hints_window_size_unset(bd);
- //edje_object_signal_emit(bd->bg_object, "unmaximize", "");
- }
+ //edje_object_signal_emit(bd->bg_object, "unmaximize", "");
+ }
break;
case E_MAXIMIZE_VERTICAL:
- if( max == E_MAXIMIZE_HORIZONTAL )
+ if (max == E_MAXIMIZE_HORIZONTAL)
; // do nothing in this case
- if( max == E_MAXIMIZE_VERTICAL )
- {
- bd->maximized = E_MAXIMIZE_NONE;
- e_hints_window_maximized_set(bd, 0);
+ if (max == E_MAXIMIZE_VERTICAL)
+ {
+ bd->maximized = E_MAXIMIZE_NONE;
+ e_hints_window_maximized_set(bd, 0);
- e_border_move_resize( bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h);
- bd->saved.x = bd->saved.y = bd->saved.w = bd->saved.h = 0;
- e_hints_window_size_unset(bd);
+ e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h);
+ bd->saved.x = bd->saved.y = bd->saved.w = bd->saved.h = 0;
+ e_hints_window_size_unset(bd);
- edje_object_signal_emit(bd->bg_object, "unmaximize", "");
- }
+ edje_object_signal_emit(bd->bg_object, "unmaximize", "");
+ }
break;
case E_MAXIMIZE_HORIZONTAL:
if( max == E_MAXIMIZE_VERTICAL )
E_GADMAN_POLICY_HSIZE = 1 << 9,
E_GADMAN_POLICY_VSIZE = 1 << 10,
E_GADMAN_POLICY_HMOVE = 1 << 11,
- E_GADMAN_POLICY_VMOVE = 1 << 12
+ E_GADMAN_POLICY_VMOVE = 1 << 12,
+ /* more extra flags */
+ E_GADMAN_POLICY_ALLOW_OVERLAP = 1 << 15,
+ E_GADMAN_POLICY_ALWAYS_ON_TOP = 1 << 16 // not used yet
} E_Gadman_Policy;
typedef enum _E_Gadman_Change
int x1, y1, x2, y2;
};
+struct _m_zone
+{
+ int x1;
+ int y1;
+ int x2;
+ int y2;
+ int area;
+};
+
#define OBSTACLE(_x1, _y1, _x2, _y2) \
{ \
r = E_NEW(E_Maximize_Rect, 1); \
static void _e_maximize_border_rects_fill(E_Border *bd, Evas_List *list, int *x1, int *y1, int *x2, int *y2);
+static int _e_mzone_split(Evas_List **add_splits_to, struct _m_zone *mzone, E_Gadman_Client *gmc);
+
+int _e_mzone_cb_square_reverse_sort(void *e1, void *e2);
+int _e_mzone_cb_width_reverse_sort(void *e1, void *e2);
+int _e_mzone_cb_height_reverse_sort(void *e1, void *e2); // not used yet
+
EAPI void
e_maximize_border_gadman_fit(E_Border *bd, int *x1, int *y1, int *x2, int *y2)
{
- Evas_List *l;
- int cx1, cx2, cy1, cy2;
+ int ii, jj;
+ Evas_List *l, *ll;
- cx1 = bd->zone->x;
- if (x1) cx1 = *x1;
-
- cy1 = bd->zone->y;
- if (y1) cy1 = *y1;
-
- cx2 = bd->zone->x + bd->zone->w;
- if (x2) cx2 = *x2;
+ Evas_List *mzones = NULL;
+ Evas_List *tmp_mzones = NULL;
- cy2 = bd->zone->y + bd->zone->h;
- if (y2) cy2 = *y2;
+ struct _m_zone *mzone = NULL;
+ struct _m_zone *mzone_split;
- /* Find the smallest box */
- for (l = bd->zone->container->gadman->clients; l; l = l->next)
- {
- E_Gadman_Client *gmc;
- double ax, ay;
+ mzone = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone == NULL)
+ return;
- gmc = l->data;
- if ((gmc->zone != bd->zone)) continue;
+ mzone->x1 = bd->zone->x;
+ if (x1) mzone->x1 = *x1;
+
+ mzone->y1 = bd->zone->y;
+ if (y1) mzone->y1 = *y1;
- ax = gmc->ax;
- ay = gmc->ay;
+ mzone->x2 = bd->zone->x + bd->zone->w;
+ if (x2) mzone->x2 = *x2;
- if (((ax == 0.0) || (ax == 1.0)) &&
- ((ay == 0.0) || (ay == 1.0)))
+ mzone->y2 = bd->zone->y + bd->zone->h;
+ if (y2) mzone->y2 = *y2;
+
+ mzones = evas_list_append(mzones, mzone);
+
+ for(l = bd->zone->container->gadman->clients; l; l = l->next)
+ {
+ E_Gadman_Client *gmc;
+
+ gmc = l->data;
+ if (gmc->zone != bd->zone || gmc->policy & E_GADMAN_POLICY_ALLOW_OVERLAP) continue;
+
+ tmp_mzones = mzones;
+ mzones = NULL;
+
+ for (ll = tmp_mzones; ll; ll = ll->next)
+ {
+ int res;
+ mzone = ll->data;
+
+ res = _e_mzone_split(&mzones, mzone, gmc);
+ if (res == 0)
{
- /* corner gadget */
- /* Fake removal from one alignment :) */
- if (gmc->w > gmc->h)
- ax = 0.5;
- else
- ay = 0.5;
+ if(mzones == NULL)
+ mzones = evas_list_append(mzones, mzone);
+ else
+ evas_list_append(mzones , mzone);
+ ll->data = NULL;
}
+ else if (res == 2)
+ ;
+ else if (res == -1)
+ ; /* mem problems. Let ignor them yet */
- 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;
- }
+ if (ll->data != NULL)
+ {
+ free(ll->data);
+ ll->data = NULL;
+ }
+ }
+ evas_list_free(tmp_mzones);
+ tmp_mzones = NULL;
+ }
- if (x1) *x1 = cx1;
- if (y1) *y1 = cy1;
- if (x2) *x2 = cx2;
- if (y2) *y2 = cy2;
+ for (l = mzones; l; l = l->next)
+ {
+ mzone = l->data;
+ mzone->area = (mzone->x2 - mzone->x1) * (mzone->y2 - mzone->y1);
+ }
+
+ tmp_mzones = evas_list_sort(mzones, evas_list_count(mzones), _e_mzone_cb_square_reverse_sort);
+ mzones = NULL;
+
+ mzones = evas_list_append(mzones, tmp_mzones->data);
+
+ for (l = tmp_mzones->next; l; l = l->next)
+ {
+ if ( ((struct _m_zone *)l->data)->area ==
+ ((struct _m_zone *)mzones->data)->area)
+ evas_list_append(mzones, l->data);
+ else
+ free(l->data);
+ }
+ tmp_mzones = evas_list_free(tmp_mzones);
+ tmp_mzones = NULL;
+
+ if (mzones != NULL && mzones->next == NULL)
+ {
+ mzone = mzones->data;
+ *x1 = mzone->x1;
+ *y1 = mzone->y1;
+ *x2 = mzone->x2;
+ *y2 = mzone->y2;
+ }
+ else if (mzones != NULL && mzones->next != NULL)
+ {
+ Evas_List *wl = NULL, *hl = NULL;
+
+ /* The use of *_width_reverse_sort or *_height_reverse_sort depends
+ * on the preferences of the user - what window he/she would like to
+ * have: (i) maximized verticaly or (ii) horisontaly.
+ */
+ wl = evas_list_sort(mzones, evas_list_count(mzones), _e_mzone_cb_width_reverse_sort);
+ mzones = NULL;
+ // hl = evas_list_sort(mzones, -1, _e_mzone_cb_height_reverse_sort);
+
+ mzone = wl->data;
+ //mzone = hl->data;
+ *x1 = mzone->x1;
+ *y1 = mzone->y1;
+ *x2 = mzone->x2;
+ *y2 = mzone->y2;
+
+ // evas_list_free( wl );
+ // evas_list_free( hl );
+
+ mzones = wl;
+ }
+
+ for (l = mzones; l ; l = l->next)
+ if (l->data != NULL)
+ free(l->data);
+ mzones = evas_list_free(mzones);
}
EAPI void
if (x2) *x2 = cx2;
if (y2) *y2 = cy2;
}
+
+int _e_mzone_split(Evas_List **add_splits_to, struct _m_zone *mzone, E_Gadman_Client *gmc)
+{
+ int ii;
+ int mzone_splitted = 0;
+ struct _m_zone *mzone_split = NULL;
+
+ if (mzone == NULL || gmc == NULL)
+ return -1;
+
+ if ((mzone->x2 - mzone->x1) <= 0 || (mzone->y2 - mzone->y1) <= 0)
+ return 1;
+
+ if (gmc->x > mzone->x1 && gmc->y > mzone->y1 &&
+ gmc->x + gmc->w < mzone->x2 && gmc->y + gmc->h < mzone->y2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 8; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if(mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 1:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = gmc->y;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y + gmc->h;
+ break;
+ case 2:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 3:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = gmc->y + gmc->h;
+ break;
+ case 4:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 5:
+ mzone_split->x1 = gmc->x;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x + gmc->w;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 6:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 7:
+ mzone_split->x1 = gmc->x;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = gmc->x + gmc->w;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ } // if
+ else if (gmc->x + gmc->w > mzone->x1 && gmc->x + gmc->w < mzone->x2 &&
+ gmc->y + gmc->h > mzone->y1 && gmc->y + gmc->h < mzone->y2 &&
+ gmc->x <= mzone->x1 && gmc->y <= mzone->y1)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 4; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y + gmc->h;
+ break;
+ case 1:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 2:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 3:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = gmc->x + gmc->w;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x > mzone->x1 && gmc->y <= mzone->y1 &&
+ gmc->x + gmc->w < mzone->x2 &&
+ gmc->y + gmc->h > mzone->y1 && gmc->y + gmc->h < mzone->y2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 6; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = gmc->y + gmc->h;
+ break;
+ case 1:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y + gmc->h;
+ break;
+ case 2:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 3:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 4:
+ mzone_split->x1 = gmc->x;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = gmc->x + gmc->w;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 5:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x > mzone->x1 && gmc->x < mzone->x2 &&
+ gmc->y + gmc->h > mzone->y1 && gmc->y + gmc->h < mzone->y2 &&
+ gmc->y <= mzone->y1 &&
+ gmc->x + gmc->w >= mzone->x2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 4; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = gmc->y + gmc->h;
+ break;
+ case 1:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 2:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 3:
+ mzone_split->x1 = gmc->x;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x > mzone->x1 && gmc->x < mzone->x2 &&
+ gmc->y > mzone->y1 &&
+ gmc->y + gmc->h < mzone->y2 &&
+ gmc->x + gmc->w >= mzone->x2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 6; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 1:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = gmc->y + gmc->h;
+ break;
+ case 2:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 3:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 4:
+ mzone_split->x1 = gmc->x;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 5:
+ mzone_split->x1 = gmc->x;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x > mzone->x1 && gmc->x < mzone->x2 &&
+ gmc->y > mzone->y1 && gmc->y < mzone->y2 &&
+ gmc->x + gmc->w >= mzone->x2 &&
+ gmc->y + gmc->h >= mzone->y2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 4; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 1:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 2:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 3:
+ mzone_split->x1 = gmc->x;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x > mzone->x1 &&
+ gmc->y > mzone->y1 && gmc->y < mzone->y2 &&
+ gmc->x + gmc->w < mzone->x2 &&
+ gmc->y + gmc->h >= mzone->y2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 6; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 1:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 2:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = gmc->y;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 3:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 4:
+ mzone_split->x1 = gmc->x;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x + gmc->w;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 5:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if(*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x <= mzone->x1 &&
+ gmc->y > mzone->y1 && gmc->y < mzone->y2 &&
+ gmc->x + gmc->w > mzone->x1 && gmc->x + gmc->w < mzone->x2 &&
+ gmc->y + gmc->h >= mzone->y2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 4; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 1:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = gmc->y;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 2:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x + gmc->w;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 3:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x <= mzone->x1 &&
+ gmc->y > mzone->y1 &&
+ gmc->y + gmc->h < mzone->y2 &&
+ gmc->x + gmc->w > mzone->x1 && gmc->x + gmc->w < mzone->x2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 6; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 1:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = gmc->y;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y + gmc->h;
+ break;
+ case 2:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 3:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x + gmc->w;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 4:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 5:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = gmc->x + gmc->w;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x <= mzone->x1 && gmc->y <= mzone->y1 &&
+ gmc->x + gmc->w >= mzone->x2 &&
+ gmc->y + gmc->h > mzone->y1 &&
+ gmc->y + gmc->h < mzone->y2)
+ {
+ mzone_splitted = 1;
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ else if (gmc->x <= mzone->x1 &&
+ gmc->x + gmc->w >= mzone->x2 &&
+ gmc->y > mzone->y1 && gmc->y < mzone->y2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 2; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+ break;
+ case 1:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = gmc->y + gmc->h;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x <= mzone->x1 &&
+ gmc->x + gmc->w >= mzone->x2 &&
+ gmc->y > mzone->y1 && gmc->y < mzone->y2 &&
+ gmc->y + gmc->h >= mzone->y2)
+ {
+ mzone_splitted = 1;
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = gmc->y;
+
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ else if (gmc->x <= mzone->x1 &&
+ gmc->y <= mzone->y1 &&
+ gmc->y + gmc->h >= mzone->y2 &&
+ gmc->x + gmc->w > mzone->x1 && gmc->x + gmc->w < mzone->x2)
+ {
+ mzone_splitted = 1;
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ else if (gmc->x > mzone->x1 &&
+ gmc->x + gmc->w < mzone->x2 &&
+ gmc->y <= mzone->y1 &&
+ gmc->y + gmc->h >= mzone->y2)
+ {
+ mzone_splitted = 1;
+ for (ii = 0; ii < 2; ii ++)
+ {
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ switch(ii)
+ {
+ case 0:
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+ break;
+ case 1:
+ mzone_split->x1 = gmc->x + gmc->w;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = mzone->x2;
+ mzone_split->y2 = mzone->y2;
+ break;
+ }
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ }
+ else if (gmc->x > mzone->x1 && gmc->x < mzone->x2 &&
+ gmc->y <= mzone->y1 &&
+ gmc->x + gmc->w >= mzone->x2 &&
+ gmc->y + gmc->h >= mzone->y2)
+ {
+ mzone_splitted = 1;
+ mzone_split = (struct _m_zone *)malloc(sizeof(struct _m_zone));
+ if (mzone_split == NULL)
+ return -1;
+
+ mzone_split->x1 = mzone->x1;
+ mzone_split->y1 = mzone->y1;
+ mzone_split->x2 = gmc->x;
+ mzone_split->y2 = mzone->y2;
+
+ if (*add_splits_to == NULL)
+ *add_splits_to = evas_list_append(*add_splits_to, mzone_split);
+ else
+ evas_list_append(*add_splits_to, mzone_split);
+ }
+ else if (gmc->x <= mzone->x1 && gmc->y <= mzone->y1 &&
+ gmc->x + gmc->w >= mzone->x2 && gmc->y + gmc->h >= mzone->y2)
+ {
+ mzone_splitted = 2;
+ }
+
+ return mzone_splitted;
+}
+int _e_mzone_cb_square_reverse_sort(void *e1, void *e2)
+{
+ struct _m_zone *mz1 = (struct _m_zone *)e1;
+ struct _m_zone *mz2 = (struct _m_zone *)e2;
+
+ if (e1 == NULL) return 1;
+ if (e2 == NULL) return -1;
+
+ if (mz1->area > mz2->area)
+ return -1;
+ else if (mz1->area < mz2->area)
+ return 1;
+
+ return 0;
+}
+
+int _e_mzone_cb_width_reverse_sort(void *e1, void *e2)
+{
+ int w1, w2;
+ struct _m_zone *mz1 = (struct _m_zone *)e1;
+ struct _m_zone *mz2 = (struct _m_zone *)e2;
+
+ if (e1 == NULL) return 1;
+ if (e2 == NULL) return -1;
+
+ w1 = mz1->x2 - mz1->x1;
+ w2 = mz2->x2 - mz2->x1;
+
+ if (w1 > w2)
+ return -1;
+ else if (w1 < w2)
+ return 1;
+
+ return 0;
+}
+
+int _e_mzone_cb_height_reverse_sort(void *e1, void *e2)
+{
+ int h1, h2;
+ struct _m_zone *mz1 = (struct _m_zone *)e1;
+ struct _m_zone *mz2 = (struct _m_zone *)e2;
+
+ if (e1 == NULL) return 1;
+ if (e2 == NULL) return -1;
+
+ h1 = mz1->y2 - mz1->y1;
+ h2 = mz2->y2 - mz2->y1;
+
+ if (h1 > h2)
+ return -1;
+ else if (h1 < h2)
+ return 1;
+
+ return 0;
+}
+
temperature \
cpufreq \
ibox \
+itray \
start \
randr \
gadget_test
int show_alert;
double poll_time;
int alarm_time;
+ int allow_overlap;
};
struct _Cfg_File_Data
{
cfdata->show_alert = 0;
}
+ cfdata->allow_overlap = b->conf->allow_overlap;
}
static void *
ob = e_widget_check_add(evas, _("Show alert when battery is low"), &(cfdata->show_alert));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
return o;
}
b = cfd->data;
e_border_button_bindings_ungrab_all();
b->conf->poll_time = 10.0;
+
+ if (cfdata->allow_overlap && !b->conf->allow_overlap)
+ b->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && b->conf->allow_overlap)
+ b->conf->allow_overlap = 0;
+
e_border_button_bindings_grab_all();
e_config_save_queue();
e_widget_frametable_object_append(of, ob, 0, 5, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
return o;
}
{
b->conf->alarm = 0;
}
+
+ if (cfdata->allow_overlap && !b->conf->allow_overlap)
+ b->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && b->conf->allow_overlap)
+ b->conf->allow_overlap = 0;
e_border_button_bindings_grab_all();
e_config_save_queue();
static Status *_battery_darwin_check(Battery *ef);
#endif
-static Battery_Face *_battery_face_new(E_Container *con);
+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_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _battery_face_cb_update_policy(void *data);
+
static E_Config_DD *conf_edd;
static E_Config_DD *conf_face_edd;
#define D conf_edd
E_CONFIG_VAL(D, T, poll_time, DOUBLE);
E_CONFIG_VAL(D, T, alarm, INT);
+ E_CONFIG_VAL(D, T, allow_overlap, INT);
E_CONFIG_LIST(D, T, faces, conf_face_edd);
e->conf = e_config_domain_load("module.battery", conf_edd);
e->conf = E_NEW(Config, 1);
e->conf->poll_time = 30.0;
e->conf->alarm = 30;
+ e->conf->allow_overlap = 0;
}
E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 1000.0);
E_CONFIG_LIMIT(e->conf->alarm, 0, 60);
+ E_CONFIG_LIMIT(e->conf->allow_overlap, 0, 1);
_battery_config_menu_new(e);
Battery_Face *ef;
con = l2->data;
- ef = _battery_face_new(con);
+ ef = _battery_face_new(e, con);
if (ef)
{
ef->battery = e;
}
static Battery_Face *
-_battery_face_new(E_Container *con)
+_battery_face_new(Battery *bat, E_Container *con)
{
Evas_Object *o;
Battery_Face *ef;
+ E_Gadman_Policy policy;
ef = E_NEW(Battery_Face, 1);
if (!ef) return NULL;
ef->gmc = e_gadman_client_new(con->gadman);
e_gadman_client_domain_set(ef->gmc, "module.battery", battery_count++);
- e_gadman_client_policy_set(ef->gmc,
- E_GADMAN_POLICY_ANYWHERE |
- E_GADMAN_POLICY_HMOVE |
- E_GADMAN_POLICY_VMOVE |
- E_GADMAN_POLICY_HSIZE |
- E_GADMAN_POLICY_VSIZE);
+
+ policy = E_GADMAN_POLICY_ANYWHERE |
+ E_GADMAN_POLICY_HMOVE |
+ E_GADMAN_POLICY_VMOVE |
+ E_GADMAN_POLICY_HSIZE |
+ E_GADMAN_POLICY_VSIZE;
+ if (bat->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+ 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);
_battery_face_cb_config_updated(Battery *bat)
{
/* Call all functions needed to update battery */
+ _battery_face_cb_update_policy((void*)bat);
/* 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);
}
+
+static void _battery_face_cb_update_policy(void *data)
+{
+ Battery *bat;
+ Battery_Face *bf;
+ Evas_List *l;
+ E_Gadman_Policy policy;
+
+ bat = data;
+ for (l = bat->faces; l; l = l->next)
+ {
+ bf = l->data;
+ policy = bf->gmc->policy;
+
+ if (bat->conf->allow_overlap ==0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+ e_gadman_client_policy_set(bf->gmc , policy);
+ }
+}
{
double poll_time;
int alarm;
+ int allow_overlap;
Evas_List *faces;
};
struct _E_Config_Dialog_Data
{
int digital_style;
+ int allow_overlap;
};
struct _Cfg_File_Data
_fill_data(Clock_Face *clk, E_Config_Dialog_Data *cfdata)
{
cfdata->digital_style = clk->conf->digitalStyle;
+ cfdata->allow_overlap = clk->clock->conf->allow_overlap;
}
static void *
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);
+
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+
return o;
}
clk = cfd->data;
e_border_button_bindings_ungrab_all();
clk->conf->digitalStyle = cfdata->digital_style;
+
+ if (cfdata->allow_overlap && !clk->clock->conf->allow_overlap)
+ clk->clock->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && clk->clock->conf->allow_overlap)
+ clk->clock->conf->allow_overlap = 0;
+
e_border_button_bindings_grab_all();
e_config_save_queue();
static void _clock_shutdown(Clock *clock);
static void _clock_config_menu_new(Clock *clock);
-static Clock_Face *_clock_face_new(E_Container *con);
+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_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);
+static void _clock_face_cb_update_policy(void *data);
+
static int _clock_count;
static E_Config_DD *conf_edd;
#undef D
#define T Config
#define D conf_edd
+ E_CONFIG_VAL(D, T, allow_overlap, INT);
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->conf->allow_overlap = 0;
}
+ E_CONFIG_LIMIT(clock->conf->allow_overlap, 0, 1);
_clock_config_menu_new(clock);
Clock_Face *face;
con = l2->data;
- face = _clock_face_new(con);
+ face = _clock_face_new(clock, con);
if (face)
{
+ face->clock = clock;
clock->faces = evas_list_append(clock->faces, face);
/* Config */
if (!cl)
}
static Clock_Face *
-_clock_face_new(E_Container *con)
+_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->gmc = e_gadman_client_new(con->gadman);
e_gadman_client_domain_set(face->gmc, "module.clock", _clock_count++);
- e_gadman_client_policy_set(face->gmc,
- E_GADMAN_POLICY_ANYWHERE |
- E_GADMAN_POLICY_HMOVE |
- E_GADMAN_POLICY_VMOVE |
- E_GADMAN_POLICY_HSIZE |
- E_GADMAN_POLICY_VSIZE);
+
+ policy = E_GADMAN_POLICY_ANYWHERE |
+ E_GADMAN_POLICY_HMOVE |
+ E_GADMAN_POLICY_VMOVE |
+ E_GADMAN_POLICY_HSIZE |
+ E_GADMAN_POLICY_VSIZE;
+
+ if (clock->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+ 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,
memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), "%i", face->conf->digitalStyle);
edje_object_part_text_set(face->clock_object, "digitalStyle", buf);
+
+ _clock_face_cb_update_policy(face->clock);
+}
+
+static void _clock_face_cb_update_policy(void *data)
+{
+ Clock *clock;
+ Clock_Face *cf;
+ Evas_List *l;
+ E_Gadman_Policy policy;
+
+ clock = data;
+ for (l = clock->faces; l; l = l->next)
+ {
+ cf = l->data;
+ policy = cf->gmc->policy;
+
+ if (clock->conf->allow_overlap ==0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+ e_gadman_client_policy_set(cf->gmc , policy);
+ }
}
struct _Config
{
+ int allow_overlap;
Evas_List *faces;
};
E_Container *con;
E_Menu *menu;
Config_Face *conf;
+ Clock *clock;
struct {
Evas_Coord l, r, t, b;
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_cb_allow_overlap(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_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 void _cpufreq_cb_update_policy(Cpufreq *e);
+
static E_Config_DD *conf_edd;
static E_Config_DD *conf_face_edd;
#define T Config
#define D conf_edd
E_CONFIG_VAL(D, T, poll_time, DOUBLE);
+ E_CONFIG_VAL(D, T, allow_overlap, INT);
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->poll_time = 2.0;
e->conf->restore_governor = 0;
e->conf->governor = NULL;
+ e->conf->allow_overlap = 0;
}
E_CONFIG_LIMIT(e->conf->poll_time, 0.5, 60.0);
+ E_CONFIG_LIMIT(e->conf->allow_overlap, 0, 1);
#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);
_cpufreq_face_menu_new(ef);
+ /* Add 'Allow Overlap' option */
+ mi = e_menu_item_new(ef->menu);
+ e_menu_item_label_set(mi, _("Allow Overlap"));
+ e_menu_item_check_set(mi, 1);
+ e_menu_item_toggle_set(mi, e->conf->allow_overlap);
+ e_menu_item_callback_set(mi, _cpufreq_menu_cb_allow_overlap, e);
+
/* Add poll time menu to this face */
mi = e_menu_item_new(ef->menu);
e_menu_item_label_set(mi, _("Set Poll Time"));
e_config_save_queue();
}
+static void _cpufreq_cb_update_policy(Cpufreq *e)
+{
+ Cpufreq_Face *cf;
+ Evas_List *l;
+ E_Gadman_Policy policy;
+
+ for (l = e->faces; l; l = l->next)
+ {
+ cf = l->data;
+ policy = cf->gmc->policy;
+
+ if (e->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+ e_gadman_client_policy_set(cf->gmc, policy);
+ }
+}
+
+static void _cpufreq_menu_cb_allow_overlap(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+ Cpufreq *e;
+
+ e = data;
+ e->conf->allow_overlap = e_menu_item_toggle_get(mi);
+ _cpufreq_cb_update_policy(e);
+ e_config_save_queue();
+}
+
+
+
static void
_cpufreq_menu_restore_governor(void *data, E_Menu *m, E_Menu_Item *mi)
{
mn = e_menu_new();
mi = e_menu_item_new(mn);
+ e_menu_item_label_set(mi, _("Allow Overlap"));
+ e_menu_item_check_set(mi, 1);
+ e_menu_item_toggle_set(mi, e->conf->allow_overlap);
+ e_menu_item_callback_set(mi, _cpufreq_menu_cb_allow_overlap, e);
+
+ 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);
{
Evas_Object *o;
Cpufreq_Face *ef;
+ E_Gadman_Policy policy;
ef = E_NEW(Cpufreq_Face, 1);
if (!ef) return NULL;
ef->gmc = e_gadman_client_new(ef->con->gadman);
e_gadman_client_domain_set(ef->gmc, "module.cpufreq", cpufreq_count++);
- e_gadman_client_policy_set(ef->gmc, E_GADMAN_POLICY_ANYWHERE |
- E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE |
- E_GADMAN_POLICY_HSIZE | E_GADMAN_POLICY_VSIZE);
+
+ policy = E_GADMAN_POLICY_ANYWHERE |
+ E_GADMAN_POLICY_HMOVE |
+ E_GADMAN_POLICY_VMOVE |
+ E_GADMAN_POLICY_HSIZE |
+ E_GADMAN_POLICY_VSIZE;
+
+ if (owner->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+ 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 */
struct _Config
{
double poll_time;
+ int allow_overlap;
Evas_List *faces;
int restore_governor;
int autofit;
int follower;
int iconsize;
+ int allow_overlap;
double follow_speed;
double autoscroll_speed;
};
cfdata->autofit = (ib->conf->width == IBAR_WIDTH_AUTO);
cfdata->follower = ib->conf->follower;
cfdata->iconsize = ib->conf->iconsize;
+ cfdata->allow_overlap = ib->conf->allow_overlap;
cfdata->follow_speed = ib->conf->follow_speed;
cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
}
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);
+
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_list_object_append(o, ob, 1, 1, 0.5);
return o;
}
{
ib->conf->follower = 0;
}
-
+
+ if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 0;
+
if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED))
{
ib->conf->width = IBAR_WIDTH_AUTO;
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);
+
+ /* allow overlap checkbox */
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
return o;
}
{
ib->conf->follower = 0;
}
+
+ /* allow overlap check box */
+ if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 0;
if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED))
{
E_CONFIG_VAL(D, T, autoscroll_speed, DOUBLE);
E_CONFIG_VAL(D, T, iconsize, INT);
E_CONFIG_VAL(D, T, width, INT);
+ E_CONFIG_VAL(D, T, allow_overlap, INT);
E_CONFIG_LIST(D, T, bars, conf_bar_edd);
ib->conf = e_config_domain_load("module.ibar", conf_edd);
ib->conf->follow_speed = 0.9;
ib->conf->autoscroll_speed = 0.95;
ib->conf->iconsize = 24;
+ ib->conf->allow_overlap = 0;
ib->conf->width = IBAR_WIDTH_AUTO;
}
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);
+ E_CONFIG_LIMIT(ib->conf->allow_overlap, 0, 1);
_ibar_config_menu_new(ib);
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;
+
+ if (ibb->ibar->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
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_box_align_set(ibb->box_object, 0.5, 0.5);
policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+ if (ibb->ibar->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
if ((edge == E_GADMAN_EDGE_BOTTOM) ||
(edge == E_GADMAN_EDGE_TOP))
{
E_Gadman_Policy policy;
policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+
+ if (ibb->ibar->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
(e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP))
{
double autoscroll_speed;
int iconsize;
int width;
+ int allow_overlap;
Evas_List *bars;
};
int iconsize;
double follow_speed;
double autoscroll_speed;
+ int allow_overlap;
};
struct _Cfg_File_Data
cfdata->iconsize = ib->conf->iconsize;
cfdata->follow_speed = ib->conf->follow_speed;
cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
+ cfdata->allow_overlap = ib->conf->allow_overlap;
}
static void *
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);
+
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_list_object_append(o, ob, 1, 1, 0.5);
return o;
}
{
ib->conf->width = IBOX_WIDTH_FIXED;
}
+
+ if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 0;
+
e_border_button_bindings_grab_all();
e_config_save_queue();
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);
+
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+
return o;
}
{
ib->conf->autoscroll_speed = cfdata->autoscroll_speed;
}
+
+ if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 0;
e_border_button_bindings_grab_all();
e_config_save_queue();
E_CONFIG_VAL(D, T, autoscroll_speed, DOUBLE);
E_CONFIG_VAL(D, T, iconsize, INT);
E_CONFIG_VAL(D, T, width, INT);
+ E_CONFIG_VAL(D, T, allow_overlap, INT);
E_CONFIG_LIST(D, T, boxes, conf_box_edd);
ib->conf = e_config_domain_load("module.ibox", conf_edd);
ib->conf->autoscroll_speed = 0.95;
ib->conf->iconsize = 24;
ib->conf->width = IBOX_WIDTH_AUTO;
+ ib->conf->allow_overlap = 0;
}
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);
+ E_CONFIG_LIMIT(ib->conf->allow_overlap, 0, 1);
_ibox_config_menu_new(ib);
policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
if (ibb->ibox->conf->width == IBOX_WIDTH_FIXED)
policy |= E_GADMAN_POLICY_VSIZE;
+
+ if (ibb->ibox->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
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_box_align_set(ibb->item_object, 0.5, 0.5);
policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+
+ if (ibb->ibox->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
if ((edge == E_GADMAN_EDGE_BOTTOM) ||
(edge == E_GADMAN_EDGE_TOP))
{
E_Gadman_Policy policy;
policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+
+ if (ibb->ibox->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
(e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP))
{
int follower;
double autoscroll_speed;
int iconsize;
+ int allow_overlap;
int width;
Evas_List *boxes;
};
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in
+MODULE = itray
+
+# data files for the module
+filesdir = $(libdir)/enlightenment/modules/$(MODULE)
+files_DATA = \
+module_icon.png
+
+EXTRA_DIST = $(files_DATA)
+
+# the module .so file
+INCLUDES = -I. \
+ -I$(top_srcdir) \
+ -I$(includedir) \
+ -I$(top_srcdir)/$(MODULE) \
+ -I$(top_srcdir)/src/bin \
+ -I$(top_srcdir)/src/lib \
+ -I$(top_srcdir)/src/modules \
+ @e_cflags@
+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
+module_la_LIBADD = @e_libs@ @dlopen_libs@
+module_la_LDFLAGS = -module -avoid-version
+module_la_DEPENDENCIES = $(top_builddir)/config.h
--- /dev/null
+#include "e.h"
+#include "e_mod_main.h"
+#include "e_mod_config.h"
+#include "config.h"
+
+typedef struct _cfdata CFData;
+typedef struct _Cfg_File_Data Cfg_File_Data;
+
+struct _cfdata
+{
+ int follower;
+ int rowsize;
+ double follow_speed;
+ int allow_overlap;
+/* double autoscroll_speed;
+ * int autofit;
+ */
+};
+
+struct _Cfg_File_Data
+{
+ E_Config_Dialog *cfd;
+ char *file;
+};
+
+/* Protos */
+static void *_create_data(E_Config_Dialog *cfd);
+static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
+static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+
+void
+_config_itray_module(E_Container *con, ITray *itray)
+{
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View v;
+
+ /* 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;
+
+ /* Create The Dialog */
+ cfd = e_config_dialog_new(con, _("ITray Configuration"), NULL, 0, &v, itray);
+ itray->config_dialog = cfd;
+}
+
+static void
+_fill_data(ITray *ib, CFData *cfdata)
+{
+/* cfdata->autofit = (ib->conf->width == ITRAY_WIDTH_AUTO);
+ * cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
+ */
+ cfdata->follower = ib->conf->follower;
+ cfdata->rowsize = ib->conf->rowsize;
+ cfdata->follow_speed = ib->conf->follow_speed;
+ cfdata->allow_overlap = ib->conf->allow_overlap;
+}
+
+static void *
+_create_data(E_Config_Dialog *cfd)
+{
+ CFData *cfdata;
+ ITray *ib;
+
+ ib = cfd->data;
+ cfdata = E_NEW(CFData, 1);
+ _fill_data(ib, cfdata);
+ return cfdata;
+}
+
+static void
+_free_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+ ITray *ib;
+
+ ib = cfd->data;
+ ib->config_dialog = NULL;
+ free(cfdata);
+}
+
+static Evas_Object *
+_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
+{
+ Evas_Object *o, *ob, *of;
+ ITray *ib;
+
+ ib = cfd->data;
+ _fill_data(ib, cfdata);
+
+ 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);
+ */
+
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ 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, CFData *cfdata)
+{
+ ITray *ib;
+
+ ib = cfd->data;
+ if ((cfdata->follower) && (!ib->conf->follower))
+ ib->conf->follower = 1;
+ else if (!(cfdata->follower) && (ib->conf->follower))
+ ib->conf->follower = 0;
+
+ if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 0;
+
+/* if ((cfdata->autofit) && (ib->conf->width == ITRAY_WIDTH_FIXED))
+ * {
+ * ib->conf->width = ITRAY_WIDTH_AUTO;
+ * }
+ * else if (!(cfdata->autofit) && (ib->conf->width == ITRAY_WIDTH_AUTO))
+ * {
+ * ib->conf->width = ITRAY_WIDTH_FIXED;
+ * }
+ */
+ e_config_save_queue();
+
+ _itray_box_cb_config_updated(ib);
+ return 1;
+}
+
+static Evas_Object *
+_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
+{
+ Evas_Object *o, *of, *ob;
+ ITray *ib;
+
+ ib = cfd->data;
+ _fill_data(ib, cfdata);
+
+ 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, _("Number of Rows"), 0);
+ ob = e_widget_slider_add(evas, 1, 0, _("%3.0f"), 1.0, 6.0, 1.0, 0, NULL, &(cfdata->rowsize), 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);
+ */
+
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ 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, CFData *cfdata)
+{
+ ITray *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 == ITRAY_WIDTH_FIXED))
+ * {
+ * ib->conf->width = ITRAY_WIDTH_AUTO;
+ * }
+ * else if (!(cfdata->autofit) && (ib->conf->width == ITRAY_WIDTH_AUTO))
+ * {
+ * ib->conf->width = ITRAY_WIDTH_FIXED;
+ * }
+ */
+
+ if (cfdata->rowsize != ib->conf->rowsize)
+ {
+ ib->conf->rowsize = cfdata->rowsize;
+ }
+ if (cfdata->follow_speed != ib->conf->follow_speed)
+ {
+ ib->conf->follow_speed = cfdata->follow_speed;
+ }
+
+ if (cfdata->allow_overlap && !ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && ib->conf->allow_overlap)
+ ib->conf->allow_overlap = 0;
+
+
+/* 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();
+
+ _itray_box_cb_config_updated(ib);
+ return 1;
+}
--- /dev/null
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_MOD_CONFIG_H
+#define E_MOD_CONFIG_H
+#include "e_mod_main.h"
+void _config_itray_module(E_Container *con, ITray *itray);
+#endif
+#endif
--- /dev/null
+/*
+ * 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 <math.h>
+
+#include "Ecore_X.h"
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+
+/* Currently unused */
+#define SYSTEM_TRAY_REQUEST_DOCK 0
+#define SYSTEM_TRAY_BEGIN_MESSAGE 1
+#define SYSTEM_TRAY_CANCEL_MESSAGE 2
+#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
+#define _NET_SYSTEM_TRAY_ORIENTATION_VERT 1
+/* ---------------- */
+
+#define XEMBED_EMBEDDED_NOTIFY 0
+
+#define TRAY_ICON_SIZE 24
+
+/* Bug List:
+ *
+ * Changing the number of rows breaks the layout.
+ * It's magically fixed when the module is moved.
+ * Remove the follower code, or make it work on top of the tray icons.
+ *
+ * TODO List:
+ *
+ * Make sure only one tray exists.
+ * Use the abovestated defines.
+ * Change the size of the tray icons.
+ * Use the shape extension for the ecore_x_window so that the "gray"
+ * itself is not visible, but the tray icons are.
+ *
+ * The Big Picture:
+ *
+ * Get rid of the ecore_x_window stuff.
+ * Make the tray survive an E restart.
+ *
+ */
+
+static int box_count;
+static E_Config_DD *conf_edd;
+static E_Config_DD *conf_box_edd;
+
+/* const strings */
+static const char *_itray_main_orientation[] =
+{"left", "right", "top", "bottom"};
+
+/* module private routines */
+static ITray *_itray_new();
+static void _itray_free(ITray *it);
+static void _itray_config_menu_new(ITray *it);
+
+static ITray_Box *_itray_box_new(ITray *it, E_Container *con);
+static void _itray_box_free(ITray_Box *itb);
+static void _itray_box_menu_new(ITray_Box *itb);
+static void _itray_box_disable(ITray_Box *itb);
+static void _itray_box_frame_resize(ITray_Box *itb);
+static void _itray_box_edge_change(ITray_Box *itb, int edge);
+static void _itray_box_update_policy(ITray_Box *itb);
+static void _itray_box_motion_handle(ITray_Box *itb, Evas_Coord mx, Evas_Coord my);
+static void _itray_box_timer_handle(ITray_Box *itb);
+static void _itray_box_follower_reset(ITray_Box *itb);
+
+static void _itray_box_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change);
+static void _itray_box_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _itray_box_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _itray_box_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _itray_box_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _itray_box_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+/* Follower */
+static int _itray_box_cb_timer(void *data);
+static int _itray_box_cb_animator(void *data);
+
+static void _itray_box_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _itray_box_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
+
+/* Config Updated Function Protos */
+static void _itray_box_cb_width_auto(void *data);
+static void _itray_box_cb_follower(void *data);
+
+/* Tray */
+static void _itray_tray_init(ITray_Box *itb);
+static void _itray_tray_shutdown(ITray_Box *itb);
+static int _itray_tray_cb_msg(void *data, int type, void *event);
+static void _itray_tray_active_set();
+
+static void _itray_tray_cb_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
+static void _itray_tray_cb_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
+
+static void _itray_tray_layout(ITray_Box *itb);
+
+/* public module routines. all modules must have these */
+EAPI E_Module_Api e_modapi =
+{
+ E_MODULE_API_VERSION,
+ "ITray"
+};
+
+EAPI void *
+e_modapi_init(E_Module *m)
+{
+ ITray *it;
+
+ /* actually init ibox */
+ it = _itray_new();
+ m->config_menu = it->config_menu;
+ return it;
+}
+
+EAPI int
+e_modapi_shutdown(E_Module *m)
+{
+ ITray *it;
+
+ if (m->config_menu)
+ m->config_menu = NULL;
+
+ it = m->data;
+ if (it)
+ {
+ if (it->config_dialog)
+ {
+ e_object_del(E_OBJECT(it->config_dialog));
+ it->config_dialog = NULL;
+ }
+ _itray_free(it);
+ }
+ return 1;
+}
+
+EAPI int
+e_modapi_save(E_Module *m)
+{
+ ITray *it;
+
+ it = m->data;
+ e_config_domain_save("module.itray", conf_edd, it->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 ITray Module"),
+ _("This is the ITray system tray module for Enlightenment.<br>"
+ "It will hold system tray icons."));
+ return 1;
+}
+
+EAPI int
+e_modapi_config(E_Module *m)
+{
+ ITray *e;
+ Evas_List *l;
+
+ e = m->data;
+ if (!e) return 0;
+ if (!e->boxes) return 0;
+
+ for (l = e->boxes; l; l = l->next)
+ {
+ ITray_Box *face;
+ face = l->data;
+ if (!face) return 0;
+ if (face->con == e_container_current_get(e_manager_current_get()))
+ {
+ _config_itray_module(face->con, face->itray);
+ break;
+ }
+ }
+ return 1;
+}
+
+/* module private routines */
+static ITray *
+_itray_new()
+{
+ ITray *it;
+ Evas_List *managers, *l, *l2, *cl;
+
+ box_count = 0;
+ it = E_NEW(ITray, 1);
+ if (!it) return NULL;
+
+ conf_box_edd = E_CONFIG_DD_NEW("ITray_Config_Box", Config_Box);
+#undef T
+#undef D
+#define T Config_Box
+#define D conf_box_edd
+ E_CONFIG_VAL(D, T, enabled, UCHAR);
+
+ conf_edd = E_CONFIG_DD_NEW("ITray_Config", Config);
+#undef T
+#undef D
+#define T Config
+#define D conf_edd
+ 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, rowsize, INT);
+ E_CONFIG_VAL(D, T, width, INT);
+ E_CONFIG_LIST(D, T, boxes, conf_box_edd);
+
+ it->conf = e_config_domain_load("module.itray", conf_edd);
+ if (!it->conf)
+ {
+ it->conf = E_NEW(Config, 1);
+ it->conf->follower = 1;
+ it->conf->follow_speed = 0.9;
+ it->conf->autoscroll_speed = 0.95;
+ it->conf->rowsize = 1;
+ it->conf->width = ITRAY_WIDTH_AUTO;
+ }
+ E_CONFIG_LIMIT(it->conf->follow_speed, 0.01, 1.0);
+ E_CONFIG_LIMIT(it->conf->autoscroll_speed, 0.01, 1.0);
+ E_CONFIG_LIMIT(it->conf->rowsize, 1, 6);
+ E_CONFIG_LIMIT(it->conf->width, -2, -1);
+
+ _itray_config_menu_new(it);
+
+ managers = e_manager_list();
+ cl = it->conf->boxes;
+ for (l = managers; l; l = l->next)
+ {
+ E_Manager *man;
+
+ man = l->data;
+ for (l2 = man->containers; l2; l2 = l2->next)
+ {
+ E_Container *con;
+ ITray_Box *itb;
+ /* Config */
+ con = l2->data;
+ itb = _itray_box_new(it, con);
+ if (itb)
+ {
+ E_Menu_Item *mi;
+
+ if (!cl)
+ {
+ itb->conf = E_NEW(Config_Box, 1);
+ itb->conf->enabled = 1;
+ it->conf->boxes = evas_list_append(it->conf->boxes, itb->conf);
+ }
+ else
+ {
+ itb->conf = cl->data;
+ cl = cl->next;
+ }
+
+ /* Menu */
+ _itray_box_menu_new(itb);
+
+ /* Add main menu to box menu */
+ mi = e_menu_item_new(it->config_menu);
+ e_menu_item_label_set(mi, con->name);
+ e_menu_item_submenu_set(mi, itb->menu);
+
+ /* Setup */
+ if (!itb->conf->enabled)
+ _itray_box_disable(itb);
+ }
+ }
+ }
+ return it;
+}
+
+static void
+_itray_free(ITray *it)
+{
+ E_CONFIG_DD_FREE(conf_edd);
+ E_CONFIG_DD_FREE(conf_box_edd);
+
+ while (it->boxes)
+ _itray_box_free(it->boxes->data);
+
+ e_object_del(E_OBJECT(it->config_menu));
+ evas_list_free(it->conf->boxes);
+ free(it->conf);
+ free(it);
+}
+
+static ITray_Box *
+_itray_box_new(ITray *it, E_Container *con)
+{
+ ITray_Box *itb;
+ Evas_Object *o;
+ E_Gadman_Policy policy;
+ Evas_Coord x, y, w, h;
+
+ itb = E_NEW(ITray_Box, 1);
+ if (!itb) return NULL;
+ itb->itray = it;
+ it->boxes = evas_list_append(it->boxes, itb);
+
+ itb->con = con;
+ e_object_ref(E_OBJECT(con));
+ itb->evas = con->bg_evas;
+
+ itb->tray = NULL;
+
+ itb->x = itb->y = itb->w = itb->h = -1;
+
+ evas_event_freeze(itb->evas);
+ o = edje_object_add(itb->evas);
+ itb->box_object = o;
+ e_theme_edje_object_set(o, "base/theme/modules/itray",
+ "modules/itray/main");
+ evas_object_show(o);
+
+ if (itb->itray->conf->follower)
+ {
+ o = edje_object_add(itb->evas);
+ itb->overlay_object = o;
+ evas_object_layer_set(o, 1);
+ e_theme_edje_object_set(o, "base/theme/modules/itray",
+ "modules/itray/follower");
+ evas_object_show(o);
+ }
+
+ o = evas_object_rectangle_add(itb->evas);
+ itb->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_IN, _itray_box_cb_mouse_in, itb);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _itray_box_cb_mouse_out, itb);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _itray_box_cb_mouse_down, itb);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _itray_box_cb_mouse_up, itb);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _itray_box_cb_mouse_move, itb);
+ evas_object_show(o);
+
+ o = e_box_add(itb->evas);
+ itb->item_object = o;
+ _itray_tray_init(itb);
+ e_box_freeze(o);
+ edje_object_part_swallow(itb->box_object, "tray", o);
+ evas_object_show(o);
+
+ itb->align_req = 0.5;
+ itb->align = 0.5;
+ e_box_align_set(itb->item_object, 0.5, 0.5);
+
+ evas_object_resize(itb->box_object, 1000, 1000);
+ edje_object_calc_force(itb->box_object);
+ edje_object_part_geometry_get(itb->box_object, "tray", &x, &y, &w, &h);
+ itb->box_inset.l = x;
+ itb->box_inset.r = 1000 - (x + w);
+ itb->box_inset.t = y;
+ itb->box_inset.b = 1000 - (y + h);
+
+ e_box_thaw(itb->item_object);
+
+ itb->gmc = e_gadman_client_new(itb->con->gadman);
+ e_gadman_client_domain_set(itb->gmc, "module.itray", box_count++);
+ policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+ if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+ policy |= E_GADMAN_POLICY_VSIZE;
+ e_gadman_client_policy_set(itb->gmc, policy);
+ e_gadman_client_min_size_set(itb->gmc, 8, 8);
+ e_gadman_client_max_size_set(itb->gmc, 3200, 3200);
+ e_gadman_client_auto_size_set(itb->gmc, -1, -1);
+ e_gadman_client_align_set(itb->gmc, 0.0, 0.5);
+ e_gadman_client_resize(itb->gmc, 400, 32);
+ e_gadman_client_change_func_set(itb->gmc, _itray_box_cb_gmc_change, itb);
+ e_gadman_client_edge_set(itb->gmc, E_GADMAN_EDGE_LEFT);
+ e_gadman_client_load(itb->gmc);
+
+ evas_event_thaw(itb->evas);
+
+ /* We need to resize, if the width is auto and the number
+ * of apps has changed since last startup */
+ _itray_box_frame_resize(itb);
+
+ /*
+ edje_object_signal_emit(itb->box_object, "passive", "");
+ edje_object_signal_emit(itb->overlay_object, "passive", "");
+ */
+
+ return itb;
+}
+
+static void
+_itray_box_free(ITray_Box *itb)
+{
+ e_object_unref(E_OBJECT(itb->con));
+ e_object_del(E_OBJECT(itb->menu));
+
+ if (itb->timer) ecore_timer_del(itb->timer);
+ if (itb->animator) ecore_animator_del(itb->animator);
+ evas_object_del(itb->box_object);
+ if (itb->overlay_object) evas_object_del(itb->overlay_object);
+ evas_object_del(itb->item_object);
+ evas_object_del(itb->event_object);
+
+ if (itb->tray)
+ {
+ _itray_tray_shutdown(itb);
+ itb->tray = NULL;
+ }
+
+ e_gadman_client_save(itb->gmc);
+ e_object_del(E_OBJECT(itb->gmc));
+
+ itb->itray->boxes = evas_list_remove(itb->itray->boxes, itb);
+
+ free(itb->conf);
+ free(itb);
+ box_count--;
+}
+
+static void
+_itray_box_menu_new(ITray_Box *itb)
+{
+ E_Menu *mn;
+ E_Menu_Item *mi;
+
+ mn = e_menu_new();
+ itb->menu = mn;
+
+ /* Config */
+ mi = e_menu_item_new(mn);
+ e_menu_item_label_set(mi, _("Configuration"));
+ e_menu_item_callback_set(mi, _itray_box_cb_menu_configure, itb);
+
+ /* Edit */
+ mi = e_menu_item_new(mn);
+ e_menu_item_label_set(mi, _("Edit Mode"));
+ e_menu_item_callback_set(mi, _itray_box_cb_menu_edit, itb);
+}
+
+static void
+_itray_box_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+ ITray_Box *itb;
+
+ itb = (ITray_Box *)data;
+ if (!itb) return;
+ _config_itray_module(itb->con, itb->itray);
+}
+
+static void
+_itray_box_disable(ITray_Box *itb)
+{
+ itb->conf->enabled = 0;
+ evas_object_hide(itb->box_object);
+ if (itb->overlay_object) evas_object_hide(itb->overlay_object);
+ evas_object_hide(itb->item_object);
+ evas_object_hide(itb->event_object);
+ e_config_save_queue();
+}
+
+void
+_itray_config_menu_new(ITray *it)
+{
+ E_Menu *mn;
+
+ mn = e_menu_new();
+ it->config_menu = mn;
+}
+
+static void
+_itray_box_frame_resize(ITray_Box *itb)
+{
+ Evas_Coord w, h, bw, bh;
+ int icons_per_row;
+ /* Not finished loading config yet! */
+ if ((itb->x == -1) ||
+ (itb->y == -1) ||
+ (itb->w == -1) ||
+ (itb->h == -1))
+ return;
+
+ evas_event_freeze(itb->evas);
+ e_box_freeze(itb->item_object);
+
+ if (e_box_pack_count_get(itb->item_object))
+ e_box_min_size_get(itb->item_object, &w, &h);
+ else
+ {
+ if (!itb->tray)
+ w = h = TRAY_ICON_SIZE + itb->box_inset.l + itb->box_inset.r;
+ else if (!itb->tray->icons)
+ w = h = TRAY_ICON_SIZE + itb->box_inset.l + itb->box_inset.r;
+ else
+ {
+ icons_per_row = (itb->tray->icons +
+ (itb->tray->icons % itb->tray->rows)) / itb->tray->rows;
+ w = (icons_per_row * TRAY_ICON_SIZE)
+ + itb->box_inset.l + itb->box_inset.r;
+ h = (itb->tray->rows * TRAY_ICON_SIZE)
+ + itb->box_inset.t + itb->box_inset.b;
+ }
+ }
+ edje_object_part_unswallow(itb->box_object, itb->item_object);
+/* edje_extern_object_min_size_set(itb->item_object, w, h);*/
+/* edje_object_part_swallow(itb->box_object, "tray", itb->item_object);*/
+/* edje_object_size_min_calc(itb->box_object, &bw, &bh);*/
+ edje_extern_object_min_size_set(itb->item_object, 0, 0);
+ edje_object_part_swallow(itb->box_object, "tray", itb->item_object);
+
+ e_box_thaw(itb->item_object);
+ evas_event_thaw(itb->evas);
+
+ if (itb->itray->conf->width == ITRAY_WIDTH_AUTO)
+ {
+ if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+ {
+ e_gadman_client_resize(itb->gmc, h, w);
+ }
+ else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM))
+ {
+ e_gadman_client_resize(itb->gmc, w, h);
+ }
+ }
+ else
+ {
+ if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+ {
+ /* h is the width of the box */
+ e_gadman_client_resize(itb->gmc, bw, itb->h);
+ }
+ else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM))
+ {
+ /* w is the width of the box */
+ e_gadman_client_resize(itb->gmc, itb->w, bh);
+ }
+ }
+}
+
+static void
+_itray_box_edge_change(ITray_Box *itb, int edge)
+{
+ Evas_Coord bw, bh, tmp;
+ Evas_Object *o;
+ E_Gadman_Policy policy;
+ int changed;
+
+ evas_event_freeze(itb->evas);
+ o = itb->box_object;
+ edje_object_signal_emit(o, "set_orientation", _itray_main_orientation[edge]);
+ edje_object_message_signal_process(o);
+
+ if (itb->overlay_object)
+ {
+ o = itb->overlay_object;
+ edje_object_signal_emit(o, "set_orientation", _itray_main_orientation[edge]);
+ edje_object_message_signal_process(o);
+ }
+
+ e_box_freeze(itb->item_object);
+
+ itb->align_req = 0.5;
+ itb->align = 0.5;
+ e_box_align_set(itb->item_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(itb->item_object) != 1);
+ if (changed)
+ {
+ e_box_orientation_set(itb->item_object, 1);
+ if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+ policy |= E_GADMAN_POLICY_HSIZE;
+ e_gadman_client_policy_set(itb->gmc, policy);
+ tmp = itb->w;
+ itb->w = itb->h;
+ itb->h = tmp;
+ }
+ }
+ else if ((edge == E_GADMAN_EDGE_LEFT) ||
+ (edge == E_GADMAN_EDGE_RIGHT))
+ {
+ changed = (e_box_orientation_get(itb->item_object) != 0);
+ if (changed)
+ {
+ e_box_orientation_set(itb->item_object, 0);
+ if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+ policy |= E_GADMAN_POLICY_VSIZE;
+ e_gadman_client_policy_set(itb->gmc, policy);
+ tmp = itb->w;
+ itb->w = itb->h;
+ itb->h = tmp;
+ }
+ }
+
+ e_box_thaw(itb->item_object);
+ evas_event_thaw(itb->evas);
+
+ _itray_box_frame_resize(itb);
+}
+
+static void
+_itray_box_update_policy(ITray_Box *itb)
+{
+ E_Gadman_Policy policy;
+
+ policy = E_GADMAN_POLICY_EDGES | E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE;
+ if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP))
+ {
+ if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+ policy |= E_GADMAN_POLICY_HSIZE;
+ e_gadman_client_policy_set(itb->gmc, policy);
+ }
+ else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+ {
+ if (itb->itray->conf->width == ITRAY_WIDTH_FIXED)
+ policy |= E_GADMAN_POLICY_VSIZE;
+ e_gadman_client_policy_set(itb->gmc, policy);
+ }
+}
+
+static void
+_itray_box_motion_handle(ITray_Box *itb, Evas_Coord mx, Evas_Coord my)
+{
+ Evas_Coord x, y, w, h;
+ double relx, rely;
+
+ evas_object_geometry_get(itb->item_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(itb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP))
+ {
+ itb->align_req = 1.0 - relx;
+ itb->follow_req = relx;
+ }
+ else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+ {
+ itb->align_req = 1.0 - rely;
+ itb->follow_req = rely;
+ }
+}
+
+static void
+_itray_box_timer_handle(ITray_Box *itb)
+{
+ if (!itb->timer)
+ itb->timer = ecore_timer_add(0.01, _itray_box_cb_timer, itb);
+ if (!itb->animator)
+ itb->animator = ecore_animator_add(_itray_box_cb_animator, itb);
+}
+
+static void
+_itray_box_follower_reset(ITray_Box *itb)
+{
+ Evas_Coord ww, hh, bx, by, bw, bh, d1, d2, mw, mh;
+
+ if (!itb->overlay_object) return;
+
+ evas_output_viewport_get(itb->evas, NULL, NULL, &ww, &hh);
+ evas_object_geometry_get(itb->item_object, &bx, &by, &bw, &bh);
+ edje_object_size_min_get(itb->overlay_object, &mw, &mh);
+ if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP))
+ {
+ d1 = bx;
+ d2 = ww - (bx + bw);
+ if (bw > 0)
+ {
+ if (d1 < d2)
+ itb->follow_req = -((double)(d1 + (mw * 4)) / (double)bw);
+ else
+ itb->follow_req = 1.0 + ((double)(d2 + (mw * 4)) / (double)bw);
+ }
+ }
+ else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+ {
+ d1 = by;
+ d2 = hh - (by + bh);
+ if (bh > 0)
+ {
+ if (d1 < d2)
+ itb->follow_req = -((double)(d1 + (mh * 4)) / (double)bh);
+ else
+ itb->follow_req = 1.0 + ((double)(d2 + (mh * 4)) / (double)bh);
+ }
+ }
+}
+
+static void
+_itray_box_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_In *ev;
+ ITray_Box *itb;
+
+ ev = event_info;
+ itb = data;
+ if (itb->overlay_object)
+ edje_object_signal_emit(itb->overlay_object, "active", "");
+ _itray_box_motion_handle(itb, ev->canvas.x, ev->canvas.y);
+ _itray_box_timer_handle(itb);
+}
+
+static void
+_itray_box_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Out *ev;
+ ITray_Box *itb;
+
+ ev = event_info;
+ itb = data;
+ if (itb->overlay_object)
+ edje_object_signal_emit(itb->overlay_object, "passive", "");
+ _itray_box_follower_reset(itb);
+ _itray_box_timer_handle(itb);
+}
+
+static void
+_itray_box_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Down *ev;
+ ITray_Box *itb;
+
+ ev = event_info;
+ itb = data;
+ if (ev->button == 3)
+ {
+ e_menu_activate_mouse(itb->menu, e_zone_current_get(itb->con),
+ ev->output.x, ev->output.y, 1, 1,
+ E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
+ e_util_container_fake_mouse_up_later(itb->con, 3);
+ }
+}
+
+static void
+_itray_box_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev;
+ ITray_Box *itb;
+
+ ev = event_info;
+ itb = data;
+}
+
+static void
+_itray_box_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Move *ev;
+ ITray_Box *itb;
+
+ ev = event_info;
+ itb = data;
+ _itray_box_motion_handle(itb, ev->cur.canvas.x, ev->cur.canvas.y);
+ _itray_box_timer_handle(itb);
+}
+
+static int
+_itray_box_cb_timer(void *data)
+{
+ ITray_Box *itb;
+ double dif, dif2;
+ double v;
+
+ itb = data;
+ v = itb->itray->conf->autoscroll_speed;
+ itb->align = (itb->align_req * (1.0 - v)) + (itb->align * v);
+ v = itb->itray->conf->follow_speed;
+ itb->follow = (itb->follow_req * (1.0 - v)) + (itb->follow * v);
+
+ dif = itb->align - itb->align_req;
+ if (dif < 0) dif = -dif;
+ if (dif < 0.001) itb->align = itb->align_req;
+
+ dif2 = itb->follow - itb->follow_req;
+ if (dif2 < 0) dif2 = -dif2;
+ if (dif2 < 0.001) itb->follow = itb->follow_req;
+
+ if ((dif < 0.001) && (dif2 < 0.001))
+ {
+ itb->timer = NULL;
+ return 0;
+ }
+ return 1;
+}
+
+static int
+_itray_box_cb_animator(void *data)
+{
+ ITray_Box *itb;
+ Evas_Coord x, y, w, h, mw, mh;
+
+ itb = data;
+
+ if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_TOP))
+ {
+ e_box_min_size_get(itb->item_object, &mw, &mh);
+ evas_object_geometry_get(itb->item_object, NULL, NULL, &w, &h);
+ if (mw > w)
+ e_box_align_set(itb->item_object, itb->align, 0.5);
+ else
+ e_box_align_set(itb->item_object, 0.5, 0.5);
+
+ if (itb->overlay_object)
+ {
+ evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
+ edje_object_size_min_get(itb->overlay_object, &mw, &mh);
+ evas_object_resize(itb->overlay_object, mw, h);
+ evas_object_move(itb->overlay_object, x + (w * itb->follow) - (mw / 2), y);
+ }
+ }
+ else if ((e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_LEFT) ||
+ (e_gadman_client_edge_get(itb->gmc) == E_GADMAN_EDGE_RIGHT))
+ {
+ e_box_min_size_get(itb->item_object, &mw, &mh);
+ evas_object_geometry_get(itb->item_object, NULL, NULL, &w, &h);
+ if (mh > h)
+ e_box_align_set(itb->item_object, 0.5, itb->align);
+ else
+ e_box_align_set(itb->item_object, 0.5, 0.5);
+
+ if (itb->overlay_object)
+ {
+ evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
+ edje_object_size_min_get(itb->overlay_object, &mw, &mh);
+ evas_object_resize(itb->overlay_object, w, mh);
+ evas_object_move(itb->overlay_object, x, y + (h * itb->follow) - (mh / 2));
+ }
+ }
+ if (itb->timer) return 1;
+ itb->animator = NULL;
+ return 0;
+}
+
+static void
+_itray_box_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change)
+{
+ ITray_Box *itb;
+
+ itb = data;
+ switch (change)
+ {
+ case E_GADMAN_CHANGE_MOVE_RESIZE:
+ e_gadman_client_geometry_get(itb->gmc, &itb->x, &itb->y, &itb->w, &itb->h);
+
+ edje_extern_object_min_size_set(itb->item_object, 0, 0);
+ edje_object_part_swallow(itb->box_object, "tray", itb->item_object);
+
+ evas_object_move(itb->box_object, itb->x, itb->y);
+ evas_object_resize(itb->box_object, itb->w, itb->h);
+
+ _itray_box_follower_reset(itb);
+ _itray_box_timer_handle(itb);
+
+ break;
+ case E_GADMAN_CHANGE_EDGE:
+ _itray_box_edge_change(itb, e_gadman_client_edge_get(itb->gmc));
+ break;
+ case E_GADMAN_CHANGE_RAISE:
+ case E_GADMAN_CHANGE_ZONE:
+ /* Ignore */
+ break;
+ }
+}
+
+static void
+_itray_box_cb_width_auto(void *data)
+{
+ ITray *it;
+ ITray_Box *itb;
+ Evas_List *l;
+
+ it = (ITray *)data;
+ for (l = it->boxes; l; l = l->next)
+ {
+ itb = l->data;
+ _itray_box_update_policy(itb);
+ _itray_box_frame_resize(itb);
+ }
+}
+
+static void
+_itray_box_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+ ITray_Box *itb;
+
+ itb = data;
+ e_gadman_mode_set(itb->gmc->gadman, E_GADMAN_MODE_EDIT);
+}
+
+static void
+_itray_box_cb_follower(void *data)
+{
+ ITray *it;
+ ITray_Box *itb;
+ unsigned char enabled;
+ Evas_List *l;
+
+ it = (ITray *)data;
+ enabled = it->conf->follower;
+ if (enabled)
+ {
+ for (l = it->boxes; l; l = l->next)
+ {
+ Evas_Object *o;
+
+ itb = l->data;
+ if (itb->overlay_object) continue;
+ o = edje_object_add(itb->evas);
+ itb->overlay_object = o;
+ evas_object_layer_set(o, 1);
+ e_theme_edje_object_set(o, "base/theme/modules/itray",
+ "modules/itray/follower");
+ edje_object_signal_emit(o, "set_orientation", _itray_main_orientation[e_gadman_client_edge_get(itb->gmc)]);
+ edje_object_message_signal_process(o);
+ evas_object_show(o);
+ }
+ }
+ else if (!enabled)
+ {
+ for (l = it->boxes; l; l = l->next)
+ {
+ itb = l->data;
+ if (!itb->overlay_object) continue;
+ evas_object_del(itb->overlay_object);
+ itb->overlay_object = NULL;
+ }
+ }
+}
+
+void
+_itray_box_cb_config_updated(void *data)
+{
+ /* Call Any Needed Funcs To Let Module Handle Config Changes */
+ _itray_box_cb_follower(data);
+ _itray_box_cb_width_auto(data);
+}
+
+void
+_itray_tray_init(ITray_Box *itb)
+{
+ Evas_Coord x, y, w, h;
+
+ /* FIXME - temp */
+ itb->tray = malloc(sizeof(ITray_Tray));
+ itb->tray->icons = 0;
+ itb->tray->w = 1;
+ itb->tray->h = 1;
+ itb->tray->wins = NULL;
+
+ evas_object_resize(itb->item_object, itb->tray->w, itb->tray->h);
+ evas_object_color_set(itb->item_object, 180, 0, 0, 0);
+ evas_object_intercept_move_callback_add(itb->item_object, _itray_tray_cb_move, itb);
+ evas_object_intercept_resize_callback_add(itb->item_object, _itray_tray_cb_resize, itb);
+
+ _itray_tray_active_set(itb, 1);
+
+ evas_object_geometry_get(itb->item_object, &x, &y, &w, &h);
+ itb->tray->win = ecore_x_window_new(itb->con->bg_win, x, y, w, h);
+ ecore_x_window_container_manage(itb->tray->win);
+ ecore_x_window_background_color_set(itb->tray->win, 255, 255, 255);
+
+ itb->tray->msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _itray_tray_cb_msg, itb);
+ itb->tray->dst_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _itray_tray_cb_msg, itb);
+}
+
+void
+_itray_tray_shutdown(ITray_Box *itb)
+{
+ _itray_tray_active_set(itb, 0);
+
+ evas_list_free(itb->tray->wins);
+ evas_object_del(itb->item_object);
+
+ ecore_event_handler_del(itb->tray->msg_handler);
+ ecore_event_handler_del(itb->tray->dst_handler);
+ ecore_x_window_del(itb->tray->win);
+}
+
+static void
+_itray_tray_active_set(ITray_Box *itb, int active)
+{
+ Ecore_X_Window win;
+ Display *display;
+ Window root;
+ char buf[32];
+ Atom selection_atom;
+
+ win = 0;
+ if (active)
+ win = itb->con->bg_win;
+
+ display = ecore_x_display_get();
+ root = RootWindow (display, DefaultScreen(display));
+
+ snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", DefaultScreen(display));
+ selection_atom = ecore_x_atom_get(buf);
+ XSetSelectionOwner (display, selection_atom, win, CurrentTime);
+
+ if (active &&
+ XGetSelectionOwner (display, selection_atom) == itb->con->bg_win)
+ {
+ ecore_x_client_message32_send(root, ecore_x_atom_get("MANAGER"),
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ CurrentTime, selection_atom, win, 0, 0);
+ }
+}
+
+static void
+_itray_tray_add(ITray_Box *itb, Ecore_X_Window win)
+{
+ if (evas_list_find(itb->tray->wins, (void *)win))
+ return;
+ ecore_x_window_show(itb->tray->win);
+ evas_object_show(itb->item_object);
+
+ /* FIXME: need a way to register managed windows so the
+ * managers default configure request handler doesnt do anything
+ */
+ /* we want to insert at the end, so as not to move all icons on each add */
+ itb->tray->wins = evas_list_append(itb->tray->wins, (void *)win);
+ itb->tray->icons++;
+ ecore_x_window_client_manage(win);
+ ecore_x_window_resize(win, TRAY_ICON_SIZE, TRAY_ICON_SIZE);
+
+ ecore_x_window_reparent(win, itb->tray->win, 0, 0);
+ _itray_tray_layout(itb);
+ _itray_box_frame_resize(itb);
+
+ ecore_x_window_show(win);
+
+}
+
+static void
+_itray_tray_remove(ITray_Box *itb, Ecore_X_Window win)
+{
+
+ if (!win)
+ return;
+ if (!evas_list_find(itb->tray->wins, (void *)win)) /* if was not found */
+ return;
+
+ itb->tray->wins = evas_list_remove(itb->tray->wins, (void *)win);
+ itb->tray->icons--;
+ _itray_tray_layout(itb);
+ _itray_box_frame_resize(itb);
+ if (itb->tray->icons == 0)
+ {
+ ecore_x_window_hide(itb->tray->win);
+ evas_object_show(itb->item_object);
+ }
+}
+
+static int
+_itray_tray_cb_msg(void *data, int type, void *event)
+{
+ Ecore_X_Event_Client_Message *ev;
+ Ecore_X_Event_Window_Destroy *dst;
+ ITray_Box *itb;
+
+ itb = data;
+ if (type == ECORE_X_EVENT_CLIENT_MESSAGE) {
+ ev = event;
+ if (ev->message_type == ecore_x_atom_get("_NET_SYSTEM_TRAY_OPCODE")) {
+ _itray_tray_add(itb, (Ecore_X_Window) ev->data.l[2]);
+
+ /* Should proto be set according to clients _XEMBED_INFO? */
+ ecore_x_client_message32_send(
+ ev->data.l[2],
+ ecore_x_atom_get("_XEMBED"),
+ ECORE_X_EVENT_MASK_NONE, CurrentTime,
+ XEMBED_EMBEDDED_NOTIFY, 0, itb->con->bg_win, /*proto*/1);
+
+ } else if (ev->message_type == ecore_x_atom_get("_NET_SYSTEM_TRAY_MESSAGE_DATA")) {
+ printf("got message\n");
+ }
+ } else if (type == ECORE_X_EVENT_WINDOW_DESTROY) {
+ dst = event;
+ _itray_tray_remove(itb, (Ecore_X_Window) dst->win);
+ }
+
+ return 1;
+
+}
+
+static void
+_itray_tray_cb_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y)
+{
+ ITray_Box *itb;
+
+ itb = data;
+ evas_object_move(o, x, y);
+ evas_object_move(itb->event_object, x, y);
+ ecore_x_window_move(itb->tray->win, (int) x, (int) y);
+}
+
+static void
+_itray_tray_cb_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h)
+{
+ ITray_Box *itb;
+
+ itb = data;
+ evas_object_resize(o, w, h);
+ evas_object_resize(itb->event_object, w, h);
+
+ _itray_tray_layout(itb);
+ _itray_box_frame_resize(itb);
+}
+
+static void
+_itray_tray_layout(ITray_Box *itb)
+{
+ Evas_Coord w, h, c, d;
+ int x, y;
+ Evas_List *wins;
+ E_Gadman_Edge edge;
+
+ if (!itb->gmc) return;
+ edge = e_gadman_client_edge_get(itb->gmc);
+ h = itb->itray->conf->rowsize * TRAY_ICON_SIZE;
+ if (h < TRAY_ICON_SIZE)
+ h = TRAY_ICON_SIZE;
+ c = (h - (h % TRAY_ICON_SIZE)) / TRAY_ICON_SIZE;
+ if (itb->tray->icons > 0 && itb->tray->icons < c + 1)
+ {
+ c = itb->tray->icons;
+ h = c * TRAY_ICON_SIZE;
+ }
+ w = ((itb->tray->icons + (itb->tray->icons % c)) / c) * TRAY_ICON_SIZE;
+
+ if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_TOP) {
+ edje_object_part_unswallow(itb->box_object, itb->item_object);
+ evas_object_resize(itb->item_object, w, h);
+ ecore_x_window_resize(itb->tray->win, (int) w, (int) h);
+
+ edje_extern_object_min_size_set(itb->item_object, w, h);
+ edje_extern_object_max_size_set(itb->item_object, w, h);
+ edje_object_part_swallow(itb->box_object, "tray", itb->item_object);
+ } else {
+ edje_object_part_unswallow(itb->box_object, itb->item_object);
+ evas_object_resize(itb->item_object, h, w);
+ ecore_x_window_resize(itb->tray->win, (int) h, (int) w);
+
+ edje_extern_object_min_size_set(itb->item_object, w, h);
+ edje_extern_object_max_size_set(itb->item_object, w, h);
+ edje_object_part_swallow(itb->box_object, "tray", itb->item_object);
+ }
+
+ x = 0;
+ if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_RIGHT)
+ y = h - TRAY_ICON_SIZE;
+ else
+ y = 0;
+ d = 0;
+ for (wins = itb->tray->wins; wins; wins = wins->next) {
+ if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_TOP)
+ ecore_x_window_move((Ecore_X_Window) wins->data, x, y);
+ else
+ ecore_x_window_move((Ecore_X_Window) wins->data, y, x);
+
+ d++;
+ if (d % c == 0) {
+ x += TRAY_ICON_SIZE;
+ if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_RIGHT)
+ y = h - TRAY_ICON_SIZE;
+ else
+ y = 0;
+ } else
+ if (edge == E_GADMAN_EDGE_BOTTOM || edge == E_GADMAN_EDGE_RIGHT)
+ y -= TRAY_ICON_SIZE;
+ else
+ y += TRAY_ICON_SIZE;
+ }
+ itb->tray->rows = c;
+}
--- /dev/null
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#ifndef E_MOD_MAIN_H
+#define E_MOD_MAIN_H
+
+typedef struct _Config Config;
+typedef struct _Config_Box Config_Box;
+typedef struct _ITray ITray;
+typedef struct _ITray_Box ITray_Box;
+typedef struct _ITray_Tray ITray_Tray;
+
+#define ITRAY_WIDTH_AUTO -1
+#define ITRAY_WIDTH_FIXED -2
+
+struct _Config
+{
+ double follow_speed;
+ int follower;
+ double autoscroll_speed;
+ int rowsize;
+ int width;
+ Evas_List *boxes;
+ int allow_overlap;
+};
+
+struct _Config_Box
+{
+ unsigned char enabled;
+};
+
+struct _ITray
+{
+ Evas_List *boxes;
+ E_Menu *config_menu;
+
+ Config *conf;
+ E_Config_Dialog *config_dialog;
+};
+
+struct _ITray_Box
+{
+ ITray *itray;
+ E_Container *con;
+ Evas *evas;
+ E_Menu *menu;
+
+ Evas_Object *box_object;
+ Evas_Object *overlay_object;
+ Evas_Object *item_object;
+ Evas_Object *event_object;
+
+ 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;
+ } box_inset;
+
+ E_Gadman_Client *gmc;
+
+ ITray_Tray *tray;
+ Config_Box *conf;
+};
+
+struct _ITray_Tray
+{
+ int w, h;
+ int icons, rows;
+ Evas_List *wins;
+ Ecore_X_Window win;
+
+ Ecore_Event_Handler *msg_handler;
+ Ecore_Event_Handler *dst_handler;
+};
+
+EAPI extern E_Module_Api e_modapi;
+
+EAPI void *e_modapi_init (E_Module *m);
+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 _itray_box_cb_config_updated(void *data);
+
+#endif
int name_pos;
int show_popup;
double popup_speed;
+ int allow_overlap;
};
struct _Cfg_File_Data
cfdata->show_popup = p->conf->popup;
cfdata->popup_speed = p->conf->popup_speed;
+ cfdata->allow_overlap = p->conf->allow_overlap;
}
static void *
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ 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);
p->conf->deskname_pos = cfdata->name_pos;
if (!cfdata->show_name) p->conf->deskname_pos = PAGER_DESKNAME_NONE;
+ if (cfdata->allow_overlap && !p->conf->allow_overlap)
+ p->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && p->conf->allow_overlap)
+ p->conf->allow_overlap = 0;
+
e_border_button_bindings_grab_all();
e_config_save_queue();
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.1, 10.0, 0.1, 0, &(cfdata->popup_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, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+
return o;
}
if (!cfdata->show_name) p->conf->deskname_pos = PAGER_DESKNAME_NONE;
p->conf->popup_speed = cfdata->popup_speed;
+ if (cfdata->allow_overlap && !p->conf->allow_overlap)
+ p->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && p->conf->allow_overlap)
+ p->conf->allow_overlap = 0;
+
e_border_button_bindings_grab_all();
e_config_save_queue();
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 _pager_cb_update_policy(void *data);
+
static int _pager_count;
static E_Config_DD *_conf_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, allow_overlap, INT);
pager->conf = e_config_domain_load("module.pager", _conf_edd);
pager->conf->deskname_pos = PAGER_DESKNAME_NONE;
pager->conf->popup_speed = 1.0;
pager->conf->popup = 1;
+ pager->conf->allow_overlap = 0;
}
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);
+ E_CONFIG_LIMIT(pager->conf->allow_overlap, 0, 1);
_pager_config_menu_new(pager);
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;
e_gadman_client_domain_set(face->gmc, "module.pager", _pager_count++);
e_gadman_client_zone_set(face->gmc, face->zone);
- e_gadman_client_policy_set(face->gmc,
-// E_GADMAN_POLICY_FIXED_ZONE |
- E_GADMAN_POLICY_ANYWHERE |
- E_GADMAN_POLICY_HMOVE |
- E_GADMAN_POLICY_VMOVE |
- E_GADMAN_POLICY_HSIZE |
- E_GADMAN_POLICY_VSIZE);
+
+ 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;
+
+ if (pager->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+ 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,
/* Handle Desktop Name Position Change */
pager = data;
+ _pager_cb_update_policy(pager);
for (l = pager->faces; l; l = l->next)
{
Pager_Face *face;
_pager_face_deskname_position_change(face);
}
}
+static void _pager_cb_update_policy(void *data)
+{
+ Pager *pg;
+ Pager_Face *pf;
+ Evas_List *l;
+ E_Gadman_Policy policy;
+
+ pg = data;
+ for (l = pg->faces; l; l = l->next)
+ {
+ pf = l->data;
+ policy = pf->gmc->policy;
+
+ if (pg->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+ e_gadman_client_policy_set(pf->gmc , policy);
+ }
+}
+
double popup_speed;
/* Show popup? */
unsigned int popup;
+
+ int allow_overlap;
};
struct _Config_Face
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \
- e_mod_main.h
+ e_mod_main.h \
+ e_mod_config.c \
+ e_mod_config.h
module_la_LIBADD = @e_libs@ @dlopen_libs@
module_la_LDFLAGS = -module -avoid-version
module_la_DEPENDENCIES = $(top_builddir)/config.h
--- /dev/null
+#include "e.h"
+#include "e_mod_main.h"
+#include "config.h"
+
+typedef struct _cfdata CFData;
+typedef struct _Cfg_File_Data Cfg_File_Data;
+
+struct _cfdata
+{
+ int allow_overlap;
+};
+
+struct _Cfg_File_Data
+{
+ E_Config_Dialog *cfd;
+ char *file;
+};
+
+/* Protos */
+static Evas_Object *_create_widgets(E_Config_Dialog *cfd, Evas *evas, Config *cfdata);
+static void *_create_data(E_Config_Dialog *cfd);
+static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
+static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+
+void
+_config_start_module(E_Container *con, Start *start)
+{
+ E_Config_Dialog *cfd;
+ E_Config_Dialog_View v;
+
+ 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 = NULL;
+ v.advanced.create_widgets = NULL;
+
+ cfd = e_config_dialog_new(con, _("Start Module Configuration"), NULL, 0, &v, start);
+}
+
+static void
+_fill_data(Start *s, CFData *cfdata)
+{
+ cfdata->allow_overlap = s->conf->allow_overlap;
+}
+
+static void
+*_create_data(E_Config_Dialog *cfd)
+{
+ CFData *cfdata;
+ Start *s;
+
+ s = cfd->data;
+ cfdata = E_NEW(CFData, 1);
+ _fill_data(s, cfdata);
+ return cfdata;
+}
+
+static void
+_free_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+ free(cfdata);
+}
+
+static Evas_Object
+*_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
+{
+ Evas_Object *o, *of, *ob;
+ Start *s;
+
+ s = cfd->data;
+ _fill_data(s, cfdata);
+
+ o = e_widget_list_add(evas, 0, 0);
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ 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, CFData *cfdata)
+{
+ Start *s;
+
+ s = cfd->data;
+ e_border_button_bindings_ungrab_all();
+
+ if (cfdata->allow_overlap && !s->conf->allow_overlap)
+ s->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && s->conf->allow_overlap)
+ s->conf->allow_overlap = 0;
+
+ e_border_button_bindings_grab_all();
+ e_config_save_queue();
+
+ _start_cb_config_updated(s);
+ return 1;
+}
--- /dev/null
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_MOD_CONFIG_H
+#define E_MOD_CONFIG_H
+#include "e_mod_main.h"
+EAPI void _config_start_module(E_Container *con, Start *start);
+#endif
+#endif
#include "e_int_menus.h"
static Start *_start_new(void);
-static Start_Face *_start_face_new(E_Container *con);
+static Start_Face *_start_face_new(Start *s, E_Container *con);
static void _start_free(Start *e);
static void _start_face_free(Start_Face *face);
static void _start_face_disable(Start_Face *e);
static void _start_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _start_menu_cb_post_deactivate(void *data, E_Menu *m);
+static void _start_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _start_cb_update_policy(void *data);
+
static int button_count;
static E_Config_DD *conf_edd;
static E_Config_DD *conf_face_edd;
return 1;
}
+int
+e_modapi_config(E_Module *m)
+{
+ Start *s;
+ Start_Face *face;
+
+ s = m->data;
+ if (s == NULL) return 0;
+ if (s->faces == NULL) return 0;
+ face = s->faces->data;
+ if (face == NULL) return 0;
+ _config_start_module(e_container_current_get(e_manager_current_get()), s);
+ return 1;
+}
+
static Start *
_start_new(void)
{
#define T Config
#define D conf_edd
E_CONFIG_LIST(D, T, faces, conf_face_edd);
+ E_CONFIG_VAL(D, T, allow_overlap, INT);
e->conf = e_config_domain_load("module.start", conf_edd);
- if (!e->conf) e->conf = E_NEW(Config, 1);
+ if (!e->conf)
+ {
+ e->conf = E_NEW(Config, 1);
+ e->conf->allow_overlap = 0;
+ }
+ E_CONFIG_LIMIT(e->conf->allow_overlap, 0, 1);
_start_config_menu_new(e);
Start_Face *face;
con = l2->data;
- face = _start_face_new(con);
+ face = _start_face_new(e, con);
if (face)
{
+ face->start = e;
e->faces = evas_list_append(e->faces, face);
/* Config */
if (!cl)
/* Menu */
/* This menu must be initialized after conf */
_start_face_menu_new(face);
+
+ mi = e_menu_item_new(e->config_menu);
+ e_menu_item_label_set(mi, _("Configuration"));
+ e_menu_item_callback_set(mi, _start_face_cb_menu_configure, face);
mi = e_menu_item_new(e->config_menu);
e_menu_item_label_set(mi, con->name);
}
static Start_Face *
-_start_face_new(E_Container *con)
+_start_face_new(Start *s, E_Container *con)
{
Start_Face *face;
Evas_Object *o;
+ E_Gadman_Policy policy;
face = E_NEW(Start_Face, 1);
if (!face) return NULL;
face->gmc = e_gadman_client_new(con->gadman);
e_gadman_client_domain_set(face->gmc, "module.start", button_count++);
- e_gadman_client_policy_set(face->gmc,
- E_GADMAN_POLICY_ANYWHERE |
- E_GADMAN_POLICY_HMOVE |
- E_GADMAN_POLICY_VMOVE |
- E_GADMAN_POLICY_HSIZE |
- E_GADMAN_POLICY_VSIZE);
+
+ policy = E_GADMAN_POLICY_ANYWHERE |
+ E_GADMAN_POLICY_HMOVE |
+ E_GADMAN_POLICY_VMOVE |
+ E_GADMAN_POLICY_HSIZE |
+ E_GADMAN_POLICY_VSIZE;
+
+ if (s->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+ 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, 40);
/* Edit */
mi = e_menu_item_new(mn);
+ e_menu_item_label_set(mi, _("Configuration"));
+ e_menu_item_callback_set(mi, _start_face_cb_menu_configure, face);
+
+ mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Edit Mode"));
e_menu_item_callback_set(mi, _start_face_cb_menu_edit, face);
e_object_del(E_OBJECT(face->main_menu));
face->main_menu = NULL;
}
+void _start_cb_config_updated( void *data )
+{
+ _start_cb_update_policy(data);
+}
+
+void
+_start_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+ Start_Face *face;
+
+ face = (Start_Face*)data;
+ if (!face) return;
+ _config_start_module(face->con, face->start);
+}
+
+static void _start_cb_update_policy(void *data)
+{
+ Start *s;
+ Start_Face *sf;
+ Evas_List *l;
+ E_Gadman_Policy policy;
+
+ s = data;
+ for (l = s->faces; l; l = l->next)
+ {
+ sf = l->data;
+ policy = sf->gmc->policy;
+
+ if (s->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+ e_gadman_client_policy_set(sf->gmc , policy);
+ }
+}
+
struct _Config
{
Evas_List *faces;
+ int allow_overlap;
};
struct _Config_Face
E_Container *con;
E_Menu *menu;
E_Menu *main_menu;
+ Start *start;
Config_Face *conf;
EAPI int e_modapi_about (E_Module *m);
/* EAPI int e_modapi_config (E_Module *module); */
+EAPI void _start_cb_config_updated(void *data);
+
#endif
int high_method;
int high_temp;
+ int allow_overlap;
+
int sensor;
};
{
cfdata->sensor = 2;
}
+
+ cfdata->allow_overlap = t->conf->allow_overlap;
}
static void *
e_widget_list_object_append(o, of, 1, 1, 0.5);
}
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+
return o;
}
t->conf->high = cfdata->high_method;
}
+ if (cfdata->allow_overlap && !t->conf->allow_overlap)
+ t->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && t->conf->allow_overlap)
+ t->conf->allow_overlap = 0;
+
e_border_button_bindings_grab_all();
e_config_save_queue();
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
}
+
+ of = e_widget_framelist_add(evas, _("Extras"), 0);
+ ob = e_widget_check_add(evas, _("Allow Overlap"), &(cfdata->allow_overlap));
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+
return o;
}
break;
}
+ if (cfdata->allow_overlap && !t->conf->allow_overlap)
+ t->conf->allow_overlap = 1;
+ else if (!cfdata->allow_overlap && t->conf->allow_overlap)
+ t->conf->allow_overlap = 0;
+
e_border_button_bindings_grab_all();
e_config_save_queue();
static void _temperature_config_menu_new(Temperature *e);
static int _temperature_cb_check(void *data);
-static Temperature_Face *_temperature_face_new(E_Container *con);
+static Temperature_Face *_temperature_face_new(Temperature *t, E_Container *con);
static void _temperature_face_free(Temperature_Face *ef);
static void _temperature_face_enable(Temperature_Face *face);
static void _temperature_face_disable(Temperature_Face *face);
static void _temperature_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
static void _temperature_face_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
+static void _temperature_cb_update_policy(void *data);
+
static E_Config_DD *conf_edd;
static E_Config_DD *conf_face_edd;
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_CONFIG_VAL(D, T, allow_overlap, INT);
e->conf = e_config_domain_load("module.temperature", conf_edd);
if (!e->conf)
e->conf->high = 80;
e->conf->sensor_name = "temp1";
e->conf->units = CELCIUS;
+ e->conf->allow_overlap = 0;
}
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_CONFIG_LIMIT(e->conf->allow_overlap, 0, 1);
_temperature_config_menu_new(e);
e->have_temp = -1;
Temperature_Face *ef;
con = l2->data;
- ef = _temperature_face_new(con);
+ ef = _temperature_face_new(e, con);
if (ef)
{
ef->temp = e;
}
static Temperature_Face *
-_temperature_face_new(E_Container *con)
+_temperature_face_new(Temperature *t, E_Container *con)
{
Evas_Object *o;
Temperature_Face *ef;
+ E_Gadman_Policy policy;
ef = E_NEW(Temperature_Face, 1);
if (!ef) return NULL;
ef->gmc = e_gadman_client_new(ef->con->gadman);
e_gadman_client_domain_set(ef->gmc, "module.temperature", temperature_count++);
- e_gadman_client_policy_set(ef->gmc,
- E_GADMAN_POLICY_ANYWHERE |
- E_GADMAN_POLICY_HMOVE |
- E_GADMAN_POLICY_VMOVE |
- E_GADMAN_POLICY_HSIZE |
- E_GADMAN_POLICY_VSIZE);
+
+ policy = E_GADMAN_POLICY_ANYWHERE |
+ E_GADMAN_POLICY_HMOVE |
+ E_GADMAN_POLICY_VMOVE |
+ E_GADMAN_POLICY_HSIZE |
+ E_GADMAN_POLICY_VSIZE;
+
+ if (t->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+ 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);
/* 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);
+ _temperature_cb_update_policy(temp);
}
+void
+_temperature_cb_update_policy(void *data)
+{
+ Temperature *temp;
+ Temperature_Face *tf;
+ Evas_List *l;
+ E_Gadman_Policy policy;
+
+ temp = data;
+ for (l = temp->faces; l; l = l->next)
+ {
+ tf = l->data;
+ policy = tf->gmc->policy;
+
+ if (temp->conf->allow_overlap == 0)
+ policy &= ~E_GADMAN_POLICY_ALLOW_OVERLAP;
+ else
+ policy |= E_GADMAN_POLICY_ALLOW_OVERLAP;
+
+ e_gadman_client_policy_set(tf->gmc, policy);
+ }
+}
Evas_List *faces;
char *sensor_name;
Unit units;
+ int allow_overlap;
};
struct _Config_Face