Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_context_menu.c ewl_context_menu.h Log Message: - minor cleanups =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_context_menu.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ewl_context_menu.c 6 Mar 2007 21:25:08 -0000 1.1 +++ ewl_context_menu.c 6 Mar 2007 23:10:16 -0000 1.2 @@ -122,8 +122,7 @@ if (!follow) ewl_popup_follow_set(EWL_POPUP(cm), EWL_WIDGET(emb)); else if (follow != EWL_WIDGET(emb)) { - DWARNING("Sorry, the context menu is not supposed to work in" - "more then one window"); + DWARNING("Sorry, the context menu doesn't work in multiple windows"); DRETURN(DLEVEL_STABLE); } @@ -252,8 +251,8 @@ Ewl_Event_Mouse *ev; Ewl_Context_Menu *cm; Ewl_Embed *popup_embed; - int width, height; - int ex, ey; + int width = 0, height = 0; + int ex = 0, ey = 0; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("w", w); @@ -268,9 +267,10 @@ ex += ev->x; ey += ev->y; - if (ev->x > 0 && ev->y > 0 && ev->x <= width && ev->y <= height) { - /* The mouse is actually in the popup, so that the - * popup to be active if it shouldn't be */ + if ((ev->x > 0) && (ev->y > 0) && + (ev->x <= width) && (ev->y <= height)) { + /* The mouse is actually in the popup, set the + * popup to be active if it isn't be */ if (ewl_embed_active_embed_get() != popup_embed) ewl_embed_active_set(popup_embed, TRUE); @@ -294,9 +294,8 @@ break; popup = ewl_embed_widget_find(follow); - if (ewl_context_menu_mouse_feed(cm, popup, ex, ey)) { + if (ewl_context_menu_mouse_feed(cm, popup, ex, ey)) break; - } } while (EWL_POPUP_IS(popup)); } @@ -365,12 +364,11 @@ ewl_widget_hide(cm->open_menu); cm->open_menu = NULL; } + /* send the focus to the child */ ewl_widget_focus_send(w); - /* - * grab the key and mouse events again for this window - */ + /* grab the key and mouse events again for this window */ ewl_context_menu_grabber_set(cm); DLEAVE_FUNCTION(DLEVEL_STABLE); @@ -410,7 +408,7 @@ static int ewl_context_menu_mouse_feed(Ewl_Context_Menu *cm, Ewl_Embed *emb, int x, int y) { - int emb_x, emb_y, emb_w, emb_h; + int emb_x = 0, emb_y = 0, emb_w = 0, emb_h = 0; DCHECK_PARAM_PTR_RET("cm", cm, FALSE); DCHECK_TYPE_RET("cm", cm, EWL_CONTEXT_MENU_TYPE, FALSE); @@ -422,12 +420,12 @@ x -= emb_x; y -= emb_y; - if (x > 0 && y > 0 && x <= emb_w && y <= emb_h) { + if ((x > 0) && (y > 0) && (x <= emb_w) && (y <= emb_h)) { ewl_embed_mouse_move_feed(emb, x, y, 0); - DRETURN_INT(DLEVEL_STABLE, TRUE); + DRETURN_INT(TRUE, DLEVEL_STABLE); } - DRETURN_INT(DLEVEL_STABLE, FALSE); + DRETURN_INT(FALSE, DLEVEL_STABLE); } static void @@ -444,7 +442,7 @@ ewl_window_keyboard_grab_set(EWL_WINDOW(cm), TRUE); ewl_window_pointer_grab_set(EWL_WINDOW(cm), TRUE); - DRETURN(DLEVEL_STABLE); + DLEAVE_FUNCTION(DLEVEL_STABLE); } static void @@ -460,6 +458,6 @@ ewl_context_menu_grabber = NULL; } - DRETURN(DLEVEL_STABLE); + DLEAVE_FUNCTION(DLEVEL_STABLE); } =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_context_menu.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ewl_context_menu.h 6 Mar 2007 21:25:08 -0000 1.1 +++ ewl_context_menu.h 6 Mar 2007 23:10:16 -0000 1.2 @@ -4,7 +4,7 @@ #include "ewl_popup.h" /** - * @addtogroup Ewl_Context_Menu Ewl_Context_Menu: XXX + * @addtogroup Ewl_Context_Menu Ewl_Context_Menu: A context menu * * @remarks Inherits from Ewl_Popup. * @image html Ewl_Context_Menu_inheritance.png @@ -26,7 +26,7 @@ EWL_CONTEXT_MENU_TYPE)) /** - * XXX + * Ewl_Context_Menu */ typedef struct Ewl_Context_Menu Ewl_Context_Menu; @@ -37,7 +37,7 @@ #define EWL_CONTEXT_MENU(context_menu) ((Ewl_Context_Menu *) context_menu) /** - * @brief Inherits from Ewl_Popup + * @brief Inherits from Ewl_Popup and extends to provide a context menu */ struct Ewl_Context_Menu { ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs