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.
This commit is contained in:
Carsten Haitzler 2014-07-21 11:39:32 +09:00
parent 138ab6509d
commit 057611a7e4
2 changed files with 75 additions and 0 deletions

View File

@ -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";
@ -308,6 +309,33 @@ _elm_win_first_frame_do(void *data, Evas *e EINA_UNUSED, void *event_info EINA_U
evas_event_callback_del_full(e, EVAS_CALLBACK_RENDER_POST, _elm_win_first_frame_do, data);
}
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)
{
@ -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)

View File

@ -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 {