Hello an issue I've always noticed in Elementary is that it doesn't
handle correctly the focus change (and using it in Illume could cause
issues with the virtual keyboard).

The widget which suffers mostly this problem is elm_entry since it uses
it's own function on focus/unfocus events and when there are two
entries, focused_entry and unfocused_entry and you do something like: 
  elm_object_focus(unfocused_entry);
The focused_entry lose the keyboard focus, but doesn't change aspect
(since its own function is not called again).

So, basically to fix this issue (or workarounding it? :)) I thought that
elementary could have just remembered the focused widget clearing the
focus to that when a new widget asked for the focus.

I've attached two versions of the patch, the first one doesn't care
about the window in which the widget is, and simply clears the focus
when any widget of the running process requests to be the new focused
widget.

The second version (better, I think) checks if the widget is in the same
window of the widget that is asking for the focus, in that case switches
the focus.

Maybe could be an idea to reset the focus at all on     
  elm_object_focus(NULL);
By the way I've not implemented it, but it could be useful when we'd
like to hide virtual keyboards (il Illume, for example) without using
the workaround of focusing another widget (like a button).
Index: src/lib/elm_widget.c
===================================================================
--- src/lib/elm_widget.c	(revisione 42476)
+++ src/lib/elm_widget.c	(copia locale)
@@ -87,6 +87,16 @@
    elm_widget_focus_steal(sd->obj);
 }
 
+static void
+_focused_obj_update(Evas_Object *obj) {
+   static Evas_Object *focused_obj = NULL;
+
+   if (focused_obj && focused_obj != obj)
+      elm_widget_focused_object_clear(focused_obj);
+
+   focused_obj = obj;
+}
+
 /* externally accessible functions */
 EAPI Evas_Object *
 elm_widget_add(Evas *evas)
@@ -481,6 +491,7 @@
    if (!sd->focused)
      {
 	sd->focused = 1;
+	_focused_obj_update(obj);
 	if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
      }
    if (sd->focus_func)
@@ -590,6 +601,7 @@
    API_ENTRY return;
    if (sd->focused) return;
    if (sd->disabled) return;
+   _focused_obj_update(obj);
    parent = obj;
    for (;;)
      {
Index: src/lib/elm_widget.c
===================================================================
--- src/lib/elm_widget.c	(revisione 42476)
+++ src/lib/elm_widget.c	(copia locale)
@@ -87,6 +87,19 @@
    elm_widget_focus_steal(sd->obj);
 }
 
+static void
+_focused_obj_update(Evas_Object *obj) {
+   static Evas_Object *focused_obj = NULL;
+
+   if (focused_obj && focused_obj != obj &&
+       elm_widget_top_get(focused_obj) == elm_widget_top_get(obj))
+      {
+         elm_widget_focused_object_clear(focused_obj);
+      }
+
+   focused_obj = obj;
+}
+
 /* externally accessible functions */
 EAPI Evas_Object *
 elm_widget_add(Evas *evas)
@@ -481,6 +494,7 @@
    if (!sd->focused)
      {
 	sd->focused = 1;
+	_focused_obj_update(obj);
 	if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
      }
    if (sd->focus_func)
@@ -590,6 +604,7 @@
    API_ENTRY return;
    if (sd->focused) return;
    if (sd->disabled) return;
+   _focused_obj_update(obj);
    parent = obj;
    for (;;)
      {
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to