Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_events.c ewl_menu.c ewl_menu.h ewl_menu_base.c ewl_menu_base.h ewl_overlay.c ewl_row.h ewl_theme.c ewl_window.c Log Message: Send configure events on window move. Improved menu placement. Removed some unnecessary event intercepts in menu code. Minor indentation/style changes. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_events.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ewl_events.c 28 Mar 2005 07:04:28 -0000 1.2 +++ ewl_events.c 25 Apr 2005 05:44:19 -0000 1.3 @@ -200,8 +200,18 @@ if (!window) DRETURN_INT(TRUE, DLEVEL_STABLE); - window->x = ev->x; - window->y = ev->y; + /* + * Save coords and queue a configure event if the window is moved. + */ + if (ev->x && ev->x != window->x) { + window->x = ev->x; + ewl_widget_configure(EWL_WIDGET(window)); + } + + if (ev->y && ev->y != window->y) { + window->y = ev->y; + ewl_widget_configure(EWL_WIDGET(window)); + } /* * Configure events really only need to occur on resize. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ewl_menu.c 28 Mar 2005 07:04:28 -0000 1.4 +++ ewl_menu.c 25 Apr 2005 05:44:19 -0000 1.5 @@ -45,6 +45,8 @@ ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_SELECT, ewl_menu_expand_cb, NULL); + ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_REALIZE, + ewl_menu_realize_cb, NULL); ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_CONFIGURE, ewl_menu_configure_cb, NULL); @@ -66,6 +68,20 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } +void +ewl_menu_realize_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) +{ + Ewl_Menu *menu = EWL_MENU(w); + + /* + * Position the popup menu relative to the menu. + */ + ewl_callback_append(EWL_WIDGET(EWL_WINDOW(menu->base.popup)), + EWL_CALLBACK_CONFIGURE, + ewl_menu_popup_move_cb, w); +} + void ewl_menu_configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { @@ -81,13 +97,6 @@ menu->popup_x = x + CURRENT_X(w); menu->popup_y = y + CURRENT_Y(w); - /* - * Position the popup menu relative to the menu. - */ - ewl_callback_append(EWL_WIDGET(EWL_WINDOW(menu->base.popup)), - EWL_CALLBACK_REALIZE, - ewl_menu_popup_move_cb, w); - DLEAVE_FUNCTION(DLEVEL_STABLE); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ewl_menu.h 9 Feb 2005 20:44:12 -0000 1.2 +++ ewl_menu.h 25 Apr 2005 05:44:19 -0000 1.3 @@ -48,6 +48,9 @@ /* * Internally used callbacks, override at your own risk. */ +void ewl_menu_realize_cb (Ewl_Widget *w, + void *ev_data, + void *user_data); void ewl_menu_configure_cb (Ewl_Widget *w, void *ev_data, void *user_data); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu_base.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_menu_base.c 10 Apr 2005 05:05:18 -0000 1.3 +++ ewl_menu_base.c 25 Apr 2005 05:44:19 -0000 1.4 @@ -28,6 +28,9 @@ ewl_widget_appearance_set(EWL_WIDGET(menu), "menu_base"); ewl_widget_inherit(EWL_WIDGET(menu), "menu_base"); + ewl_callback_del(EWL_WIDGET(menu), EWL_CALLBACK_CLICKED, + ewl_menu_item_clicked_cb); + ewl_callback_append(EWL_WIDGET(menu), EWL_CALLBACK_SELECT, ewl_menu_base_expand_cb, NULL); @@ -108,19 +111,14 @@ ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CONFIGURE, ewl_menu_item_configure_cb, NULL); + ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CLICKED, + ewl_menu_item_clicked_cb, NULL); /* - * Intercept mouse events this will cause callbacks to on this widget. + * Intercept mouse events this will cause callbacks to children of + * this widget. */ ewl_container_callback_intercept(EWL_CONTAINER(item), - EWL_CALLBACK_CLICKED); - ewl_container_callback_intercept(EWL_CONTAINER(item), - EWL_CALLBACK_MOUSE_DOWN); - ewl_container_callback_intercept(EWL_CONTAINER(item), - EWL_CALLBACK_MOUSE_UP); - ewl_container_callback_intercept(EWL_CONTAINER(item), - EWL_CALLBACK_MOUSE_MOVE); - ewl_container_callback_intercept(EWL_CONTAINER(item), EWL_CALLBACK_SELECT); ewl_container_callback_intercept(EWL_CONTAINER(item), EWL_CALLBACK_DESELECT); @@ -312,6 +310,19 @@ } void +ewl_menu_item_clicked_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) +{ + Ewl_Menu_Item *item = EWL_MENU_ITEM(w); + DENTER_FUNCTION(DLEVEL_STABLE); + + if (item->inmenu) + ewl_widget_hide(item->inmenu); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +void ewl_menu_base_expand_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) { @@ -374,7 +385,7 @@ menu = EWL_MENU_BASE(w); focused = ewl_widget_focused_get(); - if (focused && !ewl_container_parent_of(menu->popbox, focused)) + if (!focused || !ewl_container_parent_of(menu->popbox, focused)) ewl_widget_hide(menu->popup); DLEAVE_FUNCTION(DLEVEL_STABLE); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu_base.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_menu_base.h 10 Apr 2005 05:05:18 -0000 1.3 +++ ewl_menu_base.h 25 Apr 2005 05:44:19 -0000 1.4 @@ -108,6 +108,7 @@ void ewl_menu_base_destroy_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_item_clicked_cb(Ewl_Widget *w, void *ev_data, void *user_data); void ewl_menu_item_child_show_cb(Ewl_Container *parent, Ewl_Widget *child); void ewl_menu_item_child_resize_cb(Ewl_Container *parent, Ewl_Widget *child, int size, Ewl_Orientation o); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_overlay.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_overlay.c 28 Mar 2005 07:04:29 -0000 1.3 +++ ewl_overlay.c 25 Apr 2005 05:44:19 -0000 1.4 @@ -98,13 +98,13 @@ DENTER_FUNCTION(DLEVEL_STABLE); - size = -ewl_object_current_x_get(EWL_OBJECT(child)) + - ewl_object_preferred_w_get(EWL_OBJECT(child)) + CURRENT_X(o); + size = ewl_object_current_x_get(EWL_OBJECT(child)) + + ewl_object_preferred_w_get(EWL_OBJECT(child)) - CURRENT_X(o); if (size > PREFERRED_W(o)) ewl_object_preferred_inner_w_set(EWL_OBJECT(o), size); - size = -ewl_object_current_y_get(EWL_OBJECT(child)) + - ewl_object_preferred_h_get(EWL_OBJECT(child)) + CURRENT_Y(o); + size = ewl_object_current_y_get(EWL_OBJECT(child)) + + ewl_object_preferred_h_get(EWL_OBJECT(child)) - CURRENT_Y(o); if (size > PREFERRED_H(o)) ewl_object_preferred_inner_h_set(EWL_OBJECT(o), size); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_row.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_row.h 17 Feb 2005 19:14:55 -0000 1.3 +++ ewl_row.h 25 Apr 2005 05:44:19 -0000 1.4 @@ -13,13 +13,13 @@ * @themekey /row/group */ -typedef struct _ewl_row Ewl_Row; +typedef struct Ewl_Row Ewl_Row; #define EWL_ROW(t) ((Ewl_Row *)t) /* * Tree rows layout cells in a left to right fashion. */ -struct _ewl_row +struct Ewl_Row { Ewl_Container container; Ewl_Row *header; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_theme.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ewl_theme.c 11 Apr 2005 04:41:59 -0000 1.8 +++ ewl_theme.c 25 Apr 2005 05:44:19 -0000 1.9 @@ -29,7 +29,7 @@ DENTER_FUNCTION(DLEVEL_STABLE); /* - * Alloacte and clear the default theme + * Allocate and clear the default theme */ def_theme_data = ecore_hash_new(ecore_str_hash, ecore_str_compare); if (!def_theme_data) @@ -49,7 +49,7 @@ /* * Fall back to the default theme. */ - if(!theme_path) { + if (!theme_path) { theme_name = strdup("default"); theme_path = ewl_theme_path_find(theme_name); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_window.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ewl_window.c 10 Apr 2005 05:02:17 -0000 1.4 +++ ewl_window.c 25 Apr 2005 05:44:19 -0000 1.5 @@ -466,19 +466,20 @@ (ewl_engine_mask_get() & (EWL_ENGINE_SOFTWARE_X11 | EWL_ENGINE_GL_X11))) { int width, height; - window->window = (void *)ecore_x_window_new(0, window->x, - window->y, - ewl_object_current_w_get(o), - ewl_object_current_h_get(o)); - - ecore_x_window_prop_name_class_set((Ecore_X_Window)window->window, window->name, - window->classname); - ecore_x_window_prop_title_set((Ecore_X_Window)window->window, window->title); - ecore_x_window_prop_protocol_set((Ecore_X_Window)window->window, + Ecore_X_Window xwin; + xwin = ecore_x_window_new(0, window->x, + window->y, + ewl_object_current_w_get(o), + ewl_object_current_h_get(o)); + + ecore_x_window_prop_name_class_set(xwin, window->name, + window->classname); + ecore_x_window_prop_title_set(xwin, window->title); + ecore_x_window_prop_protocol_set(xwin, ECORE_X_WM_PROTOCOL_DELETE_REQUEST,1); if (window->flags & EWL_WINDOW_BORDERLESS) - ecore_x_window_prop_borderless_set((Ecore_X_Window)window->window, 1); + ecore_x_window_prop_borderless_set(xwin, 1); width = ewl_object_maximum_w_get(EWL_OBJECT(window)); height = ewl_object_maximum_h_get(EWL_OBJECT(window)); @@ -487,9 +488,8 @@ &height); ewl_object_maximum_size_set(EWL_OBJECT(window), width, height); - printf("Setting maximum window size to %dx%d\n", - width, height); } + window->window = (void *)xwin; } #endif ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs