expose start
This commit is contained in:
parent
d177714539
commit
d15a8f38a6
|
@ -44,4 +44,295 @@ collections {
|
|||
}
|
||||
}
|
||||
}
|
||||
group { name: "e/modules/desksanity/zoom/base"; program_source: "e";
|
||||
parts {
|
||||
swallow { "e.swallow.background"; clip: "clip";
|
||||
}
|
||||
rect { "fader"; nomouse;
|
||||
desc {
|
||||
color: 0 0 0 0;
|
||||
link.base: "e,state,inactive";
|
||||
link.transition: LINEAR 0.3;
|
||||
link.after: "fade_post";
|
||||
}
|
||||
desc { "fade";
|
||||
color: 0 0 0 192;
|
||||
link.base: "e,state,active";
|
||||
link.transition: LINEAR 0.3;
|
||||
}
|
||||
program { "fade_post";
|
||||
action: SIGNAL_EMIT "e,action,done" "e";
|
||||
}
|
||||
}
|
||||
rect { "clip";
|
||||
desc { color: 255 255 255 0;
|
||||
link.base: "e,state,inactive";
|
||||
link.transition: LINEAR 0.3;
|
||||
}
|
||||
desc { "active";
|
||||
link.base: "e,state,active";
|
||||
link.transition: LINEAR 0.3;
|
||||
}
|
||||
}
|
||||
swallow { "e.swallow.layout"; clip: "clip"; }
|
||||
program { signal: "e,state,inactive";
|
||||
action: SIGNAL_EMIT "e,state,hiding" "e";
|
||||
}
|
||||
}
|
||||
}
|
||||
group { name: "e/modules/desksanity/zoom/scrollframe";
|
||||
parts {
|
||||
rect { "clipper"; nomouse;
|
||||
desc {
|
||||
rel1.to: "e.swallow.content";
|
||||
rel2.to: "e.swallow.content";
|
||||
}
|
||||
}
|
||||
swallow { "e.swallow.content";
|
||||
clip: "clipper";
|
||||
}
|
||||
}
|
||||
}
|
||||
group { name: "e/modules/desksanity/zoom/client"; nomouse;
|
||||
images.image: "win_shadow.png" COMP;
|
||||
script {
|
||||
public message(Msg_Type:type, id, ...) {
|
||||
if (type == MSG_INT_SET) {
|
||||
/* client diff geom[4] */
|
||||
new x, y, w, h;
|
||||
|
||||
x = getarg(2);
|
||||
y = getarg(3);
|
||||
w = getarg(4);
|
||||
h = getarg(5);
|
||||
|
||||
custom_state(PART:"spacer", "default", 0.0);
|
||||
set_state_val(PART:"spacer", STATE_REL1_OFFSET, x, y);
|
||||
set_state_val(PART:"spacer", STATE_REL2_OFFSET, w, h);
|
||||
set_state(PART:"spacer", "custom", 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
parts {
|
||||
spacer { "spacer";
|
||||
program { signal: "e,action,show"; source: "e";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LINEAR 0.3;
|
||||
target: "spacer";
|
||||
after: "idle";
|
||||
}
|
||||
program { signal: "e,action,hide"; source: "e";
|
||||
action: STATE_SET "custom" 0.0;
|
||||
transition: LINEAR 0.3;
|
||||
target: "spacer";
|
||||
}
|
||||
}
|
||||
part { "shadow"; clip: "clip";
|
||||
desc {
|
||||
image.normal: "win_shadow.png";
|
||||
image.border: 14 14 14 14;
|
||||
image.middle: 0;
|
||||
rel1.to: "e.swallow.client";
|
||||
rel1.offset: -7 -3;
|
||||
rel2.to: "e.swallow.client";
|
||||
rel2.offset: 6 11;
|
||||
fill.smooth: 0;
|
||||
}
|
||||
}
|
||||
rect { "outline";
|
||||
desc {
|
||||
color: 51 153 255 0;
|
||||
rel1.to: "e.swallow.client";
|
||||
rel1.offset: -2 -2;
|
||||
rel2.to: "e.swallow.client";
|
||||
rel2.offset: 2 2;
|
||||
visible: 0;
|
||||
link.base: "e,state,unfocused" "e";
|
||||
link.transition: LINEAR 0.2;
|
||||
}
|
||||
desc { "active"; inherit: "default";
|
||||
color: 51 153 255 170;
|
||||
visible: 1;
|
||||
link.base: "e,state,focused" "e";
|
||||
link.transition: LINEAR 0.2;
|
||||
}
|
||||
}
|
||||
rect { "bg";
|
||||
desc {
|
||||
color: 0 0 0 255;
|
||||
rel1.to: "e.swallow.client";
|
||||
rel2.to: "e.swallow.client";
|
||||
}
|
||||
}
|
||||
swallow { "e.swallow.client"; clip: "clip";
|
||||
desc {
|
||||
rel1.to: "spacer";
|
||||
rel2.to: "spacer";
|
||||
rel1.offset: 10 10;
|
||||
rel2.offset: -10 -10;
|
||||
map.on: 1;
|
||||
link.base: "mouse,out" "events";
|
||||
link.transition: LINEAR 0.2;
|
||||
link.after: "idle";
|
||||
}
|
||||
desc { "active";
|
||||
rel1.to: "spacer";
|
||||
rel2.to: "spacer";
|
||||
rel2.relative: 1.3 1.3;
|
||||
rel2.offset: -1 -1;
|
||||
link.base: "mouse,in" "events";
|
||||
link.transition: LINEAR 0.2;
|
||||
}
|
||||
desc { "idle1"; inherit: "default";
|
||||
map.on: 1;
|
||||
map.rotation.z: -5;
|
||||
}
|
||||
desc { "idle2"; inherit: "idle1";
|
||||
map.rotation.z: 5;
|
||||
}
|
||||
desc { "idle3"; inherit: "idle1";
|
||||
map.rotation.z: 5;
|
||||
map.rotation.x: -70;
|
||||
}
|
||||
desc { "idle4"; inherit: "idle1";
|
||||
map.rotation.z: 0;
|
||||
map.rotation.x: -360;
|
||||
map.rotation.y: 360;
|
||||
}
|
||||
program { "idle";
|
||||
in: 2.0 10.0;
|
||||
action: STATE_SET "idle1";
|
||||
transition: SINUSOIDAL 6.0;
|
||||
target: "e.swallow.client";
|
||||
sequence {
|
||||
action: STATE_SET "idle2";
|
||||
name: "idle2";
|
||||
transition: SINUSOIDAL 6.0;
|
||||
target: "e.swallow.client";
|
||||
in: 2.0 10.0;
|
||||
|
||||
action: STATE_SET "idle3";
|
||||
name: "idle3";
|
||||
transition: ACCEL 6.0;
|
||||
target: "e.swallow.client";
|
||||
in: 2.0 10.0;
|
||||
|
||||
action: STATE_SET "idle4";
|
||||
name: "idle4";
|
||||
transition: SINUSOIDAL 6.0;
|
||||
target: "e.swallow.client";
|
||||
in: 2.0 10.0;
|
||||
after: "idle";
|
||||
}
|
||||
}
|
||||
}
|
||||
rect { "clip";
|
||||
desc {
|
||||
rel1.offset: -9999 -9999;
|
||||
rel2.offset: 9999 9999;
|
||||
color: 255 255 255 200;
|
||||
link.base: "mouse,out" "events";
|
||||
link.transition: LINEAR 0.2;
|
||||
}
|
||||
desc { "active"; inherit: "default";
|
||||
color: 255 255 255 255;
|
||||
link.base: "mouse,in" "events";
|
||||
link.transition: LINEAR 0.2;
|
||||
}
|
||||
}
|
||||
proxy { "clone";
|
||||
desc {
|
||||
source: "e.swallow.client";
|
||||
rel1.to: "e.swallow.client";
|
||||
rel2.to: "e.swallow.client";
|
||||
hid;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
desc { "urgent1"; inherit: "default";
|
||||
vis;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
desc { "urgent2"; inherit: "default";
|
||||
vis;
|
||||
rel1.relative: -0.5 -0.5;
|
||||
rel2.relative: 1.5 1.5;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
program { name: "urgent";
|
||||
signal: "e,state,urgent"; source: "e";
|
||||
action: ACTION_STOP;
|
||||
target: "go_big";
|
||||
target: "go_big2";
|
||||
after: "go_big";
|
||||
}
|
||||
program { name: "go_big";
|
||||
action: STATE_SET "urgent1" 0.0;
|
||||
target: "clone";
|
||||
after: "go_big2";
|
||||
}
|
||||
program { name: "go_big2";
|
||||
action: STATE_SET "urgent2" 0.0;
|
||||
transition: LINEAR 0.5;
|
||||
target: "clone";
|
||||
after: "go_big";
|
||||
}
|
||||
program { name: "not_urgent";
|
||||
signal: "e,state,not_urgent"; source: "e";
|
||||
action: ACTION_STOP;
|
||||
target: "go_big";
|
||||
target: "go_big2";
|
||||
after: "go_hid";
|
||||
}
|
||||
program { name: "go_hid";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LINEAR 0.5;
|
||||
target: "clone";
|
||||
}
|
||||
}
|
||||
text { "e.text.title"; clip: "clip"; effect: OUTLINE;
|
||||
desc {
|
||||
fixed: 1 1;
|
||||
align: 0.0 0.0;
|
||||
rel1.to_x: "e.swallow.icon";
|
||||
rel1.to_y: "e.swallow.client";
|
||||
rel1.relative: 1.0 1.0;
|
||||
rel1.offset: 0 10;
|
||||
rel2.to: "e.swallow.client";
|
||||
color: 255 255 255 255;
|
||||
color2: 0 0 0 255;
|
||||
text {
|
||||
font: "Sans:style=Bold"; size: 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
swallow { "e.swallow.icon"; clip: "clip";
|
||||
desc {
|
||||
fixed: 1 1;
|
||||
min: 16 16;
|
||||
align: 0.0 0.0;
|
||||
rel1.to_x: "e.swallow.client";
|
||||
rel1.to_y: "e.text.title";
|
||||
rel1.offset: 0 -6;
|
||||
rel2.to: "e.swallow.client";
|
||||
rel2.relative: 0.0 1.0;
|
||||
}
|
||||
}
|
||||
rect { "events"; mouse; repeat;
|
||||
desc { color: 0 0 0 0; };
|
||||
program { signal: "mouse,clicked,1"; source: "events";
|
||||
action: SIGNAL_EMIT "e,action,activate" "e";
|
||||
}
|
||||
program { signal: "mouse,in"; source: "events";
|
||||
action: SIGNAL_EMIT "e,state,active" "e";
|
||||
sequence {
|
||||
action: ACTION_STOP;
|
||||
targets: "idle" "idle2" "idle3" "idle4";
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,out"; source: "events";
|
||||
action: SIGNAL_EMIT "e,state,inactive" "e";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ module_la_SOURCES = e_mod_main.h \
|
|||
maximize.c \
|
||||
moveresize.c \
|
||||
pip.c \
|
||||
zoom.c \
|
||||
desksanity.c
|
||||
|
||||
module_la_LIBADD = @E_LIBS@
|
||||
|
|
|
@ -84,6 +84,7 @@ e_modapi_init(E_Module *m)
|
|||
maximize_init();
|
||||
|
||||
pip_init();
|
||||
zoom_init();
|
||||
|
||||
return m;
|
||||
}
|
||||
|
@ -91,6 +92,7 @@ e_modapi_init(E_Module *m)
|
|||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
||||
{
|
||||
zoom_shutdown();
|
||||
pip_shutdown();
|
||||
if (!ds_config->disable_maximize)
|
||||
maximize_shutdown();
|
||||
|
|
|
@ -100,4 +100,7 @@ EINTERN void pip_shutdown(void);
|
|||
|
||||
EINTERN void ds_config_init(void);
|
||||
EINTERN void ds_config_shutdown(void);
|
||||
|
||||
EINTERN void zoom_init(void);
|
||||
EINTERN void zoom_shutdown(void);
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,602 @@
|
|||
#include "e_mod_main.h"
|
||||
|
||||
#define MAX_COLS 4
|
||||
|
||||
static Eina_List *zoom_objs = NULL;
|
||||
static Eina_List *current = NULL;
|
||||
static E_Action *act_zoom_desk = NULL;
|
||||
static E_Action *act_zoom_desk_all = NULL;
|
||||
static E_Action *act_zoom_zone = NULL;
|
||||
static E_Action *act_zoom_zone_all = NULL;
|
||||
|
||||
static E_Action *cur_act = NULL;
|
||||
|
||||
static Eina_List *handlers = NULL;
|
||||
|
||||
static int zmw, zmh;
|
||||
|
||||
static inline unsigned int
|
||||
_cols_calc(unsigned int count)
|
||||
{
|
||||
if (count < 3) return 1;
|
||||
if (count < 5) return 2;
|
||||
if (count < 10) return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
static void
|
||||
_hid(void *data EINA_UNUSED, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
e_comp_shape_queue(e_comp_util_evas_object_comp_get(obj));
|
||||
evas_object_hide(obj);
|
||||
evas_object_del(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_zoom_hide(void)
|
||||
{
|
||||
Evas_Object *zoom_obj;
|
||||
|
||||
EINA_LIST_FREE(zoom_objs, zoom_obj)
|
||||
edje_object_signal_emit(zoom_obj, "e,state,inactive", "e");
|
||||
E_FREE_LIST(handlers, ecore_event_handler_del);
|
||||
e_comp_ungrab_input(e_comp_get(NULL), 1, 1);
|
||||
e_comp_shape_queue(e_comp_get(NULL));
|
||||
current = NULL;
|
||||
cur_act = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_dismiss()
|
||||
{
|
||||
_zoom_hide();
|
||||
}
|
||||
|
||||
static void
|
||||
_client_activate(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
e_client_activate(data, 1);
|
||||
_zoom_hide();
|
||||
}
|
||||
|
||||
static void
|
||||
_client_active(void *data EINA_UNUSED, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
evas_object_raise(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_zoomobj_pack_client(const E_Client *ec, const E_Zone *zone, Evas_Object *tb, Evas_Object *m, unsigned int id, unsigned int cols)
|
||||
{
|
||||
int w, h;
|
||||
unsigned int c, r;
|
||||
Evas_Object *e;
|
||||
|
||||
e = evas_object_smart_parent_get(m);
|
||||
if (ec->client.w > ec->client.h)
|
||||
{
|
||||
w = MIN((zone->w / cols) - zmw, ec->client.w);
|
||||
h = (ec->client.h * w) / ec->client.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = MIN((zone->w / cols) - zmh, ec->client.h);
|
||||
w = (ec->client.w * h) / ec->client.h;
|
||||
}
|
||||
|
||||
evas_object_size_hint_min_set(m, w, h);
|
||||
|
||||
r = (id - 1) / cols;
|
||||
c = (id - 1) % cols;
|
||||
e_table_pack(tb, e, c, r, 1, 1);
|
||||
e_table_pack_options_set(e, 0, 0, 0, 0, 0.5, 0.5, zmw + w, zmh + h, 9999, 9999);
|
||||
}
|
||||
|
||||
static void
|
||||
_zoomobj_add_client(Evas_Object *zoom_obj, Eina_List *l, Evas_Object *m)
|
||||
{
|
||||
E_Client *ec;
|
||||
Evas_Object *ic, *e;
|
||||
|
||||
ec = evas_object_data_get(m, "E_Client");
|
||||
e = edje_object_add(ec->comp->evas);
|
||||
evas_object_data_set(e, "__DSZOOMOBJ", zoom_obj);
|
||||
e_comp_object_util_del_list_append(zoom_obj, e);
|
||||
e_comp_object_util_del_list_append(zoom_obj, m);
|
||||
e_theme_edje_object_set(e, NULL, "e/modules/desksanity/zoom/client");
|
||||
if ((!zmw) && (!zmh))
|
||||
edje_object_size_min_calc(e, &zmw, &zmh);
|
||||
edje_object_signal_callback_add(e, "e,action,activate", "e", _client_activate, ec);
|
||||
edje_object_signal_callback_add(e, "e,state,active", "e", _client_active, ec);
|
||||
if (e_client_focused_get() == ec)
|
||||
{
|
||||
edje_object_signal_emit(e, "e,state,focused", "e");
|
||||
current = l;
|
||||
}
|
||||
edje_object_part_swallow(e, "e.swallow.client", m);
|
||||
edje_object_part_text_set(e, "e.text.title", e_client_util_name_get(ec));
|
||||
if (ec->urgent)
|
||||
edje_object_signal_emit(e, "e,state,urgent", "e");
|
||||
ic = e_client_icon_add(ec, ec->comp->evas);
|
||||
if (ic)
|
||||
{
|
||||
edje_object_part_swallow(e, "e.swallow.icon", ic);
|
||||
e_comp_object_util_del_list_append(zoom_obj, ic);
|
||||
}
|
||||
evas_object_show(e);
|
||||
}
|
||||
|
||||
static void
|
||||
_zoomobj_position_client(Evas_Object *m)
|
||||
{
|
||||
int x, y, w, h;
|
||||
E_Client *ec;
|
||||
Evas_Object *e;
|
||||
Edje_Message_Int_Set *msg;
|
||||
|
||||
e = evas_object_smart_parent_get(m);
|
||||
ec = evas_object_data_get(m, "E_Client");
|
||||
evas_object_geometry_get(e, &x, &y, &w, &h);
|
||||
msg = alloca(sizeof(Edje_Message_Int_Set) + ((4 - 1) * sizeof(int)));
|
||||
msg->count = 4;
|
||||
msg->val[0] = ec->client.x - x;
|
||||
msg->val[1] = ec->client.y - y;
|
||||
msg->val[2] = (ec->client.x + ec->client.w) - (x + w);
|
||||
msg->val[3] = (ec->client.y + ec->client.h) - (y + h);
|
||||
edje_object_message_send(e, EDJE_MESSAGE_INT_SET, 0, msg);
|
||||
edje_object_message_signal_process(e);
|
||||
edje_object_signal_emit(e, "e,action,show", "e");
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_zoom_key(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Key *ev)
|
||||
{
|
||||
Eina_List *n = NULL;
|
||||
|
||||
if (!e_util_strcmp(ev->key, "Escape"))
|
||||
_zoom_hide();
|
||||
else if (!e_util_strcmp(ev->key, "Left"))
|
||||
n = eina_list_prev(current) ?: eina_list_last(current);
|
||||
else if (!e_util_strcmp(ev->key, "Right"))
|
||||
{
|
||||
n = eina_list_next(current);
|
||||
if (!n)
|
||||
{
|
||||
Eina_List *f;
|
||||
|
||||
for (f = n = current; f; n = f, f = eina_list_prev(f));
|
||||
}
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
|
||||
{
|
||||
e_client_activate(evas_object_data_get(eina_list_data_get(current), "E_Client"), 1);
|
||||
_zoom_hide();
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
if (n)
|
||||
{
|
||||
Evas_Object *e, *scr;
|
||||
int x, y, w ,h;
|
||||
E_Zone *zone;
|
||||
|
||||
e = evas_object_smart_parent_get(eina_list_data_get(n));
|
||||
edje_object_signal_emit(e, "e,state,focused", "e");
|
||||
edje_object_signal_emit(evas_object_smart_parent_get(eina_list_data_get(current)), "e,state,unfocused", "e");
|
||||
current = n;
|
||||
evas_object_geometry_get(e, &x, &y, &w, &h);
|
||||
scr = edje_object_part_swallow_get(evas_object_data_get(e, "__DSZOOMOBJ"), "e.swallow.layout");
|
||||
zone = e_comp_object_util_zone_get(scr);
|
||||
e_scrollframe_child_region_show(scr, x - zone->x, y - zone->y, w, h);
|
||||
}
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
||||
static void
|
||||
_relayout(Evas_Object *zoom_obj, Evas_Object *scr, Evas_Object *tb)
|
||||
{
|
||||
Eina_List *l, *clients;
|
||||
Evas_Object *m;
|
||||
int tw, th;
|
||||
unsigned int id = 1;
|
||||
|
||||
clients = evas_object_data_get(zoom_obj, "__DSCLIENTS");
|
||||
e_comp_object_util_del_list_remove(zoom_obj, tb);
|
||||
evas_object_del(tb);
|
||||
tb = e_table_add(evas_object_evas_get(zoom_obj));
|
||||
e_comp_object_util_del_list_append(zoom_obj, tb);
|
||||
e_table_homogenous_set(tb, 1);
|
||||
e_table_freeze(tb);
|
||||
EINA_LIST_FOREACH(clients, l, m)
|
||||
_zoomobj_pack_client(evas_object_data_get(m, "E_Client"),
|
||||
e_comp_object_util_zone_get(zoom_obj), tb, m, id++,
|
||||
_cols_calc(eina_list_count(clients)));
|
||||
e_table_thaw(tb);
|
||||
e_table_size_min_get(tb, &tw, &th);
|
||||
evas_object_size_hint_min_set(tb, tw, th);
|
||||
evas_object_resize(tb, tw, th);
|
||||
e_scrollframe_child_set(scr, tb);
|
||||
E_LIST_FOREACH(clients, _zoomobj_position_client);
|
||||
}
|
||||
|
||||
static void
|
||||
_zoom_client_add_post(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *scr, *tb, *m;
|
||||
Eina_List *clients;
|
||||
unsigned int c, pc;
|
||||
E_Client *ec;
|
||||
|
||||
ec = evas_object_data_get(obj, "E_Client");
|
||||
evas_object_event_callback_del(ec->frame, EVAS_CALLBACK_SHOW, _zoom_client_add_post);
|
||||
m = e_comp_object_util_mirror_add(ec->frame);
|
||||
if (!m) return;
|
||||
clients = evas_object_data_get(data, "__DSCLIENTS");
|
||||
clients = eina_list_append(clients, m);
|
||||
scr = edje_object_part_swallow_get(data, "e.swallow.layout");
|
||||
tb = e_pan_child_get(edje_object_part_swallow_get(e_scrollframe_edje_object_get(scr), "e.swallow.content"));
|
||||
c = _cols_calc(eina_list_count(clients));
|
||||
pc = _cols_calc(eina_list_count(clients) - 1);
|
||||
_zoomobj_add_client(data, eina_list_last(clients), m);
|
||||
if (c == pc)
|
||||
{
|
||||
_zoomobj_pack_client(ec, ec->zone, tb, m, eina_list_count(clients), c);
|
||||
_zoomobj_position_client(m);
|
||||
}
|
||||
else
|
||||
_relayout(data, scr, tb);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_zoom_client_add(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client *ev)
|
||||
{
|
||||
Evas_Object *zoom_obj;
|
||||
Eina_List *l;
|
||||
|
||||
if (e_client_util_ignored_get(ev->ec)) return ECORE_CALLBACK_RENEW;
|
||||
if (ev->ec->iconic && (!e_config->winlist_list_show_iconified)) return ECORE_CALLBACK_RENEW;
|
||||
if (((cur_act == act_zoom_zone) || (cur_act == act_zoom_desk)) &&
|
||||
(ev->ec->zone != e_zone_current_get(ev->ec->comp))) return ECORE_CALLBACK_RENEW;
|
||||
if (((cur_act == act_zoom_desk) || (cur_act == act_zoom_desk_all)) &&
|
||||
(!ev->ec->desk->visible)) return ECORE_CALLBACK_RENEW;
|
||||
|
||||
EINA_LIST_FOREACH(zoom_objs, l, zoom_obj)
|
||||
{
|
||||
if (e_comp_object_util_zone_get(zoom_obj) != ev->ec->zone) continue;
|
||||
|
||||
evas_object_event_callback_add(ev->ec->frame, EVAS_CALLBACK_SHOW, _zoom_client_add_post, zoom_obj);
|
||||
break;
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_zoom_client_del(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client *ev)
|
||||
{
|
||||
Evas_Object *zoom_obj;
|
||||
Eina_List *l;
|
||||
|
||||
if (e_client_util_ignored_get(ev->ec)) return ECORE_CALLBACK_RENEW;
|
||||
if (ev->ec->iconic && (!e_config->winlist_list_show_iconified)) return ECORE_CALLBACK_RENEW;
|
||||
|
||||
EINA_LIST_FOREACH(zoom_objs, l, zoom_obj)
|
||||
{
|
||||
Eina_List *ll, *clients = evas_object_data_get(zoom_obj, "__DSCLIENTS");
|
||||
Evas_Object *m;
|
||||
|
||||
EINA_LIST_FOREACH(clients, ll, m)
|
||||
{
|
||||
Evas_Object *e, *scr, *tb, *ic;
|
||||
|
||||
if (evas_object_data_get(m, "E_Client") != ev->ec) continue;
|
||||
e = evas_object_smart_parent_get(m);
|
||||
e_comp_object_util_del_list_remove(zoom_obj, m);
|
||||
e_comp_object_util_del_list_remove(zoom_obj, e);
|
||||
ic = edje_object_part_swallow_get(e, "e.swallow.icon");
|
||||
e_comp_object_util_del_list_remove(zoom_obj, ic);
|
||||
evas_object_del(ic);
|
||||
evas_object_data_set(zoom_obj, "__DSCLIENTS", eina_list_remove_list(clients, ll));
|
||||
e_table_unpack(e);
|
||||
evas_object_del(ic);
|
||||
evas_object_del(e);
|
||||
evas_object_del(m);
|
||||
scr = edje_object_part_swallow_get(zoom_obj, "e.swallow.layout");
|
||||
tb = e_pan_child_get(edje_object_part_swallow_get(e_scrollframe_edje_object_get(scr), "e.swallow.content"));
|
||||
_relayout(zoom_obj, scr, tb);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_zoom_client_property(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Property *ev)
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *zoom_obj;
|
||||
|
||||
if (!(ev->property & E_CLIENT_PROPERTY_URGENCY)) return ECORE_CALLBACK_RENEW;
|
||||
|
||||
EINA_LIST_FOREACH(zoom_objs, l, zoom_obj)
|
||||
{
|
||||
Evas_Object *m;
|
||||
Eina_List *ll, *clients = evas_object_data_get(zoom_obj, "__DSCLIENTS");
|
||||
|
||||
EINA_LIST_FOREACH(clients, ll, m)
|
||||
{
|
||||
if (evas_object_data_get(m, "E_Client") != ev->ec) continue;
|
||||
|
||||
if (ev->ec->urgent)
|
||||
edje_object_signal_emit(evas_object_smart_parent_get(m), "e,state,urgent", "e");
|
||||
else
|
||||
edje_object_signal_emit(evas_object_smart_parent_get(m), "e,state,not_urgent", "e");
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
}
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static void
|
||||
_hiding(void *data EINA_UNUSED, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
Eina_List *clients = evas_object_data_get(obj, "__DSCLIENTS");
|
||||
Evas_Object *m, *e;
|
||||
|
||||
EINA_LIST_FREE(clients, m)
|
||||
{
|
||||
e = evas_object_smart_parent_get(m);
|
||||
edje_object_signal_emit(e, "e,action,hide", "e");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
zoom(Eina_List *clients, E_Zone *zone)
|
||||
{
|
||||
E_Comp *comp = zone->comp;
|
||||
Evas_Object *m, *bg_obj, *scr, *tb, *zoom_obj;
|
||||
unsigned int cols, id = 1;
|
||||
int tw, th;
|
||||
Eina_Stringshare *bgf;
|
||||
Eina_List *l;
|
||||
|
||||
if (!zoom_objs)
|
||||
{
|
||||
e_comp_shape_queue(comp);
|
||||
e_comp_grab_input(comp, 1, 1);
|
||||
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _zoom_key, NULL);
|
||||
E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_PROPERTY, _zoom_client_property, NULL);
|
||||
E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ADD, _zoom_client_add, NULL);
|
||||
E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_REMOVE, _zoom_client_del, NULL);
|
||||
}
|
||||
|
||||
zoom_obj = edje_object_add(comp->evas);
|
||||
edje_object_signal_callback_add(zoom_obj, "e,state,hiding", "e", _hiding, NULL);
|
||||
edje_object_signal_callback_add(zoom_obj, "e,action,dismiss", "e", _dismiss, NULL);
|
||||
edje_object_signal_callback_add(zoom_obj, "e,action,done", "e", _hid, NULL);
|
||||
evas_object_resize(zoom_obj, zone->w, zone->h);
|
||||
evas_object_layer_set(zoom_obj, E_LAYER_POPUP);
|
||||
e_theme_edje_object_set(zoom_obj, NULL, "e/modules/desksanity/zoom/base");
|
||||
|
||||
bg_obj = e_icon_add(comp->evas);
|
||||
bgf = e_bg_file_get(comp->man->num, zone->num, zone->desk_x_current, zone->desk_y_current);
|
||||
if (eina_str_has_extension(bgf, ".edj"))
|
||||
e_icon_file_edje_set(bg_obj, bgf, "e/desktop/background");
|
||||
else
|
||||
e_icon_file_set(bg_obj, bgf);
|
||||
eina_stringshare_del(bgf);
|
||||
e_comp_object_util_del_list_append(zoom_obj, bg_obj);
|
||||
edje_object_part_swallow(zoom_obj, "e.swallow.background", bg_obj);
|
||||
|
||||
scr = e_scrollframe_add(comp->evas);
|
||||
e_comp_object_util_del_list_append(zoom_obj, scr);
|
||||
e_scrollframe_custom_theme_set(scr, NULL, "e/modules/desksanity/zoom/scrollframe");
|
||||
edje_object_part_swallow(zoom_obj, "e.swallow.layout", scr);
|
||||
|
||||
tb = e_table_add(comp->evas);
|
||||
e_comp_object_util_del_list_append(zoom_obj, tb);
|
||||
e_table_homogenous_set(tb, 1);
|
||||
|
||||
evas_object_show(zoom_obj);
|
||||
|
||||
cols = _cols_calc(eina_list_count(clients));
|
||||
|
||||
e_table_freeze(tb);
|
||||
EINA_LIST_FOREACH(clients, l, m)
|
||||
{
|
||||
_zoomobj_add_client(zoom_obj, l, m);
|
||||
_zoomobj_pack_client(evas_object_data_get(m, "E_Client"), zone, tb, m, id++, cols);
|
||||
}
|
||||
|
||||
e_table_thaw(tb);
|
||||
e_table_size_min_get(tb, &tw, &th);
|
||||
evas_object_size_hint_min_set(tb, tw, th);
|
||||
evas_object_resize(tb, tw, th);
|
||||
e_scrollframe_child_set(scr, tb);
|
||||
edje_object_signal_emit(zoom_obj, "e,state,active", "e");
|
||||
|
||||
E_LIST_FOREACH(clients, _zoomobj_position_client);
|
||||
evas_object_data_set(zoom_obj, "__DSCLIENTS", clients);
|
||||
|
||||
zoom_objs = eina_list_append(zoom_objs, zoom_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_zoom_desk_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
|
||||
{
|
||||
Eina_List *clients = NULL;
|
||||
E_Comp *comp = e_comp_get(NULL);
|
||||
E_Zone *zone;
|
||||
Evas_Object *m;
|
||||
E_Client *ec;
|
||||
|
||||
|
||||
if (zoom_objs)
|
||||
{
|
||||
_zoom_hide();
|
||||
return;
|
||||
}
|
||||
|
||||
cur_act = act_zoom_desk;
|
||||
zone = e_zone_current_get(comp);
|
||||
E_CLIENT_FOREACH(comp, ec)
|
||||
{
|
||||
if (e_client_util_ignored_get(ec)) continue;
|
||||
if (!e_client_util_desk_visible(ec, e_desk_current_get(zone))) continue;
|
||||
if (ec->iconic && (!e_config->winlist_list_show_iconified)) continue;
|
||||
|
||||
m = e_comp_object_util_mirror_add(ec->frame);
|
||||
if (!m) continue;
|
||||
clients = eina_list_append(clients, m);
|
||||
}
|
||||
zoom(clients, zone);
|
||||
}
|
||||
|
||||
static void
|
||||
_zoom_desk_all_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
|
||||
{
|
||||
Eina_List *clients = NULL;
|
||||
E_Comp *comp = e_comp_get(NULL);
|
||||
E_Zone *zone;
|
||||
Evas_Object *m;
|
||||
E_Client *ec;
|
||||
Eina_List *l;
|
||||
|
||||
if (zoom_objs)
|
||||
{
|
||||
_zoom_hide();
|
||||
return;
|
||||
}
|
||||
|
||||
cur_act = act_zoom_desk_all;
|
||||
EINA_LIST_FOREACH(comp->zones, l, zone)
|
||||
{
|
||||
E_Desk *desk = e_desk_current_get(zone);
|
||||
E_CLIENT_FOREACH(comp, ec)
|
||||
{
|
||||
if (e_client_util_ignored_get(ec)) continue;
|
||||
if (ec->desk != desk) continue; //ignore sticky
|
||||
if (ec->iconic && (!e_config->winlist_list_show_iconified)) continue;
|
||||
|
||||
m = e_comp_object_util_mirror_add(ec->frame);
|
||||
if (!m) continue;
|
||||
clients = eina_list_append(clients, m);
|
||||
}
|
||||
zoom(clients, zone);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_zoom_zone_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
|
||||
{
|
||||
Eina_List *clients = NULL;
|
||||
E_Comp *comp = e_comp_get(NULL);
|
||||
E_Zone *zone;
|
||||
Evas_Object *m;
|
||||
E_Client *ec;
|
||||
|
||||
|
||||
if (zoom_objs)
|
||||
{
|
||||
_zoom_hide();
|
||||
return;
|
||||
}
|
||||
|
||||
cur_act = act_zoom_zone;
|
||||
zone = e_zone_current_get(comp);
|
||||
E_CLIENT_FOREACH(comp, ec)
|
||||
{
|
||||
if (e_client_util_ignored_get(ec)) continue;
|
||||
if (ec->zone != zone) continue;
|
||||
if (ec->iconic && (!e_config->winlist_list_show_iconified)) continue;
|
||||
|
||||
m = e_comp_object_util_mirror_add(ec->frame);
|
||||
if (!m) continue;
|
||||
clients = eina_list_append(clients, m);
|
||||
}
|
||||
zoom(clients, zone);
|
||||
}
|
||||
|
||||
static void
|
||||
_zoom_zone_all_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
|
||||
{
|
||||
Eina_List *clients = NULL;
|
||||
E_Comp *comp = e_comp_get(NULL);
|
||||
E_Zone *zone;
|
||||
Evas_Object *m;
|
||||
E_Client *ec;
|
||||
Eina_List *l;
|
||||
|
||||
|
||||
if (zoom_objs)
|
||||
{
|
||||
_zoom_hide();
|
||||
return;
|
||||
}
|
||||
|
||||
cur_act = act_zoom_zone_all;
|
||||
EINA_LIST_FOREACH(comp->zones, l, zone)
|
||||
{
|
||||
E_CLIENT_FOREACH(comp, ec)
|
||||
{
|
||||
if (e_client_util_ignored_get(ec)) continue;
|
||||
if (ec->zone != zone) continue;
|
||||
if (ec->iconic && (!e_config->winlist_list_show_iconified)) continue;
|
||||
|
||||
m = e_comp_object_util_mirror_add(ec->frame);
|
||||
if (!m) continue;
|
||||
clients = eina_list_append(clients, m);
|
||||
}
|
||||
zoom(clients, zone);
|
||||
}
|
||||
}
|
||||
|
||||
EINTERN void
|
||||
zoom_init(void)
|
||||
{
|
||||
act_zoom_desk = e_action_add("zoom_desk");
|
||||
if (act_zoom_desk)
|
||||
{
|
||||
act_zoom_desk->func.go = _zoom_desk_cb;
|
||||
e_action_predef_name_set(D_("Compositor"), D_("Toggle zoom current desk"),
|
||||
"zoom_desk", NULL, NULL, 0);
|
||||
}
|
||||
act_zoom_desk_all = e_action_add("zoom_desk_all");
|
||||
if (act_zoom_desk_all)
|
||||
{
|
||||
act_zoom_desk->func.go = _zoom_desk_all_cb;
|
||||
e_action_predef_name_set(D_("Compositor"), D_("Toggle zoom current desks"),
|
||||
"zoom_desk_all", NULL, NULL, 0);
|
||||
}
|
||||
act_zoom_zone = e_action_add("zoom_zone");
|
||||
if (act_zoom_zone)
|
||||
{
|
||||
act_zoom_zone->func.go = _zoom_zone_cb;
|
||||
e_action_predef_name_set(D_("Compositor"), D_("Toggle zoom current screen"),
|
||||
"zoom_zone", NULL, NULL, 0);
|
||||
}
|
||||
act_zoom_zone_all = e_action_add("zoom_zone_all");
|
||||
if (act_zoom_zone_all)
|
||||
{
|
||||
act_zoom_zone_all->func.go = _zoom_zone_all_cb;
|
||||
e_action_predef_name_set(D_("Compositor"), D_("Toggle zoom all screens"),
|
||||
"zoom_zone_all", NULL, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
EINTERN void
|
||||
zoom_shutdown(void)
|
||||
{
|
||||
e_action_predef_name_del(D_("Compositor"), D_("Toggle zoom current desk"));
|
||||
e_action_del("zoom_desk");
|
||||
act_zoom_desk = NULL;
|
||||
e_action_predef_name_del(D_("Compositor"), D_("Toggle zoom current desks"));
|
||||
e_action_del("zoom_desk_all");
|
||||
act_zoom_desk_all = NULL;
|
||||
e_action_predef_name_del(D_("Compositor"), D_("Toggle zoom current screen"));
|
||||
e_action_del("zoom_zone");
|
||||
act_zoom_zone = NULL;
|
||||
e_action_predef_name_del(D_("Compositor"), D_("Toggle zoom all screens"));
|
||||
e_action_del("zoom_zone_all");
|
||||
act_zoom_zone_all = NULL;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 501 B |
Loading…
Reference in New Issue