[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] Ewl_Menu in Ewl_Embed



Hi ewl-devs,

Some days ago I started with the rewrite of the elitaire context menu. I use a smilar approach like the Ewl_Iconbox - a floater holding the Ewl_Menu. This works well in an Ewl_Window, but when I use it in an Ewl_Embed as I was planing it, because the main elitaire window isn't a Ewl_Window, it causes error messages and doesn't work correctly:

***** Ewl Developer Warning ***** :
To find where this is occurring set a breakpoint
for the function ewl_print_warning.
       This program is calling:

       ewl_window_position_get();

       With the paramter:

       win

as the wrong type. (:widget::container::overlay::embed:) instead of (window).
       Please fix your program.

IMO the problem lies in this function:

void
ewl_menu_configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
                                       void *user_data __UNUSED__)
{
       int x, y;
       Ewl_Menu *menu;
       Ewl_Embed *emb;

       DENTER_FUNCTION(DLEVEL_STABLE);
       DCHECK_PARAM_PTR("w", w);
       DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);

       menu = EWL_MENU(w);
       emb = ewl_embed_widget_find(w);

       ewl_window_position_get(EWL_WINDOW(emb), &x, &y); // <---- HERE
       menu->popup_x = x + CURRENT_X(w);
       menu->popup_y = y + CURRENT_Y(w);

       ewl_menu_popup_move_cb(menu->base.popup, NULL, w);

       DLEAVE_FUNCTION(DLEVEL_STABLE);
}

So in my case the emb isn't also an Ewl_Window, but just an Ewl_Embed.

Perhaps it is possible to move the ewl_window_position_get() to ewl_embed_position_get() and return the evas position plus the evas_object position (this should be 0 , 0 in case of Ewl_Window). But I havent looked deep enough into the code to see if this would work or not.

thanks

peter