* Daniel Juyung Seo <seojuyu...@gmail.com> [2012-11-14 16:44:24 +0900]:

> On Fri, Aug 31, 2012 at 1:46 AM, Enlightenment SVN <
> no-re...@enlightenment.org> wrote:
> 
> > Log:
> > [elm] Popup now a layout.
> >
> >
> >
> >
> > Author:       glima
> > Date:         2012-08-30 09:46:34 -0700 (Thu, 30 Aug 2012)
> > New Revision: 75897
> > Trac:         http://trac.enlightenment.org/e/changeset/75897
> >
> > Added:
> >   trunk/elementary/doc/img/popup_inheritance_tree.eps
> > trunk/elementary/doc/img/popup_inheritance_tree.png
> > trunk/elementary/src/lib/elm_widget_popup.h
> > Modified:
> >   trunk/elementary/doc/Makefile.am
> > trunk/elementary/doc/img/elm-widget-tree.eps
> > trunk/elementary/doc/img/elm-widget-tree.png
> > trunk/elementary/src/lib/Makefile.am trunk/elementary/src/lib/elc_popup.c
> > trunk/elementary/src/lib/elc_popup.h
> >
> > Modified: trunk/elementary/doc/Makefile.am
> > ===================================================================
> > --- trunk/elementary/doc/Makefile.am    2012-08-30 16:46:20 UTC (rev 75896)
> > +++ trunk/elementary/doc/Makefile.am    2012-08-30 16:46:34 UTC (rev 75897)
> > @@ -135,6 +135,7 @@
> >         photocam \
> >         player \
> >         plug \
> > +       popup \
> >         progressbar \
> >         radio \
> >         route \
> >
> > Modified: trunk/elementary/doc/img/elm-widget-tree.eps
> > ===================================================================
> > (Binary files differ)
> >
> > Modified: trunk/elementary/doc/img/elm-widget-tree.png
> > ===================================================================
> > (Binary files differ)
> >
> >
> > Property changes on: trunk/elementary/doc/img/popup_inheritance_tree.eps
> > ___________________________________________________________________
> > Added: svn:mime-type
> >    + application/postscript
> >
> >
> > Property changes on: trunk/elementary/doc/img/popup_inheritance_tree.png
> > ___________________________________________________________________
> > Added: svn:mime-type
> >    + image/png
> >
> > Modified: trunk/elementary/src/lib/Makefile.am
> > ===================================================================
> > --- trunk/elementary/src/lib/Makefile.am        2012-08-30 16:46:20 UTC
> > (rev 75896)
> > +++ trunk/elementary/src/lib/Makefile.am        2012-08-30 16:46:34 UTC
> > (rev 75897)
> > @@ -89,6 +89,7 @@
> >  elm_widget_photocam.h \
> >  elm_widget_player.h \
> >  elm_widget_plug.h \
> > +elm_widget_popup.h \
> >  elm_widget_progressbar.h \
> >  elm_widget_radio.h \
> >  elm_widget_route.h \
> >
> > Modified: trunk/elementary/src/lib/elc_popup.c
> > ===================================================================
> > --- trunk/elementary/src/lib/elc_popup.c        2012-08-30 16:46:20 UTC
> > (rev 75896)
> > +++ trunk/elementary/src/lib/elc_popup.c        2012-08-30 16:46:34 UTC
> > (rev 75897)
> > @@ -1,520 +1,739 @@
> >  #include <Elementary.h>
> >  #include "elm_priv.h"
> > +#include "elm_widget_popup.h"
> >
> >  #define ELM_POPUP_ACTION_BUTTON_MAX 3
> > -typedef struct _Widget_Data Widget_Data;
> > -typedef struct _Elm_Popup_Content_Item Elm_Popup_Content_Item;
> > -typedef struct _Action_Area_Data Action_Area_Data;
> >
> > -struct _Widget_Data
> > -{
> > -   Evas_Object *base;
> > -   Evas_Object *notify;
> > -   Evas_Object *title_icon;
> > -   Evas_Object *title_access_obj;
> > -   Evas_Object *content_area;
> > -   Evas_Object *content_text_obj;
> > -   Evas_Object *action_area;
> > -   Evas_Object *box;
> > -   Evas_Object *tbl;
> > -   Evas_Object *spacer;
> > -   Evas_Object *scr;
> > -   Evas_Object *content;
> > -   Eina_List *items;
> > -   const char *title_text;
> > -   Action_Area_Data *buttons[ELM_POPUP_ACTION_BUTTON_MAX];
> > -   Elm_Wrap_Type content_text_wrap_type;
> > -   unsigned int button_count;
> > -   Evas_Coord max_sc_w;
> > -   Evas_Coord max_sc_h;
> > -   Eina_Bool scr_size_recalc:1;
> > -};
> > +EAPI const char ELM_POPUP_SMART_NAME[] = "elm_popup";
> >
> > -struct _Elm_Popup_Content_Item
> > -{
> > -   Elm_Widget_Item base;
> > -   const char *label;
> > -   Evas_Object *icon;
> > -   Evas_Smart_Cb func;
> > -   Eina_Bool disabled:1;
> > -};
> > +static void _button_remove(Evas_Object *, int, Eina_Bool);
> >
> > -struct _Action_Area_Data
> > -{
> > -   Evas_Object *obj;
> > -   Evas_Object *btn;
> > -   Eina_Bool delete_me;
> > -};
> > -
> > -static const char *widtype = NULL;
> > -static void _del_hook(Evas_Object *obj);
> > -static void _theme_hook(Evas_Object *obj);
> > -static void _text_set_hook(Evas_Object *obj, const char *part,
> > -                                          const char *label);
> > -static const char *_text_get_hook(const Evas_Object *obj,
> > -                                                 const char *part);
> > -static void _content_set_hook(Evas_Object *obj, const char *part,
> > -                                             Evas_Object *content);
> > -static Evas_Object *_content_get_hook(Evas_Object *obj,
> > -                                                     const char *part);
> > -static Evas_Object *_content_unset_hook(Evas_Object *obj,
> > -                                                       const char *part);
> > -static void _item_text_set_hook(Elm_Object_Item *it, const char *part,
> > -                                const char *label);
> > -static const char *_item_text_get_hook(const Elm_Object_Item *it,
> > -                                       const char *part);
> > -static void _item_content_set_hook(Elm_Object_Item *it, const char *part,
> > -                                   Evas_Object *content);
> > -static Evas_Object *_item_content_unset_hook(const Elm_Object_Item *it,
> > -                                             const char *part);
> > -static Evas_Object *_item_content_get_hook(const Elm_Object_Item *it,
> > -                                           const char *part);
> > -static void _item_disable_hook(Elm_Object_Item *it);
> > -static void _item_del_pre_hook(Elm_Object_Item *it);
> > -static void _item_signal_emit_hook(Elm_Object_Item *it, const char
> > *emission,
> > -                                   const char *source);
> > -static void _sizing_eval(Evas_Object *obj);
> > -static void _block_clicked_cb(void *data, Evas_Object *obj, void
> > *event_info);
> > -static void _notify_resize(void *data, Evas *e, Evas_Object *obj,
> > -                           void *event_info);
> > -static void _timeout(void *data, Evas_Object *obj , void *event_info);
> > -static void _sub_del(void *data, Evas_Object *obj, void *event_info);
> > -static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
> > -static void _restack(void *data, Evas *e, Evas_Object *obj, void
> > *event_info);
> > -static void _layout_change_cb(void *data, Evas_Object *obj __UNUSED__,
> > -                              const char *emission __UNUSED__,
> > -                              const char *source __UNUSED__);
> > -static void _item_new(Elm_Popup_Content_Item *item);
> > -static void _remove_items(Widget_Data *wd);
> > -static void _list_new(Evas_Object *obj);
> > -static void _list_del(Widget_Data *wd);
> > -static void _item_sizing_eval(Elm_Popup_Content_Item *item);
> > -static void _item_select_cb(void *data, Evas_Object *obj __UNUSED__,
> > -                            const char *emission __UNUSED__,
> > -                            const char *source __UNUSED__);
> > -static void _scroller_size_calc(Evas_Object *obj);
> > -static void _action_button_set(Evas_Object *obj, Evas_Object *btn,
> > -                               unsigned int idx);
> > -static Evas_Object *_action_button_get(Evas_Object *obj, unsigned int
> > idx);
> > -static Evas_Object *_action_button_unset(Evas_Object *obj, unsigned int
> > idx);
> > -static void _button_remove(Evas_Object *obj, Evas_Object *content,
> > -                           Eina_Bool delete);
> > -static void _popup_show(void *data, Evas *e, Evas_Object *obj,
> > -                        void *event_info);
> > -static void _popup_hide(void *data, Evas *e, Evas_Object *obj,
> > -                        void *event_info);
> >  static const char SIG_BLOCK_CLICKED[] = "block,clicked";
> >  static const char SIG_TIMEOUT[] = "timeout";
> > -static const Evas_Smart_Cb_Description _signals[] = {
> > -       {SIG_BLOCK_CLICKED, ""},
> > -       {SIG_TIMEOUT, ""},
> > -       {NULL, NULL}
> > +static const Evas_Smart_Cb_Description _smart_callbacks[] = {
> > +   {SIG_BLOCK_CLICKED, ""},
> > +   {SIG_TIMEOUT, ""},
> > +   {NULL, NULL}
> >  };
> >
> > -#define ELM_POPUP_CONTENT_ITEM_CHECK_RETURN(it, ...)
> >    \
> > -  ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
> > -  ELM_CHECK_WIDTYPE(WIDGET(item), widtype) __VA_ARGS__;
> > +EVAS_SMART_SUBCLASS_NEW
> > +  (ELM_POPUP_SMART_NAME, _elm_popup, Elm_Popup_Smart_Class,
> > +  Elm_Layout_Smart_Class, elm_layout_smart_class_get, _smart_callbacks);
> >
> >  static void
> > -_layout_set(Evas_Object *obj)
> > +_visuals_set(Evas_Object *obj)
> >  {
> > -   Widget_Data *wd = elm_widget_data_get(obj);
> > +   ELM_POPUP_DATA_GET(obj, sd);
> >
> > -   if (!wd) return;
> > -   if ((!(wd->title_text)) && (!(wd->title_icon)))
> > -     elm_object_signal_emit(wd->base, "elm,state,title_area,hidden",
> > "elm");
> > +   if (!sd->title_text && !sd->title_icon)
> > +     elm_layout_signal_emit(obj, "elm,state,title_area,hidden", "elm");
> >     else
> > -     elm_object_signal_emit(wd->base, "elm,state,title_area,visible",
> > "elm");
> > -   if (wd->button_count)
> > -     elm_object_signal_emit(wd->base, "elm,state,action_area,visible",
> > "elm");
> > +     elm_layout_signal_emit(obj, "elm,state,title_area,visible", "elm");
> > +
> > +   if (sd->button_count)
> > +     elm_layout_signal_emit(obj, "elm,state,action_area,visible", "elm");
> >     else
> > -     elm_object_signal_emit(wd->base, "elm,state,action_area,hidden",
> > "elm");
> > +     elm_layout_signal_emit(obj, "elm,state,action_area,hidden", "elm");
> >  }
> >
> >  static void
> > -_del_hook(Evas_Object *obj)
> > +_block_clicked_cb(void *data,
> > +                  Evas_Object *obj __UNUSED__,
> > +                  void *event_info __UNUSED__)
> >  {
> > -   Widget_Data *wd = elm_widget_data_get(obj);
> > +   evas_object_smart_callback_call(data, SIG_BLOCK_CLICKED, NULL);
> > +}
> >
> > -   if (!wd) return;
> > -   free(wd);
> > +static void
> > +_timeout_cb(void *data,
> > +            Evas_Object *obj __UNUSED__,
> > +            void *event_info __UNUSED__)
> > +{
> > +   evas_object_hide(data);
> > +   evas_object_smart_callback_call(data, SIG_TIMEOUT, NULL);
> >  }
> >
> >  static void
> > -_del_pre_hook(Evas_Object *obj)
> > +_on_show(void *data __UNUSED__,
> > +         Evas *e __UNUSED__,
> > +         Evas_Object *obj,
> > +         void *event_info __UNUSED__)
> >  {
> > +   ELM_POPUP_DATA_GET(obj, sd);
> > +
> > +   evas_object_show(sd->notify);
> > +
> >
> 
> Dear glima,
> 

Hi, Seoz.

> 
> > +   /* yeah, ugly, but again, this widget needs a rewrite */
> > +   elm_object_content_set(sd->notify, obj);
> >
> 
> It's time to discuss this line.
> It looks like this cause the focus next infinite loop issue.
> When we set the focus to popup, it calls elm_widget_focus_next_get() which
> makes circular calls between notify and popup.
> notify -> popup -> notify -> popup -> ...
> 
> It's quite easy to reproduce this, just call
> elm_object_focus_allow_set(popup, EINA_TRUE);
> elm_object_focus_set(popup, EINA_TRUE);
> 
> Any suggestion with this?

Reading the codes again, from popup and notify, I'm still helpless on
the isse.  Popup, to be better designed, should be a direct child of
notify, as it only extends its behavior. But notify is NOT a layout
and popup had to have smart functions (old hooks) on:

 - text_set() and
 - text_get(),

in order to keep API compatibility. Notify didn't have any layout
class dependency, and because of its kinda tricky positioning
calculations, it was not easy to make it layout, so I didn't. If I'd
give any advice on the rewriting stories here, I'd go with making
notify a layout, keeping its behavior (it won't break our API) and
rewriting popup, now trivially, to only extend it.

Otherwise you're screwed on this focus issue -- only fat hacks over
hacks to make it work.

BR,

-- 
Gustavo Lima Chaves
Computer Engineer @ ProFUSION Embedded Systems

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to