raster pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=0ebafb3e77c4a1009c7e8144fb280c87873c8ad0

commit 0ebafb3e77c4a1009c7e8144fb280c87873c8ad0
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Mon Jul 21 11:39:32 2014 +0900

    elm win noblank property added - to disable screen blanking/saving
    
    @feature
    
    this adds a per-window property of "noblank". this implies turning
    offf the screensaver whenever there is a window visible with this
    property set on it. only x11 support atm.
---
 src/lib/elm_win.c  | 45 +++++++++++++++++++++++++++++++++++++++++++++
 src/lib/elm_win.eo | 30 ++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)

diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 8bd0d44..59dfc0e 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -213,6 +213,7 @@ struct _Elm_Win_Data
    Eina_Bool    maximized : 1;
    Eina_Bool    skip_focus : 1;
    Eina_Bool    floating : 1;
+   Eina_Bool    noblank : 1;
 };
 
 static const char SIG_DELETE_REQUEST[] = "delete,request";
@@ -309,6 +310,33 @@ _elm_win_first_frame_do(void *data, Evas *e EINA_UNUSED, 
void *event_info EINA_U
 }
 
 static void
+_win_noblank_eval(void)
+{
+   Eina_List *l;
+   Evas_Object *obj;
+   int noblanks = 0;
+
+#ifdef HAVE_ELEMENTARY_X
+   EINA_LIST_FOREACH(_elm_win_list, l, obj)
+     {
+        ELM_WIN_DATA_GET(obj, sd);
+
+        if (sd->x.xwin)
+          {
+             if ((sd->noblank) && (!sd->iconified) && (!sd->withdrawn) &&
+                 evas_object_visible_get(obj))
+             noblanks++;
+          }
+     }
+   if (noblanks > 0) ecore_x_screensaver_supend();
+   else ecore_x_screensaver_resume();
+#endif
+#ifdef HAVE_ELEMENTARY_WAYLAND
+   // XXX: no wl implementation of this yet - maybe higher up at prop level
+#endif
+}
+
+static void
 _elm_win_state_eval(void *data EINA_UNUSED)
 {
    Eina_List *l;
@@ -398,6 +426,7 @@ _elm_win_state_eval(void *data EINA_UNUSED)
                }
           }
      }
+   _win_noblank_eval();
 }
 
 static void
@@ -3360,6 +3389,22 @@ _elm_win_type_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
    return sd->type;
 }
 
+EOLIAN static void
+_elm_win_noblank_set(Eo *obj EINA_UNUSED, Elm_Win_Data *pd, Eina_Bool noblank)
+{
+   noblank = !!noblank;
+   if (pd->noblank == noblank) return;
+   pd->noblank = noblank;
+   _win_noblank_eval();
+}
+
+EOLIAN static Eina_Bool
+_elm_win_noblank_get(Eo *obj EINA_UNUSED, Elm_Win_Data *pd)
+{
+   return pd->noblank;
+}
+
+
 EAPI Evas_Object *
 elm_win_util_standard_add(const char *name,
                           const char *title)
diff --git a/src/lib/elm_win.eo b/src/lib/elm_win.eo
index b2b564f..2981f1b 100644
--- a/src/lib/elm_win.eo
+++ b/src/lib/elm_win.eo
@@ -1149,6 +1149,36 @@ class Elm_Win (Elm_Widget, Elm_Interface_Atspi_Window)
             return Elm_Win_Type;
          }
       }
+      noblank {
+         set {
+            /*@
+            Set the noblank property of a window.
+
+            The "noblank" property is a way to request the display on which
+            the windowis shown does not blank, screensave or otherwise hide
+            or obscure the window. It is intended for uses such as media
+            playback on a television where a user may not want to be
+            interrupted by an idle screen. The noblank property may have no
+            effect if the window is iconified/minimized or hidden.
+
+            @since 1.11
+
+            @ingroup Win */
+         }
+         get {
+            /*@
+            Get the noblank property of a window.
+
+            @return If true, the window has "noblank" set.
+
+            @since 1.11
+
+            @ingroup Win */
+         }
+         values {
+            bool noblank; /*@ If true, the window is set to noblank */
+         }
+      }
    }
    methods {
       wm_manual_rotation_done {

-- 


Reply via email to