Hi,
this patch changes the shelfs autohide feature to use polling to detect
when then mouse is out of the shelf.
There is still one problem left: If a module pops up a menu or if one
drags something out of the shelf the shelf doesn't hide. My Idea for
this would be to add the functions e_gadcon_client_autohide_freeze and
-thaw so that the module can call these before and after a menu is
activated. See the comment in the patch where the shelf would test the
freeze-state to act according to the state.
Regards,
Hannes
Index: e_shelf.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_shelf.c,v
retrieving revision 1.56
diff -u -r1.56 e_shelf.c
--- e_shelf.c 11 Apr 2007 15:37:04 -0000 1.56
+++ e_shelf.c 19 Apr 2007 16:40:06 -0000
@@ -19,13 +19,13 @@
static void _e_shelf_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_shelf_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_shelf_cb_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static void _e_shelf_cb_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static int _e_shelf_cb_id_sort(void *data1, void *data2);
static int _e_shelf_cb_hide_timer(void *data);
static int _e_shelf_cb_hide_animator(void *data);
static int _e_shelf_cb_instant_hide_timer(void *data);
static void _e_shelf_menu_del_hook(void *data);
static void _e_shelf_menu_pre_cb(void *data, E_Menu *m);
+static int _e_shelf_hide_timer(void *data);
static Evas_List *shelves = NULL;
@@ -142,8 +142,7 @@
evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_shelf_cb_mouse_down, es);
evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_UP, _e_shelf_cb_mouse_up, es);
evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_IN, _e_shelf_cb_mouse_in, es);
- evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_OUT, _e_shelf_cb_mouse_out, es);
-
+
es->o_base = edje_object_add(es->evas);
es->name = evas_stringshare_add(name);
snprintf(buf, sizeof(buf), "e/shelf/%s/base", es->style);
@@ -271,36 +270,47 @@
EAPI void
e_shelf_toggle(E_Shelf *es, int show)
{
- E_OBJECT_CHECK(es);
- E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
- if (show)
- {
- if (es->hide_timer)
- {
- ecore_timer_del(es->hide_timer);
- es->hide_timer = NULL;
- }
- if (es->hidden && !es->instant_timer)
- {
- es->hidden = 0;
- edje_object_signal_emit(es->o_base, "e,state,visible", "e");
- if (es->instant_delay >= 0.0)
- {
- if (!es->instant_timer)
- _e_shelf_cb_instant_hide_timer(es);
- }
- else
- {
- if(!es->hide_animator)
- es->hide_animator = ecore_animator_add(_e_shelf_cb_hide_animator, es);
- }
- }
- }
- else if (!show && es->cfg->autohide && !es->hidden)
- {
- if(!es->hide_timer)
- es->hide_timer = ecore_timer_add(es->cfg->hide_timeout, _e_shelf_cb_hide_timer, es);
- }
+ E_OBJECT_CHECK(es);
+ E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
+
+ if(!es->cfg->autohide) return;
+
+ if (show)
+ {
+
+ if(!es->hide_timer) es->hide_timer = ecore_timer_add(0.1, _e_shelf_hide_timer, es);
+
+ if (es->hidden && !es->instant_timer)
+ {
+ es->hidden = 0;
+ edje_object_signal_emit(es->o_base, "e,state,visible", "e");
+ if (es->instant_delay >= 0.0)
+ {
+ if (!es->instant_timer)
+ _e_shelf_cb_instant_hide_timer(es);
+ }
+ else
+ {
+ if(!es->hide_animator)
+ es->hide_animator = ecore_animator_add(_e_shelf_cb_hide_animator, es);
+ }
+ }
+ }
+ else if (!show && es->cfg->autohide && !es->hidden)
+ {
+ es->hidden = 1;
+ edje_object_signal_emit(es->o_base, "e,state,hidden", "e");
+ if (es->instant_delay >= 0.0)
+ {
+ if (!es->instant_timer)
+ es->instant_timer = ecore_timer_add(es->instant_delay, _e_shelf_cb_instant_hide_timer, es);
+ }
+ else
+ {
+ if (!es->hide_animator)
+ es->hide_animator = ecore_animator_add(_e_shelf_cb_hide_animator, es);
+ }
+ }
}
EAPI void
@@ -1149,25 +1159,6 @@
e_shelf_toggle(es, 1);
}
-static void
-_e_shelf_cb_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
- Evas_Event_Mouse_Out *ev;
- E_Shelf *es;
-
- es = data;
- ev = event_info;
- if (es->cfg->autohide)
- {
- Evas_Coord x, y, w, h;
-
- evas_object_geometry_get(es->o_base, &x, &y, &w, &h);
- if (!E_INSIDE(ev->canvas.x, ev->canvas.y, x, y, w, h))
- e_shelf_toggle(es, 0);
- }
- edje_object_signal_emit(es->o_base, "e,state,unfocused", "e");
-}
-
static int
_e_shelf_cb_id_sort(void *data1, void *data2)
{
@@ -1178,28 +1169,39 @@
return (es1->id) > (es2->id);
}
-static int
-_e_shelf_cb_hide_timer(void *data)
+static int
+_e_shelf_hide_timer(void *data)
{
- E_Shelf *es;
+ Evas_Coord x, y, w, h, px, py;
- es = data;
+ E_Shelf *es = data;
- es->hidden = 1;
- edje_object_signal_emit(es->o_base, "e,state,hidden", "e");
- if (es->instant_delay >= 0.0)
- {
- if (!es->instant_timer)
- es->instant_timer = ecore_timer_add(es->instant_delay, _e_shelf_cb_instant_hide_timer, es);
- }
- else
- {
- if (!es->hide_animator)
- es->hide_animator = ecore_animator_add(_e_shelf_cb_hide_animator, es);
- }
- es->hide_timer = NULL;
-
- return 0;
+ evas_object_geometry_get(es->o_base, &x, &y, &w, &h);
+ evas_pointer_canvas_xy_get(es->evas, &px, &py);
+
+ if (E_INSIDE(px, py, x, y, w, h))
+ {
+ es->last_in = ecore_time_get();
+ return 1;
+ }
+ else
+ {
+ if(es->last_in + es->cfg->hide_timeout < ecore_time_get() ) /* && !es->gadcon->autohide_frozen
+ * for later use, if a module wants
+ * to suspend autohide
+ */
+ {
+ e_shelf_toggle(es, 0);
+ if(es->hide_timer)
+ {
+ ecore_timer_del(es->hide_timer);
+ es->hide_timer = NULL;
+ }
+ return 0;
+ }
+ else
+ return 1;
+ }
}
static int
Index: e_shelf.h
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_shelf.h,v
retrieving revision 1.20
diff -u -r1.20 e_shelf.h
--- e_shelf.h 8 Apr 2007 09:32:48 -0000 1.20
+++ e_shelf.h 19 Apr 2007 16:40:07 -0000
@@ -40,6 +40,7 @@
int hide_origin;
float instant_delay;
Ecore_Timer *instant_timer;
+ double last_in; /* last time the pointer was in the shelf */
};
EAPI int e_shelf_init(void);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel