Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_button.c ewl_container.c ewl_container.h ewl_events.c 


Log Message:
Fix for some of the more annoying focus/mouse issues.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_button.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- ewl_button.c        29 Apr 2003 18:33:12 -0000      1.42
+++ ewl_button.c        15 Jul 2003 22:00:15 -0000      1.43
@@ -57,10 +57,12 @@
                        EWL_CALLBACK_MOUSE_MOVE);
        ewl_container_notify_callback(EWL_CONTAINER(b),
                        EWL_CALLBACK_CLICKED);
+       /*
        ewl_container_notify_callback(EWL_CONTAINER(b),
                        EWL_CALLBACK_FOCUS_IN);
        ewl_container_notify_callback(EWL_CONTAINER(b),
                        EWL_CALLBACK_FOCUS_OUT);
+        */
 
        /*
         * Create and setup the label for the button if it's desired.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewl_container.c     13 Jul 2003 05:52:49 -0000      1.37
+++ ewl_container.c     15 Jul 2003 22:00:16 -0000      1.38
@@ -412,6 +412,31 @@
 }
 
 /**
+ * ewl_container_parent_of - determine if a container is a parent of a widget
+ * @c: the container to compare against, it is safe to pass a non-container
+ * @w: the widget to check parentage
+ *
+ * Returns TRUE if @c is a parent of @w, otherwise returns FALSE.
+ */
+int ewl_container_parent_of(Ewl_Widget *c, Ewl_Widget *w)
+{
+       Ewl_Widget *parent;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       DCHECK_PARAM_PTR_RET("c", c, FALSE);
+       DCHECK_PARAM_PTR_RET("w", w, FALSE);
+
+       parent = w;
+       while ((parent = parent->parent)) {
+               if (parent == c)
+                       DRETURN_INT(TRUE, DLEVEL_STABLE);
+       }
+
+       DRETURN_INT(FALSE, DLEVEL_STABLE);
+}
+
+/**
  * ewl_container_reset - destroy all children of the container
  * @c: the container to reset
  *
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_container.h     4 Apr 2003 04:55:52 -0000       1.19
+++ ewl_container.h     15 Jul 2003 22:00:16 -0000      1.20
@@ -83,6 +83,7 @@
                                           int y);
 Ewl_Widget     *ewl_container_get_child_at_recursive(Ewl_Container * widget,
                                                     int x, int y);
+int             ewl_container_parent_of(Ewl_Widget *c, Ewl_Widget *w);
 void            ewl_container_prefer_largest(Ewl_Container *c,
                                             Ewl_Orientation o);
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_events.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- ewl_events.c        13 Jul 2003 05:52:49 -0000      1.34
+++ ewl_events.c        15 Jul 2003 22:00:17 -0000      1.35
@@ -336,9 +336,15 @@
        widget = ewl_container_get_child_at_recursive(EWL_CONTAINER(embed),
                        ev->x, ev->y);
 
-       if (last_focused && (widget != last_focused)) {
+       /*
+        * Defocus all widgets up to the level of a shared parent of old and
+        * newly focused widgets.
+        */
+       while (last_focused && (widget != last_focused) &&
+                       !ewl_container_parent_of(last_focused, widget)) {
                last_focused->state &= ~EWL_STATE_HILITED;
                ewl_callback_call(last_focused, EWL_CALLBACK_FOCUS_OUT);
+               last_focused = last_focused->parent;
        }
 
        if (widget && !(widget->state & (EWL_STATE_DISABLED | EWL_STATE_HILITED))) {




-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to