2013/6/11 Daniel Juyung Seo <seojuyu...@gmail.com>

> On Wed, Jun 12, 2013 at 12:43 AM, Leif Middelschulte <
> leif.middelschu...@gmail.com> wrote:
>
> > Am Dienstag, 11. Juni 2013 um 16:19 schrieb Rafael Antognolli:
> > > Hi,
> > >
> > > On Tue, Jun 11, 2013 at 9:54 AM, Daniel Juyung Seo <
> seojuyu...@gmail.com(mailto:
> > seojuyu...@gmail.com)> wrote:
> > > > On Tue, Jun 11, 2013 at 9:42 PM, Leif Middelschulte <
> > > > leif.middelschu...@gmail.com (mailto:leif.middelschu...@gmail.com)>
> > wrote:
> > > >
> > > > > Am Dienstag, 11. Juni 2013 schrieb Daniel Juyung Seo :
> > > > >
> > > > > > Hello, this follows elementary policy.
> > > > > >
> > > > > > 1. focused object A lose its focus when another object is going
> to
> > get
> > > > > > focus.
> > > > > > 2. an object is focused when it's clicked.
> > > > > >
> > > > > > so the sequence is
> > > > > > 1. click object B
> > > > > > 2. focused object A lose its focus
> > > > > > 3. object B gets focus
> > > > > >
> > > > > > So only one object is focused at any point.
> > > > > >
> > > > > > It's not possible to unfocus other object before any other object
> > is
> > > > > > clicked.
> > > > > > Because clicked signal will trigger unfocus signal.
> > > > > >
> > > > >
> > > > >
> > > > > So, as I already imagined, it's due to the current implementation.
> > > >
> > > > Not just an implementation. It's a policy.
> > > >
> > > >
> > > > > Can't we trigger "unfocused" callbacks, before we trigger "clicked"
> > > > > callbacks? I assume that it's the way it is, because Edje
> understands
> > > > >
> > > >
> > > >
> > > > How come?
> > > > I repeat.
> > > > 1. An object is focused when it's clicked.
> > > > 2. An object is unfocused when other object is going to be focused.
> > > >
> > > > It means mouse click -> unfocused -> focused.
> > >
> > > If I understood correctly, Leif is saying that this is not what is
> > > happening, and his test proves that (I didn't try it). He is saying
> > > that the current order is:
> > >
> > > mouse click -> focused -> unfocused
> > I haven't considered "focused" events yet, because I want to react to
> > "clicked while focused" (sets stuff) and "unfocused" (resets stuff)
> events.
> >
>
> Well, contradiction here.
> If an object is already focused, click does not emit focused signal again.
> So "clicked while focused" doesn't happen.
>
Sorry, that was more of a "goal description".

>
>
> > But with current behavior I get: set (click) -> reset (unfocused)
> > So, afaics, we basically ignore the concept of object focus for "clicked"
> > events.
> > Maybe we can have "focused,clicked" or whatever?
> >
>
> Well maybe I should check your fundamental requirement first, not wasting
> my time on this topic.
>
Sorry, I didn't mean to waste anybody's time here :-/

> >From your example I don't get what you really want to do as the final
> outcome.
> Even your first email does not describe your goal.
> Can you show me more code?
>
I've attached an easy example.
Clicking on a button shall set the global state variable to some value. If
focus is lost, it should be reset to some other value.
As you can see, clicking on one button, and then the next, while using
"unfocused" callbacks, leads to a reset value.


>
> Thanks.
>
Thank you!

Leif

>
> Daniel Juyung Seo (SeoZ)
>
>
> >
> > Thanks for your explanations,
> >
> > Leif
> > >
> > > Regards,
> > > --
> > > Rafael Antognolli
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > This SF.net (http://SF.net) email is sponsored by Windows:
> > >
> > > Build for Windows Store.
> > >
> > > http://p.sf.net/sfu/windows-dev2dev
> > > _______________________________________________
> > > enlightenment-devel mailing list
> > > enlightenment-devel@lists.sourceforge.net (mailto:
> > enlightenment-devel@lists.sourceforge.net)
> > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > >
> > >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Windows:
> >
> > Build for Windows Store.
> >
> > http://p.sf.net/sfu/windows-dev2dev
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>



-- 
Leif
#include <stdio.h>
#include <elementary-1/Elementary.h>

#define RESET_VALUE (-1)

static void __mouse_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void __focus_out_cb(void *data, Evas_Object *obj, void *event_info);

int global_state_var = 0;
const int state_vals[] = { 0, 1, 2};

EAPI_MAIN int
elm_main(int argc, char **argv)
{
   unsigned int i;
   Evas_Object *win, *bg, *bx;

   win = elm_win_add(NULL, "OddSequence", ELM_WIN_BASIC);
   elm_win_title_set(win, "Odd Callback Sequence");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);

   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bx);
   elm_box_horizontal_set(bx, EINA_TRUE);
   evas_object_show(bx);

   for (i = 0; i < 3; i++)
   {
       char buf[16];
       Evas_Object *bt = elm_button_add(win);
       snprintf(buf, (sizeof(buf) - 1), "Button %i", i);
       elm_object_text_set(bt, buf);

       evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
       evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);

       evas_object_event_callback_add(bt, EVAS_CALLBACK_MOUSE_UP, __mouse_clicked_cb, &state_vals[i]);
       evas_object_smart_callback_add(bt, "unfocused", __focus_out_cb, &state_vals[i]);

       elm_box_pack_end(bx, bt);
       evas_object_show(bt);
   }

   evas_object_resize(win, 320, 240);
   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}
ELM_MAIN()

    static void
__focus_out_cb(void *data, Evas_Object *vci, void *event_info)
{
    global_state_var = RESET_VALUE;
    printf("Focus out: Global state var reset to: %i\n", global_state_var);
}

    static void
__mouse_clicked_cb(void *data, Evas *evas, Evas_Object *vent_ctrl_obj, void *event_info)
{
    global_state_var = *(unsigned int*)data;
    printf("Clicked: Global state var set to: %i\n", global_state_var);
}
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to