diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2014-07-21 11:39:32 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2014-07-21 11:39:32 +0900 |
commit | 0ebafb3e77c4a1009c7e8144fb280c87873c8ad0 (patch) | |
tree | 116f236993c63812a88587824fc8ffd5fb519e54 /src/lib | |
parent | 661d2d9474a0344df74f30f0ce401bdaacc4fa67 (diff) |
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.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/elm_win.c | 45 | ||||
-rw-r--r-- | src/lib/elm_win.eo | 30 |
2 files changed, 75 insertions, 0 deletions
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 8bd0d4497..59dfc0e16 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c | |||
@@ -213,6 +213,7 @@ struct _Elm_Win_Data | |||
213 | Eina_Bool maximized : 1; | 213 | Eina_Bool maximized : 1; |
214 | Eina_Bool skip_focus : 1; | 214 | Eina_Bool skip_focus : 1; |
215 | Eina_Bool floating : 1; | 215 | Eina_Bool floating : 1; |
216 | Eina_Bool noblank : 1; | ||
216 | }; | 217 | }; |
217 | 218 | ||
218 | static const char SIG_DELETE_REQUEST[] = "delete,request"; | 219 | 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 | |||
309 | } | 310 | } |
310 | 311 | ||
311 | static void | 312 | static void |
313 | _win_noblank_eval(void) | ||
314 | { | ||
315 | Eina_List *l; | ||
316 | Evas_Object *obj; | ||
317 | int noblanks = 0; | ||
318 | |||
319 | #ifdef HAVE_ELEMENTARY_X | ||
320 | EINA_LIST_FOREACH(_elm_win_list, l, obj) | ||
321 | { | ||
322 | ELM_WIN_DATA_GET(obj, sd); | ||
323 | |||
324 | if (sd->x.xwin) | ||
325 | { | ||
326 | if ((sd->noblank) && (!sd->iconified) && (!sd->withdrawn) && | ||
327 | evas_object_visible_get(obj)) | ||
328 | noblanks++; | ||
329 | } | ||
330 | } | ||
331 | if (noblanks > 0) ecore_x_screensaver_supend(); | ||
332 | else ecore_x_screensaver_resume(); | ||
333 | #endif | ||
334 | #ifdef HAVE_ELEMENTARY_WAYLAND | ||
335 | // XXX: no wl implementation of this yet - maybe higher up at prop level | ||
336 | #endif | ||
337 | } | ||
338 | |||
339 | static void | ||
312 | _elm_win_state_eval(void *data EINA_UNUSED) | 340 | _elm_win_state_eval(void *data EINA_UNUSED) |
313 | { | 341 | { |
314 | Eina_List *l; | 342 | Eina_List *l; |
@@ -398,6 +426,7 @@ _elm_win_state_eval(void *data EINA_UNUSED) | |||
398 | } | 426 | } |
399 | } | 427 | } |
400 | } | 428 | } |
429 | _win_noblank_eval(); | ||
401 | } | 430 | } |
402 | 431 | ||
403 | static void | 432 | static void |
@@ -3360,6 +3389,22 @@ _elm_win_type_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) | |||
3360 | return sd->type; | 3389 | return sd->type; |
3361 | } | 3390 | } |
3362 | 3391 | ||
3392 | EOLIAN static void | ||
3393 | _elm_win_noblank_set(Eo *obj EINA_UNUSED, Elm_Win_Data *pd, Eina_Bool noblank) | ||
3394 | { | ||
3395 | noblank = !!noblank; | ||
3396 | if (pd->noblank == noblank) return; | ||
3397 | pd->noblank = noblank; | ||
3398 | _win_noblank_eval(); | ||
3399 | } | ||
3400 | |||
3401 | EOLIAN static Eina_Bool | ||
3402 | _elm_win_noblank_get(Eo *obj EINA_UNUSED, Elm_Win_Data *pd) | ||
3403 | { | ||
3404 | return pd->noblank; | ||
3405 | } | ||
3406 | |||
3407 | |||
3363 | EAPI Evas_Object * | 3408 | EAPI Evas_Object * |
3364 | elm_win_util_standard_add(const char *name, | 3409 | elm_win_util_standard_add(const char *name, |
3365 | const char *title) | 3410 | const char *title) |
diff --git a/src/lib/elm_win.eo b/src/lib/elm_win.eo index b2b564fdc..2981f1b5d 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) | |||
1149 | return Elm_Win_Type; | 1149 | return Elm_Win_Type; |
1150 | } | 1150 | } |
1151 | } | 1151 | } |
1152 | noblank { | ||
1153 | set { | ||
1154 | /*@ | ||
1155 | Set the noblank property of a window. | ||
1156 | |||
1157 | The "noblank" property is a way to request the display on which | ||
1158 | the windowis shown does not blank, screensave or otherwise hide | ||
1159 | or obscure the window. It is intended for uses such as media | ||
1160 | playback on a television where a user may not want to be | ||
1161 | interrupted by an idle screen. The noblank property may have no | ||
1162 | effect if the window is iconified/minimized or hidden. | ||
1163 | |||
1164 | @since 1.11 | ||
1165 | |||
1166 | @ingroup Win */ | ||
1167 | } | ||
1168 | get { | ||
1169 | /*@ | ||
1170 | Get the noblank property of a window. | ||
1171 | |||
1172 | @return If true, the window has "noblank" set. | ||
1173 | |||
1174 | @since 1.11 | ||
1175 | |||
1176 | @ingroup Win */ | ||
1177 | } | ||
1178 | values { | ||
1179 | bool noblank; /*@ If true, the window is set to noblank */ | ||
1180 | } | ||
1181 | } | ||
1152 | } | 1182 | } |
1153 | methods { | 1183 | methods { |
1154 | wm_manual_rotation_done { | 1184 | wm_manual_rotation_done { |