Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_events.c ewl_widget.c ewl_widget.h 


Log Message:
Some means for accessing keyboard input focus.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_events.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- ewl_events.c        25 Nov 2003 07:47:29 -0000      1.42
+++ ewl_events.c        8 Dec 2003 23:13:40 -0000       1.43
@@ -2,11 +2,11 @@
 #include <Ewl.h>
 
 
-Ewl_Widget     *last_selected = NULL;
-Ewl_Widget     *last_clicked = NULL;
-Ewl_Widget     *last_key = NULL;
-Ewl_Widget     *last_focused = NULL;
-Ewl_Widget     *dnd_widget = NULL;
+extern Ewl_Widget     *last_selected;
+extern Ewl_Widget     *last_clicked;
+extern Ewl_Widget     *last_key;
+extern Ewl_Widget     *last_focused;
+extern Ewl_Widget     *dnd_widget;
 
 
 /**
@@ -171,10 +171,13 @@
         * If a widget has been selected then we send the keystroke to the
         * appropriate widget.
         */
-       if (last_selected)
-               last_key = last_selected;
-       else
-               last_key = EWL_WIDGET(embed);
+       if (!last_key || !ewl_container_parent_of(EWL_WIDGET(embed),
+                               last_key)) {
+               if (last_selected)
+                       last_key = last_selected;
+               else
+                       last_key = EWL_WIDGET(embed);
+       }
 
        /*
         * Dispatcher of key down events, these get sent to the last widget
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- ewl_widget.c        25 Nov 2003 07:47:29 -0000      1.90
+++ ewl_widget.c        8 Dec 2003 23:13:41 -0000       1.91
@@ -2,10 +2,11 @@
 #include <Ewl.h>
 
 
-extern Ewl_Widget *last_selected;
-extern Ewl_Widget *last_key;
-extern Ewl_Widget *last_focused;
-extern Ewl_Widget *dnd_widget;
+Ewl_Widget *last_selected = NULL;
+Ewl_Widget *last_clicked = NULL;
+Ewl_Widget *last_key = NULL;
+Ewl_Widget *last_focused = NULL;
+Ewl_Widget *dnd_widget = NULL;
 
 static void ewl_widget_get_theme_padding(Ewl_Widget *w, int *l, int *r,
                                         int *t, int *b);
@@ -804,6 +805,22 @@
                DRETURN_INT(FALSE, DLEVEL_STABLE);
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
+}
+
+void ewl_widget_send_focus(Ewl_Widget *w)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       last_key = w;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+Ewl_Widget *ewl_widget_get_focused()
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       DRETURN_PTR(last_key, DLEVEL_STABLE);
 }
 
 /*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- ewl_widget.h        22 Nov 2003 20:01:03 -0000      1.38
+++ ewl_widget.h        8 Dec 2003 23:13:41 -0000       1.39
@@ -150,6 +150,9 @@
 void            ewl_widget_set_clipped(Ewl_Widget *w, unsigned int val);
 unsigned int    ewl_widget_is_clipped(Ewl_Widget *w);
 
+void            ewl_widget_send_focus(Ewl_Widget *w);
+Ewl_Widget     *ewl_widget_get_focused(void);
+
 /**
  * @def LAYER(w)
  * Used to retrieve the layer of a widget.




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to