You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2133 lines
63 KiB

#include "e.h"
#include "e_mod_main.h"
/* gadcon requirements */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
static void _gc_shutdown(E_Gadcon_Client *gcc);
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED);
static const char *_gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED);
static Evas_Object *_gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas);
static const char *_gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED);
/* and actually define the gadcon class that this module provides (just 1) */
static const E_Gadcon_Client_Class _gadcon_class =
{
GADCON_CLIENT_CLASS_VERSION,
"pager",
{
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
e_gadcon_site_is_not_toolbar
},
E_GADCON_CLIENT_STYLE_INSET
};
/* actual module specifics */
typedef struct _Instance Instance;
typedef struct _Pager Pager;
typedef struct _Pager_Desk Pager_Desk;
typedef struct _Pager_Win Pager_Win;
typedef struct _Pager_Popup Pager_Popup;
struct _Instance
{
E_Gadcon_Client *gcc;
Evas_Object *o_pager; /* table */
Pager *pager;
};
struct _Pager
{
Instance *inst;
E_Drop_Handler *drop_handler;
Pager_Popup *popup;
Evas_Object *o_table;
E_Zone *zone;
int xnum, ynum;
Eina_List *desks;
Pager_Desk *active_pd;
unsigned char dragging : 1;
unsigned char just_dragged : 1;
Evas_Coord dnd_x, dnd_y;
Pager_Desk *active_drop_pd;
E_Client *active_drag_client;
Ecore_Job *recalc;
Eina_Bool invert : 1;
};
struct _Pager_Desk
{
Pager *pager;
E_Desk *desk;
Eina_List *wins;
Evas_Object *o_desk;
Evas_Object *o_layout;
int xpos, ypos, urgent;
int current : 1;
struct
{
Pager *from_pager;
unsigned char in_pager : 1;
unsigned char start : 1;
int x, y, dx, dy, button;
} drag;
};
struct _Pager_Win
{
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
9 years ago
E_Client *client;
Pager_Desk *desk;
Evas_Object *o_window;
Evas_Object *o_mirror;
unsigned char skip_winlist : 1;
struct
{
Pager *from_pager;
unsigned char start : 1;
unsigned char in_pager : 1;
unsigned char desktop : 1;
int x, y, dx, dy, button;
} drag;
};
struct _Pager_Popup
{
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
9 years ago
Evas_Object *popup;
Evas_Object *o_bg;
Pager *pager;
Ecore_Timer *timer;
unsigned char urgent : 1;
};
static void _pager_cb_mirror_add(Pager_Desk *pd, Evas_Object *obj, Evas_Object *mirror);
static void _pager_cb_obj_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _pager_cb_obj_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _pager_cb_obj_moveresize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _button_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
static void _pager_inst_cb_menu_configure(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED);
static void _pager_inst_cb_menu_virtual_desktops_dialog(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED);
static void _pager_instance_drop_zone_recalc(Instance *inst);
static Eina_Bool _pager_cb_event_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
static Eina_Bool _pager_cb_event_desk_name_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
static Eina_Bool _pager_cb_event_compositor_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
static void _pager_window_cb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _pager_window_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
static void _pager_window_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
static void _pager_window_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
static void *_pager_window_cb_drag_convert(E_Drag *drag, const char *type);
static void _pager_window_cb_drag_finished(E_Drag *drag, int dropped);
static void _pager_drop_cb_enter(void *data, const char *type EINA_UNUSED, void *event_info);
static void _pager_drop_cb_move(void *data, const char *type EINA_UNUSED, void *event_info);
static void _pager_drop_cb_leave(void *data, const char *type EINA_UNUSED, void *event_info EINA_UNUSED);
static void _pager_drop_cb_drop(void *data, const char *type, void *event_info);
static void _pager_inst_cb_scroll(void *data);
static void _pager_update_drop_position(Pager *p, Evas_Coord x, Evas_Coord y);
static void _pager_desk_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
static void _pager_desk_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
static void _pager_desk_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
static void _pager_desk_cb_drag_finished(E_Drag *drag, int dropped);
static void _pager_desk_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
static Eina_Bool _pager_popup_cb_timeout(void *data);
static Pager *_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc);
static void _pager_free(Pager *p);
static void _pager_fill(Pager *p, E_Gadcon *gc);
static void _pager_empty(Pager *p);
static Pager_Desk *_pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos, Eina_Bool invert);
static void _pager_desk_free(Pager_Desk *pd);
static Pager_Desk *_pager_desk_at_coord(Pager *p, Evas_Coord x, Evas_Coord y);
static void _pager_desk_select(Pager_Desk *pd);
static Pager_Desk *_pager_desk_find(Pager *p, E_Desk *desk);
static void _pager_desk_switch(Pager_Desk *pd1, Pager_Desk *pd2);
static Pager_Win *_pager_window_new(Pager_Desk *pd, Evas_Object *mirror, E_Client *client);
static void _pager_window_free(Pager_Win *pw);
static Pager_Popup *_pager_popup_new(E_Zone *zone, int keyaction);
static void _pager_popup_free(Pager_Popup *pp);
static Pager_Popup *_pager_popup_find(E_Zone *zone);
/* functions for pager popup on key actions */
static int _pager_popup_show(void);
static void _pager_popup_hide(int switch_desk);
static Eina_Bool _pager_popup_cb_mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
static void _pager_popup_desk_switch(int x, int y);
static void _pager_popup_modifiers_set(int mod);
static Eina_Bool _pager_popup_cb_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
static Eina_Bool _pager_popup_cb_key_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
static void _pager_popup_cb_action_show(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED, Ecore_Event_Key *ev EINA_UNUSED);
static void _pager_popup_cb_action_switch(E_Object *obj EINA_UNUSED, const char *params, Ecore_Event_Key *ev);
/* variables for pager popup on key actions */
static E_Action *act_popup_show = NULL;
static E_Action *act_popup_switch = NULL;
static Ecore_Window input_window = 0;
static Eina_List *handlers = NULL;
static Pager_Popup *act_popup = NULL; /* active popup */
static int hold_count = 0;
static int hold_mod = 0;
static E_Desk *current_desk = NULL;
static Eina_List *pagers = NULL;
EINTERN E_Module *module;
EINTERN E_Config_Dialog *config_dialog;
EINTERN Eina_List *instances, *shandlers;
static Pager_Win *
_pager_desk_window_find(Pager_Desk *pd, E_Client *client)
{
Eina_List *l;
Pager_Win *pw;
EINA_LIST_FOREACH(pd->wins, l, pw)
if (pw->client == client) return pw;
return NULL;
}
static Pager_Win *
_pager_window_find(Pager *p, E_Client *client)
{
Eina_List *l;
Pager_Desk *pd;
EINA_LIST_FOREACH(p->desks, l, pd)
{
Pager_Win *pw;
pw = _pager_desk_window_find(pd, client);
if (pw) return pw;
}
return NULL;
}
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
Pager *p;
Evas_Object *o;
E_Gadcon_Client *gcc;
Instance *inst;
Evas_Coord x, y, w, h;
const char *drop[] =
{
"enlightenment/pager_win", "enlightenment/border",
"enlightenment/vdesktop"
};
inst = E_NEW(Instance, 1);
p = _pager_new(gc->evas, gc->zone, gc);
p->inst = inst;
inst->pager = p;
o = p->o_table;
gcc = e_gadcon_client_new(gc, name, id, style, o);
gcc->data = inst;
inst->gcc = gcc;
inst->o_pager = o;
evas_object_geometry_get(o, &x, &y, &w, &h);
p->drop_handler =
e_drop_handler_add(E_OBJECT(inst->gcc), NULL, p,
_pager_drop_cb_enter, _pager_drop_cb_move,
_pager_drop_cb_leave, _pager_drop_cb_drop,
drop, 3, x, y, w, h);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE,
_pager_cb_obj_moveresize, inst);
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE,
_pager_cb_obj_moveresize, inst);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_button_cb_mouse_down, inst);
evas_object_event_callback_add(o, EVAS_CALLBACK_SHOW,
_pager_cb_obj_show, inst);
evas_object_event_callback_add(o, EVAS_CALLBACK_HIDE,
_pager_cb_obj_hide, inst);
instances = eina_list_append(instances, inst);
return gcc;
}
static void
_gc_shutdown(E_Gadcon_Client *gcc)
{
Instance *inst;
inst = gcc->data;
if (pager_config)
instances = eina_list_remove(instances, inst);
e_drop_handler_del(inst->pager->drop_handler);
_pager_free(inst->pager);
free(inst);
}
static void
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED)
{
Instance *inst;
int aspect_w, aspect_h;
double aspect_ratio;
inst = gcc->data;
if (inst->pager->invert)
{
aspect_w = inst->pager->ynum * inst->pager->zone->w;
aspect_h = inst->pager->xnum * inst->pager->zone->h;
}
else
{
aspect_w = inst->pager->xnum * inst->pager->zone->w;
aspect_h = inst->pager->ynum * inst->pager->zone->h;
}
e_gadcon_client_aspect_set(gcc, aspect_w, aspect_h);
aspect_ratio = (double)aspect_w / (double)aspect_h;
if (aspect_ratio > 1.0)
e_gadcon_client_min_size_set(gcc, 4 * aspect_ratio, 4);
else
e_gadcon_client_min_size_set(gcc, 4, 4 * aspect_ratio);
}
static const char *
_gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
{
return _("Pager");
}
static Evas_Object *
_gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas)
{
Evas_Object *o;
char buf[PATH_MAX];
o = edje_object_add(evas);
snprintf(buf, sizeof(buf), "%s/e-module-pager.edj",
e_module_dir_get(module));
edje_object_file_set(o, buf, "icon");
return o;
}
static const char *
_gc_id_new(const E_Gadcon_Client_Class *client_class)
{
static char buf[4096];
snprintf(buf, sizeof(buf), "%s.%d", client_class->name,
eina_list_count(instances) + 1);
return buf;
}
static void
_pager_recalc(void *data)
{
Pager *p = data;
Pager_Desk *pd;
Evas_Coord mw = 0, mh = 0;
int w, h, zw, zh, w2, h2;
p->recalc = NULL;
zw = p->zone->w; zh = p->zone->h;
pd = eina_list_data_get(p->desks);
if (!pd) return;
edje_object_size_min_calc(pd->o_desk, &mw, &mh);
evas_object_geometry_get(pd->o_desk, NULL, NULL, &w, &h);
w -= mw; h -= mh;
w2 = w; h2 = (zh * w) / zw;
if (h2 > h)
{
h2 = h; w2 = (zw * h) / zh;
}
w = w2; h = h2;
w += mw; h += mh;
if ((p->inst) && (p->inst->gcc))
{
if (p->invert)
e_gadcon_client_aspect_set(p->inst->gcc, p->ynum * w, p->xnum * h);
else
e_gadcon_client_aspect_set(p->inst->gcc, p->xnum * w, p->ynum * h);
}
}
static void
_pager_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Pager *p = data;
if (!p->recalc)
p->recalc = ecore_job_add(_pager_recalc, p);
}
static Pager *
_pager_new(Evas *evas, E_Zone *zone, E_Gadcon *gc)
{
Pager *p;
p = E_NEW(Pager, 1);
p->inst = NULL;
p->popup = NULL;
p->o_table = elm_table_add(e_win_evas_win_get(evas));
evas_object_event_callback_add(p->o_table, EVAS_CALLBACK_RESIZE, _pager_resize, p);
elm_table_homogeneous_set(p->o_table, 1);
p->zone = zone;
_pager_fill(p, gc);
pagers = eina_list_append(pagers, p);
return p;
}
static void
_pager_free(Pager *p)
{
_pager_empty(p);
evas_object_del(p->o_table);
ecore_job_del(p->recalc);
pagers = eina_list_remove(pagers, p);
free(p);
}
static void
_pager_fill(Pager *p, E_Gadcon *gc)
{
int x, y;
if (gc)
{
switch (gc->orient)
{
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
case E_GADCON_ORIENT_HORIZ:
case E_GADCON_ORIENT_FLOAT:
p->invert = EINA_FALSE;
break;
case E_GADCON_ORIENT_VERT:
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_LB:
case E_GADCON_ORIENT_CORNER_RB:
default:
p->invert = EINA_TRUE;
}
}
e_zone_desk_count_get(p->zone, &(p->xnum), &(p->ynum));
if (p->ynum != 1) p->invert = EINA_FALSE;
for (x = 0; x < p->xnum; x++)
{
for (y = 0; y < p->ynum; y++)
{
Pager_Desk *pd;
E_Desk *desk;
desk = e_desk_at_xy_get(p->zone, x, y);
if (desk)
{
pd = _pager_desk_new(p, desk, x, y, p->invert);
if (pd)
{
p->desks = eina_list_append(p->desks, pd);
if (desk == e_desk_current_get(desk->zone))
_pager_desk_select(pd);
}
}
}
}
}
static void
_pager_empty(Pager *p)
{
p->active_pd = NULL;
E_FREE_LIST(p->desks, _pager_desk_free);
}
static Pager_Desk *
_pager_desk_new(Pager *p, E_Desk *desk, int xpos, int ypos, Eina_Bool invert)
{
Pager_Desk *pd;
Evas_Object *o, *evo;
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
9 years ago
E_Client *ec;
Eina_List *l;
int w, h;
Evas *e;
if (!desk) return NULL;
pd = E_NEW(Pager_Desk, 1);
if (!pd) return NULL;
pd->xpos = xpos;
pd->ypos = ypos;
pd->urgent = 0;
pd->desk = desk;
e_object_ref(E_OBJECT(desk));
pd->pager = p;
e = evas_object_evas_get(p->o_table);
o = edje_object_add(e);
pd->o_desk = o;
e_theme_edje_object_set(o, "base/theme/modules/pager",
"e/modules/pager16/desk");
edje_object_part_text_set(o, "e.text.label", desk->name);
e: 1. configure/build changes to allow cross-compiling painlessly 2. pager module namespace changes - this was still dirty afdter the namespace cleanup, so clean it up 3. add a powersave subsystem - doesnt have an "automatic" way to turn on and off right now, this i think is best provided by modules (that do things like monitor acpi status's (eg close lid of laptop), AC power status etc. etc. this allows e to nicely defer "power" expensive actions to avoid disk spinups etc. 4. move to use the new ecore poller system - discussed long ago as part of power management/saving issues. now it exists 5. add a canvas idle flush call that helsp cope with the new shm greedy software x11 engine stuff 6. use the new powersave subsystem where appropriate 7. fix non-zeroed/initted memory access in e_fm_main 8. fix mem leak for e menus 9. remove ipc handlers for changed/removed config values 10. use animaotr not timer for menu scrolls - then menu scrolls obey the fps config 11. fix up timer/poll happienss of cursor idle stuff 12. remove avoid damage from popups for now - causing problems 13. change battery and temp readouts to b e shorter so they fit 14. pager can emit signals on focus change for mini-windows now 15. temperature module now uses a slave process and uses stdin/out to talk to it and get output - this makes e smoother as in my expereicne i found getting the temp on my laptop actually took like 200ms so e "hang" for 200ms while reading the acpi files - so now the subprocess does it and just writesa back to e when it gets it. ecore: 1. add ecore_pollers. see the documentation on them in doxygen comments :) 2. fix timers to only go off when they have to - bug there that made e's select time out a LOT more than it needed to. defensive coding hid the problem. now fixed. e should be much more power friendly now. 3. formatting/niceness in ecore_exe stuff 4. some comments on comments with SIGIO ideas vs. select 5. add call to be able to add an idle enterer at the start of the list of them, not just the end (as has been the default) 6. fix ecore_evas to support auto evas idler calls after 0.5 secs of idle in all canvases - and to do it right 7. if argb destination - set the shape EVENT shape (to mask out events in transparent regions much like shape does withotu translucency) 8. in ecore_x add support for the event shape evas: 1. fix cache to work properly and not just always fill up (as it seemed to like to think cahce useage dropped below 0 when it didnt and thus just over-fill) 2. software x11 engine now ONLY uses shm segments - no ximages over the socket. this ximage hack was there to avoid the 2 round trips involved in setting up an shm image - now i mitigated that wih an shm image cache pool. it keeps shm images around and repurposes them for new update regions if appropriate. this means many fewer shm creates (about 1/100th the number) and since we recycle the memory less 0 memory page filling by the kernel - in the end, i recorded about a 10-20% speedup over the old software x11 engine. simple tests i have seen up to 120% speedups. idle flush now does something - it frees all the cached shm segments. it has a hard-coded limit of 4mb worth of shm segments (or 32 segments - whichever comes first) to keep around. once can never complain much about speedups methinks :). also evas will defer sync until the NEXT frame is written - this means evas can calculate the next frame of data while x dma's/copies the images to the screen at the same time (if you hve a dual core or multi-cpu machnike or your xserver is able to use DMA to copy image data to the screen/video ram then this should see a decent speedup). SVN revision: 33448
15 years ago
if (pager_config->show_desk_names)
edje_object_signal_emit(o, "e,name,show", "e");
edje_object_size_min_calc(o, &w, &h);
evas_object_size_hint_min_set(o, w, h);
E_EXPAND(o);
E_FILL(o);
if (invert)
elm_table_pack(p->o_table, o, ypos, xpos, 1, 1);
else
elm_table_pack(p->o_table, o, xpos, ypos, 1, 1);
evo = (Evas_Object *)edje_object_part_object_get(o, "e.eventarea");
if (!evo) evo = o;
evas_object_event_callback_add(evo, EVAS_CALLBACK_MOUSE_DOWN,
_pager_desk_cb_mouse_down, pd);
evas_object_event_callback_add(evo, EVAS_CALLBACK_MOUSE_UP,
_pager_desk_cb_mouse_up, pd);
evas_object_event_callback_add(evo, EVAS_CALLBACK_MOUSE_MOVE,
_pager_desk_cb_mouse_move, pd);
evas_object_event_callback_add(evo, EVAS_CALLBACK_MOUSE_WHEEL,
_pager_desk_cb_mouse_wheel, pd);
evas_object_show(o);
pd->o_layout = e_deskmirror_add(desk, 1, 0);
evas_object_smart_callback_add(pd->o_layout, "mirror_add", (Evas_Smart_Cb)_pager_cb_mirror_add, pd);
l = e_deskmirror_mirror_list(pd->o_layout);
EINA_LIST_FREE(l, o)
{
ec = evas_object_data_get(o, "E_Client");
if (ec)
{
Pager_Win *pw;
pw = _pager_window_new(pd, o, ec);
if (pw) pd->wins = eina_list_append(pd->wins, pw);
}
}
edje_object_part_swallow(pd->o_desk, "e.swallow.content", pd->o_layout);
evas_object_show(pd->o_layout);
return pd;
}
static void
_pager_desk_free(Pager_Desk *pd)
{
Pager_Win *w;
evas_object_del(pd->o_desk);
evas_object_del(pd->o_layout);
EINA_LIST_FREE(pd->wins, w)
_pager_window_free(w);
e_object_unref(E_OBJECT(pd->desk));
free(pd);
}
static Pager_Desk *
_pager_desk_at_coord(Pager *p, Evas_Coord x, Evas_Coord y)
{
Eina_List *l;
Pager_Desk *pd;
EINA_LIST_FOREACH(p->desks, l, pd)
{
Evas_Coord dx, dy, dw, dh;
evas_object_geometry_get(pd->o_desk, &dx, &dy, &dw, &dh);
if (E_INSIDE(x, y, dx, dy, dw, dh)) return pd;