(It's always better with the patches ;D)
Hello!
After some days of happy hacking, here are some patches...
>module_randr_dialog_clock.patch : adds a clock in the acceptation dialog.
>fullscreen_background_show.patch : when a border is put in fullscreen mode, a
black background object was created, but never shown, so that leaded to display
corruption when playing a bit.
>no_borderless_when_fullscreen.patch : disable borderless in border menu when in
fullscreen mode (already borderless).
>exit_dialog_typo.patch : callbacks are not correctly associated with buttons.
>e_dialog_keyboard_focus.patch : when we have only one button, do not
unfocus/refocus it with [tab].
>modules_about_dialog.patch : as it is about modules, why not displaying modules
icon instead of e icon? :p Should be even better to display that module icon...
>e_menu_various.patch : adds several things...
- support KeyPad equivalent for keybindings (numbers as well as directions).
- add [home] [end] support : will go to the first/last menu item
- 0 will go to the last menu item instead of going to the 10th one.
- corrected the bug when the first menu item was activated *twice* when
creating a POP_DIRECTION_DOWN menu with keyboard <- passed a few hours on this
trying to figure why it was happening
- do not activate an already active menu item
Hope it helps.
Cheers !
--
ilLogict
Website: http://illogict.online.fr
E-Mail: [EMAIL PROTECTED]
AIM/NIM: illogict
Yahoo: illogict
MSN: [EMAIL PROTECTED]
ICQ: #74274856
Infos: E17 rocks!
Le nettoyage de ligne, quelle chose efficace ! (1900->4700 @60dB)
Index: apps/e/src/modules/randr/e_mod_main.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/randr/e_mod_main.c,v
retrieving revision 1.17
diff -u -r1.17 e_mod_main.c
--- apps/e/src/modules/randr/e_mod_main.c 26 Sep 2005 16:39:46 -0000 1.17
+++ apps/e/src/modules/randr/e_mod_main.c 5 Oct 2005 12:59:10 -0000
@@ -8,7 +8,6 @@
* TODO:
* * Check if randr is available. It might be disabled in
* ecore_x, or not available on screen
- * * Make a clock ticking down on the dialog
* * Add destroy callback for dialog
*/
@@ -294,6 +293,7 @@
{
Randr *e;
Randr_Resolution *res;
+ char buf[PATH_MAX];
e = data;
res = e_object_data_get(E_OBJECT(mi));
@@ -304,18 +304,26 @@
if (e->dialog) e_object_del(E_OBJECT(e->dialog));
if (e->timer) ecore_timer_del(e->timer);
+ e->timer_iterations = 15;
e->dialog = e_dialog_new(m->zone->container);
- e_dialog_title_set(e->dialog, "Resolution change");
- e_dialog_text_set(e->dialog, "Keep new resolution?");
- e_dialog_button_add(e->dialog, "OK", NULL, _randr_dialog_cb_ok, res);
- e_dialog_button_add(e->dialog, "Cancel", NULL, _randr_dialog_cb_cancel, res);
+ e_dialog_title_set(e->dialog, _("Resolution change"));
+ snprintf(buf, sizeof(buf),
+ _("Keep new resolution <hilight>%dx%d</hilight>?<br><br>"
+ "Restoring old resolution %dx%d in %d seconds."),
+ res->next.width, res->next.height,
+ res->prev.width, res->prev.height,
+ e->timer_iterations);
+ e_dialog_text_set(e->dialog, buf);
+ e_dialog_button_add(e->dialog, _("Yes"), NULL, _randr_dialog_cb_ok, res);
+ e_dialog_button_add(e->dialog, _("No"), NULL, _randr_dialog_cb_cancel, res);
+ e_dialog_button_focus_num(e->dialog, 1);
e_win_borderless_set(e->dialog->win, 1);
e_win_layer_set(e->dialog->win, 6);
e_win_centered_set(e->dialog->win, 1);
e_win_sticky_set(e->dialog->win, 1);
e_dialog_show(e->dialog);
- e->timer = ecore_timer_add(15.0, _randr_timer_cb, res);
+ e->timer = ecore_timer_add(1.0, _randr_timer_cb, res);
}
static void
@@ -361,15 +369,43 @@
{
Randr_Resolution *res;
- /* Restore old resolution */
res = data;
- ecore_x_randr_screen_size_set(res->manager->root, res->prev);
- e_object_unref(E_OBJECT(res->manager));
- e_object_del(E_OBJECT(res->randr->dialog));
- res->randr->dialog = NULL;
- res->randr->timer = NULL;
- free(res);
- return 0;
+
+ if (res->randr->timer_iterations > 1)
+ {
+ char buf[PATH_MAX];
+ -- res->randr->timer_iterations;
+ if (res->randr->timer_iterations > 1)
+ {
+ snprintf(buf, sizeof(buf),
+ _("Keep new resolution <hilight>%dx%d</hilight>?<br><br>"
+ "Restoring old resolution %dx%d in %d seconds."),
+ res->next.width, res->next.height,
+ res->prev.width, res->prev.height,
+ res->randr->timer_iterations);
+ }
+ else
+ {
+ snprintf(buf, sizeof(buf),
+ _("Keep new resolution <hilight>%dx%d</hilight>?<br><br>"
+ "Restoring old resolution %dx%d NOW!"),
+ res->next.width, res->next.height,
+ res->prev.width, res->prev.height);
+ }
+ e_dialog_text_set(res->randr->dialog, buf);
+ return 1;
+ }
+ else
+ {
+ /* Restore old resolution */
+ ecore_x_randr_screen_size_set(res->manager->root, res->prev);
+ e_object_unref(E_OBJECT(res->manager));
+ e_object_del(E_OBJECT(res->randr->dialog));
+ res->randr->dialog = NULL;
+ res->randr->timer = NULL;
+ free(res);
+ return 0;
+ }
}
static void
Index: apps/e/src/modules/randr/e_mod_main.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/randr/e_mod_main.h,v
retrieving revision 1.6
diff -u -r1.6 e_mod_main.h
--- apps/e/src/modules/randr/e_mod_main.h 24 Sep 2005 13:42:05 -0000 1.6
+++ apps/e/src/modules/randr/e_mod_main.h 5 Oct 2005 12:59:10 -0000
@@ -30,6 +30,7 @@
E_Int_Menu_Augmentation *augmentation;
Ecore_Timer *timer;
+ int timer_iterations;
E_Dialog *dialog;
Config *conf;
Index: apps/e/src/bin/e_zone.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_zone.c,v
retrieving revision 1.78
diff -u -r1.78 e_zone.c
--- apps/e/src/bin/e_zone.c 29 Sep 2005 15:43:37 -0000 1.78
+++ apps/e/src/bin/e_zone.c 5 Oct 2005 12:59:10 -0000
@@ -119,6 +119,8 @@
evas_object_move(o, 0, 0);
evas_object_resize(o, zone->w, zone->h);
evas_object_color_set(o, 0, 0, 0, 255);
+ evas_object_show(o);
+
ecore_evas_name_class_set(zone->black_ecore_evas, "E", "Black_Window");
snprintf(name, sizeof(name), "Enlightenment Black Zone (%d)", zone->num);
ecore_evas_title_set(zone->black_ecore_evas, name);
Index: apps/e/src/bin/e_border.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.438
diff -u -r1.438 e_border.c
--- apps/e/src/bin/e_border.c 29 Sep 2005 15:01:04 -0000 1.438
+++ apps/e/src/bin/e_border.c 5 Oct 2005 12:59:09 -0000
@@ -2638,6 +2638,8 @@
{
E_Event_Border_Remove *ev;
+ e_border_hide(bd, 0);
+
if (bd->border_menu) e_menu_deactivate(bd->border_menu);
_e_border_menus_del(bd);
@@ -6407,7 +6409,7 @@
(char *)e_theme_edje_file_get("base/theme/borders",
"widgets/border/default/stacking"),
"widgets/border/default/stacking");
- if ((!bd->shaded) && (!bd->lock_border))
+ if ((!bd->shaded) & (!bd->fullscreen) && (!bd->lock_border))
{
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Borderless"));
Index: apps/e/src/bin/e_actions.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_actions.c,v
retrieving revision 1.36
diff -u -r1.36 e_actions.c
--- apps/e/src/bin/e_actions.c 29 Sep 2005 15:26:34 -0000 1.36
+++ apps/e/src/bin/e_actions.c 5 Oct 2005 12:59:08 -0000
@@ -1198,8 +1198,9 @@
));
e_dialog_icon_set(exit_dialog, "enlightenment/exit", 64);
e_dialog_button_add(exit_dialog, _("Yes"), NULL,
- _e_actions_cb_exit_dialog_ok, _e_actions_cb_exit_dialog_cancel);
- e_dialog_button_add(exit_dialog, _("No"), NULL, NULL, NULL);
+ _e_actions_cb_exit_dialog_ok, NULL);
+ e_dialog_button_add(exit_dialog, _("No"), NULL,
+ _e_actions_cb_exit_dialog_cancel, NULL);
e_dialog_button_focus_num(exit_dialog, 1);
e_win_centered_set(exit_dialog->win, 1);
e_dialog_show(exit_dialog);
Index: apps/e/src/bin/e_dialog.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dialog.c,v
retrieving revision 1.22
diff -u -r1.22 e_dialog.c
--- apps/e/src/bin/e_dialog.c 30 Sep 2005 02:11:49 -0000 1.22
+++ apps/e/src/bin/e_dialog.c 5 Oct 2005 12:59:09 -0000
@@ -319,10 +319,9 @@
{
if (dia->focused && dia->buttons)
{
- E_Dialog_Button *db;
+ E_Dialog_Button *db, *ndb;
db = dia->focused->data;
- edje_object_signal_emit(db->obj, "unfocus", "");
if (evas_key_modifier_is_set(evas_key_modifier_get(e_win_evas_get(dia->win)), "Shift"))
{
if (dia->focused->prev) dia->focused = dia->focused->prev;
@@ -333,9 +332,13 @@
if (dia->focused->next) dia->focused = dia->focused->next;
else dia->focused = dia->buttons;
}
- db = evas_list_data(dia->focused);
- edje_object_signal_emit(db->obj, "focus", "");
- edje_object_signal_emit(db->obj, "enter", "");
+ ndb = evas_list_data(dia->focused);
+ if (ndb != db)
+ {
+ edje_object_signal_emit(db->obj, "unfocus", "");
+ edje_object_signal_emit(ndb->obj, "focus", "");
+ edje_object_signal_emit(ndb->obj, "enter", "");
+ }
}
else
Index: apps/e/src/bin/e_module.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_module.c,v
retrieving revision 1.41
diff -u -r1.41 e_module.c
--- apps/e/src/bin/e_module.c 30 Sep 2005 14:10:28 -0000 1.41
+++ apps/e/src/bin/e_module.c 5 Oct 2005 12:59:10 -0000
@@ -382,9 +382,10 @@
if (!dia) return;
e_dialog_title_set(dia, title);
- e_dialog_icon_set(dia, "enlightenment/e", 64);
+ e_dialog_icon_set(dia, "enlightenment/modules", 64);
e_dialog_text_set(dia, body);
- e_dialog_button_add(dia, _("Ok"), NULL, NULL, NULL);
+ e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
+ e_dialog_button_focus_num(dia, 0);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
}
Index: apps/e/src/bin/e_menu.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_menu.c,v
retrieving revision 1.40
diff -u -r1.40 e_menu.c
--- apps/e/src/bin/e_menu.c 5 Sep 2005 15:24:07 -0000 1.40
+++ apps/e/src/bin/e_menu.c 5 Oct 2005 12:59:10 -0000
@@ -40,6 +40,9 @@
static int _e_menu_active_call (void);
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_activate_next (void);
static void _e_menu_activate_previous (void);
static void _e_menu_activate_first (void);
@@ -173,6 +176,7 @@
_e_menu_activate_last();
break;
case E_MENU_POP_DIRECTION_DOWN:
+ _e_menu_realize(m);
m->cur.x = x + w;
m->cur.y = y + h;
_e_menu_activate_first();
@@ -629,6 +633,7 @@
E_Menu_Item *pmi;
pmi = _e_menu_item_active_get();
+ if (mi == pmi) return;
if (pmi) e_menu_item_active_set(pmi, 0);
mi->active = 1;
if (mi->bg_object)
@@ -1794,6 +1799,85 @@
}
static void
+_e_menu_item_activate_first(void)
+{
+ E_Menu *m;
+ Evas_List *ll;
+ E_Menu_Item *mi;
+
+ /* FIXME: inefficient. should track current menu and active item */
+ m = _e_menu_active_get();
+ if (m)
+ {
+ ll = m->items;
+ mi = ll->data;
+ while ((mi->separator) && (ll->next))
+ {
+ ll = ll->next;
+ mi = ll->data;
+ }
+ if (mi->separator) return;
+ e_menu_item_active_set(mi, 1);
+ _e_menu_item_ensure_onscreen(mi);
+ return;
+ }
+ _e_menu_activate_first();
+}
+
+static void
+_e_menu_item_activate_last(void)
+{
+ E_Menu *m;
+ Evas_List *ll;
+ E_Menu_Item *mi;
+
+ /* FIXME: inefficient. should track current menu and active item */
+ m = _e_menu_active_get();
+ if (m)
+ {
+ ll = evas_list_last(m->items);
+ mi = ll->data;
+ while ((mi->separator) && (ll->prev))
+ {
+ ll = ll->prev;
+ mi = ll->data;
+ }
+ if (mi->separator) return;
+ e_menu_item_active_set(mi, 1);
+ _e_menu_item_ensure_onscreen(mi);
+ return;
+ }
+ _e_menu_activate_first();
+}
+
+static void
+_e_menu_item_activate_nth(int n)
+{
+ E_Menu *m;
+ E_Menu_Item *mi;
+ Evas_List *ll;
+ int i;
+
+ mi = _e_menu_item_active_get();
+ if (!mi)
+ {
+ _e_menu_activate_first();
+ mi = _e_menu_item_active_get();
+ if (!mi) return;
+ }
+ m = mi->menu;
+ for (i = -1, ll = m->items; ll; ll = ll->next)
+ {
+ mi = ll->data;
+ if (!mi->separator) i++;
+ if (i == n) break;
+ }
+ e_menu_item_active_set(mi, 1);
+ _e_menu_item_ensure_onscreen(mi);
+
+}
+
+static void
_e_menu_activate_next(void)
{
E_Menu_Item *mi;
@@ -2208,45 +2292,56 @@
ev = event;
if (ev->win != _e_menu_win) return 1;
- if (!strcmp(ev->keysymbol, "Up"))
+ if ((!strcmp(ev->keysymbol, "Up")) ||
+ (!strcmp(ev->keysymbol, "KP_Up")))
_e_menu_item_activate_previous();
- else if (!strcmp(ev->keysymbol, "Down"))
+ else if ((!strcmp(ev->keysymbol, "Down")) ||
+ (!strcmp(ev->keysymbol, "KP_Down")))
_e_menu_item_activate_next();
- else if (!strcmp(ev->keysymbol, "Left"))
+ else if ((!strcmp(ev->keysymbol, "Left")) ||
+ (!strcmp(ev->keysymbol, "KP_Left")))
_e_menu_activate_previous();
- else if (!strcmp(ev->keysymbol, "Right"))
+ else if ((!strcmp(ev->keysymbol, "Right")) ||
+ (!strcmp(ev->keysymbol, "KP_Right")))
_e_menu_activate_next();
+ else if ((!strcmp(ev->keysymbol, "Home")) ||
+ (!strcmp(ev->keysymbol, "KP_Home")))
+ _e_menu_item_activate_first();
+ else if ((!strcmp(ev->keysymbol, "End")) ||
+ (!strcmp(ev->keysymbol, "KP_End")))
+ _e_menu_item_activate_last();
else if (!strcmp(ev->keysymbol, "space"))
{
_e_menu_active_call();
}
- else if (!strcmp(ev->keysymbol, "Return"))
+ else if ((!strcmp(ev->keysymbol, "Return")) ||
+ (!strcmp(ev->keysymbol, "KP_Enter")))
{
_e_menu_active_call();
_e_menu_deactivate_all();
}
else if (!strcmp(ev->keysymbol, "Escape"))
_e_menu_deactivate_all();
- else if (!strcmp(ev->keysymbol, "1"))
- _e_menu_activate_nth(0);
- else if (!strcmp(ev->keysymbol, "2"))
- _e_menu_activate_nth(1);
- else if (!strcmp(ev->keysymbol, "3"))
- _e_menu_activate_nth(2);
- else if (!strcmp(ev->keysymbol, "4"))
- _e_menu_activate_nth(3);
- else if (!strcmp(ev->keysymbol, "5"))
- _e_menu_activate_nth(4);
- else if (!strcmp(ev->keysymbol, "6"))
- _e_menu_activate_nth(5);
- else if (!strcmp(ev->keysymbol, "7"))
- _e_menu_activate_nth(6);
- else if (!strcmp(ev->keysymbol, "8"))
- _e_menu_activate_nth(7);
- else if (!strcmp(ev->keysymbol, "9"))
- _e_menu_activate_nth(8);
- else if (!strcmp(ev->keysymbol, "0"))
- _e_menu_activate_nth(9);
+ else if ((!strcmp(ev->keysymbol, "1")) || (!strcmp(ev->keysymbol, "KP_1")))
+ _e_menu_item_activate_first();
+ else if ((!strcmp(ev->keysymbol, "2")) || (!strcmp(ev->keysymbol, "KP_2")))
+ _e_menu_item_activate_nth(1);
+ else if ((!strcmp(ev->keysymbol, "3")) || (!strcmp(ev->keysymbol, "KP_3")))
+ _e_menu_item_activate_nth(2);
+ else if ((!strcmp(ev->keysymbol, "4")) || (!strcmp(ev->keysymbol, "KP_4")))
+ _e_menu_item_activate_nth(3);
+ else if ((!strcmp(ev->keysymbol, "5")) || (!strcmp(ev->keysymbol, "KP_5")))
+ _e_menu_item_activate_nth(4);
+ else if ((!strcmp(ev->keysymbol, "6")) || (!strcmp(ev->keysymbol, "KP_6")))
+ _e_menu_item_activate_nth(5);
+ else if ((!strcmp(ev->keysymbol, "7")) || (!strcmp(ev->keysymbol, "KP_7")))
+ _e_menu_item_activate_nth(6);
+ else if ((!strcmp(ev->keysymbol, "8")) || (!strcmp(ev->keysymbol, "KP_8")))
+ _e_menu_item_activate_nth(7);
+ else if ((!strcmp(ev->keysymbol, "9")) || (!strcmp(ev->keysymbol, "KP_9")))
+ _e_menu_item_activate_nth(8);
+ else if ((!strcmp(ev->keysymbol, "0")) || (!strcmp(ev->keysymbol, "KP_0")))
+ _e_menu_item_activate_last();
return 1;
}