forked from enlightenment/enlightenment
e menu - allow hold mode to be turned off
hold mode is where if u hold mosue down menu stays only as long as mouse is held down... then dismissed on up. doesnt work well when youa re trying to overload a single click with longpresses and so on - optionally turn it off. used in gadgets.
This commit is contained in:
parent
571daf936d
commit
b92b546d36
|
@ -847,6 +847,7 @@ _bryce_owner_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
e_menu_item_label_set(mi, _("Gadget Bar"));
|
e_menu_item_label_set(mi, _("Gadget Bar"));
|
||||||
|
|
||||||
subm = e_menu_new();
|
subm = e_menu_new();
|
||||||
|
e_menu_hold_mode_set(subm, EINA_FALSE);
|
||||||
e_menu_item_submenu_set(mi, subm);
|
e_menu_item_submenu_set(mi, subm);
|
||||||
e_object_unref(E_OBJECT(subm));
|
e_object_unref(E_OBJECT(subm));
|
||||||
|
|
||||||
|
@ -1047,6 +1048,7 @@ _bryce_menu(Bryce *b, Evas_Object *g)
|
||||||
int x = 0, y = 0, w = 1, h = 1;
|
int x = 0, y = 0, w = 1, h = 1;
|
||||||
|
|
||||||
m = e_menu_new();
|
m = e_menu_new();
|
||||||
|
e_menu_hold_mode_set(m, EINA_FALSE);
|
||||||
_bryce_menu_populate(b, m, g);
|
_bryce_menu_populate(b, m, g);
|
||||||
if (g)
|
if (g)
|
||||||
evas_object_geometry_get(g, &x, &y, &w, &h);
|
evas_object_geometry_get(g, &x, &y, &w, &h);
|
||||||
|
|
|
@ -1316,6 +1316,7 @@ _gadget_menu(Evas_Object *g, unsigned int timestamp)
|
||||||
_gadget_popups_clear(zgc);
|
_gadget_popups_clear(zgc);
|
||||||
|
|
||||||
zgc->menu = e_menu_new();
|
zgc->menu = e_menu_new();
|
||||||
|
e_menu_hold_mode_set(zgc->menu, EINA_FALSE);
|
||||||
if (zgc->type)
|
if (zgc->type)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
@ -1338,6 +1339,7 @@ _gadget_menu(Evas_Object *g, unsigned int timestamp)
|
||||||
e_menu_item_separator_set(mi, 1);
|
e_menu_item_separator_set(mi, 1);
|
||||||
}
|
}
|
||||||
subm = e_menu_new();
|
subm = e_menu_new();
|
||||||
|
e_menu_hold_mode_set(subm, EINA_FALSE);
|
||||||
evas_object_smart_callback_call(zgc->site->layout, "gadget_site_style_menu", subm);
|
evas_object_smart_callback_call(zgc->site->layout, "gadget_site_style_menu", subm);
|
||||||
if (e_object_data_get(E_OBJECT(subm)))
|
if (e_object_data_get(E_OBJECT(subm)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -210,9 +210,18 @@ e_menu_new(void)
|
||||||
m->cur.w = 1;
|
m->cur.w = 1;
|
||||||
m->cur.h = 1;
|
m->cur.h = 1;
|
||||||
m->category = NULL;
|
m->category = NULL;
|
||||||
|
m->hold_mode = EINA_TRUE;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
E_API void
|
||||||
|
e_menu_hold_mode_set(E_Menu *m, Eina_Bool hold_mode)
|
||||||
|
{
|
||||||
|
E_OBJECT_CHECK(m);
|
||||||
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
||||||
|
m->hold_mode = hold_mode;
|
||||||
|
}
|
||||||
|
|
||||||
E_API void
|
E_API void
|
||||||
e_menu_activate_key(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir)
|
e_menu_activate_key(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir)
|
||||||
{
|
{
|
||||||
|
@ -2780,6 +2789,8 @@ static Eina_Bool
|
||||||
_e_menu_cb_mouse_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
_e_menu_cb_mouse_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||||
{
|
{
|
||||||
Ecore_Event_Mouse_Button *ev;
|
Ecore_Event_Mouse_Button *ev;
|
||||||
|
E_Menu *m;
|
||||||
|
Eina_List *l;
|
||||||
unsigned int t;
|
unsigned int t;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -2787,6 +2798,18 @@ _e_menu_cb_mouse_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||||
ev = event;
|
ev = event;
|
||||||
if (ev->window != _e_menu_win) return ECORE_CALLBACK_RENEW;
|
if (ev->window != _e_menu_win) return ECORE_CALLBACK_RENEW;
|
||||||
|
|
||||||
|
if (!_e_menu_activate_floating)
|
||||||
|
{
|
||||||
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
||||||
|
{
|
||||||
|
if (!m->hold_mode)
|
||||||
|
{
|
||||||
|
_e_menu_activate_floating = 1;
|
||||||
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
t = ev->timestamp - _e_menu_activate_time;
|
t = ev->timestamp - _e_menu_activate_time;
|
||||||
if ((_e_menu_activate_time != 0) &&
|
if ((_e_menu_activate_time != 0) &&
|
||||||
(t < (e_config->menus_click_drag_timeout * 1000)))
|
(t < (e_config->menus_click_drag_timeout * 1000)))
|
||||||
|
|
|
@ -71,6 +71,7 @@ struct _E_Menu
|
||||||
Eina_Bool pending_new_submenu E_BITFIELD;
|
Eina_Bool pending_new_submenu E_BITFIELD;
|
||||||
Eina_Bool have_submenu E_BITFIELD;
|
Eina_Bool have_submenu E_BITFIELD;
|
||||||
Eina_Bool in_active_list E_BITFIELD;
|
Eina_Bool in_active_list E_BITFIELD;
|
||||||
|
Eina_Bool hold_mode E_BITFIELD;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _E_Menu_Item
|
struct _E_Menu_Item
|
||||||
|
@ -156,6 +157,7 @@ EINTERN int e_menu_shutdown(void);
|
||||||
|
|
||||||
E_API void e_menu_hide_all(void);
|
E_API void e_menu_hide_all(void);
|
||||||
E_API E_Menu *e_menu_new(void);
|
E_API E_Menu *e_menu_new(void);
|
||||||
|
E_API void e_menu_hold_mode_set(E_Menu *m, Eina_Bool hold_mode);
|
||||||
E_API void e_menu_activate_key(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir);
|
E_API void e_menu_activate_key(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir);
|
||||||
E_API void e_menu_activate_mouse(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir, unsigned int activate_time);
|
E_API void e_menu_activate_mouse(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir, unsigned int activate_time);
|
||||||
E_API void e_menu_activate(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir);
|
E_API void e_menu_activate(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir);
|
||||||
|
|
Loading…
Reference in New Issue