aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/lib/elm_win.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-09-04 15:09:10 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-09-04 15:09:10 +0900
commitdada522426bbefd3291f8c02d077fc93aeeb7c16 (patch)
tree607d208d02e0fd4697a11b1225cfa5a912e8cca7 /legacy/elementary/src/lib/elm_win.c
parentelm_map: the widget use efreet cache home to save image files to, so efreet s... (diff)
downloadefl-dada522426bbefd3291f8c02d077fc93aeeb7c16.tar.gz
elm process state - add events and state get function
this adds the ability to query current process state, and get events idicating a change in process state and what change that was. @feature
Diffstat (limited to 'legacy/elementary/src/lib/elm_win.c')
-rw-r--r--legacy/elementary/src/lib/elm_win.c69
1 files changed, 42 insertions, 27 deletions
diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c
index a5f93edafa..1de2075789 100644
--- a/legacy/elementary/src/lib/elm_win.c
+++ b/legacy/elementary/src/lib/elm_win.c
@@ -345,6 +345,15 @@ _win_noblank_eval(void)
#endif
}
+static Elm_Process_State _elm_process_state = ELM_PROCESS_STATE_FOREGROUND;
+
+EAPI Elm_Process_State
+elm_process_state_get(void)
+{
+ return _elm_process_state;
+}
+
+
static void
_elm_win_state_eval(void *data EINA_UNUSED)
{
@@ -353,6 +362,7 @@ _elm_win_state_eval(void *data EINA_UNUSED)
int _elm_win_count_shown = 0;
int _elm_win_count_iconified = 0;
int _elm_win_count_withdrawn = 0;
+ Eina_Bool throttle = EINA_FALSE;
_elm_win_state_eval_job = NULL;
@@ -397,41 +407,46 @@ _elm_win_state_eval(void *data EINA_UNUSED)
if (((_elm_config->auto_throttle) &&
(elm_policy_get(ELM_POLICY_THROTTLE) != ELM_POLICY_THROTTLE_NEVER)) ||
(elm_policy_get(ELM_POLICY_THROTTLE) == ELM_POLICY_THROTTLE_HIDDEN_ALWAYS))
+ throttle = EINA_TRUE;
+ if (_elm_win_count == 0)
{
- if (_elm_win_count == 0)
+ if (_elm_win_auto_throttled)
{
- if (_elm_win_auto_throttled)
+ _elm_process_state = ELM_PROCESS_STATE_FOREGROUND;
+ ecore_event_add(ELM_EVENT_PROCESS_FOREGROUND, NULL, NULL, NULL);
+ if (throttle)
+ ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
+ _elm_win_auto_throttled = EINA_FALSE;
+ }
+ }
+ else
+ {
+ EINA_LIST_FOREACH(_elm_win_list, l, obj)
+ {
+ if (elm_win_withdrawn_get(obj)) _elm_win_count_withdrawn++;
+ else if (elm_win_iconified_get(obj)) _elm_win_count_iconified++;
+ else if (evas_object_visible_get(obj)) _elm_win_count_shown++;
+ }
+ if (_elm_win_count_shown <= 0)
+ {
+ if (!_elm_win_auto_throttled)
{
- ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
- _elm_win_auto_throttled = EINA_FALSE;
+ _elm_process_state = ELM_PROCESS_STATE_BACKGROUND;
+ ecore_event_add(ELM_EVENT_PROCESS_BACKGROUND, NULL, NULL, NULL);
+ if (throttle)
+ ecore_throttle_adjust(_elm_config->auto_throttle_amount);
+ _elm_win_auto_throttled = EINA_TRUE;
}
}
else
{
- EINA_LIST_FOREACH(_elm_win_list, l, obj)
- {
- if (elm_win_withdrawn_get(obj))
- _elm_win_count_withdrawn++;
- else if (elm_win_iconified_get(obj))
- _elm_win_count_iconified++;
- else if (evas_object_visible_get(obj))
- _elm_win_count_shown++;
- }
- if (_elm_win_count_shown <= 0)
- {
- if (!_elm_win_auto_throttled)
- {
- ecore_throttle_adjust(_elm_config->auto_throttle_amount);
- _elm_win_auto_throttled = EINA_TRUE;
- }
- }
- else
+ if (_elm_win_auto_throttled)
{
- if (_elm_win_auto_throttled)
- {
- ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
- _elm_win_auto_throttled = EINA_FALSE;
- }
+ _elm_process_state = ELM_PROCESS_STATE_FOREGROUND;
+ ecore_event_add(ELM_EVENT_PROCESS_FOREGROUND, NULL, NULL, NULL);
+ if (throttle)
+ ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
+ _elm_win_auto_throttled = EINA_FALSE;
}
}
}