Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_embed.c 


Log Message:
* Fix segv - last.clicked/last.mouse_in are not guaranteed to still be valid 
pointers after a callback execute.
* Make focus work properly - remove STATE_PRESSED on hide and on mouse_up

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- ewl_embed.c 2 Jan 2006 11:57:30 -0000       1.38
+++ ewl_embed.c 5 Jan 2006 23:07:36 -0000       1.39
@@ -270,6 +270,9 @@
        {
                ewl_object_state_remove(EWL_OBJECT(e->last.clicked),
                                                EWL_FLAG_STATE_FOCUSED);
+               ewl_object_state_remove(EWL_OBJECT(e->last.clicked),
+                                               EWL_FLAG_STATE_PRESSED);
+               
                ewl_callback_call(e->last.clicked, EWL_CALLBACK_FOCUS_OUT);
 
                e->last.clicked = NULL;
@@ -627,6 +630,7 @@
        if (!embed->last.mouse_in 
                        || 
!ewl_object_state_has(EWL_OBJECT(embed->last.mouse_in), 
                                                 EWL_FLAG_STATE_PRESSED)) {
+
                widget = 
ewl_container_child_at_recursive_get(EWL_CONTAINER(embed),
                                x, y);
                if (!widget)
@@ -643,7 +647,12 @@
                        
ewl_object_state_remove(EWL_OBJECT(embed->last.mouse_in),
                                        EWL_FLAG_STATE_MOUSE_IN);
                        ewl_callback_call(embed->last.mouse_in, 
EWL_CALLBACK_MOUSE_OUT);
-                       embed->last.mouse_in = embed->last.mouse_in->parent;
+
+                       /*It's possible that the call to MOUSE_IN caused the 
'embed->last.mouse_in'
+                        * to have become null.  Make sure this pointer is 
still here
+                        * An example of this behaviour is FOCUS_OUT in 
ewl_menu */
+                       if (embed->last.mouse_in)
+                               embed->last.mouse_in = 
embed->last.mouse_in->parent;
                }
        }
        else 
@@ -672,7 +681,11 @@
                        ewl_callback_call_with_event_data(embed->last.mouse_in,
                                        EWL_CALLBACK_MOUSE_MOVE, &ev);
                }
-               embed->last.mouse_in = embed->last.mouse_in->parent;
+               
+               /*It's possible that the call to MOUSE_IN caused the 
'embed->last.mouse_in'
+                * to have become null.  Make sure this pointer is still here*/
+               if (embed->last.mouse_in)
+                       embed->last.mouse_in = embed->last.mouse_in->parent;
        }
 
        embed->last.mouse_in = widget;
@@ -1380,6 +1393,8 @@
        DCHECK_PARAM_PTR("e", e);
        DCHECK_TYPE("e", e, "embed");
 
+       ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAG_STATE_PRESSED);
+
        if ((w == e->last.focused) || (RECURSIVE(w) && ewl_widget_parent_of(w, 
e->last.focused))) {
                e->last.focused = NULL;
                /*ewl_embed_focused_widget_set(e, NULL);*/




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to