Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_embed.c ewl_events.c ewl_floater.c ewl_imenu.c ewl_imenu.h 
        ewl_menu_base.c ewl_menu_base.h ewl_widget.c 


Log Message:
More event work, some progress on the menus, and fix a keyboard input issue.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_embed.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_embed.c 27 Feb 2004 18:46:44 -0000      1.27
+++ ewl_embed.c 4 Mar 2004 00:29:20 -0000       1.28
@@ -209,6 +209,7 @@
 /**
  * @param embed: the embed where the key event is to occur
  * @param keyname: the key press to trigger
+ * @param mods: the mask of key modifiers currently pressed
  * @return Returns no value.
  * @brief Sends the event for a key press into an embed.
  */
@@ -259,6 +260,7 @@
 /**
  * @param embed: the embed where the key event is to occur
  * @param keyname: the key release to trigger
+ * @param mods: the mask of key modifiers currently pressed
  * @return Returns no value.
  * @brief Sends the event for a key release into an embed.
  */
@@ -296,6 +298,9 @@
 /**
  * @param embed: the embed where the mouse event is to occur
  * @param b: the number of the button pressed
+ * @param x: the x coordinate of the mouse press
+ * @param y: the y coordinate of the mouse press
+ * @param mods: the mask of key modifiers currently pressed
  * @return Returns no value.
  * @brief Sends the event for a mouse button press into an embed.
  */
@@ -322,26 +327,6 @@
        temp = last_selected;
        last_key = last_selected = widget;
 
-       /*
-        * Determine whether this widget has already been selected, if not,
-        * deselect the previously selected widget and notify it of the
-        * change. Then select the new widget and notify it of the selection.
-        */
-       if (widget != temp) {
-               if (temp) {
-                       ewl_object_remove_state(EWL_OBJECT(temp),
-                                       EWL_FLAG_STATE_SELECTED);
-                       ewl_callback_call(temp, EWL_CALLBACK_DESELECT);
-               }
-
-               if (widget && !(ewl_object_has_state(EWL_OBJECT(widget),
-                                       EWL_FLAG_STATE_DISABLED))) {
-                       ewl_object_add_state(EWL_OBJECT(widget),
-                                       EWL_FLAG_STATE_SELECTED);
-                       ewl_callback_call(widget, EWL_CALLBACK_SELECT);
-               }
-       }
-
        ev.modifiers = mods;
        ev.x = x;
        ev.y = y;
@@ -349,7 +334,9 @@
 
        /*
         * While the mouse is down the widget has a pressed state, the widget
-        * and its parents are notified in this change of state.
+        * and its parents are notified in this change of state. Send the
+        * click events prior to the selection events to allow containers to
+        * take different actions depending on child state.
         */
        temp = widget;
        while (temp) {
@@ -369,6 +356,26 @@
                temp = temp->parent;
        }
 
+       /*
+        * Determine whether this widget has already been selected, if not,
+        * deselect the previously selected widget and notify it of the
+        * change. Then select the new widget and notify it of the selection.
+        */
+       if (widget != temp) {
+               if (temp) {
+                       ewl_object_remove_state(EWL_OBJECT(temp),
+                                       EWL_FLAG_STATE_SELECTED);
+                       ewl_callback_call(temp, EWL_CALLBACK_DESELECT);
+               }
+
+               if (widget && !(ewl_object_has_state(EWL_OBJECT(widget),
+                                       EWL_FLAG_STATE_DISABLED))) {
+                       ewl_object_add_state(EWL_OBJECT(widget),
+                                       EWL_FLAG_STATE_SELECTED);
+                       ewl_callback_call(widget, EWL_CALLBACK_SELECT);
+               }
+       }
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -376,6 +383,9 @@
 /**
  * @param embed: the embed where the mouse event is to occur
  * @param b: the number of the button released
+ * @param x: the x coordinate of the mouse release
+ * @param y: the y coordinate of the mouse release
+ * @param mods: the mask of key modifiers currently release
  * @return Returns no value.
  * @brief Sends the event for a mouse button release into an embed.
  */
@@ -415,6 +425,15 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+
+/**
+ * @param embed: the embed where the mouse event is to occur
+ * @param x: the x coordinate of the mouse move
+ * @param y: the y coordinate of the mouse move
+ * @param mods: the mask of key modifiers currently release
+ * @return Returns no value.
+ * @brief Sends the event for a mouse button release into an embed.
+ */
 void
 ewl_embed_feed_mouse_move(Ewl_Embed *embed, int x, int y, unsigned int mods)
 {
@@ -488,10 +507,15 @@
 }
 
 /**
+ * @param embed: the embed where the mouse event is to occur
+ * @param x: the x coordinate of the mouse out
+ * @param y: the y coordinate of the mouse out
+ * @param mods: the mask of key modifiers currently release
  * @return Returns no value.
  * @brief Sends a mouse out event to the last focused widget
  */
-void ewl_embed_feed_mouse_out(Ewl_Embed *e, int x, int y, unsigned int mods)
+void
+ewl_embed_feed_mouse_out(Ewl_Embed *embed, int x, int y, unsigned int mods)
 {
        Ewl_Event_Mouse_Out ev;
        DENTER_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_events.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- ewl_events.c        2 Mar 2004 20:24:24 -0000       1.55
+++ ewl_events.c        4 Mar 2004 00:29:20 -0000       1.56
@@ -262,7 +262,8 @@
                key_modifiers |= EWL_KEY_MODIFIER_WIN;
        else if (strstr(ev->keyname, "Hyper_"))
                key_modifiers |= EWL_KEY_MODIFIER_WIN;
-       else if (strlen(ev->keyname) > 1 || !ev->key_compose)
+       else if (!ev->key_compose || iscntrl(*ev->key_compose) ||
+                       !isspace(*ev->key_compose))
                ewl_embed_feed_key_down(embed, ev->keyname, key_modifiers);
        else
                ewl_embed_feed_key_down(embed, ev->key_compose, key_modifiers);
@@ -304,7 +305,8 @@
                key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
        else if (strstr(ev->keyname, "Hyper_"))
                key_modifiers &= ~EWL_KEY_MODIFIER_WIN;
-       else if (strlen(ev->keyname) > 1 || !ev->key_compose)
+       else if (!ev->key_compose || iscntrl(*ev->key_compose) ||
+                       !isspace(*ev->key_compose))
                ewl_embed_feed_key_up(embed, ev->keyname, key_modifiers);
        else
                ewl_embed_feed_key_up(embed, ev->key_compose, key_modifiers);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_floater.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ewl_floater.c       14 Jan 2004 20:42:54 -0000      1.16
+++ ewl_floater.c       4 Mar 2004 00:29:21 -0000       1.17
@@ -81,6 +81,9 @@
 
        DCHECK_PARAM_PTR("f", f);
 
+       if (x == f->x && y == f->y)
+               DRETURN(DLEVEL_UNSTABLE);
+
        /*
         * Set the coordinates of the floater, this will be used for either
         * absolute or relative positioning.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_imenu.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ewl_imenu.c 19 Feb 2004 05:07:01 -0000      1.16
+++ ewl_imenu.c 4 Mar 2004 00:29:21 -0000       1.17
@@ -41,8 +41,10 @@
         */
        ewl_menu_base_init(EWL_MENU_BASE(menu), image, title);
 
-       ewl_callback_prepend(EWL_WIDGET(menu), EWL_CALLBACK_SELECT,
+       ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_SELECT,
                            ewl_imenu_expand_cb, NULL);
+       ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_CONFIGURE,
+                           ewl_imenu_configure_cb, NULL);
 
        /*
         * Create the popup menu portion of the widget.
@@ -61,22 +63,12 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-
-void ewl_imenu_expand_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+void ewl_imenu_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data)
 {
-       Ewl_IMenu      *menu;
-       Ewl_Embed      *emb;
+       Ewl_IMenu *menu = EWL_IMENU(w);
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       menu = EWL_IMENU(w);
-
-       if (!REALIZED(menu->base.popup)) {
-               emb = ewl_embed_find_by_widget(w);
-               ewl_container_append_child(EWL_CONTAINER(emb),
-                                          menu->base.popup); 
-       }
-
        /*
         * Position the popup menu relative to the menu.
         */
@@ -89,6 +81,24 @@
                                         CURRENT_H(w));
        }
 
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void ewl_imenu_expand_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+       Ewl_IMenu      *menu;
+       Ewl_Embed      *emb;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       menu = EWL_IMENU(w);
+
+       if (!REALIZED(menu->base.popup)) {
+               emb = ewl_embed_find_by_widget(w);
+               ewl_container_append_child(EWL_CONTAINER(emb),
+                                          menu->base.popup); 
+       }
+
        ewl_widget_show(menu->base.popup);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_imenu.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ewl_imenu.h 19 Nov 2003 20:18:34 -0000      1.7
+++ ewl_imenu.h 4 Mar 2004 00:29:21 -0000       1.8
@@ -41,10 +41,10 @@
 /*
  * Internally used callbacks, override at your own risk.
  */
+void            ewl_imenu_configure_cb(Ewl_Widget *w, void *ev_data,
+                                      void *user_data);
 void            ewl_imenu_expand_cb(Ewl_Widget * w, void *ev_data,
                                    void *user_data);
-void            ewl_imenu_floater_destroy_cb(Ewl_Widget * w, void *ev_data,
-                                            void *user_data);
 
 /**
  * @}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ewl_menu_base.c     19 Feb 2004 05:07:01 -0000      1.25
+++ ewl_menu_base.c     4 Mar 2004 00:29:21 -0000       1.26
@@ -37,6 +37,8 @@
        menu->popbox = ewl_vbox_new();
        ewl_object_set_alignment(EWL_OBJECT(menu->popbox),
                                 EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
+       ewl_callback_append(EWL_WIDGET(menu->popbox), EWL_CALLBACK_MOUSE_DOWN,
+                           ewl_menu_popup_hold_cb, menu);
        ewl_widget_show(menu->popbox);
 
        /*
@@ -103,17 +105,17 @@
         * Intercept mouse events this will cause callbacks to on this widget.
         */
        ewl_container_intercept_callback(EWL_CONTAINER(item),
-                       EWL_CALLBACK_CLICKED);
+                                        EWL_CALLBACK_CLICKED);
        ewl_container_intercept_callback(EWL_CONTAINER(item),
-                       EWL_CALLBACK_MOUSE_DOWN);
+                                        EWL_CALLBACK_MOUSE_DOWN);
        ewl_container_intercept_callback(EWL_CONTAINER(item),
-                       EWL_CALLBACK_MOUSE_UP);
+                                        EWL_CALLBACK_MOUSE_UP);
        ewl_container_intercept_callback(EWL_CONTAINER(item),
-                       EWL_CALLBACK_MOUSE_MOVE);
+                                        EWL_CALLBACK_MOUSE_MOVE);
        ewl_container_intercept_callback(EWL_CONTAINER(item),
-                       EWL_CALLBACK_SELECT);
+                                        EWL_CALLBACK_SELECT);
        ewl_container_intercept_callback(EWL_CONTAINER(item),
-                       EWL_CALLBACK_DESELECT);
+                                        EWL_CALLBACK_DESELECT);
 
        /*
         * Create the icon if one is requested, or a spacer if not, but there is
@@ -257,6 +259,7 @@
 void
 ewl_menu_base_expand_cb(Ewl_Widget *w, void *ev_data, void *user_data)
 {
+       Ewl_Widget *child;
        Ewl_Menu_Base *menu = EWL_MENU_BASE(w);
 
        DENTER_FUNCTION(DLEVEL_STABLE);
@@ -273,6 +276,14 @@
                ewl_object_set_minimum_w(EWL_OBJECT(menu->popup),
                                         CURRENT_W(menu));
 
+       ewd_list_goto_first(EWL_CONTAINER(menu->popbox)->children);
+
+       while ((child = ewd_list_next(EWL_CONTAINER(menu->popbox)->children))) {
+               if (ewl_widget_is_type(child, "menuitem")) {
+                       EWL_MENU_ITEM(child)->submenu = 1;
+               }
+       }
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -304,3 +315,13 @@
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
+
+void
+ewl_menu_popup_hold_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+       Ewl_Menu_Base *menu = EWL_MENU_BASE(user_data);
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- ewl_menu_base.h     3 Jan 2004 21:23:11 -0000       1.12
+++ ewl_menu_base.h     4 Mar 2004 00:29:21 -0000       1.13
@@ -29,9 +29,10 @@
 struct Ewl_Menu_Item
 {
        Ewl_Container   container; /**< Inherit from Ewl_Container */
-       Ewl_Widget     *icon; /**< The image in this menu item.  */
-       Ewl_Widget     *text; /**< The text label for this menu item.  */
-       int             submenu; /**< Indicates if this is inside a menu.  */
+       Ewl_Widget     *icon; /**< The image in this menu item */
+       Ewl_Widget     *text; /**< The text label for this menu item  */
+       int             submenu; /**< Indicates if this is inside a menu */
+       int             hold; /**< Indicates not to hide this on a deselect */
 };
 
 /**
@@ -91,6 +92,7 @@
 void ewl_menu_base_expand_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_menu_base_collapse_cb(Ewl_Widget * w, void *ev_data, void *user_data);
 void ewl_menu_base_destroy_cb(Ewl_Widget * w, void *ev_data, void *user_data);
+void ewl_menu_popup_hold_cb(Ewl_Widget * w, void *ev_data, void *user_data);
 
 void ewl_menu_item_configure_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_menu_add_cb(Ewl_Container * parent, Ewl_Widget * child);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -3 -r1.106 -r1.107
--- ewl_widget.c        27 Feb 2004 16:39:39 -0000      1.106
+++ ewl_widget.c        4 Mar 2004 00:29:21 -0000       1.107
@@ -765,8 +765,8 @@
 /**
  * @param widget: the widget to determine if a type is inherited
  * @param type: the type to check for inheritance in the widget
- * @return Returns TRUE if @w inherited the type @t, otherwise FALSE.
- * @brief Determine if the widget @w has inherited from the type @t.
+ * @return Returns TRUE if @a w inherited the type @a t, otherwise FALSE.
+ * @brief Determine if the widget @a w has inherited from the type @a t.
  */
 unsigned int ewl_widget_is_type(Ewl_Widget *widget, char *type)
 {
@@ -777,7 +777,7 @@
        DCHECK_PARAM_PTR_RET("widget", widget, FALSE);
        DCHECK_PARAM_PTR_RET("type", type, FALSE);
 
-       snprintf(tmp, PATH_MAX, "/%s/", type);
+       snprintf(tmp, PATH_MAX, ":%s:", type);
        if (widget->inheritance && strstr(widget->inheritance, tmp))
                found = TRUE;
 




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to