AE_UNKNOWN,
AE_CREATE,
AE_TERMINATE,
+ AE_TERMINATE_BGAPP,
AE_PAUSE,
AE_RESUME,
AE_RAISE,
+ AE_LOWER,
AE_RESET,
AE_LOWMEM_POST,
AE_MEM_FLUSH,
/* appcore-X.c */
extern int x_raise_win(pid_t pid);
+extern int x_pause_win(pid_t pid);
/* appcore-util.c */
/* extern void stack_trim(void);*/
return r;
}
+
+int x_pause_win(pid_t pid)
+{
+ int r;
+ Display *d;
+ Window win;
+ Eina_List *list_win = NULL;
+
+ if (pid < 1) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ r = kill(pid, 0);
+ if (r == -1) {
+ errno = ESRCH;
+ return -1;
+ }
+
+ d = XOpenDisplay(NULL);
+ _retv_if(d == NULL, -1);
+
+ win = XDefaultRootWindow(d);
+ if (!a_pid)
+ a_pid = XInternAtom(d, "_NET_WM_PID", True);
+
+ __foreach_win(&list_win, d, &win, pid);
+ r = __iconify_win(list_win, d);
+
+ XCloseDisplay(d);
+
+ if (list_win)
+ eina_list_free(list_win);
+
+ return r;
+}
return;
}
+ if (event == AE_LOWER) {
+#ifdef X11
+ x_pause_win(getpid());
+ return;
+#endif
+ /* TODO: wayland support */
+ }
+
_ret_if(ui->ops == NULL);
switch (event) {
ui->name);
_send_to_resourced(PROC_STATUS_FOREGRD);
break;
+ case AE_TERMINATE_BGAPP:
+ if (ui->state == AS_PAUSED) {
+ _DBG("[APP %d] is paused. TERMINATE", _pid);
+ ui->state = AS_DYING;
+ aul_status_update(STATUS_DYING);
+ elm_exit();
+ } else if (ui->state == AS_RUNNING) {
+ _DBG("[APP %d] is running.", _pid);
+ } else {
+ _DBG("[APP %d] is another state", _pid);
+ }
+ break;
default:
/* do nothing */
break;
{
#ifdef WAYLAND
Ecore_Wl_Event_Window_Hide *ev;
- int bvisibility = 0;
-
- ev = event;
-
- _DBG("[EVENT_TEST][EVENT] GET HIDE EVENT!!!. WIN:%x\n", ev->win);
-
- if (__find_win((unsigned int)ev->win)) {
- __delete_win((unsigned int)ev->win);
-
- bvisibility = __check_visible();
- if (!bvisibility && b_active == TRUE) {
- _DBG(" Go to Pasue state \n");
- b_active = FALSE;
- __do_app(AE_PAUSE, data, NULL);
- }
- }
#else
Ecore_X_Event_Window_Hide *ev;
+#endif
int bvisibility = 0;
ev = event;
__do_app(AE_PAUSE, data, NULL);
}
}
-#endif
return ECORE_CALLBACK_RENEW;
}
return 0;
}
+static int __bgapp_terminate(void *data)
+{
+ struct appcore *ac = data;
+
+ _retv_if(ac == NULL || ac->ops == NULL, -1);
+ _retv_if(ac->ops->cb_app == NULL, 0);
+
+ ac->ops->cb_app(AE_TERMINATE_BGAPP, ac->ops->data, NULL);
+
+ return 0;
+}
+
static gboolean __prt_ltime(gpointer data)
{
int msec;
return 0;
}
+static int __app_pause(void *data)
+{
+ struct appcore *ac = data;
+ _retv_if(ac == NULL || ac->ops == NULL, -1);
+ _retv_if(ac->ops->cb_app == NULL, 0);
+
+ ac->ops->cb_app(AE_LOWER, ac->ops->data, NULL);
+ return 0;
+}
+
static int __sys_do_default(struct appcore *ac, enum sys_event event)
{
int r;
_DBG("[APP %d] AUL event: AUL_TERMINATE", _pid);
__app_terminate(data);
break;
+ case AUL_TERMINATE_BGAPP:
+ _DBG("[APP %d] AUL event: AUL_TERMINATE_BGAPP", _pid);
+ __bgapp_terminate(data);
+ break;
+ case AUL_PAUSE:
+ _DBG("[APP %d] AUL event: AUL_PAUSE", _pid);
+ __app_pause(data);
+ break;
default:
_DBG("[APP %d] AUL event: %d", _pid, type);
/* do nothing */