APPCORE_BASE_SUSPENDED_STATE_DID_EXIT_FROM_SUSPEND
};
+enum appcore_base_display_state {
+ APPCORE_BASE_DISPLAY_STATE_UNKNOWN,
+ APPCORE_BASE_DISPLAY_STATE_ON,
+ APPCORE_BASE_DISPLAY_STATE_OFF,
+};
typedef int (*appcore_base_event_cb)(void *event, void *data);
typedef void *appcore_base_event_h;
void appcore_base_exit(void);
void appcore_base_add_suspend_timer(void);
void appcore_base_remove_suspend_timer(void);
+void appcore_base_set_display_state(int display_state);
+int appcore_base_get_display_state(void);
#ifdef __cplusplus
}
void appcore_efl_base_window_on_hide(int type, void *event);
void appcore_efl_base_window_on_lower(int type, void *event);
void appcore_efl_base_window_on_visibility(int type, void *event);
+void appcore_efl_base_window_on_pre_visibility(int type, void *event);
+void appcore_efl_base_window_on_aux_message(int type, void *event);
int appcore_efl_base_init(appcore_efl_base_ops ops, int argc, char **argv,
void *data, unsigned int hint);
void appcore_efl_base_fini(void);
void (*lower)(int type, void *event, void *data);
void (*visibility)(int type, void *event, void *data);
void (*pre_visibility)(int type, void *event, void *data);
+ void (*aux_message)(int type, void *event, void *data);
} appcore_multiwindow_base_window_ops;
typedef struct _appcore_multiwindow_base_ops {
void appcore_multiwindow_base_window_on_lower(int type, void *event);
void appcore_multiwindow_base_window_on_visibility(int type, void *event);
void appcore_multiwindow_base_window_on_pre_visibility(int type, void *event);
+void appcore_multiwindow_base_window_on_aux_message(int type, void *event);
void appcore_multiwindow_base_window_bind(appcore_multiwindow_base_instance_h h, Ecore_Wl2_Window *wl_win);
void appcore_multiwindow_base_window_unbind(appcore_multiwindow_base_instance_h h);
bool appcore_multiwindow_base_window_is_resumed(void);
void (*lower)(int type, void *event, void *data);
void (*visibility)(int type, void *event, void *data);
void (*pre_visibility)(int type, void *event, void *data);
+ void (*aux_message)(int type, void *event, void *data);
} appcore_ui_base_window_ops;
typedef struct _appcore_ui_base_ops {
void appcore_ui_base_window_on_lower(int type, void *event);
void appcore_ui_base_window_on_visibility(int type, void *event);
void appcore_ui_base_window_on_pre_visibility(int type, void *event);
+void appcore_ui_base_window_on_aux_message(int type, void *event);
int appcore_ui_base_init(appcore_ui_base_ops ops, int argc, char **argv,
void *data, unsigned int hint);
void appcore_ui_base_fini(void);
bool allowed_bg;
bool dirty;
guint sid;
+ int display_state;
} appcore_base_context;
typedef struct _appcore_base_event_node {
__remove_suspend_timer();
}
+EXPORT_API void appcore_base_set_display_state(int display_state)
+{
+ __context.display_state = display_state;
+}
+
+EXPORT_API int appcore_base_get_display_state(void)
+{
+ return __context.display_state;
+}
+
static int __on_receive(aul_type type, bundle *b, void *data)
{
return appcore_base_on_receive(type, b);
appcore_ui_base_window_on_visibility(type, event);
}
+EXPORT_API void appcore_efl_base_window_on_pre_visibility(int type, void *event)
+{
+ appcore_ui_base_window_on_pre_visibility(type, event);
+}
+
+EXPORT_API void appcore_efl_base_window_on_aux_message(int type, void *event)
+{
+ appcore_ui_base_window_on_aux_message(type, event);
+}
+
EXPORT_API void appcore_efl_base_pause(void)
{
appcore_ui_base_pause();
return ECORE_CALLBACK_RENEW;
}
+static Eina_Bool __stub_aux_message_cb(void *data, int type, void *event)
+{
+ if (_appcore_mw_context.ops.window.aux_message)
+ _appcore_mw_context.ops.window.aux_message(type, event, _appcore_mw_context.data);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void __add_ecore_events(void)
+{
+ if (!_appcore_mw_context.hshow) {
+ _appcore_mw_context.hshow = ecore_event_handler_add(
+ ECORE_WL2_EVENT_WINDOW_SHOW,
+ __stub_show_cb, NULL);
+ if (!_appcore_mw_context.hshow)
+ _ERR("Failed to add window show event");
+ }
+
+ if (!_appcore_mw_context.hhide) {
+ _appcore_mw_context.hhide = ecore_event_handler_add(
+ ECORE_WL2_EVENT_WINDOW_HIDE,
+ __stub_hide_cb, NULL);
+ if (!_appcore_mw_context.hhide)
+ _ERR("Failed to add window hide event");
+ }
+
+ if (!_appcore_mw_context.hvchange) {
+ _appcore_mw_context.hvchange = ecore_event_handler_add(
+ ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE,
+ __stub_visibility_cb, NULL);
+ if (!_appcore_mw_context.hvchange)
+ _ERR("Failed to add window visibility change event");
+ }
+
+ if (!_appcore_mw_context.hlower) {
+ _appcore_mw_context.hlower = ecore_event_handler_add(
+ ECORE_WL2_EVENT_WINDOW_LOWER,
+ __stub_lower_cb, NULL);
+ if (!_appcore_mw_context.hlower)
+ _ERR("Failed to add window lower event");
+ }
+
+ if (!_appcore_mw_context.hpvchange) {
+ _appcore_mw_context.hpvchange = ecore_event_handler_add(
+ ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE,
+ __stub_pre_visibility_cb, NULL);
+ if (!_appcore_mw_context.hpvchange)
+ _ERR("Failed to add window pre-visbiility change event");
+ }
+
+ if (!_appcore_mw_context.hauxmsg) {
+ _appcore_mw_context.hauxmsg = ecore_event_handler_add(
+ ECORE_WL2_EVENT_AUX_MESSAGE,
+ __stub_aux_message_cb, NULL);
+ if (!_appcore_mw_context.hauxmsg)
+ _ERR("Failed to add aux message event");
+ }
+}
+
+static void __remove_ecore_events(void)
+{
+ if (_appcore_mw_context.hshow) {
+ ecore_event_handler_del(_appcore_mw_context.hshow);
+ _appcore_mw_context.hshow = NULL;
+ }
+
+ if (_appcore_mw_context.hhide) {
+ ecore_event_handler_del(_appcore_mw_context.hhide);
+ _appcore_mw_context.hhide = NULL;
+ }
+
+ if (_appcore_mw_context.hvchange) {
+ ecore_event_handler_del(_appcore_mw_context.hvchange);
+ _appcore_mw_context.hvchange = NULL;
+ }
+
+ if (_appcore_mw_context.hlower) {
+ ecore_event_handler_del(_appcore_mw_context.hlower);
+ _appcore_mw_context.hlower = NULL;
+ }
+
+ if (_appcore_mw_context.hpvchange) {
+ ecore_event_handler_del(_appcore_mw_context.hpvchange);
+ _appcore_mw_context.hpvchange = NULL;
+ }
+
+ if (_appcore_mw_context.hauxmsg) {
+ ecore_event_handler_del(_appcore_mw_context.hauxmsg);
+ _appcore_mw_context.hauxmsg = NULL;
+ }
+}
+
EXPORT_API int appcore_multiwindow_base_init(appcore_multiwindow_base_ops ops, int argc, char **argv, void *data)
{
_appcore_mw_context.ops = ops;
g_list_free_full(_appcore_mw_context.classes, __free_class);
_appcore_mw_context.classes = NULL;
- if (_appcore_mw_context.hshow) {
- ecore_event_handler_del(_appcore_mw_context.hshow);
- _appcore_mw_context.hshow = NULL;
- }
-
- if (_appcore_mw_context.hhide) {
- ecore_event_handler_del(_appcore_mw_context.hhide);
- _appcore_mw_context.hhide = NULL;
- }
-
- if (_appcore_mw_context.hvchange) {
- ecore_event_handler_del(_appcore_mw_context.hvchange);
- _appcore_mw_context.hvchange = NULL;
- }
-
- if (_appcore_mw_context.hlower) {
- ecore_event_handler_del(_appcore_mw_context.hlower);
- _appcore_mw_context.hlower = NULL;
- }
-
- if (_appcore_mw_context.hpvchange) {
- ecore_event_handler_del(_appcore_mw_context.hpvchange);
- _appcore_mw_context.hpvchange = NULL;
- }
-
+ __remove_ecore_events();
appcore_base_fini();
}
appcore_multiwindow_base_window_on_pre_visibility(type, event);
}
+static void __window_on_aux_message(int type, void *event, void *data)
+{
+ appcore_multiwindow_base_window_on_aux_message(type, event);
+}
+
EXPORT_API appcore_multiwindow_base_ops appcore_multiwindow_base_get_default_ops(void)
{
appcore_multiwindow_base_ops ops;
ops.window.lower = __window_on_lower;
ops.window.visibility = __window_on_visibility;
ops.window.pre_visibility = __window_on_pre_visibility;
+ ops.window.aux_message = __window_on_aux_message;
return ops;
}
EXPORT_API int appcore_multiwindow_base_on_create(void)
{
appcore_base_on_create();
-
- _appcore_mw_context.hshow = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW, __stub_show_cb, NULL);
- _appcore_mw_context.hhide = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_HIDE, __stub_hide_cb, NULL);
- _appcore_mw_context.hvchange = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE,
- __stub_visibility_cb, NULL);
- _appcore_mw_context.hlower = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_LOWER, __stub_lower_cb, NULL);
- _appcore_mw_context.hpvchange = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE,
- __stub_pre_visibility_cb, NULL);
+ __add_ecore_events();
return 0;
}
Ecore_Event_Handler *hvchange;
Ecore_Event_Handler *hlower;
Ecore_Event_Handler *hpvchange;
+
+ Ecore_Event_Handler *hauxmsg;
} appcore_multiwindow_base_context;
typedef struct _appcore_multiwindow_base_instance {
appcore_multiwindow_base_instance_resume(cxt->inst);
}
+EXPORT_API void appcore_multiwindow_base_window_on_aux_message(int type, void *event)
+{
+ Ecore_Wl2_Event_Aux_Message *ev = event;
+
+ if (ev->key && !strcmp(ev->key, "dpms_wm")) {
+ if (ev->val && !strcmp(ev->val, "on")) {
+ _DBG("Display state: on");
+ appcore_base_set_display_state(
+ APPCORE_BASE_DISPLAY_STATE_ON);
+ } else if (ev->val && !strcmp(ev->val, "off")) {
+ _DBG("Display state: off");
+ appcore_base_set_display_state(
+ APPCORE_BASE_DISPLAY_STATE_OFF);
+ } else {
+ _ERR("Unknown state: %s", ev->val);
+ }
+ }
+}
+
EXPORT_API void appcore_multiwindow_base_window_bind(appcore_multiwindow_base_instance_h h, Ecore_Wl2_Window *wl_win)
{
win_context *cxt;
Ecore_Event_Handler *hvchange;
Ecore_Event_Handler *hlower;
Ecore_Event_Handler *hpvchange;
+ Ecore_Event_Handler *hauxmsg;
} appcore_ui_base_context;
return ECORE_CALLBACK_RENEW;
}
+static Eina_Bool __stub_aux_message_cb(void *data, int type, void *event)
+{
+ if (__context.ops.window.aux_message)
+ __context.ops.window.aux_message(type, event, __context.data);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
static void __prepare_to_suspend(void)
{
int suspend = APPCORE_BASE_SUSPENDED_STATE_WILL_ENTER_SUSPEND;
__stub_pre_visibility_cb, NULL);
if (!__context.hpvchange)
_ERR("Failed to add ECORE_WL_EVENT_WINDOW_PRE_VISIBILITY_CHANGE event");
+
+ __context.hauxmsg = ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE,
+ __stub_aux_message_cb, NULL);
+ if (!__context.hauxmsg)
+ _ERR("Failed to add ECORE_WL2_EVENT_AUX_MESSAGE event");
}
static void __del_ecore_events(void)
ecore_event_handler_del(__context.hpvchange);
__context.hpvchange = NULL;
}
+
+ if (__context.hauxmsg) {
+ ecore_event_handler_del(__context.hauxmsg);
+ __context.hauxmsg = NULL;
+ }
}
EXPORT_API int appcore_ui_base_on_create(void)
}
}
+EXPORT_API void appcore_ui_base_window_on_aux_message(int type, void *event)
+{
+ Ecore_Wl2_Event_Aux_Message *ev = event;
+
+ if (ev->key && !strcmp(ev->key, "dpms_wm")) {
+ if (ev->val && !strcmp(ev->val, "on")) {
+ _DBG("Display state: on");
+ appcore_base_set_display_state(
+ APPCORE_BASE_DISPLAY_STATE_ON);
+ } else if (ev->val && !strcmp(ev->val, "off")) {
+ _DBG("Display state: off");
+ appcore_base_set_display_state(
+ APPCORE_BASE_DISPLAY_STATE_OFF);
+ } else {
+ _ERR("Unknown state: %s", ev->val);
+ }
+ }
+}
+
EXPORT_API int appcore_ui_base_init(appcore_ui_base_ops ops, int argc, char **argv,
void *data, unsigned int hint)
{
appcore_ui_base_window_on_pre_visibility(type, event);
}
+static void __window_on_aux_message(int type, void *event, void *data)
+{
+ appcore_ui_base_window_on_aux_message(type, event);
+}
+
EXPORT_API appcore_ui_base_ops appcore_ui_base_get_default_ops(void)
{
appcore_ui_base_ops ops;
ops.window.lower = __window_on_lower;
ops.window.visibility = __window_on_visibility;
ops.window.pre_visibility = __window_on_pre_visibility;
+ ops.window.aux_message = __window_on_aux_message;
return ops;
}