Better focus behaviour for the filelist... like sloppy focus.

This commit is contained in:
Jaime Thomas 2008-12-09 23:17:57 +00:00
parent d464ad8aaf
commit 8701dba4d2
5 changed files with 85 additions and 20 deletions

View File

@ -278,8 +278,7 @@ group {
}
program {
name: "focus_in";
signal: "ecdb,button,in";
name: "focus_in,mouse";
signal: "mouse,down,1";
action: STATE_SET "visible" 0.0;
source: "*";
@ -287,6 +286,15 @@ group {
transition: DECELERATE 0.5;
}
program {
name: "focus_in,ecdb";
signal: "ecdb,focus,in";
action: STATE_SET "visible" 0.0;
source: "ecdb";
target: "focus_clip";
transition: DECELERATE 0.5;
}
program {
name: "unclick";
signal: "mouse,clicked,1";

View File

@ -90,20 +90,29 @@ group {
programs {
program {
name: "focus1";
name: "focus_set";
action: FOCUS_SET;
signal: "mouse,down,*";
source: "*";
target: "label";
}
program {
name: "focus2";
name: "focus_in,mouse";
action: STATE_SET "focused" 0.0;
signal: "mouse,down,*";
source: "*";
target: "entry_focus";
transition: DECELERATE 0.5;
after: "focus_set";
}
program {
name: "focus_in,ecdb";
action: STATE_SET "focused" 0.0;
signal: "ecdb,focus,in";
source: "ecdb";
target: "entry_focus";
transition: DECELERATE 0.5;
after: "focus_set";
}
program {

View File

@ -28,15 +28,6 @@
#include <limits.h>
#include <pthread.h>
#undef FREE
#define FREE(dat) \
{ \
if (dat) { free(dat); dat = NULL; } \
}
#undef __UNUSED__
#define __UNUSED__ __attribute__ ((unused))
/* ECDB Global Variables */
typedef struct _Ecdb_Main Ecdb_Main;
struct _Ecdb_Main

View File

@ -2,6 +2,18 @@
#ifndef ECDB_COMMON_H
#define ECDB_COMMON_H
#undef FREE
#define FREE(dat) \
{ \
if (dat) { free(dat); dat = NULL; } \
}
#undef __UNUSED__
#define __UNUSED__ __attribute__ ((unused))
#define IN 1
#define OUT 2
/* Typdefs */
typedef struct burn_source BurnSource;
typedef struct burn_disc BurnDisc;

View File

@ -19,6 +19,7 @@ static void ecdb_welcome_page_show(void);
static void ecdb_erase_page_show(void);
static void ecdb_burn_image_page_show(void);
static void ecdb_page_hide(const char *pname);
static void ecdb_filelist_focus_handle(int action, Evas_Object *fl);
static void
ecdb_cb_enter(Ecore_Evas *ee)
@ -47,6 +48,43 @@ ecdb_cb_resize(Ecore_Evas *ee)
evas_object_resize(gui, w, h);
}
static void ecdb_filelist_focus_handle(int action, Evas_Object *fl)
{
static Evas_Object *old_focus;
Evas_Object *gui;
if (action == IN)
{
old_focus = evas_focus_get(ecore_evas_get(em->main_win_ee));
edje_object_signal_emit(old_focus, "ecdb,focus,out", "ecdb");
evas_object_focus_set(fl, 1);
}
else if (old_focus)
{
edje_object_signal_emit(old_focus, "ecdb,focus,in", "ecdb");
evas_object_focus_set(old_focus, 1);
old_focus = NULL;
gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui");
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate", "ecdb");
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
}
}
static void
_cb_filelist_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *eo,
void *ev_data __UNUSED__)
{
ecdb_filelist_focus_handle(IN, eo);
}
static void
_cb_filelist_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *eo,
void *ev_data __UNUSED__)
{
ecdb_filelist_focus_handle(OUT, eo);
}
static void
_cb_filelist_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *eo,
void *ev_data __UNUSED__)
@ -275,7 +313,7 @@ ecdb_handle_typebuf(Evas_Object *gui)
FREE(dir);
}
edje_object_signal_emit(gui, "deactivate", "ecdb");
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate", "ecdb");
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
return;
}
@ -317,13 +355,12 @@ ecdb_cb_controls_focused(void *data, Evas_Object *o, const char *emission,
const char *source)
{
static char *old_source;
Evas_Object *unsel;
Evas_Object *eo;
if ((old_source) && (strcmp(old_source, source)))
{
unsel = evas_object_name_find(ecore_evas_get(em->main_win_ee),
old_source);
edje_object_signal_emit(unsel, "ecdb,focus,out", "ecdb");
eo = evas_object_name_find(ecore_evas_get(em->main_win_ee), old_source);
edje_object_signal_emit(eo, "ecdb,focus,out", "ecdb");
FREE(old_source);
old_source = strdup(source);
}
@ -331,6 +368,10 @@ ecdb_cb_controls_focused(void *data, Evas_Object *o, const char *emission,
{
old_source = strdup(source);
}
// Send focus to the freshly clicked widget
eo = evas_object_name_find(ecore_evas_get(em->main_win_ee), source);
evas_object_focus_set(eo, 1);
}
static void
@ -657,6 +698,10 @@ ecdb_filelist_show(void)
_cb_filelist_mouse_down, gui);
evas_object_event_callback_add(swallow, EVAS_CALLBACK_KEY_DOWN,
_cb_filelist_key_down, gui);
evas_object_event_callback_add(swallow, EVAS_CALLBACK_MOUSE_IN,
_cb_filelist_mouse_in, gui);
evas_object_event_callback_add(swallow, EVAS_CALLBACK_MOUSE_OUT,
_cb_filelist_mouse_out, gui);
evas_object_show(swallow);
}