allow multiple evry instances. just for testing atm: use F1 to drag-off popup.

fix segv: keep state until cleared. ignore events from delete_me states


SVN revision: 49453
This commit is contained in:
Hannes Janetzek 2010-06-04 19:32:59 +00:00
parent 1e8d952fa2
commit c197c02360
10 changed files with 489 additions and 500 deletions

View File

@ -21,7 +21,11 @@ typedef struct _Evry_Window Evry_Window;
struct _Evry_Window
{
E_Popup *popup;
E_Win *ewin;
Evas *evas;
E_Zone *zone;
Ecore_X_Window input_window;
Evas_Object *o_main;
Eina_Bool request_selection;
@ -37,19 +41,20 @@ struct _Evry_Window
Evry_Selector **selectors;
Evry_Selector **sel_list;
int level;
unsigned int level;
int mouse_out;
int mouse_button;
unsigned int mouse_out;
unsigned int mouse_button;
Evry_View *view_clearing;
Evry_View *view_freeing;
unsigned int grab;
Evry_State *state_clearing;
};
struct _Evry_Selector
{
Evry_Window *win;
/* current state */
Evry_State *state;
@ -74,6 +79,8 @@ struct _Evry_Selector
Ecore_Timer *update_timer;
Ecore_Timer *action_timer;
const char *edje_part;
};
struct _Evry_State
@ -111,6 +118,10 @@ struct _Evry_State
Eina_Bool trigger_active;
unsigned int request;
Ecore_Timer *clear_timer;
Eina_Bool delete_me;
};
struct _Evry_View
@ -128,9 +139,9 @@ struct _Evry_View
int (*update) (Evry_View *view);
void (*clear) (Evry_View *view);
Ecore_Timer *clear_timer;
int priority;
Evry_State *state;
};
struct _Tab_View
@ -150,7 +161,7 @@ struct _Tab_View
double align;
double align_to;
Ecore_Animator *animator;
Ecore_Timer *timer;
Ecore_Idle_Exiter *timer;
};
struct _Config
@ -203,16 +214,12 @@ struct _History
int version;
Eina_Hash *subjects;
double begin;
Eina_Bool changed;
};
/* evry.c */
/*** Evry_Api functions ***/
void evry_item_select(const Evry_State *s, Evry_Item *it);
void evry_item_mark(const Evry_State *state, Evry_Item *it, Eina_Bool mark);
void evry_plugin_select(Evry_Plugin *p);
/* int evry_list_win_show(void);
* void evry_list_win_hide(void); */
Evry_Item *evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label,
Evas_Object *(*icon_get) (Evry_Item *it, Evas *e),
void (*cb_free) (Evry_Item *item));
@ -278,7 +285,7 @@ int evry_api_version_check(int version);
Evry_Type evry_type_register(const char *type);
const char *evry_type_get(Evry_Type type);
/*** internal ***/
Tab_View *evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e);
void evry_tab_view_free(Tab_View *v);
@ -300,7 +307,7 @@ void evry_plug_collection_shutdown(void);
int evry_init(void);
int evry_shutdown(void);
Evry_Window *evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params);
void evry_hide(int clear);
void evry_hide(Evry_Window *win, int clear);
int evry_plug_actions_init();
void evry_plug_actions_shutdown();
@ -313,10 +320,10 @@ void evry_history_free(void);
int evry_browse_item(Evry_Item *it);
int evry_browse_back(Evry_Selector *sel);
void evry_plugin_action(int finished);
void evry_plugin_action(Evry_Window *win, int finished);
int evry_state_push(Evry_Selector *sel, Eina_List *plugins);
int evry_selectors_switch(int dir, int slide);
int evry_selectors_switch(Evry_Window *win,int dir, int slide);
int evry_view_toggle(Evry_State *s, const char *trigger);
int evry_gadget_init(void);
@ -369,10 +376,10 @@ extern int _e_module_evry_log_dom;
#undef WRN
#undef ERR
#define DBG(...) EINA_LOG_DOM_DBG(_e_module_evry_log_dom , __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(_e_module_evry_log_dom , __VA_ARGS__)
#define WRN(...) EINA_LOG_DOM_WARN(_e_module_evry_log_dom , __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_e_module_evry_log_dom , __VA_ARGS__)
#define DBG(...) EINA_LOG_DOM_DBG(_e_module_evry_log_dom, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(_e_module_evry_log_dom, __VA_ARGS__)
#define WRN(...) EINA_LOG_DOM_WARN(_e_module_evry_log_dom, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_e_module_evry_log_dom, __VA_ARGS__)
/*** E Module ***/
EAPI void *e_modapi_init (E_Module *m);

File diff suppressed because it is too large Load Diff

View File

@ -69,7 +69,7 @@ _gc_shutdown(E_Gadcon_Client *gcc)
inst = gcc->data;
if (inst->del_fn && inst->win)
e_object_delfn_del(E_OBJECT(inst->win->popup), inst->del_fn);
e_object_delfn_del(E_OBJECT(inst->win->ewin), inst->del_fn);
evas_object_del(inst->o_button);
free(inst);
@ -125,7 +125,7 @@ static void _del_func(void *data, void *obj)
Instance *inst = data;
e_gadcon_locked_set(inst->gcc->gadcon, 0);
e_object_delfn_del(E_OBJECT(inst->win->popup), inst->del_fn);
e_object_delfn_del(E_OBJECT(inst->win->ewin), inst->del_fn);
inst->del_fn = NULL;
inst->win = NULL;
edje_object_signal_emit(inst->o_button, "e,state,unfocused", "e");
@ -162,8 +162,8 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
* evry_conf->edge_width,
* evry_conf->edge_height); */
pw = win->popup->w;
ph = win->popup->h;
pw = win->ewin->w;
ph = win->ewin->h;
switch (inst->gcc->gadcon->orient)
{
@ -171,22 +171,22 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
e_popup_move(win->popup, x, y + h);
e_win_move(win->ewin, x, y + h);
break;
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BR:
case E_GADCON_ORIENT_CORNER_BL:
e_popup_move(win->popup, x, y - ph);
e_win_move(win->ewin, x, y - ph);
break;
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_LB:
e_popup_move(win->popup, x + w, y);
e_win_move(win->ewin, x + w, y);
break;
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_RB:
e_popup_move(win->popup, x - pw, y);
e_win_move(win->ewin, x - pw, y);
break;
case E_GADCON_ORIENT_FLOAT:
case E_GADCON_ORIENT_HORIZ:
@ -197,15 +197,15 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
inst->win = win;
if (win->popup->x + pw > win->popup->zone->w)
e_popup_move(win->popup, win->popup->zone->w - pw, win->popup->y);
if (win->ewin->x + pw > win->zone->w)
e_win_move(win->ewin, win->zone->w - pw, win->ewin->y);
if (win->popup->y + ph > win->popup->zone->h)
e_popup_move(win->popup, win->popup->x, win->popup->zone->h - ph);
if (win->ewin->y + ph > win->zone->h)
e_win_move(win->ewin, win->ewin->x, win->zone->h - ph);
e_gadcon_locked_set(inst->gcc->gadcon, 1);
inst->del_fn = e_object_delfn_add(E_OBJECT(win->popup), _del_func, inst);
inst->del_fn = e_object_delfn_add(E_OBJECT(win->ewin), _del_func, inst);
edje_object_signal_emit(inst->o_button, "e,state,focused", "e");
}

View File

@ -67,6 +67,7 @@ _add_item(Plugin *p, Plugin_Config *pc)
it->icon_get = itp->icon_get;
it->data = pc;
it->browseable = EINA_TRUE;
it->detail = eina_stringshare_ref(EVRY_ITEM(p)->label);
p->plugins = eina_list_append(p->plugins, it);
}
return it;
@ -100,9 +101,7 @@ _begin_all(Evry_Plugin *plugin, const Evry_Item *item)
{
if (!strcmp(pc->name, "All") ||
!strcmp(pc->name, "Actions") ||
!strcmp(pc->name, "Text") ||
!strcmp(pc->name, "Calculator") ||
!strcmp(pc->name, "Spell Checker") ||
!strcmp(pc->name, "Plugins"))
continue;
@ -139,14 +138,38 @@ _fetch(Evry_Plugin *plugin, const char *input)
return !!(plugin->items);
}
static Evry_Plugin *
_add_plugin(const char *name)
{
Evry_Plugin *p;
char path[4096];
char title[4096];
p = EVRY_PLUGIN_NEW(Evry_Plugin, N_(name),
_module_icon, COLLECTION_PLUGIN,
_begin, _finish, _fetch, NULL);
p->browse = &_browse;
snprintf(path, sizeof(path), "extensions/everything-%s", p->name);
snprintf(title, sizeof(title), "Everything %s", p->name);
e_configure_registry_item_add
(path, 110, title, NULL, NULL/*icon*/, evry_collection_conf_dialog);
p->config_path = eina_stringshare_add(path);
plugins = eina_list_append(plugins, p);
return p;
}
Eina_Bool
evry_plug_collection_init(void)
{
Evry_Plugin *p;
Plugin_Config *pc, *pcc;
Plugin_Config *pc;
Eina_List *l;
char path[4096];
char title[4096];
plugin_config.min_query = 0;
plugin_config.top_level = EINA_TRUE;
@ -158,43 +181,23 @@ evry_plug_collection_init(void)
e_configure_registry_category_add
("extensions", 80, _("Extensions"), NULL, "preferences-extensions");
p = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Plugins"),
_module_icon, COLLECTION_PLUGIN,
_begin_all, _finish, _fetch, NULL);
p->browse = &_browse;
p = _add_plugin("Plugins");
p->begin = &_begin_all;
if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 100))
{
p->config->aggregate = EINA_TRUE;
p->config->top_level = EINA_TRUE;
p->config->view_mode = VIEW_MODE_THUMB;
}
plugins = eina_list_append(plugins, p);
EINA_LIST_FOREACH(evry_conf->collections, l, pc)
{
p = EVRY_PLUGIN_NEW(Evry_Plugin, N_(pc->name),
_module_icon, COLLECTION_PLUGIN,
_begin, _finish, _fetch, NULL);
p->browse = &_browse;
p = _add_plugin(pc->name);
p->config = pc;
pc->plugin = p;
if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1))
{
p->config->aggregate = EINA_FALSE;
}
snprintf(path, sizeof(path), "extensions/everything-%s", p->name);
snprintf(title, sizeof(title), "Everything %s", p->name);
e_configure_registry_item_add
(path, 110, title, NULL, NULL/*icon*/, evry_collection_conf_dialog);
p->config_path = eina_stringshare_add(path);
plugins = eina_list_append(plugins, p);
p->config->aggregate = EINA_FALSE;
}
return EINA_TRUE;

View File

@ -3,6 +3,12 @@
static Evry_Plugin *p1;
static Evry_Plugin *p2;
static Evry_Plugin *
_begin(Evry_Plugin *p, const Evry_Item *it)
{
return p;
}
static void
_finish(Evry_Plugin *p)
{
@ -38,11 +44,11 @@ evry_plug_text_init(void)
{
p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Text"),
"accessories-text-editor", EVRY_TYPE_TEXT,
NULL, _finish, _fetch, NULL);
_begin, _finish, _fetch, NULL);
p2 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Text"),
"accessories-text-editor", EVRY_TYPE_TEXT,
NULL, _finish, _fetch, NULL);
_begin, _finish, _fetch, NULL);
if (evry_plugin_register(p1, EVRY_PLUGIN_OBJECT,999))
{

View File

@ -106,7 +106,7 @@ _evry_plugin_action_browse(Evry_Action *act)
sel = it->plugin->state->selector;
evry_selectors_switch(-1, EINA_TRUE);
evry_selectors_switch(sel->win, -1, EINA_TRUE);
if ((p = pp->begin(pp, it)))
{

View File

@ -149,8 +149,8 @@ struct _Evry_Plugin
active. free 'items' here */
void (*finish) (Evry_Plugin *p);
/* optional: plugin is added to the list of current plugins and
queried for results when not returning NULL. The previos
/* plugin is added to the list of current plugins and
queried for results when not returning NULL. The previous
selectors item is passed, i.e. a plugin registered as action
receives the subject, a plugin registered as object receives the
action item. here you can check wheter the plugin can be queried,

View File

@ -205,21 +205,27 @@ _item_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
Evas_Event_Mouse_Down *ev = event_info;
Item *it = data;
Smart_Data *sd = evas_object_smart_data_get(it->obj);
const Evry_State *s;
if (!sd) return;
sd->mouse_act = 1;
sd->it_down = it;
sd->mouse_button = ev->button;
s = sd->view->state;
if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK))
{
evry_item_select(sd->view->state, it->item);
_pan_item_select(it->obj, it, 0);
if (it != sd->cur_item)
{
evry_item_select(s, it->item);
_pan_item_select(it->obj, it, 0);
}
if (it->item->browseable)
evry_browse_item(it->item);
else
evry_plugin_action(1);
evry_plugin_action(s->selector->win, 1);
}
else
{
@ -234,6 +240,7 @@ _item_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
Evas_Event_Mouse_Up *ev = event_info;
Item *it = data;
Smart_Data *sd = evas_object_smart_data_get(it->obj);
const Evry_State *s;
if (!sd) return;
sd->mouse_x = 0;
@ -245,20 +252,23 @@ _item_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
edje_object_signal_emit(sd->view->bg, "e,action,hide,back", "e");
sd->it_down = NULL;
s = sd->view->state;
if (ev->button == 1)
{
if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) &&
(it != sd->cur_item))
{
evry_item_select(sd->view->state, it->item);
evry_item_select(s, it->item);
_pan_item_select(it->obj, it, 0);
}
}
else if (ev->button == 3)
{
evry_item_select(sd->view->state, it->item);
evry_item_select(s, it->item);
_pan_item_select(it->obj, it, 0);
evry_plugin_action(0);
evry_plugin_action(s->selector->win, 0);
}
}
@ -1313,7 +1323,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
}
else
{
if (it->y >= cur - sd->h) break;
if (it->y + it->h >= cur - sd->h) break;
}
if (!l->next)
@ -1487,9 +1497,9 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
sd->mouse_x = 0;
sd->mouse_y = 0;
if (sel->states->next)
evry_browse_back(NULL);
evry_browse_back(sel);
else
evry_selectors_switch(-1, EINA_TRUE);
evry_selectors_switch(sel->win, -1, EINA_TRUE);
}
else if ((sd->it_down && (sd->cur_item == sd->it_down)) &&
(sd->mouse_x - ev->cur.canvas.x > SLIDE_RESISTANCE))
@ -1503,7 +1513,7 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
}
else
{
evry_selectors_switch(1, EINA_TRUE);
evry_selectors_switch(sel->win, 1, EINA_TRUE);
}
sd->it_down = NULL;
@ -1529,7 +1539,6 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
v = E_NEW(View, 1);
v->view = *view;
v->view.clear_timer = NULL;
v->state = s;
v->evas = evas_object_evas_get(swallow);

View File

@ -2,7 +2,6 @@
static Evry_View *view;
static Evas_Object *o_text = NULL;
static const Evry_State *state = NULL;
static void
_view_clear(Evry_View *v)
@ -13,7 +12,6 @@ _view_clear(Evry_View *v)
o_text = NULL;
}
static int
_view_update(Evry_View *v)
{
@ -55,7 +53,7 @@ _cb_key_down(Evry_View *v, const Ecore_Event_Key *ev)
return 1;
}
evry_view_toggle((Evry_State *)state, NULL);
evry_view_toggle(v->state, NULL);
return 1;
}
@ -64,7 +62,7 @@ _view_create(Evry_View *v, const Evry_State *s, const Evas_Object *swallow)
{
Evas_Object *o;
int mw, mh;
char *text =
_(" Ok, here comes the explanation of <hilight>everything</hilight>...<br>"
" Just type a few letters of the thing you are looking for. <br>"
@ -106,7 +104,6 @@ _view_create(Evry_View *v, const Evry_State *s, const Evas_Object *swallow)
o_text = o;
v->active = 1;
state = s;
return v;
}

View File

@ -26,7 +26,6 @@ _timer_cb(void *data)
v->timer = NULL;
return 0;
}
static void
@ -117,7 +116,8 @@ _tabs_update(Tab_View *v)
if (!w && !v->timer)
{
v->timer = ecore_timer_add(0.1, _timer_cb, v);
v->timer = ecore_idle_exiter_add(_timer_cb, v);
e_util_wakeup();
return;
}
@ -384,7 +384,7 @@ evry_tab_view_free(Tab_View *v)
ecore_animator_del(v->animator);
if (v->timer)
ecore_timer_del(v->timer);
ecore_idle_exiter_del(v->timer);
E_FREE(v);
}