hi,
this patch fixes the problem that the pager popup always has the same
size as the pager in the shelf. it also solves the problem when having
two pagers in one zone. i.e. it shows only _one_ popup no matter
how many pager instances are running in a zone. it is now also
possible to have a pager popup without having a shelf instance. To make
this comfortable the pager is now also configurable via
extensions->pager.
I saw a FIXME in the code concerning that there should be a
configuration per zone. I think this approach with putting a config
link in extensions can also work with this. i.e. extensions ->
pager (Zone n)
comments and suggestion are welcome. i think i'll work a bit more on
the pager module: adding key actions to show the popup, cycle
through desktops without immediatly switching to them and maybe one
to permute desktops.
I made a whitespace-cleanup and changed the indentaion to e`s
standard (in a few places spaces are replaced by tabs now) sorry if this
makes the patch harder to read.
regards,
Hannes 'jeffdameth' Janetzek
Index: e_mod_main.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/modules/pager/e_mod_main.c,v
retrieving revision 1.220
diff -u -r1.220 e_mod_main.c
--- e_mod_main.c 10 Nov 2007 18:54:45 -0000 1.220
+++ e_mod_main.c 14 Dec 2007 21:47:52 -0000
@@ -1,6 +1,7 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
+
#include "e.h"
#include "e_mod_main.h"
@@ -19,7 +20,7 @@
GADCON_CLIENT_CLASS_VERSION,
"pager",
{
- _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL
+ _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL
},
E_GADCON_CLIENT_STYLE_INSET
};
@@ -53,7 +54,6 @@
E_Zone *zone;
int xnum, ynum;
Evas_List *desks;
- Pager_Popup *popup;
unsigned char dragging : 1;
unsigned char just_dragged : 1;
Evas_Coord dnd_x, dnd_y;
@@ -69,6 +69,7 @@
Evas_Object *o_layout;
int xpos, ypos;
int current : 1;
+ int urgent;
struct {
Pager *from_pager;
unsigned char in_pager : 1;
@@ -101,7 +102,7 @@
struct _Pager_Popup
{
E_Popup *popup;
- Pager *pager, *src_pager;
+ Pager *pager;
Evas_Object *o_bg;
Ecore_Timer *timer;
unsigned char urgent : 1;
@@ -164,10 +165,13 @@
static void _pager_window_move(Pager_Win *pw);
static Pager_Win *_pager_window_find(Pager *p, E_Border *border);
static Pager_Win *_pager_desk_window_find(Pager_Desk *pd, E_Border *border);
-static Pager_Popup *_pager_popup_new(Pager *p, int urgent);
+static Pager_Popup *_pager_popup_new(E_Zone *zone, int urgent);
static void _pager_popup_free(Pager_Popup *pp);
+static Pager_Popup *_pager_popup_find(E_Zone *zone);
+static E_Config_Dialog *_pager_config_dialog(E_Container *con, const char *params);
static E_Config_DD *conf_edd = NULL;
+static Evas_List *pager_popups = NULL;
Config *pager_config = NULL;
@@ -180,16 +184,16 @@
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);
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;
@@ -209,11 +213,11 @@
return gcc;
}
-static void
+static void
_gc_shutdown(E_Gadcon_Client *gcc)
{
Instance *inst;
-
+
inst = gcc->data;
pager_config->instances = evas_list_remove(pager_config->instances, inst);
e_drop_handler_del(inst->drop_handler);
@@ -225,14 +229,14 @@
_gc_orient(E_Gadcon_Client *gcc)
{
Instance *inst;
-
+
inst = gcc->data;
- e_gadcon_client_aspect_set(gcc,
- inst->pager->xnum * inst->pager->zone->w,
+ e_gadcon_client_aspect_set(gcc,
+ inst->pager->xnum * inst->pager->zone->w,
inst->pager->ynum * inst->pager->zone->h);
e_gadcon_client_min_size_set(gcc, 16, 16);
}
-
+
static char *
_gc_label(void)
{
@@ -244,7 +248,7 @@
{
Evas_Object *o;
char buf[4096];
-
+
o = edje_object_add(evas);
snprintf(buf, sizeof(buf), "%s/e-module-pager.edj",
e_module_dir_get(pager_config->module));
@@ -267,7 +271,7 @@
_pager_new(Evas *evas, E_Zone *zone)
{
Pager *p;
-
+
p = E_NEW(Pager, 1);
p->o_table = e_table_add(evas);
e_table_homogenous_set(p->o_table, 1);
@@ -288,7 +292,7 @@
_pager_fill(Pager *p)
{
int x, y;
-
+
e_zone_desk_count_get(p->zone, &(p->xnum), &(p->ynum));
for (x = 0; x < p->xnum; x++)
{
@@ -312,7 +316,7 @@
static void
_pager_empty(Pager *p)
{
- if (p->popup) _pager_popup_free(p->popup);
+ // if (p->popup) _pager_popup_free(p->popup);
while (p->desks)
{
@@ -335,6 +339,8 @@
pd->xpos = xpos;
pd->ypos = ypos;
+ pd->urgent = 0;
+
pd->desk = desk;
e_object_ref(E_OBJECT(desk));
pd->pager = p;
@@ -379,7 +385,7 @@
evas_object_del(pd->o_desk);
evas_object_del(pd->o_layout);
- for (l = pd->wins; l; l = l->next)
+ for (l = pd->wins; l; l = l->next)
_pager_window_free(l->data);
evas_list_free(pd->wins);
e_object_unref(E_OBJECT(pd->desk));
@@ -465,14 +471,14 @@
/* Move opened windows from on desk to the other */
for (l = pd1->wins; l; l = l->next)
{
- pw = l->data;
- if (!pw || !pw->border || pw->border->iconic) continue;
+ pw = l->data;
+ if (!pw || !pw->border || pw->border->iconic) continue;
e_border_desk_set(pw->border, desk2);
}
for (l = pd2->wins; l; l = l->next)
{
- pw = l->data;
- if (!pw || !pw->border || pw->border->iconic) continue;
+ pw = l->data;
+ if (!pw || !pw->border || pw->border->iconic) continue;
e_border_desk_set(pw->border, desk1);
}
@@ -481,26 +487,26 @@
{
E_Config_Desktop_Name *tmp_dn;
- tmp_dn = l->data;
- if (!tmp_dn) continue;
- if (tmp_dn->desk_x == desk1->x &&
- tmp_dn->desk_y == desk1->y &&
+ tmp_dn = l->data;
+ if (!tmp_dn) continue;
+ if (tmp_dn->desk_x == desk1->x &&
+ tmp_dn->desk_y == desk1->y &&
tmp_dn->zone == desk1->zone->num)
- {
- tmp_dn->desk_x = desk2->x;
- tmp_dn->desk_y = desk2->y;
+ {
+ tmp_dn->desk_x = desk2->x;
+ tmp_dn->desk_y = desk2->y;
tmp_dn->zone = desk2->zone->num;
- c++;
- }
- else if (tmp_dn->desk_x == desk2->x &&
- tmp_dn->desk_y == desk2->y &&
+ c++;
+ }
+ else if (tmp_dn->desk_x == desk2->x &&
+ tmp_dn->desk_y == desk2->y &&
tmp_dn->zone == desk2->zone->num)
- {
- tmp_dn->desk_x = desk1->x;
- tmp_dn->desk_y = desk1->y;
+ {
+ tmp_dn->desk_x = desk1->x;
+ tmp_dn->desk_y = desk1->y;
tmp_dn->zone = desk1->zone->num;
- c++;
- }
+ c++;
+ }
}
if (c > 0) e_config_save();
e_desk_name_update();
@@ -510,37 +516,37 @@
{
E_Config_Desktop_Background *tmp_db;
- tmp_db = l->data;
- if (!tmp_db) continue;
- if (tmp_db->desk_x == desk1->x &&
- tmp_db->desk_y == desk1->y &&
+ tmp_db = l->data;
+ if (!tmp_db) continue;
+ if (tmp_db->desk_x == desk1->x &&
+ tmp_db->desk_y == desk1->y &&
tmp_db->zone == desk1->zone->num)
- {
- tmp_db->desk_x = desk2->x;
- tmp_db->desk_y = desk2->y;
- tmp_db->zone = desk2->zone->num;
- c++;
- }
- else if (tmp_db->desk_x == desk2->x &&
- tmp_db->desk_y == desk2->y &&
+ {
+ tmp_db->desk_x = desk2->x;
+ tmp_db->desk_y = desk2->y;
+ tmp_db->zone = desk2->zone->num;
+ c++;
+ }
+ else if (tmp_db->desk_x == desk2->x &&
+ tmp_db->desk_y == desk2->y &&
tmp_db->zone == desk2->zone->num)
- {
- tmp_db->desk_x = desk1->x;
- tmp_db->desk_y = desk1->y;
- tmp_db->zone = desk1->zone->num;
- c++;
- }
+ {
+ tmp_db->desk_x = desk1->x;
+ tmp_db->desk_y = desk1->y;
+ tmp_db->zone = desk1->zone->num;
+ c++;
+ }
}
if (c > 0) e_config_save();
/* If the current desktop has been switched, force to update of the screen */
- if (desk2 == e_desk_current_get(zone2))
+ if (desk2 == e_desk_current_get(zone2))
{
desk2->visible = 0;
e_desk_show(desk2);
}
- if (desk1 == e_desk_current_get(zone1))
+ if (desk1 == e_desk_current_get(zone1))
{
desk1->visible = 0;
e_desk_show(desk1);
@@ -573,7 +579,7 @@
e_layout_pack(pd->o_layout, pw->o_window);
e_layout_child_raise(pw->o_window);
-
+
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _pager_window_cb_mouse_in, pw);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _pager_window_cb_mouse_out, pw);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _pager_window_cb_mouse_down, pw);
@@ -590,11 +596,11 @@
if (border->client.icccm.urgent)
{
- if (!(border->iconic))
- edje_object_signal_emit(pd->o_desk,
- "e,state,urgent", "e");
- edje_object_signal_emit(pw->o_window,
- "e,state,urgent", "e");
+ if (!(border->iconic))
+ edje_object_signal_emit(pd->o_desk,
+ "e,state,urgent", "e");
+ edje_object_signal_emit(pw->o_window,
+ "e,state,urgent", "e");
}
evas_object_show(o);
@@ -656,91 +662,109 @@
}
static Pager_Popup *
-_pager_popup_new(Pager *p, int urgent)
+_pager_popup_new(E_Zone *zone, int urgent)
{
Pager_Popup *pp;
Evas_Coord w, h;
+ int x,y;
E_Desk *desk;
-
+
pp = E_NEW(Pager_Popup, 1);
if (!pp) return NULL;
-
+
/* Show popup */
- pp->popup = e_popup_new(p->zone, 0, 0, 1, 1);
+ pp->popup = e_popup_new(zone, 0, 0, 1, 1);
if (!pp->popup)
{
free(pp);
return NULL;
}
- e_popup_layer_set(pp->popup, 999);
- pp->src_pager = p;
+ e_popup_layer_set(pp->popup, 255);
- p->popup = pp;
+ pp->pager = _pager_new(pp->popup->evas, zone);
- evas_object_geometry_get(p->o_table, NULL, NULL, &w, &h);
-
- pp->pager = _pager_new(pp->popup->evas, p->zone);
- pp->pager->inst = p->inst;
pp->pager->is_popup = 1;
+
+ e_zone_desk_count_get(zone, &x, &y);
+ int height = pager_config->popup_pager_height * y;
+ int width = ((zone->w * x)/(zone->h * y)) * height;
+
evas_object_move(pp->pager->o_table, 0, 0);
- evas_object_resize(pp->pager->o_table, w, h);
-
+ evas_object_resize(pp->pager->o_table, width, height);
+
pp->o_bg = edje_object_add(pp->popup->evas);
e_theme_edje_object_set(pp->o_bg,
"base/theme/modules/pager",
"e/widgets/pager/popup");
- desk = e_desk_current_get(p->zone);
+ desk = e_desk_current_get(zone);
if (desk)
edje_object_part_text_set(pp->o_bg, "text", desk->name);
evas_object_show(pp->o_bg);
- edje_extern_object_min_size_set(pp->pager->o_table, w, h);
+
+ edje_extern_object_min_size_set(pp->pager->o_table, width, height);
edje_object_part_swallow(pp->o_bg, "pager", pp->pager->o_table);
edje_object_size_min_calc(pp->o_bg, &w, &h);
-
+
evas_object_move(pp->o_bg, 0, 0);
evas_object_resize(pp->o_bg, w, h);
e_popup_edje_bg_object_set(pp->popup, pp->o_bg);
//e_popup_ignore_events_set(pp->popup, 1);
- e_popup_move_resize(pp->popup, ((p->zone->w - w) / 2),
- ((p->zone->h - h) / 2), w, h);
+ e_popup_move_resize(pp->popup, ((zone->w - w) / 2),
+ ((zone->h - h) / 2), w, h);
e_bindings_mouse_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win);
e_bindings_wheel_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win);
e_popup_show(pp->popup);
-
+
if (!urgent)
{
- pp->timer = ecore_timer_add(pager_config->popup_speed,
- _pager_popup_cb_timeout, pp);
+ pp->timer = ecore_timer_add(pager_config->popup_speed,
+ _pager_popup_cb_timeout, pp);
}
else
{
- if (!pager_config->popup_urgent_stick)
- pp->timer = ecore_timer_add(pager_config->popup_urgent_speed,
- _pager_popup_cb_timeout, pp);
+ if (!pager_config->popup_urgent_stick)
+ pp->timer = ecore_timer_add(pager_config->popup_urgent_speed,
+ _pager_popup_cb_timeout, pp);
}
pp->urgent = urgent;
+ pager_popups = evas_list_append(pager_popups, pp);
+
return pp;
}
static void
_pager_popup_free(Pager_Popup *pp)
{
- pp->src_pager->popup = NULL;
if (pp->timer) ecore_timer_del(pp->timer);
evas_object_del(pp->o_bg);
_pager_free(pp->pager);
e_bindings_mouse_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win);
e_bindings_wheel_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win);
e_object_del(E_OBJECT(pp->popup));
+ pager_popups = evas_list_remove(pager_popups, pp);
free(pp);
}
+static Pager_Popup *_pager_popup_find(E_Zone *zone)
+{
+ Pager_Popup *pp;
+ Evas_List *l;
+
+ for(l = pager_popups; l; l = l->next)
+ {
+ pp = l->data;
+ pp->pager->zone == zone;
+ return pp;
+ }
+ return NULL;
+}
+
static void
_pager_cb_obj_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Instance *inst;
-
+
inst = data;
_pager_instance_drop_zone_recalc(inst);
}
@@ -750,7 +774,7 @@
{
Instance *inst;
Evas_Event_Mouse_Down *ev;
-
+
inst = data;
ev = event_info;
if ((ev->button == 3) && (!pager_config->menu))
@@ -758,16 +782,16 @@
E_Menu *mn;
E_Menu_Item *mi;
int cx, cy, cw, ch;
-
+
mn = e_menu_new();
e_menu_post_deactivate_callback_set(mn, _menu_cb_post, inst);
pager_config->menu = mn;
-
+
mi = e_menu_item_new(mn);
e_menu_item_label_set(mi, _("Configuration"));
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
e_menu_item_callback_set(mi, _pager_inst_cb_menu_configure, NULL);
-
+
if (e_configure_registry_exists("screen/virtual_desktops"))
{
mi = e_menu_item_new(mn);
@@ -775,9 +799,9 @@
e_util_menu_item_edje_icon_set(mi, "enlightenment/vdesktops");
e_menu_item_callback_set(mi, _pager_inst_cb_menu_virtual_desktops_dialog, inst);
}
-
+
e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0);
-
+
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch);
e_menu_activate_mouse(mn,
e_util_zone_current_get(e_manager_current_get()),
@@ -804,7 +828,17 @@
_config_pager_module(NULL);
}
-static void
+static E_Config_Dialog *
+_pager_config_dialog(E_Container *con, const char *params)
+{
+ if (!pager_config) return;
+ if (pager_config->config_dialog) return;
+ /* FIXME: pass zone config item */
+ _config_pager_module(NULL);
+ return pager_config->config_dialog;
+}
+
+static void
_pager_inst_cb_menu_virtual_desktops_dialog(void *data, E_Menu *m, E_Menu_Item *mi)
{
Instance *inst;
@@ -817,7 +851,7 @@
_pager_instance_drop_zone_recalc(Instance *inst)
{
Evas_Coord x, y, w, h;
-
+
evas_object_geometry_get(inst->o_pager, &x, &y, &w, &h);
e_drop_handler_geometry_set(inst->drop_handler, x, y, w, h);
}
@@ -1006,7 +1040,7 @@
{
Instance *inst;
Pager_Win *pw;
-
+
inst = l->data;
if (inst->pager->zone != ev->border->zone) continue;
pw = _pager_window_find(inst->pager, ev->border);
@@ -1075,7 +1109,7 @@
inst = l->data;
/* if this pager is not for the zone of the border */
- if (inst->pager->zone != ev->border->zone)
+ if (inst->pager->zone != ev->border->zone)
{
/* look at all desks in the pager */
for (l2 = inst->pager->desks; l2; l2 = l2->next)
@@ -1205,7 +1239,7 @@
Instance *inst;
inst = l->data;
- if (inst->pager->zone != ev->border->zone) continue;
+ if (inst->pager->zone != ev->border->zone) continue;
for (l2 = inst->pager->desks; l2; l2 = l2->next)
{
Pager_Desk *pd;
@@ -1264,7 +1298,7 @@
Instance *inst;
inst = l->data;
- if (inst->pager->zone != ev->border->zone) continue;
+ if (inst->pager->zone != ev->border->zone) continue;
for (l2 = inst->pager->desks; l2; l2 = l2->next)
{
Pager_Desk *pd;
@@ -1300,14 +1334,24 @@
{
E_Event_Border_Urgent_Change *ev;
Evas_List *l, *l2;
+ Pager_Popup *pp;
+ E_Zone *zone;
+ int urgent;
+ int urgent_cnt = 0;
ev = event;
+ zone = ev->border->zone;
+ urgent = ev->border->client.icccm.urgent;
+
+ /* this didnt handle the case when two windows became urgent at
+ the same time */
+
for (l = pager_config->instances; l; l = l->next)
{
Instance *inst;
inst = l->data;
- if (inst->pager->zone != ev->border->zone) continue;
+ if (inst->pager->zone != zone) continue;
for (l2 = inst->pager->desks; l2; l2 = l2->next)
{
Pager_Desk *pd;
@@ -1317,34 +1361,72 @@
pw = _pager_desk_window_find(pd, ev->border);
if (pw)
{
- if (ev->border->client.icccm.urgent)
+ if (urgent)
{
if (!(ev->border->iconic))
- edje_object_signal_emit(pd->o_desk,
- "e,state,urgent", "e");
- edje_object_signal_emit(pw->o_window,
+ edje_object_signal_emit(pd->o_desk,
+ "e,state,urgent", "e");
+ edje_object_signal_emit(pw->o_window,
"e,state,urgent", "e");
-
- if (pager_config->popup_urgent &&
- !inst->pager->popup)
- {
- _pager_popup_new(inst->pager, 1);
- }
}
else
{
+ /* FIXME this seems to be wrong - why set the
+ desk to not urgent when iconic, while
+ another window on that desk could still be urgent? */
if (!(ev->border->iconic))
- edje_object_signal_emit(pd->o_desk,
+ edje_object_signal_emit(pd->o_desk,
"e,state,not_urgent", "e");
- edje_object_signal_emit(pw->o_window,
+ edje_object_signal_emit(pw->o_window,
"e,state,not_urgent", "e");
+ }
+ }
+ }
+ }
- if (inst->pager->popup &&
- inst->pager->popup->urgent)
- {
- _pager_popup_free(inst->pager->popup);
- }
+ if(pager_config->popup_urgent)
+ {
+ pp = _pager_popup_find(zone);
+
+ if(!pp && urgent)
+ {
+ _pager_popup_new(zone, 1);
+ }
+ else if(pp)
+ {
+ for (l = pp->pager->desks; l; l = l->next)
+ {
+ Pager_Desk *pd;
+ Pager_Win *pw;
+
+ pd = l->data;
+ pw = _pager_desk_window_find(pd, ev->border);
+ if (!pw) continue;
+
+ if (urgent)
+ {
+ edje_object_signal_emit(pd->o_desk,
+ "e,state,urgent", "e");
+ edje_object_signal_emit(pw->o_window,
+ "e,state,urgent", "e");
+ pd->urgent++;
+ }
+ else
+ {
+ pd->urgent--;
+
+ if (!(pd->urgent))
+ edje_object_signal_emit(pd->o_desk,
+ "e,state,not_urgent", "e");
+
+ edje_object_signal_emit(pw->o_window,
+ "e,state,not_urgent", "e");
}
+ urgent_cnt += pd->urgent;
+ }
+ if(urgent_cnt == 0)
+ {
+ _pager_popup_free(pp);
}
}
}
@@ -1352,13 +1434,13 @@
return 1;
}
-static int
-_pager_cb_event_border_property(void *data, int type, void *event)
+static int
+_pager_cb_event_border_property(void *data, int type, void *event)
{
E_Event_Border_Property *ev;
Evas_List *l, *l2;
int found = 0;
-
+
ev = event;
for (l = pager_config->instances; l; l = l->next)
{
@@ -1376,7 +1458,7 @@
if (pw)
{
found = 1;
- if (ev->border->client.netwm.state.skip_pager)
+ if (ev->border->client.netwm.state.skip_pager)
{
pd->wins = evas_list_remove(pd->wins, pw);
_pager_window_free(pw);
@@ -1385,7 +1467,7 @@
}
}
if (found) return 1;
-
+
/* If we did not find this window in the pager, then add it because
* the skip_pager state may have changed to 1 */
for (l = pager_config->instances; l; l = l->next)
@@ -1403,13 +1485,13 @@
if (pd)
{
Pager_Win *pw;
-
+
pw = _pager_window_new(pd, ev->border);
if (pw)
{
Pager_Win *pw2 = NULL;
E_Border *bd;
-
+
pd->wins = evas_list_append(pd->wins, pw);
bd = e_util_desk_border_above(pw->border);
if (bd)
@@ -1426,15 +1508,15 @@
{
for (l2 = inst->pager->desks; l2; l2 = l2->next)
{
- Pager_Win *pw;
-
+ Pager_Win *pw;
+
pd = l2->data;
pw = _pager_window_new(pd, ev->border);
if (pw)
{
Pager_Win *pw2 = NULL;
E_Border *bd;
-
+
pd->wins = evas_list_append(pd->wins, pw);
bd = e_util_desk_border_above(pw->border);
if (bd)
@@ -1472,29 +1554,40 @@
{
E_Event_Desk_Show *ev;
Evas_List *l;
+ Pager_Desk *pd;
+ Pager_Popup *pp;
ev = event;
for (l = pager_config->instances; l; l = l->next)
{
Instance *inst;
- Pager_Desk *pd;
inst = l->data;
if (inst->pager->zone != ev->desk->zone) continue;
pd = _pager_desk_find(inst->pager, ev->desk);
- if (pd)
+
+ if (pd) _pager_desk_select(pd);
+ }
+
+ if(pager_config->popup)
+ {
+ if(!(pp = _pager_popup_find(ev->desk->zone)))
{
- _pager_desk_select(pd);
- if (pd->pager->popup) _pager_popup_free(pd->pager->popup);
- if (pager_config->popup)
- {
- Pager_Popup *pp;
-
- pp = _pager_popup_new(pd->pager, 0);
- }
+ _pager_popup_new(ev->desk->zone, 0);
+ }
+ else
+ {
+ pd = _pager_desk_find(pp->pager, ev->desk);
+
+ if (pd) _pager_desk_select(pd);
+
+ ecore_timer_del(pp->timer);
+ pp->timer = ecore_timer_add(pager_config->popup_speed,
+ _pager_popup_cb_timeout, pp);
}
}
+
return 1;
}
@@ -1529,13 +1622,13 @@
for (l = pager_config->instances; l; l = l->next)
{
Instance *inst;
-
+
inst = l->data;
if (inst->pager->zone->container != ev->container) continue;
for (l2 = inst->pager->desks; l2; l2 = l2->next)
{
Pager_Desk *pd;
-
+
pd = l2->data;
e_layout_virtual_size_set(pd->o_layout, pd->desk->zone->w,
pd->desk->zone->h);
@@ -1581,7 +1674,7 @@
if (pw->desk->pager->is_popup) return;
if (pw->border->lock_user_location) return;
if (ev->button == pager_config->btn_desk) return;
- if ((ev->button == pager_config->btn_drag) ||
+ if ((ev->button == pager_config->btn_drag) ||
(ev->button == pager_config->btn_noplace))
{
Evas_Coord ox, oy;
@@ -1595,7 +1688,7 @@
pw->drag.start = 1;
pw->drag.no_place = 0;
pw->drag.button = ev->button;
- if (ev->button == pager_config->btn_noplace)
+ if (ev->button == pager_config->btn_noplace)
pw->drag.no_place = 1;
}
}
@@ -1613,7 +1706,7 @@
if (ev->button == pager_config->btn_desk) return;
if ((ev->button == pager_config->btn_drag) ||
(ev->button == pager_config->btn_noplace))
- {
+ {
if (!pw->drag.from_pager)
{
if (!pw->drag.start) pw->desk->pager->just_dragged = 1;
@@ -1632,7 +1725,7 @@
ev = event_info;
pw = data;
-
+
if (!pw) return;
if (pw->desk->pager->is_popup) return;
/* prevent drag for a few pixels */
@@ -1645,7 +1738,7 @@
dy = pw->drag.y - ev->cur.output.y;
if (pw->desk && pw->desk->pager && pw->desk->pager->inst)
resist = pager_config->drag_resist;
-
+
if (((dx * dx) + (dy * dy)) <= (resist * resist)) return;
pw->desk->pager->dragging = 1;
@@ -1666,7 +1759,7 @@
pd = _pager_desk_at_coord(pw->desk->pager, mx, my);
if ((pd) && (!pw->drag.no_place))
{
- e_layout_coord_canvas_to_virtual(pd->o_layout,
+ e_layout_coord_canvas_to_virtual(pd->o_layout,
mx + pw->drag.dx,
my + pw->drag.dy, &vx, &vy);
if (pd != pw->desk)
@@ -1682,10 +1775,10 @@
Evas_Coord x, y, w, h;
const char *file = NULL, *part = NULL;
const char *drag_types[] = { "enlightenment/pager_win", "enlightenment/border" };
-
+
evas_object_geometry_get(pw->o_window, &x, &y, &w, &h);
evas_object_hide(pw->o_window);
-
+
drag = e_drag_new(pw->desk->pager->inst->gcc->gadcon->zone->container,
x, y, drag_types, 2, pw, -1,
_pager_window_cb_drag_convert,
@@ -1694,7 +1787,7 @@
o = edje_object_add(drag->evas);
edje_object_file_get(pw->o_window, &file, &part);
edje_object_file_set(o, file, part);
-
+
oo = o;
o = edje_object_add(drag->evas);
edje_object_file_get(pw->o_icon, &file, &part);
@@ -1703,7 +1796,7 @@
e_drag_object_set(drag, oo);
e_drag_resize(drag, w, h);
e_drag_start(drag, x - pw->drag.dx, y - pw->drag.dy);
-
+
/* this prevents the desk from switching on drags */
pw->drag.from_pager = pw->desk->pager;
pw->drag.from_pager->dragging = 1;
@@ -1749,20 +1842,20 @@
e_border_desk_set(pw->border, desk);
ecore_x_pointer_last_xy_get(&x, &y);
-
+
dx = (pw->border->w / 2);
dy = (pw->border->h / 2);
-
+
/* offset so that center of window is on mouse, but keep within desk bounds */
if (dx < x)
{
x -= dx;
- if ((pw->border->w < zone->w) &&
+ if ((pw->border->w < zone->w) &&
(x + pw->border->w > zone->x + zone->w))
x -= x + pw->border->w - (zone->x + zone->w);
}
else x = 0;
-
+
if (dy < y)
{
y -= dy;
@@ -1848,7 +1941,7 @@
for (l = inst->pager->desks; l && inst->pager->active_drop_pd; l = l->next)
{
Pager_Desk *pd;
-
+
pd = l->data;
if (pd == inst->pager->active_drop_pd)
{
@@ -1895,7 +1988,7 @@
else if (!strcmp(type, "enlightenment/border"))
{
Evas_Coord wx, wy, wx2, wy2;
-
+
bd = ev->data;
e_layout_coord_virtual_to_canvas(pd->o_layout, bd->x, bd->y, &wx, &wy);
e_layout_coord_virtual_to_canvas(pd->o_layout, bd->x + bd->w, bd->y + bd->h, &wx2, &wy2);
@@ -1905,7 +1998,7 @@
else if (!strcmp(type, "enlightenment/vdesktop"))
{
pd2 = ev->data;
- if (!pd2) return;
+ if (!pd2) return;
_pager_desk_switch(pd, pd2);
}
else
@@ -1914,12 +2007,12 @@
if (bd)
{
Evas_Coord nx, ny;
-
+
if (bd->iconic) e_border_uniconify(bd);
e_border_desk_set(bd, pd->desk);
if ((!pw) || ((pw) && (!pw->drag.no_place)))
{
- e_layout_coord_canvas_to_virtual(pd->o_layout,
+ e_layout_coord_canvas_to_virtual(pd->o_layout,
ev->x + xx + x + dx,
ev->y + yy + y + dy,
&nx, &ny);
@@ -1978,13 +2071,13 @@
if (!pd) return;
p = pd->pager;
- if ( p->is_popup &&
- (pd->desk == e_desk_current_get(pd->pager->zone)) )
+ /* if ( p->is_popup &&
+ (pd->desk == e_desk_current_get(pd->pager->zone)) )
{
- if (p->inst->pager->popup)
- _pager_popup_free(p->inst->pager->popup);
+ if (p->inst->pager->popup)
+ _pager_popup_free(p->inst->pager->popup);
}
-
+ */
/* FIXME: pd->pager->dragging is 0 when finishing a drag from desk to desk */
if ((ev->button == 1) && (!pd->pager->dragging) &&
(!pd->pager->just_dragged))
@@ -2030,7 +2123,7 @@
const char *drag_types[] = { "enlightenment/vdesktop" };
Pager_Win *pw;
Evas_List *l;
-
+
evas_object_geometry_get(pd->o_desk, &x, &y, &w, &h);
drag = e_drag_new(pd->pager->inst->gcc->gadcon->zone->container,
x, y, drag_types, 1, pd, -1,
@@ -2043,8 +2136,8 @@
evas_object_show(o);
/* redraw the desktop theme above */
- o = edje_object_add(drag->evas);
- e_theme_edje_object_set(o, "base/theme/modules/pager",
+ o = edje_object_add(drag->evas);
+ e_theme_edje_object_set(o, "base/theme/modules/pager",
"e/modules/pager/desk");
evas_object_show(o);
e_drag_object_set(drag, o);
@@ -2058,17 +2151,17 @@
for (l = pd->wins; l; l = l->next)
{
pw = l->data;
- if (!pw || pw->border->iconic
- || pw->border->client.netwm.state.skip_pager)
+ if (!pw || pw->border->iconic
+ || pw->border->client.netwm.state.skip_pager)
continue;
o = edje_object_add(drag->evas);
- e_theme_edje_object_set(o, "base/theme/modules/pager",
+ e_theme_edje_object_set(o, "base/theme/modules/pager",
"e/modules/pager/window");
e_layout_pack(oo, o);
e_layout_child_raise(o);
- e_layout_child_move(o,
- pw->border->x - pw->desk->desk->zone->x,
+ e_layout_child_move(o,
+ pw->border->x - pw->desk->desk->zone->x,
pw->border->y - pw->desk->desk->zone->y);
e_layout_child_resize(o, pw->border->w, pw->border->h);
evas_object_show(o);
@@ -2106,7 +2199,7 @@
if (!pd->desk) return;
desk = e_desk_current_get(
- e_zone_current_get(
+ e_zone_current_get(
e_container_current_get(
e_manager_current_get())));
for (l = pager_config->instances; l && !pd2; l = l->next)
@@ -2139,7 +2232,7 @@
if (pd->pager->is_popup) return;
- if (pager_config->flip_desk)
+ if (pager_config->flip_desk)
e_zone_desk_linear_flip_by(pd->desk->zone, ev->z);
}
@@ -2175,6 +2268,7 @@
E_CONFIG_VAL(D, T, popup_urgent, UINT);
E_CONFIG_VAL(D, T, popup_urgent_stick, UINT);
E_CONFIG_VAL(D, T, popup_urgent_speed, DOUBLE);
+ E_CONFIG_VAL(D, T, popup_pager_height, INT);
E_CONFIG_VAL(D, T, drag_resist, UINT);
E_CONFIG_VAL(D, T, scale, UCHAR);
E_CONFIG_VAL(D, T, resize, UCHAR);
@@ -2193,6 +2287,7 @@
pager_config->popup_urgent = 0;
pager_config->popup_urgent_stick = 0;
pager_config->popup_urgent_speed = 1.5;
+ pager_config->popup_pager_height = 60;
pager_config->drag_resist = 3;
pager_config->scale = 1;
pager_config->resize = PAGER_RESIZE_BOTH;
@@ -2206,6 +2301,7 @@
E_CONFIG_LIMIT(pager_config->popup_urgent, 0, 1);
E_CONFIG_LIMIT(pager_config->popup_urgent_stick, 0, 1);
E_CONFIG_LIMIT(pager_config->popup_urgent_speed, 0.1, 10.0);
+ E_CONFIG_LIMIT(pager_config->popup_pager_height, 20, 200);
E_CONFIG_LIMIT(pager_config->drag_resist, 0, 50);
E_CONFIG_LIMIT(pager_config->resize, PAGER_RESIZE_HORZ, PAGER_RESIZE_BOTH);
E_CONFIG_LIMIT(pager_config->flip_desk, 0, 1);
@@ -2249,7 +2345,7 @@
(E_EVENT_BORDER_ICON_CHANGE, _pager_cb_event_border_icon_change, NULL));
pager_config->handlers = evas_list_append
(pager_config->handlers, ecore_event_handler_add
- (E_EVENT_BORDER_URGENT_CHANGE,
+ (E_EVENT_BORDER_URGENT_CHANGE,
_pager_cb_event_border_urgent_change, NULL));
pager_config->handlers = evas_list_append
(pager_config->handlers, ecore_event_handler_add
@@ -2266,18 +2362,24 @@
pager_config->handlers = evas_list_append
(pager_config->handlers, ecore_event_handler_add
(E_EVENT_CONTAINER_RESIZE, _pager_cb_event_container_resize, NULL));
-
+
pager_config->module = m;
e_gadcon_provider_register(&_gadcon_class);
- return m;
+
+ e_configure_registry_item_add("extensions/pager", 40,
+ N_("Pager"), NULL,
+ "enlightenment/pager",
+ _pager_config_dialog);
+
+ return m;
}
EAPI int
e_modapi_shutdown(E_Module *m)
{
e_gadcon_provider_unregister(&_gadcon_class);
-
+
if (pager_config->config_dialog)
e_object_del(E_OBJECT(pager_config->config_dialog));
while (pager_config->handlers)
@@ -2285,13 +2387,16 @@
ecore_event_handler_del(pager_config->handlers->data);
pager_config->handlers = evas_list_remove_list(pager_config->handlers, pager_config->handlers);
}
-
+
if (pager_config->menu)
{
e_menu_post_deactivate_callback_set(pager_config->menu, NULL, NULL);
e_object_del(E_OBJECT(pager_config->menu));
pager_config->menu = NULL;
}
+
+ e_configure_registry_item_del("extensions/pager");
+
E_FREE(pager_config);
E_CONFIG_DD_FREE(conf_edd);
return 1;
Index: e_mod_main.h
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/modules/pager/e_mod_main.h,v
retrieving revision 1.53
diff -u -r1.53 e_mod_main.h
--- e_mod_main.h 31 Oct 2007 12:23:14 -0000 1.53
+++ e_mod_main.h 14 Dec 2007 21:47:52 -0000
@@ -26,6 +26,7 @@
unsigned int popup_urgent;
unsigned int popup_urgent_stick;
double popup_urgent_speed;
+ int popup_pager_height;
unsigned int drag_resist;
unsigned int scale;
unsigned char resize;
Index: e_mod_config.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/modules/pager/e_mod_config.c,v
retrieving revision 1.32
diff -u -r1.32 e_mod_config.c
--- e_mod_config.c 16 Jul 2007 03:15:17 -0000 1.32
+++ e_mod_config.c 14 Dec 2007 21:47:52 -0000
@@ -16,6 +16,7 @@
int show_popup_urgent;
int popup_urgent_stick;
double popup_urgent_speed;
+ int popup_pager_height;
int drag_resist;
unsigned int btn_drag;
unsigned int btn_noplace;
@@ -85,6 +86,7 @@
cfdata->show_popup_urgent = pager_config->popup_urgent;
cfdata->popup_urgent_stick = pager_config->popup_urgent_stick;
cfdata->popup_urgent_speed = pager_config->popup_urgent_speed;
+ cfdata->popup_pager_height = pager_config->popup_pager_height;
cfdata->drag_resist = pager_config->drag_resist;
cfdata->btn_drag = pager_config->btn_drag;
cfdata->btn_noplace = pager_config->btn_noplace;
@@ -169,6 +171,10 @@
of = e_widget_framelist_add(evas, _("Pager Popup Settings"), 0);
ob = e_widget_check_add(evas, _("Show Popup on desktop change"), &(cfdata->show_popup));
e_widget_framelist_object_append(of, ob);
+ ob = e_widget_label_add(evas, _("Popup Pager Height"));
+ e_widget_framelist_object_append(of, ob);
+ ob = e_widget_slider_add(evas, 1, 0, _("%.0f px"), 20.0, 200.0, 0.1, 0, NULL, &(cfdata->popup_pager_height), 200);
+ e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Popup Speed"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.1, 10.0, 0.1, 0, &(cfdata->popup_speed), NULL, 200);
@@ -202,6 +208,7 @@
pager_config->popup_urgent = cfdata->show_popup_urgent;
pager_config->popup_urgent_stick = cfdata->popup_urgent_stick;
pager_config->popup_urgent_speed = cfdata->popup_urgent_speed;
+ pager_config->popup_pager_height = cfdata->popup_pager_height;
pager_config->drag_resist = cfdata->drag_resist;
pager_config->btn_drag = cfdata->btn_drag;
pager_config->btn_noplace = cfdata->btn_noplace;
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel