minor improvements to dialogs asking to enter presentation mode.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Wed, 6 May 2009 12:00:19 +0000 (12:00 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Wed, 6 May 2009 12:00:19 +0000 (12:00 +0000)
SVN revision: 40521

src/bin/e_desklock.c
src/bin/e_screensaver.c

index 6491587..a3fcc85 100644 (file)
@@ -141,7 +141,8 @@ _user_wallpaper_get(void)
 EAPI int
 e_desklock_show_autolocked(void)
 {
-   _e_desklock_autolock_time = ecore_loop_time_get();
+   if (_e_desklock_autolock_time < 1.0)
+     _e_desklock_autolock_time = ecore_loop_time_get();
    return e_desklock_show();
 }
 
@@ -927,7 +928,7 @@ _e_desklock_cb_idle_poller(void *data)
        idle = ecore_x_screensaver_idle_time_get();
        max = e_config->desklock_autolock_idle_timeout;
        if (_e_desklock_ask_presentation_count > 0)
-         max *= _e_desklock_ask_presentation_count;
+         max *= (1 + _e_desklock_ask_presentation_count);
 
        /* If we have exceeded our idle time... */
         if (idle >= max)
@@ -1004,6 +1005,18 @@ _e_desklock_ask_presentation_no_forever(void *data __UNUSED__, E_Dialog *dia)
 }
 
 static void
+_e_desklock_ask_presentation_key_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event)
+{
+   Evas_Event_Key_Down *ev = event;
+   E_Dialog *dia = data;
+
+   if (strcmp(ev->keyname, "Return") == 0)
+     _e_desklock_ask_presentation_yes(NULL, dia);
+   else if (strcmp(ev->keyname, "Escape") == 0)
+     _e_desklock_ask_presentation_no(NULL, dia);
+}
+
+static void
 _e_desklock_ask_presentation_mode(void)
 {
    E_Manager *man;
@@ -1048,5 +1061,9 @@ _e_desklock_ask_presentation_mode(void)
    e_win_centered_set(dia->win, 1);
    e_dialog_show(dia);
 
+   evas_object_event_callback_add
+     (dia->bg_object, EVAS_CALLBACK_KEY_DOWN,
+      _e_desklock_ask_presentation_key_down, dia);
+
    _e_desklock_ask_presentation_dia = dia;
 }
index fa3d4ba..4d241bc 100644 (file)
@@ -45,7 +45,7 @@ _e_screensaver_ask_presentation_no_increase(void *data __UNUSED__, E_Dialog *dia
    int timeout, interval, blanking, expose;
 
    _e_screensaver_ask_presentation_count++;
-   timeout = e_config->screensaver_timeout * _e_screensaver_ask_presentation_count;
+   timeout = e_config->screensaver_timeout * (1 + _e_screensaver_ask_presentation_count);
    interval = e_config->screensaver_interval;
    blanking = e_config->screensaver_blanking;
    expose = e_config->screensaver_expose;
@@ -64,6 +64,18 @@ _e_screensaver_ask_presentation_no_forever(void *data __UNUSED__, E_Dialog *dia)
 }
 
 static void
+_e_screensaver_ask_presentation_key_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event)
+{
+   Evas_Event_Key_Down *ev = event;
+   E_Dialog *dia = data;
+
+   if (strcmp(ev->keyname, "Return") == 0)
+     _e_screensaver_ask_presentation_yes(NULL, dia);
+   else if (strcmp(ev->keyname, "Escape") == 0)
+     _e_screensaver_ask_presentation_no(NULL, dia);
+}
+
+static void
 _e_screensaver_ask_presentation_mode(void)
 {
    E_Manager *man;
@@ -108,6 +120,10 @@ _e_screensaver_ask_presentation_mode(void)
    e_win_centered_set(dia->win, 1);
    e_dialog_show(dia);
 
+   evas_object_event_callback_add
+     (dia->bg_object, EVAS_CALLBACK_KEY_DOWN,
+      _e_screensaver_ask_presentation_key_down, dia);
+
    _e_screensaver_ask_presentation_dia = dia;
 }