2004-11-24 19:37:45 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
|
|
|
/* TODO List:
|
2012-06-20 23:19:43 -07:00
|
|
|
*
|
2004-11-24 19:37:45 -08:00
|
|
|
* * support change of menu items after realize
|
|
|
|
* * support add/del of menu items after realize
|
|
|
|
* * support text/color classes
|
|
|
|
* * refcount menu up while looping thru and calling other fn's
|
|
|
|
* * support alignment (x, y) as well as spawn direction
|
|
|
|
* * need different menu style support for different menus
|
|
|
|
* * add menu icon/title support
|
|
|
|
* * use event timestamps not clock for "click and release" detect
|
|
|
|
* * menu icons can set if/how they will be scaled
|
|
|
|
* * support move/resize of "box" that spawned the menu
|
|
|
|
* * add image item (label is replaced by image/icon)
|
|
|
|
* * add generic evas object item type (label replaced by object)
|
|
|
|
* * allow menus to stretch width/height to fit spawner widget/box
|
|
|
|
* * allow menus to auto-shrink (horizontally) if forced to
|
|
|
|
* * support auto left/right direction spawn
|
2005-05-06 21:34:26 -07:00
|
|
|
* * support obscures to indicate offscreen/not visible menu parts
|
2004-11-24 19:37:45 -08:00
|
|
|
*/
|
|
|
|
|
2006-01-06 15:45:13 -08:00
|
|
|
/* local subsystem data types */
|
|
|
|
typedef struct _E_Menu_Category E_Menu_Category;
|
|
|
|
|
|
|
|
struct _E_Menu_Category
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
void *data;
|
2009-03-24 14:11:03 -07:00
|
|
|
Eina_List *callbacks;
|
2006-01-06 15:45:13 -08:00
|
|
|
};
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
/* local subsystem functions */
|
2012-06-21 00:11:47 -07:00
|
|
|
static void _e_menu_free(E_Menu *m);
|
|
|
|
static void _e_menu_item_free(E_Menu_Item *mi);
|
|
|
|
static void _e_menu_item_realize(E_Menu_Item *mi);
|
|
|
|
static void _e_menu_realize(E_Menu *m);
|
|
|
|
static void _e_menu_items_layout_update(E_Menu *m);
|
|
|
|
static void _e_menu_item_unrealize(E_Menu_Item *mi);
|
|
|
|
static void _e_menu_unrealize(E_Menu *m);
|
|
|
|
static void _e_menu_activate_internal(E_Menu *m, E_Zone *zone);
|
|
|
|
static void _e_menu_deactivate_all(void);
|
|
|
|
static void _e_menu_deactivate_above(E_Menu *m);
|
|
|
|
static void _e_menu_submenu_activate(E_Menu_Item *mi);
|
|
|
|
static void _e_menu_submenu_deactivate(E_Menu_Item *mi);
|
|
|
|
static void _e_menu_reposition(E_Menu *m);
|
|
|
|
static int _e_menu_active_call(void);
|
|
|
|
static int _e_menu_realize_call(E_Menu_Item *mi);
|
|
|
|
static void _e_menu_item_activate_next(void);
|
|
|
|
static void _e_menu_item_activate_previous(void);
|
|
|
|
static void _e_menu_item_activate_first(void);
|
|
|
|
static void _e_menu_item_activate_last(void);
|
|
|
|
static void _e_menu_item_activate_nth(int n);
|
|
|
|
static void _e_menu_item_activate_char(const char *key_compose);
|
|
|
|
static void _e_menu_activate_next(void);
|
|
|
|
static void _e_menu_activate_previous(void);
|
|
|
|
static void _e_menu_activate_first(void);
|
|
|
|
static void _e_menu_activate_last(void);
|
2006-12-28 06:15:10 -08:00
|
|
|
#if 0
|
2012-06-21 00:11:47 -07:00
|
|
|
static void _e_menu_activate_nth(int n);
|
2006-12-28 06:15:10 -08:00
|
|
|
#endif
|
2012-06-21 00:11:47 -07:00
|
|
|
static E_Menu *_e_menu_active_get(void);
|
2009-10-25 11:42:47 -07:00
|
|
|
static E_Menu_Item *_e_menu_item_active_get(void);
|
2012-06-21 00:11:47 -07:00
|
|
|
static Eina_List *_e_menu_list_item_active_get(void);
|
|
|
|
static int _e_menu_outside_bounds_get(int xdir, int ydir);
|
|
|
|
static void _e_menu_scroll_by(int dx, int dy);
|
|
|
|
static void _e_menu_mouse_autoscroll_check(void);
|
|
|
|
static void _e_menu_item_ensure_onscreen(E_Menu_Item *mi);
|
|
|
|
static int _e_menu_auto_place(E_Menu *m, int x, int y, int w, int h);
|
|
|
|
static void _e_menu_cb_intercept_item_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
|
|
|
|
static void _e_menu_cb_intercept_item_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
|
|
|
|
static void _e_menu_cb_intercept_container_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
|
|
|
|
static void _e_menu_cb_intercept_container_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
|
|
|
|
static void _e_menu_cb_item_in(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
|
|
|
static void _e_menu_cb_item_out(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
static Eina_Bool _e_menu_cb_key_down(void *data EINA_UNUSED, Ecore_Event_Key *ev);
|
2012-06-21 00:11:47 -07:00
|
|
|
static Eina_Bool _e_menu_cb_mouse_down(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_menu_cb_mouse_up(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_menu_cb_mouse_move(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_menu_cb_mouse_wheel(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_menu_cb_scroll_animator(void *data);
|
|
|
|
static void _e_menu_cb_item_submenu_post_default(void *data, E_Menu *m, E_Menu_Item *mi);
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
static void _e_menu_category_free_cb(E_Menu_Category *cat);
|
|
|
|
static void _e_menu_cb_mouse_evas_down(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED);
|
2019-07-31 05:04:44 -07:00
|
|
|
static void _e_menu_hide_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
|
2005-04-21 00:19:49 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
/* local subsystem globals */
|
2017-02-24 11:15:42 -08:00
|
|
|
static Ecore_Window _e_menu_win = UINT_MAX;
|
2019-07-31 05:04:44 -07:00
|
|
|
static Eina_Bool _e_menu_grabbed = EINA_FALSE;
|
2009-10-25 11:42:47 -07:00
|
|
|
static Eina_List *_e_active_menus = NULL;
|
|
|
|
static E_Menu_Item *_e_active_menu_item = NULL;
|
2012-08-30 00:04:53 -07:00
|
|
|
static E_Menu_Item *_e_prev_active_menu_item = NULL;
|
2008-12-17 07:33:43 -08:00
|
|
|
/*static Eina_Hash *_e_menu_category_items = NULL;*/
|
2009-10-25 11:42:47 -07:00
|
|
|
static Eina_Hash *_e_menu_categories = NULL;
|
2013-09-11 06:23:43 -07:00
|
|
|
static unsigned int _e_menu_activate_time = 0;
|
2009-10-25 11:42:47 -07:00
|
|
|
static int _e_menu_activate_floating = 0;
|
|
|
|
static int _e_menu_activate_maybe_drag = 0;
|
|
|
|
static int _e_menu_activate_dragging = 0;
|
|
|
|
static Ecore_Animator *_e_menu_scroll_animator = NULL;
|
|
|
|
static double _e_menu_scroll_start = 0.0;
|
|
|
|
static int _e_menu_x = 0;
|
|
|
|
static int _e_menu_y = 0;
|
2013-09-11 06:23:43 -07:00
|
|
|
static unsigned int _e_menu_time = 0;
|
2009-10-25 11:42:47 -07:00
|
|
|
static int _e_menu_autoscroll_x = 0;
|
|
|
|
static int _e_menu_autoscroll_y = 0;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
static Eina_List *handlers = NULL;
|
2012-09-11 04:55:08 -07:00
|
|
|
static Eina_Bool _e_menu_lock = EINA_FALSE;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2017-03-03 08:56:16 -08:00
|
|
|
static Eina_Bool pending_feed;
|
|
|
|
static unsigned int pending_activate_time;
|
|
|
|
|
2009-03-23 05:28:15 -07:00
|
|
|
static Eina_List *
|
|
|
|
_e_active_menus_copy_ref(void)
|
|
|
|
{
|
|
|
|
E_Object *o;
|
|
|
|
Eina_List *l, *ret = NULL;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, o)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
ret = eina_list_append(ret, o);
|
|
|
|
e_object_ref(o);
|
2009-03-23 05:28:15 -07:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_List *
|
|
|
|
_e_menu_list_free_unref(Eina_List *l)
|
|
|
|
{
|
|
|
|
E_Object *o;
|
2012-08-30 00:04:53 -07:00
|
|
|
Eina_List *ll, *lll;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2012-08-30 00:04:53 -07:00
|
|
|
/* list must be freed in reverse to ensure that submenus
|
|
|
|
* (which are added to the end of the list)
|
|
|
|
* are deleted before their parents
|
|
|
|
*/
|
|
|
|
EINA_LIST_REVERSE_FOREACH_SAFE(l, ll, lll, o)
|
2013-01-11 02:34:29 -08:00
|
|
|
{
|
|
|
|
e_object_unref(o);
|
|
|
|
l = eina_list_remove_list(l, ll);
|
|
|
|
}
|
2009-03-23 05:28:15 -07:00
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
2012-08-30 00:04:53 -07:00
|
|
|
/* macros for debugging menu refcounts */
|
|
|
|
#if 0
|
2013-01-11 02:34:29 -08:00
|
|
|
#define e_object_ref(X) do { \
|
|
|
|
int xx; \
|
|
|
|
xx = e_object_ref(X); \
|
|
|
|
INF("REF: %p || %d", X, xx); \
|
2012-08-30 00:04:53 -07:00
|
|
|
} while (0)
|
2013-01-11 02:34:29 -08:00
|
|
|
#define e_object_unref(X) do { \
|
|
|
|
int xx; \
|
|
|
|
xx = e_object_unref(X); \
|
|
|
|
INF("UNREF: %p || %d", X, xx); \
|
2012-08-30 00:04:53 -07:00
|
|
|
} while (0)
|
|
|
|
#endif
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
/* externally accessible functions */
|
2010-11-22 07:21:32 -08:00
|
|
|
EINTERN int
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_init(void)
|
|
|
|
{
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_menu_cb_mouse_down, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_menu_cb_mouse_up, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, _e_menu_cb_mouse_move, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_WHEEL, _e_menu_cb_mouse_wheel, NULL);
|
|
|
|
_e_menu_categories = eina_hash_string_superfast_new((Eina_Free_Cb)_e_menu_category_free_cb);
|
2010-01-14 20:41:20 -08:00
|
|
|
|
2012-09-20 01:57:36 -07:00
|
|
|
e_int_menus_init();
|
2004-11-24 19:37:45 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-11-22 07:21:32 -08:00
|
|
|
EINTERN int
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_shutdown(void)
|
|
|
|
{
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
E_FREE_LIST(handlers, ecore_event_handler_del);
|
2005-02-15 03:49:24 -08:00
|
|
|
|
2011-02-15 21:20:13 -08:00
|
|
|
if (!x_fatal)
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
e_menu_hide_all();
|
2005-02-15 03:49:24 -08:00
|
|
|
_e_active_menus = NULL;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
E_FREE_FUNC(_e_menu_categories, eina_hash_free);
|
2008-12-17 07:33:43 -08:00
|
|
|
|
2012-09-11 04:55:08 -07:00
|
|
|
_e_menu_lock = EINA_FALSE;
|
2012-09-19 03:15:03 -07:00
|
|
|
e_int_menus_shutdown();
|
2010-05-01 12:28:27 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-12-30 23:47:51 -08:00
|
|
|
e_menu_hide_all(void)
|
|
|
|
{
|
2016-04-26 13:33:46 -07:00
|
|
|
E_Menu *m;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(_e_active_menus, m)
|
2012-12-30 23:47:51 -08:00
|
|
|
{
|
2013-09-05 09:26:22 -07:00
|
|
|
if (m->post_deactivate_cb.func)
|
|
|
|
m->post_deactivate_cb.func(m->post_deactivate_cb.data, m);
|
2012-12-30 23:47:51 -08:00
|
|
|
m->active = 0;
|
2016-01-14 12:05:33 -08:00
|
|
|
if (m->comp_object == e_comp->autoclose.obj)
|
|
|
|
e_comp_object_util_autoclose(NULL, NULL, NULL, NULL);
|
2012-12-30 23:47:51 -08:00
|
|
|
_e_menu_unrealize(m);
|
|
|
|
m->in_active_list = 0;
|
|
|
|
e_object_unref(E_OBJECT(m));
|
|
|
|
}
|
2019-07-31 05:04:44 -07:00
|
|
|
if (_e_menu_grabbed)
|
|
|
|
{
|
|
|
|
e_comp_ungrab_input(1, 1);
|
|
|
|
_e_menu_grabbed = EINA_FALSE;
|
|
|
|
}
|
2012-12-30 23:47:51 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Menu *
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_new(void)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2005-01-21 22:58:34 -08:00
|
|
|
m = E_OBJECT_ALLOC(E_Menu, E_MENU_TYPE, _e_menu_free);
|
2004-11-24 19:37:45 -08:00
|
|
|
if (!m) return NULL;
|
|
|
|
m->cur.w = 1;
|
|
|
|
m->cur.h = 1;
|
2006-01-06 15:45:13 -08:00
|
|
|
m->category = NULL;
|
2018-10-17 04:17:10 -07:00
|
|
|
m->hold_mode = EINA_TRUE;
|
2004-11-24 19:37:45 -08:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2018-10-17 04:17:10 -07:00
|
|
|
E_API void
|
|
|
|
e_menu_hold_mode_set(E_Menu *m, Eina_Bool hold_mode)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(m);
|
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
|
|
|
m->hold_mode = hold_mode;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2005-01-11 05:43:01 -08:00
|
|
|
e_menu_activate_key(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(m);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
2005-01-11 05:43:01 -08:00
|
|
|
E_OBJECT_CHECK(zone);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
|
2013-03-13 00:47:46 -07:00
|
|
|
if (_e_active_menus) e_menu_hide_all();
|
2005-07-25 02:55:47 -07:00
|
|
|
_e_menu_activate_time = 0;
|
2005-06-16 02:12:44 -07:00
|
|
|
_e_menu_activate_floating = 0;
|
2005-01-11 05:43:01 -08:00
|
|
|
_e_menu_activate_internal(m, zone);
|
2006-10-07 23:43:31 -07:00
|
|
|
if (!m->zone)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_deactivate(m);
|
|
|
|
return;
|
2006-10-07 23:43:31 -07:00
|
|
|
}
|
2005-05-18 03:18:02 -07:00
|
|
|
switch (dir)
|
|
|
|
{
|
|
|
|
case E_MENU_POP_DIRECTION_LEFT:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x - m->cur.w;
|
|
|
|
m->cur.y = y;
|
|
|
|
if ((m->cur.y + m->cur.h) > (m->zone->y + m->zone->h))
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
|
|
|
_e_menu_activate_first();
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_RIGHT:
|
2017-09-19 03:50:39 -07:00
|
|
|
_e_menu_realize(m);
|
2012-06-21 00:11:47 -07:00
|
|
|
m->cur.x = x + w;
|
|
|
|
m->cur.y = y;
|
|
|
|
_e_menu_activate_first();
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_UP:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x;
|
|
|
|
if ((m->cur.x + m->cur.w) > (m->zone->x + m->zone->w))
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
m->cur.y = y - m->cur.h;
|
|
|
|
_e_menu_activate_last();
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_DOWN:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x;
|
|
|
|
if ((m->cur.x + m->cur.w) > (m->zone->x + m->zone->w))
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
m->cur.y = y + h;
|
|
|
|
if ((m->cur.y + m->cur.h) > (m->zone->y + m->zone->h))
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
|
|
|
_e_menu_activate_first();
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_AUTO:
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
|
|
|
int pos = 0;
|
|
|
|
|
|
|
|
pos = _e_menu_auto_place(m, x, y, w, h);
|
|
|
|
if (pos == 4)
|
|
|
|
_e_menu_activate_last();
|
|
|
|
else
|
|
|
|
_e_menu_activate_first();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
default:
|
2012-06-21 00:11:47 -07:00
|
|
|
m->cur.x = x + w;
|
|
|
|
m->cur.y = y + h;
|
|
|
|
_e_menu_activate_first();
|
|
|
|
break;
|
2005-05-18 03:18:02 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2013-09-11 06:23:43 -07:00
|
|
|
e_menu_activate_mouse(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir, unsigned int activate_time)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_Menu_Item *pmi;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
E_OBJECT_CHECK(m);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
2005-01-11 05:43:01 -08:00
|
|
|
E_OBJECT_CHECK(zone);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
|
2013-03-13 00:47:46 -07:00
|
|
|
if (_e_active_menus) e_menu_hide_all();
|
2017-08-04 13:23:39 -07:00
|
|
|
_e_menu_activate_time = 0;
|
2005-06-16 02:12:44 -07:00
|
|
|
_e_menu_activate_floating = 0;
|
2005-01-11 05:43:01 -08:00
|
|
|
_e_menu_activate_internal(m, zone);
|
2006-10-07 23:43:31 -07:00
|
|
|
if (!m->zone)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_deactivate(m);
|
|
|
|
return;
|
2006-10-07 23:43:31 -07:00
|
|
|
}
|
2005-05-18 03:18:02 -07:00
|
|
|
switch (dir)
|
|
|
|
{
|
|
|
|
case E_MENU_POP_DIRECTION_LEFT:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x - m->cur.w;
|
|
|
|
m->cur.y = y;
|
|
|
|
if ((m->cur.y + m->cur.h) > (m->zone->y + m->zone->h))
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_RIGHT:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x + w;
|
|
|
|
m->cur.y = y;
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_UP:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x;
|
|
|
|
if ((m->cur.x + m->cur.w) > (m->zone->x + m->zone->w))
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
m->cur.y = y - m->cur.h;
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_DOWN:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x;
|
|
|
|
if ((m->cur.x + m->cur.w) > (m->zone->x + m->zone->w))
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
m->cur.y = y + h;
|
|
|
|
if ((m->cur.y + m->cur.h) > (m->zone->y + m->zone->h))
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_AUTO:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_auto_place(m, x, y, w, h);
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
default:
|
2012-06-21 00:11:47 -07:00
|
|
|
m->cur.x = x + w;
|
|
|
|
m->cur.y = y + h;
|
|
|
|
break;
|
2005-05-18 03:18:02 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
pmi = _e_menu_item_active_get();
|
|
|
|
if (pmi) e_menu_item_active_set(pmi, 0);
|
2017-03-03 08:56:16 -08:00
|
|
|
pending_feed = 1;
|
2017-08-04 13:23:39 -07:00
|
|
|
if (!activate_time) activate_time = lround(ecore_loop_time_get() * 1000);
|
|
|
|
_e_menu_activate_time = pending_activate_time = activate_time;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2005-01-11 05:43:01 -08:00
|
|
|
e_menu_activate(E_Menu *m, E_Zone *zone, int x, int y, int w, int h, int dir)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_Menu_Item *pmi;
|
|
|
|
|
|
|
|
E_OBJECT_CHECK(m);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
2005-01-11 05:43:01 -08:00
|
|
|
E_OBJECT_CHECK(zone);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);
|
2013-03-13 00:47:46 -07:00
|
|
|
if (_e_active_menus) e_menu_hide_all();
|
2005-07-25 02:55:47 -07:00
|
|
|
_e_menu_activate_time = 0;
|
2005-06-16 02:12:44 -07:00
|
|
|
_e_menu_activate_floating = 0;
|
2005-01-11 05:43:01 -08:00
|
|
|
_e_menu_activate_internal(m, zone);
|
2006-10-07 23:43:31 -07:00
|
|
|
if (!m->zone)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_deactivate(m);
|
|
|
|
return;
|
2006-10-07 23:43:31 -07:00
|
|
|
}
|
2005-05-18 03:18:02 -07:00
|
|
|
switch (dir)
|
|
|
|
{
|
|
|
|
case E_MENU_POP_DIRECTION_LEFT:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x - m->cur.w;
|
|
|
|
m->cur.y = y;
|
|
|
|
if ((m->cur.y + m->cur.h) > (m->zone->y + m->zone->h))
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
|
|
|
_e_menu_activate_first();
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_RIGHT:
|
2009-03-24 13:13:50 -07:00
|
|
|
_e_menu_realize(m);
|
2012-06-21 00:11:47 -07:00
|
|
|
m->cur.x = x + w;
|
|
|
|
m->cur.y = y;
|
|
|
|
_e_menu_activate_first();
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_UP:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x;
|
|
|
|
if ((m->cur.x + m->cur.w) > (m->zone->x + m->zone->w))
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
m->cur.y = y - m->cur.h;
|
|
|
|
_e_menu_activate_last();
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_DOWN:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
m->cur.x = x;
|
|
|
|
if ((m->cur.x + m->cur.w) > (m->zone->x + m->zone->w))
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
m->cur.y = y + h;
|
|
|
|
if ((m->cur.y + m->cur.h) > (m->zone->y + m->zone->h))
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
|
|
|
_e_menu_activate_first();
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
case E_MENU_POP_DIRECTION_AUTO:
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_auto_place(m, x, y, w, h);
|
|
|
|
break;
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
default:
|
2012-06-21 00:11:47 -07:00
|
|
|
m->cur.x = x + w;
|
|
|
|
m->cur.y = y + h;
|
|
|
|
break;
|
2005-05-18 03:18:02 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
pmi = _e_menu_item_active_get();
|
|
|
|
if (pmi) e_menu_item_active_set(pmi, 0);
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_deactivate(E_Menu *m)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(m);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
2013-05-18 09:00:39 -07:00
|
|
|
if (!m->active) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
m->cur.visible = 0;
|
|
|
|
m->active = 0;
|
|
|
|
if (m->post_deactivate_cb.func)
|
|
|
|
m->post_deactivate_cb.func(m->post_deactivate_cb.data, m);
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_freeze(E_Menu *m)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK_RETURN(m, 0);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(m, E_MENU_TYPE, 0);
|
2004-11-24 19:37:45 -08:00
|
|
|
m->frozen++;
|
|
|
|
return m->frozen;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_thaw(E_Menu *m)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK_RETURN(m, 0);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(m, E_MENU_TYPE, 0);
|
2004-11-24 19:37:45 -08:00
|
|
|
m->frozen--;
|
|
|
|
if (m->frozen < 0) m->frozen = 0;
|
|
|
|
return m->frozen;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-08-22 06:02:08 -07:00
|
|
|
e_menu_title_set(E_Menu *m, const char *title)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(m);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
if ((m->header.title) && (title) && (!strcmp(m->header.title, title)))
|
|
|
|
return;
|
|
|
|
if (m->header.title)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
eina_stringshare_del(m->header.title);
|
|
|
|
m->header.title = NULL;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2008-10-15 08:12:56 -07:00
|
|
|
if (title) m->header.title = eina_stringshare_add(title);
|
2004-11-24 19:37:45 -08:00
|
|
|
else m->header.title = NULL;
|
|
|
|
m->changed = 1;
|
2018-06-19 09:01:43 -07:00
|
|
|
if (!m->realized) return;
|
2012-07-31 02:11:23 -07:00
|
|
|
edje_object_part_text_set(m->bg_object, "e.text.title", m->header.title);
|
|
|
|
if (m->header.title)
|
|
|
|
edje_object_signal_emit(m->bg_object, "e,action,show,title", "e");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(m->bg_object, "e,action,hide,title", "e");
|
|
|
|
edje_object_message_signal_process(m->bg_object);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2015-03-18 15:09:09 -07:00
|
|
|
e_menu_icon_file_set(E_Menu *m EINA_UNUSED, const char *icon EINA_UNUSED)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2010-08-19 17:45:45 -07:00
|
|
|
/* FIXME: support menu icons
|
2012-06-21 00:11:47 -07:00
|
|
|
E_OBJECT_CHECK(m);
|
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
2010-08-19 17:45:45 -07:00
|
|
|
*/
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-08-22 06:02:08 -07:00
|
|
|
e_menu_category_set(E_Menu *m, const char *category)
|
2006-01-06 15:45:13 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(m);
|
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
|
|
|
if (m->category)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
eina_stringshare_del(m->category);
|
|
|
|
m->category = NULL;
|
2006-01-06 15:45:13 -08:00
|
|
|
}
|
2006-01-08 08:38:01 -08:00
|
|
|
if (category)
|
2009-03-24 14:11:03 -07:00
|
|
|
m->category = eina_stringshare_add(category);
|
2006-01-08 08:38:01 -08:00
|
|
|
else
|
2009-03-24 14:11:03 -07:00
|
|
|
m->category = NULL;
|
2006-01-06 15:45:13 -08:00
|
|
|
m->changed = 1;
|
|
|
|
}
|
2006-01-07 02:39:46 -08:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2006-01-06 15:45:13 -08:00
|
|
|
e_menu_category_data_set(char *category, void *data)
|
|
|
|
{
|
|
|
|
E_Menu_Category *cat;
|
2008-12-17 07:33:43 -08:00
|
|
|
|
|
|
|
cat = eina_hash_find(_e_menu_categories, category);
|
2006-01-06 15:45:13 -08:00
|
|
|
if (cat)
|
2009-03-24 14:11:03 -07:00
|
|
|
cat->data = data;
|
2010-09-08 16:59:07 -07:00
|
|
|
else /* if it isn't found create the new hash */
|
2006-01-06 15:45:13 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
cat = calloc(1, sizeof(E_Menu_Category));
|
|
|
|
cat->data = data;
|
|
|
|
eina_hash_add(_e_menu_categories, category, cat);
|
2006-01-06 15:45:13 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Menu_Category_Callback *
|
2013-01-11 02:34:29 -08:00
|
|
|
e_menu_category_callback_add(char *category, void (*create_cb)(void *data, E_Menu *m, void *category_data), Ecore_Cb free_cb, void *data)
|
2006-01-06 15:45:13 -08:00
|
|
|
{
|
|
|
|
E_Menu_Category *cat;
|
2006-01-08 08:38:01 -08:00
|
|
|
E_Menu_Category_Callback *cb = NULL;
|
2008-12-17 07:33:43 -08:00
|
|
|
|
|
|
|
cat = eina_hash_find(_e_menu_categories, category);
|
2010-09-08 16:59:07 -07:00
|
|
|
if (!cat) /* if it isn't found create the new hash */
|
2006-01-06 15:45:13 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
cat = calloc(1, sizeof(E_Menu_Category));
|
|
|
|
eina_hash_add(_e_menu_categories, category, cat);
|
2006-01-06 15:45:13 -08:00
|
|
|
}
|
2006-01-08 08:38:01 -08:00
|
|
|
if (cat)
|
2009-03-24 14:11:03 -07:00
|
|
|
{
|
|
|
|
cb = calloc(1, sizeof(E_Menu_Category_Callback));
|
|
|
|
if (cb)
|
|
|
|
{
|
|
|
|
cb->data = data;
|
2012-05-03 19:34:56 -07:00
|
|
|
cb->create = create_cb;
|
|
|
|
cb->free = free_cb;
|
2009-03-24 14:11:03 -07:00
|
|
|
cb->category = eina_stringshare_add(category);
|
|
|
|
cat->callbacks = eina_list_append(cat->callbacks, cb);
|
|
|
|
}
|
|
|
|
}
|
2006-01-08 08:38:01 -08:00
|
|
|
return cb;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2006-01-08 08:38:01 -08:00
|
|
|
e_menu_category_callback_del(E_Menu_Category_Callback *cb)
|
|
|
|
{
|
|
|
|
E_Menu_Category *cat;
|
|
|
|
|
|
|
|
if (cb)
|
2009-03-24 14:11:03 -07:00
|
|
|
{
|
|
|
|
cat = eina_hash_find(_e_menu_categories, cb->category);
|
|
|
|
if (cat)
|
|
|
|
cat->callbacks = eina_list_remove(cat->callbacks, cb);
|
|
|
|
eina_stringshare_del(cb->category);
|
|
|
|
free(cb);
|
|
|
|
}
|
2006-01-06 15:45:13 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_pre_activate_callback_set(E_Menu *m, void (*func)(void *data, E_Menu *m), void *data)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(m);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
m->pre_activate_cb.func = func;
|
|
|
|
m->pre_activate_cb.data = data;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_post_deactivate_callback_set(E_Menu *m, void (*func)(void *data, E_Menu *m), void *data)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(m);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(m, E_MENU_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
m->post_deactivate_cb.func = func;
|
|
|
|
m->post_deactivate_cb.data = data;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Menu *
|
2004-12-22 02:41:03 -08:00
|
|
|
e_menu_root_get(E_Menu *m)
|
|
|
|
{
|
|
|
|
E_Menu *ret;
|
|
|
|
|
|
|
|
E_OBJECT_CHECK_RETURN(m, NULL);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(m, E_MENU_TYPE, NULL);
|
2004-12-22 02:41:03 -08:00
|
|
|
ret = m;
|
2006-08-09 06:52:52 -07:00
|
|
|
while ((ret->parent_item) && (ret->parent_item->menu))
|
2009-03-24 14:11:03 -07:00
|
|
|
ret = ret->parent_item->menu;
|
2004-12-22 02:41:03 -08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Menu_Item *
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_new(E_Menu *m)
|
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
E_OBJECT_CHECK_RETURN(m, NULL);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(m, E_MENU_TYPE, NULL);
|
|
|
|
mi = E_OBJECT_ALLOC(E_Menu_Item, E_MENU_ITEM_TYPE, _e_menu_item_free);
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->menu = m;
|
2008-10-22 04:49:33 -07:00
|
|
|
mi->menu->items = eina_list_append(mi->menu->items, mi);
|
|
|
|
mi->list_position = eina_list_last(mi->menu->items);
|
2004-11-24 19:37:45 -08:00
|
|
|
return mi;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Menu_Item *
|
2011-03-17 10:08:36 -07:00
|
|
|
e_menu_item_new_relative(E_Menu *m, E_Menu_Item *rel)
|
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
E_OBJECT_CHECK_RETURN(m, NULL);
|
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(m, E_MENU_TYPE, NULL);
|
|
|
|
if (rel)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
E_OBJECT_CHECK_RETURN(rel, NULL);
|
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(rel, E_MENU_ITEM_TYPE, NULL);
|
|
|
|
if (rel->menu != m) return NULL;
|
2011-03-17 10:08:36 -07:00
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2011-03-17 10:08:36 -07:00
|
|
|
mi = E_OBJECT_ALLOC(E_Menu_Item, E_MENU_ITEM_TYPE, _e_menu_item_free);
|
|
|
|
mi->menu = m;
|
|
|
|
|
|
|
|
if (rel)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
Eina_List *l;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2012-06-21 00:11:47 -07:00
|
|
|
l = eina_list_data_find_list(m->items, rel);
|
|
|
|
m->items = eina_list_append_relative_list(m->items, mi, l);
|
2012-07-30 06:30:08 -07:00
|
|
|
mi->list_position = l->next;
|
2011-03-17 10:08:36 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
m->items = eina_list_prepend(m->items, mi);
|
|
|
|
mi->list_position = m->items;
|
2011-03-17 10:08:36 -07:00
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2011-03-17 10:08:36 -07:00
|
|
|
return mi;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Menu_Item *
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_nth(E_Menu *m, int n)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK_RETURN(m, NULL);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(m, E_MENU_TYPE, NULL);
|
2008-10-22 04:49:33 -07:00
|
|
|
return (E_Menu_Item *)eina_list_nth(m->items, n);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2009-03-23 05:28:15 -07:00
|
|
|
e_menu_item_num_get(const E_Menu_Item *mi)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2009-03-23 05:28:15 -07:00
|
|
|
const Eina_List *l;
|
|
|
|
const E_Menu_Item *mi2;
|
2009-03-24 14:11:03 -07:00
|
|
|
int i = 0;
|
2009-03-23 05:28:15 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
E_OBJECT_CHECK_RETURN(mi, -1);
|
2006-06-08 12:01:32 -07:00
|
|
|
E_OBJECT_CHECK_RETURN(mi->menu, -1);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(mi, E_MENU_TYPE, -1);
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(mi->menu->items, l, mi2)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi2 == mi) return i;
|
|
|
|
i++;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2005-05-19 20:09:44 -07:00
|
|
|
e_menu_item_icon_file_set(E_Menu_Item *mi, const char *icon)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
if (((mi->icon) && (icon) && (!strcmp(icon, mi->icon))) ||
|
2012-06-20 23:19:43 -07:00
|
|
|
((!mi->icon) && (!icon)))
|
2004-11-24 19:37:45 -08:00
|
|
|
return;
|
2008-10-15 08:12:56 -07:00
|
|
|
if (mi->icon) eina_stringshare_del(mi->icon);
|
|
|
|
if (mi->icon_key) eina_stringshare_del(mi->icon_key);
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->icon = NULL;
|
|
|
|
mi->icon_key = NULL;
|
2011-01-15 17:11:46 -08:00
|
|
|
if (icon)
|
|
|
|
{
|
|
|
|
mi->icon = eina_stringshare_add(icon);
|
2012-09-19 00:16:54 -07:00
|
|
|
if (eina_str_has_extension(mi->icon, ".edj"))
|
2011-01-15 17:11:46 -08:00
|
|
|
mi->icon_key = eina_stringshare_add("icon");
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->changed = 1;
|
|
|
|
mi->menu->changed = 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2005-05-19 20:09:44 -07:00
|
|
|
e_menu_item_icon_edje_set(E_Menu_Item *mi, const char *icon, const char *key)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
if (((mi->icon) && (icon) && (!strcmp(icon, mi->icon))) ||
|
2012-06-20 23:19:43 -07:00
|
|
|
((!mi->icon) && (!icon)) ||
|
2004-11-24 19:37:45 -08:00
|
|
|
((key) && (mi->icon_key) && (!strcmp(key, mi->icon_key))))
|
|
|
|
return;
|
2012-09-19 00:20:26 -07:00
|
|
|
eina_stringshare_replace(&mi->icon, icon);
|
|
|
|
eina_stringshare_replace(&mi->icon_key, key);
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->changed = 1;
|
|
|
|
mi->menu->changed = 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2005-05-19 20:09:44 -07:00
|
|
|
e_menu_item_label_set(E_Menu_Item *mi, const char *label)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
if (((mi->label) && (label) && (!strcmp(label, mi->label))) ||
|
2012-06-20 23:19:43 -07:00
|
|
|
((!mi->label) && (!label)))
|
2004-11-24 19:37:45 -08:00
|
|
|
return;
|
2008-10-15 08:12:56 -07:00
|
|
|
if (mi->label) eina_stringshare_del(mi->label);
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->label = NULL;
|
2008-10-15 08:12:56 -07:00
|
|
|
if (label) mi->label = eina_stringshare_add(label);
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->changed = 1;
|
|
|
|
mi->menu->changed = 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_submenu_set(E_Menu_Item *mi, E_Menu *sub)
|
|
|
|
{
|
2012-08-03 02:11:15 -07:00
|
|
|
Eina_Bool submenu = EINA_FALSE;
|
|
|
|
Evas_Object *o;
|
2013-02-19 00:09:05 -08:00
|
|
|
Eina_List *tmp = NULL;
|
2012-08-03 02:11:15 -07:00
|
|
|
int ww, hh;
|
2004-11-24 19:37:45 -08:00
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2013-02-19 00:09:05 -08:00
|
|
|
|
|
|
|
tmp = _e_active_menus_copy_ref();
|
2012-08-03 02:11:15 -07:00
|
|
|
submenu = !!mi->submenu;
|
2004-11-24 19:37:45 -08:00
|
|
|
if (mi->submenu) e_object_unref(E_OBJECT(mi->submenu));
|
2005-04-27 16:29:12 -07:00
|
|
|
if (sub) e_object_ref(E_OBJECT(sub));
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->submenu = sub;
|
|
|
|
mi->changed = 1;
|
|
|
|
mi->menu->changed = 1;
|
2013-02-19 00:09:05 -08:00
|
|
|
if (!!sub == submenu) goto out;
|
|
|
|
if (!mi->bg_object) goto out;
|
2012-09-11 04:55:08 -07:00
|
|
|
if (sub) e_object_ref(E_OBJECT(sub));
|
|
|
|
_e_menu_lock = EINA_TRUE;
|
2012-08-03 02:11:15 -07:00
|
|
|
if ((mi->submenu) || (mi->submenu_pre_cb.func))
|
|
|
|
{
|
2012-11-02 04:56:32 -07:00
|
|
|
if (mi->submenu_object)
|
|
|
|
{
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->submenu_object))
|
2012-11-02 04:56:32 -07:00
|
|
|
{
|
|
|
|
/* already have a correct submenu object, don't re-set it */
|
|
|
|
_e_menu_lock = EINA_FALSE;
|
|
|
|
if (sub) e_object_unref(E_OBJECT(sub));
|
2012-12-11 06:37:17 -08:00
|
|
|
edje_object_size_min_calc(mi->submenu_object, &ww, &hh);
|
|
|
|
mi->submenu_w = ww;
|
|
|
|
mi->submenu_h = hh;
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->submenu_object, 0, 1);
|
|
|
|
E_FILL(mi->submenu_object);
|
|
|
|
evas_object_size_hint_min_set(mi->submenu_object, ww, hh);
|
2013-02-19 00:09:05 -08:00
|
|
|
goto out;
|
2012-11-02 04:56:32 -07:00
|
|
|
}
|
|
|
|
evas_object_del(mi->submenu_object);
|
|
|
|
}
|
2012-08-03 02:11:15 -07:00
|
|
|
o = edje_object_add(mi->menu->evas);
|
2012-09-11 04:55:08 -07:00
|
|
|
if (sub && (mi->submenu != sub)) e_object_ref(E_OBJECT(sub));
|
|
|
|
mi->submenu = sub;
|
2012-08-03 02:11:15 -07:00
|
|
|
mi->submenu_object = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/submenu");
|
|
|
|
evas_object_pass_events_set(o, 1);
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
2019-07-31 17:25:44 -07:00
|
|
|
evas_object_show(o);
|
2012-08-03 02:11:15 -07:00
|
|
|
edje_object_size_min_calc(mi->submenu_object, &ww, &hh);
|
|
|
|
mi->submenu_w = ww;
|
|
|
|
mi->submenu_h = hh;
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->submenu_object, 0, 1);
|
|
|
|
E_FILL(mi->submenu_object);
|
|
|
|
evas_object_size_hint_min_set(mi->submenu_object, ww, hh);
|
2012-11-02 04:56:32 -07:00
|
|
|
edje_object_part_swallow(mi->bg_object, "e.swallow.content",
|
|
|
|
mi->container_object);
|
|
|
|
edje_object_size_min_calc(mi->bg_object, &ww, &hh);
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->bg_object, 1, 0);
|
|
|
|
E_FILL(mi->bg_object);
|
|
|
|
evas_object_size_hint_min_set(mi->bg_object, ww, hh);
|
2012-08-03 02:11:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (mi->submenu_object) evas_object_del(mi->submenu_object);
|
|
|
|
o = evas_object_rectangle_add(mi->menu->evas);
|
|
|
|
mi->submenu_object = o;
|
|
|
|
evas_object_color_set(o, 0, 0, 0, 0);
|
|
|
|
evas_object_pass_events_set(o, 1);
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
2012-08-03 02:11:15 -07:00
|
|
|
}
|
2012-09-11 04:55:08 -07:00
|
|
|
_e_menu_lock = EINA_FALSE;
|
|
|
|
if (sub) e_object_unref(E_OBJECT(sub));
|
2012-08-03 02:11:15 -07:00
|
|
|
if ((mi->submenu) || (mi->submenu_pre_cb.func))
|
|
|
|
{
|
|
|
|
if (e_theme_edje_object_set(mi->bg_object, "base/theme/menus",
|
2013-01-11 02:34:29 -08:00
|
|
|
"e/widgets/menu/default/submenu_bg"))
|
2013-02-19 00:09:05 -08:00
|
|
|
goto out;
|
2012-08-03 02:11:15 -07:00
|
|
|
}
|
2013-01-11 02:34:29 -08:00
|
|
|
|
2012-08-03 02:11:15 -07:00
|
|
|
e_theme_edje_object_set(mi->bg_object, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/item_bg");
|
2013-02-19 00:09:05 -08:00
|
|
|
out:
|
|
|
|
_e_menu_list_free_unref(tmp);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_separator_set(E_Menu_Item *mi, int sep)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2009-03-24 14:11:03 -07:00
|
|
|
if (((mi->separator) && (sep)) || ((!mi->separator) && (!sep))) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->separator = sep;
|
|
|
|
mi->changed = 1;
|
|
|
|
mi->menu->changed = 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_check_set(E_Menu_Item *mi, int chk)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2009-03-24 14:11:03 -07:00
|
|
|
if (((mi->check) && (chk)) || ((!mi->check) && (!chk))) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->check = chk;
|
|
|
|
mi->changed = 1;
|
|
|
|
mi->menu->changed = 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_radio_set(E_Menu_Item *mi, int rad)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2009-03-24 14:11:03 -07:00
|
|
|
if (((mi->radio) && (rad)) || ((!mi->radio) && (!rad))) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->radio = rad;
|
|
|
|
mi->changed = 1;
|
|
|
|
mi->menu->changed = 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_radio_group_set(E_Menu_Item *mi, int radg)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2004-12-22 22:38:27 -08:00
|
|
|
if (mi->radio_group == radg) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->radio_group = radg;
|
|
|
|
mi->changed = 1;
|
|
|
|
mi->menu->changed = 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_toggle_set(E_Menu_Item *mi, int tog)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
if (mi->separator) return;
|
|
|
|
if (tog)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
mi->toggle = 1;
|
|
|
|
if (mi->bg_object)
|
|
|
|
edje_object_signal_emit(mi->bg_object, "e,state,on", "e");
|
|
|
|
if (mi->icon_bg_object)
|
|
|
|
edje_object_signal_emit(mi->icon_bg_object, "e,state,on", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->label_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->label_object, "e,state,on", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->submenu_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->submenu_object, "e,state,on", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->toggle_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->toggle_object, "e,state,on", "e");
|
|
|
|
if (mi->menu->bg_object)
|
|
|
|
edje_object_signal_emit(mi->menu->bg_object, "e,state,on", "e");
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
mi->toggle = 0;
|
|
|
|
if (mi->bg_object)
|
|
|
|
edje_object_signal_emit(mi->bg_object, "e,state,off", "e");
|
|
|
|
if (mi->icon_bg_object)
|
|
|
|
edje_object_signal_emit(mi->icon_bg_object, "e,state,off", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->label_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->label_object, "e,state,off", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->submenu_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->submenu_object, "e,state,off", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->toggle_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->toggle_object, "e,state,off", "e");
|
|
|
|
if (mi->menu->bg_object)
|
|
|
|
edje_object_signal_emit(mi->menu->bg_object, "e,state,off", "e");
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
if (tog)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->radio)
|
|
|
|
{
|
|
|
|
const Eina_List *l;
|
|
|
|
E_Menu_Item *mi2;
|
2009-03-23 05:28:15 -07:00
|
|
|
|
2012-06-21 00:11:47 -07:00
|
|
|
EINA_LIST_FOREACH(mi->menu->items, l, mi2)
|
|
|
|
{
|
|
|
|
if ((mi2 != mi) && (mi2->radio) &&
|
|
|
|
(mi2->radio_group == mi->radio_group))
|
|
|
|
e_menu_item_toggle_set(mi2, 0);
|
|
|
|
}
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_toggle_get(E_Menu_Item *mi)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK_RETURN(mi, 0);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(mi, E_MENU_ITEM_TYPE, 0);
|
2004-11-24 19:37:45 -08:00
|
|
|
return mi->toggle;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-07-30 04:55:43 -07:00
|
|
|
e_menu_item_callback_set(E_Menu_Item *mi, void (*func)(void *data, E_Menu *m, E_Menu_Item *mi), const void *data)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
mi->cb.func = func;
|
2013-01-11 02:34:29 -08:00
|
|
|
mi->cb.data = (void *)data;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_item_realize_callback_set(E_Menu_Item *mi, void (*func)(void *data, E_Menu *m, E_Menu_Item *mi), void *data)
|
2006-08-21 13:03:09 -07:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
|
|
|
mi->realize_cb.func = func;
|
|
|
|
mi->realize_cb.data = data;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-08-28 03:54:58 -07:00
|
|
|
e_menu_item_submenu_pre_callback_set(E_Menu_Item *mi, void (*func)(void *data, E_Menu *m, E_Menu_Item *mi), const void *data)
|
2005-04-21 00:19:49 -07:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
|
|
|
mi->submenu_pre_cb.func = func;
|
2013-01-11 02:34:29 -08:00
|
|
|
mi->submenu_pre_cb.data = (void *)data;
|
2005-04-21 00:19:49 -07:00
|
|
|
if (!mi->submenu_post_cb.func)
|
2005-05-06 21:34:26 -07:00
|
|
|
mi->submenu_post_cb.func = _e_menu_cb_item_submenu_post_default;
|
2005-04-21 00:19:49 -07:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-08-28 03:54:58 -07:00
|
|
|
e_menu_item_submenu_post_callback_set(E_Menu_Item *mi, void (*func)(void *data, E_Menu *m, E_Menu_Item *mi), const void *data)
|
2005-04-21 00:19:49 -07:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
|
|
|
mi->submenu_post_cb.func = func;
|
2013-01-11 02:34:29 -08:00
|
|
|
mi->submenu_post_cb.data = (void *)data;
|
2005-04-21 00:19:49 -07:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_item_drag_callback_set(E_Menu_Item *mi, void (*func)(void *data, E_Menu *m, E_Menu_Item *mi), void *data)
|
2006-08-22 01:38:24 -07:00
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
|
|
|
mi->drag_cb.func = func;
|
|
|
|
mi->drag_cb.data = data;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_active_set(E_Menu_Item *mi, int active)
|
|
|
|
{
|
2013-02-19 00:09:05 -08:00
|
|
|
Eina_List *tmp = NULL;
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
E_OBJECT_CHECK(mi);
|
2005-01-21 22:58:34 -08:00
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
2004-11-24 19:37:45 -08:00
|
|
|
if (mi->separator) return;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
active = !!active;
|
|
|
|
if (active == mi->active) return;
|
2006-08-09 06:52:52 -07:00
|
|
|
if ((active) && (!mi->active))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
E_Menu_Item *pmi;
|
|
|
|
|
|
|
|
if (mi->disable) return;
|
|
|
|
pmi = _e_menu_item_active_get();
|
|
|
|
if (mi == pmi) return;
|
2012-08-30 00:04:53 -07:00
|
|
|
if (pmi)
|
2013-02-19 00:09:05 -08:00
|
|
|
{
|
|
|
|
tmp = _e_active_menus_copy_ref();
|
|
|
|
e_menu_item_active_set(pmi, 0);
|
|
|
|
}
|
2012-08-30 00:04:53 -07:00
|
|
|
if (_e_prev_active_menu_item && (mi != _e_prev_active_menu_item))
|
|
|
|
{
|
2013-12-01 08:30:43 -08:00
|
|
|
if (mi->menu->parent_item && (_e_prev_active_menu_item != mi->menu->parent_item))
|
2012-08-30 00:04:53 -07:00
|
|
|
_e_menu_submenu_deactivate(_e_prev_active_menu_item);
|
|
|
|
}
|
2012-06-21 00:11:47 -07:00
|
|
|
mi->active = 1;
|
|
|
|
_e_active_menu_item = mi;
|
|
|
|
if (mi->bg_object)
|
|
|
|
edje_object_signal_emit(mi->bg_object, "e,state,selected", "e");
|
|
|
|
if (mi->icon_bg_object)
|
|
|
|
edje_object_signal_emit(mi->icon_bg_object, "e,state,selected", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->label_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->label_object, "e,state,selected", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->submenu_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->submenu_object, "e,state,selected", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->toggle_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->toggle_object, "e,state,selected", "e");
|
|
|
|
if (mi->icon_key)
|
|
|
|
{
|
2010-06-20 04:13:31 -07:00
|
|
|
if (mi->icon_object)
|
|
|
|
{
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->icon_object))
|
2010-06-20 04:13:31 -07:00
|
|
|
edje_object_signal_emit(mi->icon_object, "e,state,selected", "e");
|
|
|
|
else
|
|
|
|
e_icon_selected_set(mi->icon_object, EINA_TRUE);
|
|
|
|
}
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
edje_object_signal_emit(mi->menu->bg_object, "e,state,selected", "e");
|
|
|
|
_e_menu_submenu_activate(mi);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2006-08-09 06:52:52 -07:00
|
|
|
else if ((!active) && (mi->active))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2013-02-19 00:09:05 -08:00
|
|
|
tmp = _e_active_menus_copy_ref();
|
2012-06-21 00:11:47 -07:00
|
|
|
mi->active = 0;
|
2012-08-30 00:04:53 -07:00
|
|
|
_e_prev_active_menu_item = mi;
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_active_menu_item = NULL;
|
|
|
|
if (mi->bg_object)
|
|
|
|
edje_object_signal_emit(mi->bg_object, "e,state,unselected", "e");
|
|
|
|
if (mi->icon_bg_object)
|
|
|
|
edje_object_signal_emit(mi->icon_bg_object, "e,state,unselected", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->label_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->label_object, "e,state,unselected", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->submenu_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->submenu_object, "e,state,unselected", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->toggle_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->toggle_object, "e,state,unselected", "e");
|
|
|
|
if (mi->icon_key)
|
|
|
|
{
|
2010-06-20 04:13:31 -07:00
|
|
|
if (mi->icon_object)
|
|
|
|
{
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->icon_object))
|
2010-06-20 04:13:31 -07:00
|
|
|
edje_object_signal_emit(mi->icon_object, "e,state,unselected", "e");
|
|
|
|
else
|
|
|
|
e_icon_selected_set(mi->icon_object, EINA_FALSE);
|
|
|
|
}
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
edje_object_signal_emit(mi->menu->bg_object, "e,state,unselected", "e");
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2013-02-19 00:09:05 -08:00
|
|
|
_e_menu_list_free_unref(tmp);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Menu_Item *
|
2012-09-03 23:17:38 -07:00
|
|
|
e_menu_item_active_get(void)
|
|
|
|
{
|
|
|
|
return _e_active_menu_item;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2012-09-04 00:01:09 -07:00
|
|
|
e_menu_active_item_activate(void)
|
|
|
|
{
|
|
|
|
_e_menu_active_call();
|
|
|
|
_e_menu_deactivate_all();
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2009-03-30 06:59:56 -07:00
|
|
|
e_menu_item_disabled_set(E_Menu_Item *mi, int disable)
|
|
|
|
{
|
|
|
|
E_OBJECT_CHECK(mi);
|
|
|
|
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
|
|
|
|
if (mi->separator) return;
|
|
|
|
if ((disable))
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->active) e_menu_item_active_set(mi, 0);
|
|
|
|
mi->disable = 1;
|
|
|
|
if (mi->icon_bg_object)
|
|
|
|
edje_object_signal_emit(mi->icon_bg_object, "e,state,disable", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->label_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->label_object, "e,state,disable", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->toggle_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->toggle_object, "e,state,disable", "e");
|
2009-03-30 06:59:56 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
mi->disable = 0;
|
|
|
|
if (mi->icon_bg_object)
|
|
|
|
edje_object_signal_emit(mi->icon_bg_object, "e,state,enable", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->label_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->label_object, "e,state,enable", "e");
|
2014-06-30 16:37:33 -07:00
|
|
|
if (isedje(mi->toggle_object))
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_signal_emit(mi->toggle_object, "e,state,enable", "e");
|
2009-03-30 06:59:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_idler_before(void)
|
|
|
|
{
|
|
|
|
/* when e goes "idle" this gets called so leave all our hard work till */
|
|
|
|
/* idle time to avoid falling behind the user. just evaluate the high */
|
|
|
|
/* level state machine */
|
2009-03-23 05:28:15 -07:00
|
|
|
Eina_List *l, *removals = NULL, *tmp;
|
|
|
|
E_Menu *m;
|
2018-10-18 08:58:51 -07:00
|
|
|
int active_count = 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2017-03-03 08:56:16 -08:00
|
|
|
if (pending_feed)
|
|
|
|
{
|
|
|
|
e_comp_canvas_feed_mouse_up(pending_activate_time);
|
|
|
|
pending_feed = 0;
|
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
/* add refcount to all menus we will work with */
|
2009-03-23 05:28:15 -07:00
|
|
|
tmp = _e_active_menus_copy_ref();
|
2004-11-24 19:37:45 -08:00
|
|
|
/* phase 1. hide all the menus that want to be hidden */
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if ((!m->cur.visible) && (m->prev.visible))
|
|
|
|
{
|
|
|
|
m->prev.visible = m->cur.visible;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
e_object_ref(E_OBJECT(m));
|
|
|
|
evas_object_pass_events_set(m->comp_object, 1);
|
|
|
|
if (m->container_object)
|
|
|
|
{
|
|
|
|
evas_object_intercept_move_callback_del(m->container_object, _e_menu_cb_intercept_container_move);
|
|
|
|
evas_object_intercept_resize_callback_del(m->container_object, _e_menu_cb_intercept_container_resize);
|
|
|
|
}
|
|
|
|
evas_object_hide(m->comp_object);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
/* phase 2. move & reisze all the menus that want to moves/resized */
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
if (m->frozen || (!m->active)) continue;
|
2012-06-21 00:11:47 -07:00
|
|
|
if (!m->realized) _e_menu_realize(m);
|
2013-06-21 02:28:22 -07:00
|
|
|
if (!m->realized) continue;
|
|
|
|
if (((m->cur.w) != (m->prev.w)) ||
|
|
|
|
((m->cur.h) != (m->prev.h)))
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2013-06-21 02:28:22 -07:00
|
|
|
int w, h;
|
|
|
|
|
|
|
|
m->prev.w = m->cur.w;
|
|
|
|
m->prev.h = m->cur.h;
|
|
|
|
w = m->cur.w;
|
|
|
|
h = m->cur.h;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
evas_object_resize(m->comp_object, w, h);
|
2013-06-21 02:28:22 -07:00
|
|
|
}
|
|
|
|
if (((m->cur.x) != (m->prev.x)) ||
|
|
|
|
((m->cur.y) != (m->prev.y)))
|
|
|
|
{
|
|
|
|
if (!m->parent_item)
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2013-06-21 02:28:22 -07:00
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
e_zone_useful_geometry_get(m->zone, &x, &y, &w, &h);
|
|
|
|
if (m->cur.w <= w)
|
2012-11-16 14:09:48 -08:00
|
|
|
{
|
2013-06-21 02:28:22 -07:00
|
|
|
if ((m->cur.x + m->cur.w) > (x + w))
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
}
|
|
|
|
if (m->cur.h <= h)
|
|
|
|
{
|
|
|
|
if ((m->cur.y + m->cur.h) > (y + h))
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
2012-11-16 14:09:48 -08:00
|
|
|
}
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2013-06-21 02:28:22 -07:00
|
|
|
m->prev.x = m->cur.x;
|
|
|
|
m->prev.y = m->cur.y;
|
2017-08-18 12:52:52 -07:00
|
|
|
_e_menu_lock = 1;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
evas_object_move(m->comp_object, m->cur.x, m->cur.y);
|
2017-08-18 12:52:52 -07:00
|
|
|
_e_menu_lock = 0;
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
/* phase 3. show all the menus that want to be shown */
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-08-06 01:16:14 -07:00
|
|
|
if (m->frozen) continue;
|
2012-09-19 03:05:41 -07:00
|
|
|
if (!m->realized) continue;
|
2015-04-20 15:08:07 -07:00
|
|
|
if (m->cur.visible)
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
|
|
|
m->prev.visible = m->cur.visible;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
evas_object_pass_events_set(m->comp_object, 0);
|
|
|
|
evas_object_show(m->comp_object);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
/* phase 4. de-activate... */
|
2013-02-19 00:09:05 -08:00
|
|
|
EINA_LIST_REVERSE_FOREACH(_e_active_menus, l, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2018-07-25 11:59:36 -07:00
|
|
|
if (!m->active)
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2018-07-25 11:59:36 -07:00
|
|
|
if ((m->realized) &&
|
|
|
|
(!evas_object_visible_get(m->comp_object)))
|
|
|
|
{
|
|
|
|
_e_menu_unrealize(m);
|
|
|
|
removals = eina_list_append(removals, m);
|
|
|
|
}
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FREE(removals, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (m->in_active_list)
|
|
|
|
{
|
|
|
|
_e_active_menus = eina_list_remove(_e_active_menus, m);
|
|
|
|
m->in_active_list = 0;
|
|
|
|
e_object_unref(E_OBJECT(m));
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
/* del refcount to all menus we worked with */
|
2010-01-15 03:29:50 -08:00
|
|
|
_e_menu_list_free_unref(tmp);
|
2009-03-23 05:28:15 -07:00
|
|
|
|
2018-10-18 08:58:51 -07:00
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
|
|
|
{
|
|
|
|
if (m->active) active_count++;
|
|
|
|
}
|
|
|
|
if (!active_count)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2017-02-24 11:15:42 -08:00
|
|
|
if (_e_menu_win == e_comp->ee_win)
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2019-07-31 05:04:44 -07:00
|
|
|
if (_e_menu_grabbed)
|
|
|
|
{
|
|
|
|
e_comp_ungrab_input(1, 1);
|
|
|
|
_e_menu_grabbed = EINA_FALSE;
|
|
|
|
}
|
2017-02-24 11:15:42 -08:00
|
|
|
_e_menu_win = UINT_MAX;
|
2016-01-22 09:55:32 -08:00
|
|
|
e_bindings_disabled_set(0);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-24 11:15:42 -08:00
|
|
|
E_API Eina_Bool
|
|
|
|
e_menu_is_active(void)
|
2005-01-01 18:39:44 -08:00
|
|
|
{
|
2017-02-24 11:15:42 -08:00
|
|
|
return _e_menu_win == e_comp->ee_win;
|
2005-01-01 18:39:44 -08:00
|
|
|
}
|
|
|
|
|
2017-08-04 13:23:39 -07:00
|
|
|
E_API E_Menu *
|
|
|
|
e_menu_active_get(void)
|
|
|
|
{
|
|
|
|
return _e_active_menus ? eina_list_last_data_get(_e_active_menus) : NULL;
|
|
|
|
}
|
|
|
|
|
2013-02-19 00:09:05 -08:00
|
|
|
/* local subsystem functions */
|
|
|
|
static void
|
|
|
|
_e_menu_dangling_cb(void *data)
|
2013-02-19 00:22:46 -08:00
|
|
|
{
|
2013-11-26 16:13:37 -08:00
|
|
|
E_Menu *m = data;
|
|
|
|
|
2013-02-19 00:09:05 -08:00
|
|
|
WRN("DANGLING SUBMENU: REF(%d)||MENU(%p)", e_object_ref_get(data), data);
|
2013-11-26 16:13:37 -08:00
|
|
|
m->dangling_job = NULL;
|
2013-02-19 00:22:46 -08:00
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
static void
|
|
|
|
_e_menu_free(E_Menu *m)
|
|
|
|
{
|
2009-03-23 05:28:15 -07:00
|
|
|
Eina_List *l, *l_next;
|
|
|
|
E_Menu_Item *mi;
|
2008-12-29 04:40:49 -08:00
|
|
|
E_Menu_Category *cat = NULL;
|
2008-12-17 07:33:43 -08:00
|
|
|
|
2006-01-06 15:45:13 -08:00
|
|
|
/* the foreign menu items */
|
2008-12-29 04:40:49 -08:00
|
|
|
if (m->category) cat = eina_hash_find(_e_menu_categories, m->category);
|
2006-08-09 06:52:52 -07:00
|
|
|
if (cat)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
E_Menu_Category_Callback *cb;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2012-06-21 00:11:47 -07:00
|
|
|
EINA_LIST_FOREACH(cat->callbacks, l, cb)
|
|
|
|
{
|
|
|
|
if (cb->free) cb->free(cb->data);
|
|
|
|
}
|
2006-08-09 06:52:52 -07:00
|
|
|
}
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
eina_stringshare_replace(&m->category, NULL);
|
2013-02-19 04:58:25 -08:00
|
|
|
if (m->parent_item)
|
2012-08-30 00:04:53 -07:00
|
|
|
m->parent_item->submenu = NULL;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
_e_menu_unrealize(m);
|
|
|
|
if (m->realized) return;
|
2013-01-11 02:34:29 -08:00
|
|
|
EINA_LIST_FOREACH_SAFE(m->items, l, l_next, mi)
|
2009-10-25 11:42:47 -07:00
|
|
|
e_object_del(E_OBJECT(mi));
|
2004-11-24 19:37:45 -08:00
|
|
|
if (m->in_active_list)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_active_menus = eina_list_remove(_e_active_menus, m);
|
|
|
|
m->in_active_list = 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2008-10-15 08:12:56 -07:00
|
|
|
if (m->header.title) eina_stringshare_del(m->header.title);
|
|
|
|
if (m->header.icon_file) eina_stringshare_del(m->header.icon_file);
|
2013-03-29 22:11:07 -07:00
|
|
|
if (m->dangling_job) ecore_job_del(m->dangling_job);
|
2004-11-24 19:37:45 -08:00
|
|
|
free(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_item_free(E_Menu_Item *mi)
|
|
|
|
{
|
2006-08-09 06:52:52 -07:00
|
|
|
if (mi == _e_active_menu_item) _e_active_menu_item = NULL;
|
2012-08-30 00:04:53 -07:00
|
|
|
if (mi == _e_prev_active_menu_item) _e_prev_active_menu_item = NULL;
|
2004-11-24 19:37:45 -08:00
|
|
|
if (mi->submenu)
|
|
|
|
{
|
2012-08-30 00:04:53 -07:00
|
|
|
int ref = 0;
|
|
|
|
|
|
|
|
/* parent_item gets unset in a few places, reapply it for use in cleanup */
|
|
|
|
if (!mi->submenu->parent_item)
|
|
|
|
mi->submenu->parent_item = mi;
|
|
|
|
/* menu may not have been deactivated, ensure deactivate callback is called */
|
|
|
|
if (mi->active)
|
|
|
|
_e_menu_submenu_deactivate(mi);
|
|
|
|
/* submenus CANNOT exist without their parent menu+item, so ensure that they get deleted */
|
|
|
|
if (mi->submenu)
|
|
|
|
{
|
|
|
|
ref = e_object_ref_get(E_OBJECT(mi->submenu)) - 1;
|
|
|
|
e_object_unref(E_OBJECT(mi->submenu));
|
|
|
|
}
|
2013-01-11 02:34:29 -08:00
|
|
|
if (ref)
|
2013-02-19 00:09:05 -08:00
|
|
|
{
|
|
|
|
if (!mi->submenu->dangling_job)
|
|
|
|
mi->submenu->dangling_job = ecore_job_add(_e_menu_dangling_cb, mi->submenu);
|
|
|
|
mi->submenu->parent_item = NULL;
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
if (mi->menu->realized) _e_menu_item_unrealize(mi);
|
2008-10-22 04:49:33 -07:00
|
|
|
mi->menu->items = eina_list_remove(mi->menu->items, mi);
|
2008-10-15 08:12:56 -07:00
|
|
|
if (mi->icon) eina_stringshare_del(mi->icon);
|
|
|
|
if (mi->icon_key) eina_stringshare_del(mi->icon_key);
|
|
|
|
if (mi->label) eina_stringshare_del(mi->label);
|
2004-11-24 19:37:45 -08:00
|
|
|
free(mi);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_cb_intercept_item_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y)
|
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
mi = data;
|
|
|
|
mi->x = x;
|
|
|
|
mi->y = y;
|
|
|
|
evas_object_move(o, x, y);
|
|
|
|
if ((mi->submenu) && (mi->submenu->parent_item))
|
2013-02-11 00:35:28 -08:00
|
|
|
{
|
|
|
|
mi->submenu->zone = mi->menu->zone;
|
|
|
|
_e_menu_reposition(mi->submenu);
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_cb_intercept_item_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h)
|
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
mi = data;
|
|
|
|
mi->w = w;
|
|
|
|
mi->h = h;
|
|
|
|
evas_object_resize(o, w, h);
|
|
|
|
if ((mi->submenu) && (mi->submenu->parent_item))
|
|
|
|
_e_menu_reposition(mi->submenu);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_cb_intercept_container_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
m = data;
|
|
|
|
m->container_x = x;
|
|
|
|
m->container_y = y;
|
|
|
|
if (m->parent_item) _e_menu_reposition(m);
|
|
|
|
evas_object_move(o, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_cb_intercept_container_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
2009-03-24 14:11:03 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
m = data;
|
|
|
|
m->container_w = w;
|
|
|
|
m->container_h = h;
|
|
|
|
if (m->parent_item) _e_menu_reposition(m);
|
|
|
|
evas_object_resize(o, w, h);
|
|
|
|
}
|
|
|
|
|
2013-02-19 00:09:05 -08:00
|
|
|
static void
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
_e_menu_hide_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2013-02-19 00:09:05 -08:00
|
|
|
{
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
e_object_unref(data);
|
2013-02-19 00:09:05 -08:00
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
static void
|
|
|
|
_e_menu_item_realize(E_Menu_Item *mi)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
2014-03-13 08:09:59 -07:00
|
|
|
Evas_Coord ww = 1, hh = 1;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
/* and set up initial item state */
|
2004-11-24 19:37:45 -08:00
|
|
|
if (mi->separator)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
mi->separator_object = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/separator");
|
|
|
|
edje_object_size_min_calc(mi->separator_object, &ww, &hh);
|
2015-01-01 14:29:25 -08:00
|
|
|
E_FILL(mi->separator_object);
|
2012-06-21 00:11:47 -07:00
|
|
|
mi->separator_w = ww;
|
|
|
|
mi->separator_h = hh;
|
2019-07-31 17:25:44 -07:00
|
|
|
evas_object_size_hint_min_set(mi->separator_object, ww, hh);
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_pack_end(mi->menu->container_object, mi->separator_object);
|
2019-07-31 17:25:44 -07:00
|
|
|
evas_object_show(o);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
mi->bg_object = o;
|
2013-02-19 00:09:05 -08:00
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _e_menu_cb_item_in, mi);
|
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _e_menu_cb_item_out, mi);
|
2012-06-21 00:11:47 -07:00
|
|
|
evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_item_move, mi);
|
|
|
|
evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_item_resize, mi);
|
|
|
|
if ((mi->submenu) || (mi->submenu_pre_cb.func))
|
|
|
|
{
|
|
|
|
if (!e_theme_edje_object_set(mi->bg_object, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/submenu_bg"))
|
|
|
|
goto no_submenu_item;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
no_submenu_item:
|
|
|
|
e_theme_edje_object_set(mi->bg_object, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/item_bg");
|
|
|
|
}
|
2015-01-20 16:20:04 -08:00
|
|
|
o = elm_box_add(e_comp->elm);
|
2012-06-21 00:11:47 -07:00
|
|
|
mi->container_object = o;
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_horizontal_set(o, 1);
|
2012-06-21 00:11:47 -07:00
|
|
|
evas_object_show(o);
|
|
|
|
|
|
|
|
|
|
|
|
if (mi->check)
|
|
|
|
{
|
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
mi->toggle_object = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/check");
|
|
|
|
edje_object_size_min_calc(mi->toggle_object, &ww, &hh);
|
|
|
|
mi->toggle_w = ww;
|
|
|
|
mi->toggle_h = hh;
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->toggle_object, 0, 1);
|
|
|
|
E_FILL(mi->toggle_object);
|
|
|
|
evas_object_size_hint_min_set(mi->toggle_object, ww, hh);
|
2019-07-31 17:25:44 -07:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
|
|
|
evas_object_show(o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
else if (mi->radio)
|
|
|
|
{
|
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
mi->toggle_object = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/radio");
|
|
|
|
edje_object_size_min_calc(mi->toggle_object, &ww, &hh);
|
|
|
|
mi->toggle_w = ww;
|
|
|
|
mi->toggle_h = hh;
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->toggle_object, 0, 1);
|
|
|
|
E_FILL(mi->toggle_object);
|
|
|
|
evas_object_size_hint_min_set(mi->toggle_object, ww, hh);
|
2019-07-31 17:25:44 -07:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
|
|
|
evas_object_show(o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o = evas_object_rectangle_add(mi->menu->evas);
|
|
|
|
mi->toggle_object = o;
|
|
|
|
evas_object_color_set(o, 0, 0, 0, 0);
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2013-01-07 01:35:30 -08:00
|
|
|
if ((!e_config->menu_icons_hide) && ((mi->icon) || (mi->realize_cb.func)))
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
|
|
|
int icon_w = 0, icon_h = 0;
|
|
|
|
|
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
if (e_theme_edje_object_set(o, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/icon"))
|
|
|
|
{
|
|
|
|
mi->icon_bg_object = o;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_del(o);
|
|
|
|
o = NULL;
|
|
|
|
}
|
2013-02-19 00:09:05 -08:00
|
|
|
//if (o) evas_object_pass_events_set(o, 1);
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2015-06-16 13:10:21 -07:00
|
|
|
/* FIXME: Not sure why there are two different tries to get the icon size, surely only the last one is needed. */
|
2006-09-03 04:32:13 -07:00
|
|
|
/* FIXME: Do it this way later, when e_app_icon_add() just registers a request for an icon to be filled in when it's ready.
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->app)
|
|
|
|
{
|
|
|
|
o = e_app_icon_add(mi->menu->evas, mi->app);
|
|
|
|
mi->icon_object = o;
|
|
|
|
e_icon_size_get(mi->icon_object, &icon_w, &icon_h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*/
|
|
|
|
if (mi->icon)
|
|
|
|
{
|
|
|
|
/* This is done this way to match up with how e_app_icon_add does it. */
|
|
|
|
if (mi->icon_key)
|
|
|
|
{
|
|
|
|
Evas_Coord iww, ihh;
|
|
|
|
|
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
if (edje_object_file_set(o, mi->icon, mi->icon_key))
|
|
|
|
{
|
|
|
|
mi->icon_object = o;
|
|
|
|
edje_object_size_max_get(o, &iww, &ihh);
|
|
|
|
icon_w = iww;
|
|
|
|
icon_h = ihh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_del(o);
|
|
|
|
o = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!mi->icon_object)
|
|
|
|
{
|
|
|
|
o = e_icon_add(mi->menu->evas);
|
|
|
|
mi->icon_object = o;
|
2018-01-04 12:21:51 -08:00
|
|
|
e_icon_scale_size_set(o, e_util_icon_size_normalize(96 * e_scale));
|
2009-10-25 11:42:47 -07:00
|
|
|
e_icon_preload_set(mi->icon_object, 1);
|
2012-06-21 00:11:47 -07:00
|
|
|
e_icon_file_set(o, mi->icon);
|
|
|
|
e_icon_fill_inside_set(mi->icon_object, 1);
|
|
|
|
e_icon_size_get(mi->icon_object, &icon_w, &icon_h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_e_menu_realize_call(mi))
|
|
|
|
{
|
|
|
|
o = mi->icon_object;
|
|
|
|
e_icon_fill_inside_set(o, 1);
|
|
|
|
e_icon_size_get(o, &icon_w, &icon_h);
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_show(o);
|
|
|
|
|
|
|
|
if (mi->icon_bg_object)
|
|
|
|
{
|
2014-06-07 09:29:17 -07:00
|
|
|
evas_object_size_hint_min_set(mi->icon_object, 0, 0);
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_part_swallow(mi->icon_bg_object,
|
2012-06-20 23:19:43 -07:00
|
|
|
"e.swallow.content",
|
2009-03-24 14:11:03 -07:00
|
|
|
mi->icon_object);
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_size_min_calc(mi->icon_bg_object, &ww, &hh);
|
|
|
|
mi->icon_w = ww;
|
|
|
|
mi->icon_h = hh;
|
2019-07-31 17:25:44 -07:00
|
|
|
evas_object_size_hint_min_set(mi->icon_bg_object, ww, hh);
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->icon_bg_object, 0, 1);
|
|
|
|
E_FILL(mi->icon_bg_object);
|
2019-07-31 17:25:44 -07:00
|
|
|
elm_box_pack_end(mi->container_object, mi->icon_bg_object);
|
|
|
|
evas_object_show(mi->icon_bg_object);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
e_icon_size_get(mi->icon_object, &icon_w, &icon_h);
|
|
|
|
mi->icon_w = icon_w;
|
|
|
|
mi->icon_h = icon_h;
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->icon_object, 0, 1);
|
2019-08-22 11:50:14 -07:00
|
|
|
E_FILL(mi->icon_object);
|
2015-01-01 14:29:25 -08:00
|
|
|
evas_object_size_hint_min_set(mi->icon_object, ww, hh);
|
2019-07-31 17:25:44 -07:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
|
|
|
evas_object_show(o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o = evas_object_rectangle_add(mi->menu->evas);
|
|
|
|
mi->icon_object = o;
|
|
|
|
evas_object_color_set(o, 0, 0, 0, 0);
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mi->label)
|
|
|
|
{
|
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
mi->label_object = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/label");
|
|
|
|
/* default label */
|
|
|
|
edje_object_part_text_set(o, "e.text.label", mi->label);
|
|
|
|
edje_object_size_min_calc(mi->label_object, &ww, &hh);
|
|
|
|
mi->label_w = ww;
|
|
|
|
mi->label_h = hh;
|
2019-07-31 17:25:44 -07:00
|
|
|
evas_object_size_hint_min_set(mi->label_object, ww, hh);
|
2015-01-01 14:29:25 -08:00
|
|
|
E_EXPAND(mi->label_object);
|
|
|
|
E_FILL(mi->label_object);
|
2019-07-31 17:25:44 -07:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
|
|
|
evas_object_show(o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o = evas_object_rectangle_add(mi->menu->evas);
|
|
|
|
mi->label_object = o;
|
|
|
|
evas_object_color_set(o, 0, 0, 0, 0);
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
if ((mi->submenu) || (mi->submenu_pre_cb.func))
|
|
|
|
{
|
|
|
|
o = edje_object_add(mi->menu->evas);
|
|
|
|
mi->submenu_object = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/menus",
|
|
|
|
"e/widgets/menu/default/submenu");
|
|
|
|
edje_object_size_min_calc(mi->submenu_object, &ww, &hh);
|
|
|
|
mi->submenu_w = ww;
|
|
|
|
mi->submenu_h = hh;
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->submenu_object, 0, 1);
|
|
|
|
E_FILL(mi->submenu_object);
|
|
|
|
evas_object_size_hint_min_set(mi->submenu_object, ww, hh);
|
2019-07-31 17:25:44 -07:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
|
|
|
evas_object_show(o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
o = evas_object_rectangle_add(mi->menu->evas);
|
|
|
|
mi->submenu_object = o;
|
|
|
|
evas_object_color_set(o, 0, 0, 0, 0);
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_pack_end(mi->container_object, o);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_part_swallow(mi->bg_object, "e.swallow.content",
|
2009-03-24 14:11:03 -07:00
|
|
|
mi->container_object);
|
|
|
|
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_pack_end(mi->menu->container_object, mi->bg_object);
|
2019-07-31 17:25:44 -07:00
|
|
|
evas_object_show(mi->container_object);
|
|
|
|
evas_object_show(mi->bg_object);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
if (mi->active) e_menu_item_active_set(mi, 1);
|
|
|
|
if (mi->toggle) e_menu_item_toggle_set(mi, 1);
|
2009-03-30 06:59:56 -07:00
|
|
|
if (mi->disable) e_menu_item_disabled_set(mi, 1);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_realize(E_Menu *m)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
2012-08-06 01:16:14 -07:00
|
|
|
Eina_List *l;
|
2009-03-23 05:28:15 -07:00
|
|
|
E_Menu_Item *mi;
|
2013-01-11 02:34:29 -08:00
|
|
|
|
2012-09-19 03:05:41 -07:00
|
|
|
if (m->realized || (!m->items)) return;
|
2013-02-19 00:22:46 -08:00
|
|
|
|
2013-02-19 00:09:05 -08:00
|
|
|
if (m->parent_item && m->parent_item->menu)
|
|
|
|
m->zone = m->parent_item->menu->zone;
|
2013-06-21 02:27:18 -07:00
|
|
|
if (!m->zone) return; //menu not ready!
|
2015-10-21 07:26:18 -07:00
|
|
|
m->evas = evas_object_evas_get(e_comp->elm);
|
2005-05-26 08:30:10 -07:00
|
|
|
evas_event_freeze(m->evas);
|
2009-09-06 13:04:20 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
o = edje_object_add(m->evas);
|
|
|
|
m->bg_object = o;
|
2013-04-17 00:07:11 -07:00
|
|
|
e_theme_edje_object_set(o, "base/theme/menus", "e/widgets/menu/default/background");
|
2006-08-09 08:24:34 -07:00
|
|
|
if (m->header.title)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
edje_object_part_text_set(o, "e.text.title", m->header.title);
|
|
|
|
edje_object_signal_emit(o, "e,action,show,title", "e");
|
|
|
|
edje_object_message_signal_process(o);
|
2006-08-09 08:24:34 -07:00
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
m->comp_object = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_MENU);
|
|
|
|
if (!m->parent_item)
|
|
|
|
e_comp_object_util_autoclose(m->comp_object, _e_menu_cb_mouse_evas_down, _e_menu_cb_key_down, m);
|
|
|
|
evas_object_event_callback_add(m->comp_object, EVAS_CALLBACK_HIDE, _e_menu_hide_cb, m);
|
|
|
|
evas_object_layer_set(m->comp_object, E_LAYER_MENU);
|
2019-07-31 17:25:44 -07:00
|
|
|
evas_object_geometry_set(m->comp_object, m->cur.x, m->cur.y, m->cur.w, m->cur.h);
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
|
2015-01-20 16:20:04 -08:00
|
|
|
o = elm_box_add(e_comp->elm);
|
2004-11-24 19:37:45 -08:00
|
|
|
m->container_object = o;
|
2008-07-07 20:50:16 -07:00
|
|
|
evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_container_move, m);
|
2004-11-24 19:37:45 -08:00
|
|
|
evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_container_resize, m);
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2012-08-06 01:16:14 -07:00
|
|
|
EINA_LIST_FOREACH(m->items, l, mi)
|
|
|
|
_e_menu_item_realize(mi);
|
2006-01-06 15:45:13 -08:00
|
|
|
|
2019-07-31 17:25:44 -07:00
|
|
|
edje_object_part_swallow(m->bg_object, "e.swallow.content", m->container_object);
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_items_layout_update(m);
|
2013-02-19 00:09:05 -08:00
|
|
|
|
2019-07-31 17:25:44 -07:00
|
|
|
|
2005-05-26 08:30:10 -07:00
|
|
|
evas_event_thaw(m->evas);
|
2019-08-20 00:42:55 -07:00
|
|
|
evas_event_thaw_eval(m->evas);
|
2013-06-12 05:55:08 -07:00
|
|
|
m->realized = 1;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_items_layout_update(E_Menu *m)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2009-03-23 05:28:15 -07:00
|
|
|
E_Menu_Item *mi;
|
2012-12-30 02:53:29 -08:00
|
|
|
Evas_Coord bw, bh, mw = 0, mh = 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
int toggles_on = 0;
|
|
|
|
int icons_on = 0;
|
|
|
|
int labels_on = 0;
|
|
|
|
int submenus_on = 0;
|
|
|
|
int min_icon_w = 0, min_icon_h = 0;
|
|
|
|
int min_label_w = 0, min_label_h = 0;
|
|
|
|
int min_submenu_w = 0, min_submenu_h = 0;
|
|
|
|
int min_toggle_w = 0, min_toggle_h = 0;
|
2014-03-13 08:41:17 -07:00
|
|
|
int min_w = 0, min_h = 1;
|
2012-12-27 19:28:25 -08:00
|
|
|
int zh = 0, ms = 0, maxh = 0;
|
2012-11-28 19:02:16 -08:00
|
|
|
unsigned int cur_items = 0, max_items = -1;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(m->items, l, mi)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->icon) icons_on = 1;
|
|
|
|
if (mi->icon_object) icons_on = 1;
|
|
|
|
if (mi->label) labels_on = 1;
|
|
|
|
if (mi->submenu) submenus_on = 1;
|
2012-12-12 03:06:40 -08:00
|
|
|
if (mi->submenu_pre_cb.func) submenus_on = 1;
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->check) toggles_on = 1;
|
|
|
|
if (mi->radio) toggles_on = 1;
|
|
|
|
|
|
|
|
if (mi->icon_w > min_icon_w) min_icon_w = mi->icon_w;
|
|
|
|
if (mi->icon_h > min_icon_h) min_icon_h = mi->icon_h;
|
|
|
|
if (mi->label_w > min_label_w) min_label_w = mi->label_w;
|
|
|
|
if (mi->label_h > min_label_h) min_label_h = mi->label_h;
|
|
|
|
if (mi->submenu_w > min_submenu_w) min_submenu_w = mi->submenu_w;
|
|
|
|
if (mi->submenu_h > min_submenu_h) min_submenu_h = mi->submenu_h;
|
|
|
|
if (mi->toggle_w > min_toggle_w) min_toggle_w = mi->toggle_w;
|
|
|
|
if (mi->toggle_h > min_toggle_h) min_toggle_h = mi->toggle_h;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
if (labels_on)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (submenus_on)
|
|
|
|
{
|
|
|
|
if (min_label_h < min_submenu_h)
|
|
|
|
min_label_h = min_submenu_h;
|
|
|
|
}
|
|
|
|
if (toggles_on)
|
|
|
|
{
|
|
|
|
if (min_label_h < min_toggle_h)
|
|
|
|
min_label_h = min_toggle_h;
|
|
|
|
}
|
|
|
|
if ((icons_on) && (min_icon_h > 0))
|
|
|
|
{
|
|
|
|
min_icon_w = (min_icon_w * min_label_h) / min_icon_h;
|
|
|
|
min_icon_h = min_label_h;
|
|
|
|
}
|
|
|
|
min_w = min_label_w + min_icon_w + min_submenu_w + min_toggle_w;
|
|
|
|
min_h = min_label_h;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else if (icons_on)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (submenus_on)
|
|
|
|
{
|
|
|
|
if (min_icon_h < min_submenu_h)
|
|
|
|
min_icon_h = min_submenu_h;
|
|
|
|
}
|
|
|
|
if (toggles_on)
|
|
|
|
{
|
|
|
|
if (min_icon_h < min_toggle_h)
|
|
|
|
min_icon_h = min_toggle_h;
|
|
|
|
}
|
|
|
|
min_w = min_icon_w + min_toggle_w + min_submenu_w;
|
|
|
|
min_h = min_icon_h;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else if (toggles_on)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (submenus_on)
|
|
|
|
{
|
|
|
|
if (min_toggle_h < min_submenu_h)
|
|
|
|
min_toggle_h = min_submenu_h;
|
|
|
|
}
|
|
|
|
min_w = min_toggle_w + min_submenu_w;
|
|
|
|
min_h = min_toggle_h;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2012-12-04 01:08:19 -08:00
|
|
|
if (min_h * eina_list_count(m->items) >= (unsigned int)m->zone->h)
|
|
|
|
{
|
|
|
|
e_zone_useful_geometry_get(m->zone, NULL, NULL, NULL, &zh);
|
2012-12-30 02:53:29 -08:00
|
|
|
maxh = zh * 4;
|
2013-01-11 02:34:29 -08:00
|
|
|
if (maxh > 30000) maxh = 30000; // 32k x 32k mx coord limit for wins
|
2012-12-27 19:28:25 -08:00
|
|
|
max_items = (maxh / min_h) - 1;
|
2012-12-04 01:08:19 -08:00
|
|
|
}
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(m->items, l, mi)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-12-30 02:53:29 -08:00
|
|
|
if (cur_items >= max_items)
|
2012-11-28 19:02:16 -08:00
|
|
|
{
|
|
|
|
_e_menu_item_unrealize(mi);
|
|
|
|
continue;
|
|
|
|
}
|
2012-12-04 01:08:19 -08:00
|
|
|
cur_items++;
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->separator)
|
|
|
|
{
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->separator_object, 1, 0);
|
|
|
|
E_FILL(mi->separator_object);
|
|
|
|
evas_object_size_hint_min_set(mi->separator_object, mi->separator_w, mi->separator_h);
|
|
|
|
evas_object_size_hint_max_set(mi->separator_object, -1, mi->separator_h);
|
2012-12-04 01:08:19 -08:00
|
|
|
ms += mi->separator_h;
|
|
|
|
continue;
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->toggle_object, 0, toggles_on);
|
|
|
|
E_FILL(mi->toggle_object);
|
|
|
|
evas_object_size_hint_min_set(mi->toggle_object, min_toggle_w * toggles_on, min_toggle_h * toggles_on);
|
2012-12-04 01:08:19 -08:00
|
|
|
if (icons_on)
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->icon_bg_object ?: mi->icon_object, 0, 1);
|
|
|
|
E_FILL(mi->icon_bg_object ?: mi->icon_object);
|
|
|
|
evas_object_size_hint_min_set(mi->icon_bg_object ?: mi->icon_object, min_icon_w, min_icon_h);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2012-12-04 01:08:19 -08:00
|
|
|
else
|
2015-01-01 14:29:25 -08:00
|
|
|
{
|
|
|
|
E_WEIGHT(mi->icon_object, 0, 1);
|
|
|
|
E_FILL(mi->icon_object);
|
|
|
|
evas_object_size_hint_min_set(mi->icon_object, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
E_WEIGHT(mi->label_object, 0, 1 * labels_on);
|
|
|
|
E_FILL(mi->label_object);
|
|
|
|
evas_object_size_hint_min_set(mi->label_object, min_label_w * labels_on, min_label_h * labels_on);
|
|
|
|
|
|
|
|
E_WEIGHT(mi->submenu_object, 0, 1 * submenus_on);
|
|
|
|
E_FILL(mi->submenu_object);
|
|
|
|
evas_object_size_hint_min_set(mi->submenu_object, min_submenu_w * submenus_on, min_submenu_h * submenus_on);
|
|
|
|
|
2014-06-07 09:29:17 -07:00
|
|
|
evas_object_size_hint_min_set(mi->container_object,
|
2012-12-04 01:08:19 -08:00
|
|
|
min_w, min_h);
|
|
|
|
edje_object_size_min_calc(mi->bg_object, &mw, &mh);
|
2015-01-01 14:29:25 -08:00
|
|
|
E_WEIGHT(mi->bg_object, 0, 1);
|
|
|
|
E_FILL(mi->bg_object);
|
|
|
|
evas_object_size_hint_min_set(mi->bg_object, mw, mh);
|
2012-12-04 01:08:19 -08:00
|
|
|
ms += mh;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2015-01-01 14:29:25 -08:00
|
|
|
elm_box_recalculate(m->container_object);
|
|
|
|
evas_object_size_hint_min_get(m->container_object, &bw, &bh);
|
2014-06-07 09:29:17 -07:00
|
|
|
evas_object_size_hint_max_set(m->container_object, bw, bh);
|
2004-11-24 19:37:45 -08:00
|
|
|
edje_object_size_min_calc(m->bg_object, &mw, &mh);
|
|
|
|
m->cur.w = mw;
|
|
|
|
m->cur.h = mh;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_item_unrealize(E_Menu_Item *mi)
|
|
|
|
{
|
|
|
|
if (mi->separator_object) evas_object_del(mi->separator_object);
|
|
|
|
mi->separator_object = NULL;
|
|
|
|
if (mi->bg_object) evas_object_del(mi->bg_object);
|
|
|
|
mi->bg_object = NULL;
|
|
|
|
if (mi->container_object) evas_object_del(mi->container_object);
|
|
|
|
mi->container_object = NULL;
|
|
|
|
if (mi->toggle_object) evas_object_del(mi->toggle_object);
|
|
|
|
mi->toggle_object = NULL;
|
|
|
|
if (mi->icon_bg_object) evas_object_del(mi->icon_bg_object);
|
|
|
|
mi->icon_bg_object = NULL;
|
|
|
|
if (mi->icon_object) evas_object_del(mi->icon_object);
|
|
|
|
mi->icon_object = NULL;
|
|
|
|
if (mi->label_object) evas_object_del(mi->label_object);
|
|
|
|
mi->label_object = NULL;
|
|
|
|
if (mi->submenu_object) evas_object_del(mi->submenu_object);
|
|
|
|
mi->submenu_object = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_unrealize(E_Menu *m)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2009-03-23 05:28:15 -07:00
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
if (!m->realized) return;
|
2013-02-19 00:09:05 -08:00
|
|
|
/* freeze+thaw here breaks the universe. don't do it. */
|
|
|
|
//evas_event_freeze(m->evas);
|
2019-07-31 05:04:44 -07:00
|
|
|
if (m->comp_object)
|
|
|
|
evas_object_event_callback_del(m->comp_object, EVAS_CALLBACK_HIDE, _e_menu_hide_cb);
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
if (m->cur.visible && m->comp_object && (!stopping))
|
|
|
|
{
|
|
|
|
/* force unref in smart object */
|
|
|
|
if (m->container_object)
|
|
|
|
{
|
|
|
|
evas_object_intercept_move_callback_del(m->container_object, _e_menu_cb_intercept_container_move);
|
|
|
|
evas_object_intercept_resize_callback_del(m->container_object, _e_menu_cb_intercept_container_resize);
|
|
|
|
}
|
|
|
|
evas_object_pass_events_set(m->comp_object, 1);
|
|
|
|
evas_object_hide(m->comp_object);
|
|
|
|
E_FREE_FUNC(m->comp_object, evas_object_del);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
evas_object_hide(m->comp_object);
|
|
|
|
evas_object_del(m->comp_object);
|
|
|
|
if (stopping && m->comp_object) evas_object_unref(m->comp_object);
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(m->items, l, mi)
|
2009-10-25 11:42:47 -07:00
|
|
|
_e_menu_item_unrealize(mi);
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
E_FREE_FUNC(m->header.icon, evas_object_del);
|
|
|
|
E_FREE_FUNC(m->bg_object, evas_object_del);
|
|
|
|
E_FREE_FUNC(m->container_object, evas_object_del);
|
2004-11-24 19:37:45 -08:00
|
|
|
m->cur.visible = 0;
|
|
|
|
m->prev.visible = 0;
|
|
|
|
m->realized = 0;
|
2005-01-11 05:43:01 -08:00
|
|
|
m->zone = NULL;
|
2013-02-19 00:09:05 -08:00
|
|
|
//evas_event_thaw(m->evas);
|
2004-11-24 19:37:45 -08:00
|
|
|
m->evas = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-01-11 05:43:01 -08:00
|
|
|
_e_menu_activate_internal(E_Menu *m, E_Zone *zone)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2008-12-29 04:40:49 -08:00
|
|
|
E_Menu_Category *cat = NULL;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2006-01-06 15:45:13 -08:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
if (m->pre_activate_cb.func)
|
|
|
|
m->pre_activate_cb.func(m->pre_activate_cb.data, m);
|
|
|
|
m->fast_mouse = 0;
|
|
|
|
m->pending_new_submenu = 0;
|
2017-02-24 11:15:42 -08:00
|
|
|
if (_e_menu_win != e_comp->ee_win)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2015-03-13 14:44:24 -07:00
|
|
|
_e_menu_win = e_comp->ee_win;
|
2015-03-13 13:48:29 -07:00
|
|
|
if (!e_comp_grab_input(1, 1))
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2017-02-24 11:15:42 -08:00
|
|
|
_e_menu_win = UINT_MAX;
|
2012-06-21 00:11:47 -07:00
|
|
|
return;
|
|
|
|
}
|
2019-07-31 05:04:44 -07:00
|
|
|
_e_menu_grabbed = EINA_TRUE;
|
2016-01-22 09:55:32 -08:00
|
|
|
e_bindings_disabled_set(1);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2006-10-07 23:12:25 -07:00
|
|
|
m->zone = zone;
|
2004-11-24 19:37:45 -08:00
|
|
|
if (!m->active)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
/* this remove is in case the menu is marked as inactive but hasn't */
|
|
|
|
/* been removed from the list yet */
|
|
|
|
if (m->in_active_list)
|
2013-02-19 00:09:05 -08:00
|
|
|
_e_active_menus = eina_list_remove(_e_active_menus, m);
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_active_menus = eina_list_append(_e_active_menus, m);
|
2013-02-19 00:09:05 -08:00
|
|
|
if (!m->in_active_list)
|
|
|
|
e_object_ref(E_OBJECT(m));
|
2012-06-21 00:11:47 -07:00
|
|
|
m->in_active_list = 1;
|
|
|
|
m->active = 1;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2006-01-06 15:45:13 -08:00
|
|
|
/* the foreign menu items */
|
2008-12-29 04:40:49 -08:00
|
|
|
if (m->category)
|
2006-06-20 06:10:08 -07:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
cat = eina_hash_find(_e_menu_categories, m->category);
|
|
|
|
if (cat)
|
|
|
|
{
|
|
|
|
E_Menu_Category_Callback *cb;
|
|
|
|
EINA_LIST_FOREACH(cat->callbacks, l, cb)
|
2013-01-10 02:36:41 -08:00
|
|
|
if (cb->create) cb->create(cb->data, m, cat->data);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
2006-06-20 06:10:08 -07:00
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
m->cur.visible = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_deactivate_all(void)
|
|
|
|
{
|
2009-03-23 05:28:15 -07:00
|
|
|
Eina_List *tmp;
|
|
|
|
E_Menu *m;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2009-03-23 05:28:15 -07:00
|
|
|
tmp = _e_active_menus_copy_ref();
|
|
|
|
|
|
|
|
EINA_LIST_FREE(tmp, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_deactivate(m);
|
|
|
|
m->parent_item = NULL;
|
|
|
|
e_object_unref(E_OBJECT(m));
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2006-08-22 01:38:24 -07:00
|
|
|
_e_menu_activate_floating = 0;
|
|
|
|
_e_menu_activate_maybe_drag = 0;
|
|
|
|
_e_menu_activate_dragging = 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_deactivate_above(E_Menu *ma)
|
|
|
|
{
|
2009-03-23 05:28:15 -07:00
|
|
|
Eina_List *tmp;
|
2004-11-24 19:37:45 -08:00
|
|
|
int above = 0;
|
2009-03-23 05:28:15 -07:00
|
|
|
E_Menu *m;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2009-03-23 05:28:15 -07:00
|
|
|
tmp = _e_active_menus_copy_ref();
|
|
|
|
|
|
|
|
EINA_LIST_FREE(tmp, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (above)
|
|
|
|
{
|
|
|
|
e_menu_deactivate(m);
|
|
|
|
m->parent_item = NULL;
|
|
|
|
}
|
|
|
|
if (ma == m) above = 1;
|
|
|
|
e_object_unref(E_OBJECT(m));
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_submenu_activate(E_Menu_Item *mi)
|
|
|
|
{
|
|
|
|
if (!mi->menu->active) return;
|
2017-08-18 12:52:52 -07:00
|
|
|
if (mi->submenu && mi->submenu->active) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
if (mi->menu->fast_mouse)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
mi->menu->pending_new_submenu = 1;
|
|
|
|
return;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
mi->menu->pending_new_submenu = 0;
|
|
|
|
_e_menu_deactivate_above(mi->menu);
|
2005-04-21 00:19:49 -07:00
|
|
|
if (mi->submenu_pre_cb.func)
|
|
|
|
mi->submenu_pre_cb.func(mi->submenu_pre_cb.data, mi->menu, mi);
|
2004-11-24 19:37:45 -08:00
|
|
|
if (mi->submenu)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
E_Menu *m;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2012-06-21 00:11:47 -07:00
|
|
|
m = mi->submenu;
|
|
|
|
e_object_ref(E_OBJECT(m));
|
|
|
|
m->parent_item = mi;
|
|
|
|
_e_menu_activate_internal(m, mi->menu->zone);
|
|
|
|
_e_menu_reposition(m);
|
|
|
|
e_object_unref(E_OBJECT(m));
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
mi->menu->have_submenu = 1;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2005-04-21 00:45:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_submenu_deactivate(E_Menu_Item *mi)
|
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
if (!mi->menu->active) return;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
mi->menu->have_submenu = 0;
|
2005-04-21 00:19:49 -07:00
|
|
|
if (mi->submenu_post_cb.func)
|
|
|
|
mi->submenu_post_cb.func(mi->submenu_post_cb.data, mi->menu, mi);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_reposition(E_Menu *m)
|
|
|
|
{
|
2009-03-23 05:28:15 -07:00
|
|
|
Eina_List *l, *tmp;
|
|
|
|
E_Menu_Item *mi;
|
2006-09-07 03:33:57 -07:00
|
|
|
int parent_item_bottom;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
if (!m->parent_item) return;
|
|
|
|
m->cur.x = m->parent_item->menu->cur.x + m->parent_item->menu->cur.w;
|
2006-09-07 03:33:57 -07:00
|
|
|
|
2013-02-19 00:09:05 -08:00
|
|
|
parent_item_bottom = m->parent_item->y;
|
2006-09-09 00:00:14 -07:00
|
|
|
if (m->cur.h > m->zone->h)
|
2006-09-07 03:33:57 -07:00
|
|
|
{
|
2013-03-29 05:57:55 -07:00
|
|
|
#if 0 // we can't win - we just flip back and forth, so let it go off and use scrolling
|
2012-06-21 00:11:47 -07:00
|
|
|
/* menu is larger than screen */
|
2015-02-24 22:55:08 -08:00
|
|
|
if (parent_item_bottom > (m->zone->y + (m->zone->h / 2)))
|
2012-06-21 00:11:47 -07:00
|
|
|
/* more is shown if menu goes up */
|
2015-02-24 22:55:08 -08:00
|
|
|
m->cur.y = (parent_item_bottom - (m->zone->h + 1));
|
2012-06-21 00:11:47 -07:00
|
|
|
else
|
|
|
|
/* more is shown if menu goes down */
|
2015-02-24 22:55:08 -08:00
|
|
|
m->cur.y = parent_item_bottom - m->zone->y;
|
2013-03-29 05:57:55 -07:00
|
|
|
#endif
|
2006-09-07 03:33:57 -07:00
|
|
|
}
|
|
|
|
else
|
2012-06-20 23:19:43 -07:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
/* menu is smaller than screen */
|
2015-02-24 22:55:08 -08:00
|
|
|
if (((parent_item_bottom + m->cur.h) > (m->zone->y + m->zone->h)) &&
|
|
|
|
(parent_item_bottom > (m->zone->y + (m->zone->h / 2))))
|
2012-06-21 00:11:47 -07:00
|
|
|
/* menu is partially out of screen and more is shown if menu goes up */
|
2013-02-19 00:09:05 -08:00
|
|
|
m->cur.y = parent_item_bottom - m->cur.h + m->parent_item->h;
|
2012-06-21 00:11:47 -07:00
|
|
|
else
|
2013-02-19 00:09:05 -08:00
|
|
|
m->cur.y = parent_item_bottom;
|
2006-09-07 03:33:57 -07:00
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
/* FIXME: this will suck for big menus */
|
2009-03-23 05:28:15 -07:00
|
|
|
tmp = _e_active_menus_copy_ref();
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(m->items, l, mi)
|
2009-10-25 11:42:47 -07:00
|
|
|
if ((mi->active) && (mi->submenu)) _e_menu_reposition(mi->submenu);
|
2009-03-23 05:28:15 -07:00
|
|
|
|
|
|
|
_e_menu_list_free_unref(tmp);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_menu_active_call(void)
|
|
|
|
{
|
2006-08-09 06:52:52 -07:00
|
|
|
E_Menu_Item *mi;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2006-08-09 06:52:52 -07:00
|
|
|
mi = _e_menu_item_active_get();
|
|
|
|
if (mi)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->check)
|
|
|
|
e_menu_item_toggle_set(mi, !mi->toggle);
|
|
|
|
if ((mi->radio) && (!e_menu_item_toggle_get(mi)))
|
|
|
|
e_menu_item_toggle_set(mi, 1);
|
|
|
|
if (mi->cb.func)
|
|
|
|
mi->cb.func(mi->cb.data, mi->menu, mi);
|
|
|
|
return 1;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2006-08-21 13:03:09 -07:00
|
|
|
static int
|
|
|
|
_e_menu_realize_call(E_Menu_Item *mi)
|
|
|
|
{
|
|
|
|
if (mi)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->realize_cb.func)
|
|
|
|
{
|
|
|
|
mi->realize_cb.func(mi->realize_cb.data, mi->menu, mi);
|
|
|
|
return 1;
|
|
|
|
}
|
2006-08-21 13:03:09 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
static void
|
|
|
|
_e_menu_item_activate_next(void)
|
|
|
|
{
|
2006-10-08 01:25:08 -07:00
|
|
|
E_Menu_Item *mi;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2006-10-08 01:25:08 -07:00
|
|
|
ll = _e_menu_list_item_active_get();
|
|
|
|
mi = _e_menu_item_active_get();
|
2012-06-20 23:19:43 -07:00
|
|
|
if (ll && mi)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
/* Look at the next item and then cycle until we're not on
|
|
|
|
* a separator. */
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!eina_list_next(ll))
|
|
|
|
ll = mi->menu->items;
|
|
|
|
else
|
|
|
|
ll = eina_list_next(ll);
|
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
}
|
|
|
|
while (mi->separator || mi->disable);
|
2006-10-08 01:25:08 -07:00
|
|
|
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
return;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2006-10-08 01:25:08 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_activate_first();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_item_activate_previous(void)
|
|
|
|
{
|
2006-10-08 01:25:08 -07:00
|
|
|
E_Menu_Item *mi;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2006-10-08 01:25:08 -07:00
|
|
|
ll = _e_menu_list_item_active_get();
|
|
|
|
mi = _e_menu_item_active_get();
|
2012-06-20 23:19:43 -07:00
|
|
|
if (ll && mi)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
/* Look at the prev item and then cycle until we're not on
|
|
|
|
* a separator. */
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!eina_list_prev(ll))
|
|
|
|
ll = eina_list_last(ll);
|
|
|
|
else
|
|
|
|
ll = eina_list_prev(ll);
|
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
}
|
|
|
|
while ((mi->separator) || (mi->disable));
|
2006-10-08 01:25:08 -07:00
|
|
|
|
2012-06-21 00:11:47 -07:00
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
return;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2006-10-08 01:25:08 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_activate_first();
|
|
|
|
}
|
|
|
|
|
2006-02-02 22:16:25 -08:00
|
|
|
static void
|
|
|
|
_e_menu_item_activate_first(void)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll;
|
2006-02-02 22:16:25 -08:00
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
|
|
|
m = _e_menu_active_get();
|
|
|
|
if (m)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
ll = m->items;
|
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
while ((mi->separator) && eina_list_next(ll))
|
|
|
|
{
|
|
|
|
ll = eina_list_next(ll);
|
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
}
|
|
|
|
if (mi->separator) return;
|
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
return;
|
2006-02-02 22:16:25 -08:00
|
|
|
}
|
|
|
|
_e_menu_activate_first();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_item_activate_last(void)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll;
|
2006-02-02 22:16:25 -08:00
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
|
|
|
m = _e_menu_active_get();
|
|
|
|
if (m)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
ll = eina_list_last(m->items);
|
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
while ((mi->separator) && eina_list_prev(ll))
|
|
|
|
{
|
|
|
|
ll = eina_list_prev(ll);
|
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
}
|
|
|
|
if (mi->separator) return;
|
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
return;
|
2006-02-02 22:16:25 -08:00
|
|
|
}
|
|
|
|
_e_menu_activate_first();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_item_activate_nth(int n)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
|
|
|
E_Menu_Item *mi;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll;
|
2009-03-24 14:11:03 -07:00
|
|
|
int i = -1;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2006-02-02 22:16:25 -08:00
|
|
|
mi = _e_menu_item_active_get();
|
|
|
|
if (!mi)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_activate_first();
|
|
|
|
mi = _e_menu_item_active_get();
|
|
|
|
if (!mi) return;
|
2006-02-02 22:16:25 -08:00
|
|
|
}
|
|
|
|
m = mi->menu;
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(m->items, ll, mi)
|
2006-02-02 22:16:25 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (!mi->separator) i++;
|
|
|
|
if (i == n) break;
|
2006-02-02 22:16:25 -08:00
|
|
|
}
|
2015-01-08 21:51:40 -08:00
|
|
|
if (!mi) return;
|
2006-02-02 22:16:25 -08:00
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
}
|
|
|
|
|
2006-10-08 01:25:08 -07:00
|
|
|
static void
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_item_activate_char(const char *key_compose)
|
2006-10-08 01:25:08 -07:00
|
|
|
{
|
|
|
|
E_Menu *m;
|
|
|
|
E_Menu_Item *mi;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll, *ll_orig;
|
2006-10-08 01:25:08 -07:00
|
|
|
|
|
|
|
/* Ignore modifiers and such. */
|
|
|
|
if (!key_compose) return;
|
|
|
|
|
|
|
|
/* Check we've got a menu and it's active. */
|
|
|
|
m = _e_menu_active_get();
|
2012-06-20 23:19:43 -07:00
|
|
|
if (!m)
|
2006-10-08 01:25:08 -07:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (!_e_active_menus) return;
|
|
|
|
m = eina_list_data_get(_e_active_menus);
|
|
|
|
if (!m) return;
|
2006-10-08 01:25:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ll = _e_menu_list_item_active_get();
|
|
|
|
/* If we don't have an active item, start from the top of the list. */
|
|
|
|
if (!ll)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
ll = m->items;
|
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
/* Only check the current item if it wasn't active before. */
|
|
|
|
if (!mi->separator && mi->label && !strncasecmp(key_compose, mi->label, strlen(key_compose)))
|
|
|
|
{
|
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
return;
|
|
|
|
}
|
2006-10-08 01:25:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ll_orig = ll;
|
|
|
|
|
2009-08-21 08:08:49 -07:00
|
|
|
mi = eina_list_data_get(ll);
|
2012-06-20 23:19:43 -07:00
|
|
|
if (!eina_list_next(ll))
|
2006-10-08 01:25:08 -07:00
|
|
|
ll = mi->menu->items;
|
|
|
|
else
|
2009-08-21 08:08:49 -07:00
|
|
|
ll = eina_list_next(ll);
|
|
|
|
mi = eina_list_data_get(ll);
|
2006-10-08 01:25:08 -07:00
|
|
|
|
|
|
|
/* While we don't have a label OR we don't match AND we haven't
|
|
|
|
* wrapped around */
|
2012-06-20 23:19:43 -07:00
|
|
|
while ((!mi->label || strncasecmp(key_compose, mi->label, strlen(key_compose)))
|
2009-10-25 11:42:47 -07:00
|
|
|
&& ll != ll_orig)
|
2006-10-08 01:25:08 -07:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!eina_list_next(ll))
|
|
|
|
ll = mi->menu->items;
|
|
|
|
else
|
|
|
|
ll = eina_list_next(ll);
|
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
}
|
|
|
|
while (mi->separator);
|
2006-10-08 01:25:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
static void
|
|
|
|
_e_menu_activate_next(void)
|
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
|
|
|
mi = _e_menu_item_active_get();
|
|
|
|
if (mi)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->submenu)
|
|
|
|
{
|
|
|
|
if (mi->submenu->items)
|
|
|
|
{
|
2012-06-21 05:09:08 -07:00
|
|
|
Eina_List *l;
|
|
|
|
EINA_LIST_FOREACH(mi->submenu->items, l, mi)
|
|
|
|
if (!mi->disable)
|
|
|
|
{
|
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
break;
|
|
|
|
}
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
_e_menu_activate_first();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_activate_previous(void)
|
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
|
|
|
mi = _e_menu_item_active_get();
|
|
|
|
if (mi)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (mi->menu->parent_item)
|
|
|
|
{
|
|
|
|
mi = mi->menu->parent_item;
|
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
}
|
|
|
|
return;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2005-05-18 03:18:02 -07:00
|
|
|
_e_menu_activate_last();
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_activate_first(void)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
|
|
|
E_Menu_Item *mi;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
if (!_e_active_menus) return;
|
2009-08-21 08:08:49 -07:00
|
|
|
m = eina_list_data_get(_e_active_menus);
|
2004-11-24 19:37:45 -08:00
|
|
|
if (!m->items) return;
|
|
|
|
ll = m->items;
|
2009-08-21 08:08:49 -07:00
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
while ((mi->separator) && eina_list_next(ll))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
ll = eina_list_next(ll);
|
|
|
|
mi = eina_list_data_get(ll);
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
if (mi->separator) return;
|
2012-06-20 23:19:43 -07:00
|
|
|
e_menu_item_active_set(mi, 1);
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
}
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
static void
|
|
|
|
_e_menu_activate_last(void)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
|
|
|
E_Menu_Item *mi;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
if (!_e_active_menus) return;
|
2009-08-21 08:08:49 -07:00
|
|
|
m = eina_list_data_get(_e_active_menus);
|
2005-05-18 03:18:02 -07:00
|
|
|
if (!m->items) return;
|
2008-10-22 04:49:33 -07:00
|
|
|
ll = eina_list_last(m->items);
|
2009-08-21 08:08:49 -07:00
|
|
|
mi = eina_list_data_get(ll);
|
|
|
|
while ((mi->separator) && eina_list_prev(ll))
|
2005-05-18 03:18:02 -07:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
ll = eina_list_prev(ll);
|
|
|
|
mi = eina_list_data_get(ll);
|
2005-05-18 03:18:02 -07:00
|
|
|
}
|
|
|
|
if (mi->separator) return;
|
2012-06-20 23:19:43 -07:00
|
|
|
e_menu_item_active_set(mi, 1);
|
2005-05-18 03:18:02 -07:00
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
}
|
|
|
|
|
2006-12-28 06:15:10 -08:00
|
|
|
#if 0
|
2004-11-24 19:37:45 -08:00
|
|
|
static void
|
|
|
|
_e_menu_activate_nth(int n)
|
|
|
|
{
|
|
|
|
E_Menu *m;
|
|
|
|
E_Menu_Item *mi;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *ll;
|
2009-03-24 14:11:03 -07:00
|
|
|
int i = -1;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
mi = _e_menu_item_active_get();
|
|
|
|
if (!mi)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_activate_first();
|
|
|
|
mi = _e_menu_item_active_get();
|
|
|
|
if (!mi) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
m = mi->menu;
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(m->items, ll, mi)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (!mi->separator) i++;
|
|
|
|
if (i == n)
|
|
|
|
{
|
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
_e_menu_item_ensure_onscreen(mi);
|
|
|
|
return;
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
}
|
2012-06-21 00:11:47 -07:00
|
|
|
|
2006-12-28 06:15:10 -08:00
|
|
|
#endif
|
2004-11-24 19:37:45 -08:00
|
|
|
|
|
|
|
static E_Menu *
|
|
|
|
_e_menu_active_get(void)
|
|
|
|
{
|
2006-08-09 06:56:23 -07:00
|
|
|
if (_e_active_menu_item) return _e_active_menu_item->menu;
|
|
|
|
return NULL;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static E_Menu_Item *
|
|
|
|
_e_menu_item_active_get(void)
|
|
|
|
{
|
2006-08-09 06:52:52 -07:00
|
|
|
return _e_active_menu_item;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static Eina_List *
|
2006-10-08 01:25:08 -07:00
|
|
|
_e_menu_list_item_active_get(void)
|
|
|
|
{
|
|
|
|
if (_e_active_menu_item)
|
2009-03-24 14:11:03 -07:00
|
|
|
return _e_active_menu_item->list_position;
|
2006-10-08 01:25:08 -07:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
static int
|
|
|
|
_e_menu_outside_bounds_get(int xdir, int ydir)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2009-03-23 05:28:15 -07:00
|
|
|
E_Menu *m;
|
2004-11-24 19:37:45 -08:00
|
|
|
int outl = 0;
|
|
|
|
int outr = 0;
|
|
|
|
int outt = 0;
|
|
|
|
int outb = 0;
|
2009-03-24 14:11:03 -07:00
|
|
|
int i = 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
2009-03-23 05:28:15 -07:00
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (m->cur.x < m->zone->x + e_config->menu_autoscroll_margin)
|
|
|
|
{
|
|
|
|
i = m->zone->x - m->cur.x + e_config->menu_autoscroll_margin;
|
|
|
|
if (i > outl) outl = i;
|
|
|
|
}
|
|
|
|
if (m->cur.y < m->zone->y + e_config->menu_autoscroll_margin)
|
|
|
|
{
|
|
|
|
i = m->zone->y - m->cur.y + e_config->menu_autoscroll_margin;
|
|
|
|
if (i > outt) outt = i;
|
|
|
|
}
|
|
|
|
if ((m->cur.x + m->cur.w) > (m->zone->w - e_config->menu_autoscroll_margin))
|
|
|
|
{
|
|
|
|
i = m->cur.x + m->cur.w - (m->zone->x + m->zone->w - e_config->menu_autoscroll_margin);
|
|
|
|
if (i > outr) outr = i;
|
|
|
|
}
|
|
|
|
if ((m->cur.y + m->cur.h) > (m->zone->h - e_config->menu_autoscroll_margin))
|
|
|
|
{
|
|
|
|
i = m->cur.y + m->cur.h - (m->zone->y + m->zone->h - e_config->menu_autoscroll_margin);
|
|
|
|
if (i > outb) outb = i;
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
if (xdir == -1)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (outl) return outl;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else if (xdir == 1)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (outr) return outr;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else if (ydir == -1)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (outt) return outt;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else if (ydir == 1)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (outb) return outb;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_scroll_by(int dx, int dy)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2009-03-23 05:28:15 -07:00
|
|
|
E_Menu *m;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
m->cur.x += dx;
|
|
|
|
m->cur.y += dy;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_mouse_autoscroll_check(void)
|
|
|
|
{
|
|
|
|
int autoscroll_x = 0;
|
|
|
|
int autoscroll_y = 0;
|
2015-02-24 22:31:00 -08:00
|
|
|
E_Menu *m = NULL;
|
|
|
|
int mx, my;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2015-02-24 22:31:00 -08:00
|
|
|
mx = _e_menu_x;
|
|
|
|
my = _e_menu_y;
|
|
|
|
if (_e_active_menus)
|
|
|
|
{
|
|
|
|
m = eina_list_data_get(_e_active_menus);
|
|
|
|
if (m)
|
|
|
|
{
|
|
|
|
mx -= m->zone->x;
|
|
|
|
my -= m->zone->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mx - e_config->menu_autoscroll_cursor_margin <= 0)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (_e_menu_outside_bounds_get(-1, 0)) autoscroll_x = -1;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2015-02-24 22:31:00 -08:00
|
|
|
if (my - e_config->menu_autoscroll_cursor_margin <= 0)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (_e_menu_outside_bounds_get(0, -1)) autoscroll_y = -1;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
if ((!autoscroll_x) && (!autoscroll_y))
|
|
|
|
{
|
2015-02-24 22:31:00 -08:00
|
|
|
if (m)
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2015-02-24 22:31:00 -08:00
|
|
|
if (mx + e_config->menu_autoscroll_cursor_margin >= (m->zone->w - 1))
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
|
|
|
if (_e_menu_outside_bounds_get(1, 0)) autoscroll_x = 1;
|
|
|
|
}
|
2015-02-24 22:31:00 -08:00
|
|
|
if (my + e_config->menu_autoscroll_cursor_margin >= (m->zone->h - 1))
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
|
|
|
if (_e_menu_outside_bounds_get(0, 1)) autoscroll_y = 1;
|
|
|
|
}
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
_e_menu_autoscroll_x = autoscroll_x;
|
|
|
|
_e_menu_autoscroll_y = autoscroll_y;
|
|
|
|
if ((!autoscroll_x) && (!autoscroll_y)) return;
|
2008-01-10 23:33:57 -08:00
|
|
|
if (_e_menu_scroll_animator) return;
|
|
|
|
_e_menu_scroll_animator = ecore_animator_add(_e_menu_cb_scroll_animator,
|
2012-06-21 00:11:47 -07:00
|
|
|
NULL);
|
2008-11-01 19:36:10 -07:00
|
|
|
_e_menu_scroll_start = ecore_loop_time_get();
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_menu_item_ensure_onscreen(E_Menu_Item *mi)
|
|
|
|
{
|
2009-03-24 14:11:03 -07:00
|
|
|
int x = 0, y = 0, w = 0, h = 0;
|
|
|
|
int dx = 0, dy = 0;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2005-12-27 09:16:58 -08:00
|
|
|
if (!mi->menu) return;
|
|
|
|
if (!mi->menu->zone) return;
|
2017-08-18 12:52:52 -07:00
|
|
|
evas_object_geometry_get(mi->container_object, &x, &y, &w, &h);
|
2005-01-11 05:43:01 -08:00
|
|
|
if ((x + w) > (mi->menu->zone->x + mi->menu->zone->w))
|
|
|
|
dx = (mi->menu->zone->x + mi->menu->zone->w) - (x + w);
|
2005-12-27 09:16:58 -08:00
|
|
|
else if (x < mi->menu->zone->x)
|
|
|
|
dx = mi->menu->zone->x - x;
|
2005-01-11 05:43:01 -08:00
|
|
|
if ((y + h) > (mi->menu->zone->y + mi->menu->zone->h))
|
|
|
|
dy = (mi->menu->zone->y + mi->menu->zone->h) - (y + h);
|
2005-12-27 09:16:58 -08:00
|
|
|
else if (y < mi->menu->zone->y)
|
|
|
|
dy = mi->menu->zone->y - y;
|
2004-11-24 19:37:45 -08:00
|
|
|
if ((dx != 0) || (dy != 0))
|
|
|
|
_e_menu_scroll_by(dx, dy);
|
|
|
|
}
|
|
|
|
|
2017-08-18 12:52:52 -07:00
|
|
|
static void
|
|
|
|
_e_menu_auto_place_vert(E_Menu *m, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
int zx, zy, zw, zh;
|
|
|
|
|
|
|
|
e_zone_useful_geometry_get(m->zone, &zx, &zy, &zw, &zh);
|
|
|
|
if (E_CONTAINS(zx, zy, zw, zh, m->cur.x, y, m->cur.w, m->cur.h))
|
|
|
|
{
|
|
|
|
if (w + h > 2)
|
|
|
|
{
|
|
|
|
if (E_INTERSECTS(m->cur.x, y, m->cur.w, m->cur.h, x, y, w, h))
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
|
|
|
else
|
|
|
|
m->cur.y = y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m->cur.y = y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m->cur.y = y + h - m->cur.h;
|
|
|
|
}
|
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
static int
|
|
|
|
_e_menu_auto_place(E_Menu *m, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
double xr, yr;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
_e_menu_realize(m);
|
|
|
|
/* +-----+
|
|
|
|
* |\ T /|
|
|
|
|
* | \ / |
|
|
|
|
* |L X R|
|
|
|
|
* | / \ |
|
|
|
|
* |/ B \|
|
|
|
|
* +-----+
|
2012-06-20 23:19:43 -07:00
|
|
|
*
|
2005-05-18 03:18:02 -07:00
|
|
|
* quadrants... which one
|
|
|
|
*/
|
2005-05-19 23:30:26 -07:00
|
|
|
if (w != m->zone->w)
|
|
|
|
xr = (double)(x - m->zone->x) /
|
2012-06-21 00:11:47 -07:00
|
|
|
(double)(m->zone->w - w);
|
2005-05-18 03:18:02 -07:00
|
|
|
else
|
|
|
|
xr = 0.0;
|
2005-05-19 23:30:26 -07:00
|
|
|
if (h != m->zone->h)
|
|
|
|
yr = (double)(y - m->zone->y) /
|
2012-06-21 00:11:47 -07:00
|
|
|
(double)(m->zone->h - h);
|
2005-05-18 03:18:02 -07:00
|
|
|
else
|
|
|
|
yr = 0.0;
|
2017-08-18 12:52:52 -07:00
|
|
|
|
2005-05-18 03:18:02 -07:00
|
|
|
if ((xr + yr) < 0.99) /* top or left */
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (((1.0 - yr) + xr) <= 1.0)
|
|
|
|
{
|
|
|
|
/* L */
|
|
|
|
m->cur.x = x + w;
|
2017-08-18 12:52:52 -07:00
|
|
|
_e_menu_auto_place_vert(m, x, y, w, h);
|
2012-06-21 00:11:47 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-11 02:34:29 -08:00
|
|
|
/* T */
|
2012-06-21 00:11:47 -07:00
|
|
|
m->cur.y = y + h;
|
|
|
|
if (x < (m->zone->x + ((m->zone->w * 1) / 3)))
|
|
|
|
m->cur.x = x;
|
|
|
|
else if (x < (m->zone->x + ((m->zone->w * 2) / 3)))
|
|
|
|
m->cur.x = x + ((w - m->cur.w) / 2);
|
|
|
|
else
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
return 3;
|
|
|
|
}
|
2005-05-18 03:18:02 -07:00
|
|
|
}
|
|
|
|
else /* bottom or right */
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
if (((1.0 - yr) + xr) <= 1.01)
|
|
|
|
{
|
|
|
|
/* B */
|
|
|
|
m->cur.y = y - m->cur.h;
|
|
|
|
if (x < (m->zone->x + ((m->zone->w * 1) / 3)))
|
|
|
|
m->cur.x = x;
|
|
|
|
else if (x < (m->zone->x + ((m->zone->w * 2) / 3)))
|
|
|
|
m->cur.x = x + ((w - m->cur.w) / 2);
|
|
|
|
else
|
|
|
|
m->cur.x = x + w - m->cur.w;
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-11 02:34:29 -08:00
|
|
|
/* R */
|
2012-06-21 00:11:47 -07:00
|
|
|
m->cur.x = x - m->cur.w;
|
2017-08-18 12:52:52 -07:00
|
|
|
_e_menu_auto_place_vert(m, x, y, w, h);
|
2012-06-21 00:11:47 -07:00
|
|
|
return 2;
|
|
|
|
}
|
2005-05-18 03:18:02 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_menu_cb_item_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2013-06-12 05:55:08 -07:00
|
|
|
E_Menu_Item *mi = data;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2012-09-11 04:55:08 -07:00
|
|
|
if (_e_menu_lock) return;
|
2013-06-12 05:55:08 -07:00
|
|
|
/* this can be triggered when creating menus if the new menu is on top of its parent */
|
|
|
|
if (!mi->menu->realized) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_active_set(mi, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_menu_cb_item_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2013-06-12 05:35:25 -07:00
|
|
|
E_Menu_Item *mi = data;
|
2013-06-12 05:55:08 -07:00
|
|
|
/* this can be triggered when creating menus if the new menu is on top of its parent */
|
|
|
|
if (!mi->menu->realized) return;
|
2004-11-24 19:37:45 -08:00
|
|
|
e_menu_item_active_set(mi, 0);
|
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
_e_menu_cb_key_down(void *data EINA_UNUSED, Ecore_Event_Key *ev)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2009-10-25 11:42:47 -07:00
|
|
|
if ((!strcmp(ev->key, "Up")) || (!strcmp(ev->key, "KP_Up")))
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_item_activate_previous();
|
2009-10-25 11:42:47 -07:00
|
|
|
else if ((!strcmp(ev->key, "Down")) || (!strcmp(ev->key, "KP_Down")))
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_item_activate_next();
|
2009-10-25 11:42:47 -07:00
|
|
|
else if ((!strcmp(ev->key, "Left")) || (!strcmp(ev->key, "KP_Left")))
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_activate_previous();
|
2009-10-25 11:42:47 -07:00
|
|
|
else if ((!strcmp(ev->key, "Right")) || (!strcmp(ev->key, "KP_Right")))
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_activate_next();
|
2009-10-25 11:42:47 -07:00
|
|
|
else if ((!strcmp(ev->key, "Home")) || (!strcmp(ev->key, "KP_Home")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_first();
|
2009-10-25 11:42:47 -07:00
|
|
|
else if ((!strcmp(ev->key, "End")) || (!strcmp(ev->key, "KP_End")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_last();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "space"))
|
2009-10-25 11:42:47 -07:00
|
|
|
_e_menu_active_call();
|
|
|
|
else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_active_call();
|
|
|
|
_e_menu_deactivate_all();
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "Escape"))
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_deactivate_all();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "1")) || (!strcmp(ev->key, "KP_1")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_first();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "2")) || (!strcmp(ev->key, "KP_2")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_nth(1);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "3")) || (!strcmp(ev->key, "KP_3")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_nth(2);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "4")) || (!strcmp(ev->key, "KP_4")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_nth(3);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "5")) || (!strcmp(ev->key, "KP_5")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_nth(4);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "6")) || (!strcmp(ev->key, "KP_6")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_nth(5);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "7")) || (!strcmp(ev->key, "KP_7")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_nth(6);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "8")) || (!strcmp(ev->key, "KP_8")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_nth(7);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "9")) || (!strcmp(ev->key, "KP_9")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_nth(8);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if ((!strcmp(ev->key, "0")) || (!strcmp(ev->key, "KP_0")))
|
2006-02-02 22:16:25 -08:00
|
|
|
_e_menu_item_activate_last();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (ev->compose)
|
|
|
|
_e_menu_item_activate_char(ev->compose);
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* we need all of these because menus are special and grab the mouse and
|
2010-09-08 16:59:07 -07:00
|
|
|
* keyboard and thus the normal event mechanism doesn't work, so we feed
|
2004-11-24 19:37:45 -08:00
|
|
|
* events directly to the canvases from our grab window
|
|
|
|
*/
|
|
|
|
|
2013-03-20 02:50:47 -07:00
|
|
|
static void
|
2016-01-14 12:05:33 -08:00
|
|
|
_e_menu_cb_mouse_evas_down(void *data, Evas_Object *obj EINA_UNUSED)
|
2013-03-20 02:50:47 -07:00
|
|
|
{
|
2016-01-14 12:05:33 -08:00
|
|
|
E_Menu *m = data;
|
|
|
|
|
|
|
|
while (m->parent_item)
|
|
|
|
m = m->parent_item->menu;
|
|
|
|
e_menu_deactivate(m);
|
2013-03-20 02:50:47 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_menu_cb_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Button *ev;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
ev = event;
|
2013-02-19 00:09:05 -08:00
|
|
|
if (ev->window != _e_menu_win)
|
|
|
|
{
|
2014-01-17 08:21:20 -08:00
|
|
|
if (_e_menu_active_get())
|
|
|
|
_e_menu_deactivate_all();
|
2013-02-19 00:09:05 -08:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
2006-08-22 01:38:24 -07:00
|
|
|
|
2015-08-19 11:49:34 -07:00
|
|
|
_e_menu_lock = 1;
|
|
|
|
e_comp_canvas_feed_mouse_up(0);
|
|
|
|
_e_menu_lock = 0;
|
|
|
|
|
2006-08-22 01:38:24 -07:00
|
|
|
/* Only allow dragging from floating menus for now.
|
2012-06-20 23:19:43 -07:00
|
|
|
* The reason for this is that for non floating menus,
|
2006-08-22 01:38:24 -07:00
|
|
|
* the mouse is already down and dragging, so the decision
|
|
|
|
* to start a drag is much more complex.
|
|
|
|
*/
|
|
|
|
if (_e_menu_activate_floating)
|
2007-01-03 08:53:48 -08:00
|
|
|
_e_menu_activate_maybe_drag = 1;
|
2006-08-22 01:38:24 -07:00
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_menu_cb_mouse_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Button *ev;
|
2018-10-17 04:17:10 -07:00
|
|
|
E_Menu *m;
|
|
|
|
Eina_List *l;
|
2013-09-11 06:23:43 -07:00
|
|
|
unsigned int t;
|
2006-08-22 01:38:24 -07:00
|
|
|
int ret = 0;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2015-08-19 11:49:34 -07:00
|
|
|
if (_e_menu_lock) return ECORE_CALLBACK_RENEW;
|
2004-11-24 19:37:45 -08:00
|
|
|
ev = event;
|
2013-02-19 00:09:05 -08:00
|
|
|
if (ev->window != _e_menu_win) return ECORE_CALLBACK_RENEW;
|
2006-08-22 01:38:24 -07:00
|
|
|
|
2018-10-17 04:17:10 -07:00
|
|
|
if (!_e_menu_activate_floating)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
|
|
|
{
|
|
|
|
if (!m->hold_mode)
|
|
|
|
{
|
|
|
|
_e_menu_activate_floating = 1;
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
t = ev->timestamp - _e_menu_activate_time;
|
2005-07-25 02:55:47 -07:00
|
|
|
if ((_e_menu_activate_time != 0) &&
|
|
|
|
(t < (e_config->menus_click_drag_timeout * 1000)))
|
2005-06-16 02:12:44 -07:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_activate_floating = 1;
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2005-06-16 02:12:44 -07:00
|
|
|
}
|
2005-05-03 01:29:26 -07:00
|
|
|
|
2006-08-22 01:38:24 -07:00
|
|
|
if (_e_menu_activate_dragging)
|
2007-01-03 08:53:48 -08:00
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
/* FIXME: This is a drop, which is not allowed for now.
|
2015-06-16 13:10:21 -07:00
|
|
|
* Once dragging is working, this will be subject to some experimentation.
|
2012-06-21 00:11:47 -07:00
|
|
|
*/
|
2007-01-03 08:53:48 -08:00
|
|
|
}
|
2006-08-22 01:38:24 -07:00
|
|
|
else
|
2013-02-19 00:09:05 -08:00
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
|
|
|
mi = _e_menu_item_active_get();
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
if ((!mi) ||
|
2015-03-13 12:54:51 -07:00
|
|
|
(E_INSIDE(e_comp_canvas_x_root_adjust(ev->root.x),
|
|
|
|
e_comp_canvas_y_root_adjust(ev->root.y),
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
mi->x, mi->y, mi->w, mi->h))
|
|
|
|
)
|
2013-02-19 00:09:05 -08:00
|
|
|
ret = _e_menu_active_call();
|
|
|
|
}
|
2006-08-22 01:38:24 -07:00
|
|
|
_e_menu_activate_maybe_drag = 0;
|
|
|
|
_e_menu_activate_dragging = 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
if (ret == 1)
|
|
|
|
{
|
2012-06-20 23:19:43 -07:00
|
|
|
/* allow mouse to pop down menu if clicked elsewhere */
|
2005-07-25 02:55:47 -07:00
|
|
|
/* if (_e_menu_activate_time != 0) */
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_deactivate_all();
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else if (ret == -1)
|
|
|
|
_e_menu_deactivate_all();
|
2005-06-16 02:12:44 -07:00
|
|
|
else if (!_e_menu_activate_floating)
|
2005-05-03 01:29:26 -07:00
|
|
|
_e_menu_deactivate_all();
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_menu_cb_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Move *ev;
|
2009-03-23 05:28:15 -07:00
|
|
|
Eina_List *l, *tmp;
|
|
|
|
E_Menu *m;
|
2004-11-24 19:37:45 -08:00
|
|
|
int dx, dy, d;
|
|
|
|
double dt;
|
|
|
|
double fast_move_threshold;
|
|
|
|
int is_fast = 0;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
ev = event;
|
2010-06-24 09:19:12 -07:00
|
|
|
if (ev->window != _e_menu_win) return ECORE_CALLBACK_PASS_ON;
|
2005-05-12 02:28:58 -07:00
|
|
|
fast_move_threshold = e_config->menus_fast_mouse_move_threshhold;
|
2004-11-24 19:37:45 -08:00
|
|
|
dx = ev->x - _e_menu_x;
|
|
|
|
dy = ev->y - _e_menu_y;
|
|
|
|
d = (dx * dx) + (dy * dy);
|
2009-03-16 09:24:43 -07:00
|
|
|
dt = (double)(ev->timestamp - _e_menu_time) / 1000.0;
|
2004-11-24 19:37:45 -08:00
|
|
|
dt = dt * dt;
|
|
|
|
if ((dt > 0.0) && ((d / dt) >= (fast_move_threshold * fast_move_threshold)))
|
|
|
|
is_fast = 1;
|
2006-08-22 01:38:24 -07:00
|
|
|
|
2009-03-23 05:28:15 -07:00
|
|
|
tmp = _e_active_menus_copy_ref();
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(_e_active_menus, l, m)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2013-02-19 00:09:05 -08:00
|
|
|
if ((!m->realized) || (!m->cur.visible)) continue;
|
|
|
|
if (is_fast)
|
|
|
|
m->fast_mouse = 1;
|
|
|
|
else if (dt > 0.0)
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2013-02-19 00:09:05 -08:00
|
|
|
m->fast_mouse = 0;
|
|
|
|
if (m->pending_new_submenu)
|
2012-06-21 00:11:47 -07:00
|
|
|
{
|
2013-02-19 00:09:05 -08:00
|
|
|
E_Menu_Item *mi;
|
2012-06-21 00:11:47 -07:00
|
|
|
|
2013-02-19 00:09:05 -08:00
|
|
|
mi = _e_menu_item_active_get();
|
|
|
|
if (mi)
|
|
|
|
_e_menu_submenu_activate(mi);
|
2012-06-21 00:11:47 -07:00
|
|
|
}
|
|
|
|
}
|
2013-06-12 05:35:25 -07:00
|
|
|
if (!_e_menu_activate_maybe_drag)
|
|
|
|
/* this is useless while the mouse is down */
|
|
|
|
evas_event_feed_mouse_move(m->evas, ev->x, ev->y, ev->timestamp, NULL);
|
|
|
|
}
|
2013-06-12 05:55:08 -07:00
|
|
|
if (_e_menu_activate_maybe_drag)
|
2013-06-12 05:35:25 -07:00
|
|
|
{
|
2013-06-12 05:55:08 -07:00
|
|
|
if (_e_active_menu_item)
|
2013-06-12 05:35:25 -07:00
|
|
|
{
|
2013-06-12 05:55:08 -07:00
|
|
|
if (!E_INSIDE(ev->x, ev->y, _e_active_menu_item->x, _e_active_menu_item->y, _e_active_menu_item->w, _e_active_menu_item->h))
|
2013-06-12 05:35:25 -07:00
|
|
|
{
|
2013-06-12 05:55:08 -07:00
|
|
|
if (_e_active_menu_item->drag_cb.func)
|
|
|
|
{
|
|
|
|
/* User is dragging a draggable item elsewhere. */
|
|
|
|
_e_active_menu_item->drag.x = ev->x - (ev->x - _e_active_menu_item->x);
|
|
|
|
_e_active_menu_item->drag.y = ev->y - (ev->y - _e_active_menu_item->y);
|
|
|
|
_e_menu_deactivate_all();
|
|
|
|
_e_active_menu_item->drag_cb.func(_e_active_menu_item->drag_cb.data, _e_active_menu_item->menu, _e_active_menu_item);
|
|
|
|
}
|
2013-12-06 08:44:33 -08:00
|
|
|
/* Either way, the maybe drag stops here. */
|
|
|
|
_e_menu_activate_maybe_drag = 0;
|
2013-06-12 05:35:25 -07:00
|
|
|
}
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2009-03-23 05:28:15 -07:00
|
|
|
|
|
|
|
_e_menu_list_free_unref(tmp);
|
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_x = ev->x;
|
|
|
|
_e_menu_y = ev->y;
|
2009-03-16 09:24:43 -07:00
|
|
|
_e_menu_time = ev->timestamp;
|
2004-11-24 19:37:45 -08:00
|
|
|
_e_menu_mouse_autoscroll_check();
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_menu_cb_mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Wheel *ev;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2004-11-24 19:37:45 -08:00
|
|
|
ev = event;
|
2010-06-24 09:19:12 -07:00
|
|
|
if (ev->window != _e_menu_win) return ECORE_CALLBACK_PASS_ON;
|
2004-11-24 19:37:45 -08:00
|
|
|
if (ev->z < 0) /* up */
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
int i;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2012-06-21 00:11:47 -07:00
|
|
|
for (i = ev->z; i < 0; i++)
|
|
|
|
_e_menu_item_activate_previous();
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
else if (ev->z > 0) /* down */
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
int i;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2012-06-21 00:11:47 -07:00
|
|
|
for (i = ev->z; i > 0; i--)
|
|
|
|
_e_menu_item_activate_next();
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_menu_cb_scroll_animator(void *data EINA_UNUSED)
|
2004-11-24 19:37:45 -08:00
|
|
|
{
|
|
|
|
double t, dt;
|
|
|
|
double dx, dy;
|
|
|
|
int out;
|
|
|
|
double spd;
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2008-11-01 19:36:10 -07:00
|
|
|
t = ecore_loop_time_get();
|
2004-12-04 23:43:51 -08:00
|
|
|
spd = e_config->menus_scroll_speed;
|
2004-11-24 19:37:45 -08:00
|
|
|
dt = t - _e_menu_scroll_start;
|
|
|
|
_e_menu_scroll_start = t;
|
|
|
|
dx = 0;
|
|
|
|
dy = 0;
|
|
|
|
if (_e_menu_autoscroll_x)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
out = _e_menu_outside_bounds_get(_e_menu_autoscroll_x, 0);
|
|
|
|
dx = (-_e_menu_autoscroll_x) * spd * dt;
|
|
|
|
if (_e_menu_autoscroll_x == -1)
|
|
|
|
{
|
|
|
|
if (dx > out) dx = out;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dx < -out) dx = -out;
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
if (_e_menu_autoscroll_y)
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
out = _e_menu_outside_bounds_get(0, _e_menu_autoscroll_y);
|
|
|
|
dy = (-_e_menu_autoscroll_y) * spd * dt;
|
|
|
|
if (_e_menu_autoscroll_y == -1)
|
|
|
|
{
|
|
|
|
if (dy > out) dy = out;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dy < -out) dy = -out;
|
|
|
|
}
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
_e_menu_scroll_by(dx, dy);
|
|
|
|
_e_menu_mouse_autoscroll_check();
|
|
|
|
if ((_e_menu_autoscroll_x == 0) && (_e_menu_autoscroll_y == 0))
|
|
|
|
{
|
2012-06-21 00:11:47 -07:00
|
|
|
_e_menu_scroll_animator = NULL;
|
|
|
|
return 0;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2005-04-13 08:52:34 -07:00
|
|
|
|
2005-04-21 00:19:49 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_menu_cb_item_submenu_post_default(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi)
|
2005-04-21 00:19:49 -07:00
|
|
|
{
|
|
|
|
E_Menu *subm;
|
|
|
|
|
|
|
|
if (!mi->submenu) return;
|
|
|
|
|
|
|
|
subm = mi->submenu;
|
2012-08-30 00:04:53 -07:00
|
|
|
e_menu_item_submenu_set(mi, NULL);
|
2005-04-21 00:19:49 -07:00
|
|
|
e_object_del(E_OBJECT(subm));
|
|
|
|
}
|
2006-01-06 15:45:13 -08:00
|
|
|
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
static void
|
|
|
|
_e_menu_category_free_cb(E_Menu_Category *cat)
|
2006-01-06 15:45:13 -08:00
|
|
|
{
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
E_FREE_LIST(cat->callbacks, free);
|
2006-01-06 15:45:13 -08:00
|
|
|
free(cat);
|
|
|
|
}
|
2012-06-21 00:11:47 -07:00
|
|
|
|