forked from enlightenment/enlightenment
bryce - improve usability from code and user by having std right menu
now right click on any gagdte in bryce and they ALL have a menu that allows removal of the gagdte bar or the gadget as well as access to gadget settings AND the ability for gadgets to extendthis menu like lunhcer does per icon. now it's standard behavior everywhere which is much easier to use and discover. it also removes code from every gadget to do their own "button 3" handling as its handled centrally making the code in gadgets simpler. this is part of my effort to improve usability (mostly discoverability and accessibility of settings/features). also long press left mouse gets u gadget right click menu this has to move many modules/gadgets actions to mouse up instead of mouse down so the bryce has a chance to trap the events first and set hold flags. but now long press for 0.5 sec and bryce menu come sup (with left mouse .. so touch friendly). in addition move context menu hanbdling to e_gadget instead of in bryce and in e_gadget. a context callback is called so different systems can still do different things. this should probably change to always pop up a mnenu and simple call populate callbacks for site owner specific content. all in all it makes the new gagdtes more consistent, easier to use (without a right mouse button), doesn't need special action bindings etc. etc.
This commit is contained in:
parent
a9b303baa5
commit
e4339f4819
|
@ -36,7 +36,9 @@ typedef struct Bryce
|
|||
unsigned int autohide_blocked;
|
||||
Eina_List *popups;
|
||||
void *event_info;
|
||||
uint64_t last_timestamp;
|
||||
unsigned int last_timestamp;
|
||||
|
||||
E_Menu *menu;
|
||||
|
||||
/* config: do not bitfield! */
|
||||
Eina_Bool autosize;
|
||||
|
@ -60,11 +62,10 @@ static E_Config_DD *edd_bryces;
|
|||
static E_Config_DD *edd_bryce;
|
||||
static Bryces *bryces;
|
||||
static E_Action *resize_act;
|
||||
static E_Action *menu_act;
|
||||
static Eina_List *handlers;
|
||||
|
||||
|
||||
static void _bryce_menu(Bryce *b);
|
||||
static void _bryce_menu(Bryce *b, Evas_Object *g);
|
||||
|
||||
#define BRYCE_GET(obj) \
|
||||
Bryce *b; \
|
||||
|
@ -592,35 +593,6 @@ _bryce_moveresize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event
|
|||
_bryce_autosize(b);
|
||||
}
|
||||
|
||||
static void
|
||||
_bryce_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Bryce *b = data;
|
||||
Evas_Event_Mouse_Down *ev = event_info;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_ANY, b->e_obj_inherit, ev))
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
return;
|
||||
}
|
||||
if (ev->button != 3) return;
|
||||
b->last_timestamp = ev->timestamp;
|
||||
_bryce_menu(b);
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
}
|
||||
|
||||
static void
|
||||
_bryce_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Bryce *b = data;
|
||||
Evas_Event_Mouse_Up *ev = event_info;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (e_bindings_mouse_up_evas_event_handle(E_BINDING_CONTEXT_ANY, b->e_obj_inherit, ev))
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
}
|
||||
|
||||
static void
|
||||
_bryce_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
|
@ -662,6 +634,12 @@ _bryce_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
|
|||
Evas_Object *zone_clip;
|
||||
void *obs;
|
||||
|
||||
if (b->menu)
|
||||
{
|
||||
e_menu_deactivate(b->menu);
|
||||
e_object_del(E_OBJECT(b->menu));
|
||||
b->menu = NULL;
|
||||
}
|
||||
EINA_LIST_FREE(b->zone_obstacles, obs)
|
||||
{
|
||||
E_OBJECT_DEL_SET(obs, NULL);
|
||||
|
@ -771,15 +749,55 @@ _bryce_wizard_menu(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSE
|
|||
}
|
||||
|
||||
static void
|
||||
_bryce_menu_populate(Bryce *b, E_Menu *m)
|
||||
_bryce_gadget_settings_menu(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *g = data;
|
||||
e_gadget_configure(g);
|
||||
}
|
||||
|
||||
static void
|
||||
_bryce_gadget_remove_menu(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *g = data;
|
||||
e_gadget_del(g);
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
static void
|
||||
_bryce_menu_post_cb(void *data, E_Menu *m)
|
||||
{
|
||||
Bryce *b = data;
|
||||
if (b->menu != m) return;
|
||||
b->menu = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_bryce_menu_populate(Bryce *b, E_Menu *m, Evas_Object *g)
|
||||
{
|
||||
E_Menu_Item *mi;
|
||||
const char *s = NULL;
|
||||
|
||||
e_menu_title_set(m, _("Gadget Bar"));
|
||||
if (g) s = e_gadget_type_get(g);
|
||||
if (s) e_menu_title_set(m, e_gadget_type_get(g));
|
||||
else e_menu_title_set(m, _("Gadget Bar"));
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Wizard"));
|
||||
e_menu_item_callback_set(mi, _bryce_wizard_menu, b);
|
||||
if (g)
|
||||
{
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Gadget Settings"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-system");
|
||||
e_menu_item_callback_set(mi, _bryce_gadget_settings_menu, g);
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Remove Gadget"));
|
||||
e_util_menu_item_theme_icon_set(mi, "list-remove");
|
||||
e_menu_item_callback_set(mi, _bryce_gadget_remove_menu, g);
|
||||
|
||||
e_gadget_menu_populate(g, m);
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_separator_set(mi, 1);
|
||||
}
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Autosize"));
|
||||
|
@ -794,13 +812,25 @@ _bryce_menu_populate(Bryce *b, E_Menu *m)
|
|||
e_menu_item_callback_set(mi, _bryce_autohide_menu, b);
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Gadgets"));
|
||||
e_menu_item_label_set(mi, _("Wizard"));
|
||||
e_menu_item_callback_set(mi, _bryce_wizard_menu, b);
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Select Gadgets"));
|
||||
e_menu_item_callback_set(mi, _bryce_gadgets_menu, b);
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Remove"));
|
||||
e_menu_item_label_set(mi, _("Remove Gadget Bar"));
|
||||
e_util_menu_item_theme_icon_set(mi, "list-remove");
|
||||
e_menu_item_callback_set(mi, _bryce_remove_menu, b);
|
||||
|
||||
if (b->menu)
|
||||
{
|
||||
e_menu_deactivate(b->menu);
|
||||
e_object_del(E_OBJECT(b->menu));
|
||||
}
|
||||
b->menu = m;
|
||||
e_menu_post_deactivate_callback_set(m, _bryce_menu_post_cb, b);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -816,7 +846,7 @@ _bryce_owner_menu(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|||
e_menu_item_submenu_set(mi, subm);
|
||||
e_object_unref(E_OBJECT(subm));
|
||||
|
||||
_bryce_menu_populate(b, subm);
|
||||
_bryce_menu_populate(b, subm, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -862,11 +892,22 @@ _bryce_gadget_size_request(void *data, Evas_Object *obj EINA_UNUSED, void *event
|
|||
edje_object_part_geometry_get(elm_layout_edje_get(b->layout), "e.swallow.content", NULL, NULL, &size->w, &size->h);
|
||||
}
|
||||
|
||||
static void
|
||||
_bryce_context(Evas_Object *site, Evas_Object *g, unsigned int timestamp)
|
||||
{
|
||||
Bryce *b = evas_object_data_get(site, "__bryce");
|
||||
if (b)
|
||||
{
|
||||
b->last_timestamp = timestamp;
|
||||
_bryce_menu(b, g);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_bryce_orient(Bryce *b)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
|
||||
evas_object_del(b->site);
|
||||
|
||||
snprintf(buf, sizeof(buf), "__bryce%s", b->name);
|
||||
|
@ -875,7 +916,7 @@ _bryce_orient(Bryce *b)
|
|||
E_FILL(b->site);
|
||||
evas_object_data_set(b->site, "__bryce", b);
|
||||
elm_object_content_set(b->scroller, b->site);
|
||||
e_gadget_site_owner_setup(b->site, b->anchor, _bryce_style);
|
||||
e_gadget_site_owner_setup(b->site, b->anchor, _bryce_style, _bryce_context);
|
||||
if (b->orient == E_GADGET_SITE_ORIENT_HORIZONTAL)
|
||||
{
|
||||
elm_layout_signal_emit(b->layout, "e,state,orient,horizontal", "e");
|
||||
|
@ -919,6 +960,7 @@ _bryce_create(Bryce *b, Evas_Object *parent)
|
|||
|
||||
b->e_obj_inherit = E_OBJECT_ALLOC(E_Object, E_BRYCE_TYPE, _bryce_object_free);
|
||||
b->events = evas_object_rectangle_add(e_comp->evas);
|
||||
evas_object_repeat_events_set(b->events, EINA_TRUE);
|
||||
evas_object_color_set(b->events, 0, 0, 0, 0);
|
||||
evas_object_name_set(b->events, "b->events");
|
||||
evas_object_show(b->events);
|
||||
|
@ -933,9 +975,9 @@ _bryce_create(Bryce *b, Evas_Object *parent)
|
|||
elm_object_part_content_set(ly, "e.swallow.content", scr);
|
||||
evas_object_show(ly);
|
||||
b->bryce = bryce = e_comp_object_util_add(ly, _bryce_shadow_type(b));
|
||||
evas_object_repeat_events_set(evas_object_smart_parent_get(ly), 1);
|
||||
// evas_object_repeat_events_set(evas_object_smart_parent_get(ly), 1);
|
||||
evas_object_smart_member_add(b->events, bryce);
|
||||
evas_object_lower(b->events);
|
||||
evas_object_raise(b->events);
|
||||
evas_object_data_set(bryce, "comp_skip", (void*)1);
|
||||
evas_object_layer_set(bryce, b->layer);
|
||||
evas_object_lower(bryce);
|
||||
|
@ -953,8 +995,6 @@ _bryce_create(Bryce *b, Evas_Object *parent)
|
|||
evas_object_event_callback_add(bryce, EVAS_CALLBACK_RESTACK, _bryce_restack, b);
|
||||
evas_object_event_callback_add(bryce, EVAS_CALLBACK_MOVE, _bryce_moveresize, b);
|
||||
evas_object_event_callback_add(bryce, EVAS_CALLBACK_RESIZE, _bryce_moveresize, b);
|
||||
evas_object_event_callback_add(b->events, EVAS_CALLBACK_MOUSE_DOWN, _bryce_mouse_down, b);
|
||||
evas_object_event_callback_add(b->events, EVAS_CALLBACK_MOUSE_UP, _bryce_mouse_up, b);
|
||||
evas_object_event_callback_add(b->events, EVAS_CALLBACK_MOUSE_WHEEL, _bryce_mouse_wheel, b);
|
||||
|
||||
_bryce_zone_setup(b);
|
||||
|
@ -997,29 +1037,22 @@ _bryce_act_resize(E_Object *obj, const char *params, E_Binding_Event_Wheel *ev)
|
|||
}
|
||||
|
||||
static void
|
||||
_bryce_menu(Bryce *b)
|
||||
_bryce_menu(Bryce *b, Evas_Object *g)
|
||||
{
|
||||
E_Menu *m;
|
||||
int x, y;
|
||||
int x = 0, y = 0, w = 1, h = 1;
|
||||
|
||||
m = e_menu_new();
|
||||
_bryce_menu_populate(b, m);
|
||||
evas_pointer_canvas_xy_get(e_comp->evas, &x, &y);
|
||||
e_menu_activate_mouse(m, e_zone_current_get(), x, y, 1, 1, E_MENU_POP_DIRECTION_AUTO, b->last_timestamp);
|
||||
_bryce_menu_populate(b, m, g);
|
||||
if (g)
|
||||
evas_object_geometry_get(g, &x, &y, &w, &h);
|
||||
else
|
||||
evas_pointer_canvas_xy_get(e_comp->evas, &x, &y);
|
||||
e_menu_activate_mouse(m, e_zone_current_get(), x, y, w, h,
|
||||
E_MENU_POP_DIRECTION_AUTO, b->last_timestamp);
|
||||
_bryce_popup(b, m->comp_object);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_bryce_act_menu(E_Object *obj, const char *params EINA_UNUSED, E_Binding_Event_Mouse_Button *ev)
|
||||
{
|
||||
Bryce *b;
|
||||
if (obj->type != E_BRYCE_TYPE) return EINA_FALSE;
|
||||
b = e_object_data_get(obj);
|
||||
b->last_timestamp = ev->timestamp;
|
||||
_bryce_menu(b);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_bryce_zone_useful_geometry_changed(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Zone_Move_Resize *ev)
|
||||
{
|
||||
|
@ -1338,10 +1371,6 @@ e_bryce_init(void)
|
|||
e_action_predef_name_set(_("Bryces"), _("Resize Gadget Bar"), "bryce_resize", NULL, "syntax: step, example: 4", 1);
|
||||
resize_act->func.go_wheel = _bryce_act_resize;
|
||||
|
||||
menu_act = e_action_add("bryce_menu");
|
||||
e_action_predef_name_set(_("Bryces"), _("Gadget Bar Menu"), "bryce_menu", NULL, NULL, 0);
|
||||
menu_act->func.go_mouse = _bryce_act_menu;
|
||||
|
||||
edd_bryce = E_CONFIG_DD_NEW("Bryce", Bryce);
|
||||
E_CONFIG_VAL(edd_bryce, Bryce, name, STR);
|
||||
E_CONFIG_VAL(edd_bryce, Bryce, style, STR);
|
||||
|
|
|
@ -1563,6 +1563,27 @@ e_config_load(void)
|
|||
CONFIG_VERSION_UPDATE_INFO(26);
|
||||
e_config_save_queue();
|
||||
}
|
||||
CONFIG_VERSION_CHECK(28)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
E_Config_Binding_Mouse *ebm;
|
||||
|
||||
EINA_LIST_FOREACH_SAFE(e_bindings->mouse_bindings, l, ll, ebm)
|
||||
{
|
||||
if ((eina_streq(ebm->action, "gadget_menu")) ||
|
||||
(eina_streq(ebm->action, "bryce_menu")))
|
||||
{
|
||||
e_bindings->mouse_bindings =
|
||||
eina_list_remove_list
|
||||
(e_bindings->mouse_bindings, l);
|
||||
eina_stringshare_del(ebm->action);
|
||||
eina_stringshare_del(ebm->params);
|
||||
free(ebm);
|
||||
}
|
||||
}
|
||||
CONFIG_VERSION_UPDATE_INFO(27);
|
||||
e_config_save_queue();
|
||||
}
|
||||
}
|
||||
elm_config_profile_set(_e_config_profile);
|
||||
if (!e_config->remember_internal_fm_windows)
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef enum
|
|||
/* increment this whenever a new set of config values are added but the users
|
||||
* config doesn't need to be wiped - simply new values need to be put in
|
||||
*/
|
||||
#define E_CONFIG_FILE_GENERATION 26
|
||||
#define E_CONFIG_FILE_GENERATION 27
|
||||
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION)
|
||||
|
||||
#define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!!
|
||||
|
|
|
@ -33,9 +33,14 @@ typedef struct E_Gadget_Site
|
|||
Eina_List *gadgets;
|
||||
Eina_Inlist *gadget_list;
|
||||
|
||||
Eina_Bool longpressed : 1;
|
||||
Evas_Coord down_1_x, down_1_y, down_3_x, down_3_y;
|
||||
Ecore_Timer *down_timer;
|
||||
|
||||
Evas_Object *layout;
|
||||
Evas_Object *events;
|
||||
E_Gadget_Style_Cb style_cb;
|
||||
E_Gadget_Context_Cb context_cb;
|
||||
int cur_size;
|
||||
Ecore_Job *calc_job;
|
||||
|
||||
|
@ -69,6 +74,7 @@ struct E_Gadget_Config
|
|||
} style;
|
||||
E_Gadget_Configure_Cb configure;
|
||||
Evas_Object *cfg_object;
|
||||
E_Gadget_Menu_Populate_Cb populate;
|
||||
Eina_List *popups;
|
||||
E_Gadget_Site *site;
|
||||
E_Menu *menu;
|
||||
|
@ -140,7 +146,6 @@ static Evas_Object *comp_site;
|
|||
static E_Action *move_act;
|
||||
static E_Action *resize_act;
|
||||
static E_Action *configure_act;
|
||||
static E_Action *menu_act;
|
||||
|
||||
static E_Config_DD *edd_sites;
|
||||
static E_Config_DD *edd_site;
|
||||
|
@ -208,6 +213,12 @@ _comp_site_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
static void
|
||||
_gadget_free(E_Gadget_Config *zgc)
|
||||
{
|
||||
if (zgc->menu)
|
||||
{
|
||||
e_menu_deactivate(zgc->menu);
|
||||
e_object_del(E_OBJECT(zgc->menu));
|
||||
zgc->menu = NULL;
|
||||
}
|
||||
evas_object_del(zgc->display);
|
||||
eina_stringshare_del(zgc->type);
|
||||
eina_stringshare_del(zgc->external.type);
|
||||
|
@ -970,7 +981,7 @@ _site_layout(Evas_Object *o, Evas_Object_Box_Data *priv EINA_UNUSED, void *data)
|
|||
{
|
||||
if (gx < px) gx = px;
|
||||
}
|
||||
else if (
|
||||
else if ()
|
||||
{
|
||||
if (gx > px) gx = px;
|
||||
}
|
||||
|
@ -986,7 +997,7 @@ _site_layout(Evas_Object *o, Evas_Object_Box_Data *priv EINA_UNUSED, void *data)
|
|||
#endif
|
||||
}
|
||||
|
||||
evas_object_move(zgc->display, gx, gy);
|
||||
evas_object_move(zgc->display, gx, gy);
|
||||
#if 0//FIXME
|
||||
if (zgs->gravity is horizontal or something)
|
||||
px = gx + (-ax * ow);
|
||||
|
@ -1167,7 +1178,7 @@ _gadget_act_move(E_Object *obj, const char *params EINA_UNUSED, E_Binding_Event_
|
|||
zgc = evas_object_data_get(g, "__e_gadget");
|
||||
zgc->moving = 1;
|
||||
_editor_pointer_site_init(zgc->site->orient, NULL, NULL, 1);
|
||||
e_gadget_site_owner_setup(pointer_site, zgc->site->anchor, NULL);
|
||||
e_gadget_site_owner_setup(pointer_site, zgc->site->anchor, NULL, NULL);
|
||||
ZGS_GET(pointer_site);
|
||||
if (zgc->external.domain)
|
||||
_gadget_util_add(zgs, zgc->external.domain, zgc->external.type, zgc->id);
|
||||
|
@ -1241,6 +1252,13 @@ _gadget_configure(E_Gadget_Config *zgc)
|
|||
evas_object_smart_callback_call(zgc->display, "gadget_popup", zgc->cfg_object);
|
||||
}
|
||||
|
||||
static void
|
||||
_gadget_menu_populate(E_Gadget_Config *zgc, E_Menu *m)
|
||||
{
|
||||
if (!zgc->populate) return;
|
||||
zgc->populate(zgc->gadget, m);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_gadget_act_configure(E_Object *obj, const char *params EINA_UNUSED, E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
|
||||
{
|
||||
|
@ -1286,18 +1304,14 @@ _gadget_menu_style(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi)
|
|||
zgc->site->style_cb(zgc->site->layout, style, zgc->gadget);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_gadget_act_menu(E_Object *obj, const char *params EINA_UNUSED, E_Binding_Event_Mouse_Button *ev)
|
||||
static void
|
||||
_gadget_menu(Evas_Object *g, unsigned int timestamp)
|
||||
{
|
||||
E_Gadget_Config *zgc;
|
||||
Evas_Object *g;
|
||||
E_Menu_Item *mi;
|
||||
E_Menu *subm;
|
||||
int x, y;
|
||||
|
||||
if (obj->type != E_GADGET_TYPE) return EINA_FALSE;
|
||||
|
||||
g = e_object_data_get(obj);
|
||||
zgc = evas_object_data_get(g, "__e_gadget");
|
||||
_gadget_popups_clear(zgc);
|
||||
|
||||
|
@ -1314,7 +1328,7 @@ _gadget_act_menu(E_Object *obj, const char *params EINA_UNUSED, E_Binding_Event_
|
|||
if (zgc->configure)
|
||||
{
|
||||
mi = e_menu_item_new(zgc->menu);
|
||||
e_menu_item_label_set(mi, _("Settings"));
|
||||
e_menu_item_label_set(mi, _("Gadget Settings"));
|
||||
e_util_menu_item_theme_icon_set(mi, "configure");
|
||||
e_menu_item_callback_set(mi, _gadget_menu_configure, zgc);
|
||||
}
|
||||
|
@ -1375,7 +1389,7 @@ _gadget_act_menu(E_Object *obj, const char *params EINA_UNUSED, E_Binding_Event_
|
|||
e_object_del(E_OBJECT(mi));
|
||||
|
||||
mi = e_menu_item_new(zgc->menu);
|
||||
e_menu_item_label_set(mi, _("Remove"));
|
||||
e_menu_item_label_set(mi, _("Remove Gadget"));
|
||||
e_util_menu_item_theme_icon_set(mi, "list-remove");
|
||||
e_menu_item_callback_set(mi, _gadget_menu_remove, zgc);
|
||||
|
||||
|
@ -1383,56 +1397,77 @@ _gadget_act_menu(E_Object *obj, const char *params EINA_UNUSED, E_Binding_Event_
|
|||
e_menu_activate_mouse(zgc->menu,
|
||||
e_zone_current_get(),
|
||||
x, y, 1, 1,
|
||||
E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
|
||||
E_MENU_POP_DIRECTION_AUTO, timestamp);
|
||||
_desktop_rect_obj_add(zgc->menu->comp_object);
|
||||
evas_object_smart_callback_call(zgc->site->layout, "gadget_site_popup", zgc->menu->comp_object);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_site_mouse_up(E_Gadget_Site *zgs, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev)
|
||||
_site_longpress_menu(void *data)
|
||||
{
|
||||
if (e_bindings_mouse_up_ecore_event_handle(E_BINDING_CONTEXT_ANY, zgs->action->e_obj_inherit, ev))
|
||||
{
|
||||
evas_object_pointer_mode_set(zgs->events, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
||||
zgs->action = NULL;
|
||||
E_FREE_FUNC(zgs->mouse_up_handler, ecore_event_handler_del);
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
E_Gadget_Site *zgs = data;
|
||||
E_Gadget_Config *zgc;
|
||||
Evas_Object *g = NULL;
|
||||
|
||||
zgs->down_timer = NULL;
|
||||
zgs->longpressed = EINA_TRUE;
|
||||
zgc = _gadget_at_xy(zgs, zgs->down_1_x, zgs->down_1_y, NULL);
|
||||
if (zgc) g = zgc->gadget;
|
||||
if (zgs->context_cb) zgs->context_cb(zgs->layout, g, ecore_loop_time_get() * 1000);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_site_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
|
||||
_site_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
E_Gadget_Site *zgs = data;
|
||||
Evas_Event_Mouse_Down *ev = event_info;
|
||||
E_Gadget_Config *zgc;
|
||||
E_Action *act;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
zgc = _gadget_at_xy(zgs, ev->output.x, ev->output.y, NULL);
|
||||
if (!zgc) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
act = e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_ANY, zgc->e_obj_inherit, event_info);
|
||||
if (!act)
|
||||
if (ev->button == 1)
|
||||
{
|
||||
ev->event_flags &= ~EVAS_EVENT_FLAG_ON_HOLD;
|
||||
return;
|
||||
zgs->longpressed = EINA_FALSE;
|
||||
zgs->down_1_x = ev->canvas.x;
|
||||
zgs->down_1_y = ev->canvas.y;
|
||||
E_FREE_FUNC(zgs->down_timer, ecore_timer_del);
|
||||
zgs->down_timer = ecore_timer_add(1.0, _site_longpress_menu, zgs);
|
||||
}
|
||||
if (act->func.end_mouse)
|
||||
else if (ev->button == 3)
|
||||
{
|
||||
int x, y;
|
||||
zgs->down_3_x = ev->canvas.x;
|
||||
zgs->down_3_y = ev->canvas.y;
|
||||
}
|
||||
}
|
||||
|
||||
evas_object_pointer_mode_set(obj, EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN);
|
||||
zgs->action = zgc;
|
||||
if (!zgs->mouse_up_handler)
|
||||
zgs->mouse_up_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, (Ecore_Event_Handler_Cb)_site_mouse_up, zgs);
|
||||
static void
|
||||
_site_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
E_Gadget_Site *zgs = data;
|
||||
Evas_Event_Mouse_Up *ev = event_info;
|
||||
|
||||
evas_object_geometry_get(zgc->display, &x, &y, NULL, NULL);
|
||||
zgc->offset.x = ev->canvas.x - x;
|
||||
zgc->offset.y = ev->canvas.y - y;
|
||||
zgc->down.x = ev->canvas.x;
|
||||
zgc->down.y = ev->canvas.y;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button == 1)
|
||||
{
|
||||
E_FREE_FUNC(zgs->down_timer, ecore_timer_del);
|
||||
if (zgs->longpressed)
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
{
|
||||
Evas_Coord dx, dy;
|
||||
|
||||
dx = ev->canvas.x - zgs->down_3_x;
|
||||
dy = ev->canvas.y - zgs->down_3_y;
|
||||
if (((dx * dx) + (dy * dy)) < (5 * 5))
|
||||
{
|
||||
E_Gadget_Config *zgc;
|
||||
Evas_Object *g = NULL;
|
||||
|
||||
zgc = _gadget_at_xy(zgs, ev->canvas.x, ev->canvas.y, NULL);
|
||||
if (zgc) g = zgc->gadget;
|
||||
if (zgs->context_cb) zgs->context_cb(zgs->layout, g, ev->timestamp);
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1654,6 +1689,7 @@ _site_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
|
|||
zgs->style_cb = NULL;
|
||||
if (zgs->name) return;
|
||||
eina_stringshare_del(zgs->name);
|
||||
E_FREE_FUNC(zgs->down_timer, ecore_timer_del);
|
||||
free(zgs);
|
||||
}
|
||||
|
||||
|
@ -1712,6 +1748,7 @@ _site_create(E_Gadget_Site *zgs)
|
|||
evas_object_repeat_events_set(zgs->events, 1);
|
||||
evas_object_show(zgs->events);
|
||||
evas_object_event_callback_add(zgs->events, EVAS_CALLBACK_MOUSE_DOWN, _site_mouse_down, zgs);
|
||||
evas_object_event_callback_add(zgs->events, EVAS_CALLBACK_MOUSE_UP, _site_mouse_up, zgs);
|
||||
if (!zgs->orient)
|
||||
{
|
||||
evas_object_event_callback_add(zgs->layout, EVAS_CALLBACK_SHOW, _site_visibility, zgs);
|
||||
|
@ -1906,13 +1943,14 @@ e_gadget_site_anchor_get(Evas_Object *obj)
|
|||
}
|
||||
|
||||
E_API void
|
||||
e_gadget_site_owner_setup(Evas_Object *obj, E_Gadget_Site_Anchor an, E_Gadget_Style_Cb cb)
|
||||
e_gadget_site_owner_setup(Evas_Object *obj, E_Gadget_Site_Anchor an, E_Gadget_Style_Cb cb, E_Gadget_Context_Cb context_cb)
|
||||
{
|
||||
Evas_Object *parent;
|
||||
ZGS_GET(obj);
|
||||
|
||||
zgs->anchor = an;
|
||||
zgs->style_cb = cb;
|
||||
zgs->context_cb = context_cb;
|
||||
evas_object_smart_callback_call(zgs->layout, "gadget_site_anchor", NULL);
|
||||
parent = evas_object_smart_parent_get(obj);
|
||||
if (parent)
|
||||
|
@ -2025,6 +2063,29 @@ e_gadget_configure(Evas_Object *g)
|
|||
_gadget_configure(zgc);
|
||||
}
|
||||
|
||||
E_API void
|
||||
e_gadget_menu_populate_cb_set(Evas_Object *g, E_Gadget_Menu_Populate_Cb cb)
|
||||
{
|
||||
E_Gadget_Config *zgc;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(g);
|
||||
zgc = evas_object_data_get(g, "__e_gadget");
|
||||
EINA_SAFETY_ON_NULL_RETURN(zgc);
|
||||
zgc->populate = cb;
|
||||
}
|
||||
|
||||
E_API void
|
||||
e_gadget_menu_populate(Evas_Object *g, E_Menu *m)
|
||||
{
|
||||
E_Gadget_Config *zgc;
|
||||
|
||||
if (e_desklock_state_get()) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(g);
|
||||
zgc = evas_object_data_get(g, "__e_gadget");
|
||||
EINA_SAFETY_ON_NULL_RETURN(zgc);
|
||||
_gadget_menu_populate(zgc, m);
|
||||
}
|
||||
|
||||
E_API Eina_Stringshare *
|
||||
e_gadget_type_get(Evas_Object *g)
|
||||
{
|
||||
|
@ -2459,6 +2520,12 @@ e_gadget_site_rename(const char *name, const char *newname)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_desktop_gadget_context(Evas_Object *site EINA_UNUSED, Evas_Object *g, unsigned int timestamp)
|
||||
{
|
||||
if (g) _gadget_menu(g, timestamp);
|
||||
}
|
||||
|
||||
EINTERN void
|
||||
e_gadget_init(void)
|
||||
{
|
||||
|
@ -2520,10 +2587,6 @@ e_gadget_init(void)
|
|||
e_action_predef_name_set(_("Gadgets"), _("Configure gadget"), "gadget_configure", NULL, NULL, 0);
|
||||
configure_act->func.go_mouse = _gadget_act_configure;
|
||||
|
||||
menu_act = e_action_add("gadget_menu");
|
||||
e_action_predef_name_set(_("Gadgets"), _("Gadget menu"), "gadget_menu", NULL, NULL, 0);
|
||||
menu_act->func.go_mouse = _gadget_act_menu;
|
||||
|
||||
E_LIST_HANDLER_APPEND(handlers, E_EVENT_COMP_OBJECT_ADD, _site_auto_comp_object_handler, NULL);
|
||||
E_LIST_HANDLER_APPEND(handlers, E_EVENT_COMPOSITOR_UPDATE, _site_auto_comp_update, NULL);
|
||||
E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_USEFUL_GEOMETRY_CHANGED, _site_zones_update, NULL);
|
||||
|
@ -2532,6 +2595,8 @@ e_gadget_init(void)
|
|||
|
||||
comp_site = e_comp->canvas->gadget_site = e_gadget_site_add(E_GADGET_SITE_ORIENT_NONE, "__desktop");
|
||||
evas_object_event_callback_add(e_comp->canvas->resize_object, EVAS_CALLBACK_RESIZE, _comp_site_resize, comp_site);
|
||||
ZGS_GET(comp_site);
|
||||
zgs->context_cb = _desktop_gadget_context;
|
||||
evas_object_layer_set(comp_site, E_LAYER_DESKTOP);
|
||||
evas_object_resize(comp_site, e_comp->w, e_comp->h);
|
||||
#ifdef HAVE_WAYLAND
|
||||
|
@ -2563,12 +2628,10 @@ e_gadget_shutdown(void)
|
|||
e_action_del("gadget_move");
|
||||
e_action_del("gadget_resize");
|
||||
e_action_del("gadget_configure");
|
||||
e_action_del("gadget_menu");
|
||||
e_action_predef_name_del(_("Gadgets"), _("Move gadget"));
|
||||
e_action_predef_name_del(_("Gadgets"), _("Resize gadget"));
|
||||
e_action_predef_name_del(_("Gadgets"), _("Configure gadget"));
|
||||
e_action_predef_name_del(_("Gadgets"), _("Gadget menu"));
|
||||
move_act = resize_act = configure_act = menu_act = NULL;
|
||||
move_act = resize_act = configure_act = NULL;
|
||||
E_FREE_FUNC(gadget_types, eina_hash_free);
|
||||
E_FREE_FUNC(gadget_external_domains, eina_hash_free);
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@
|
|||
typedef Evas_Object *(*E_Gadget_Create_Cb)(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient);
|
||||
typedef Evas_Object *(*E_Gadget_External_Create_Cb)(Evas_Object *parent, const char *type, int *id, E_Gadget_Site_Orient orient);
|
||||
typedef Evas_Object *(*E_Gadget_Configure_Cb)(Evas_Object *gadget);
|
||||
typedef Evas_Object *(*E_Gadget_Menu_Populate_Cb)(Evas_Object *gadget, E_Menu *m);
|
||||
typedef void (*E_Gadget_Context_Cb)(Evas_Object *site, Evas_Object *g, unsigned int timestamp);
|
||||
typedef void (*E_Gadget_Wizard_End_Cb)(void *data, int id);
|
||||
typedef Evas_Object *(*E_Gadget_Wizard_Cb)(E_Gadget_Wizard_End_Cb cb, void *data, Evas_Object *site);
|
||||
typedef Evas_Object *(*E_Gadget_External_Wizard_Cb)(E_Gadget_Wizard_End_Cb cb, void *data, const char *type, Evas_Object *site);
|
||||
|
@ -106,7 +108,7 @@ E_API Evas_Object *e_gadget_site_add(E_Gadget_Site_Orient orient, const char *na
|
|||
E_API Evas_Object *e_gadget_site_auto_add(E_Gadget_Site_Orient orient, const char *name);
|
||||
E_API void e_gadget_site_del(Evas_Object *obj);
|
||||
E_API E_Gadget_Site_Anchor e_gadget_site_anchor_get(Evas_Object *obj);
|
||||
E_API void e_gadget_site_owner_setup(Evas_Object *obj, E_Gadget_Site_Anchor an, E_Gadget_Style_Cb cb);
|
||||
E_API void e_gadget_site_owner_setup(Evas_Object *obj, E_Gadget_Site_Anchor an, E_Gadget_Style_Cb cb, E_Gadget_Context_Cb context_cb);
|
||||
E_API E_Gadget_Site_Orient e_gadget_site_orient_get(Evas_Object *obj);
|
||||
E_API E_Gadget_Site_Gravity e_gadget_site_gravity_get(Evas_Object *obj);
|
||||
E_API void e_gadget_site_gravity_set(Evas_Object *obj, E_Gadget_Site_Gravity gravity);
|
||||
|
@ -117,6 +119,9 @@ E_API Eina_Bool e_gadget_site_is_desklock(Evas_Object *obj);
|
|||
|
||||
E_API void e_gadget_configure_cb_set(Evas_Object *g, E_Gadget_Configure_Cb cb);
|
||||
E_API void e_gadget_configure(Evas_Object *g);
|
||||
E_API void e_gadget_menu_populate_cb_set(Evas_Object *g, E_Gadget_Menu_Populate_Cb cb);
|
||||
E_API void e_gadget_menu_populate(Evas_Object *g, E_Menu *m);
|
||||
|
||||
E_API Evas_Object *e_gadget_site_get(Evas_Object *g);
|
||||
E_API Eina_Stringshare *e_gadget_type_get(Evas_Object *g);
|
||||
|
||||
|
|
|
@ -109,10 +109,10 @@ _backlight_popup_new(Instance *inst)
|
|||
}
|
||||
|
||||
static void
|
||||
_backlight_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
_backlight_cb_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
{
|
||||
Instance *inst = data;
|
||||
Evas_Event_Mouse_Down *ev = event;
|
||||
Evas_Event_Mouse_Up *ev = event;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
|
||||
|
@ -121,11 +121,6 @@ _backlight_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EI
|
|||
if (inst->popup) elm_ctxpopup_dismiss(inst->popup);
|
||||
else _backlight_popup_new(inst);
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -235,8 +230,8 @@ _backlight_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA
|
|||
"base/theme/gadget/backlight",
|
||||
"e/gadget/backlight/main");
|
||||
evas_object_event_callback_add(inst->o_backlight,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_backlight_cb_mouse_down,
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_backlight_cb_mouse_up,
|
||||
inst);
|
||||
evas_object_event_callback_add(inst->o_backlight,
|
||||
EVAS_CALLBACK_MOUSE_WHEEL,
|
||||
|
|
|
@ -68,11 +68,11 @@ _gad_popup_do(Instance *inst)
|
|||
}
|
||||
|
||||
static void
|
||||
_gad_mouse_down(void *data, Evas *evas EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED, void *event)
|
||||
_gad_mouse_up(void *data, Evas *evas EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED, void *event)
|
||||
{
|
||||
Instance *inst = data;
|
||||
Evas_Event_Mouse_Down *ev = event;
|
||||
Evas_Event_Mouse_Up *ev = event;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button != 1) return;
|
||||
|
@ -113,7 +113,7 @@ _gad_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient)
|
|||
evas_object_size_hint_aspect_set(o, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
||||
// XXX: fill in later when we have gotten this far
|
||||
// e_gadget_configure_cb_set(o, _gad_config);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _gad_mouse_down, inst);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _gad_mouse_up, inst);
|
||||
if (*id != -1)
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _gad_del, inst);
|
||||
instances = eina_list_append(instances, inst);
|
||||
|
|
|
@ -262,69 +262,6 @@ _bar_icon_del(Instance *inst, Icon *ic)
|
|||
E_FREE(ic);
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_settings_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||
{
|
||||
Icon *ic = data;
|
||||
Evas_Object *popup = evas_object_data_get(obj, "popup");
|
||||
Evas_Object *box = evas_object_data_get(obj, "content");
|
||||
|
||||
evas_object_del(box);
|
||||
elm_ctxpopup_dismiss(popup);
|
||||
e_gadget_configure(ic->inst->o_main);
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_add_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||
{
|
||||
Icon *ic = data;
|
||||
Evas_Object *popup = evas_object_data_get(obj, "popup");
|
||||
Evas_Object *box = evas_object_data_get(obj, "content");
|
||||
|
||||
evas_object_del(box);
|
||||
elm_ctxpopup_dismiss(popup);
|
||||
if (ic->desktop)
|
||||
e_order_append(ic->inst->order, ic->desktop);
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_remove_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||
{
|
||||
Icon *ic = data;
|
||||
Evas_Object *popup = evas_object_data_get(obj, "popup");
|
||||
Evas_Object *box = evas_object_data_get(obj, "content");
|
||||
|
||||
evas_object_del(box);
|
||||
elm_ctxpopup_dismiss(popup);
|
||||
if (ic->desktop)
|
||||
e_order_remove(ic->inst->order, ic->desktop);
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_properties_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||
{
|
||||
Icon *ic = data;
|
||||
Evas_Object *popup = evas_object_data_get(obj, "popup");
|
||||
Evas_Object *box = evas_object_data_get(obj, "content");
|
||||
|
||||
evas_object_del(box);
|
||||
elm_ctxpopup_dismiss(popup);
|
||||
if (ic->desktop)
|
||||
e_desktop_edit(ic->desktop);
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_action_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||
{
|
||||
Efreet_Desktop_Action *action = (Efreet_Desktop_Action*)data;
|
||||
Evas_Object *popup = evas_object_data_get(obj, "popup");
|
||||
Evas_Object *box = evas_object_data_get(obj, "content");
|
||||
|
||||
evas_object_del(box);
|
||||
elm_ctxpopup_dismiss(popup);
|
||||
e_exec(e_zone_current_get(), NULL, action->exec, NULL, "luncher");
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_icon_mouse_out(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED)
|
||||
{
|
||||
|
@ -529,6 +466,104 @@ _bar_drag_timer(void *data)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_action_cb(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
|
||||
{
|
||||
Efreet_Desktop_Action *action = (Efreet_Desktop_Action*)data;
|
||||
|
||||
e_exec(e_zone_current_get(), NULL, action->exec, NULL, "luncher");
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_add_cb(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
|
||||
{
|
||||
Icon *ic = data;
|
||||
|
||||
if (ic->desktop)
|
||||
e_order_append(ic->inst->order, ic->desktop);
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_remove_cb(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
|
||||
{
|
||||
Icon *ic = data;
|
||||
|
||||
if (ic->desktop)
|
||||
e_order_remove(ic->inst->order, ic->desktop);
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_menu_properties_cb(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
|
||||
{
|
||||
Icon *ic = data;
|
||||
|
||||
if (ic->desktop)
|
||||
e_desktop_edit(ic->desktop);
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_gadget_menu_populate(Evas_Object *g, E_Menu *m)
|
||||
{
|
||||
Instance *inst = evas_object_data_get(g, "instance");
|
||||
Evas *e = evas_object_evas_get(g);
|
||||
Eina_List *l;
|
||||
Icon *ic = NULL;
|
||||
Evas_Coord px, py;
|
||||
E_Menu_Item *mi;
|
||||
Efreet_Desktop_Action *action;
|
||||
|
||||
evas_pointer_canvas_xy_get(e, &px, &py);
|
||||
EINA_LIST_FOREACH(inst->icons, l, ic)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
evas_object_geometry_get(g, &x, &y, &w, &h);
|
||||
if (E_INSIDE(px, py, x, y, w, h)) break;
|
||||
ic = NULL;
|
||||
}
|
||||
if (!ic) return;
|
||||
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_separator_set(mi, 1);
|
||||
|
||||
if (ic->desktop)
|
||||
{
|
||||
if (ic->desktop->actions)
|
||||
{
|
||||
EINA_LIST_FOREACH(ic->desktop->actions, l, action)
|
||||
{
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, action->name);
|
||||
e_util_menu_item_theme_icon_set(mi, action->icon);
|
||||
e_menu_item_callback_set(mi, _bar_icon_menu_action_cb, action);
|
||||
}
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_separator_set(mi, 1);
|
||||
}
|
||||
}
|
||||
if (ic->desktop)
|
||||
{
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Icon Properties"));
|
||||
e_util_menu_item_theme_icon_set(mi, "preferences-applications");
|
||||
e_menu_item_callback_set(mi, _bar_icon_menu_properties_cb, ic);
|
||||
}
|
||||
if (ic->in_order)
|
||||
{
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Remove Icon"));
|
||||
e_util_menu_item_theme_icon_set(mi, "list-remove");
|
||||
e_menu_item_callback_set(mi, _bar_icon_menu_remove_cb, ic);
|
||||
}
|
||||
else if ((!ic->in_order) && (ic->desktop))
|
||||
{
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Add Icon"));
|
||||
e_util_menu_item_theme_icon_set(mi, "list-add");
|
||||
e_menu_item_callback_set(mi, _bar_icon_menu_add_cb, ic);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_bar_icon_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
{
|
||||
|
@ -545,86 +580,7 @@ _bar_icon_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
|
|||
ic->drag.x = ev->output.x;
|
||||
ic->drag.y = ev->output.y;
|
||||
E_FREE_FUNC(ic->drag_timer, ecore_timer_del);
|
||||
ic->drag_timer = ecore_timer_loop_add(.35, _bar_drag_timer, ic);
|
||||
}
|
||||
if (ev->button == 3)
|
||||
{
|
||||
Evas_Object *popup, *box, *item, *sep;
|
||||
Eina_List *l = NULL;
|
||||
Efreet_Desktop_Action *action;
|
||||
E_Gadget_Site_Orient orient = e_gadget_site_orient_get(e_gadget_site_get(ic->inst->o_main));
|
||||
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
||||
popup = elm_ctxpopup_add(e_comp->elm);
|
||||
elm_object_style_set(popup, "noblock");
|
||||
evas_object_smart_callback_add(popup, "dismissed", _bar_popup_dismissed, ic);
|
||||
evas_object_size_hint_min_set(popup, ic->inst->size, ic->inst->size);
|
||||
|
||||
box = elm_box_add(popup);
|
||||
evas_object_size_hint_align_set(box, 0, 0);
|
||||
switch (orient)
|
||||
{
|
||||
case E_GADGET_SITE_ORIENT_HORIZONTAL:
|
||||
elm_box_horizontal_set(box, EINA_TRUE);
|
||||
break;
|
||||
case E_GADGET_SITE_ORIENT_VERTICAL:
|
||||
elm_box_horizontal_set(box, EINA_FALSE);
|
||||
break;
|
||||
default:
|
||||
elm_box_horizontal_set(box, EINA_TRUE);
|
||||
}
|
||||
|
||||
if (ic->desktop)
|
||||
{
|
||||
if (ic->desktop->actions)
|
||||
{
|
||||
EINA_LIST_FOREACH(ic->desktop->actions, l, action)
|
||||
{
|
||||
item = _bar_icon_menu_item_new(ic, popup, box, action->name, action->icon);
|
||||
evas_object_event_callback_add(item, EVAS_CALLBACK_MOUSE_UP, _bar_icon_menu_action_clicked, action);
|
||||
}
|
||||
sep = elm_separator_add(box);
|
||||
switch (orient)
|
||||
{
|
||||
case E_GADGET_SITE_ORIENT_HORIZONTAL:
|
||||
elm_separator_horizontal_set(item, EINA_TRUE);
|
||||
break;
|
||||
case E_GADGET_SITE_ORIENT_VERTICAL:
|
||||
elm_separator_horizontal_set(item, EINA_FALSE);
|
||||
break;
|
||||
default:
|
||||
elm_separator_horizontal_set(item, EINA_TRUE);
|
||||
}
|
||||
elm_box_pack_end(box, sep);
|
||||
evas_object_show(sep);
|
||||
}
|
||||
}
|
||||
if (ic->desktop)
|
||||
{
|
||||
item = _bar_icon_menu_item_new(ic, popup, box, _("Icon Properties"), "preferences-applications");
|
||||
evas_object_event_callback_add(item, EVAS_CALLBACK_MOUSE_UP, _bar_icon_menu_properties_clicked, ic);
|
||||
}
|
||||
if (ic->in_order)
|
||||
{
|
||||
item = _bar_icon_menu_item_new(ic, popup, box, _("Remove From Bar"), "list-remove");
|
||||
evas_object_event_callback_add(item, EVAS_CALLBACK_MOUSE_UP, _bar_icon_menu_remove_clicked, ic);
|
||||
}
|
||||
else if (!ic->in_order && ic->desktop)
|
||||
{
|
||||
item = _bar_icon_menu_item_new(ic, popup, box, _("Add To Bar"), "list-add");
|
||||
evas_object_event_callback_add(item, EVAS_CALLBACK_MOUSE_UP, _bar_icon_menu_add_clicked, ic);
|
||||
}
|
||||
item = _bar_icon_menu_item_new(ic, popup, box, _("Luncher Settings"), "configure");
|
||||
evas_object_event_callback_add(item, EVAS_CALLBACK_MOUSE_UP, _bar_icon_menu_settings_clicked, ic);
|
||||
|
||||
elm_object_content_set(popup, box);
|
||||
evas_object_show(box);
|
||||
|
||||
e_gadget_util_ctxpopup_place(ic->inst->o_main, popup, ic->o_layout);
|
||||
e_comp_object_util_autoclose(popup, NULL, NULL, NULL);
|
||||
evas_object_layer_set(popup, E_LAYER_POPUP);
|
||||
evas_object_show(popup);
|
||||
ic->drag_timer = ecore_timer_loop_add(0.35, _bar_drag_timer, ic);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,7 +590,18 @@ _bar_icon_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED
|
|||
Icon *ic = data;
|
||||
Evas_Event_Mouse_Up *ev = event_data;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
||||
{
|
||||
if (ev->button == 1)
|
||||
{
|
||||
ic->drag.start = 0;
|
||||
ic->drag.dnd = 0;
|
||||
E_FREE_FUNC(ic->mouse_in_timer, ecore_timer_del);
|
||||
E_FREE_FUNC(ic->mouse_out_timer, ecore_timer_del);
|
||||
E_FREE_FUNC(ic->drag_timer, ecore_timer_del);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_bar_check_modifiers(ev->modifiers)) return;
|
||||
|
||||
if (ev->button == 1)
|
||||
|
@ -1896,6 +1863,7 @@ _bar_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED)
|
|||
evas_object_data_set(inst->o_icon_con, "instance", inst);
|
||||
|
||||
e_gadget_configure_cb_set(inst->o_main, _bar_gadget_configure);
|
||||
e_gadget_menu_populate_cb_set(inst->o_main, _bar_gadget_menu_populate);
|
||||
evas_object_smart_callback_del_full(obj, "gadget_created", _bar_created_cb, data);
|
||||
|
||||
if (!inst->cfg->dir)
|
||||
|
|
|
@ -145,7 +145,18 @@ _grid_icon_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
|
|||
Icon *ic = data;
|
||||
Evas_Event_Mouse_Up *ev = event_data;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
||||
{
|
||||
if (ev->button == 1)
|
||||
{
|
||||
ic->drag.start = 0;
|
||||
ic->drag.dnd = 0;
|
||||
E_FREE_FUNC(ic->mouse_in_timer, ecore_timer_del);
|
||||
E_FREE_FUNC(ic->mouse_out_timer, ecore_timer_del);
|
||||
E_FREE_FUNC(ic->drag_timer, ecore_timer_del);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_grid_check_modifiers(ev->modifiers)) return;
|
||||
|
||||
if (ev->button == 1)
|
||||
|
@ -155,10 +166,6 @@ _grid_icon_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
|
|||
E_FREE_FUNC(ic->drag_timer, ecore_timer_del);
|
||||
ic->drag_timer = ecore_timer_loop_add(.35, _grid_drag_timer, ic);
|
||||
}
|
||||
if (ev->button == 3)
|
||||
{
|
||||
e_gadget_configure(ic->inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -538,11 +538,11 @@ _popup_new(Instance *inst)
|
|||
}
|
||||
|
||||
static void
|
||||
_mouse_down_cb(void *data, Evas *evas EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED, void *event)
|
||||
_mouse_up_cb(void *data, Evas *evas EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED, void *event)
|
||||
{
|
||||
Instance *inst = data;
|
||||
Evas_Event_Mouse_Down *ev = event;
|
||||
Evas_Event_Mouse_Up *ev = event;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
|
||||
|
@ -559,11 +559,6 @@ _mouse_down_cb(void *data, Evas *evas EINA_UNUSED,
|
|||
{
|
||||
_volume_mute_cb(NULL, NULL);
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -620,8 +615,8 @@ _mixer_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA_UNU
|
|||
e_theme_edje_object_set(inst->o_mixer,
|
||||
"base/theme/gadget/mixer",
|
||||
"e/gadget/mixer/main");
|
||||
evas_object_event_callback_add(inst->o_mixer, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_mouse_down_cb, inst);
|
||||
evas_object_event_callback_add(inst->o_mixer, EVAS_CALLBACK_MOUSE_UP,
|
||||
_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->o_mixer, EVAS_CALLBACK_MOUSE_WHEEL,
|
||||
_mouse_wheel_cb, inst);
|
||||
evas_object_event_callback_add(inst->o_mixer, EVAS_CALLBACK_RESIZE,
|
||||
|
|
|
@ -79,11 +79,11 @@ _refresh_timer_cb(void *data)
|
|||
|
||||
/* Gadget Api Functions */
|
||||
static void
|
||||
_gadget_mouse_down_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
_gadget_mouse_up_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
{
|
||||
E_PackageKit_Instance *inst = data;
|
||||
E_PackageKit_Module_Context *ctxt = packagekit_mod->data;
|
||||
Evas_Event_Mouse_Down *ev = event;
|
||||
Evas_Event_Mouse_Up *ev = event;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
@ -134,8 +134,8 @@ _gadget_create_cb(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient EINA
|
|||
ctxt->instances = eina_list_append(ctxt->instances, inst);
|
||||
if (*id >= 0)
|
||||
{ // normal mode
|
||||
evas_object_event_callback_add(inst->gadget, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_gadget_mouse_down_cb, inst);
|
||||
evas_object_event_callback_add(inst->gadget, EVAS_CALLBACK_MOUSE_UP,
|
||||
_gadget_mouse_up_cb, inst);
|
||||
packagekit_icon_update(ctxt, EINA_FALSE);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1088,21 +1088,6 @@ _pager_gadget_configure(Evas_Object *g EINA_UNUSED)
|
|||
return config_pager(e_zone_current_get());
|
||||
}
|
||||
|
||||
static void
|
||||
_button_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Instance *inst = data;
|
||||
Evas_Event_Mouse_Down *ev = event_info;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (_pager_check_modifiers(ev->modifiers)) return;
|
||||
if (ev->button != 3) return;
|
||||
if (!pager_config) return;
|
||||
if (cfg_dialog) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
e_gadget_configure(inst->o_pager);
|
||||
}
|
||||
|
||||
EINTERN void
|
||||
_pager_cb_config_gadget_updated(Eina_Bool style_changed)
|
||||
{
|
||||
|
@ -2973,8 +2958,6 @@ pager_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient EINA_UNUS
|
|||
evas_object_smart_callback_add(parent, "gadget_created", _pager_gadget_created_cb, inst);
|
||||
evas_object_smart_callback_add(parent, "gadget_site_anchor", _pager_gadget_anchor_change_cb, inst);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _pager_cb_move, inst);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_button_cb_mouse_down, inst);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_SHOW,
|
||||
_pager_cb_obj_show, inst);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_HIDE,
|
||||
|
|
|
@ -122,10 +122,10 @@ _menu_cb_post(void *data, E_Menu *m)
|
|||
}
|
||||
|
||||
static void
|
||||
_button_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
_button_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Instance *inst = data;
|
||||
Evas_Event_Mouse_Down *ev = event_info;
|
||||
Evas_Event_Mouse_Up *ev = event_info;
|
||||
Evas_Coord x, y, w, h;
|
||||
E_Gadget_Site_Anchor an;
|
||||
int dir = E_MENU_POP_DIRECTION_AUTO;
|
||||
|
@ -216,8 +216,8 @@ start_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient)
|
|||
inst->o_button = o;
|
||||
evas_object_size_hint_aspect_set(o, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
||||
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_button_cb_mouse_down, inst);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
|
||||
_button_cb_mouse_up, inst);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, start_del, inst);
|
||||
evas_object_smart_callback_add(parent, "gadget_site_anchor", _anchor_change, inst);
|
||||
evas_object_smart_callback_add(parent, "gadget_created", _gadget_created, inst);
|
||||
|
|
|
@ -140,30 +140,19 @@ _batman_configure_cb(Evas_Object *g)
|
|||
}
|
||||
|
||||
static void
|
||||
_batman_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
_batman_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
{
|
||||
Evas_Event_Mouse_Down *ev = event_data;
|
||||
Evas_Event_Mouse_Up *ev = event_data;
|
||||
Instance *inst = data;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button != 3)
|
||||
if (ev->button == 1)
|
||||
{
|
||||
if (inst->cfg->batman.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->batman.popup);
|
||||
else
|
||||
inst->cfg->batman.popup = _batman_popup_create(inst);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inst->cfg->batman.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->batman.popup);
|
||||
if (!sysinfo_config) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (inst->cfg->esm != E_SYSINFO_MODULE_BATMAN)
|
||||
batman_configure(inst);
|
||||
else
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -536,7 +525,7 @@ _batman_warning_popup(Instance *inst, int t, double percent)
|
|||
evas_object_show(inst->warning);
|
||||
|
||||
evas_object_geometry_get(inst->warning, &x, &y, &w, &h);
|
||||
evas_object_event_callback_add(inst->warning, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
evas_object_event_callback_add(inst->warning, EVAS_CALLBACK_MOUSE_UP,
|
||||
_batman_cb_warning_popup_hide, inst);
|
||||
|
||||
_batman_face_level_set(inst->popup_battery, percent);
|
||||
|
@ -651,8 +640,8 @@ _batman_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED)
|
|||
E_FILL(inst->cfg->batman.o_gadget);
|
||||
elm_box_pack_end(inst->o_main, inst->cfg->batman.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->batman.o_gadget,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_batman_mouse_down_cb, inst);
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_batman_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->batman.o_gadget, EVAS_CALLBACK_RESIZE, _batman_resize_cb, inst);
|
||||
evas_object_show(inst->cfg->batman.o_gadget);
|
||||
evas_object_smart_callback_del_full(obj, "gadget_created", _batman_created_cb, data);
|
||||
|
@ -679,8 +668,8 @@ sysinfo_batman_create(Evas_Object *parent, Instance *inst)
|
|||
E_EXPAND(inst->cfg->batman.o_gadget);
|
||||
E_FILL(inst->cfg->batman.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->batman.o_gadget,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_batman_mouse_down_cb, inst);
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_batman_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->batman.o_gadget, EVAS_CALLBACK_RESIZE, _batman_resize_cb, inst);
|
||||
evas_object_show(inst->cfg->batman.o_gadget);
|
||||
|
||||
|
|
|
@ -331,30 +331,19 @@ _cpuclock_popup_create(Instance *inst)
|
|||
}
|
||||
|
||||
static void
|
||||
_cpuclock_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
_cpuclock_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
{
|
||||
Evas_Event_Mouse_Down *ev = event_data;
|
||||
Evas_Event_Mouse_Up *ev = event_data;
|
||||
Instance *inst = data;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button != 3)
|
||||
if (ev->button == 1)
|
||||
{
|
||||
if (inst->cfg->cpuclock.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->cpuclock.popup);
|
||||
else
|
||||
inst->cfg->cpuclock.popup = _cpuclock_popup_create(inst);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inst->cfg->cpuclock.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->cpuclock.popup);
|
||||
if (!sysinfo_config) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (inst->cfg->esm != E_SYSINFO_MODULE_CPUCLOCK)
|
||||
cpuclock_configure(inst);
|
||||
else
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1084,8 +1073,8 @@ _cpuclock_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED)
|
|||
evas_object_event_callback_add(inst->cfg->cpuclock.o_gadget, EVAS_CALLBACK_RESIZE, _cpuclock_resize_cb, inst);
|
||||
elm_box_pack_end(inst->o_main, inst->cfg->cpuclock.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->cpuclock.o_gadget,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_cpuclock_mouse_down_cb, inst);
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_cpuclock_mouse_up_cb, inst);
|
||||
evas_object_show(inst->cfg->cpuclock.o_gadget);
|
||||
evas_object_smart_callback_del_full(obj, "gadget_created", _cpuclock_created_cb, data);
|
||||
|
||||
|
@ -1127,8 +1116,8 @@ sysinfo_cpuclock_create(Evas_Object *parent, Instance *inst)
|
|||
E_EXPAND(inst->cfg->cpuclock.o_gadget);
|
||||
E_FILL(inst->cfg->cpuclock.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->cpuclock.o_gadget,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_cpuclock_mouse_down_cb, inst);
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_cpuclock_mouse_up_cb, inst);
|
||||
edje_object_signal_callback_add(elm_layout_edje_get(inst->cfg->cpuclock.o_gadget), "e,action,governor,next", "*",
|
||||
_cpuclock_face_cb_set_governor, inst);
|
||||
edje_object_signal_callback_add(elm_layout_edje_get(inst->cfg->cpuclock.o_gadget), "e,action,frequency,increase", "*",
|
||||
|
|
|
@ -64,15 +64,15 @@ _cpumonitor_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
|
|||
}
|
||||
|
||||
static void
|
||||
_cpumonitor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
_cpumonitor_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
{
|
||||
Evas_Object *popup, *box, *pbar, *label;
|
||||
Evas_Event_Mouse_Down *ev = event_data;
|
||||
Evas_Event_Mouse_Up *ev = event_data;
|
||||
Instance *inst = data;
|
||||
char text[256];
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button != 3)
|
||||
if (ev->button == 1)
|
||||
{
|
||||
if (inst->cfg->cpumonitor.popup)
|
||||
{
|
||||
|
@ -109,17 +109,6 @@ _cpumonitor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
|
|||
evas_object_show(popup);
|
||||
inst->cfg->cpumonitor.popup = popup;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inst->cfg->cpumonitor.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->cpumonitor.popup);
|
||||
if (!sysinfo_config) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (inst->cfg->esm != E_SYSINFO_MODULE_CPUMONITOR)
|
||||
cpumonitor_configure(inst);
|
||||
else
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -404,8 +393,8 @@ _cpumonitor_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSE
|
|||
E_EXPAND(inst->cfg->cpumonitor.o_gadget);
|
||||
E_FILL(inst->cfg->cpumonitor.o_gadget);
|
||||
elm_box_pack_end(inst->o_main, inst->cfg->cpumonitor.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_cpumonitor_mouse_down_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_UP,
|
||||
_cpumonitor_mouse_up_cb, inst);
|
||||
evas_object_show(inst->cfg->cpumonitor.o_gadget);
|
||||
|
||||
inst->cfg->cpumonitor.o_gadget_box = elm_box_add(inst->cfg->cpumonitor.o_gadget);
|
||||
|
@ -439,8 +428,8 @@ sysinfo_cpumonitor_create(Evas_Object *parent, Instance *inst)
|
|||
"e/gadget/cpumonitor/main");
|
||||
E_EXPAND(inst->cfg->cpumonitor.o_gadget);
|
||||
E_FILL(inst->cfg->cpumonitor.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_cpumonitor_mouse_down_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_UP,
|
||||
_cpumonitor_mouse_up_cb, inst);
|
||||
evas_object_show(inst->cfg->cpumonitor.o_gadget);
|
||||
|
||||
inst->cfg->cpumonitor.o_gadget_box = elm_box_add(inst->cfg->cpumonitor.o_gadget);
|
||||
|
|
|
@ -237,13 +237,13 @@ _memusage_popup_create(Instance *inst)
|
|||
}
|
||||
|
||||
static void
|
||||
_memusage_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
_memusage_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
{
|
||||
Evas_Event_Mouse_Down *ev = event_data;
|
||||
Evas_Event_Mouse_Up *ev = event_data;
|
||||
Instance *inst = data;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button != 3)
|
||||
if (ev->button == 1)
|
||||
{
|
||||
if (inst->cfg->memusage.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->memusage.popup);
|
||||
|
@ -253,17 +253,6 @@ _memusage_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
|
|||
_memusage_popup_update(inst);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inst->cfg->memusage.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->memusage.popup);
|
||||
if (!sysinfo_config) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE)
|
||||
memusage_configure(inst);
|
||||
else
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -471,8 +460,8 @@ _memusage_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED)
|
|||
E_FILL(inst->cfg->memusage.o_gadget);
|
||||
elm_box_pack_end(inst->o_main, inst->cfg->memusage.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_memusage_mouse_down_cb, inst);
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_memusage_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
|
||||
EVAS_CALLBACK_RESIZE,
|
||||
_memusage_resize_cb, inst);
|
||||
|
@ -507,8 +496,8 @@ sysinfo_memusage_create(Evas_Object *parent, Instance *inst)
|
|||
E_EXPAND(inst->cfg->memusage.o_gadget);
|
||||
E_FILL(inst->cfg->memusage.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_memusage_mouse_down_cb, inst);
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_memusage_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
|
||||
EVAS_CALLBACK_RESIZE,
|
||||
_memusage_resize_cb, inst);
|
||||
|
|
|
@ -84,15 +84,15 @@ _netstatus_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
|
|||
}
|
||||
|
||||
static void
|
||||
_netstatus_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
_netstatus_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
{
|
||||
Evas_Object *label, *popup, *table, *pbar;
|
||||
Evas_Event_Mouse_Down *ev = event_data;
|
||||
Evas_Event_Mouse_Up *ev = event_data;
|
||||
Instance *inst = data;
|
||||
char text[4096], buf[4096];
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button != 3)
|
||||
if (ev->button == 1)
|
||||
{
|
||||
if (inst->cfg->netstatus.popup)
|
||||
{
|
||||
|
@ -164,17 +164,6 @@ _netstatus_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
|
|||
evas_object_show(popup);
|
||||
inst->cfg->netstatus.popup = popup;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inst->cfg->netstatus.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->netstatus.popup);
|
||||
if (!sysinfo_config) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (inst->cfg->esm != E_SYSINFO_MODULE_NETSTATUS)
|
||||
netstatus_configure(inst);
|
||||
else
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -423,7 +412,7 @@ _netstatus_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED
|
|||
E_EXPAND(inst->cfg->netstatus.o_gadget);
|
||||
E_FILL(inst->cfg->netstatus.o_gadget);
|
||||
elm_box_pack_end(inst->o_main, inst->cfg->netstatus.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _netstatus_mouse_down_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_MOUSE_UP, _netstatus_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_RESIZE, _netstatus_resize_cb, inst);
|
||||
evas_object_show(inst->cfg->netstatus.o_gadget);
|
||||
evas_object_smart_callback_del_full(obj, "gadget_created", _netstatus_created_cb, data);
|
||||
|
@ -448,7 +437,7 @@ sysinfo_netstatus_create(Evas_Object *parent, Instance *inst)
|
|||
"e/gadget/netstatus/main");
|
||||
E_EXPAND(inst->cfg->netstatus.o_gadget);
|
||||
E_FILL(inst->cfg->netstatus.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _netstatus_mouse_down_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_MOUSE_UP, _netstatus_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_RESIZE, _netstatus_resize_cb, inst);
|
||||
evas_object_show(inst->cfg->netstatus.o_gadget);
|
||||
|
||||
|
|
|
@ -231,30 +231,19 @@ _thermal_popup_create(Instance *inst)
|
|||
}
|
||||
|
||||
static void
|
||||
_thermal_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
_thermal_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data)
|
||||
{
|
||||
Evas_Event_Mouse_Down *ev = event_data;
|
||||
Evas_Event_Mouse_Up *ev = event_data;
|
||||
Instance *inst = data;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button != 3)
|
||||
if (ev->button == 1)
|
||||
{
|
||||
if (inst->cfg->thermal.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->thermal.popup);
|
||||
else
|
||||
inst->cfg->thermal.popup = _thermal_popup_create(inst);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inst->cfg->thermal.popup)
|
||||
elm_ctxpopup_dismiss(inst->cfg->thermal.popup);
|
||||
if (!sysinfo_config) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (inst->cfg->esm != E_SYSINFO_MODULE_THERMAL)
|
||||
thermal_configure(inst);
|
||||
else
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -426,8 +415,8 @@ _thermal_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED)
|
|||
E_FILL(inst->cfg->thermal.o_gadget);
|
||||
elm_box_pack_end(inst->o_main, inst->cfg->thermal.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->thermal.o_gadget,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_thermal_mouse_down_cb, inst);
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_thermal_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->thermal.o_gadget, EVAS_CALLBACK_RESIZE, _thermal_resize_cb, inst);
|
||||
evas_object_show(inst->cfg->thermal.o_gadget);
|
||||
evas_object_smart_callback_del_full(obj, "gadget_created", _thermal_created_cb, data);
|
||||
|
@ -451,8 +440,8 @@ sysinfo_thermal_create(Evas_Object *parent, Instance *inst)
|
|||
E_EXPAND(inst->cfg->thermal.o_gadget);
|
||||
E_FILL(inst->cfg->thermal.o_gadget);
|
||||
evas_object_event_callback_add(inst->cfg->thermal.o_gadget,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_thermal_mouse_down_cb, inst);
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_thermal_mouse_up_cb, inst);
|
||||
evas_object_event_callback_add(inst->cfg->thermal.o_gadget, EVAS_CALLBACK_RESIZE, _thermal_resize_cb, inst);
|
||||
evas_object_show(inst->cfg->thermal.o_gadget);
|
||||
|
||||
|
|
|
@ -274,10 +274,10 @@ clock_instances_redo(void)
|
|||
}
|
||||
|
||||
static void
|
||||
_clock_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
_clock_cb_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
{
|
||||
Instance *inst = data;
|
||||
Evas_Event_Mouse_Down *ev = event;
|
||||
Evas_Event_Mouse_Up *ev = event;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
@ -286,8 +286,6 @@ _clock_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_U
|
|||
if (inst->popup) elm_ctxpopup_dismiss(inst->popup);
|
||||
else clock_popup_new(inst);
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
e_gadget_configure(inst->o_clock);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -435,8 +433,8 @@ clock_create(Evas_Object *parent, Instance *inst, E_Gadget_Site_Orient orient)
|
|||
evas_object_data_set(o, "clock", inst);
|
||||
|
||||
evas_object_event_callback_add(inst->o_clock,
|
||||
EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_clock_cb_mouse_down,
|
||||
EVAS_CALLBACK_MOUSE_UP,
|
||||
_clock_cb_mouse_up,
|
||||
inst);
|
||||
|
||||
if (inst->cfg->id < 0) return o;
|
||||
|
|
|
@ -994,9 +994,9 @@ _wireless_popup_dismissed(void *data EINA_UNUSED, Evas_Object *obj, void *event_
|
|||
}
|
||||
|
||||
static void
|
||||
_wireless_gadget_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
|
||||
_wireless_gadget_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Event_Mouse_Down *ev = event_info;
|
||||
Evas_Event_Mouse_Up *ev = event_info;
|
||||
Instance *inst = data;
|
||||
Evas_Object *ctx, *tb, *list, *toggle;
|
||||
int type;
|
||||
|
@ -1182,7 +1182,7 @@ _wireless_gadget_icon_add(Instance *inst, int type)
|
|||
E_FILL(g);
|
||||
e_theme_edje_object_set(g, NULL, wireless_theme_groups[type]);
|
||||
elm_object_tooltip_content_cb_set(g, _wireless_tooltip, inst, NULL);
|
||||
evas_object_event_callback_add(g, EVAS_CALLBACK_MOUSE_DOWN, _wireless_gadget_mouse_down, inst);
|
||||
evas_object_event_callback_add(g, EVAS_CALLBACK_MOUSE_UP, _wireless_gadget_mouse_up, inst);
|
||||
}
|
||||
DBG("Updating icon for %d", type);
|
||||
_wifi_icon_init(inst->icon[type], wireless_current[type] ? wireless_current[type]->wn : NULL, type);
|
||||
|
|
|
@ -120,19 +120,14 @@ _xkbg_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSE
|
|||
}
|
||||
|
||||
static void
|
||||
_xkbg_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
_xkbg_cb_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
|
||||
{
|
||||
Evas_Event_Mouse_Down *ev = event;
|
||||
Evas_Event_Mouse_Up *ev = event;
|
||||
Instance *inst = data;
|
||||
|
||||
if (!inst) return;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
if (ev->button == 3)
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
e_gadget_configure(inst->o_main);
|
||||
}
|
||||
else if ((ev->button == 1) && (inst->popup))
|
||||
if ((ev->button == 1) && (inst->popup))
|
||||
{
|
||||
elm_ctxpopup_dismiss(inst->popup);
|
||||
return;
|
||||
|
@ -253,8 +248,8 @@ _xkbg_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUS
|
|||
inst->o_xkbflag);
|
||||
}
|
||||
else inst->o_xkbflag = NULL;
|
||||
evas_object_event_callback_add(inst->o_xkbswitch, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_xkbg_cb_mouse_down, inst);
|
||||
evas_object_event_callback_add(inst->o_xkbswitch, EVAS_CALLBACK_MOUSE_UP,
|
||||
_xkbg_cb_mouse_up, inst);
|
||||
evas_object_event_callback_add(inst->o_xkbswitch, EVAS_CALLBACK_RESIZE,
|
||||
_xkbg_resize_cb, inst);
|
||||
elm_box_pack_end(inst->o_main, inst->o_xkbswitch);
|
||||
|
|
Loading…
Reference in New Issue