fi
AM_CONDITIONAL(HAVE_WAYLAND_ONLY, [test "x${have_wayland_only}" = xyes])
-PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment, capi-system-device])
-if test "x${have_wayland_only}" = "xyes"; then
- PKG_CHECK_MODULES(EXTRA, [tizen-extension-server])
- ENLIGHTENMENT_CFLAGS="${ENLIGHTENMENT_CFLAGS} ${EXTRA_CFLAGS}"
- ENLIGHTENMENT_LIBS="${ENLIGHTENMENT_LIBS} ${EXTRA_LIBS}"
-fi
+PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment])
AC_SUBST(ENLIGHTENMENT_CFLAGS)
AC_SUBST(ENLIGHTENMENT_LIBS)
-# Checks for cynara
-have_cynara=no
-AC_ARG_ENABLE(cynara,
- AS_HELP_STRING([--enable-cynara], [enable cynara]),
- [have_cynara=$enableval],
- [have_cynara=no]
-)
-if test "x${have_cynara}" = "xyes"; then
- PKG_CHECK_MODULES(CYNARA, [cynara-client, cynara-creds-socket, cynara-session])
- AC_DEFINE([ENABLE_CYNARA],[1],[enable cynara])
-fi
-
# Checks for ttrace header files
PKG_CHECK_MODULES(TTRACE,
[ttrace],
datadir=$(pkg-config --variable=modules enlightenment)/${PACKAGE}
-# for Tzsh
-if test "x${have_wayland_only}" = "xyes"; then
- PKG_CHECK_MODULES([TZSH_SERVER], [tzsh-server])
-fi
-
# for include e_comp_wl.h
if test "x${have_wayland_only}" != "xno"; then
AC_DEFINE_UNQUOTED([HAVE_WAYLAND],[1],[enable wayland support])
BuildRequires: pkgconfig(ttrace)
BuildRequires: libsensord-devel
BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(capi-system-device)
%if %{with x}
BuildRequires: pkgconfig(x11)
%endif
%if %{with wayland}
-BuildRequires: pkgconfig(tizen-extension-server)
BuildRequires: pkgconfig(eina)
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(edje)
-BuildRequires: pkgconfig(tzsh-server)
-BuildRequires: pkgconfig(cynara-client)
-BuildRequires: pkgconfig(cynara-creds-socket)
%endif
%global TZ_SYS_RO_SHARE %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE}%{!?TZ_SYS_RO_SHARE:/usr/share}
%if %{with wayland}
%reconfigure \
--enable-wayland-only \
- --enable-cynara \
--enable-auto-rotation
%else
%reconfigure
MAINTAINERCLEANFILES = Makefile.in
-AM_CPPFLAGS = -I./rotation \
- -I./services
+AM_CPPFLAGS = -I./rotation
MODULE = e-mod-tizen-wm-policy
# data files for the module
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
-files_DATA = e-module-policy.edj
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
pkg_LTLIBRARIES = module.la
rotation/e_mod_rotation_settings.c \
rotation/e_mod_rotation_settings.h
-SRVS_SRC = services/e_mod_quickpanel.c \
- services/e_mod_quickpanel.h \
- services/e_mod_lockscreen.h \
- services/e_mod_lockscreen.c \
- services/e_mod_indicator.h \
- services/e_mod_indicator.c \
- services/e_mod_gesture.c \
- services/e_mod_gesture.h \
- services/e_mod_region.h \
- services/e_mod_region.c
-
if HAVE_AUTO_ROTATION
ROT_SRC += rotation/e_mod_sensord.c \
rotation/e_mod_sensord.h
endif
-WL_SRC += e_mod_wl.c \
- e_mod_wl.h \
- e_mod_wl_display.c \
- e_mod_wl_display.h \
- tizen_policy_ext-protocol.c \
+WL_SRC += tizen_policy_ext-protocol.c \
tizen_policy_ext-server-protocol.h
ROT_SRC += rotation/e_mod_rotation_wl.c \
- rotation/e_mod_rotation_wl.h
-
-SRVS_SRC += services/e_mod_volume.c \
- services/e_mod_volume.h
+ rotation/e_mod_rotation_wl.h
module_la_SOURCES = e_mod_config.c \
e_mod_main.c \
e_mod_main.h \
- e_mod_softkey.c \
- e_mod_visibility.c \
- e_mod_utils.h \
- e_mod_keyboard.c \
- e_mod_keyboard.h \
- e_mod_stack.c \
- e_mod_private_data.h \
- e_mod_transform_mode.c \
- e_mod_transform_mode.h \
- e_mod_conformant.c \
- e_mod_conformant.h \
$(WL_SRC) \
- $(ROT_SRC) \
- $(SRVS_SRC)
+ $(ROT_SRC)
module_la_LIBADD =
-module_la_CFLAGS = @ENLIGHTENMENT_CFLAGS@ @TZSH_SERVER_CFLAGS@ @TTRACE_CFLAGS@ @CYNARA_CFLAGS@
-module_la_LDFLAGS = -module -avoid-version @ENLIGHTENMENT_LIBS@ @TZSH_SERVER_LIBS@ @TTRACE_LIBS@ @CYNARA_LIBS@
+module_la_CFLAGS = @ENLIGHTENMENT_CFLAGS@ @TTRACE_CFLAGS@
+module_la_LDFLAGS = -module -avoid-version @ENLIGHTENMENT_LIBS@ @TTRACE_LIBS@
module_la_DEPENDENCIES = $(top_builddir)/config.h
if HAVE_AUTO_ROTATION
#include "e_mod_main.h"
-static void _pol_conf_desk_add(Config *conf, E_Desk *desk);
-#if 0
-static void _pol_conf_desk_del(Config *conf, Config_Desk *d);
-static Config_Desk *_pol_conf_desk_get(Config *conf, Config_Desk *d);
-
-static void *_pol_cfd_data_create(E_Config_Dialog *cfd);
-static void _pol_cfd_data_free(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata);
-static int _pol_cfd_data_basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata);
-static void _pol_cfd_desk_list_update(E_Config_Dialog_Data *cfdata, E_Zone *zone);
-static void _pol_cfd_hook_zone_change(void *data, Evas_Object *obj);
-static Evas_Object *_pol_cfd_data_basic_widgets_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata);
-#endif
-
-static void
-_pol_conf_desk_add(Config *conf, E_Desk *desk)
-{
- Config_Desk *d;
- E_Zone *zone = NULL;
- int x = 0, y = 0;
-
- if (desk)
- {
- zone = desk->zone;
- x = desk->x;
- y = desk->y;
- }
-
- d = E_NEW(Config_Desk, 1);
- d->zone_num = zone? zone->num : 0;
- d->x = x;
- d->y = y;
- d->enable = 1;
-
- conf->desks = eina_list_append(conf->desks, d);
-}
-
-#if 0
-static void
-_pol_conf_desk_del(Config *conf, Config_Desk *d)
-{
- conf->desks = eina_list_remove(conf->desks, d);
- free(d);
-}
-
-static Config_Desk *
-_pol_conf_desk_get(Config *conf, Config_Desk *d)
-{
- Eina_List *l;
- Config_Desk *d2;
-
- EINA_LIST_FOREACH(conf->desks, l, d2)
- {
- if ((d2->zone_num == d->zone_num) &&
- (d2->x == d->x) && (d2->y == d->y))
- {
- return d2;
- }
- }
-
- return NULL;
-}
-
-static void *
-_pol_cfd_data_create(E_Config_Dialog *cfd)
-{
- E_Config_Dialog_Data *cfdata = NULL;
-
- cfdata = E_NEW(E_Config_Dialog_Data, 1);
- cfdata->conf = E_NEW(Config, 1);
- cfdata->conf->launcher.title = eina_stringshare_ref(_pol_mod->conf->launcher.title);
- cfdata->conf->launcher.clas = eina_stringshare_ref(_pol_mod->conf->launcher.clas);
- cfdata->conf->launcher.type = _pol_mod->conf->launcher.type;
- cfdata->conf->use_softkey = _pol_mod->conf->use_softkey;
- cfdata->conf->softkey_size = _pol_mod->conf->softkey_size;
-
- _pol_mod->conf_dialog = cfd;
-
- return cfdata;
-}
-
-static void
-_pol_cfd_data_free(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
-{
- _pol_mod->conf_dialog = NULL;
- E_FREE_LIST(cfdata->conf->desks, free);
- eina_stringshare_del(cfdata->conf->launcher.title);
- eina_stringshare_del(cfdata->conf->launcher.clas);
- free(cfdata->conf);
- free(cfdata);
-}
-
-static int
-_pol_cfd_data_basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
-{
- E_Zone *zone;
- E_Desk *desk;
- Pol_Softkey *softkey;
- Pol_Desk *pd;
- Config_Desk *d, *d2;
- Eina_Bool changed = EINA_FALSE;
- const Eina_List *l;
- Eina_Inlist *il;
- Eina_Iterator *it;
-
- if (_pol_mod->conf->use_softkey != cfdata->conf->use_softkey)
- {
- _pol_mod->conf->use_softkey = cfdata->conf->use_softkey;
- if (_pol_mod->conf->use_softkey)
- {
- it = eina_hash_iterator_data_new(hash_pol_desks);
- while (eina_iterator_next(it, (void **)&pd))
- {
- softkey = e_mod_pol_softkey_get(pd->zone);
- if (!softkey)
- softkey = e_mod_pol_softkey_add(pd->zone);
- if (e_desk_current_get(pd->zone) == pd->desk)
- e_mod_pol_softkey_show(softkey);
- }
- eina_iterator_free(it);
- }
- else
- {
- EINA_INLIST_FOREACH_SAFE(_pol_mod->softkeys, il, softkey)
- e_mod_pol_softkey_del(softkey);
- }
-
- changed = EINA_TRUE;
- }
-
- if (_pol_mod->conf->softkey_size != cfdata->conf->softkey_size)
- {
- _pol_mod->conf->softkey_size = cfdata->conf->softkey_size;
- if (_pol_mod->conf->use_softkey)
- {
- EINA_INLIST_FOREACH(_pol_mod->softkeys, softkey)
- e_mod_pol_softkey_update(softkey);
- }
- changed = EINA_TRUE;
- }
-
- EINA_LIST_FOREACH(cfdata->conf->desks, l, d)
- {
- zone = e_comp_zone_number_get(d->zone_num);
- desk = e_desk_at_xy_get(zone, d->x, d->y);
- if (!desk) continue;
-
- d2 = _pol_conf_desk_get(_pol_mod->conf, d);
- if (d2)
- {
- /* disable policy for this desktop */
- if (d2->enable != d->enable)
- {
- pd = eina_hash_find(hash_pol_desks, &desk);
- if (pd) e_mod_pol_desk_del(pd);
- _pol_conf_desk_del(_pol_mod->conf, d2);
- changed = EINA_TRUE;
- }
- }
- else
- {
- /* apply policy for all clients in this desk,
- * and add desk to configuration list and desk hash */
- if (d->enable)
- {
- e_mod_pol_desk_add(desk);
- _pol_conf_desk_add(_pol_mod->conf, desk);
- changed = EINA_TRUE;
- }
- }
- }
-
- if (changed)
- e_config_save_queue();
-
- return 1;
-}
-
-static void
-_pol_cfd_desk_list_update(E_Config_Dialog_Data *cfdata, E_Zone *zone)
-{
- Evas_Object *o, *ch;
- Evas *evas;
- E_Desk *desk;
- Config_Desk *d, *d2;
- int i, n;
-
- evas = evas_object_evas_get(cfdata->o_list);
- evas_object_del(cfdata->o_desks);
- E_FREE_LIST(cfdata->conf->desks, free);
-
- o = e_widget_list_add(evas, 1, 0);
- cfdata->o_desks = o;
-
- n = zone->desk_y_count * zone->desk_x_count;
- for (i = 0; i < n; i++)
- {
- desk = zone->desks[i];
-
- d = E_NEW(Config_Desk, 1);
- d->zone_num = zone->num;
- d->x = desk->x;
- d->y = desk->y;
- d->enable = 0;
-
- d2 = _pol_conf_desk_get(_pol_mod->conf, d);
- if (d2)
- d->enable = d2->enable;
-
- ch = e_widget_check_add(evas, desk->name, &d->enable);
- e_widget_list_object_append(o, ch, 1, 1, 0.5);
-
- cfdata->conf->desks = eina_list_append(cfdata->conf->desks, d);
- }
-
- e_widget_list_object_append(cfdata->o_list, o, 1, 1, 0.5);
-}
-
-static void
-_pol_cfd_hook_zone_change(void *data, Evas_Object *obj)
-{
- E_Config_Dialog_Data *cfdata;
- E_Zone *zone;
- int n;
-
- cfdata = data;
- n = e_widget_ilist_selected_get(obj);
- zone = e_widget_ilist_nth_data_get(obj, n);
- if (zone)
- _pol_cfd_desk_list_update(cfdata, zone);
-}
-
-static Evas_Object *
-_pol_cfd_data_basic_widgets_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata)
-{
- Evas_Object *base, *fl, *lb, *lo, *o;
- E_Zone *zone;
- Eina_List *l;
-
- base = e_widget_list_add(evas, 0, 0);
- fl = e_widget_framelist_add(evas, _("Softkey"), 0);
- fl = e_widget_framelist_add(evas, _("Softkey"), 0);
- o = e_widget_check_add(evas, _("Use softkey for navigation among the windows"),
- &cfdata->conf->use_softkey);
- e_widget_framelist_object_append(fl, o);
- o = e_widget_label_add(evas, _("Icon Size"));
- e_widget_framelist_object_append(fl, o);
- o = e_widget_slider_add(evas, 1, 0, "%1.0f", 32, 256, 1, 0, NULL,
- &(cfdata->conf->softkey_size), 150);
- e_widget_framelist_object_append(fl, o);
- e_widget_list_object_append(base, fl, 1, 1, 0.5);
-
- fl = e_widget_framelist_add(evas, _("Virtual Desktops"), 0);
- lb = e_widget_label_add(evas, _("Enable mobile policy per desktop"));
- e_widget_framelist_object_append(fl, lb);
-
- lo = e_widget_list_add(evas, 0, 1);
- cfdata->o_list = lo;
- o = e_widget_ilist_add(evas, 0, 0, NULL);
- e_widget_ilist_multi_select_set(o, EINA_FALSE);
- e_widget_size_min_set(o, 100, 100);
- e_widget_on_change_hook_set(o, _pol_cfd_hook_zone_change, cfdata);
- EINA_LIST_REVERSE_FOREACH(e_comp->zones, l, zone)
- e_widget_ilist_append(o, NULL, zone->name, NULL, zone, NULL);
- e_widget_ilist_go(o);
- e_widget_ilist_selected_set(o, 0);
- e_widget_list_object_append(lo, o, 1, 1, 0.5);
-
- /* update virtual desktops of first zone */
- zone = eina_list_data_get(e_comp->zones);
- _pol_cfd_desk_list_update(cfdata, zone);
-
- e_widget_framelist_object_append(fl, lo);
- e_widget_list_object_append(base, fl, 1, 1, 0.5);
-
- return base;
-}
-#endif
-
void
e_mod_pol_conf_init(Mod *mod)
{
- E_Zone *zone;
- E_Desk *desk;
- Config *conf;
-
- mod->conf_desk_edd = E_CONFIG_DD_NEW("Policy_Mobile_Config_Desk", Config_Desk);
-#undef T
-#undef D
-#define T Config_Desk
-#define D mod->conf_desk_edd
- E_CONFIG_VAL(D, T, zone_num, UINT);
- E_CONFIG_VAL(D, T, x, INT);
- E_CONFIG_VAL(D, T, y, INT);
- E_CONFIG_VAL(D, T, enable, INT);
-
mod->conf_rot_edd = E_CONFIG_DD_NEW("Policy_Mobile_Config_Rot", Config_Rot);
#undef T
#undef D
#undef D
#define T Config
#define D mod->conf_edd
- E_CONFIG_VAL(D, T, launcher.title, STR);
- E_CONFIG_VAL(D, T, launcher.clas, STR);
- E_CONFIG_VAL(D, T, launcher.type, UINT);
- E_CONFIG_LIST(D, T, desks, mod->conf_desk_edd);
- E_CONFIG_VAL(D, T, use_softkey, INT);
- E_CONFIG_VAL(D, T, softkey_size, INT);
E_CONFIG_LIST(D, T, rotations, mod->conf_rot_edd);
#undef T
#undef D
mod->conf = e_config_domain_load("module.policy-tizen", mod->conf_edd);
- if (!mod->conf)
- {
- conf = E_NEW(Config, 1);
- mod->conf = conf;
- conf->launcher.title = eina_stringshare_add("Illume Home");
- conf->launcher.clas = eina_stringshare_add("Illume-Home");
- conf->launcher.type = E_WINDOW_TYPE_NORMAL;
- conf->use_softkey = 1;
- conf->softkey_size = 42;
-
- zone = e_zone_current_get();
- desk = e_desk_current_get(zone);
- _pol_conf_desk_add(conf, desk);
- }
}
void
e_mod_pol_conf_shutdown(Mod *mod)
{
- Config *conf;
-
if (mod->conf)
- {
- conf = mod->conf;
- E_FREE_LIST(conf->desks, free);
- eina_stringshare_del(conf->launcher.title);
- eina_stringshare_del(conf->launcher.clas);
- free(mod->conf);
- }
+ free(mod->conf);
E_CONFIG_DD_FREE(mod->conf_rot_edd);
- E_CONFIG_DD_FREE(mod->conf_desk_edd);
E_CONFIG_DD_FREE(mod->conf_edd);
}
-Config_Desk *
-e_mod_pol_conf_desk_get_by_nums(Config *conf, unsigned int zone_num, int x, int y)
-{
- Eina_List *l;
- Config_Desk *d2;
-
- EINA_LIST_FOREACH(conf->desks, l, d2)
- {
- if ((d2->zone_num == zone_num) &&
- (d2->x == x) && (d2->y == y))
- {
- return d2;
- }
- }
-
- return NULL;
-}
-
-#if 0
-E_Config_Dialog *
-e_int_config_pol_mobile(Evas_Object *o EINA_UNUSED, const char *params EINA_UNUSED)
-{
- E_Config_Dialog *cfd;
- E_Config_Dialog_View *v;
- char buf[PATH_MAX];
-
- if (e_config_dialog_find("E", "windows/policy-tizen"))
- return NULL;
-
- v = E_NEW(E_Config_Dialog_View, 1);
- v->create_cfdata = _pol_cfd_data_create;
- v->free_cfdata = _pol_cfd_data_free;
- v->basic.apply_cfdata = _pol_cfd_data_basic_apply;
- v->basic.create_widgets = _pol_cfd_data_basic_widgets_create;
-
- snprintf(buf, sizeof(buf), "%s/e-module-policy.edj",
- e_module_dir_get(_pol_mod->module));
- cfd = e_config_dialog_new(NULL, _("Mobile Policy Configuration"), "E",
- "windows/policy-tizen", buf, 0, v, NULL);
- return cfd;
-}
-#endif
-
EINTERN Eina_Bool
e_mod_pol_conf_rot_enable_get(int angle)
{
+++ /dev/null
-#include "e_mod_main.h"
-
-#include <wayland-server.h>
-#include <tizen-extension-server-protocol.h>
-
-#define CFDBG(f, x...) DBG("Conformant|"f, ##x)
-#define CFINF(f, x...) INF("Conformant|"f, ##x)
-#define CFERR(f, x...) ERR("Conformant|"f, ##x)
-
-#define CONF_DATA_GET(ptr) \
- Conformant *ptr = _conf_data_get()
-#define CONF_DATA_GET_OR_RETURN(ptr) \
- CONF_DATA_GET(ptr); \
- if (!ptr) \
- { \
- CFERR("no conformant data"); \
- return; \
- }
-#define CONF_DATA_GET_OR_RETURN_VAL(ptr, val) \
- CONF_DATA_GET(ptr); \
- if (!ptr) \
- { \
- CFERR("no conformant data"); \
- return val; \
- }
-
-typedef struct
-{
- E_Client *vkbd;
- E_Client *owner;
- Eina_Hash *client_hash;
- Eina_List *handlers;
- E_Client_Hook *client_del_hook;
- Ecore_Idle_Enterer *idle_enterer;
-
- struct
- {
- Eina_Bool restore;
- Eina_Bool visible;
- int x, y, w, h;
- } state;
-
- Eina_Bool changed : 1;
-} Conformant;
-
-typedef struct
-{
- E_Client *ec;
- Eina_List *res_list;
-} Conformant_Client;
-
-typedef struct
-{
- Conformant_Client *cfc;
- struct wl_resource *res;
- struct wl_listener destroy_listener;
-} Conformant_Wl_Res;
-
-Conformant *_conf = NULL;
-
-static Conformant *
-_conf_data_get()
-{
- return _conf;
-}
-
-static void
-_conf_state_update(Conformant *conf, Eina_Bool visible, int x, int y, int w, int h)
-{
- Conformant_Client *cfc;
- Conformant_Wl_Res *cres;
- Eina_List *l;
-
- if ((conf->state.visible == visible) &&
- (conf->state.x == x) && (conf->state.x == y) &&
- (conf->state.x == w) && (conf->state.x == h))
- return;
-
- CFDBG("Update Conformant State\n");
- CFDBG("\tprev: v %d geom %d %d %d %d\n",
- conf->state.visible, conf->state.x, conf->state.y, conf->state.w, conf->state.h);
- CFDBG("\tnew : v %d geom %d %d %d %d\n", visible, x, y, w, h);
-
- conf->state.visible = visible;
- conf->state.x = x;
- conf->state.y = y;
- conf->state.w = w;
- conf->state.h = h;
-
- if (!conf->owner)
- return;
-
- cfc = eina_hash_find(conf->client_hash, &conf->owner);
- if (!cfc)
- return;
-
- CFDBG("\t=> '%s'(%p)", cfc->ec ? (cfc->ec->icccm.name ?:"") : "", cfc->ec);
- EINA_LIST_FOREACH(cfc->res_list, l, cres)
- {
- tizen_policy_send_conformant_area
- (cres->res,
- cfc->ec->comp_data->surface,
- TIZEN_POLICY_CONFORMANT_PART_KEYBOARD,
- (unsigned int)visible, x, y, w, h);
- }
-}
-
-static void
-_conf_cb_vkbd_obj_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Conformant *conf;
-
- CFDBG("VKBD Deleted");
- conf = data;
- conf->vkbd = NULL;
-}
-
-static void
-_conf_cb_vkbd_obj_show(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Conformant *conf;
-
- CFDBG("VKBD Show");
- conf = data;
- conf->owner = conf->vkbd->parent;
- if (!conf->owner)
- WRN("Not exist vkbd's parent even if it becomes visible");
- conf->changed = 1;
-}
-
-static void
-_conf_cb_vkbd_obj_hide(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Conformant *conf;
-
- CFDBG("VKBD Hide");
- conf = data;
- _conf_state_update(conf, EINA_FALSE, conf->state.x, conf->state.y, conf->state.w, conf->state.h);
- conf->owner = NULL;
-}
-
-static void
-_conf_cb_vkbd_obj_move(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Conformant *conf;
-
- CFDBG("VKBD Move");
- conf = data;
- conf->changed = 1;
-}
-
-static void
-_conf_cb_vkbd_obj_resize(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Conformant *conf;
-
- CFDBG("VKBD Resize");
- conf = data;
- conf->changed = 1;
-}
-
-static void
-_conf_client_del(Conformant_Client *cfc)
-{
- Conformant_Wl_Res *cres;
-
- EINA_LIST_FREE(cfc->res_list, cres)
- {
- wl_list_remove(&cres->destroy_listener.link);
- free(cres);
- }
-
- free(cfc);
-}
-
-static void
-_conf_client_resource_destroy(struct wl_listener *listener, void *data)
-{
- Conformant_Wl_Res *cres;
-
- cres = container_of(listener, Conformant_Wl_Res, destroy_listener);
- if (!cres)
- return;
-
- CFDBG("Destroy Wl Resource res %p owner %s(%p)",
- cres->res, cres->cfc->ec->icccm.name ? cres->cfc->ec->icccm.name : "", cres->cfc->ec);
-
- cres->cfc->res_list = eina_list_remove(cres->cfc->res_list, cres);
-
- free(cres);
-}
-
-static void
-_conf_client_resource_add(Conformant_Client *cfc, struct wl_resource *res)
-{
- Conformant_Wl_Res *cres;
- Eina_List *l;
-
- if (cfc->res_list)
- {
- EINA_LIST_FOREACH(cfc->res_list, l, cres)
- {
- if (cres->res == res)
- {
- CFERR("Already Added Resource, Nothing to do. res: %p", res);
- return;
- }
- }
- }
-
- cres = E_NEW(Conformant_Wl_Res, 1);
- if (!cres)
- return;
-
- cres->cfc = cfc;
- cres->res = res;
- cres->destroy_listener.notify = _conf_client_resource_destroy;
- wl_resource_add_destroy_listener(res, &cres->destroy_listener);
-
- cfc->res_list = eina_list_append(cfc->res_list, cres);
-}
-
-static Conformant_Client *
-_conf_client_add(Conformant *conf, E_Client *ec, struct wl_resource *res)
-{
- Conformant_Client *cfc;
-
- cfc = E_NEW(Conformant_Client, 1);
- if (!cfc)
- return NULL;
-
- cfc->ec = ec;
-
- _conf_client_resource_add(cfc, res);
-
- return cfc;
-}
-
-static void
-_conf_vkbd_register(Conformant *conf, E_Client *ec)
-{
- CFINF("VKBD Registered");
- if (conf->vkbd)
- {
- CFERR("Something strange error, VKBD Already Registered.");
- return;
- }
- conf->vkbd = ec;
-
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL, _conf_cb_vkbd_obj_del, conf);
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _conf_cb_vkbd_obj_show, conf);
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _conf_cb_vkbd_obj_hide, conf);
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _conf_cb_vkbd_obj_move, conf);
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _conf_cb_vkbd_obj_resize, conf);
-}
-
-static Eina_Bool
-_conf_cb_client_add(void *data, int type EINA_UNUSED, void *event)
-{
- Conformant *conf;
- E_Event_Client *ev;
-
- conf = data;
- ev = event;
-
- if (ev->ec->vkbd.vkbd)
- _conf_vkbd_register(conf, ev->ec);
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_conf_cb_client_rot_change_begin(void *data, int type EINA_UNUSED, void *event)
-{
- Conformant *conf;
- E_Event_Client *ev;
-
- ev = event;
- conf = data;
-
- if (ev->ec != conf->vkbd)
- goto end;
-
- /* set conformant area to non-visible state before starting rotation.
- * this is to prevent to apply wrong area of conformant area after rotation.
- * Suppose conformant area will be set later according to changes of vkbd such as resize or move.
- * if there is no being called rot_change_cancel and nothing changes vkbd,
- * that is unexpected case.
- */
- if (conf->state.visible)
- {
- CFDBG("Rotation Begin");
- _conf_state_update(conf, EINA_FALSE, conf->state.x, conf->state.y, conf->state.w, conf->state.h);
- conf->state.restore = EINA_TRUE;
- }
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_conf_cb_client_rot_change_cancel(void *data, int type EINA_UNUSED, void *event)
-{
- Conformant *conf;
- E_Event_Client *ev;
-
- ev = event;
- conf = data;
-
- if (ev->ec != conf->vkbd)
- goto end;
-
- if (conf->state.restore)
- {
- CFDBG("Rotation Cancel");
- _conf_state_update(conf, EINA_FALSE, conf->state.x, conf->state.y, conf->state.w, conf->state.h);
- conf->state.restore = EINA_TRUE;
- }
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_conf_cb_client_rot_change_end(void *data, int type EINA_UNUSED, void *event)
-{
- Conformant *conf;
- E_Event_Client *ev;
-
- ev = event;
- conf = data;
-
- if (ev->ec != conf->vkbd)
- goto end;
-
- conf->state.restore = EINA_FALSE;
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_conf_cb_client_del(void *data, E_Client *ec)
-{
- Conformant *conf;
- Conformant_Client *cfc;
-
- conf = data;
- if (!conf->client_hash)
- return;
-
- cfc = eina_hash_find(conf->client_hash, &ec);
- if (!cfc)
- return;
-
- eina_hash_del(conf->client_hash, &ec, cfc);
- _conf_client_del(cfc);
-}
-
-static Eina_Bool
-_conf_idle_enter(void *data)
-{
- Conformant *conf;
- Eina_Bool visible;
- int x, y, w, h;
-
- conf = data;
- if (!conf->vkbd)
- goto end;
-
- if (conf->changed)
- {
- visible = evas_object_visible_get(conf->vkbd->frame);
- evas_object_geometry_get(conf->vkbd->frame, &x, &y, &w, &h);
-
- _conf_state_update(conf, visible, x, y, w, h);
-
- conf->changed = EINA_FALSE;
- }
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_conf_event_init(Conformant *conf)
-{
- E_LIST_HANDLER_APPEND(conf->handlers, E_EVENT_CLIENT_ADD, _conf_cb_client_add, conf);
- E_LIST_HANDLER_APPEND(conf->handlers, E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN, _conf_cb_client_rot_change_begin, conf);
- E_LIST_HANDLER_APPEND(conf->handlers, E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL, _conf_cb_client_rot_change_cancel, conf);
- E_LIST_HANDLER_APPEND(conf->handlers, E_EVENT_CLIENT_ROTATION_CHANGE_END, _conf_cb_client_rot_change_end, conf);
-
- conf->client_del_hook = e_client_hook_add(E_CLIENT_HOOK_DEL, _conf_cb_client_del, conf);
- conf->idle_enterer = ecore_idle_enterer_add(_conf_idle_enter, conf);
-}
-
-static void
-_conf_event_shutdown(Conformant *conf)
-{
- E_FREE_LIST(conf->handlers, ecore_event_handler_del);
- E_FREE_FUNC(conf->client_del_hook, e_client_hook_del);
- E_FREE_FUNC(conf->idle_enterer, ecore_idle_enterer_del);
-}
-
-EINTERN void
-e_mod_conformant_client_add(E_Client *ec, struct wl_resource *res)
-{
- Conformant_Client *cfc;
-
- CONF_DATA_GET_OR_RETURN(conf);
-
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- CFDBG("Client Add '%s'(%p)", ec->icccm.name ? ec->icccm.name : "", ec);
-
- if (conf->client_hash)
- {
- cfc = eina_hash_find(conf->client_hash, &ec);
- if (cfc)
- {
- CFDBG("Already Added Client, Just Add Resource");
- _conf_client_resource_add(cfc, res);
- return;
- }
- }
-
- cfc = _conf_client_add(conf, ec, res);
-
- /* do we need to send conformant state if vkbd is visible ? */
-
- if (!conf->client_hash)
- conf->client_hash = eina_hash_pointer_new(NULL);
-
- eina_hash_add(conf->client_hash, &ec, cfc);
-}
-
-EINTERN void
-e_mod_conformant_client_del(E_Client *ec)
-{
- Conformant_Client *cfc;
-
- CONF_DATA_GET_OR_RETURN(conf);
-
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- CFDBG("Client Del '%s'(%p)", ec->icccm.name ? ec->icccm.name : "", ec);
-
- cfc = eina_hash_find(conf->client_hash, &ec);
- if (cfc)
- {
- eina_hash_del(conf->client_hash, &ec, cfc);
- _conf_client_del(cfc);
- }
-}
-
-EINTERN Eina_Bool
-e_mod_conformant_client_check(E_Client *ec)
-{
- CONF_DATA_GET_OR_RETURN_VAL(conf, EINA_FALSE);
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
-
- if (!conf->client_hash)
- return EINA_FALSE;
-
- return !!eina_hash_find(conf->client_hash, &ec);
-}
-
-EINTERN Eina_Bool
-e_mod_conformant_init(void)
-{
- Conformant *conf;
-
- if (_conf)
- return EINA_TRUE;
-
- CFINF("Conformant Module Init");
-
- conf = E_NEW(Conformant, 1);
- if (!conf)
- return EINA_FALSE;
-
- _conf_event_init(conf);
-
- _conf = conf;
-
- return EINA_TRUE;
-}
-
-EINTERN void
-e_mod_conformant_shutdown(void)
-{
- Conformant_Client *cfc;
- Eina_Iterator *itr;
-
- if (!_conf)
- return;
-
- CFINF("Conformant Module Shutdown");
-
- _conf_event_shutdown(_conf);
-
- itr = eina_hash_iterator_data_new(_conf->client_hash);
- EINA_ITERATOR_FOREACH(itr, cfc)
- _conf_client_del(cfc);
- eina_iterator_free(itr);
-
- E_FREE_FUNC(_conf->client_hash, eina_hash_free);
-
- E_FREE(_conf);
-}
+++ /dev/null
-#ifndef _E_MOD_CONFORMANT_H_
-#define _E_MOD_CONFORMANT_H_
-
-EINTERN Eina_Bool e_mod_conformant_init(void);
-EINTERN void e_mod_conformant_shutdown(void);
-EINTERN void e_mod_conformant_client_add(E_Client *ec, struct wl_resource *res);
-EINTERN void e_mod_conformant_client_del(E_Client *ec);
-EINTERN Eina_Bool e_mod_conformant_client_check(E_Client *ec);
-
-#endif
+++ /dev/null
-#include "e_mod_keyboard.h"
-#include "e_mod_rotation.h"
-
-EINTERN Eina_Bool
-e_mod_pol_client_is_keyboard(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (ec->vkbd.vkbd) return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-EINTERN Eina_Bool
-e_mod_pol_client_is_keyboard_sub(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (ec->vkbd.vkbd) return EINA_FALSE;
-
- if ((ec->icccm.class) &&
- (!strcmp(ec->icccm.class, "ISF")))
- return EINA_TRUE;
- if ((ec->icccm.title) &&
- (!strcmp(ec->icccm.title, "ISF Popup")))
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-EINTERN void
-e_mod_pol_keyboard_layout_apply(E_Client *ec EINA_UNUSED)
-{
-/* FIXME: do not resize and move client.
- * ec->e.state.rot.geom[].w/h is always 0,
- * then the geometry calculated here is not valid. */
-#if 0
- int angle;
- int angle_id = 0;
- int kbd_x, kbd_y, kbd_w, kbd_h;
-
- if (!e_mod_pol_client_is_keyboard(ec) &&
- !e_mod_pol_client_is_keyboard_sub(ec))
- return;
-
- angle = e_client_rotation_curr_angle_get(ec);
-
- switch (angle)
- {
- case 0: angle_id = 0; break;
- case 90: angle_id = 1; break;
- case 180: angle_id = 2; break;
- case 270: angle_id = 3; break;
- default: angle_id = 0; break;
- }
-
- kbd_w = ec->e.state.rot.geom[angle_id].w;
- kbd_h = ec->e.state.rot.geom[angle_id].h;
-
- switch (angle)
- {
- case 0:
- kbd_x = ec->zone->w - kbd_w;
- kbd_y = ec->zone->h - kbd_h;
- break;
-
- case 90:
- kbd_x = ec->zone->w - kbd_w;
- kbd_y = ec->zone->h - kbd_h;
- break;
-
- case 180:
- kbd_x = 0;
- kbd_y = 0;
- break;
-
- case 270:
- kbd_x = 0;
- kbd_y = 0;
- break;
-
- default:
- kbd_x = ec->zone->w - kbd_w;
- kbd_y = ec->zone->h - kbd_h;
- break;
- }
-
- if ((ec->frame) &&
- ((ec->w != kbd_w) || (ec->h != kbd_h)))
- e_client_util_resize_without_frame(ec, kbd_w, kbd_h);
-
- if ((e_mod_pol_client_is_keyboard(ec)) &&
- (ec->frame) &&
- ((ec->x != kbd_x) || (ec->y != kbd_y)))
- e_client_util_move_without_frame(ec, kbd_x, kbd_y);
-#endif
-}
+++ /dev/null
-#ifndef E_MOD_KEYBOARD_H
-#define E_MOD_KEYBOARD_H
-#include <e.h>
-
-EINTERN Eina_Bool e_mod_pol_client_is_keyboard(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_keyboard_sub(E_Client *ec);
-EINTERN void e_mod_pol_keyboard_layout_apply(E_Client *ec);
-
-#endif
#include "e_mod_main.h"
#include "e_mod_rotation.h"
-#include "e_mod_keyboard.h"
-#include "e_mod_transform_mode.h"
-#include "e_mod_conformant.h"
-#ifdef HAVE_WAYLAND_ONLY
-#include "e_mod_wl.h"
-#endif
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Policy-Mobile" };
Mod *_pol_mod = NULL;
-Eina_Hash *hash_pol_desks = NULL;
-Eina_Hash *hash_pol_clients = NULL;
-Pol_System_Info g_system_info =
-{
- {NULL, EINA_FALSE},
- { -1, -1, EINA_FALSE}
-};
-
-static Eina_List *handlers = NULL;
-static Eina_List *hooks_ec = NULL;
-static Eina_List *hooks_cp = NULL;
-static Ecore_Idle_Enterer *_idle_enterer = NULL;
-static Eina_Bool _changed_vis = EINA_FALSE;
-static Eina_List *_changed_zone = NULL;
-
-static Pol_Client *_pol_client_add(E_Client *ec);
-static void _pol_client_del(Pol_Client *pc);
-static Eina_Bool _pol_client_normal_check(E_Client *ec);
-static Eina_Bool _pol_client_maximize_policy_apply(Pol_Client *pc);
-static void _pol_client_maximize_policy_cancel(Pol_Client *pc);
-static void _pol_client_floating_policy_apply(Pol_Client *pc);
-static void _pol_client_floating_policy_cancel(Pol_Client *pc);
-static void _pol_client_launcher_set(Pol_Client *pc);
-
-static void _pol_cb_hook_client_eval_pre_new_client(void *d EINA_UNUSED, E_Client *ec);
-static void _pol_cb_hook_client_eval_pre_fetch(void *d EINA_UNUSED, E_Client *ec);
-static void _pol_cb_hook_client_eval_pre_post_fetch(void *d EINA_UNUSED, E_Client *ec);
-static void _pol_cb_hook_client_eval_post_fetch(void *d EINA_UNUSED, E_Client *ec);
-static void _pol_cb_hook_client_eval_post_new_client(void *d EINA_UNUSED, E_Client *ec);
-static void _pol_cb_hook_client_desk_set(void *d EINA_UNUSED, E_Client *ec);
-static void _pol_cb_hook_client_fullscreen_pre(void *data EINA_UNUSED, E_Client *ec);
-
-static void _pol_cb_hook_pixmap_del(void *data EINA_UNUSED, E_Pixmap *cp);
-static void _pol_cb_hook_pixmap_unusable(void *data EINA_UNUSED, E_Pixmap *cp);
-
-static void _pol_cb_desk_data_free(void *data);
-static void _pol_cb_client_data_free(void *data);
-static Eina_Bool _pol_cb_zone_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
-static Eina_Bool _pol_cb_zone_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
-static Eina_Bool _pol_cb_zone_move_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
-static Eina_Bool _pol_cb_zone_desk_count_set(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
-static Eina_Bool _pol_cb_zone_display_state_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
-static Eina_Bool _pol_cb_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
-static Eina_Bool _pol_cb_client_add(void *data EINA_UNUSED, int type, void *event);
-static Eina_Bool _pol_cb_client_move(void *data EINA_UNUSED, int type, void *event);
-static Eina_Bool _pol_cb_client_resize(void *data EINA_UNUSED, int type, void *event);
-static Eina_Bool _pol_cb_client_stack(void *data EINA_UNUSED, int type, void *event);
-static Eina_Bool _pol_cb_client_property(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
-static Eina_Bool _pol_cb_client_vis_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED);
-static Eina_Bool _pol_cb_client_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
-static Eina_Bool _pol_cb_module_defer_job(void *data EINA_UNUSED);
-
-
-static void
-_pol_client_launcher_set(Pol_Client *pc)
-{
- Pol_Client *pc2;
-
- pc2 = e_mod_pol_client_launcher_get(pc->ec->zone);
- if (pc2) return;
-
- if (pc->ec->netwm.type != _pol_mod->conf->launcher.type)
- return;
-
- if (e_util_strcmp(pc->ec->icccm.class,
- _pol_mod->conf->launcher.clas))
- return;
-
-
- if (e_util_strcmp(pc->ec->icccm.title,
- _pol_mod->conf->launcher.title))
- {
- /* check netwm name instead, because comp_x had ignored
- * icccm name when fetching */
- if (e_util_strcmp(pc->ec->netwm.name,
- _pol_mod->conf->launcher.title))
- {
- return;
- }
- }
-
- _pol_mod->launchers = eina_list_append(_pol_mod->launchers, pc);
-}
-
-static Pol_Client *
-_pol_client_add(E_Client *ec)
-{
- Pol_Client *pc;
-
- if (e_object_is_del(E_OBJECT(ec))) return NULL;
-
- pc = eina_hash_find(hash_pol_clients, &ec);
- if (pc) return NULL;
-
- pc = E_NEW(Pol_Client, 1);
- pc->ec = ec;
-
- eina_hash_add(hash_pol_clients, &ec, pc);
-
- return pc;
-}
-
-static void
-_pol_client_del(Pol_Client *pc)
-{
- eina_hash_del_by_key(hash_pol_clients, &pc->ec);
-}
-
-static Eina_Bool
-_pol_client_normal_check(E_Client *ec)
-{
- Pol_Client *pc;
-
- if ((e_client_util_ignored_get(ec)) ||
- (!ec->pixmap))
- {
- return EINA_FALSE;
- }
-
- if (e_mod_pol_client_is_quickpanel(ec))
- {
- return EINA_FALSE;
- }
-
- if (e_mod_pol_client_is_keyboard(ec) ||
- e_mod_pol_client_is_keyboard_sub(ec))
- {
- e_mod_pol_keyboard_layout_apply(ec);
- goto cancel_max;
- }
- else if (e_mod_pol_client_is_volume_tv(ec))
- goto cancel_max;
- else if (!e_util_strcmp("e_demo", ec->icccm.window_role))
- goto cancel_max;
- else if (e_mod_pol_client_is_floating(ec))
- {
- pc = eina_hash_find(hash_pol_clients, &ec);
- _pol_client_maximize_policy_cancel(pc);
- _pol_client_floating_policy_apply(pc);
- return EINA_FALSE;
- }
-#ifdef HAVE_WAYLAND_ONLY
- else if (e_mod_pol_client_is_subsurface(ec))
- goto cancel_max;
-#endif
-
- if ((ec->netwm.type == E_WINDOW_TYPE_NORMAL) ||
- (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN) ||
- (ec->netwm.type == E_WINDOW_TYPE_NOTIFICATION))
- {
- return EINA_TRUE;
- }
-
- return EINA_FALSE;
-
-cancel_max:
- pc = eina_hash_find(hash_pol_clients, &ec);
- _pol_client_maximize_policy_cancel(pc);
-
- return EINA_FALSE;
-}
-
-static void
-_pol_client_maximize_pre(Pol_Client *pc)
-{
- E_Client *ec;
- int zx, zy, zw, zh;
-
- ec = pc->ec;
-
- if (ec->desk->visible)
- e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh);
- else
- {
- zx = ec->zone->x;
- zy = ec->zone->y;
- zw = ec->zone->w;
- zh = ec->zone->h;
- }
-
- ec->x = ec->client.x = zx;
- ec->y = ec->client.y = zy;
- ec->w = ec->client.w = zw;
- ec->h = ec->client.h = zh;
-
- EC_CHANGED(ec);
-}
-
-static Eina_Bool
-_pol_client_maximize_policy_apply(Pol_Client *pc)
-{
- E_Client *ec;
-
- if (!pc) return EINA_FALSE;
- if (pc->max_policy_state) return EINA_FALSE;
- if (pc->allow_user_geom) return EINA_FALSE;
-
- ec = pc->ec;
- if (ec->netwm.type == E_WINDOW_TYPE_UTILITY) return EINA_FALSE;
-
- pc->max_policy_state = EINA_TRUE;
-
-#undef _SET
-# define _SET(a) pc->orig.a = pc->ec->a
- _SET(borderless);
- _SET(fullscreen);
- _SET(maximized);
- _SET(lock_user_location);
- _SET(lock_client_location);
- _SET(lock_user_size);
- _SET(lock_client_size);
- _SET(lock_client_stacking);
- _SET(lock_user_shade);
- _SET(lock_client_shade);
- _SET(lock_user_maximize);
- _SET(lock_client_maximize);
- _SET(lock_user_fullscreen);
- _SET(lock_client_fullscreen);
-#undef _SET
-
- _pol_client_launcher_set(pc);
-
- if (ec->remember)
- {
- e_remember_del(ec->remember);
- ec->remember = NULL;
- }
-
- /* skip hooks of e_remeber for eval_pre_post_fetch and eval_post_new_client */
- ec->internal_no_remember = 1;
-
- if (!ec->borderless)
- {
- ec->borderless = 1;
- ec->border.changed = 1;
- EC_CHANGED(pc->ec);
- }
-
- if (!ec->maximized)
- {
- e_client_maximize(ec, E_MAXIMIZE_EXPAND | E_MAXIMIZE_BOTH);
-
- if (ec->changes.need_maximize)
- _pol_client_maximize_pre(pc);
- }
-
- /* do not allow client to change these properties */
- ec->lock_user_location = 1;
- ec->lock_client_location = 1;
- ec->lock_user_size = 1;
- ec->lock_client_size = 1;
- ec->lock_user_shade = 1;
- ec->lock_client_shade = 1;
- ec->lock_user_maximize = 1;
- ec->lock_client_maximize = 1;
- ec->lock_user_fullscreen = 1;
- ec->lock_client_fullscreen = 1;
- ec->skip_fullscreen = 1;
-
- if (!e_mod_pol_client_is_home_screen(ec))
- ec->lock_client_stacking = 1;
-
- return EINA_TRUE;
-}
-
-static void
-_pol_client_maximize_policy_cancel(Pol_Client *pc)
-{
- E_Client *ec;
- Eina_Bool changed = EINA_FALSE;
-
- if (!pc) return;
- if (!pc->max_policy_state) return;
-
- pc->max_policy_state = EINA_FALSE;
-
- ec = pc->ec;
-
- if (pc->orig.borderless != ec->borderless)
- {
- ec->border.changed = 1;
- changed = EINA_TRUE;
- }
-
- if ((pc->orig.fullscreen != ec->fullscreen) &&
- (pc->orig.fullscreen))
- {
- ec->need_fullscreen = 1;
- changed = EINA_TRUE;
- }
-
- if (pc->orig.maximized != ec->maximized)
- {
- if (pc->orig.maximized)
- ec->changes.need_maximize = 1;
- else
- e_client_unmaximize(ec, ec->maximized);
-
- changed = EINA_TRUE;
- }
-
-#undef _SET
-# define _SET(a) ec->a = pc->orig.a
- _SET(borderless);
- _SET(fullscreen);
- _SET(maximized);
- _SET(lock_user_location);
- _SET(lock_client_location);
- _SET(lock_user_size);
- _SET(lock_client_size);
- _SET(lock_client_stacking);
- _SET(lock_user_shade);
- _SET(lock_client_shade);
- _SET(lock_user_maximize);
- _SET(lock_client_maximize);
- _SET(lock_user_fullscreen);
- _SET(lock_client_fullscreen);
-#undef _SET
-
- ec->skip_fullscreen = 0;
-
- /* only set it if the border is changed or fullscreen/maximize has changed */
- if (changed)
- EC_CHANGED(pc->ec);
-
- _pol_mod->launchers = eina_list_remove(_pol_mod->launchers, pc);
-}
-
-static void
-_pol_client_floating_policy_apply(Pol_Client *pc)
-{
- E_Client *ec;
-
- if (!pc) return;
- if (pc->flt_policy_state) return;
-
- pc->flt_policy_state = EINA_TRUE;
- ec = pc->ec;
-
-#undef _SET
-# define _SET(a) pc->orig.a = pc->ec->a
- _SET(fullscreen);
- _SET(lock_client_stacking);
- _SET(lock_user_shade);
- _SET(lock_client_shade);
- _SET(lock_user_maximize);
- _SET(lock_client_maximize);
- _SET(lock_user_fullscreen);
- _SET(lock_client_fullscreen);
-#undef _SET
-
- ec->skip_fullscreen = 1;
- ec->lock_client_stacking = 1;
- ec->lock_user_shade = 1;
- ec->lock_client_shade = 1;
- ec->lock_user_maximize = 1;
- ec->lock_client_maximize = 1;
- ec->lock_user_fullscreen = 1;
- ec->lock_client_fullscreen = 1;
-}
-
-static void
-_pol_client_floating_policy_cancel(Pol_Client *pc)
-{
- E_Client *ec;
- Eina_Bool changed = EINA_FALSE;
-
- if (!pc) return;
- if (!pc->flt_policy_state) return;
-
- pc->flt_policy_state = EINA_FALSE;
- ec = pc->ec;
-
- if ((pc->orig.fullscreen != ec->fullscreen) &&
- (pc->orig.fullscreen))
- {
- ec->need_fullscreen = 1;
- changed = EINA_TRUE;
- }
-
- if (pc->orig.maximized != ec->maximized)
- {
- if (pc->orig.maximized)
- ec->changes.need_maximize = 1;
- else
- e_client_unmaximize(ec, ec->maximized);
-
- changed = EINA_TRUE;
- }
-
- ec->skip_fullscreen = 0;
-
-#undef _SET
-# define _SET(a) ec->a = pc->orig.a
- _SET(fullscreen);
- _SET(lock_client_stacking);
- _SET(lock_user_shade);
- _SET(lock_client_shade);
- _SET(lock_user_maximize);
- _SET(lock_client_maximize);
- _SET(lock_user_fullscreen);
- _SET(lock_client_fullscreen);
-#undef _SET
-
- if (changed)
- EC_CHANGED(pc->ec);
-}
-
-static void
-_pol_cb_hook_client_new(void *d EINA_UNUSED, E_Client *ec)
-{
- if (EINA_UNLIKELY(!ec))
- return;
-
- _pol_client_add(ec);
-}
-
-static void
-_pol_cb_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
-{
- Pol_Client *pc;
-
- if (EINA_UNLIKELY(!ec))
- return;
-
- e_mod_pol_wl_win_brightness_apply(ec);
- e_tzsh_indicator_srv_ower_win_update(ec->zone);
-
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_client_del(ec);
-#endif
-
- if (e_mod_pol_client_is_lockscreen(ec))
- e_mod_pol_stack_clients_restack_above_lockscreen(ec, EINA_FALSE);
-
- e_mod_pol_stack_cb_client_remove(ec);
- e_client_visibility_calculate();
-
- pc = eina_hash_find(hash_pol_clients, &ec);
- _pol_client_del(pc);
-}
-
-static void
-_pol_cb_hook_client_eval_pre_new_client(void *d EINA_UNUSED, E_Client *ec)
-{
- short ly;
-
- if (e_object_is_del(E_OBJECT(ec))) return;
-
- if (e_mod_pol_client_is_keyboard_sub(ec))
- {
- ec->placed = 1;
- ec->exp_iconify.skip_iconify = EINA_TRUE;
-
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
- if (ec->layer != E_LAYER_CLIENT_ABOVE)
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
- }
- if (e_mod_pol_client_is_noti(ec))
- {
- if (ec->frame)
- {
- ly = evas_object_layer_get(ec->frame);
- ELOGF("NOTI", " |ec->layer:%d object->layer:%d", ec->pixmap, ec, ec->layer, ly);
- if (ly != ec->layer)
- evas_object_layer_set(ec->frame, ec->layer);
- }
- }
- if (e_mod_pol_client_is_floating(ec))
- {
- if (ec->frame)
- {
- if (ec->layer != E_LAYER_CLIENT_ABOVE)
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
- }
- }
-}
-
-static void
-_pol_cb_hook_client_eval_pre_fetch(void *d EINA_UNUSED, E_Client *ec)
-{
- if (e_object_is_del(E_OBJECT(ec))) return;
-
- e_mod_pol_stack_hook_pre_fetch(ec);
-}
-
-static void
-_pol_cb_hook_client_eval_pre_post_fetch(void *d EINA_UNUSED, E_Client *ec)
-{
- if (e_object_is_del(E_OBJECT(ec))) return;
-
- e_mod_pol_stack_hook_pre_post_fetch(ec);
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_notification_level_fetch(ec);
- e_mod_pol_wl_eval_pre_post_fetch(ec);
-#endif
-
-}
-
-static void
-_pol_cb_hook_client_eval_post_fetch(void *d EINA_UNUSED, E_Client *ec)
-{
- Pol_Client *pc;
- Pol_Desk *pd;
-
- if (e_object_is_del(E_OBJECT(ec))) return;
- /* Following E_Clients will be added to module hash and will be managed.
- *
- * - Not new client: Updating internal info of E_Client has been finished
- * by e main evaluation, thus module can classify E_Client and manage it.
- *
- * - New client that has valid buffer: This E_Client has been passed e main
- * evaluation, and it has handled first wl_surface::commit request.
- */
- if ((ec->new_client) && (!e_pixmap_usable_get(ec->pixmap))) return;
-
- if (e_mod_pol_client_is_keyboard(ec) ||
- e_mod_pol_client_is_keyboard_sub(ec))
- {
- Pol_Client *pc;
- pc = eina_hash_find(hash_pol_clients, &ec);
- _pol_client_maximize_policy_cancel(pc);
-
- e_mod_pol_keyboard_layout_apply(ec);
- }
-
- if (!e_util_strcmp("wl_pointer-cursor", ec->icccm.window_role))
- {
- Pol_Client *pc;
- pc = eina_hash_find(hash_pol_clients, &ec);
- _pol_client_maximize_policy_cancel(pc);
- return;
- }
-
- if (e_mod_pol_client_is_floating(ec))
- {
- Pol_Client *pc;
- pc = eina_hash_find(hash_pol_clients, &ec);
- _pol_client_maximize_policy_cancel(pc);
- _pol_client_floating_policy_apply(pc);
- return;
- }
-
- if (!_pol_client_normal_check(ec)) return;
-
- pd = eina_hash_find(hash_pol_desks, &ec->desk);
- if (!pd) return;
-
- pc = eina_hash_find(hash_pol_clients, &ec);
- if (!pc) return;
-
- if (pc->flt_policy_state)
- _pol_client_floating_policy_cancel(pc);
-
- _pol_client_maximize_policy_apply(pc);
-}
-
-static void
-_pol_cb_hook_client_eval_post_new_client(void *d EINA_UNUSED, E_Client *ec)
-{
- if (e_object_is_del(E_OBJECT(ec))) return;
- if ((ec->new_client) && (!e_pixmap_usable_get(ec->pixmap))) return;
-
- if (e_mod_pol_client_is_lockscreen(ec))
- e_mod_pol_stack_clients_restack_above_lockscreen(ec, EINA_TRUE);
-}
-
-static void
-_pol_cb_hook_client_desk_set(void *d EINA_UNUSED, E_Client *ec)
-{
- Pol_Client *pc;
- Pol_Desk *pd;
-
- if (e_object_is_del(E_OBJECT(ec))) return;
- if (!_pol_client_normal_check(ec)) return;
- if (ec->internal) return;
- if (ec->new_client) return;
-
- pc = eina_hash_find(hash_pol_clients, &ec);
- if (EINA_UNLIKELY(!pc))
- return;
-
- pd = eina_hash_find(hash_pol_desks, &ec->desk);
-
- if (pd)
- _pol_client_maximize_policy_apply(pc);
- else
- _pol_client_maximize_policy_cancel(pc);
-}
-
-static void
-_pol_cb_hook_client_fullscreen_pre(void* data EINA_UNUSED, E_Client *ec)
-{
- if (e_object_is_del(E_OBJECT(ec))) return;
- if (!_pol_client_normal_check(ec)) return;
- if (ec->internal) return;
-
- ec->skip_fullscreen = 1;
-}
-
-static void
-_pol_cb_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec)
-{
- if (ec->visibility.changed)
- {
- e_mod_pol_client_visibility_send(ec);
-
- if (ec->visibility.obscured == E_VISIBILITY_UNOBSCURED)
- {
- e_mod_pol_client_uniconify_by_visibility(ec);
- }
- else
- {
- e_mod_pol_client_iconify_by_visibility(ec);
- }
-
- e_mod_pol_wl_win_brightness_apply(ec);
-
- _changed_vis = EINA_TRUE;
- if (!eina_list_data_find(_changed_zone, ec->zone))
- _changed_zone = eina_list_append(_changed_zone, ec->zone);
- }
- else
- {
- if (ec->visibility.obscured == E_VISIBILITY_FULLY_OBSCURED)
- {
- Eina_Bool obscured_by_alpha_opaque = EINA_FALSE;
- Eina_Bool find_above = EINA_FALSE;
- E_Client *above_ec;
- Evas_Object *o;
-
- if (ec->zone->display_state == E_ZONE_DISPLAY_STATE_ON)
- {
- for (o = evas_object_above_get(ec->frame); o; o = evas_object_above_get(o))
- {
- above_ec = evas_object_data_get(o, "E_Client");
- if (!above_ec) continue;
- if (e_client_util_ignored_get(above_ec)) continue;
-
- if (above_ec->exp_iconify.by_client) continue;
- if (above_ec->exp_iconify.skip_iconify) continue;
-
- if (!above_ec->iconic)
- {
- if (above_ec->argb && (above_ec->visibility.opaque > 0))
- obscured_by_alpha_opaque = EINA_TRUE;
- }
- find_above = EINA_TRUE;
- break;
- }
-
- if (!find_above) return;
- if (obscured_by_alpha_opaque)
- {
- e_mod_pol_client_uniconify_by_visibility(ec);
- }
- else
- {
- e_mod_pol_client_iconify_by_visibility(ec);
- }
- }
- else if (ec->zone->display_state == E_ZONE_DISPLAY_STATE_OFF)
- {
- if (e_client_util_ignored_get(ec)) return;
- if (ec->exp_iconify.by_client) return;
- if (ec->exp_iconify.skip_iconify) return;
- if (!ec->iconic)
- {
- e_mod_pol_client_iconify_by_visibility(ec);
- }
- }
- }
- }
-}
-
-static void
-_pol_cb_hook_pixmap_del(void *data EINA_UNUSED, E_Pixmap *cp)
-{
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_pixmap_del(cp);
-#endif
-}
-
-static void
-_pol_cb_hook_pixmap_unusable(void *data EINA_UNUSED, E_Pixmap *cp)
-{
- E_Client *ec = (E_Client *)e_pixmap_client_get(cp);
-
- if (!ec) return;
- if (!ec->iconic) return;
- if (ec->exp_iconify.by_client) return;
- if (ec->exp_iconify.skip_iconify) return;
-
- ec->exp_iconify.not_raise = 1;
- e_client_uniconify(ec);
- e_mod_pol_wl_iconify_state_change_send(ec, 0);
-}
-
-static void
-_pol_cb_desk_data_free(void *data)
-{
- free(data);
-}
-
-static void
-_pol_cb_client_data_free(void *data)
-{
- free(data);
-}
-
-static Eina_Bool
-_pol_cb_zone_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Zone_Add *ev;
- E_Zone *zone;
- Config_Desk *d;
- int i, n;
-
- ev = event;
- zone = ev->zone;
- n = zone->desk_y_count * zone->desk_x_count;
- for (i = 0; i < n; i++)
- {
- d = e_mod_pol_conf_desk_get_by_nums(_pol_mod->conf,
- zone->num,
- zone->desks[i]->x,
- zone->desks[i]->y);
- if (d)
- e_mod_pol_desk_add(zone->desks[i]);
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_zone_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Zone_Del *ev;
- E_Zone *zone;
- Pol_Desk *pd;
- int i, n;
-
- ev = event;
- zone = ev->zone;
- n = zone->desk_y_count * zone->desk_x_count;
- for (i = 0; i < n; i++)
- {
- pd = eina_hash_find(hash_pol_desks, &zone->desks[i]);
- if (pd) e_mod_pol_desk_del(pd);
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_zone_move_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Zone_Move_Resize *ev;
- Pol_Softkey *softkey;
-
- ev = event;
-
- if (_pol_mod->conf->use_softkey)
- {
- softkey = e_mod_pol_softkey_get(ev->zone);
- e_mod_pol_softkey_update(softkey);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_zone_desk_count_set(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Zone_Desk_Count_Set *ev;
- E_Zone *zone;
- E_Desk *desk;
- Eina_Iterator *it;
- Pol_Desk *pd;
- Config_Desk *d;
- int i, n;
- Eina_Bool found;
- Eina_List *desks_del = NULL;
-
- ev = event;
- zone = ev->zone;
-
- /* remove deleted desk from hash */
- it = eina_hash_iterator_data_new(hash_pol_desks);
- while (eina_iterator_next(it, (void **)&pd))
- {
- if (pd->zone != zone) continue;
-
- found = EINA_FALSE;
- n = zone->desk_y_count * zone->desk_x_count;
- for (i = 0; i < n; i++)
- {
- if (pd->desk == zone->desks[i])
- {
- found = EINA_TRUE;
- break;
- }
- }
- if (!found)
- desks_del = eina_list_append(desks_del, pd->desk);
- }
- eina_iterator_free(it);
-
- EINA_LIST_FREE(desks_del, desk)
- {
- pd = eina_hash_find(hash_pol_desks, &desk);
- if (pd) e_mod_pol_desk_del(pd);
- }
-
- /* add newly added desk to hash */
- n = zone->desk_y_count * zone->desk_x_count;
- for (i = 0; i < n; i++)
- {
- d = e_mod_pol_conf_desk_get_by_nums(_pol_mod->conf,
- zone->num,
- zone->desks[i]->x,
- zone->desks[i]->y);
- if (d)
- e_mod_pol_desk_add(zone->desks[i]);
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_zone_display_state_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Zone_Display_State_Change *ev;
-
- ev = event;
- if (!ev) return ECORE_CALLBACK_PASS_ON;
-
- e_client_visibility_calculate();
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Desk_Show *ev;
- Pol_Softkey *softkey;
-
- ev = event;
-
- if (_pol_mod->conf->use_softkey)
- {
- softkey = e_mod_pol_softkey_get(ev->desk->zone);
- if (eina_hash_find(hash_pol_desks, &ev->desk))
- e_mod_pol_softkey_show(softkey);
- else
- e_mod_pol_softkey_hide(softkey);
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Client *ev;
-
- ev = event;
- EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON);
-
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_client_add(ev->ec);
-#endif
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_client_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Client *ev;
-
- ev = event;
- if (!ev) goto end;
-
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_position_send(ev->ec);
-#endif
- e_client_visibility_calculate();
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_client_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Client *ev;
- E_Client *ec;
- int zh = 0;
-
- ev = (E_Event_Client *)event;
- EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON);
-
- ec = ev->ec;
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ECORE_CALLBACK_PASS_ON);
-
- /* re-calculate window's position with changed size */
- if (e_mod_pol_client_is_volume_tv(ec))
- {
- e_zone_useful_geometry_get(ec->zone, NULL, NULL, NULL, &zh);
- evas_object_move(ec->frame, 0, (zh / 2) - (ec->h / 2));
-
- evas_object_pass_events_set(ec->frame, 1);
- }
-
- /* calculate e_client visibility */
- e_client_visibility_calculate();
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_client_stack(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Client *ev;
-
- ev = event;
- if (!ev) return ECORE_CALLBACK_PASS_ON;
- /* calculate e_client visibility */
- e_client_visibility_calculate();
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_client_property(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Client_Property *ev;
-
- ev = event;
- if (!ev || (!ev->ec)) return ECORE_CALLBACK_PASS_ON;
- if (ev->property & E_CLIENT_PROPERTY_CLIENT_TYPE)
- {
- if (e_mod_pol_client_is_home_screen(ev->ec))
- {
- ev->ec->lock_client_stacking = 0;
- return ECORE_CALLBACK_PASS_ON;
- }
- else if (e_mod_pol_client_is_lockscreen(ev->ec))
- return ECORE_CALLBACK_PASS_ON;
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_client_vis_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
-{
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_win_scrmode_apply();
-#endif
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_client_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Client *ev;
- E_Client *ec;
-
- ev = event;
- if (!ev) return ECORE_CALLBACK_PASS_ON;
-
- ec = ev->ec;
- e_tzsh_indicator_srv_ower_win_update(ec->zone);
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_cb_idle_enterer(void *data __UNUSED__)
-{
- E_Zone *zone;
-
- if (_changed_vis)
- {
- EINA_LIST_FREE(_changed_zone, zone)
- {
- e_tzsh_indicator_srv_ower_win_update(zone);
- }
- _changed_zone = NULL;
- }
- _changed_vis = EINA_FALSE;
-
- return ECORE_CALLBACK_RENEW;
-}
-
-void
-e_mod_pol_allow_user_geometry_set(E_Client *ec, Eina_Bool set)
-{
- Pol_Client *pc;
-
- if (EINA_UNLIKELY(!ec))
- return;
-
- pc = eina_hash_find(hash_pol_clients, &ec);
- if (EINA_UNLIKELY(!pc))
- return;
-
- if (set) pc->user_geom_ref++;
- else pc->user_geom_ref--;
-
- if (pc->user_geom_ref == 1 && !pc->allow_user_geom)
- {
- pc->allow_user_geom = EINA_TRUE;
-
- if (!e_mod_pol_client_is_noti(ec))
- {
- ec->netwm.type = E_WINDOW_TYPE_UTILITY;
- ec->lock_client_location = EINA_FALSE;
- }
-
- ec->lock_client_size = EINA_FALSE;
- ec->placed = 1;
- EC_CHANGED(ec);
- }
- else if (pc->user_geom_ref == 0 && pc->allow_user_geom)
- {
- pc->allow_user_geom = EINA_FALSE;
-
- ec->lock_client_location = EINA_TRUE;
- ec->lock_client_size = EINA_TRUE;
- ec->placed = 0;
- ec->netwm.type = E_WINDOW_TYPE_NORMAL;
- EC_CHANGED(ec);
- }
-}
-
-void
-e_mod_pol_desk_add(E_Desk *desk)
-{
- Pol_Desk *pd;
- E_Client *ec;
- Pol_Softkey *softkey;
- Pol_Client *pc;
-
- pd = eina_hash_find(hash_pol_desks, &desk);
- if (pd) return;
-
- pd = E_NEW(Pol_Desk, 1);
- pd->desk = desk;
- pd->zone = desk->zone;
-
- eina_hash_add(hash_pol_desks, &desk, pd);
-
- /* add clients */
- E_CLIENT_FOREACH(ec)
- {
- if (pd->desk == ec->desk)
- {
- pc = eina_hash_find(hash_pol_clients, &ec);
- _pol_client_maximize_policy_apply(pc);
- }
- }
-
- /* add and show softkey */
- if (_pol_mod->conf->use_softkey)
- {
- softkey = e_mod_pol_softkey_get(desk->zone);
- if (!softkey)
- softkey = e_mod_pol_softkey_add(desk->zone);
- if (e_desk_current_get(desk->zone) == desk)
- e_mod_pol_softkey_show(softkey);
- }
-}
-
-void
-e_mod_pol_desk_del(Pol_Desk *pd)
-{
- Eina_Iterator *it;
- Pol_Client *pc;
- E_Client *ec;
- Eina_List *clients_del = NULL;
- Pol_Softkey *softkey;
- Eina_Bool keep = EINA_FALSE;
- int i, n;
-
- /* hide and delete softkey */
- if (_pol_mod->conf->use_softkey)
- {
- softkey = e_mod_pol_softkey_get(pd->zone);
- if (e_desk_current_get(pd->zone) == pd->desk)
- e_mod_pol_softkey_hide(softkey);
-
- n = pd->zone->desk_y_count * pd->zone->desk_x_count;
- for (i = 0; i < n; i++)
- {
- if (eina_hash_find(hash_pol_desks, &pd->zone->desks[i]))
- {
- keep = EINA_TRUE;
- break;
- }
- }
-
- if (!keep)
- e_mod_pol_softkey_del(softkey);
- }
-
- /* remove clients */
- it = eina_hash_iterator_data_new(hash_pol_clients);
- while (eina_iterator_next(it, (void **)&pc))
- {
- if (pc->ec->desk == pd->desk)
- clients_del = eina_list_append(clients_del, pc->ec);
- }
- eina_iterator_free(it);
-
- EINA_LIST_FREE(clients_del, ec)
- {
- pc = eina_hash_find(hash_pol_clients, &ec);
- _pol_client_maximize_policy_cancel(pc);
- }
-
- eina_hash_del_by_key(hash_pol_desks, &pd->desk);
-}
-
-Pol_Client *
-e_mod_pol_client_launcher_get(E_Zone *zone)
-{
- Pol_Client *pc;
- Eina_List *l;
-
- EINA_LIST_FOREACH(_pol_mod->launchers, l, pc)
- {
- if (pc->ec->zone == zone)
- return pc;
- }
- return NULL;
-}
-
-Eina_Bool
-e_mod_pol_client_maximize(E_Client *ec)
-{
- Pol_Desk *pd;
- Pol_Client *pc;
-
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (EINA_UNLIKELY(!ec)) return EINA_FALSE;
- if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
-
- if ((e_mod_pol_client_is_keyboard(ec)) ||
- (e_mod_pol_client_is_keyboard_sub(ec)) ||
- (e_mod_pol_client_is_floating(ec)) ||
- (e_mod_pol_client_is_quickpanel(ec)) ||
- (e_mod_pol_client_is_volume(ec)) ||
- (!e_util_strcmp("wl_pointer-cursor", ec->icccm.window_role)) ||
- (!e_util_strcmp("e_demo", ec->icccm.window_role)))
- return EINA_FALSE;
-
-#ifdef HAVE_WAYLAND_ONLY
- if (e_mod_pol_client_is_subsurface(ec)) return EINA_FALSE;
-#endif
-
- if ((ec->netwm.type != E_WINDOW_TYPE_NORMAL) &&
- (ec->netwm.type != E_WINDOW_TYPE_UNKNOWN) &&
- (ec->netwm.type != E_WINDOW_TYPE_NOTIFICATION))
- return EINA_FALSE;
-
- pd = eina_hash_find(hash_pol_desks, &ec->desk);
- if (!pd) return EINA_FALSE;
-
- pc = eina_hash_find(hash_pol_clients, &ec);
- EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
-
- if (pc->flt_policy_state)
- _pol_client_floating_policy_cancel(pc);
-
- return _pol_client_maximize_policy_apply(pc);
-}
-
-Eina_Bool
-e_mod_pol_client_is_lockscreen(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (ec->client_type == 2)
- return EINA_TRUE;
-
- if (!e_util_strcmp(ec->icccm.title, "LOCKSCREEN"))
- return EINA_TRUE;
-
- if (!e_util_strcmp(ec->icccm.window_role, "lockscreen"))
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-Eina_Bool
-e_mod_pol_client_is_home_screen(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (ec->client_type == 1)
- return EINA_TRUE;
-
-
- return EINA_FALSE;
-}
-
-Eina_Bool
-e_mod_pol_client_is_quickpanel(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (!e_util_strcmp(ec->icccm.window_role, "quickpanel"))
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-Eina_Bool
-e_mod_pol_client_is_conformant(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
-
-#ifdef HAVE_WAYLAND_ONLY
- E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
- if (cdata->conformant == 1)
- {
- return EINA_TRUE;
- }
-#endif
-
- return EINA_FALSE;
-}
-
-Eina_Bool
-e_mod_pol_client_is_volume(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (!e_util_strcmp(ec->netwm.name, "volume"))
- return EINA_TRUE;
-
- if (!e_util_strcmp(ec->icccm.title, "volume"))
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-Eina_Bool
-e_mod_pol_client_is_volume_tv(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (!e_util_strcmp(ec->icccm.window_role, "tv-volume-popup"))
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-Eina_Bool
-e_mod_pol_client_is_noti(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (!e_util_strcmp(ec->icccm.title, "noti_win"))
- return EINA_TRUE;
-
- if (ec->netwm.type == E_WINDOW_TYPE_NOTIFICATION)
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-#ifdef HAVE_WAYLAND_ONLY
-Eina_Bool
-e_mod_pol_client_is_subsurface(E_Client *ec)
-{
- E_Comp_Wl_Client_Data *cd;
-
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- cd = (E_Comp_Wl_Client_Data *)ec->comp_data;
- if (cd && cd->sub.data)
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-#endif
-
-Eina_Bool
-e_mod_pol_client_is_floating(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (EINA_UNLIKELY(!ec))
- return EINA_FALSE;
-
- return ec->floating;
-}
-
-Eina_Bool
-e_mod_pol_client_is_cursor(E_Client *ec)
-{
- E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
- E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
-
- if (!e_util_strcmp("wl_pointer-cursor", ec->icccm.window_role))
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-static Eina_Bool
-_pol_cb_module_defer_job(void *data EINA_UNUSED)
-{
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_defer_job();
-#endif
- return ECORE_CALLBACK_PASS_ON;
-}
-
-#undef E_CLIENT_HOOK_APPEND
-#define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
- do \
- { \
- E_Client_Hook *_h; \
- _h = e_client_hook_add(t, cb, d); \
- assert(_h); \
- l = eina_list_append(l, _h); \
- } \
- while (0)
-
-#undef E_PIXMAP_HOOK_APPEND
-#define E_PIXMAP_HOOK_APPEND(l, t, cb, d) \
- do \
- { \
- E_Pixmap_Hook *_h; \
- _h = e_pixmap_hook_add(t, cb, d); \
- assert(_h); \
- l = eina_list_append(l, _h); \
- } \
- while (0)
E_API void *
e_modapi_init(E_Module *m)
{
Mod *mod;
- E_Zone *zone;
- Config_Desk *d;
- const Eina_List *l;
- int i, n;
- //char buf[PATH_MAX];
mod = E_NEW(Mod, 1);
EINA_SAFETY_ON_NULL_RETURN_VAL(mod, NULL);
mod->module = m;
_pol_mod = mod;
- if (e_config->use_e_policy)
- {
- e_mod_pol_conf_init(mod);
- e_mod_pol_rotation_init();
- return mod;
- }
-
- hash_pol_clients = eina_hash_pointer_new(_pol_cb_client_data_free);
- hash_pol_desks = eina_hash_pointer_new(_pol_cb_desk_data_free);
-
- e_mod_pol_stack_init();
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_init();
- e_mod_pol_wl_aux_hint_init();
-#endif
-
- /* initialize configure and config data type */
-#if 0
- snprintf(buf, sizeof(buf), "%s/e-module-policy.edj",
- e_module_dir_get(m));
- e_configure_registry_category_add("windows", 50, _("Windows"), NULL,
- "preferences-system-windows");
- e_configure_registry_item_add("windows/policy-tizen", 150,
- _("Tizen Policy"), NULL, buf,
- e_int_config_pol_mobile);
-#endif
+ if (!e_config->use_e_policy)
+ ERR("No policy system!");
e_mod_pol_conf_init(mod);
-
- EINA_LIST_FOREACH(e_comp->zones, l, zone)
- {
- n = zone->desk_y_count * zone->desk_x_count;
- for (i = 0; i < n; i++)
- {
- d = e_mod_pol_conf_desk_get_by_nums(_pol_mod->conf,
- zone->num,
- zone->desks[i]->x,
- zone->desks[i]->y);
- if (d)
- e_mod_pol_desk_add(zone->desks[i]);
- }
- }
-
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_ADD, _pol_cb_zone_add, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DEL, _pol_cb_zone_del, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_MOVE_RESIZE, _pol_cb_zone_move_resize, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DESK_COUNT_SET, _pol_cb_zone_desk_count_set, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DISPLAY_STATE_CHANGE, _pol_cb_zone_display_state_change, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_SHOW, _pol_cb_desk_show, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ADD, _pol_cb_client_add, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_MOVE, _pol_cb_client_move, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_RESIZE, _pol_cb_client_resize, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_STACK, _pol_cb_client_stack, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_PROPERTY, _pol_cb_client_property, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_VISIBILITY_CHANGE, _pol_cb_client_vis_change, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_HIDE, _pol_cb_client_hide, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_MODULE_DEFER_JOB, _pol_cb_module_defer_job, NULL);
-
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_NEW_CLIENT, _pol_cb_hook_client_new, NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_DEL, _pol_cb_hook_client_del, NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT, _pol_cb_hook_client_eval_pre_new_client, NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_EVAL_PRE_FETCH, _pol_cb_hook_client_eval_pre_fetch, NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_EVAL_PRE_POST_FETCH, _pol_cb_hook_client_eval_pre_post_fetch, NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_EVAL_POST_FETCH, _pol_cb_hook_client_eval_post_fetch, NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT,_pol_cb_hook_client_eval_post_new_client,NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_DESK_SET, _pol_cb_hook_client_desk_set, NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_FULLSCREEN_PRE, _pol_cb_hook_client_fullscreen_pre, NULL);
- E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_EVAL_VISIBILITY, _pol_cb_hook_client_visibility, NULL);
-
- E_PIXMAP_HOOK_APPEND(hooks_cp, E_PIXMAP_HOOK_DEL, _pol_cb_hook_pixmap_del, NULL);
- E_PIXMAP_HOOK_APPEND(hooks_cp, E_PIXMAP_HOOK_UNUSABLE, _pol_cb_hook_pixmap_unusable, NULL);
-
- _idle_enterer = ecore_idle_enterer_add(_pol_cb_idle_enterer, NULL);
-
e_mod_pol_rotation_init();
- e_mod_transform_mode_init();
- e_mod_conformant_init();
return mod;
}
e_modapi_shutdown(E_Module *m)
{
Mod *mod = m->data;
- Eina_Inlist *l;
- Pol_Softkey *softkey;
-
- if (e_config->use_e_policy)
- {
- e_mod_pol_rotation_shutdown();
- e_mod_pol_conf_shutdown(mod);
- E_FREE(mod);
- _pol_mod = NULL;
- return 1;
- }
- eina_list_free(_changed_zone);
- eina_list_free(mod->launchers);
- EINA_INLIST_FOREACH_SAFE(mod->softkeys, l, softkey)
- e_mod_pol_softkey_del(softkey);
- E_FREE_LIST(hooks_cp, e_pixmap_hook_del);
- E_FREE_LIST(hooks_ec, e_client_hook_del);
- E_FREE_LIST(handlers, ecore_event_handler_del);
-
- E_FREE_FUNC(hash_pol_desks, eina_hash_free);
- E_FREE_FUNC(hash_pol_clients, eina_hash_free);
-
- e_mod_pol_stack_shutdonw();
e_mod_pol_rotation_shutdown();
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_shutdown();
-#endif
-
-#if 0
- e_configure_registry_item_del("windows/policy-tizen");
- e_configure_registry_category_del("windows");
-
- if (mod->conf_dialog)
- {
- e_object_del(E_OBJECT(mod->conf_dialog));
- mod->conf_dialog = NULL;
- }
-#endif
-
e_mod_pol_conf_shutdown(mod);
- e_mod_transform_mode_shutdown();
- e_mod_conformant_shutdown();
-
E_FREE(mod);
-
_pol_mod = NULL;
-
return 1;
}
#define E_MOD_MAIN_H
#include <e.h>
-#ifndef _
-# ifdef HAVE_GETTEXT
-#define _(str) gettext(str)
-# else
-#define _(str) (str)
-# endif
-#endif
-
-#undef E_CLIENT_HOOK_APPEND
-#define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
- do \
- { \
- E_Client_Hook *_h; \
- _h = e_client_hook_add(t, cb, d); \
- assert(_h); \
- l = eina_list_append(l, _h); \
- } \
- while (0)
-
-#undef E_COMP_OBJECT_INTERCEPT_HOOK_APPEND
-#define E_COMP_OBJECT_INTERCEPT_HOOK_APPEND(l, t, cb, d) \
- do \
- { \
- E_Comp_Object_Intercept_Hook *_h; \
- _h = e_comp_object_intercept_hook_add(t, cb, d); \
- assert(_h); \
- l = eina_list_append(l, _h); \
- } \
- while (0)
-
-typedef struct _Pol_Desk Pol_Desk;
-typedef struct _Pol_Client Pol_Client;
-typedef struct _Pol_Softkey Pol_Softkey;
-typedef struct _Config_Match Config_Match;
-typedef struct _Config_Desk Config_Desk;
typedef struct _Config_Rot Config_Rot;
typedef struct _Config Config;
typedef struct _Mod Mod;
-typedef struct _Pol_System_Info Pol_System_Info;
-
-struct _Pol_Desk
-{
- E_Desk *desk;
- E_Zone *zone;
-};
-
-struct _Pol_Client
-{
- E_Client *ec;
- struct
- {
- E_Maximize maximized;
- unsigned int fullscreen : 1;
- unsigned char borderless : 1;
- unsigned int lock_user_location : 1;
- unsigned int lock_client_location : 1;
- unsigned int lock_user_size : 1;
- unsigned int lock_client_size : 1;
- unsigned int lock_client_stacking : 1;
- unsigned int lock_user_shade : 1;
- unsigned int lock_client_shade : 1;
- unsigned int lock_user_maximize : 1;
- unsigned int lock_client_maximize : 1;
- unsigned int lock_user_fullscreen : 1;
- unsigned int lock_client_fullscreen : 1;
- } orig;
-
- struct
- {
- unsigned int vkbd_state;
- unsigned int already_hide;
- } changes;
-
- Eina_Bool max_policy_state;
- Eina_Bool flt_policy_state;
- Eina_Bool allow_user_geom;
- int user_geom_ref;
-};
-
-struct _Pol_Softkey
-{
- EINA_INLIST;
-
- E_Zone *zone;
- Evas_Object *home;
- Evas_Object *back;
-};
-
-struct _Config_Match
-{
- const char *title; /* icccm.title or netwm.name */
- const char *clas; /* icccm.class */
- unsigned int type; /* netwm.type */
-};
-
-struct _Config_Desk
-{
- unsigned int zone_num;
- int x, y;
- int enable;
-};
struct _Config_Rot
{
struct _Config
{
- Config_Match launcher;
- Eina_List *desks;
Eina_List *rotations;
- int use_softkey;
- int softkey_size;
};
struct _Mod
{
E_Module *module;
E_Config_DD *conf_edd;
- E_Config_DD *conf_desk_edd;
E_Config_DD *conf_rot_edd;
Config *conf;
- Eina_List *launchers; /* launcher window per zone */
- Eina_Inlist *softkeys; /* softkey ui object per zone */
-};
-
-struct _E_Config_Dialog_Data
-{
- Config *conf;
- Evas_Object *o_list;
- Evas_Object *o_desks;
};
-struct _Pol_System_Info
-{
- struct
- {
- E_Client *ec;
- Eina_Bool show;
- } lockscreen;
+#undef E_CLIENT_HOOK_APPEND
+#define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
+ do \
+ { \
+ E_Client_Hook *_h; \
+ _h = e_client_hook_add(t, cb, d); \
+ assert(_h); \
+ l = eina_list_append(l, _h); \
+ } \
+ while (0)
- struct
- {
- int system;
- int client;
- Eina_Bool use_client;
- } brightness;
-};
+#undef E_COMP_OBJECT_INTERCEPT_HOOK_APPEND
+#define E_COMP_OBJECT_INTERCEPT_HOOK_APPEND(l, t, cb, d) \
+ do \
+ { \
+ E_Comp_Object_Intercept_Hook *_h; \
+ _h = e_comp_object_intercept_hook_add(t, cb, d); \
+ assert(_h); \
+ l = eina_list_append(l, _h); \
+ } \
+ while (0)
extern Mod *_pol_mod;
-extern Eina_Hash *hash_pol_desks;
-extern Eina_Hash *hash_pol_clients;
-extern Pol_System_Info g_system_info;
-
EINTERN void e_mod_pol_conf_init(Mod *mod);
EINTERN void e_mod_pol_conf_shutdown(Mod *mod);
-EINTERN Config_Desk *e_mod_pol_conf_desk_get_by_nums(Config *conf, unsigned int zone_num, int x, int y);
-//EINTERN E_Config_Dialog *e_int_config_pol_mobile(Evas_Object *o EINA_UNUSED, const char *params EINA_UNUSED);
-EINTERN Pol_Client *e_mod_pol_client_get(E_Client *ec);
-EINTERN void e_mod_pol_allow_user_geometry_set(E_Client *ec, Eina_Bool set);
-EINTERN void e_mod_pol_desk_add(E_Desk *desk);
-EINTERN void e_mod_pol_desk_del(Pol_Desk *pd);
-EINTERN Pol_Client *e_mod_pol_client_launcher_get(E_Zone *zone);
-EINTERN Eina_Bool e_mod_pol_client_is_lockscreen(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_home_screen(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_quickpanel(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_conformant(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_volume(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_volume_tv(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_noti(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_floating(E_Client *ec);
-EINTERN Eina_Bool e_mod_pol_client_is_cursor(E_Client *ec);
-
-#ifdef HAVE_WAYLAND_ONLY
-EINTERN Eina_Bool e_mod_pol_client_is_subsurface(E_Client *ec);
-#endif
-
-EINTERN Pol_Softkey *e_mod_pol_softkey_add(E_Zone *zone);
-EINTERN void e_mod_pol_softkey_del(Pol_Softkey *softkey);
-EINTERN void e_mod_pol_softkey_show(Pol_Softkey *softkey);
-EINTERN void e_mod_pol_softkey_hide(Pol_Softkey *softkey);
-EINTERN void e_mod_pol_softkey_update(Pol_Softkey *softkey);
-EINTERN Pol_Softkey *e_mod_pol_softkey_get(E_Zone *zone);
-
-EINTERN void e_mod_pol_client_visibility_send(E_Client *ec);
-EINTERN void e_mod_pol_client_iconify_by_visibility(E_Client *ec);
-EINTERN void e_mod_pol_client_uniconify_by_visibility(E_Client *ec);
-
-EINTERN Eina_Bool e_mod_pol_client_maximize(E_Client *ec);
-
-EINTERN void e_mod_pol_client_window_opaque_set(E_Client *ec);
-
-EINTERN void e_mod_pol_stack_init(void);
-EINTERN void e_mod_pol_stack_shutdonw(void);
-EINTERN void e_mod_pol_stack_transient_for_set(E_Client *child, E_Client *parent);
-EINTERN void e_mod_pol_stack_cb_client_remove(E_Client *ec);
-EINTERN void e_mod_pol_stack_hook_pre_fetch(E_Client *ec);
-EINTERN void e_mod_pol_stack_hook_pre_post_fetch(E_Client *ec);
-
-EINTERN void e_mod_pol_stack_below(E_Client *ec, E_Client *below_ec);
-
-EINTERN void e_mod_pol_stack_clients_restack_above_lockscreen(E_Client *ec_lock, Eina_Bool show);
-EINTERN Eina_Bool e_mod_pol_stack_check_above_lockscreen(E_Client *ec, E_Layer layer, E_Layer *new_layer, Eina_Bool set_layer);
-
EINTERN Eina_Bool e_mod_pol_conf_rot_enable_get(int angle);
#endif
+++ /dev/null
-#ifndef E_MOD_PRIVATE_DATA_H
-#define E_MOD_PRIVATE_DATA_H
-
-/* define layer values here */
-
-/* layer level - 999 */
-# define WM_POL_QUICKPANEL_LAYER E_LAYER_CLIENT_ALERT
-# define WM_POL_TOAST_POPUP_LAYER E_LAYER_CLIENT_ALERT
-
-/* layer level - E_LAYER_CLIENT_NOTIFICATION_TOP (800) */
-# define WM_POL_VOLUME_LAYER E_LAYER_CLIENT_NOTIFICATION_TOP
-
-/* layer level - E_LAYER_CLIENT_NOTIFICATION_HIGH (750) */
-/* layer level - E_LAYER_CLIENT_NOTIFICATION_NORMAL (700) */
-/* layer level - E_LAYER_CLIENT_NOTIFICATION_LOW (650) */
-
-/* layer level - E_LAYER_CLIENT_PRIO (600) */
-# define WM_POL_FLOATING_LAYER E_LAYER_CLIENT_PRIO
-
-/* layer level - E_LAYER_CLIENT_FULLSCREEN (350) */
-/* layer level - E_LAYER_CLIENT_ABOVE (250) */
-/* layer level - E_LAYER_CLIENT_NORMAL (200) */
-/* layer level - E_LAYER_CLIENT_BELOW (150) */
-
-#endif
+++ /dev/null
-#include "e_mod_main.h"
-
-static void _pol_cb_softkey(void *data, Evas_Object *obj EINA_UNUSED, const char *emission, const char *source EINA_UNUSED);
-static void _pol_softkey_iconify(E_Zone *zone, Eina_Bool all);
-static Evas_Object *_pol_softkey_icon_add(E_Zone *zone, const char *name);
-static void _pol_softkey_icon_del(Evas_Object *comp_obj);
-
-static void
-_pol_cb_softkey(void *data, Evas_Object *obj EINA_UNUSED, const char *emission, const char *source EINA_UNUSED)
-{
- E_Zone *zone;
- Eina_Bool all;
-
- zone = data;
-
- if (!e_util_strcmp(emission, "e,action,softkey,home"))
- all = EINA_TRUE;
- else if (!e_util_strcmp(emission, "e,action,softkey,back"))
- all = EINA_FALSE;
- else
- return;
-
- _pol_softkey_iconify(zone, all);
-}
-
-static void
-_pol_softkey_iconify(E_Zone *zone, Eina_Bool all)
-{
- E_Desk *desk;
- E_Client *ec;
- Pol_Client *launcher;
-
- desk = e_desk_current_get(zone);
- launcher = e_mod_pol_client_launcher_get(zone);
-
- E_CLIENT_REVERSE_FOREACH(ec)
- {
- if (e_client_util_ignored_get(ec)) continue;
- if (!e_client_util_desk_visible(ec, desk)) continue;
- if (!evas_object_visible_get(ec->frame)) continue;
-
- if ((launcher) && (launcher->ec == ec))
- return;
-
- if (e_mod_pol_client_is_home_screen(ec))
- {
- evas_object_raise(ec->frame);
- return;
- }
- if (!all)
- {
- evas_object_lower(ec->frame);
- return;
- }
- }
-}
-
-static Evas_Object *
-_pol_softkey_icon_add(E_Zone *zone, const char *name)
-{
- Evas_Object *obj, *comp_obj;
- char path[PATH_MAX], group[PATH_MAX];
-
- obj = edje_object_add(e_comp->evas);
-
- snprintf(group, sizeof(group), "e/modules/policy-mobile/softkey/%s", name);
- snprintf(path, sizeof(path), "%s/e-module-policy.edj",
- e_module_dir_get(_pol_mod->module));
-
- if (!e_theme_edje_object_set(obj, NULL, group))
- edje_object_file_set(obj, path, group);
-
- edje_object_signal_callback_add(obj, "e,action,softkey,*", "e",
- _pol_cb_softkey, zone);
-
- /* use TYPE_NONE to disable shadow for softkey object */
- comp_obj = e_comp_object_util_add(obj, E_COMP_OBJECT_TYPE_NONE);
- evas_object_layer_set(comp_obj, E_LAYER_POPUP);
-
- evas_object_data_set(comp_obj, "policy_mobile_obj", obj);
-
- return comp_obj;
-}
-
-static void
-_pol_softkey_icon_del(Evas_Object *comp_obj)
-{
- Evas_Object *obj;
-
- obj = evas_object_data_get(comp_obj, "policy_mobile_obj");
-
- edje_object_signal_callback_del(obj, "e,action,softkey,*",
- "e", _pol_cb_softkey);
- evas_object_hide(comp_obj);
- evas_object_del(comp_obj);
-}
-
-Pol_Softkey *
-e_mod_pol_softkey_add(E_Zone *zone)
-{
- Pol_Softkey *softkey;
-
- softkey = E_NEW(Pol_Softkey, 1);
-
- softkey->zone = zone;
- softkey->home = _pol_softkey_icon_add(zone, "home");
- softkey->back = _pol_softkey_icon_add(zone, "back");
-
- _pol_mod->softkeys = eina_inlist_append(_pol_mod->softkeys, EINA_INLIST_GET(softkey));
-
- return softkey;
-}
-
-void
-e_mod_pol_softkey_del(Pol_Softkey *softkey)
-{
- if (!softkey) return;
-
- _pol_softkey_icon_del(softkey->home);
- _pol_softkey_icon_del(softkey->back);
-
- _pol_mod->softkeys = eina_inlist_remove(_pol_mod->softkeys, EINA_INLIST_GET(softkey));
-
- free(softkey);
-}
-
-void
-e_mod_pol_softkey_show(Pol_Softkey *softkey)
-{
- if (!softkey) return;
-
- e_mod_pol_softkey_update(softkey);
-
- evas_object_show(softkey->home);
- evas_object_show(softkey->back);
-}
-
-void
-e_mod_pol_softkey_hide(Pol_Softkey *softkey)
-{
- if (!softkey) return;
-
- evas_object_hide(softkey->home);
- evas_object_hide(softkey->back);
-}
-
-void
-e_mod_pol_softkey_update(Pol_Softkey *softkey)
-{
- int x, y, w, h, ow, oh, space;
-
- if (!softkey) return;
-
- e_zone_useful_geometry_get(softkey->zone, &x, &y, &w, &h);
-
- ow = oh = _pol_mod->conf->softkey_size;
-
- x = x + (w - ow) / 2;
- y = h - oh;
- space = ow * 4;
-
- evas_object_geometry_set(softkey->home, x - space, y, ow, oh);
- evas_object_geometry_set(softkey->back, x + space, y, ow, oh);
-}
-
-Pol_Softkey *
-e_mod_pol_softkey_get(E_Zone *zone)
-{
- Pol_Softkey *softkey;
-
- EINA_INLIST_FOREACH(_pol_mod->softkeys, softkey)
- {
- if (softkey->zone == zone)
- return softkey;
- }
-
- return NULL;
-}
+++ /dev/null
-#include "e_mod_main.h"
-
-typedef struct _Pol_Stack Pol_Stack;
-
-struct _Pol_Stack
-{
- E_Client *ec;
-
- struct
- {
- Ecore_Window win;
- Eina_Bool fetched;
- } transient;
-};
-
-static Eina_Hash *hash_pol_stack = NULL;
-
-static void
-_pol_stack_cb_data_free(void *data)
-{
- E_FREE(data);
-}
-
-Pol_Stack*
-_pol_stack_data_add(E_Client *ec)
-{
- Pol_Stack *ps;
-
- if ((ps = eina_hash_find(hash_pol_stack, &ec)))
- return ps;
-
- ps = E_NEW(Pol_Stack, 1);
- if (!ps) return NULL;
-
- ps->ec = ec;
- eina_hash_add(hash_pol_stack, &ec, ps);
-
- return ps;
-}
-
-void
-_pol_stack_data_del(E_Client *ec)
-{
- Pol_Stack *ps;
-
- if ((ps = eina_hash_find(hash_pol_stack, &ec)))
- {
- eina_hash_del_by_key(hash_pol_stack, &ec);
- }
-}
-
-void
-_pol_stack_transient_for_apply(E_Client *ec)
-{
- int raise;
- E_Client *child, *top;
- Eina_List *l;
-
- if (ec->parent->layer != ec->layer)
- {
- raise = e_config->transient.raise;
-
- ec->saved.layer = ec->layer;
- ec->layer = ec->parent->layer;
- if (e_config->transient.layer)
- {
- e_config->transient.raise = 1;
- EINA_LIST_FOREACH(ec->transients, l, child)
- {
- if (!child) continue;
- child->saved.layer = child->layer;
- child->layer = ec->parent->layer;
- }
- }
-
- e_config->transient.raise = raise;
- }
-
- if (ec->transient_policy == E_TRANSIENT_ABOVE)
- {
- top = e_client_top_get();
- while (top)
- {
- if ((!ec->parent->transients) || (top == ec->parent))
- {
- top = NULL;
- break;
- }
- if ((top != ec) && (eina_list_data_find(ec->parent->transients, top)))
- break;
-
- top = e_client_below_get(top);
- }
-
- if (top)
- evas_object_stack_above(ec->frame, top->frame);
- else
- evas_object_stack_above(ec->frame, ec->parent->frame);
- }
- else if (ec->transient_policy == E_TRANSIENT_BELOW)
- {
- evas_object_stack_below(ec->frame, ec->parent->frame);
- }
-}
-
-Eina_Bool
-_pol_stack_transient_for_tree_check(E_Client *child, E_Client *parent)
-{
- E_Client *p;
-
- p = parent->parent;
- while (p)
- {
- if (e_object_is_del(E_OBJECT(p))) return EINA_FALSE;
- if (p == child) return EINA_TRUE;
-
- p = p->parent;
- }
-
- return EINA_FALSE;
-}
-
-void
-e_mod_pol_stack_hook_pre_post_fetch(E_Client *ec)
-{
- Pol_Stack *ps;
- ps = eina_hash_find(hash_pol_stack, &ec);
-
- if (ps)
- {
- if ((ps->transient.win) && (ps->transient.fetched))
- {
-#ifndef HAVE_WAYLAND_ONLY
- if ((ec->icccm.transient_for == ps->transient.win) &&
- (ec->parent))
-#else
- if (ec->parent && ps->transient.win)
-#endif
- _pol_stack_transient_for_apply(ec);
- else
- ps->transient.win = ec->icccm.transient_for;
-
- ps->transient.fetched = 0;
- }
- }
-}
-
-void
-e_mod_pol_stack_hook_pre_fetch(E_Client *ec)
-{
- Pol_Stack *ps;
- ps = eina_hash_find(hash_pol_stack, &ec);
-
- if (ec->icccm.fetch.transient_for)
- {
- Ecore_Window transient_for_win = 0;
- E_Client *parent = NULL;
- Eina_Bool transient_each_other = EINA_FALSE;
-
-#ifdef HAVE_WAYLAND_ONLY
- parent = e_pixmap_find_client(E_PIXMAP_TYPE_WL, ec->icccm.transient_for);
-#endif
-
- if (parent)
- {
- if (!ps) ps = _pol_stack_data_add(ec);
-
-#ifdef HAVE_WAYLAND_ONLY
- ps->transient.win = e_client_util_win_get(parent);
-#endif
- ps->transient.fetched = 1;
-
- /* clients transient for each other */
- transient_each_other = _pol_stack_transient_for_tree_check(ec, parent);
- if (transient_each_other)
- {
- ec->icccm.transient_for = transient_for_win;
- ec->icccm.fetch.transient_for = 0;
- ps->transient.fetched = 0;
- parent = NULL;
- }
- }
- }
-}
-
-void
-e_mod_pol_stack_transient_for_set(E_Client *child, E_Client *parent)
-{
- Ecore_Window pwin = 0;
-
- EINA_SAFETY_ON_NULL_RETURN(child);
-
- if (!parent)
- {
- child->icccm.fetch.transient_for = EINA_FALSE;
- child->icccm.transient_for = 0;
- if (child->parent)
- {
- child->parent->transients =
- eina_list_remove(child->parent->transients, child);
- if (child->parent->modal == child) child->parent->modal = NULL;
- child->parent = NULL;
- }
- return;
- }
-
- pwin = e_client_util_win_get(parent);
-
- /* If we already have a parent, remove it */
- if (child->parent)
- {
- if (parent != child->parent)
- {
- child->parent->transients =
- eina_list_remove(child->parent->transients, child);
- if (child->parent->modal == child) child->parent->modal = NULL;
- child->parent = NULL;
- }
- else
- parent = NULL;
- }
-
- if ((parent) && (parent != child) &&
- (eina_list_data_find(parent->transients, child) != child))
- {
- parent->transients = eina_list_append(parent->transients, child);
- child->parent = parent;
- }
-
- child->icccm.fetch.transient_for = EINA_TRUE;
- child->icccm.transient_for = pwin;
-}
-
-void
-e_mod_pol_stack_cb_client_remove(E_Client *ec)
-{
- _pol_stack_data_del(ec);
-}
-
-void
-e_mod_pol_stack_shutdonw(void)
-{
- eina_hash_free(hash_pol_stack);
- hash_pol_stack = NULL;
-}
-
-void
-e_mod_pol_stack_init(void)
-{
- hash_pol_stack = eina_hash_pointer_new(_pol_stack_cb_data_free);
-}
-
-void
-e_mod_pol_stack_below(E_Client *ec, E_Client *below_ec)
-{
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- EINA_SAFETY_ON_NULL_RETURN(below_ec);
- EINA_SAFETY_ON_NULL_RETURN(below_ec->frame);
-
- evas_object_stack_below(ec->frame, below_ec->frame);
- if (e_config->transient.iconify)
- {
- E_Client *child;
- Eina_List *list = eina_list_clone(ec->transients);
-
- EINA_LIST_FREE(list, child)
- {
- e_mod_pol_stack_below(child, below_ec);
- }
- }
-}
-
-static E_Client *
-_e_mod_pol_stack_find_top_lockscreen(E_Client *ec_lock, E_Client *ec_except)
-{
- E_Client *ec = NULL;
- E_Client *ec_top_lock = NULL;
- int x, y, w, h;
-
- if (!ec_lock) return NULL;
-
- E_CLIENT_REVERSE_FOREACH(ec)
- {
- if (e_object_is_del(E_OBJECT(ec))) continue;
- if ((ec != ec_except) &&
- (e_mod_pol_client_is_lockscreen(ec)))
- {
- e_client_geometry_get(ec, &x, &y, &w, &h);
- if (E_CONTAINS(ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h,
- x, y, w, h))
- {
- ec_top_lock = ec;
- break;
- }
- }
- }
-
- return ec_top_lock;
-}
-
-void
-e_mod_pol_stack_clients_restack_above_lockscreen(E_Client *ec_lock, Eina_Bool show)
-{
- E_Client *ec = NULL;
- E_Client *new_lock = NULL;
- Eina_Bool restack_above = EINA_FALSE;
-
- if (!ec_lock) return;
-
- if (show)
- {
- new_lock = _e_mod_pol_stack_find_top_lockscreen(ec_lock, NULL);
- if (!new_lock)
- new_lock = ec_lock;
-
- g_system_info.lockscreen.show = show;
- g_system_info.lockscreen.ec = new_lock;
-
- restack_above = EINA_TRUE;
- }
- else
- {
- if (ec_lock != g_system_info.lockscreen.ec)
- return;
-
- new_lock = _e_mod_pol_stack_find_top_lockscreen(ec_lock, g_system_info.lockscreen.ec);
- if (new_lock)
- {
- g_system_info.lockscreen.show = EINA_TRUE;
- g_system_info.lockscreen.ec = new_lock;
- restack_above = EINA_TRUE;
- }
- else
- {
- E_Layer org_layer;
- Eina_List *restore_list = NULL;
- Eina_List *l = NULL;
-
- g_system_info.lockscreen.show = show;
- g_system_info.lockscreen.ec = NULL;
-
- E_CLIENT_FOREACH(ec)
- {
- if (e_object_is_del(E_OBJECT(ec))) continue;
- if (ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].set &&
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved)
- {
- restore_list = eina_list_append(restore_list, ec);
- }
- }
-
- if (restore_list)
- {
- EINA_LIST_FOREACH(restore_list, l, ec)
- {
- org_layer = ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved_layer;
- ELOGF("CHANGE to Original layer", "AboveLock|layer: %d -> %d", ec->pixmap, ec, ec->layer, org_layer);
- evas_object_layer_set(ec->frame, org_layer);
- ec->layer = org_layer;
-
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved = EINA_FALSE;
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved_layer = 0;
- }
- eina_list_free(restore_list);
- restore_list = NULL;
- }
- }
- }
-
- if (restack_above)
- {
- Eina_List *restack_list = NULL;
- Eina_List *l = NULL;
- E_Layer lock_layer = g_system_info.lockscreen.ec->layer;
- Eina_Bool passed_new_lock = EINA_FALSE;
- int x, y, w, h;
-
- E_CLIENT_REVERSE_FOREACH(ec)
- {
- if (e_object_is_del(E_OBJECT(ec))) continue;
- if (ec == new_lock)
- {
- passed_new_lock = EINA_TRUE;
- continue;
- }
- if (!passed_new_lock) continue;
- if (e_mod_pol_client_is_lockscreen(ec)) continue;
- if (ec->exp_iconify.by_client) continue;
-
- if (ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].set)
- {
- if (ec->layer <= lock_layer)
- {
- restack_list = eina_list_append(restack_list, ec);
- }
- }
-
- if ((!ec->argb) ||
- ((ec->argb) &&
- (ec->visibility.opaque == 1)))
- {
- e_client_geometry_get(ec, &x, &y, &w, &h);
- if (E_CONTAINS(x, y, w, h, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h))
- {
- break;
- }
- }
- }
-
- if (restack_list)
- {
- EINA_LIST_REVERSE_FOREACH(restack_list, l, ec)
- {
- if (ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved == EINA_FALSE)
- {
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved = EINA_TRUE;
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved_layer = ec->layer;
- }
-
- ELOGF("CHANGE to Lockscreen layer", "AboveLock|layer: %d -> %d", ec->pixmap, ec, ec->layer, lock_layer);
- if (ec->layer == lock_layer)
- evas_object_raise(ec->frame);
- else
- evas_object_layer_set(ec->frame, lock_layer);
-
- ec->layer = lock_layer;
- }
- eina_list_free(restack_list);
- restack_list = NULL;
- }
- }
-
-}
-
-Eina_Bool
-e_mod_pol_stack_check_above_lockscreen(E_Client *ec, E_Layer layer, E_Layer *new_layer, Eina_Bool set_layer)
-{
- E_Layer lock_layer;
-
- if (!ec) return EINA_FALSE;
- if (!ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].set)
- return EINA_FALSE;
-
- if (g_system_info.lockscreen.show &&
- g_system_info.lockscreen.ec)
- {
- lock_layer = g_system_info.lockscreen.ec->layer;
- if (layer <= lock_layer)
- {
- if (ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved == EINA_FALSE)
- {
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved = EINA_TRUE;
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved_layer = ec->layer;
- }
-
- if (set_layer)
- {
- ELOGF("CHANGE to Lockscreen layer", "AboveLock|layer: %d -> %d", ec->pixmap, ec, ec->layer, lock_layer);
- if (ec->layer == lock_layer)
- evas_object_raise(ec->frame);
- else
- evas_object_layer_set(ec->frame, lock_layer);
- ec->layer = lock_layer;
- }
-
- if (new_layer)
- *new_layer = lock_layer;
- }
- else
- {
- if (set_layer)
- {
- if (ec->layer != layer)
- {
- ELOGF("CHANGE to Lockscreen layer", "AboveLock|layer: %d -> %d", ec->pixmap, ec, ec->layer, lock_layer);
- evas_object_layer_set(ec->frame, lock_layer);
- ec->layer = lock_layer;
- }
- }
-
- if (new_layer)
- *new_layer = layer;
- }
-
- return EINA_TRUE;
- }
-
- return EINA_FALSE;
-
-}
-
+++ /dev/null
-#include "e_mod_transform_mode.h"
-#include "e_mod_main.h"
-
-#define E_TRANSFORM_MODE_NAME "wm.policy.win.transform.mode"
-#define E_TRANSFORM_MODE_AUTOFIT "autofit"
-#define E_TRANSFORM_MODE_RATIOFIT "ratiofit"
-
-typedef struct _E_Mod_Transform_Client E_Mod_Transform_Client;
-typedef struct _E_Mod_Transform_Manager E_Mod_Transform_Manager;
-
-typedef enum
-{
- E_Mod_Transform_Type_None = 0,
- E_Mod_Transform_Type_AutoFit,
- E_Mod_Transform_Type_RatioFit
-
-}E_Mod_Transform_Type;
-
-struct _E_Mod_Transform_Client
-{
- E_Client *ec;
- E_Util_Transform *transform;
- Eina_Bool user_geometry_by_me;
- E_Mod_Transform_Type transform_type;
- int x, y, w, h;
-};
-
-struct _E_Mod_Transform_Manager
-{
- Eina_List *transform_client_list;
- Eina_List *hook_list;
- Eina_List *event_list;
-};
-
-static E_Mod_Transform_Manager *_transform_mode = NULL;
-
-static E_Mod_Transform_Client *_e_mod_transform_client_new(E_Client *ec, E_Mod_Transform_Manager *mng);
-static void _e_mod_transform_client_del(E_Mod_Transform_Client *transform_ec, E_Mod_Transform_Manager *mng);
-static E_Mod_Transform_Client *_e_mod_transform_client_find(E_Client *ec, E_Mod_Transform_Manager *mng);
-static void _e_mod_transform_client_mode_change(E_Mod_Transform_Client *transform_ec, E_Mod_Transform_Type mode);
-static void _e_mod_transform_client_mode_cancel(E_Mod_Transform_Client *transform_ec);
-static void _e_mod_transform_client_mode_autofit_ratiofit_set(E_Mod_Transform_Client *transform_ec, E_Mod_Transform_Type mode);
-static void _e_mod_transform_client_mode_autofit_ratiofit_cancel(E_Mod_Transform_Client *transform_ec);
-
-static void _e_mod_transform_cb_aux_change(void *data, E_Client *ec);
-static void _e_mod_transform_cb_client_del(void *data, E_Client *ec);
-static void _e_mod_transform_cb_client_move_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
-
-
-static E_Mod_Transform_Type _e_mod_transform_mode_string_to_enum(const char *str_mode);
-static void _e_mod_transform_screen_size_get(E_Mod_Transform_Client *transform_ec, int *w, int *h);
-static void _e_mod_transform_client_size_get(E_Mod_Transform_Client *transform_ec, int *w, int *h);
-static void _e_mod_transform_client_pos_get(E_Mod_Transform_Client *transform_ec, int *x, int *y);
-static Eina_Bool _e_mod_transform_client_geometry_change_check(E_Mod_Transform_Client *transform_ec);
-
-Eina_Bool
-e_mod_transform_mode_init(void)
-{
- if (_transform_mode) return EINA_FALSE;
-
- _transform_mode = (E_Mod_Transform_Manager*)malloc(sizeof(E_Mod_Transform_Manager));
- memset(_transform_mode, 0, sizeof(E_Mod_Transform_Manager));
-
- _transform_mode->hook_list = eina_list_append(_transform_mode->hook_list,
- e_client_hook_add(E_CLIENT_HOOK_AUX_HINT_CHANGE ,
- _e_mod_transform_cb_aux_change,
- _transform_mode));
-
- _transform_mode->hook_list = eina_list_append(_transform_mode->hook_list,
- e_client_hook_add(E_CLIENT_HOOK_DEL ,
- _e_mod_transform_cb_client_del,
- _transform_mode));
-
- e_hints_aux_hint_supported_add(E_TRANSFORM_MODE_NAME);
- return EINA_TRUE;
-}
-
-void
-e_mod_transform_mode_shutdown(void)
-{
- if (!_transform_mode) return;
-
- while(_transform_mode->transform_client_list)
- {
- _e_mod_transform_client_del(eina_list_nth(_transform_mode->transform_client_list, 0), _transform_mode);
- }
-
- if (_transform_mode->hook_list)
- {
- E_Client_Hook *hook;
-
- EINA_LIST_FREE(_transform_mode->hook_list, hook)
- {
- e_client_hook_del(hook);
- }
- }
-
- free(_transform_mode);
- _transform_mode = NULL;
-
- e_hints_aux_hint_supported_del(E_TRANSFORM_MODE_NAME);
-}
-
-static E_Mod_Transform_Client*
-_e_mod_transform_client_new(E_Client *ec, E_Mod_Transform_Manager *mng)
-{
- E_Mod_Transform_Client *result = NULL;
-
- if (!mng) return NULL;
- if (!ec) return NULL;
- if (_e_mod_transform_client_find(ec, mng)) return NULL;
-
- result = (E_Mod_Transform_Client*)malloc(sizeof(E_Mod_Transform_Client));
- memset(result, 0, sizeof(E_Mod_Transform_Client));
- result->ec = ec;
- result->transform = e_util_transform_new();
-
- mng->transform_client_list = eina_list_append(mng->transform_client_list, result);
- return result;
-}
-
-static void
-_e_mod_transform_client_del(E_Mod_Transform_Client *transform_ec, E_Mod_Transform_Manager *mng)
-{
- if (!mng) return;
- if (!transform_ec) return;
-
- if (transform_ec->transform)
- {
- _e_mod_transform_client_mode_cancel(transform_ec);
- e_util_transform_del(transform_ec->transform);
- transform_ec->transform = NULL;
- }
-
- mng->transform_client_list = eina_list_remove(mng->transform_client_list, transform_ec);
- free(transform_ec);
-}
-
-static E_Mod_Transform_Client*
-_e_mod_transform_client_find(E_Client *ec, E_Mod_Transform_Manager *mng)
-{
- E_Mod_Transform_Client *temp = NULL;
- E_Mod_Transform_Client *result = NULL;
- Eina_List *l = NULL;
-
- if (!mng) return NULL;
- if (!ec) return NULL;
-
- EINA_LIST_FOREACH(mng->transform_client_list, l, temp)
- {
- if (temp->ec == ec)
- {
- result = temp;
- break;
- }
- }
- return result;
-}
-
-static void
-_e_mod_transform_client_mode_change(E_Mod_Transform_Client *transform_ec, E_Mod_Transform_Type mode)
-{
- if (!transform_ec) return;
- if (mode == E_Mod_Transform_Type_None) return;
-
- if (transform_ec->transform_type != mode)
- {
- _e_mod_transform_client_mode_cancel(transform_ec);
-
- if (mode == E_Mod_Transform_Type_AutoFit ||
- mode == E_Mod_Transform_Type_RatioFit)
- {
- _e_mod_transform_client_mode_autofit_ratiofit_set(transform_ec, mode);
- }
- }
-}
-
-static void
-_e_mod_transform_client_mode_cancel(E_Mod_Transform_Client *transform_ec)
-{
- if (!transform_ec) return;
- if (transform_ec->transform_type == E_Mod_Transform_Type_None) return;
-
- if (transform_ec->transform_type == E_Mod_Transform_Type_AutoFit ||
- transform_ec->transform_type == E_Mod_Transform_Type_RatioFit)
- {
- _e_mod_transform_client_mode_autofit_ratiofit_cancel(transform_ec);
- }
-
- transform_ec->transform_type = E_Mod_Transform_Type_None;
-}
-
-static void
-_e_mod_transform_client_mode_autofit_ratiofit_set(E_Mod_Transform_Client *transform_ec, E_Mod_Transform_Type mode)
-{
- if (!transform_ec) return;
- if (transform_ec->transform_type != E_Mod_Transform_Type_None) return;
-
- if (transform_ec->transform)
- {
- if (mode == E_Mod_Transform_Type_RatioFit)
- e_util_transform_keep_ratio_set(transform_ec->transform, EINA_TRUE);
- e_client_transform_core_add(transform_ec->ec, transform_ec->transform);
- }
- _e_mod_transform_cb_client_move_resize(transform_ec, 0, 0, 0);
-
- if (transform_ec->ec->frame)
- {
- evas_object_event_callback_add(transform_ec->ec->frame, EVAS_CALLBACK_RESIZE, _e_mod_transform_cb_client_move_resize, transform_ec);
- evas_object_event_callback_add(transform_ec->ec->frame, EVAS_CALLBACK_MOVE, _e_mod_transform_cb_client_move_resize, transform_ec);
- }
-
- e_mod_pol_allow_user_geometry_set(transform_ec->ec, EINA_TRUE);
- transform_ec->transform_type = mode;
-}
-
-static void
-_e_mod_transform_client_mode_autofit_ratiofit_cancel(E_Mod_Transform_Client *transform_ec)
-{
- if (!transform_ec) return;
- if (transform_ec->transform_type != E_Mod_Transform_Type_AutoFit &&
- transform_ec->transform_type != E_Mod_Transform_Type_RatioFit) return;
-
- if (transform_ec->transform)
- {
- e_util_transform_keep_ratio_set(transform_ec->transform, EINA_FALSE);
- e_client_transform_core_remove(transform_ec->ec, transform_ec->transform);
- }
-
- if (transform_ec->ec->frame)
- {
- evas_object_event_callback_del(transform_ec->ec->frame, EVAS_CALLBACK_RESIZE, _e_mod_transform_cb_client_move_resize);
- evas_object_event_callback_del(transform_ec->ec->frame, EVAS_CALLBACK_MOVE, _e_mod_transform_cb_client_move_resize);
- }
-
- e_mod_pol_allow_user_geometry_set(transform_ec->ec, EINA_FALSE);
- transform_ec->transform_type = E_Mod_Transform_Type_None;
-}
-
-static void
-_e_mod_transform_cb_aux_change(void *data, E_Client *ec)
-{
- E_Mod_Transform_Manager *mng = (E_Mod_Transform_Manager*)data;
- E_Mod_Transform_Client *t_ec = NULL;
- E_Mod_Transform_Type t_mode = E_Mod_Transform_Type_None;
- const char *t_str = NULL;
-
- if (!ec) return;
- if (!mng) return;
-
- t_ec = _e_mod_transform_client_find(ec, mng);
- t_str = e_hints_aux_hint_value_get(ec, E_TRANSFORM_MODE_NAME);
- t_mode = _e_mod_transform_mode_string_to_enum(t_str);
-
- if (t_ec)
- {
- if (t_mode == E_Mod_Transform_Type_None)
- _e_mod_transform_client_del(t_ec, mng);
- else
- _e_mod_transform_client_mode_change(t_ec, t_mode);
- }
- else
- {
- if (t_mode != E_Mod_Transform_Type_None)
- {
- t_ec = _e_mod_transform_client_new(ec, mng);
- _e_mod_transform_client_mode_change(t_ec, t_mode);
- }
- }
-}
-
-static void
-_e_mod_transform_cb_client_del(void *data, E_Client *ec)
-{
- E_Mod_Transform_Manager *mng = (E_Mod_Transform_Manager*)data;
- E_Mod_Transform_Client *transform_ec = NULL;
-
- if (!mng) return;
- if (!ec) return;
-
- transform_ec = _e_mod_transform_client_find(ec, mng);
-
- if (transform_ec)
- _e_mod_transform_client_del(transform_ec, mng);
-}
-
-static void
-_e_mod_transform_cb_client_move_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- E_Mod_Transform_Client *transform_ec = (E_Mod_Transform_Client*)data;
- int zone_w = 1, zone_h = 1;
- double sx = 1.0, sy = 1.0;
- int w = 1, h = 1;
- int x, y;
-
- if (!transform_ec) return;
- if (!_e_mod_transform_client_geometry_change_check(transform_ec)) return;
-
- _e_mod_transform_screen_size_get(transform_ec, &zone_w, &zone_h);
- _e_mod_transform_client_size_get(transform_ec, &w, &h);
- _e_mod_transform_client_pos_get(transform_ec, &x, &y);
-
- sx = (double) zone_w / (double) w;
- sy = (double) zone_h / (double) h;
-
- e_util_transform_init(transform_ec->transform);
- if (transform_ec->transform_type == E_Mod_Transform_Type_RatioFit)
- e_util_transform_keep_ratio_set(transform_ec->transform, EINA_TRUE);
- e_util_transform_move(transform_ec->transform, -x, -y, 0.0);
- e_util_transform_scale(transform_ec->transform, sx, sy, 1.0);
-}
-
-static E_Mod_Transform_Type
-_e_mod_transform_mode_string_to_enum(const char *str_mode)
-{
- if (!str_mode) return E_Mod_Transform_Type_None;
- else if (!e_util_strcmp(str_mode, E_TRANSFORM_MODE_AUTOFIT)) return E_Mod_Transform_Type_AutoFit;
- else if (!e_util_strcmp(str_mode, E_TRANSFORM_MODE_RATIOFIT)) return E_Mod_Transform_Type_RatioFit;
-
- return E_Mod_Transform_Type_None;
-}
-
-static void
-_e_mod_transform_screen_size_get(E_Mod_Transform_Client *transform_ec, int *w, int *h)
-{
- int zone_w = 1;
- int zone_h = 1;
-
- if (!transform_ec) return;
-
- if (transform_ec->ec->zone)
- {
- zone_w = transform_ec->ec->zone->w;
- zone_h = transform_ec->ec->zone->h;
- }
- else
- {
- zone_w = 1920;
- zone_h = 1080;
- }
-
- if (zone_w < 1) zone_w = 1;
- if (zone_h < 1) zone_h = 1;
-
- if (w) *w = zone_w;
- if (h) *h = zone_h;
-}
-
-static void
-_e_mod_transform_client_size_get(E_Mod_Transform_Client *transform_ec, int *w, int *h)
-{
- int ec_w = 1;
- int ec_h = 1;
-
- if (!transform_ec) return;
-
- ec_w = transform_ec->ec->w;
- ec_h = transform_ec->ec->h;
-
- if (ec_w < 1) ec_w = 1;
- if (ec_h < 1) ec_h = 1;
-
- if (w) *w = ec_w;
- if (h) *h = ec_h;
-}
-
-static void
-_e_mod_transform_client_pos_get(E_Mod_Transform_Client *transform_ec, int *x, int *y)
-{
- if (!transform_ec) return;
-
- if (x) *x = transform_ec->ec->x;
- if (y) *y = transform_ec->ec->y;
-
-}
-
-static Eina_Bool
-_e_mod_transform_client_geometry_change_check(E_Mod_Transform_Client *transform_ec)
-{
- if (!transform_ec) return EINA_FALSE;
- if (transform_ec->ec->x != transform_ec->x ||
- transform_ec->ec->y != transform_ec->y ||
- transform_ec->ec->w != transform_ec->w ||
- transform_ec->ec->h != transform_ec->h)
- {
- transform_ec->x = transform_ec->ec->x;
- transform_ec->y = transform_ec->ec->y;
- transform_ec->w = transform_ec->ec->w;
- transform_ec->h = transform_ec->ec->h;
-
- return EINA_TRUE;
- }
-
- return EINA_FALSE;
-}
+++ /dev/null
-#ifndef E_MOD_TRANSFORM_MODE_H
-#define E_MOD_TRANSFORM_MODE_H
-
-#include "e.h"
-
-Eina_Bool e_mod_transform_mode_init(void);
-void e_mod_transform_mode_shutdown(void);
-
-#endif /* end of E_MOD_TRANSFORM_MODE_H */
+++ /dev/null
-#ifndef E_MOD_UTILS_H
-#define E_MOD_UTILS_H
-
-#define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
- do \
- { \
- E_Client_Hook *_h; \
- _h = e_client_hook_add(t, cb, d); \
- assert(_h); \
- l = eina_list_append(l, _h); \
- } \
- while (0)
-
-#endif
+++ /dev/null
-#include "e_mod_main.h"
-#ifdef HAVE_WAYLAND_ONLY
-#include "e_comp_wl.h"
-#include "e_mod_wl.h"
-#endif
-
-#ifdef ENABLE_TTRACE
-# include <ttrace.h>
-# undef TRACE_DS_BEGIN
-# undef TRACE_DS_END
-
-# define TRACE_DS_BEGIN(NAME) traceBegin(TTRACE_TAG_WINDOW_MANAGER, "DS:POL:"#NAME)
-# define TRACE_DS_END() traceEnd(TTRACE_TAG_WINDOW_MANAGER)
-#else
-# define TRACE_DS_BEGIN(NAME)
-# define TRACE_DS_END()
-#endif
-
-static Eina_Bool _e_mod_pol_check_transient_child_visible(E_Client *ancestor_ec, E_Client *ec);
-static Eina_Bool _e_mod_pol_check_above_alpha_opaque(E_Client *ec);
-static void _e_mod_pol_client_iconify_by_visibility(E_Client *ec);
-static void _e_mod_pol_client_ancestor_uniconify(E_Client *ec);
-static void _e_mod_pol_client_below_uniconify(E_Client *ec);
-static void _e_mod_pol_client_uniconify_by_visibility(E_Client *ec);
-
-static Eina_Bool
-_e_mod_pol_check_transient_child_visible(E_Client *ancestor_ec, E_Client *ec)
-{
- Eina_Bool visible = EINA_FALSE;
- Eina_List *list = NULL;
- E_Client *child_ec = NULL;
- int anc_x, anc_y, anc_w, anc_h;
- int child_x, child_y, child_w, child_h;
-
- if (!ancestor_ec) return EINA_FALSE;
-
- e_client_geometry_get(ancestor_ec, &anc_x, &anc_y, &anc_w, &anc_h);
-
- list = eina_list_clone(ec->transients);
- EINA_LIST_FREE(list, child_ec)
- {
- if (visible == EINA_TRUE) continue;
-
- if (child_ec->exp_iconify.skip_iconify == EINA_TRUE)
- {
- if (child_ec->visibility.obscured == E_VISIBILITY_UNOBSCURED)
- {
- return EINA_TRUE;
- }
- else
- {
- if (!child_ec->iconic)
- {
- e_client_geometry_get(child_ec, &child_x, &child_y, &child_w, &child_h);
- if (E_CONTAINS(child_x, child_y, child_w, child_h, anc_x, anc_y, anc_w, anc_h))
- {
- return EINA_TRUE;
- }
- }
- }
- }
- else
- {
- if ((!child_ec->iconic) ||
- (child_ec->visibility.obscured == E_VISIBILITY_UNOBSCURED))
- {
- return EINA_TRUE;
- }
- }
-
- visible = _e_mod_pol_check_transient_child_visible(ancestor_ec, child_ec);
- }
-
- return visible;
-}
-
-static Eina_Bool
-_e_mod_pol_check_above_alpha_opaque(E_Client *ec)
-{
- E_Client *above_ec;
- Evas_Object *o;
- Eina_Bool alpha_opaque = EINA_FALSE;
-
- for (o = evas_object_above_get(ec->frame); o; o = evas_object_above_get(o))
- {
- above_ec = evas_object_data_get(o, "E_Client");
- if (!above_ec) continue;
- if (e_client_util_ignored_get(above_ec)) continue;
- if (!E_CONTAINS(above_ec->x, above_ec->y, above_ec->w, above_ec->h, ec->x, ec->y, ec->w, ec->h)) continue;
-
- if ((above_ec->visibility.opaque > 0) && (above_ec->argb))
- {
- if (above_ec->visibility.obscured == E_VISIBILITY_UNOBSCURED)
- {
- alpha_opaque = EINA_TRUE;
- }
- else
- {
- if (!above_ec->iconic)
- {
- alpha_opaque = EINA_TRUE;
- }
- }
- }
- break;
- }
-
- return alpha_opaque;
-}
-
-static void
-_e_mod_pol_client_iconify_by_visibility(E_Client *ec)
-{
- Eina_Bool do_iconify = EINA_TRUE;
-
- if (!ec) return;
- if (ec->iconic) return;
- if (ec->exp_iconify.by_client) return;
- if (ec->exp_iconify.skip_iconify) return;
-
- E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
- if (cdata && !cdata->mapped) return;
-
- if (e_config->transient.iconify)
- {
- if (_e_mod_pol_check_transient_child_visible(ec, ec))
- {
- do_iconify = EINA_FALSE;
- }
- }
-
- if (ec->zone->display_state != E_ZONE_DISPLAY_STATE_OFF)
- {
- // check above window is alpha opaque or not
- if (_e_mod_pol_check_above_alpha_opaque(ec))
- {
- do_iconify = EINA_FALSE;
- }
- }
-
- if (!do_iconify)
- {
- ELOGF("SKIP.. ICONIFY_BY_WM", "win:0x%08x", ec->pixmap, ec, e_client_util_win_get(ec));
- return;
- }
-
- ELOGF("ICONIFY_BY_WM", "win:0x%08x", ec->pixmap, ec, e_client_util_win_get(ec));
- e_mod_pol_wl_iconify_state_change_send(ec, 1);
- e_client_iconify(ec);
-
- /* if client has obscured parent, try to iconify the parent also */
- if (ec->parent)
- {
- if (ec->parent->visibility.obscured == E_VISIBILITY_FULLY_OBSCURED)
- _e_mod_pol_client_iconify_by_visibility(ec->parent);
- }
-}
-
-static void
-_e_mod_pol_client_ancestor_uniconify(E_Client *ec)
-{
- Eina_List *list = NULL;
- Eina_List *l = NULL;
- E_Client *parent = NULL;
- int transient_iconify = 0;
- int count = 0;
-
- if (!ec) return;
- if (e_object_is_del(E_OBJECT(ec))) return;
- if (!ec->iconic) return;
- if (ec->exp_iconify.by_client) return;
- if (ec->exp_iconify.skip_iconify) return;
-
- parent = ec->parent;
- while (parent)
- {
- if (count > 10)
- {
- // something strange state.
- ELOGF("CHECK transient_for tree", "win:0x%08x, parent:0x%08x", NULL, NULL, e_client_util_win_get(ec), e_client_util_win_get(parent));
- break;
- }
-
- if (e_object_is_del(E_OBJECT(parent))) break;
- if (!parent->iconic) break;
- if (parent->exp_iconify.by_client) break;
- if (parent->exp_iconify.skip_iconify) break;
-
- if (eina_list_data_find(list, parent))
- {
- // very bad. there are loop for parenting
- ELOGF("Very BAD. Circling transient_for window", "win:0x%08x, parent:0x%08x", NULL, NULL, e_client_util_win_get(ec), e_client_util_win_get(parent));
- break;
- }
-
- list = eina_list_prepend(list, parent);
- parent = parent->parent;
-
- // for preventing infiniting loop
- count++;
- }
-
- transient_iconify = e_config->transient.iconify;
- e_config->transient.iconify = 0;
-
- parent = NULL;
- EINA_LIST_FOREACH(list, l, parent)
- {
- ELOGF("UNICONIFY_BY_WM", "parent_win:0x%08x", parent->pixmap, parent, e_client_util_win_get(parent));
- parent->exp_iconify.not_raise = 1;
- e_client_uniconify(parent);
- e_mod_pol_wl_iconify_state_change_send(parent, 0);
- }
- eina_list_free(list);
-
- e_config->transient.iconify = transient_iconify;
-}
-
-static void
-_e_mod_pol_client_below_uniconify(E_Client *ec)
-{
- E_Client *below_ec;
- Evas_Object *o;
-
- for (o = evas_object_below_get(ec->frame); o; o = evas_object_below_get(o))
- {
- below_ec = evas_object_data_get(o, "E_Client");
- if (!below_ec) continue;
- if (e_client_util_ignored_get(below_ec)) continue;
-
- if (ec->parent == below_ec) break;
- if (!below_ec->iconic) break;
-
- if (below_ec->visibility.obscured == E_VISIBILITY_FULLY_OBSCURED)
- {
- _e_mod_pol_client_uniconify_by_visibility(below_ec);
- }
-
- break;
- }
-}
-
-static void
-_e_mod_pol_client_uniconify_by_visibility(E_Client *ec)
-{
- if (!ec) return;
- if (e_object_is_del(E_OBJECT(ec))) return;
- if (!ec->iconic) return;
- if (ec->exp_iconify.by_client) return;
- if (ec->exp_iconify.skip_iconify) return;
-
- E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
- if (cdata && !cdata->mapped) return;
-
- _e_mod_pol_client_ancestor_uniconify(ec);
-
- ELOGF("UNICONIFY_BY_WM", "win:0x%08x", ec->pixmap, ec, e_client_util_win_get(ec));
- ec->exp_iconify.not_raise = 1;
- e_client_uniconify(ec);
- e_mod_pol_wl_iconify_state_change_send(ec, 0);
-
- if ((ec->visibility.opaque > 0) && (ec->argb))
- {
- _e_mod_pol_client_below_uniconify(ec);
- }
-}
-
-void
-e_mod_pol_client_visibility_send(E_Client *ec)
-{
-#ifdef HAVE_WAYLAND_ONLY
- e_mod_pol_wl_visibility_send(ec, ec->visibility.obscured);
-#endif
-}
-
-void
-e_mod_pol_client_iconify_by_visibility(E_Client *ec)
-{
- if (!ec) return;
- _e_mod_pol_client_iconify_by_visibility(ec);
-}
-
-void
-e_mod_pol_client_uniconify_by_visibility(E_Client *ec)
-{
- if (!ec) return;
- _e_mod_pol_client_uniconify_by_visibility(ec);
-}
+++ /dev/null
-#include "e_mod_wl.h"
-#include "e_mod_main.h"
-#include "e_mod_quickpanel.h"
-#include "e_mod_volume.h"
-#include "e_mod_lockscreen.h"
-#include "e_mod_wl_display.h"
-#include "e_mod_conformant.h"
-#include "e_mod_indicator.h"
-
-#include <device/display.h>
-#include <wayland-server.h>
-#include <tizen-extension-server-protocol.h>
-#include <tzsh_server.h>
-
-#ifdef ENABLE_CYNARA
-# include <cynara-session.h>
-# include <cynara-client.h>
-# include <cynara-creds-socket.h>
-#endif
-
-#define PRIVILEGE_NOTIFICATION_LEVEL_SET "http://tizen.org/privilege/window.priority.set"
-#define PRIVILEGE_SCREEN_MODE_SET "http://tizen.org/privilege/display"
-#define PRIVILEGE_BRIGHTNESS_SET "http://tizen.org/privilege/display"
-
-#define APP_DEFINE_GROUP_NAME "effect"
-
-typedef enum _Tzsh_Srv_Role
-{
- TZSH_SRV_ROLE_UNKNOWN = -1,
- TZSH_SRV_ROLE_CALL,
- TZSH_SRV_ROLE_VOLUME,
- TZSH_SRV_ROLE_QUICKPANEL,
- TZSH_SRV_ROLE_LOCKSCREEN,
- TZSH_SRV_ROLE_INDICATOR,
- TZSH_SRV_ROLE_TVSERVICE,
- TZSH_SRV_ROLE_SCREENSAVER_MNG,
- TZSH_SRV_ROLE_SCREENSAVER,
- TZSH_SRV_ROLE_MAX
-} Tzsh_Srv_Role;
-
-typedef enum _Tzsh_Type
-{
- TZSH_TYPE_UNKNOWN = 0,
- TZSH_TYPE_SRV,
- TZSH_TYPE_CLIENT
-} Tzsh_Type;
-
-typedef struct _Pol_Wl_Tzpol
-{
- struct wl_resource *res_tzpol; /* tizen_policy_interface */
- Eina_List *psurfs; /* list of Pol_Wl_Surface */
- Eina_List *pending_bg;
-} Pol_Wl_Tzpol;
-
-typedef struct _Pol_Wl_Tz_Dpy_Pol
-{
- struct wl_resource *res_tz_dpy_pol;
- Eina_List *dpy_surfs; // list of Pol_Wl_Dpy_Surface
-} Pol_Wl_Tz_Dpy_Pol;
-
-typedef struct _Pol_Wl_Tzsh
-{
- struct wl_resource *res_tzsh; /* tizen_ws_shell_interface */
- Tzsh_Type type;
- E_Pixmap *cp;
- E_Client *ec;
-} Pol_Wl_Tzsh;
-
-typedef struct _Pol_Wl_Tzsh_Srv
-{
- Pol_Wl_Tzsh *tzsh;
- struct wl_resource *res_tzsh_srv;
- Tzsh_Srv_Role role;
- const char *name;
-} Pol_Wl_Tzsh_Srv;
-
-typedef struct _Pol_Wl_Tzsh_Client
-{
- Pol_Wl_Tzsh *tzsh;
- struct wl_resource *res_tzsh_client;
- Eina_Bool qp_client;
-} Pol_Wl_Tzsh_Client;
-
-typedef struct _Pol_Wl_Tzsh_Region
-{
- Pol_Wl_Tzsh *tzsh;
- struct wl_resource *res_tzsh_reg;
- Eina_Tiler *tiler;
- struct wl_listener destroy_listener;
-} Pol_Wl_Tzsh_Region;
-
-typedef struct _Pol_Wl_Surface
-{
- struct wl_resource *surf;
- Pol_Wl_Tzpol *tzpol;
- E_Pixmap *cp;
- E_Client *ec;
- pid_t pid;
- Eina_Bool pending_notilv;
- int32_t notilv;
- Eina_List *vislist; /* list of tizen_visibility_interface resources */
- Eina_List *poslist; /* list of tizen_position_inteface resources */
- Eina_Bool is_background;
-} Pol_Wl_Surface;
-
-typedef struct _Pol_Wl_Dpy_Surface
-{
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol;
- struct wl_resource *surf;
- E_Client *ec;
- Eina_Bool set;
- int32_t brightness;
-} Pol_Wl_Dpy_Surface;
-
-typedef struct _Pol_Wl_Tzlaunch
-{
- struct wl_resource *res_tzlaunch; /* tizen_launchscreen */
- Eina_List *imglist; /* list of Pol_Wl_Tzlaunch_Img */
-} Pol_Wl_Tzlaunch;
-
-typedef struct _Pol_Wl_Tzlaunch_Img
-{
- struct wl_resource *res_tzlaunch_img; /* tizen_launch_image */
- Pol_Wl_Tzlaunch *tzlaunch; /* launcher */
-
- const char *path; /* image resource path */
- uint32_t type; /* 0: image, 1: edc */
- uint32_t indicator; /* 0: off, 1: on */
- uint32_t angle; /* 0, 90, 180, 270 : rotation angle */
- uint32_t pid;
-
- Evas_Object *obj; /* launch screen image */
- E_Pixmap *ep; /* pixmap for launch screen client */
- E_Client *ec; /* client for launch screen image */
- Ecore_Timer *timeout; /* launch screen image hide timer */
-
- Eina_Bool valid;
-} Pol_Wl_Tzlaunch_Img;
-
-typedef struct _Pol_Wl_Tz_Indicator
-{
- struct wl_resource *res_tz_indicator;
- E_Client *ec;
-} Pol_Wl_Tz_Indicator;
-
-typedef enum _E_Launch_Img_File_type
-{
- E_LAUNCH_FILE_TYPE_ERROR = -1,
- E_LAUNCH_FILE_TYPE_IMAGE = 0,
- E_LAUNCH_FILE_TYPE_EDJ
-} E_Launch_Img_File_type;
-
-typedef struct _Pol_Wl
-{
- Eina_List *globals; /* list of wl_global */
- Eina_Hash *tzpols; /* list of Pol_Wl_Tzpol */
-
- Eina_List *tz_dpy_pols; /* list of Pol_Wl_Tz_Dpy_Pol */
- Eina_List *pending_vis; /* list of clients that have pending visibility change*/
-
- /* tizen_ws_shell_interface */
- Eina_List *tzshs; /* list of Pol_Wl_Tzsh */
- Eina_List *tzsh_srvs; /* list of Pol_Wl_Tzsh_Srv */
- Eina_List *tzsh_clients; /* list of Pol_Wl_Tzsh_Client */
- Pol_Wl_Tzsh_Srv *srvs[TZSH_SRV_ROLE_MAX]; /* list of registered Pol_Wl_Tzsh_Srv */
- Eina_List *tvsrv_bind_list; /* list of activated Pol_Wl_Tzsh_Client */
- Eina_List *tz_indicators;
-
- /* tizen_launchscreen_interface */
- Eina_List *tzlaunchs; /* list of Pol_Wl_Tzlaunch */
-#ifdef ENABLE_CYNARA
- cynara *p_cynara;
-#endif
-} Pol_Wl;
-
-typedef struct _E_Tzsh_QP_Event
-{
- int type;
- int val;
-} E_Tzsh_QP_Event;
-
-static Pol_Wl *polwl = NULL;
-
-static Eina_List *handlers = NULL;
-static Eina_List *hooks_cw = NULL;
-static struct wl_resource *_scrsaver_mng_res = NULL; // TODO
-static struct wl_resource *_indicator_srv_res = NULL;
-
-enum _WM_Policy_Hint_Type
-{
- WM_POLICY_HINT_USER_GEOMETRY = 0,
- WM_POLICY_HINT_FIXED_RESIZE = 1,
- WM_POLICY_HINT_DEICONIFY_APPROVE_DISABLE = 2,
- WM_POLICY_HINT_ICONIFY = 3,
- WM_POLICY_HINT_ABOVE_LOCKSCREEN = 4,
- WM_POLICY_HINT_GESTURE_DISABLE = 5,
- WM_POLICY_HINT_EFFECT_DISABLE = 6,
-};
-
-static const char *hint_names[] =
-{
- "wm.policy.win.user.geometry",
- "wm.policy.win.fixed.resize",
- "wm.policy.win.deiconify.approve.disable",
- "wm.policy.win.iconify",
- "wm.policy.win.above.lock",
- "wm.policy.win.gesture.disable",
- "wm.policy.win.effect.disable",
-};
-
-static void _pol_wl_surf_del(Pol_Wl_Surface *psurf);
-static void _pol_wl_tzsh_srv_register_handle(Pol_Wl_Tzsh_Srv *tzsh_srv);
-static void _pol_wl_tzsh_srv_unregister_handle(Pol_Wl_Tzsh_Srv *tzsh_srv);
-static void _pol_wl_tzsh_srv_state_broadcast(Pol_Wl_Tzsh_Srv *tzsh_srv, Eina_Bool reg);
-static void _pol_wl_tzsh_srv_tvsrv_bind_update(void);
-static Eina_Bool _pol_wl_e_client_is_valid(E_Client *ec);
-static Pol_Wl_Tzsh_Srv *_pol_wl_tzsh_srv_add(Pol_Wl_Tzsh *tzsh, Tzsh_Srv_Role role, struct wl_resource *res_tzsh_srv, const char *name);
-static void _pol_wl_tzsh_srv_del(Pol_Wl_Tzsh_Srv *tzsh_srv);
-static Pol_Wl_Tzsh_Client *_pol_wl_tzsh_client_add(Pol_Wl_Tzsh *tzsh, struct wl_resource *res_tzsh_client);
-static void _pol_wl_tzsh_client_del(Pol_Wl_Tzsh_Client *tzsh_client);
-static void _launchscreen_hide(uint32_t pid);
-static void _launch_img_off(Pol_Wl_Tzlaunch_Img *tzlaunchimg);
-static void _pol_wl_background_state_set(Pol_Wl_Surface *psurf, Eina_Bool state);
-
-// --------------------------------------------------------
-// Pol_Wl_Tzpol
-// --------------------------------------------------------
-static Pol_Wl_Tzpol *
-_pol_wl_tzpol_add(struct wl_resource *res_tzpol)
-{
- Pol_Wl_Tzpol *tzpol;
-
- tzpol = E_NEW(Pol_Wl_Tzpol, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tzpol, NULL);
-
- eina_hash_add(polwl->tzpols, &res_tzpol, tzpol);
-
- tzpol->res_tzpol = res_tzpol;
-
- return tzpol;
-}
-
-static void
-_pol_wl_tzpol_del(void *data)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
-
- tzpol = (Pol_Wl_Tzpol *)data;
-
- EINA_LIST_FREE(tzpol->psurfs, psurf)
- {
- _pol_wl_surf_del(psurf);
- }
-
- tzpol->pending_bg = eina_list_free(tzpol->pending_bg);
-
- memset(tzpol, 0x0, sizeof(Pol_Wl_Tzpol));
- E_FREE(tzpol);
-}
-
-static Pol_Wl_Tzpol *
-_pol_wl_tzpol_get(struct wl_resource *res_tzpol)
-{
- return (Pol_Wl_Tzpol *)eina_hash_find(polwl->tzpols, &res_tzpol);
-}
-
-static Pol_Wl_Surface *
-_pol_wl_tzpol_surf_find(Pol_Wl_Tzpol *tzpol, E_Client *ec)
-{
- Eina_List *l;
- Pol_Wl_Surface *psurf;
-
- EINA_LIST_FOREACH(tzpol->psurfs, l, psurf)
- {
- if (psurf->ec == ec)
- return psurf;
- }
-
- return NULL;
-}
-
-static Eina_List *
-_pol_wl_tzpol_surf_find_by_pid(Pol_Wl_Tzpol *tzpol, pid_t pid)
-{
- Eina_List *surfs = NULL, *l;
- Pol_Wl_Surface *psurf;
-
- EINA_LIST_FOREACH(tzpol->psurfs, l, psurf)
- {
- if (psurf->pid == pid)
- {
- surfs = eina_list_append(surfs, psurf);
- }
- }
-
- return surfs;
-}
-
-static Eina_Bool
-_pol_wl_surf_is_valid(Pol_Wl_Surface *psurf)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf2;
- Eina_Iterator *it;
- Eina_List *l;
-
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- EINA_LIST_FOREACH(tzpol->psurfs, l, psurf2)
- {
- if (psurf2 == psurf)
- {
- eina_iterator_free(it);
- return EINA_TRUE;
- }
- }
- eina_iterator_free(it);
-
- return EINA_FALSE;
-}
-
-// --------------------------------------------------------
-// Pol_Wl_Tzsh
-// --------------------------------------------------------
-static Pol_Wl_Tzsh *
-_pol_wl_tzsh_add(struct wl_resource *res_tzsh)
-{
- Pol_Wl_Tzsh *tzsh;
-
- tzsh = E_NEW(Pol_Wl_Tzsh, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tzsh, NULL);
-
- tzsh->res_tzsh = res_tzsh;
- tzsh->type = TZSH_TYPE_UNKNOWN;
-
- polwl->tzshs = eina_list_append(polwl->tzshs, tzsh);
-
- return tzsh;
-}
-
-static void
-_pol_wl_tzsh_del(Pol_Wl_Tzsh *tzsh)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- Pol_Wl_Tzsh_Client *tzsh_client;
- Eina_List *l, *ll;
-
- polwl->tzshs = eina_list_remove(polwl->tzshs, tzsh);
-
- if (tzsh->type == TZSH_TYPE_SRV)
- {
- EINA_LIST_FOREACH_SAFE(polwl->tzsh_srvs, l, ll, tzsh_srv)
- {
- if (tzsh_srv->tzsh != tzsh) continue;
- _pol_wl_tzsh_srv_del(tzsh_srv);
- break;
- }
- }
- else
- {
- EINA_LIST_FOREACH_SAFE(polwl->tzsh_clients, l, ll, tzsh_client)
- {
- if (tzsh_client->tzsh != tzsh) continue;
- _pol_wl_tzsh_client_del(tzsh_client);
- break;
- }
- }
-
- memset(tzsh, 0x0, sizeof(Pol_Wl_Tzsh));
- E_FREE(tzsh);
-}
-
-static void
-_pol_wl_tzsh_data_set(Pol_Wl_Tzsh *tzsh, Tzsh_Type type, E_Pixmap *cp, E_Client *ec)
-{
- tzsh->type = type;
- tzsh->cp = cp;
- tzsh->ec = ec;
-}
-
-/* notify current registered services to the client */
-static void
-_pol_wl_tzsh_registered_srv_send(Pol_Wl_Tzsh *tzsh)
-{
- int i;
-
- for (i = 0; i < TZSH_SRV_ROLE_MAX; i++)
- {
- if (!polwl->srvs[i]) continue;
-
- tizen_ws_shell_send_service_register
- (tzsh->res_tzsh, polwl->srvs[i]->name);
- }
-}
-
-static Pol_Wl_Tzsh *
-_pol_wl_tzsh_get_from_client(E_Client *ec)
-{
- Pol_Wl_Tzsh *tzsh = NULL;
- Eina_List *l;
-
- EINA_LIST_FOREACH(polwl->tzshs, l, tzsh)
- {
- if (tzsh->cp == ec->pixmap)
- {
- if ((tzsh->ec) &&
- (tzsh->ec != ec))
- {
- ELOGF("TZSH",
- "CRI ERR!!|tzsh_cp:0x%08x|tzsh_ec:0x%08x|tzsh:0x%08x",
- ec->pixmap, ec,
- (unsigned int)tzsh->cp,
- (unsigned int)tzsh->ec,
- (unsigned int)tzsh);
- }
-
- return tzsh;
- }
- }
-
- return NULL;
-}
-
-static Pol_Wl_Tzsh_Client *
-_pol_wl_tzsh_client_get_from_client(E_Client *ec)
-{
- Pol_Wl_Tzsh_Client *tzsh_client = NULL;
- Eina_List *l;
-
- if (!ec) return NULL;
- if (e_object_is_del(E_OBJECT(ec))) return NULL;
-
- EINA_LIST_FOREACH(polwl->tzsh_clients, l, tzsh_client)
- {
- if (!tzsh_client->tzsh) continue;
- if (!tzsh_client->tzsh->ec) continue;
-
- if (tzsh_client->tzsh->cp == ec->pixmap)
- {
- if (tzsh_client->tzsh->ec != ec)
- {
- ELOGF("TZSH",
- "CRI ERR!!|tzsh_cp:0x%08x|tzsh_ec:0x%08x|tzsh:0x%08x",
- ec->pixmap, ec,
- (unsigned int)tzsh_client->tzsh->cp,
- (unsigned int)tzsh_client->tzsh->ec,
- (unsigned int)tzsh_client->tzsh);
- }
- return tzsh_client;
- }
- }
-
- return NULL;
-}
-
-static Pol_Wl_Tzsh_Client *
-_pol_wl_tzsh_client_get_from_tzsh(Pol_Wl_Tzsh *tzsh)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- Eina_List *l;
-
- EINA_LIST_FOREACH(polwl->tvsrv_bind_list, l, tzsh_client)
- {
- if (tzsh_client->tzsh == tzsh)
- return tzsh_client;
- }
-
- return NULL;
-}
-
-static void
-_pol_wl_tzsh_client_set(E_Client *ec)
-{
- Pol_Wl_Tzsh *tzsh, *tzsh2;
- Pol_Wl_Tzsh_Srv *tzsh_srv;
-
- tzsh = _pol_wl_tzsh_get_from_client(ec);
- if (!tzsh) return;
-
- tzsh->ec = ec;
-
- if (tzsh->type == TZSH_TYPE_SRV)
- {
- tzsh_srv = polwl->srvs[TZSH_SRV_ROLE_TVSERVICE];
- if (tzsh_srv)
- {
- tzsh2 = tzsh_srv->tzsh;
- if (tzsh2 == tzsh)
- _pol_wl_tzsh_srv_register_handle(tzsh_srv);
- }
- }
- else
- {
- if (_pol_wl_tzsh_client_get_from_tzsh(tzsh))
- _pol_wl_tzsh_srv_tvsrv_bind_update();
- }
-}
-
-static void
-_pol_wl_tzsh_client_unset(E_Client *ec)
-{
- Pol_Wl_Tzsh *tzsh, *tzsh2;
- Pol_Wl_Tzsh_Srv *tzsh_srv;
-
- tzsh = _pol_wl_tzsh_get_from_client(ec);
- if (!tzsh) return;
-
- tzsh->ec = NULL;
-
- if (tzsh->type == TZSH_TYPE_SRV)
- {
- tzsh_srv = polwl->srvs[TZSH_SRV_ROLE_TVSERVICE];
- if (tzsh_srv)
- {
- tzsh2 = tzsh_srv->tzsh;
- if (tzsh2 == tzsh)
- _pol_wl_tzsh_srv_unregister_handle(tzsh_srv);
- }
- }
- else
- {
- if (_pol_wl_tzsh_client_get_from_tzsh(tzsh))
- _pol_wl_tzsh_srv_tvsrv_bind_update();
- }
-}
-
-// --------------------------------------------------------
-// Pol_Wl_Tzsh_Srv
-// --------------------------------------------------------
-static Pol_Wl_Tzsh_Srv *
-_pol_wl_tzsh_srv_add(Pol_Wl_Tzsh *tzsh, Tzsh_Srv_Role role, struct wl_resource *res_tzsh_srv, const char *name)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
-
- tzsh_srv = E_NEW(Pol_Wl_Tzsh_Srv, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tzsh_srv, NULL);
-
- tzsh_srv->tzsh = tzsh;
- tzsh_srv->res_tzsh_srv = res_tzsh_srv;
- tzsh_srv->role = role;
- tzsh_srv->name = eina_stringshare_add(name);
-
- polwl->srvs[role] = tzsh_srv;
- polwl->tzsh_srvs = eina_list_append(polwl->tzsh_srvs, tzsh_srv);
-
- _pol_wl_tzsh_srv_register_handle(tzsh_srv);
- _pol_wl_tzsh_srv_state_broadcast(tzsh_srv, EINA_TRUE);
-
- return tzsh_srv;
-}
-
-static void
-_pol_wl_tzsh_srv_del(Pol_Wl_Tzsh_Srv *tzsh_srv)
-{
- polwl->tzsh_srvs = eina_list_remove(polwl->tzsh_srvs, tzsh_srv);
-
- if (polwl->srvs[tzsh_srv->role] == tzsh_srv)
- polwl->srvs[tzsh_srv->role] = NULL;
-
- _pol_wl_tzsh_srv_state_broadcast(tzsh_srv, EINA_TRUE);
- _pol_wl_tzsh_srv_unregister_handle(tzsh_srv);
-
- if (tzsh_srv->name)
- eina_stringshare_del(tzsh_srv->name);
-
- if (tzsh_srv->role == TZSH_SRV_ROLE_INDICATOR)
- {
- E_Client *ec;
- ec = tzsh_srv->tzsh->ec;
-
- if (ec && ec->internal)
- {
- e_pixmap_del(tzsh_srv->tzsh->cp);
- e_object_del(E_OBJECT(ec));
- }
-
- _indicator_srv_res = NULL;
- }
-
- memset(tzsh_srv, 0x0, sizeof(Pol_Wl_Tzsh_Srv));
- E_FREE(tzsh_srv);
-}
-
-static int
-_pol_wl_tzsh_srv_role_get(const char *name)
-{
- Tzsh_Srv_Role role = TZSH_SRV_ROLE_UNKNOWN;
-
- if (!e_util_strcmp(name, "call" )) role = TZSH_SRV_ROLE_CALL;
- else if (!e_util_strcmp(name, "volume" )) role = TZSH_SRV_ROLE_VOLUME;
- else if (!e_util_strcmp(name, "quickpanel" )) role = TZSH_SRV_ROLE_QUICKPANEL;
- else if (!e_util_strcmp(name, "lockscreen" )) role = TZSH_SRV_ROLE_LOCKSCREEN;
- else if (!e_util_strcmp(name, "indicator" )) role = TZSH_SRV_ROLE_INDICATOR;
- else if (!e_util_strcmp(name, "tvsrv" )) role = TZSH_SRV_ROLE_TVSERVICE;
- else if (!e_util_strcmp(name, "screensaver_manager")) role = TZSH_SRV_ROLE_SCREENSAVER_MNG;
- else if (!e_util_strcmp(name, "screensaver" )) role = TZSH_SRV_ROLE_SCREENSAVER;
-
- return role;
-}
-
-static E_Client *
-_pol_wl_tzsh_srv_parent_client_pick(void)
-{
- Pol_Wl_Tzsh *tzsh = NULL;
- Pol_Wl_Tzsh_Client *tzsh_client;
- E_Client *ec = NULL, *ec2;
- Eina_List *l;
-
- EINA_LIST_REVERSE_FOREACH(polwl->tvsrv_bind_list, l, tzsh_client)
- {
- tzsh = tzsh_client->tzsh;
- if (!tzsh) continue;
-
- ec2 = tzsh->ec;
- if (!ec2) continue;
- if (!_pol_wl_e_client_is_valid(ec2)) continue;
-
- ec = ec2;
- break;
- }
-
- return ec;
-}
-
-static void
-_pol_wl_tzsh_srv_tvsrv_bind_update(void)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- E_Client *tzsh_client_ec = NULL;
- E_Client *tzsh_srv_ec = NULL;
-
- tzsh_srv = polwl->srvs[TZSH_SRV_ROLE_TVSERVICE];
- if ((tzsh_srv) && (tzsh_srv->tzsh))
- tzsh_srv_ec = tzsh_srv->tzsh->ec;
-
- tzsh_client_ec = _pol_wl_tzsh_srv_parent_client_pick();
-
- if ((tzsh_srv_ec) &&
- (tzsh_srv_ec->parent == tzsh_client_ec))
- return;
-
- if ((tzsh_client_ec) && (tzsh_srv_ec))
- {
- ELOGF("TZSH",
- "TR_SET |parent_ec:0x%08x|child_ec:0x%08x",
- NULL, NULL,
- (unsigned int)e_client_util_win_get(tzsh_client_ec),
- (unsigned int)e_client_util_win_get(tzsh_srv_ec));
-
- e_mod_pol_stack_transient_for_set(tzsh_srv_ec, tzsh_client_ec);
- evas_object_stack_below(tzsh_srv_ec->frame, tzsh_client_ec->frame);
- }
- else
- {
- if (tzsh_srv_ec)
- {
- ELOGF("TZSH",
- "TR_UNSET | |child_ec:0x%08x",
- NULL, NULL,
- (unsigned int)e_client_util_win_get(tzsh_srv_ec));
-
- e_mod_pol_stack_transient_for_set(tzsh_srv_ec, NULL);
- }
- }
-}
-
-static void
-_pol_wl_tzsh_srv_register_handle(Pol_Wl_Tzsh_Srv *tzsh_srv)
-{
- Pol_Wl_Tzsh *tzsh;
-
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
-
- tzsh = tzsh_srv->tzsh;
- EINA_SAFETY_ON_NULL_RETURN(tzsh);
-
- switch (tzsh_srv->role)
- {
- case TZSH_SRV_ROLE_TVSERVICE:
- if (tzsh->ec) tzsh->ec->transient_policy = E_TRANSIENT_BELOW;
- _pol_wl_tzsh_srv_tvsrv_bind_update();
- break;
-
- default:
- break;
- }
-}
-
-static void
-_pol_wl_tzsh_srv_unregister_handle(Pol_Wl_Tzsh_Srv *tzsh_srv)
-{
- Pol_Wl_Tzsh *tzsh;
-
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
-
- tzsh = tzsh_srv->tzsh;
- EINA_SAFETY_ON_NULL_RETURN(tzsh);
-
- switch (tzsh_srv->role)
- {
- case TZSH_SRV_ROLE_TVSERVICE:
- _pol_wl_tzsh_srv_tvsrv_bind_update();
- break;
-
- default:
- break;
- }
-}
-
-/* broadcast state of registered service to all subscribers */
-static void
-_pol_wl_tzsh_srv_state_broadcast(Pol_Wl_Tzsh_Srv *tzsh_srv, Eina_Bool reg)
-{
- Pol_Wl_Tzsh *tzsh;
- Eina_List *l;
-
- EINA_LIST_FOREACH(polwl->tzshs, l, tzsh)
- {
- if (tzsh->type == TZSH_TYPE_SRV) continue;
-
- if (reg)
- tizen_ws_shell_send_service_register
- (tzsh->res_tzsh, tzsh_srv->name);
- else
- tizen_ws_shell_send_service_unregister
- (tzsh->res_tzsh, tzsh_srv->name);
- }
-}
-
-// --------------------------------------------------------
-// Pol_Wl_Tzsh_Client
-// --------------------------------------------------------
-static Pol_Wl_Tzsh_Client *
-_pol_wl_tzsh_client_add(Pol_Wl_Tzsh *tzsh, struct wl_resource *res_tzsh_client)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
-
- tzsh_client = E_NEW(Pol_Wl_Tzsh_Client, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tzsh_client, NULL);
-
- tzsh_client->tzsh = tzsh;
- tzsh_client->res_tzsh_client = res_tzsh_client;
-
- /* TODO: add tzsh_client to list or hash */
-
- polwl->tzsh_clients = eina_list_append(polwl->tzsh_clients, tzsh_client);
-
- return tzsh_client;
-}
-
-static void
-_pol_wl_tzsh_client_del(Pol_Wl_Tzsh_Client *tzsh_client)
-{
- if (!tzsh_client) return;
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- polwl->tzsh_clients = eina_list_remove(polwl->tzsh_clients, tzsh_client);
- polwl->tvsrv_bind_list = eina_list_remove(polwl->tvsrv_bind_list, tzsh_client);
-
- if ((tzsh_client->qp_client) &&
- (tzsh_client->tzsh) &&
- (tzsh_client->tzsh->ec))
- e_qp_client_del(tzsh_client->tzsh->ec);
-
- memset(tzsh_client, 0x0, sizeof(Pol_Wl_Tzsh_Client));
- E_FREE(tzsh_client);
-}
-
-// --------------------------------------------------------
-// Pol_Wl_Surface
-// --------------------------------------------------------
-static Pol_Wl_Surface *
-_pol_wl_surf_add(E_Client *ec, struct wl_resource *res_tzpol)
-{
- Pol_Wl_Surface *psurf = NULL;
-
- Pol_Wl_Tzpol *tzpol;
-
- tzpol = _pol_wl_tzpol_get(res_tzpol);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tzpol, NULL);
-
- psurf = _pol_wl_tzpol_surf_find(tzpol, ec);
- if (psurf) return psurf;
-
- psurf = E_NEW(Pol_Wl_Surface, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(psurf, NULL);
-
- psurf->surf = ec->comp_data->surface;
- psurf->tzpol = tzpol;
- psurf->cp = ec->pixmap;
- psurf->ec = ec;
- psurf->pid = ec->netwm.pid;
-
- tzpol->psurfs = eina_list_append(tzpol->psurfs, psurf);
-
- return psurf;
-}
-
-static void
-_pol_wl_surf_del(Pol_Wl_Surface *psurf)
-{
- eina_list_free(psurf->vislist);
- eina_list_free(psurf->poslist);
-
- memset(psurf, 0x0, sizeof(Pol_Wl_Surface));
- E_FREE(psurf);
-}
-
-static void
-_pol_wl_surf_client_set(E_Client *ec)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
- Eina_Iterator *it;
-
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- {
- psurf = _pol_wl_tzpol_surf_find(tzpol, ec);
- if (psurf)
- {
- if ((psurf->ec) && (psurf->ec != ec))
- {
- ELOGF("POLSURF",
- "CRI ERR!!|s:0x%08x|tzpol:0x%08x|ps:0x%08x|new_ec:0x%08x|new_cp:0x%08x",
- psurf->cp,
- psurf->ec,
- (unsigned int)psurf->surf,
- (unsigned int)psurf->tzpol,
- (unsigned int)psurf,
- (unsigned int)ec,
- (unsigned int)ec->pixmap);
- }
-
- psurf->ec = ec;
- }
- }
- eina_iterator_free(it);
-
- return;
-}
-
-static void
-_pol_wl_pending_bg_client_set(E_Client *ec)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
- Eina_Iterator *it;
-
- if (ec->netwm.pid == 0) return;
-
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- {
- Eina_List *psurfs;
-
- if (!tzpol->pending_bg) continue;
-
- if ((psurfs = _pol_wl_tzpol_surf_find_by_pid(tzpol, ec->netwm.pid)))
- {
- EINA_LIST_FREE(psurfs, psurf)
- {
- psurf->ec = ec;
-
- if (eina_list_data_find(tzpol->pending_bg, psurf))
- {
- _pol_wl_background_state_set(psurf, EINA_TRUE);
- tzpol->pending_bg = eina_list_remove(tzpol->pending_bg, psurf);
- }
- }
- }
- }
- eina_iterator_free(it);
-}
-
-static E_Pixmap *
-_pol_wl_e_pixmap_get_from_id(struct wl_client *client, uint32_t id)
-{
- E_Pixmap *cp;
- E_Client *ec;
- struct wl_resource *res_surf;
-
- res_surf = wl_client_get_object(client, id);
- if (!res_surf)
- {
- ERR("Could not get surface resource");
- return NULL;
- }
-
- ec = wl_resource_get_user_data(res_surf);
- if (!ec)
- {
- ERR("Could not get surface's user data");
- return NULL;
- }
-
- /* check E_Pixmap */
- cp = e_pixmap_find(E_PIXMAP_TYPE_WL, (uintptr_t)res_surf);
- if (cp != ec->pixmap)
- {
- ELOGF("POLWL",
- "CRI ERR!!|cp2:0x%08x|ec2:0x%08x|res_surf:0x%08x",
- ec->pixmap, ec,
- (unsigned int)cp,
- (unsigned int)e_pixmap_client_get(cp),
- (unsigned int)res_surf);
- return NULL;
- }
-
- return cp;
-}
-
-static Eina_Bool
-_pol_wl_e_client_is_valid(E_Client *ec)
-{
- E_Client *ec2;
- Eina_List *l;
- Eina_Bool del = EINA_FALSE;
- Eina_Bool found = EINA_FALSE;
-
- EINA_LIST_FOREACH(e_comp->clients, l, ec2)
- {
- if (ec2 == ec)
- {
- if (e_object_is_del(E_OBJECT(ec2)))
- del = EINA_TRUE;
- found = EINA_TRUE;
- break;
- }
- }
-
- return ((!del) && (found));
-}
-
-static Eina_List *
-_pol_wl_e_clients_find_by_pid(pid_t pid)
-{
- E_Client *ec;
- Eina_List *clients = NULL, *l;
-
- EINA_LIST_FOREACH(e_comp->clients, l, ec)
- {
- if (e_object_is_del(E_OBJECT(ec))) continue;
- if (ec->netwm.pid != pid) continue;
- clients = eina_list_append(clients, ec);
- }
-
- return clients;
-}
-
-// --------------------------------------------------------
-// visibility
-// --------------------------------------------------------
-static void
-_tzvis_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzvis)
-{
- wl_resource_destroy(res_tzvis);
-}
-
-static const struct tizen_visibility_interface _tzvis_iface =
-{
- _tzvis_iface_cb_destroy
-};
-
-static void
-_tzvis_iface_cb_vis_destroy(struct wl_resource *res_tzvis)
-{
- Pol_Wl_Surface *psurf;
- Eina_Bool r;
-
- psurf = wl_resource_get_user_data(res_tzvis);
- EINA_SAFETY_ON_NULL_RETURN(psurf);
-
- r = _pol_wl_surf_is_valid(psurf);
- if (!r) return;
-
- psurf->vislist = eina_list_remove(psurf->vislist, res_tzvis);
-}
-
-static void
-_tzpol_iface_cb_vis_get(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t id, struct wl_resource *surf)
-{
- E_Client *ec;
- Pol_Wl_Surface *psurf;
- struct wl_resource *res_tzvis;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- psurf = _pol_wl_surf_add(ec, res_tzpol);
- EINA_SAFETY_ON_NULL_RETURN(psurf);
-
- res_tzvis = wl_resource_create(client,
- &tizen_visibility_interface,
- wl_resource_get_version(res_tzpol),
- id);
- if (!res_tzvis)
- {
- wl_client_post_no_memory(client);
- return;
- }
-
- wl_resource_set_implementation(res_tzvis,
- &_tzvis_iface,
- psurf,
- _tzvis_iface_cb_vis_destroy);
-
- psurf->vislist = eina_list_append(psurf->vislist, res_tzvis);
-
- if (eina_list_data_find(polwl->pending_vis, ec))
- {
- e_mod_pol_wl_visibility_send(ec, ec->visibility.obscured);
- }
-}
-
-void
-e_mod_pol_wl_visibility_send(E_Client *ec, int vis)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
- struct wl_resource *res_tzvis;
- Eina_List *l, *ll;
- Eina_Iterator *it;
- E_Client *ec2;
- Ecore_Window win;
- Eina_Bool sent = EINA_FALSE;
-
- win = e_client_util_win_get(ec);
-
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- EINA_LIST_FOREACH(tzpol->psurfs, l, psurf)
- {
- ec2 = e_pixmap_client_get(psurf->cp);
- if (ec2 != ec) continue;
-
- EINA_LIST_FOREACH(psurf->vislist, ll, res_tzvis)
- {
- tizen_visibility_send_notify(res_tzvis, vis);
- ELOGF("TZVIS",
- "SEND |win:0x%08x|res_tzvis:0x%08x|v:%d",
- ec->pixmap, ec,
- (unsigned int)win,
- (unsigned int)res_tzvis,
- vis);
- sent = EINA_TRUE;
- _launchscreen_hide(ec->netwm.pid);
- }
- }
- eina_iterator_free(it);
-
- polwl->pending_vis = eina_list_remove(polwl->pending_vis, ec);
- if (!sent)
- polwl->pending_vis = eina_list_append(polwl->pending_vis, ec);
-}
-
-void
-e_mod_pol_wl_iconify_state_change_send(E_Client *ec, int iconic)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
- E_Client *ec2;
- Eina_List *l;
- Eina_Iterator *it;
- Ecore_Window win;
-
- if (ec->exp_iconify.skip_iconify) return;
-
- if (e_config->transient.iconify)
- {
- E_Client *child;
- Eina_List *list = eina_list_clone(ec->transients);
-
- EINA_LIST_FREE(list, child)
- {
- if ((child->iconic == ec->iconic) &&
- (child->exp_iconify.by_client == ec->exp_iconify.by_client))
- e_mod_pol_wl_iconify_state_change_send(child, iconic);
-
- }
- }
-
- win = e_client_util_win_get(ec);
-
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- EINA_LIST_FOREACH(tzpol->psurfs, l, psurf)
- {
- ec2 = e_pixmap_client_get(psurf->cp);
- if (ec2 != ec) continue;
-
- tizen_policy_send_iconify_state_changed(tzpol->res_tzpol, psurf->surf, iconic, 1);
- ELOGF("ICONIFY",
- "SEND |win:0x%08x|iconic:%d |sur:%p",
- ec->pixmap, ec,
- (unsigned int)win,
- iconic, psurf->surf);
- break;
- }
- eina_iterator_free(it);
-}
-
-// --------------------------------------------------------
-// position
-// --------------------------------------------------------
-static void
-_tzpos_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpos)
-{
- wl_resource_destroy(res_tzpos);
-}
-
-static void
-_tzpos_iface_cb_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpos, int32_t x, int32_t y)
-{
- E_Client *ec;
- Pol_Wl_Surface *psurf;
-
- psurf = wl_resource_get_user_data(res_tzpos);
- EINA_SAFETY_ON_NULL_RETURN(psurf);
-
- ec = e_pixmap_client_get(psurf->cp);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- if(!E_INTERSECTS(ec->zone->x, ec->zone->y,
- ec->zone->w, ec->zone->h,
- x, y,
- ec->w, ec->h))
- {
- e_mod_pol_wl_position_send(ec);
- return;
- }
-
- if (!ec->lock_client_location)
- {
- ec->x = ec->client.x = x;
- ec->y = ec->client.y = y;
- ec->placed = 1;
- }
-}
-
-static const struct tizen_position_interface _tzpos_iface =
-{
- _tzpos_iface_cb_destroy,
- _tzpos_iface_cb_set,
-};
-
-static void
-_tzpol_iface_cb_pos_destroy(struct wl_resource *res_tzpos)
-{
- Pol_Wl_Surface *psurf;
- Eina_Bool r;
-
- psurf = wl_resource_get_user_data(res_tzpos);
- EINA_SAFETY_ON_NULL_RETURN(psurf);
-
- r = _pol_wl_surf_is_valid(psurf);
- if (!r) return;
-
- psurf->poslist = eina_list_remove(psurf->poslist, res_tzpos);
-}
-
-static void
-_tzpol_iface_cb_pos_get(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t id, struct wl_resource *surf)
-{
- E_Client *ec;
- Pol_Wl_Surface *psurf;
- struct wl_resource *res_tzpos;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- psurf = _pol_wl_surf_add(ec, res_tzpol);
- EINA_SAFETY_ON_NULL_RETURN(psurf);
-
- res_tzpos = wl_resource_create(client,
- &tizen_position_interface,
- wl_resource_get_version(res_tzpol),
- id);
- if (!res_tzpos)
- {
- wl_client_post_no_memory(client);
- return;
- }
-
- wl_resource_set_implementation(res_tzpos,
- &_tzpos_iface,
- psurf,
- _tzpol_iface_cb_pos_destroy);
-
- psurf->poslist = eina_list_append(psurf->poslist, res_tzpos);
-}
-
-void
-e_mod_pol_wl_position_send(E_Client *ec)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
- struct wl_resource *res_tzpos;
- Eina_List *l, *ll;
- Eina_Iterator *it;
- Ecore_Window win;
-
- win = e_client_util_win_get(ec);
-
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- EINA_LIST_FOREACH(tzpol->psurfs, l, psurf)
- {
- if (e_pixmap_client_get(psurf->cp) != ec) continue;
-
- EINA_LIST_FOREACH(psurf->poslist, ll, res_tzpos)
- {
- tizen_position_send_changed(res_tzpos, ec->client.x, ec->client.y);
- ELOGF("TZPOS",
- "SEND |win:0x%08x|res_tzpos:0x%08x|ec->x:%d, ec->y:%d, ec->client.x:%d, ec->client.y:%d",
- ec->pixmap, ec,
- (unsigned int)win,
- (unsigned int)res_tzpos,
- ec->x, ec->y,
- ec->client.x, ec->client.y);
- }
- }
- eina_iterator_free(it);
-}
-
-// --------------------------------------------------------
-// stack: activate, raise, lower
-// --------------------------------------------------------
-static void
-_tzpol_iface_cb_activate(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- ELOGF("TZPOL", "ACTIVATE", ec->pixmap, ec);
-
- if ((!starting) && (!ec->focused))
- {
- if ((ec->iconic) && (!ec->exp_iconify.by_client))
- e_mod_pol_wl_iconify_state_change_send(ec, 0);
- e_client_activate(ec, EINA_TRUE);
- }
- else
- evas_object_raise(ec->frame);
-
- if (e_mod_pol_client_is_lockscreen(ec))
- e_mod_pol_stack_clients_restack_above_lockscreen(ec, EINA_TRUE);
- else
- e_mod_pol_stack_check_above_lockscreen(ec, ec->layer, NULL, EINA_TRUE);
-}
-
-static void
-_tzpol_iface_cb_activate_below_by_res_id(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t res_id, uint32_t below_res_id)
-{
- E_Client *ec = NULL;
- E_Client *below_ec = NULL;
- E_Client *parent_ec = NULL;
- Eina_Bool check_ancestor = EINA_FALSE;
-
- ec = e_pixmap_find_client_by_res_id(res_id);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- below_ec = e_pixmap_find_client_by_res_id(below_res_id);
- EINA_SAFETY_ON_NULL_RETURN(below_ec);
- EINA_SAFETY_ON_NULL_RETURN(below_ec->frame);
-
- if (ec->layer > below_ec->layer) return;
-
- parent_ec = ec->parent;
- while (parent_ec)
- {
- if (parent_ec == below_ec)
- {
- check_ancestor = EINA_TRUE;
- break;
- }
- parent_ec = parent_ec->parent;
- }
- if (check_ancestor) return;
-
- if ((!starting) && (!ec->focused))
- {
- if ((ec->iconic) && (!ec->exp_iconify.by_client))
- e_mod_pol_wl_iconify_state_change_send(ec, 0);
-
- e_client_activate(ec, EINA_TRUE);
- }
-
- e_mod_pol_stack_below(ec, below_ec);
-
- if (!e_client_first_mapped_get(ec))
- e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_FALSE);
-}
-
-static void
-_tzpol_iface_cb_raise(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- ELOGF("TZPOL", "RAISE", ec->pixmap, ec);
-
- evas_object_raise(ec->frame);
-
- if (!e_client_first_mapped_get(ec))
- e_client_post_raise_lower_set(ec, EINA_TRUE, EINA_FALSE);
-}
-
-static void
-_tzpol_iface_cb_lower(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
-{
- E_Client *ec, *below = NULL;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- ELOGF("TZPOL", "LOWER", ec->pixmap, ec);
-
- below = ec;
- while ((below = e_client_below_get(below)))
- {
- if ((e_client_util_ignored_get(below)) ||
- (below->iconic))
- continue;
-
- break;
- }
-
- evas_object_lower(ec->frame);
-
- if (!e_client_first_mapped_get(ec))
- e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_TRUE);
-
- if ((!below) || (!ec->focused)) return;
-
- evas_object_focus_set(below->frame, 1);
-}
-
-static void
-_tzpol_iface_cb_lower_by_res_id(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t res_id)
-{
- E_Client *ec, *below = NULL;
-
- ELOGF("TZPOL",
- "LOWER_RES|res_tzpol:0x%08x|res_id:%d",
- NULL, NULL, (unsigned int)res_tzpol, res_id);
-
- ec = e_pixmap_find_client_by_res_id(res_id);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- below = ec;
- while ((below = e_client_below_get(below)))
- {
- if ((e_client_util_ignored_get(below)) ||
- (below->iconic))
- continue;
-
- break;
- }
-
- evas_object_lower(ec->frame);
-
- if (!e_client_first_mapped_get(ec))
- e_client_post_raise_lower_set(ec, EINA_FALSE, EINA_TRUE);
-
- if ((!below) || (!ec->focused)) return;
-
- if ((below->icccm.accepts_focus) ||(below->icccm.take_focus))
- evas_object_focus_set(below->frame, 1);
-}
-
-// --------------------------------------------------------
-// focus
-// --------------------------------------------------------
-static void
-_tzpol_iface_cb_focus_skip_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- if (ec->icccm.accepts_focus)
- {
- ec->icccm.accepts_focus = ec->icccm.take_focus = 0;
- EC_CHANGED(ec);
- }
-}
-
-static void
-_tzpol_iface_cb_focus_skip_unset(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- if (!ec->icccm.accepts_focus)
- {
- ec->icccm.accepts_focus = ec->icccm.take_focus = 1;
- EC_CHANGED(ec);
- }
-}
-
-// --------------------------------------------------------
-// role
-// --------------------------------------------------------
-static void
-_tzpol_iface_cb_role_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf, const char *role)
-{
- E_Client *ec;
-
- EINA_SAFETY_ON_NULL_RETURN(role);
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- eina_stringshare_replace(&ec->icccm.window_role, role);
-
- /* TODO: support multiple roles */
- if (!e_util_strcmp("notification-low", role))
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NOTIFICATION_LOW);
- }
- else if (!e_util_strcmp("notification-normal", role))
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NOTIFICATION_NORMAL);
- }
- else if (!e_util_strcmp("notification-high", role))
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NOTIFICATION_HIGH);
- }
- else if (!e_util_strcmp("alert", role))
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ALERT);
- }
- else if (!e_util_strcmp("tv-volume-popup", role))
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NOTIFICATION_LOW);
- ec->lock_client_location = 1;
- }
- else if (!e_util_strcmp("e_demo", role))
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NOTIFICATION_HIGH);
- ec->lock_client_location = 1;
- }
- else if (!e_util_strcmp("cbhm", role))
- {
- if (!ec->comp_data) return;
- e_comp_wl->selection.cbhm = ec->comp_data->surface;
- }
-}
-
-static void
-_tzpol_iface_cb_type_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf, uint32_t type)
-{
- E_Client *ec;
- E_Window_Type win_type;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- switch (type)
- {
- /* TODO: support other types */
- case TIZEN_POLICY_WIN_TYPE_NOTIFICATION:
- win_type = E_WINDOW_TYPE_NOTIFICATION;
- break;
-
- case TIZEN_POLICY_WIN_TYPE_UTILITY:
- win_type = E_WINDOW_TYPE_UTILITY;
- break;
-
- default: return;
- }
-
- ELOGF("TZPOL",
- "TYPE_SET |win:0x%08x|s:0x%08x|res_tzpol:0x%08x|tizen_win_type:%d, e_win_type:%d",
- ec->pixmap, ec,
- (unsigned int)e_client_util_win_get(ec),
- (unsigned int)surf,
- (unsigned int)res_tzpol,
- type, win_type);
-
- ec->netwm.type = win_type;
-
- EC_CHANGED(ec);
-}
-// --------------------------------------------------------
-// conformant
-// --------------------------------------------------------
-static void
-_tzpol_iface_cb_conformant_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- e_mod_conformant_client_add(ec, res_tzpol);
-}
-
-static void
-_tzpol_iface_cb_conformant_unset(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- e_mod_conformant_client_del(ec);
-}
-
-static void
-_tzpol_iface_cb_conformant_get(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- tizen_policy_send_conformant(res_tzpol, surf, e_mod_conformant_client_check(ec));
-}
-
-// --------------------------------------------------------
-// notification level
-// --------------------------------------------------------
-#define SMACK_LABEL_LEN 255
-#define PATH_MAX_LEN 64
-
-static void
-_pol_wl_smack_label_direct_read(int pid, char **client)
-{
- int ret;
- int fd = -1;
- char smack_label[SMACK_LABEL_LEN +1];
- char path[PATH_MAX_LEN + 1];
-
- bzero(smack_label, SMACK_LABEL_LEN + 1);
- bzero(path, PATH_MAX_LEN + 1);
- snprintf(path, PATH_MAX_LEN, "/proc/%d/attr/current", pid);
- fd = open(path, O_RDONLY);
- if (fd == -1) return;
-
- ret = read(fd, smack_label, SMACK_LABEL_LEN);
- close(fd);
- if (ret < 0) return;
-
- *client = calloc(SMACK_LABEL_LEN + 1, sizeof(char));
- strncpy(*client, smack_label, SMACK_LABEL_LEN + 1);
-}
-
-static Eina_Bool
-_pol_wl_privilege_check(int fd, const char *privilege)
-{
-#ifdef ENABLE_CYNARA
- char *client = NULL, *user = NULL, *client_session = NULL;
- pid_t pid = 0;
- int ret = -1;
- Eina_Bool res = EINA_FALSE;
-
- if ((!polwl->p_cynara))
- {
- ELOGF("TZPOL",
- "Cynara is not initialized. DENY all requests", NULL, NULL);
- return EINA_FALSE;
- }
-
- ret = cynara_creds_socket_get_user(fd, USER_METHOD_DEFAULT, &user);
- if (ret != CYNARA_API_SUCCESS) goto cynara_finished;
-
- ret = cynara_creds_socket_get_pid(fd, &pid);
- if (ret != CYNARA_API_SUCCESS) goto cynara_finished;
-
- client_session = cynara_session_from_pid(pid);
- if (!client_session) goto cynara_finished;
-
- /* Temporary fix for mis matching socket smack label
- * ret = cynara_creds_socket_get_client(fd, CLIENT_METHOD_DEFAULT, &client);
- * if (ret != CYNARA_API_SUCCESS) goto cynara_finished;
- */
- _pol_wl_smack_label_direct_read(pid, &client);
- if (!client) goto cynara_finished;
-
- ret = cynara_check(polwl->p_cynara,
- client,
- client_session,
- user,
- privilege);
-
- if (ret == CYNARA_API_ACCESS_ALLOWED)
- res = EINA_TRUE;
-
-cynara_finished:
- ELOGF("TZPOL",
- "Privilege Check For %s %s fd:%d client:%s user:%s pid:%u client_session:%s ret:%d",
- NULL, NULL,
- privilege, res?"SUCCESS":"FAIL",
- fd, client?:"N/A", user?:"N/A", pid, client_session?:"N/A", ret);
-
- if (client_session) free(client_session);
- if (user) free(user);
- if (client) free(client);
-
- return res;
-#else
- (void)ec;
- return EINA_TRUE;
-#endif
-}
-
-static void
-_tzpol_notilv_set(E_Client *ec, int lv)
-{
- short ly;
-
- switch (lv)
- {
- case 0: ly = E_LAYER_CLIENT_NOTIFICATION_LOW; break;
- case 1: ly = E_LAYER_CLIENT_NOTIFICATION_NORMAL; break;
- case 2: ly = E_LAYER_CLIENT_NOTIFICATION_TOP; break;
- case -1: ly = E_LAYER_CLIENT_NORMAL; break;
- case 10: ly = E_LAYER_CLIENT_NOTIFICATION_LOW; break;
- case 20: ly = E_LAYER_CLIENT_NOTIFICATION_NORMAL; break;
- case 30: ly = E_LAYER_CLIENT_NOTIFICATION_HIGH; break;
- case 40: ly = E_LAYER_CLIENT_NOTIFICATION_TOP; break;
- default: ly = E_LAYER_CLIENT_NOTIFICATION_LOW; break;
- }
-
- if (ly != evas_object_layer_get(ec->frame))
- {
- evas_object_layer_set(ec->frame, ly);
- }
-
- ec->layer = ly;
-}
-
-static void
-_tzpol_iface_cb_notilv_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t lv)
-{
- E_Client *ec;
- Pol_Wl_Surface *psurf;
- int fd;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- psurf = _pol_wl_surf_add(ec, res_tzpol);
- EINA_SAFETY_ON_NULL_RETURN(psurf);
-
- fd = wl_client_get_fd(client);
- if (!_pol_wl_privilege_check(fd, PRIVILEGE_NOTIFICATION_LEVEL_SET))
- {
- ELOGF("TZPOL",
- "Privilege Check Failed! DENY set_notification_level",
- ec->pixmap, ec);
-
- tizen_policy_send_notification_done
- (res_tzpol,
- surf,
- -1,
- TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED);
- return;
- }
-
- ELOGF("TZPOL", "NOTI_LEVEL|level:%d", ec->pixmap, ec, lv);
- _tzpol_notilv_set(ec, lv);
-
- psurf->notilv = lv;
-
- tizen_policy_send_notification_done
- (res_tzpol, surf, lv, TIZEN_POLICY_ERROR_STATE_NONE);
-
- if (e_mod_pol_client_is_lockscreen(ec))
- e_mod_pol_stack_clients_restack_above_lockscreen(ec, EINA_TRUE);
-}
-
-void
-e_mod_pol_wl_notification_level_fetch(E_Client *ec)
-{
- E_Pixmap *cp;
- Pol_Wl_Surface *psurf;
- Pol_Wl_Tzpol *tzpol;
- Eina_Iterator *it;
- Eina_List *l;
- Eina_Bool changed_stack = EINA_FALSE;
-
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- cp = ec->pixmap;
- EINA_SAFETY_ON_NULL_RETURN(cp);
-
- // TODO: use pending_notilv_list instead of loop
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- EINA_LIST_FOREACH(tzpol->psurfs, l, psurf)
- {
- if (psurf->cp != cp) continue;
- if (!psurf->pending_notilv) continue;
-
- psurf->pending_notilv = EINA_FALSE;
- _tzpol_notilv_set(ec, psurf->notilv);
- changed_stack = EINA_TRUE;
- }
- eina_iterator_free(it);
-
- if (changed_stack &&
- e_mod_pol_client_is_lockscreen(ec))
- {
- e_mod_pol_stack_clients_restack_above_lockscreen(ec, EINA_TRUE);
- }
-}
-
-// --------------------------------------------------------
-// transient for
-// --------------------------------------------------------
-static void
-_pol_wl_parent_surf_set(E_Client *ec, struct wl_resource *parent_surf)
-{
- E_Client *pc = NULL;
-
- if (parent_surf)
- {
- if (!(pc = wl_resource_get_user_data(parent_surf)))
- {
- ERR("Could not get parent res e_client");
- return;
- }
- }
-
- e_mod_pol_stack_transient_for_set(ec, pc);
-}
-
-static void
-_tzpol_iface_cb_transient_for_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t child_id, uint32_t parent_id)
-{
- E_Client *ec, *pc;
- struct wl_resource *parent_surf;
-
- ELOGF("TZPOL",
- "TF_SET |res_tzpol:0x%08x|parent:%d|child:%d",
- NULL, NULL, (unsigned int)res_tzpol, parent_id, child_id);
-
- ec = e_pixmap_find_client_by_res_id(child_id);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- pc = e_pixmap_find_client_by_res_id(parent_id);
- EINA_SAFETY_ON_NULL_RETURN(pc);
- EINA_SAFETY_ON_NULL_RETURN(pc->comp_data);
-
- parent_surf = pc->comp_data->surface;
-
- _pol_wl_parent_surf_set(ec, parent_surf);
-
- ELOGF("TZPOL",
- " |win:0x%08x|parent|s:0x%08x",
- pc->pixmap, pc,
- (unsigned int)e_client_util_win_get(pc),
- (unsigned int)parent_surf);
-
- ELOGF("TZPOL",
- " |win:0x%08x|child |s:0x%08x",
- ec->pixmap, ec,
- (unsigned int)e_client_util_win_get(ec),
- (unsigned int)(ec->comp_data ? ec->comp_data->surface : NULL));
-
- tizen_policy_send_transient_for_done(res_tzpol, child_id);
-
- EC_CHANGED(ec);
-}
-
-static void
-_tzpol_iface_cb_transient_for_unset(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t child_id)
-{
- E_Client *ec;
-
- ELOGF("TZPOL",
- "TF_UNSET |res_tzpol:0x%08x|child:%d",
- NULL, NULL, (unsigned int)res_tzpol, child_id);
-
- ec = e_pixmap_find_client_by_res_id(child_id);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- _pol_wl_parent_surf_set(ec, NULL);
-
- tizen_policy_send_transient_for_done(res_tzpol, child_id);
-
- EC_CHANGED(ec);
-}
-
-// --------------------------------------------------------
-// window screen mode
-// --------------------------------------------------------
-static void
-_tzpol_iface_cb_win_scrmode_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf, uint32_t mode)
-{
- E_Client *ec;
- int fd;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- fd = wl_client_get_fd(client);
- if (!_pol_wl_privilege_check(fd, PRIVILEGE_SCREEN_MODE_SET))
- {
- ELOGF("TZPOL",
- "Privilege Check Failed! DENY set_screen_mode",
- ec->pixmap, ec);
-
- tizen_policy_send_window_screen_mode_done
- (res_tzpol,
- surf,
- -1,
- TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED);
- return;
- }
-
- ELOGF("TZPOL", "SCR_MODE |mode:%d", ec->pixmap, ec, mode);
-
- e_mod_pol_display_screen_mode_set(ec, mode);
- e_mod_pol_wl_win_scrmode_apply();
-
- tizen_policy_send_window_screen_mode_done
- (res_tzpol, surf, mode, TIZEN_POLICY_ERROR_STATE_NONE);
-}
-
-void
-e_mod_pol_wl_win_scrmode_apply(void)
-{
- e_mod_pol_display_screen_mode_apply();
-}
-
-// --------------------------------------------------------
-// subsurface
-// --------------------------------------------------------
-static void
-_tzpol_iface_cb_subsurf_place_below_parent(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *subsurf)
-{
- E_Client *ec;
- E_Client *epc;
- E_Comp_Wl_Subsurf_Data *sdata;
-
- ec = wl_resource_get_user_data(subsurf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
-
- sdata = ec->comp_data->sub.data;
- EINA_SAFETY_ON_NULL_RETURN(sdata);
-
- epc = sdata->parent;
- EINA_SAFETY_ON_NULL_RETURN(epc);
-
- /* check if a subsurface has already placed below a parent */
- if (eina_list_data_find(epc->comp_data->sub.below_list, ec)) return;
-
- epc->comp_data->sub.list = eina_list_remove(epc->comp_data->sub.list, ec);
- epc->comp_data->sub.list_pending = eina_list_remove(epc->comp_data->sub.list_pending, ec);
- epc->comp_data->sub.below_list = eina_list_append(epc->comp_data->sub.below_list, ec);
- epc->comp_data->sub.list_changed = EINA_TRUE;
-}
-
-static void
-_tzpol_iface_cb_subsurf_stand_alone_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *subsurf)
-{
- E_Client *ec;
- E_Comp_Wl_Subsurf_Data *sdata;
-
- ec = wl_resource_get_user_data(subsurf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
-
- sdata = ec->comp_data->sub.data;
- EINA_SAFETY_ON_NULL_RETURN(sdata);
-
- sdata->stand_alone = EINA_TRUE;
-}
-
-static void
-_tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface, uint32_t parent_id)
-{
- E_Client *ec, *epc;
-
- ELOGF("TZPOL",
- "SUBSURF |wl_surface@%d|parent_id:%d",
- NULL, NULL, wl_resource_get_id(surface), parent_id);
-
- ec = wl_resource_get_user_data(surface);
- if (!ec)
- {
- wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
- "tizen_policy failed: wrong wl_surface@%d resource",
- wl_resource_get_id(surface));
- return;
- }
-
- if (e_object_is_del(E_OBJECT(ec))) return;
-
- epc = e_pixmap_find_client_by_res_id(parent_id);
- if (!epc)
- {
- wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
- "tizen_policy failed: wrong parent_id(%d)", parent_id);
- return;
- }
-
- if (e_object_is_del(E_OBJECT(epc))) return;
-
- /* check if this surface is already a sub-surface */
- if ((ec->comp_data) && (ec->comp_data->sub.data))
- {
- wl_resource_post_error(resource,
- WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE,
- "wl_surface@%d is already a sub-surface",
- wl_resource_get_id(surface));
- return;
- }
-
- /* try to create a new subsurface */
- if (!e_comp_wl_subsurface_create(ec, epc, id, surface))
- ERR("Failed to create subsurface for surface@%d",
- wl_resource_get_id(surface));
-
- /* ec's parent comes from another process */
- if (ec->comp_data)
- ec->comp_data->has_extern_parent = EINA_TRUE;
-}
-
-static void
-_tzpol_iface_cb_opaque_state_set(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface, int32_t state)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surface);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- ELOGF("TZPOL", "OPAQUE |opaque_state:%d", ec->pixmap, ec, state);
- ec->visibility.opaque = state;
-}
-
-// --------------------------------------------------------
-// iconify
-// --------------------------------------------------------
-static void
-_tzpol_iface_cb_iconify(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- ELOG("Set ICONIFY BY CLIENT", ec->pixmap, ec);
- ec->exp_iconify.by_client = 1;
- e_client_iconify(ec);
-
- EC_CHANGED(ec);
-}
-
-static void
-_tzpol_iface_cb_uniconify(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- if ((ec->iconic) && (!ec->exp_iconify.by_client))
- e_mod_pol_wl_iconify_state_change_send(ec, 0);
-
- ELOG("Un-Set ICONIFY BY CLIENT", ec->pixmap, ec);
- ec->exp_iconify.by_client = 0;
- e_client_uniconify(ec);
-
- EC_CHANGED(ec);
-}
-
-static void
-_pol_wl_allowed_aux_hint_send(E_Client *ec, int id)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
- Eina_List *l;
- Eina_Iterator *it;
-
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- EINA_LIST_FOREACH(tzpol->psurfs, l, psurf)
- {
- if (e_pixmap_client_get(psurf->cp) != ec) continue;
- tizen_policy_send_allowed_aux_hint
- (tzpol->res_tzpol,
- psurf->surf,
- id);
- ELOGF("TZPOL",
- "SEND |res_tzpol:0x%08x|allowed hint->id:%d",
- ec->pixmap, ec,
- (unsigned int)tzpol->res_tzpol,
- id);
- }
- eina_iterator_free(it);
-}
-
-static void
-_pol_wl_aux_hint_apply(E_Client *ec)
-{
- E_Comp_Wl_Aux_Hint *hint;
- Eina_List *l;
- Eina_Bool send;
-
- if (!ec->comp_data) return;
- if (!ec->comp_data->aux_hint.changed) return;
-
- EINA_LIST_FOREACH(ec->comp_data->aux_hint.hints, l, hint)
- {
- if (!hint->changed) continue;
-
- send = EINA_FALSE;
- if (!strcmp(hint->hint, hint_names[WM_POLICY_HINT_USER_GEOMETRY]))
- {
- if (hint->deleted)
- {
- e_mod_pol_allow_user_geometry_set(ec, EINA_FALSE);
- continue;
- }
-
- if (!strcmp(hint->val, "1"))
- {
- send = EINA_TRUE;
- e_mod_pol_allow_user_geometry_set(ec, EINA_TRUE);
- }
- else if (strcmp(hint->val, "1"))
- {
- send = EINA_TRUE;
- e_mod_pol_allow_user_geometry_set(ec, EINA_FALSE);
- }
- }
- else if (!strcmp(hint->hint, hint_names[WM_POLICY_HINT_FIXED_RESIZE]))
- {
- /* TODO: support other aux_hints */
- }
- else if (!strcmp(hint->hint, hint_names[WM_POLICY_HINT_DEICONIFY_APPROVE_DISABLE]))
- {
- /* TODO: would implement after deiconify approve protocol provided */
- }
- else if (!strcmp(hint->hint, hint_names[WM_POLICY_HINT_GESTURE_DISABLE]))
- {
- if (hint->deleted)
- {
- ec->gesture_disable = EINA_FALSE;
- continue;
- }
-
- if (atoi(hint->val) == 1)
- {
- ec->gesture_disable = EINA_TRUE;
- }
- else
- {
- ec->gesture_disable = EINA_FALSE;
- }
- }
- else if (!strcmp(hint->hint, hint_names[WM_POLICY_HINT_ICONIFY]))
- {
- if (hint->deleted)
- {
- ec->exp_iconify.skip_iconify = 0;
- EC_CHANGED(ec);
- continue;
- }
-
- if (!strcmp(hint->val, "disable"))
- {
- ec->exp_iconify.skip_iconify = 1;
- EC_CHANGED(ec);
- }
- else if (!strcmp(hint->val, "enable"))
- {
- ec->exp_iconify.skip_iconify = 0;
- EC_CHANGED(ec);
- }
- }
- else if (!strcmp(hint->hint, hint_names[WM_POLICY_HINT_ABOVE_LOCKSCREEN]))
- {
- if ((hint->deleted) ||
- (!strcmp(hint->val, "0")))
- {
- E_Layer original_layer = ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved_layer;
- if (ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].set &&
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved)
- {
- // restore original layer
- if (original_layer != evas_object_layer_get(ec->frame))
- {
- evas_object_layer_set(ec->frame, original_layer);
- ec->layer = original_layer;
- }
- }
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].set = 0;
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved = 0;
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved_layer = 0;
- EC_CHANGED(ec);
- }
- else if (!strcmp(hint->val, "1"))
- {
- if (!ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved)
- {
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].set = 1;
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved = 0;
- ec->changable_layer[E_CHANGABLE_LAYER_TYPE_ABOVE_NOTIFICATION].saved_layer = ec->layer;
- EC_CHANGED(ec);
- }
- }
- }
- else if (!strcmp(hint->hint, hint_names[WM_POLICY_HINT_EFFECT_DISABLE]))
- {
- if ((hint->deleted) ||
- (!strcmp(hint->val, "0")))
- {
- ec->animatable = 1;
- }
- else if (!strcmp(hint->val, "1"))
- {
- ec->animatable = 0;
- }
- }
-
- if (send)
- _pol_wl_allowed_aux_hint_send(ec, hint->id);
- }
-}
-
-void
-e_mod_pol_wl_eval_pre_post_fetch(E_Client *ec)
-{
- if (!ec) return;
-
- _pol_wl_aux_hint_apply(ec);
-}
-
-static void
-_tzpol_iface_cb_aux_hint_add(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id, const char *name, const char *value)
-{
- E_Client *ec;
- Eina_Bool res = EINA_FALSE;
-
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- res = e_hints_aux_hint_add(ec, id, name, value);
-
- ELOGF("TZPOL", "HINT_ADD |res_tzpol:0x%08x|id:%d, name:%s, val:%s, res:%d", ec->pixmap, ec, (unsigned int)res_tzpol, id, name, value, res);
-
- if (res)
- {
- _pol_wl_aux_hint_apply(ec);
- tizen_policy_send_allowed_aux_hint(res_tzpol, surf, id);
- EC_CHANGED(ec);
- }
-}
-
-static void
-_tzpol_iface_cb_aux_hint_change(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id, const char *value)
-{
- E_Client *ec;
- Eina_Bool res = EINA_FALSE;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- res = e_hints_aux_hint_change(ec, id, value);
-
- ELOGF("TZPOL", "HINT_CHD |res_tzpol:0x%08x|id:%d, val:%s, result:%d", ec->pixmap, ec, (unsigned int)res_tzpol, id, value, res);
-
- if (res)
- {
- _pol_wl_aux_hint_apply(ec);
- tizen_policy_send_allowed_aux_hint(res_tzpol, surf, id);
- EC_CHANGED(ec);
- }
-}
-
-static void
-_tzpol_iface_cb_aux_hint_del(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id)
-{
- E_Client *ec;
- unsigned int res = -1;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- res = e_hints_aux_hint_del(ec, id);
- ELOGF("TZPOL", "HINT_DEL |res_tzpol:0x%08x|id:%d, result:%d", ec->pixmap, ec, (unsigned int)res_tzpol, id, res);
-
- if (res)
- {
- _pol_wl_aux_hint_apply(ec);
- EC_CHANGED(ec);
- }
-}
-
-static void
-_tzpol_iface_cb_supported_aux_hints_get(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf)
-{
- E_Client *ec;
- const Eina_List *hints_list;
- const Eina_List *l;
- struct wl_array hints;
- const char *hint_name;
- int len;
- char *p;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- hints_list = e_hints_aux_hint_supported_get();
-
- wl_array_init(&hints);
- EINA_LIST_FOREACH(hints_list, l, hint_name)
- {
- len = strlen(hint_name) + 1;
- p = wl_array_add(&hints, len);
-
- if (p == NULL)
- break;
- strncpy(p, hint_name, len);
- }
-
- tizen_policy_send_supported_aux_hints(res_tzpol, surf, &hints, eina_list_count(hints_list));
- ELOGF("TZPOL",
- "SEND |res_tzpol:0x%08x|supported_hints size:%d",
- ec->pixmap, ec,
- (unsigned int)res_tzpol,
- eina_list_count(hints_list));
- wl_array_release(&hints);
-}
-
-static void
-e_client_background_state_set(E_Client *ec, Eina_Bool state)
-{
- if (!ec) return;
-
- ELOGF("TZPOL",
- "BACKGROUND STATE %s for PID(%u)",
- ec->pixmap, ec,
- state?"SET":"UNSET", ec->netwm.pid);
-
- if (state)
- {
- ec->comp_data->mapped = EINA_TRUE;
- evas_object_hide(ec->frame);
- EC_CHANGED(ec);
- }
- else
- {
- ec->comp_data->mapped = EINA_FALSE;
- if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.map))
- ec->comp_data->shell.map(ec->comp_data->shell.surface);
- evas_object_show(ec->frame);
- e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
- }
-}
-
-static void
-_pol_wl_background_state_set(Pol_Wl_Surface *psurf, Eina_Bool state)
-{
- if (state)
- {
- if (psurf->ec)
- e_client_background_state_set(psurf->ec, EINA_TRUE);
- else
- {
- ELOGF("TZPOL",
- "PENDING BACKGROUND STATE SET for PID(%u) psurf:%p tzpol:%p",
- NULL, NULL, psurf->pid, psurf, psurf->tzpol);
-
- if (!eina_list_data_find(psurf->tzpol->pending_bg, psurf))
- psurf->tzpol->pending_bg =
- eina_list_append(psurf->tzpol->pending_bg, psurf);
- }
- }
- else
- {
- if (psurf->ec)
- e_client_background_state_set(psurf->ec, EINA_FALSE);
- else
- {
- ELOGF("TZPOL",
- "UNSET PENDING BACKGROUND STATE for PID(%u) psurf:%p tzpol:%p",
- NULL, NULL, psurf->pid, psurf, psurf->tzpol);
-
- if (eina_list_data_find(psurf->tzpol->pending_bg, psurf))
- psurf->tzpol->pending_bg =
- eina_list_remove(psurf->tzpol->pending_bg, psurf);
- }
- }
-}
-
-static void
-_tzpol_iface_cb_background_state_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t pid)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
- Eina_List *psurfs = NULL, *clients = NULL;
- E_Client *ec;
-
- tzpol = _pol_wl_tzpol_get(res_tzpol);
- EINA_SAFETY_ON_NULL_RETURN(tzpol);
-
- if ((psurfs = _pol_wl_tzpol_surf_find_by_pid(tzpol, pid)))
- {
- EINA_LIST_FREE(psurfs, psurf)
- {
- if (psurf->is_background) continue;
-
- _pol_wl_background_state_set(psurf, EINA_TRUE);
- }
-
- return;
- }
-
- clients = _pol_wl_e_clients_find_by_pid(pid);
-
- if (clients)
- {
- EINA_LIST_FREE(clients, ec)
- {
- psurf = _pol_wl_surf_add(ec, res_tzpol);
-
- ELOGF("TZPOL",
- "Register PID(%u) for BACKGROUND STATE psurf:%p tzpol:%p",
- ec->pixmap, ec, pid, psurf, psurf ? psurf->tzpol : NULL);
- }
- }
- else
- {
- psurf = E_NEW(Pol_Wl_Surface, 1);
- EINA_SAFETY_ON_NULL_RETURN(psurf);
-
- psurf->tzpol = tzpol;
- psurf->pid = pid;
- psurf->ec = NULL;
-
- tzpol->psurfs = eina_list_append(tzpol->psurfs, psurf);
-
- ELOGF("TZPOL",
- "Register PID(%u) for BACKGROUND STATE psurf:%p tzpol:%p",
- NULL, NULL, pid, psurf, psurf->tzpol);
- }
-
- psurf->is_background = EINA_TRUE;
- _pol_wl_background_state_set(psurf, EINA_TRUE);
-}
-
-static void
-_tzpol_iface_cb_background_state_unset(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t pid)
-{
- Pol_Wl_Surface *psurf = NULL;
- Pol_Wl_Tzpol *tzpol;
- Eina_List *psurfs = NULL;
-
- tzpol = _pol_wl_tzpol_get(res_tzpol);
- EINA_SAFETY_ON_NULL_RETURN(tzpol);
-
- if ((psurfs = _pol_wl_tzpol_surf_find_by_pid(tzpol, pid)))
- {
- EINA_LIST_FREE(psurfs, psurf)
- {
- if (!psurf->is_background) continue;
- psurf->is_background = EINA_FALSE;
- _pol_wl_background_state_set(psurf, EINA_FALSE);
- }
- return;
- }
-}
-
-static void
-_pol_wl_floating_mode_apply(E_Client *ec, Eina_Bool floating)
-{
- if (ec->floating == floating) return;
-
- ec->floating = floating;
-
- if (ec->frame)
- {
- if (floating)
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
- else
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
- }
-
- EC_CHANGED(ec);
-}
-
-static void
-_tzpol_iface_cb_floating_mode_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- ELOGF("TZPOL", "FLOATING Set", ec->pixmap, ec);
-
- _pol_wl_floating_mode_apply(ec, EINA_TRUE);
-}
-
-static void
-_tzpol_iface_cb_floating_mode_unset(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- ELOGF("TZPOL", "FLOATING Unset", ec->pixmap, ec);
-
- _pol_wl_floating_mode_apply(ec, EINA_FALSE);
-}
-
-static void
-_tzpol_iface_cb_stack_mode_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, struct wl_resource *surf, uint32_t mode)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- ELOGF("TZPOL", "STACK Mode Set. mode:%d", ec->pixmap, ec, mode);
-
- if (ec->frame)
- {
- if (mode == TIZEN_POLICY_STACK_MODE_ABOVE)
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_ABOVE);
- }
- else if (mode == TIZEN_POLICY_STACK_MODE_BELOW)
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_BELOW);
- }
- else
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NORMAL);
- }
- EC_CHANGED(ec);
- }
-}
-
-// --------------------------------------------------------
-// Pol_Wl_Tz_Dpy_Pol
-// --------------------------------------------------------
-static Pol_Wl_Tz_Dpy_Pol *
-_pol_wl_tz_dpy_pol_add(struct wl_resource *res_tz_dpy_pol)
-{
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol;
-
- tz_dpy_pol = E_NEW(Pol_Wl_Tz_Dpy_Pol, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tz_dpy_pol, NULL);
-
- tz_dpy_pol->res_tz_dpy_pol = res_tz_dpy_pol;
-
- polwl->tz_dpy_pols = eina_list_append(polwl->tz_dpy_pols, tz_dpy_pol);
-
- return tz_dpy_pol;
-}
-
-static void
-_pol_wl_tz_dpy_pol_del(Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol)
-{
- Pol_Wl_Dpy_Surface *dpy_surf;
-
- EINA_SAFETY_ON_NULL_RETURN(tz_dpy_pol);
-
- polwl->tz_dpy_pols = eina_list_remove(polwl->tz_dpy_pols, tz_dpy_pol);
-
- EINA_LIST_FREE(tz_dpy_pol->dpy_surfs, dpy_surf)
- {
- E_FREE(dpy_surf);
- }
-
- E_FREE(tz_dpy_pol);
-}
-
-static Pol_Wl_Tz_Dpy_Pol *
-_pol_wl_tz_dpy_pol_get(struct wl_resource *res_tz_dpy_pol)
-{
- Eina_List *l;
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol;
-
- EINA_LIST_FOREACH(polwl->tz_dpy_pols, l, tz_dpy_pol)
- {
- if (tz_dpy_pol->res_tz_dpy_pol == res_tz_dpy_pol)
- return tz_dpy_pol;
- }
-
- return NULL;
-}
-
-// --------------------------------------------------------
-// Pol_Wl_Dpy_Surface
-// --------------------------------------------------------
-static Pol_Wl_Dpy_Surface *
-_pol_wl_dpy_surf_find(Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol, E_Client *ec)
-{
- Eina_List *l;
- Pol_Wl_Dpy_Surface *dpy_surf;
-
- EINA_LIST_FOREACH(tz_dpy_pol->dpy_surfs, l, dpy_surf)
- {
- if (dpy_surf->ec == ec)
- return dpy_surf;
- }
-
- return NULL;
-}
-
-static Pol_Wl_Dpy_Surface *
-_pol_wl_dpy_surf_add(E_Client *ec, struct wl_resource *res_tz_dpy_pol)
-{
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol = NULL;
- Pol_Wl_Dpy_Surface *dpy_surf = NULL;
-
- tz_dpy_pol = _pol_wl_tz_dpy_pol_get(res_tz_dpy_pol);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tz_dpy_pol, NULL);
-
- dpy_surf = _pol_wl_dpy_surf_find(tz_dpy_pol, ec);
- if (dpy_surf)
- return dpy_surf;
-
- dpy_surf = E_NEW(Pol_Wl_Dpy_Surface, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(dpy_surf, NULL);
-
- dpy_surf->surf = ec->comp_data->surface;
- dpy_surf->tz_dpy_pol = tz_dpy_pol;
- dpy_surf->ec = ec;
- dpy_surf->brightness = -1;
-
- tz_dpy_pol->dpy_surfs = eina_list_append(tz_dpy_pol->dpy_surfs, dpy_surf);
- return dpy_surf;
-}
-
-static void
-_pol_wl_dpy_surf_del(E_Client *ec)
-{
- Eina_List *l;
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol;
- Pol_Wl_Dpy_Surface *dpy_surf;
-
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- EINA_LIST_FOREACH(polwl->tz_dpy_pols, l, tz_dpy_pol)
- {
- dpy_surf = _pol_wl_dpy_surf_find(tz_dpy_pol, ec);
- if (dpy_surf)
- {
- tz_dpy_pol->dpy_surfs = eina_list_remove(tz_dpy_pol->dpy_surfs, dpy_surf);
- E_FREE(dpy_surf);
- }
- }
-}
-
-// --------------------------------------------------------
-// brightness
-// --------------------------------------------------------
-static Eina_Bool
-_e_mod_system_brightness_get(int *brightness)
-{
- int error;
- int sys_brightness = -1;
-
- if (!brightness) return EINA_FALSE;
-
- error = device_display_get_brightness(0, &sys_brightness);
- if (error != DEVICE_ERROR_NONE)
- {
- // error
- return EINA_FALSE;
- }
-
- *brightness = sys_brightness;
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_e_mod_system_brightness_set(int brightness)
-{
- Eina_Bool ret;
- int error;
- int num_of_dpy;
- int id;
-
- ret = EINA_TRUE;
-
- error = device_display_get_numbers(&num_of_dpy);
- if (error != DEVICE_ERROR_NONE)
- {
- // error
- return EINA_FALSE;
- }
-
- for (id = 0; id < num_of_dpy; id++)
- {
- error = device_display_set_brightness(id, brightness);
- if (error != DEVICE_ERROR_NONE)
- {
- // error
- ret = EINA_FALSE;
- break;
- }
- }
-
- return ret;
-}
-
-static Eina_Bool
-_e_mod_pol_change_system_brightness(int new_brightness)
-{
- Eina_Bool ret;
- int sys_brightness;
-
- if (!g_system_info.brightness.use_client)
- {
- // save system brightness
- ret = _e_mod_system_brightness_get(&sys_brightness);
- if (!ret)
- {
- return EINA_FALSE;
- }
- g_system_info.brightness.system = sys_brightness;
- }
-
- ret = _e_mod_system_brightness_set(new_brightness);
- if (!ret)
- {
- return EINA_FALSE;
- }
- g_system_info.brightness.client = new_brightness;
- g_system_info.brightness.use_client = EINA_TRUE;
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_e_mod_pol_restore_system_brightness(void)
-{
- Eina_Bool ret;
-
- if (!g_system_info.brightness.use_client) return EINA_TRUE;
-
- // restore system brightness
- ret = _e_mod_system_brightness_set(g_system_info.brightness.system);
- if (!ret)
- {
- return EINA_FALSE;
- }
- g_system_info.brightness.use_client = EINA_FALSE;
-
- // Todo:
- // if there are another window which set brighteness, then we change brighteness of it
- // if no, then we rollback system brightness
-
- return EINA_TRUE;
-}
-
-Eina_Bool
-e_mod_pol_wl_win_brightness_apply(E_Client *ec)
-{
- Eina_Bool ret;
- Eina_List *l;
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol;
- Pol_Wl_Dpy_Surface *dpy_surf = NULL;
- int ec_visibility;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- if (e_object_is_del(E_OBJECT(ec)))
- ec_visibility = E_VISIBILITY_FULLY_OBSCURED;
- else
- ec_visibility = ec->visibility.obscured;
-
- EINA_LIST_FOREACH(polwl->tz_dpy_pols, l, tz_dpy_pol)
- {
- dpy_surf = _pol_wl_dpy_surf_find(tz_dpy_pol, ec);
- if (dpy_surf)
- break;
- }
-
- if (!dpy_surf) return EINA_FALSE;
- if (!dpy_surf->set) return EINA_FALSE;
-
- // use system brightness
- if (dpy_surf->brightness < 0)
- {
- ELOGF("TZ_DPY_POL", "Restore system brightness. Win(0x%08x)'s brightness:%d", ec->pixmap, ec, e_client_util_win_get(ec), dpy_surf->brightness);
- ret = _e_mod_pol_restore_system_brightness();
- return ret;
- }
-
- if (ec_visibility == E_VISIBILITY_UNOBSCURED)
- {
- ELOGF("TZ_DPY_POL", "Change system brightness(%d). Win(0x%08x) is un-obscured", ec->pixmap, ec, dpy_surf->brightness, e_client_util_win_get(ec));
- ret = _e_mod_pol_change_system_brightness(dpy_surf->brightness);
- if (!ret) return EINA_FALSE;
- }
- else
- {
- ELOGF("TZ_DPY_POL", "Restore system brightness. Win(0x%08x) is obscured", ec->pixmap, ec, e_client_util_win_get(ec));
- ret = _e_mod_pol_restore_system_brightness();
- if (!ret) return EINA_FALSE;
- }
-
- return EINA_TRUE;
-}
-
-static void
-_tz_dpy_pol_iface_cb_brightness_set(struct wl_client *client, struct wl_resource *res_tz_dpy_pol, struct wl_resource *surf, int32_t brightness)
-{
- E_Client *ec;
- Pol_Wl_Dpy_Surface *dpy_surf;
- int fd;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- dpy_surf = _pol_wl_dpy_surf_add(ec, res_tz_dpy_pol);
- EINA_SAFETY_ON_NULL_RETURN(dpy_surf);
-
- fd = wl_client_get_fd(client);
- if (!_pol_wl_privilege_check(fd, PRIVILEGE_BRIGHTNESS_SET))
- {
- ELOGF("TZ_DPY_POL",
- "Privilege Check Failed! DENY set_brightness",
- ec->pixmap, ec);
-
- tizen_display_policy_send_window_brightness_done
- (res_tz_dpy_pol,
- surf,
- -1,
- TIZEN_DISPLAY_POLICY_ERROR_STATE_PERMISSION_DENIED);
- return;
- }
- ELOGF("TZ_DPY_POL", "Set Win(0x%08x)'s brightness:%d", ec->pixmap, ec, e_client_util_win_get(ec), brightness);
- dpy_surf->set = EINA_TRUE;
- dpy_surf->brightness = brightness;
-
- e_mod_pol_wl_win_brightness_apply(ec);
-
- tizen_display_policy_send_window_brightness_done
- (res_tz_dpy_pol, surf, brightness, TIZEN_DISPLAY_POLICY_ERROR_STATE_NONE);
-}
-
-// --------------------------------------------------------
-// tizen_policy_interface
-// --------------------------------------------------------
-static const struct tizen_policy_interface _tzpol_iface =
-{
- _tzpol_iface_cb_vis_get,
- _tzpol_iface_cb_pos_get,
- _tzpol_iface_cb_activate,
- _tzpol_iface_cb_activate_below_by_res_id,
- _tzpol_iface_cb_raise,
- _tzpol_iface_cb_lower,
- _tzpol_iface_cb_lower_by_res_id,
- _tzpol_iface_cb_focus_skip_set,
- _tzpol_iface_cb_focus_skip_unset,
- _tzpol_iface_cb_role_set,
- _tzpol_iface_cb_type_set,
- _tzpol_iface_cb_conformant_set,
- _tzpol_iface_cb_conformant_unset,
- _tzpol_iface_cb_conformant_get,
- _tzpol_iface_cb_notilv_set,
- _tzpol_iface_cb_transient_for_set,
- _tzpol_iface_cb_transient_for_unset,
- _tzpol_iface_cb_win_scrmode_set,
- _tzpol_iface_cb_subsurf_place_below_parent,
- _tzpol_iface_cb_subsurf_stand_alone_set,
- _tzpol_iface_cb_subsurface_get,
- _tzpol_iface_cb_opaque_state_set,
- _tzpol_iface_cb_iconify,
- _tzpol_iface_cb_uniconify,
- _tzpol_iface_cb_aux_hint_add,
- _tzpol_iface_cb_aux_hint_change,
- _tzpol_iface_cb_aux_hint_del,
- _tzpol_iface_cb_supported_aux_hints_get,
- _tzpol_iface_cb_background_state_set,
- _tzpol_iface_cb_background_state_unset,
- _tzpol_iface_cb_floating_mode_set,
- _tzpol_iface_cb_floating_mode_unset,
- _tzpol_iface_cb_stack_mode_set,
-};
-
-static void
-_tzpol_cb_unbind(struct wl_resource *res_tzpol)
-{
- Pol_Wl_Tzpol *tzpol;
-
- tzpol = _pol_wl_tzpol_get(res_tzpol);
- EINA_SAFETY_ON_NULL_RETURN(tzpol);
-
- eina_hash_del_by_key(polwl->tzpols, &res_tzpol);
-}
-
-static void
-_tzpol_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t ver, uint32_t id)
-{
- Pol_Wl_Tzpol *tzpol;
- struct wl_resource *res_tzpol;
-
- EINA_SAFETY_ON_NULL_GOTO(polwl, err);
-
- res_tzpol = wl_resource_create(client,
- &tizen_policy_interface,
- ver,
- id);
- EINA_SAFETY_ON_NULL_GOTO(res_tzpol, err);
-
- tzpol = _pol_wl_tzpol_add(res_tzpol);
- EINA_SAFETY_ON_NULL_GOTO(tzpol, err);
-
- wl_resource_set_implementation(res_tzpol,
- &_tzpol_iface,
- NULL,
- _tzpol_cb_unbind);
- return;
-
-err:
- ERR("Could not create tizen_policy_interface res: %m");
- wl_client_post_no_memory(client);
-}
-
-// --------------------------------------------------------
-// tizen_display_policy_interface
-// --------------------------------------------------------
-static const struct tizen_display_policy_interface _tz_dpy_pol_iface =
-{
- _tz_dpy_pol_iface_cb_brightness_set,
-};
-
-static void
-_tz_dpy_pol_cb_unbind(struct wl_resource *res_tz_dpy_pol)
-{
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol;
-
- tz_dpy_pol = _pol_wl_tz_dpy_pol_get(res_tz_dpy_pol);
- EINA_SAFETY_ON_NULL_RETURN(tz_dpy_pol);
-
- _pol_wl_tz_dpy_pol_del(tz_dpy_pol);
-}
-
-static void
-_tz_dpy_pol_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t ver, uint32_t id)
-{
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol;
- struct wl_resource *res_tz_dpy_pol;
-
- EINA_SAFETY_ON_NULL_GOTO(polwl, err);
-
- res_tz_dpy_pol = wl_resource_create(client,
- &tizen_display_policy_interface,
- ver,
- id);
- EINA_SAFETY_ON_NULL_GOTO(res_tz_dpy_pol, err);
-
- tz_dpy_pol = _pol_wl_tz_dpy_pol_add(res_tz_dpy_pol);
- EINA_SAFETY_ON_NULL_GOTO(tz_dpy_pol, err);
-
- wl_resource_set_implementation(res_tz_dpy_pol,
- &_tz_dpy_pol_iface,
- NULL,
- _tz_dpy_pol_cb_unbind);
- return;
-
-err:
- ERR("Could not create tizen_display_policy_interface res: %m");
- wl_client_post_no_memory(client);
-}
-
-// --------------------------------------------------------
-// tizen_ws_shell_interface::service
-// --------------------------------------------------------
-static void
-_tzsh_srv_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_srv)
-{
- wl_resource_destroy(res_tzsh_srv);
-}
-
-static void
-_tzsh_srv_iface_cb_region_set(struct wl_client *client, struct wl_resource *res_tzsh_srv, int32_t type, int32_t angle, struct wl_resource *res_reg)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- Pol_Wl_Tzsh_Region *tzsh_reg;
-
- tzsh_srv = wl_resource_get_user_data(res_tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
-
- if (!eina_list_data_find(polwl->tzsh_srvs, tzsh_srv))
- return;
-
- tzsh_reg = wl_resource_get_user_data(res_reg);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_reg);
-
- if (tzsh_srv->role == TZSH_SRV_ROLE_QUICKPANEL)
- e_mod_quickpanel_region_set(type, angle, tzsh_reg->tiler);
- else if (tzsh_srv->role == TZSH_SRV_ROLE_VOLUME)
- e_mod_volume_region_set(type, angle, tzsh_reg->tiler);
-}
-
-static void
-_tzsh_srv_indicator_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
-{
- _indicator_srv_res = NULL;
- wl_resource_destroy(resource);
-}
-
-static const struct tws_service_indicator_interface _tzsh_srv_indicator_iface =
-{
- _tzsh_srv_indicator_cb_destroy,
-};
-
-static void
-_tzsh_srv_iface_cb_indicator_get(struct wl_client *client, struct wl_resource *res_tzsh_srv, uint32_t id)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- struct wl_resource *res;
-
- tzsh_srv = wl_resource_get_user_data(res_tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
-
- if (!eina_list_data_find(polwl->tzsh_srvs, tzsh_srv))
- return;
-
- res = wl_resource_create(client, &tws_service_indicator_interface, 1, id);
- if (!res)
- {
- wl_client_post_no_memory(client);
- return;
- }
- _indicator_srv_res = res;
-
- wl_resource_set_implementation(res, &_tzsh_srv_indicator_iface, tzsh_srv, NULL);
-}
-
-static void
-_tzsh_srv_qp_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
-{
- wl_resource_destroy(resource);
-}
-
-static void
-_tzsh_srv_qp_cb_msg(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t msg)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
-
- tzsh_srv = wl_resource_get_user_data(resource);
-
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv->tzsh);
-
-#define EC tzsh_srv->tzsh->ec
- EINA_SAFETY_ON_NULL_RETURN(EC);
-
- switch (msg)
- {
- case TWS_SERVICE_QUICKPANEL_MSG_SHOW:
- e_mod_quickpanel_show();
- break;
- case TWS_SERVICE_QUICKPANEL_MSG_HIDE:
- e_mod_quickpanel_hide();
- break;
- default:
- ERR("Unknown message!! msg %d", msg);
- break;
- }
-#undef EC
-}
-
-static const struct tws_service_quickpanel_interface _tzsh_srv_qp_iface =
-{
- _tzsh_srv_qp_cb_destroy,
- _tzsh_srv_qp_cb_msg
-};
-
-static void
-_tzsh_srv_iface_cb_quickpanel_get(struct wl_client *client, struct wl_resource *res_tzsh_srv, uint32_t id)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- struct wl_resource *res;
-
- tzsh_srv = wl_resource_get_user_data(res_tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
-
- if (!eina_list_data_find(polwl->tzsh_srvs, tzsh_srv))
- return;
-
- res = wl_resource_create(client, &tws_service_quickpanel_interface, 1, id);
- if (!res)
- {
- wl_client_post_no_memory(client);
- return;
- }
-
- wl_resource_set_implementation(res, &_tzsh_srv_qp_iface, tzsh_srv, NULL);
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////
-static void
-_tzsh_srv_scrsaver_cb_release(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
-{
- wl_resource_destroy(resource);
-}
-
-static const struct tws_service_screensaver_interface _tzsh_srv_scrsaver_iface =
-{
- _tzsh_srv_scrsaver_cb_release
-};
-
-static void
-_tzsh_srv_iface_cb_scrsaver_get(struct wl_client *client, struct wl_resource *res_tzsh_srv, uint32_t id)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- struct wl_resource *res;
-
- tzsh_srv = wl_resource_get_user_data(res_tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
-
- if (!eina_list_data_find(polwl->tzsh_srvs, tzsh_srv))
- return;
-
- res = wl_resource_create(client, &tws_service_screensaver_interface, 1, id);
- if (!res)
- {
- wl_client_post_no_memory(client);
- return;
- }
-
- wl_resource_set_implementation(res, &_tzsh_srv_scrsaver_iface, tzsh_srv, NULL);
-}
-
-static void
-_tzsh_srv_scrsaver_mng_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
-{
- _scrsaver_mng_res = NULL;
- wl_resource_destroy(resource);
- e_screensaver_disable();
-}
-
-static void
-_tzsh_srv_scrsaver_mng_cb_enable(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
-
- tzsh_srv = wl_resource_get_user_data(resource);
-
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv->tzsh);
-
- e_screensaver_enable();
-}
-
-static void
-_tzsh_srv_scrsaver_mng_cb_disable(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
-
- tzsh_srv = wl_resource_get_user_data(resource);
-
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv->tzsh);
-
- e_screensaver_disable();
-}
-
-static void
-_tzsh_srv_scrsaver_mng_cb_idle_time_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t time)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- double timeout;
-
- tzsh_srv = wl_resource_get_user_data(resource);
-
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv->tzsh);
-
- /* convert time to seconds (double) from milliseconds (unsigned int) */
- timeout = (double)time * 0.001f;
-
- e_screensaver_timeout_set(timeout);
-}
-
-static const struct tws_service_screensaver_manager_interface _tzsh_srv_scrsaver_mng_iface =
-{
- _tzsh_srv_scrsaver_mng_cb_destroy,
- _tzsh_srv_scrsaver_mng_cb_enable,
- _tzsh_srv_scrsaver_mng_cb_disable,
- _tzsh_srv_scrsaver_mng_cb_idle_time_set
-};
-
-static void
-_tzsh_srv_iface_cb_scrsaver_mng_get(struct wl_client *client, struct wl_resource *res_tzsh_srv, uint32_t id)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- struct wl_resource *res;
-
- tzsh_srv = wl_resource_get_user_data(res_tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
-
- if (!eina_list_data_find(polwl->tzsh_srvs, tzsh_srv))
- return;
-
- res = wl_resource_create(client, &tws_service_screensaver_manager_interface, 1, id);
- if (!res)
- {
- wl_client_post_no_memory(client);
- return;
- }
-
- _scrsaver_mng_res = res;
-
- wl_resource_set_implementation(res, &_tzsh_srv_scrsaver_mng_iface, tzsh_srv, NULL);
-}
-
-static const struct tws_service_interface _tzsh_srv_iface =
-{
- _tzsh_srv_iface_cb_destroy,
- _tzsh_srv_iface_cb_region_set,
- _tzsh_srv_iface_cb_indicator_get,
- _tzsh_srv_iface_cb_quickpanel_get,
- _tzsh_srv_iface_cb_scrsaver_mng_get,
- _tzsh_srv_iface_cb_scrsaver_get
-};
-
-static void
-_tzsh_cb_srv_destroy(struct wl_resource *res_tzsh_srv)
-{
- Pol_Wl_Tzsh_Srv *tzsh_srv;
-
- tzsh_srv = wl_resource_get_user_data(res_tzsh_srv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
-
- if (!eina_list_data_find(polwl->tzsh_srvs, tzsh_srv))
- return;
-
- _pol_wl_tzsh_srv_del(tzsh_srv);
-}
-
-static void
-_tzsh_iface_cb_srv_create(struct wl_client *client, struct wl_resource *res_tzsh, uint32_t id, uint32_t surf_id, const char *name)
-{
- Pol_Wl_Tzsh *tzsh;
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- struct wl_resource *res_tzsh_srv;
- E_Client *ec;
- E_Pixmap *cp;
- int role;
-
- role = _pol_wl_tzsh_srv_role_get(name);
- if (role == TZSH_SRV_ROLE_UNKNOWN)
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid res_tzsh");
- return;
- }
-
- tzsh = wl_resource_get_user_data(res_tzsh);
- if (!tzsh)
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid res_tzsh's user data");
- return;
- }
-
- cp = _pol_wl_e_pixmap_get_from_id(client, surf_id);
- if (!cp)
- {
- if (role == TZSH_SRV_ROLE_INDICATOR)
- cp = e_pixmap_new(E_PIXMAP_TYPE_NONE, 0);
-
- if (!cp)
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid surface id");
- return;
- }
- }
-
- ec = e_pixmap_client_get(cp);
- if (!ec)
- {
- if (role == TZSH_SRV_ROLE_INDICATOR)
- {
- ec = e_client_new(cp, 0, 1);
- if (ec) ec->ignored = 1;
- }
- }
-
- if (ec)
- {
- if (!_pol_wl_e_client_is_valid(ec))
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid surface id");
- return;
- }
- }
-
- res_tzsh_srv = wl_resource_create(client,
- &tws_service_interface,
- wl_resource_get_version(res_tzsh),
- id);
- if (!res_tzsh_srv)
- {
- ERR("Could not create tws_service resource: %m");
- wl_client_post_no_memory(client);
- return;
- }
-
- _pol_wl_tzsh_data_set(tzsh, TZSH_TYPE_SRV, cp, ec);
-
- tzsh_srv = _pol_wl_tzsh_srv_add(tzsh,
- role,
- res_tzsh_srv,
- name);
- if (!tzsh_srv)
- {
- ERR("Could not create WS_Shell_Service");
- wl_client_post_no_memory(client);
- wl_resource_destroy(res_tzsh_srv);
- return;
- }
-
- wl_resource_set_implementation(res_tzsh_srv,
- &_tzsh_srv_iface,
- tzsh_srv,
- _tzsh_cb_srv_destroy);
-
- if (role == TZSH_SRV_ROLE_QUICKPANEL)
- e_mod_quickpanel_client_set(tzsh->ec);
- else if (role == TZSH_SRV_ROLE_VOLUME)
- e_mod_volume_client_set(tzsh->ec);
- else if (role == TZSH_SRV_ROLE_LOCKSCREEN)
- e_mod_lockscreen_client_set(tzsh->ec);
- else if (role == TZSH_SRV_ROLE_SCREENSAVER_MNG)
- e_mod_lockscreen_client_set(tzsh->ec);
- else if (role == TZSH_SRV_ROLE_SCREENSAVER)
- e_mod_lockscreen_client_set(tzsh->ec);
- else if (role == TZSH_SRV_ROLE_INDICATOR)
- e_mod_indicator_client_set(tzsh->ec);
-}
-
-// --------------------------------------------------------
-// tizen_ws_shell_interface::region
-// --------------------------------------------------------
-static void
-_tzsh_reg_cb_shell_destroy(struct wl_listener *listener, void *data)
-{
- Pol_Wl_Tzsh_Region *tzsh_reg;
-
- tzsh_reg = container_of(listener, Pol_Wl_Tzsh_Region, destroy_listener);
-
- if (tzsh_reg->res_tzsh_reg)
- {
- wl_resource_destroy(tzsh_reg->res_tzsh_reg);
- tzsh_reg->res_tzsh_reg = NULL;
- }
-}
-
-static void
-_tzsh_reg_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_reg)
-{
- wl_resource_destroy(res_tzsh_reg);
-}
-
-static void
-_tzsh_reg_iface_cb_add(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_reg, int32_t x, int32_t y, int32_t w, int32_t h)
-{
- Pol_Wl_Tzsh_Region *tzsh_reg;
- Eina_Tiler *src;
- int area_w = 0, area_h = 0;
-
- tzsh_reg = wl_resource_get_user_data(res_tzsh_reg);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_reg);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_reg->tiler);
-
- eina_tiler_area_size_get(tzsh_reg->tiler, &area_w, &area_h);
- src = eina_tiler_new(area_w, area_h);
- eina_tiler_tile_size_set(src, 1, 1);
- eina_tiler_rect_add(src, &(Eina_Rectangle){x, y, w, h});
- eina_tiler_union(tzsh_reg->tiler, src);
- eina_tiler_free(src);
-}
-
-static void
-_tzsh_reg_iface_cb_subtract(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_reg, int32_t x, int32_t y, int32_t w, int32_t h)
-{
- Pol_Wl_Tzsh_Region *tzsh_reg;
- Eina_Tiler *src;
- int area_w = 0, area_h = 0;
-
- tzsh_reg = wl_resource_get_user_data(res_tzsh_reg);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_reg);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_reg->tiler);
-
- eina_tiler_area_size_get(tzsh_reg->tiler, &area_w, &area_h);
- src = eina_tiler_new(area_w, area_h);
- eina_tiler_tile_size_set(src, 1, 1);
- eina_tiler_rect_add(src, &(Eina_Rectangle){x, y, w, h});
- eina_tiler_subtract(tzsh_reg->tiler, src);
- eina_tiler_free(src);
-}
-
-static const struct tws_region_interface _tzsh_reg_iface =
-{
- _tzsh_reg_iface_cb_destroy,
- _tzsh_reg_iface_cb_add,
- _tzsh_reg_iface_cb_subtract
-};
-
-static void
-_tzsh_reg_cb_destroy(struct wl_resource *res_tzsh_reg)
-{
- Pol_Wl_Tzsh_Region *tzsh_reg;
-
- tzsh_reg = wl_resource_get_user_data(res_tzsh_reg);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_reg);
-
- wl_list_remove(&tzsh_reg->destroy_listener.link);
- eina_tiler_free(tzsh_reg->tiler);
-
- E_FREE(tzsh_reg);
-}
-
-static void
-_tzsh_iface_cb_reg_create(struct wl_client *client, struct wl_resource *res_tzsh, uint32_t id)
-{
- Pol_Wl_Tzsh *tzsh;
- Pol_Wl_Tzsh_Region *tzsh_reg = NULL;
- Eina_Tiler *tz = NULL;
- struct wl_resource *res_tzsh_reg;
- int zw = 0, zh = 0;
-
- tzsh = wl_resource_get_user_data(res_tzsh);
- if (!tzsh)
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid res_tzsh's user data");
- return;
- }
-
- tzsh_reg = E_NEW(Pol_Wl_Tzsh_Region, 1);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_reg);
-
- e_zone_useful_geometry_get(e_zone_current_get(),
- NULL, NULL, &zw, &zh);
-
- tz = eina_tiler_new(zw, zh);
- EINA_SAFETY_ON_NULL_GOTO(tz, err);
- tzsh_reg->tiler = tz;
-
- eina_tiler_tile_size_set(tzsh_reg->tiler, 1, 1);
-
- if (!(res_tzsh_reg = wl_resource_create(client,
- &tws_region_interface,
- wl_resource_get_version(res_tzsh),
- id)))
- {
- ERR("Could not create tws_service resource: %m");
- wl_client_post_no_memory(client);
- goto err;
- }
-
- wl_resource_set_implementation(res_tzsh_reg,
- &_tzsh_reg_iface,
- tzsh_reg,
- _tzsh_reg_cb_destroy);
-
- tzsh_reg->tzsh = tzsh;
- tzsh_reg->res_tzsh_reg = res_tzsh_reg;
- tzsh_reg->destroy_listener.notify = _tzsh_reg_cb_shell_destroy;
-
- wl_resource_add_destroy_listener(res_tzsh,
- &tzsh_reg->destroy_listener);
- return;
-
-err:
- if (tzsh_reg->tiler) eina_tiler_free(tzsh_reg->tiler);
- E_FREE(tzsh_reg);
-}
-
-// --------------------------------------------------------
-// tizen_ws_shell_interface::indicator
-// --------------------------------------------------------
-E_Client *
-_pol_find_topvisible_client(E_Zone *zone)
-{
- E_Client *ec;
- Evas_Object *o;
- E_Comp_Wl_Client_Data *cdata;
-
- o = evas_object_top_get(e_comp->evas);
- for (; o; o = evas_object_below_get(o))
- {
- ec = evas_object_data_get(o, "E_Client");
-
- /* check e_client and skip e_clients not intersects with zone */
- if (!ec) continue;
- if (e_object_is_del(E_OBJECT(ec))) continue;
- if (e_client_util_ignored_get(ec)) continue;
- if (ec->zone != zone) continue;
- if (!ec->frame) continue;
- if (!ec->visible) continue;
- if (ec->visibility.skip) continue;
- if ((ec->visibility.obscured != E_VISIBILITY_UNOBSCURED) &&
- (ec->visibility.obscured != E_VISIBILITY_PARTIALLY_OBSCURED))
- continue;
-
- /* if ec is subsurface, skip this */
- cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
- if (cdata && cdata->sub.data) continue;
-
- if (!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
- continue;
-
- return ec;
-
- }
-
- return NULL;
-}
-
-static void
-_e_tzsh_indicator_srv_property_change_send(E_Client *ec)
-{
- int angle;
- int opacity;
-
- if (!ec) return;
- if (!_indicator_srv_res)
- {
- ELOGF("TZ_IND", "NO indicator service", NULL, NULL);
- return;
- }
-
- angle = ec->e.state.rot.ang.curr;
- opacity = ec->indicator.opacity_mode;
-
- ELOGF("TZ_IND", "SEND indicator info. angle:%d, opacity:%d", ec->pixmap, ec, angle, opacity);
- tws_service_indicator_send_property_change(_indicator_srv_res, angle, opacity);
-}
-
-EINTERN void
-e_tzsh_indicator_srv_property_update(E_Client *ec)
-{
- E_Client *ec_ind_owner;
- if (!_indicator_srv_res) return;
-
- ec_ind_owner = e_mod_indicator_owner_get();
- if (ec != ec_ind_owner) return;
-
- _e_tzsh_indicator_srv_property_change_send(ec);
-}
-
-EINTERN void
-e_tzsh_indicator_srv_ower_win_update(E_Zone *zone)
-{
- E_Client *ec = NULL;
- E_Client *ec_cur_owner = NULL;
-
- if (!zone) return;
- if (!_indicator_srv_res) return;
-
- ec_cur_owner = e_mod_indicator_owner_get();
- ec = _pol_find_topvisible_client(zone);
-
- if (ec != ec_cur_owner)
- {
- ELOGF("TZ_IND", "INDICATOR OWNER win:%x", NULL, NULL, e_client_util_win_get(ec));
- e_mod_indicator_owner_set(ec);
-
- e_tzsh_indicator_srv_property_update(ec);
- }
-}
-
-// --------------------------------------------------------
-// tizen_ws_shell_interface::quickpanel
-// --------------------------------------------------------
-EINTERN void
-e_tzsh_qp_state_visible_update(E_Client *ec, Eina_Bool vis)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- struct wl_array states;
- E_Tzsh_QP_Event *ev;
-
- tzsh_client = _pol_wl_tzsh_client_get_from_client(ec);
- if (!tzsh_client) return;
-
- wl_array_init(&states);
-
- ev = wl_array_add(&states, sizeof(E_Tzsh_QP_Event));
-
- ev->type = TWS_QUICKPANEL_STATE_TYPE_VISIBILITY;
- ev->val = vis ? TWS_QUICKPANEL_STATE_VALUE_VISIBLE_SHOW : TWS_QUICKPANEL_STATE_VALUE_VISIBLE_HIDE;
-
- tws_quickpanel_send_state_changed(tzsh_client->res_tzsh_client, &states);
-
- wl_array_release(&states);
-}
-
-EINTERN void
-e_tzsh_qp_state_scrollable_update(E_Client *ec, Eina_Bool scrollable)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- struct wl_array states;
- E_Tzsh_QP_Event *ev;
-
- tzsh_client = _pol_wl_tzsh_client_get_from_client(ec);
- if (!tzsh_client) return;
-
- wl_array_init(&states);
-
- ev = wl_array_add(&states, sizeof(E_Tzsh_QP_Event));
-
- ev->type = TWS_QUICKPANEL_STATE_TYPE_SCROLLABLE;
- ev->val = scrollable ? TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_SET : TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_UNSET;
-
- tws_quickpanel_send_state_changed(tzsh_client->res_tzsh_client, &states);
-
- wl_array_release(&states);
-}
-
-EINTERN void
-e_tzsh_qp_state_orientation_update(E_Client *ec, int ridx)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- struct wl_array states;
- E_Tzsh_QP_Event *ev;
-
- tzsh_client = _pol_wl_tzsh_client_get_from_client(ec);
- if (!tzsh_client) return;
-
- wl_array_init(&states);
-
- ev = wl_array_add(&states, sizeof(E_Tzsh_QP_Event));
-
- ev->type = TWS_QUICKPANEL_STATE_TYPE_ORIENTATION;
- ev->val = TWS_QUICKPANEL_STATE_VALUE_ORIENTATION_0 + ridx;
-
- tws_quickpanel_send_state_changed(tzsh_client->res_tzsh_client, &states);
-
- wl_array_release(&states);
-}
-
-static void
-_tzsh_qp_iface_cb_release(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_qp)
-{
- wl_resource_destroy(res_tzsh_qp);
-}
-
-static void
-_tzsh_qp_iface_cb_show(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_qp)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- E_Client *ec;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_qp);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh->ec);
-
- ec = tzsh_client->tzsh->ec;
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- e_qp_client_show(ec);
-}
-
-static void
-_tzsh_qp_iface_cb_hide(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_qp)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- E_Client *ec;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_qp);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh->ec);
-
- ec = tzsh_client->tzsh->ec;
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- e_qp_client_hide(ec);
-}
-
-static void
-_tzsh_qp_iface_cb_enable(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_qp)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- E_Client *ec;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_qp);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh->ec);
-
- ec = tzsh_client->tzsh->ec;
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- e_qp_client_scrollable_set(ec, EINA_TRUE);
-}
-
-static void
-_tzsh_qp_iface_cb_disable(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_qp)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- E_Client *ec;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_qp);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh->ec);
-
- ec = tzsh_client->tzsh->ec;
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- e_qp_client_scrollable_set(ec, EINA_FALSE);
-}
-
-static void
-_tzsh_qp_iface_cb_state_get(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_qp, int32_t type)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
- E_Client *ec;
- Eina_Bool vis, scrollable;
- int ridx;
- int val = TWS_QUICKPANEL_STATE_VALUE_UNKNOWN;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_qp);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client->tzsh->ec);
-
- ec = tzsh_client->tzsh->ec;
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- switch (type)
- {
- case TWS_QUICKPANEL_STATE_TYPE_VISIBILITY:
- val = TWS_QUICKPANEL_STATE_VALUE_VISIBLE_HIDE;
- vis = e_qp_visible_get();
- if (vis) val = TWS_QUICKPANEL_STATE_VALUE_VISIBLE_SHOW;
- break;
- case TWS_QUICKPANEL_STATE_TYPE_SCROLLABLE:
- val = TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_UNSET;
- scrollable = e_qp_client_scrollable_get(ec);
- if (scrollable) val = TWS_QUICKPANEL_STATE_VALUE_SCROLLABLE_SET;
- break;
- case TWS_QUICKPANEL_STATE_TYPE_ORIENTATION:
- ridx = e_qp_orientation_get();
- val = TWS_QUICKPANEL_STATE_VALUE_ORIENTATION_0 + ridx;
- break;
- default:
- break;
- }
-
- tws_quickpanel_send_state_get_done(res_tzsh_qp, type, val, 0);
-}
-
-static const struct tws_quickpanel_interface _tzsh_qp_iface =
-{
- _tzsh_qp_iface_cb_release,
- _tzsh_qp_iface_cb_show,
- _tzsh_qp_iface_cb_hide,
- _tzsh_qp_iface_cb_enable,
- _tzsh_qp_iface_cb_disable,
- _tzsh_qp_iface_cb_state_get
-};
-
-static void
-_tzsh_cb_qp_destroy(struct wl_resource *res_tzsh_qp)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_qp);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
-
- _pol_wl_tzsh_client_del(tzsh_client);
-}
-
-static void
-_tzsh_iface_cb_qp_get(struct wl_client *client, struct wl_resource *res_tzsh, uint32_t id, uint32_t surf_id)
-{
- Pol_Wl_Tzsh *tzsh;
- Pol_Wl_Tzsh_Client *tzsh_client;
- struct wl_resource *res_tzsh_qp;
- E_Client *ec;
- E_Pixmap *cp;
-
- tzsh = wl_resource_get_user_data(res_tzsh);
- if (!tzsh)
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid res_tzsh's user data");
- return;
- }
-
- cp = _pol_wl_e_pixmap_get_from_id(client, surf_id);
- if (!cp)
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid surface id");
- return;
- }
-
- ec = e_pixmap_client_get(cp);
- if (ec)
- {
- if (!_pol_wl_e_client_is_valid(ec))
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid surface id");
- return;
- }
- }
-
- res_tzsh_qp = wl_resource_create(client,
- &tws_quickpanel_interface,
- wl_resource_get_version(res_tzsh),
- id);
- if (!res_tzsh_qp)
- {
- ERR("Could not create tws_quickpanel resource: %m");
- wl_client_post_no_memory(client);
- return;
- }
-
- _pol_wl_tzsh_data_set(tzsh, TZSH_TYPE_CLIENT, cp, ec);
-
- tzsh_client = _pol_wl_tzsh_client_add(tzsh, res_tzsh_qp);
- if (!tzsh_client)
- {
- ERR("Could not create tzsh_client");
- wl_client_post_no_memory(client);
- return;
- }
-
- tzsh_client->qp_client = EINA_TRUE;
- e_qp_client_add(tzsh->ec);
-
- wl_resource_set_implementation(res_tzsh_qp,
- &_tzsh_qp_iface,
- tzsh_client,
- _tzsh_cb_qp_destroy);
-}
-
-// --------------------------------------------------------
-// tizen_ws_shell_interface::tvservice
-// --------------------------------------------------------
-static void
-_tzsh_tvsrv_iface_cb_release(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_tvsrv)
-{
- wl_resource_destroy(res_tzsh_tvsrv);
-}
-
-static void
-_tzsh_tvsrv_iface_cb_bind(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_tvsrv)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_tvsrv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- polwl->tvsrv_bind_list = eina_list_append(polwl->tvsrv_bind_list, tzsh_client);
-
- _pol_wl_tzsh_srv_tvsrv_bind_update();
-}
-
-static void
-_tzsh_tvsrv_iface_cb_unbind(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh_tvsrv)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_tvsrv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- polwl->tvsrv_bind_list = eina_list_remove(polwl->tvsrv_bind_list, tzsh_client);
-
- _pol_wl_tzsh_srv_tvsrv_bind_update();
-}
-
-static const struct tws_tvsrv_interface _tzsh_tvsrv_iface =
-{
- _tzsh_tvsrv_iface_cb_release,
- _tzsh_tvsrv_iface_cb_bind,
- _tzsh_tvsrv_iface_cb_unbind
-};
-
-static void
-_tzsh_cb_tvsrv_destroy(struct wl_resource *res_tzsh_tvsrv)
-{
- Pol_Wl_Tzsh_Client *tzsh_client;
-
- tzsh_client = wl_resource_get_user_data(res_tzsh_tvsrv);
- EINA_SAFETY_ON_NULL_RETURN(tzsh_client);
-
- if (!eina_list_data_find(polwl->tzsh_clients, tzsh_client))
- return;
-
- polwl->tvsrv_bind_list = eina_list_remove(polwl->tvsrv_bind_list, tzsh_client);
-
- _pol_wl_tzsh_srv_tvsrv_bind_update();
- _pol_wl_tzsh_client_del(tzsh_client);
-}
-
-static void
-_tzsh_iface_cb_tvsrv_get(struct wl_client *client, struct wl_resource *res_tzsh, uint32_t id, uint32_t surf_id)
-{
- Pol_Wl_Tzsh *tzsh;
- Pol_Wl_Tzsh_Client *tzsh_client;
- struct wl_resource *res_tzsh_tvsrv;
- E_Pixmap *cp;
- E_Client *ec;
-
- tzsh = wl_resource_get_user_data(res_tzsh);
- if (!tzsh)
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid res_tzsh's user data");
- return;
- }
-
- cp = _pol_wl_e_pixmap_get_from_id(client, surf_id);
- if (!cp)
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid surface id");
- return;
- }
-
- ec = e_pixmap_client_get(cp);
- if (ec)
- {
- if (!_pol_wl_e_client_is_valid(ec))
- {
- wl_resource_post_error
- (res_tzsh,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid surface id");
- return;
- }
- }
-
- res_tzsh_tvsrv = wl_resource_create(client,
- &tws_tvsrv_interface,
- wl_resource_get_version(res_tzsh),
- id);
- if (!res_tzsh_tvsrv)
- {
- ERR("Could not create tws_tvsrv resource: %m");
- wl_client_post_no_memory(client);
- return;
- }
-
- _pol_wl_tzsh_data_set(tzsh, TZSH_TYPE_CLIENT, cp, ec);
-
- tzsh_client = _pol_wl_tzsh_client_add(tzsh, res_tzsh_tvsrv);
- if (!tzsh_client)
- {
- ERR("Could not create tzsh_client");
- wl_client_post_no_memory(client);
- wl_resource_destroy(res_tzsh_tvsrv);
- return;
- }
-
- wl_resource_set_implementation(res_tzsh_tvsrv,
- &_tzsh_tvsrv_iface,
- tzsh_client,
- _tzsh_cb_tvsrv_destroy);
-}
-
-// --------------------------------------------------------
-// tizen_ws_shell_interface
-// --------------------------------------------------------
-static void
-_tzsh_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzsh)
-{
- wl_resource_destroy(res_tzsh);
-}
-
-static const struct tizen_ws_shell_interface _tzsh_iface =
-{
- _tzsh_iface_cb_destroy,
- _tzsh_iface_cb_srv_create,
- _tzsh_iface_cb_reg_create,
- _tzsh_iface_cb_qp_get,
- _tzsh_iface_cb_tvsrv_get
-};
-
-static void
-_tzsh_cb_unbind(struct wl_resource *res_tzsh)
-{
- Pol_Wl_Tzsh *tzsh;
-
- tzsh = wl_resource_get_user_data(res_tzsh);
- EINA_SAFETY_ON_NULL_RETURN(tzsh);
-
- _pol_wl_tzsh_del(tzsh);
-}
-
-static void
-_tzsh_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t ver, uint32_t id)
-{
- Pol_Wl_Tzsh *tzsh;
- struct wl_resource *res_tzsh;
-
- EINA_SAFETY_ON_NULL_GOTO(polwl, err);
-
- res_tzsh = wl_resource_create(client,
- &tizen_ws_shell_interface,
- ver,
- id);
- EINA_SAFETY_ON_NULL_GOTO(res_tzsh, err);
-
- tzsh = _pol_wl_tzsh_add(res_tzsh);
- EINA_SAFETY_ON_NULL_GOTO(tzsh, err);
-
- wl_resource_set_implementation(res_tzsh,
- &_tzsh_iface,
- tzsh,
- _tzsh_cb_unbind);
-
- _pol_wl_tzsh_registered_srv_send(tzsh);
- return;
-
-err:
- ERR("Could not create tizen_ws_shell_interface res: %m");
- wl_client_post_no_memory(client);
-}
-
-// --------------------------------------------------------
-// tizen_launchscreen_interface
-// --------------------------------------------------------
-static void
-_launchscreen_hide(uint32_t pid)
-{
- Eina_List *l, *ll;
- Pol_Wl_Tzlaunch *plauncher;
- Pol_Wl_Tzlaunch_Img *pimg;
-
- if(pid <= 0) return;
-
- EINA_LIST_FOREACH(polwl->tzlaunchs, l, plauncher)
- {
- EINA_LIST_FOREACH(plauncher->imglist, ll, pimg)
- if (pimg->pid == pid)
- {
- DBG("Launch Screen hide | pid %d", pid);
- _launch_img_off(pimg);
- }
- }
-
- return;
-}
-
-static void
-_launch_img_cb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
-{
- Pol_Wl_Tzlaunch_Img *tzlaunchimg = data;
-
- if ((tzlaunchimg) && (tzlaunchimg->obj == obj))
- tzlaunchimg->obj = NULL;
-}
-
-static void
-_launch_img_off(Pol_Wl_Tzlaunch_Img *tzlaunchimg)
-{
- E_Client *ec = NULL;
-
- if (!tzlaunchimg->valid) return;
- if (!tzlaunchimg->ec) return;
-
- ec = tzlaunchimg->ec;
-
- if ((ec->pixmap) &&
- (ec->pixmap == tzlaunchimg->ep))
- {
- if (ec->visible)
- {
- ec->visible = EINA_FALSE;
- evas_object_hide(ec->frame);
- ec->ignored = EINA_TRUE;
- }
-
- e_comp->launchscrns = eina_list_remove(e_comp->launchscrns, ec);
-
- e_pixmap_del(tzlaunchimg->ep);
- e_object_del(E_OBJECT(ec));
- }
-
- tzlaunchimg->ep = NULL;
- tzlaunchimg->ec = NULL;
- if (tzlaunchimg->timeout) ecore_timer_del(tzlaunchimg->timeout);
- tzlaunchimg->timeout = NULL;
- tzlaunchimg->valid = EINA_FALSE;
-}
-
-static Eina_Bool
-_launch_timeout(void *data)
-{
- Pol_Wl_Tzlaunch_Img *tzlaunchimg;
- tzlaunchimg = (Pol_Wl_Tzlaunch_Img *)data;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunchimg, 0);
-
- _launch_img_off(tzlaunchimg);
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-static void
-_tzlaunchimg_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunchimg)
-{
- wl_resource_destroy(res_tzlaunchimg);
-}
-
-static void
-_tzlaunchimg_iface_cb_launch(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunchimg,
- const char *pfname, uint32_t ftype,
- uint32_t depth, uint32_t angle,
- uint32_t indicator, struct wl_array *options)
-{
- Pol_Wl_Tzlaunch_Img *tzlaunchimg;
- Evas_Load_Error err;
- E_Client *ec = NULL;
- E_Comp_Object_Content_Type content_type = 0;
-
- tzlaunchimg = wl_resource_get_user_data(res_tzlaunchimg);
- EINA_SAFETY_ON_NULL_RETURN(tzlaunchimg);
- EINA_SAFETY_ON_NULL_RETURN(tzlaunchimg->ec);
- EINA_SAFETY_ON_NULL_RETURN(tzlaunchimg->ec->frame);
-
- ec = tzlaunchimg->ec;
-
- // TO DO
- // invaid parameter handle
- DBG("%s | path %s(%d), indicator(%d), angle(%d)", __FUNCTION__, pfname, ftype, indicator, angle);
- tzlaunchimg->path = pfname;
- tzlaunchimg->type = ftype;
- tzlaunchimg->indicator = indicator;
- tzlaunchimg->angle = angle;
-
- if (tzlaunchimg->type == E_LAUNCH_FILE_TYPE_IMAGE)
- {
- content_type = E_COMP_OBJECT_CONTENT_TYPE_EXT_IMAGE;
- tzlaunchimg->obj = evas_object_image_add(e_comp->evas);
- EINA_SAFETY_ON_NULL_GOTO(tzlaunchimg->obj, error);
- evas_object_image_file_set(tzlaunchimg->obj, tzlaunchimg->path, NULL);
-
- err = evas_object_image_load_error_get(tzlaunchimg->obj);
- EINA_SAFETY_ON_FALSE_GOTO(err == EVAS_LOAD_ERROR_NONE, error);
-
- evas_object_image_fill_set(tzlaunchimg->obj, 0, 0, e_comp->w, e_comp->h);
- evas_object_image_filled_set(tzlaunchimg->obj, EINA_TRUE);
- }
- else
- {
- content_type = E_COMP_OBJECT_CONTENT_TYPE_EXT_EDJE;
- tzlaunchimg->obj = edje_object_add(e_comp->evas);
- EINA_SAFETY_ON_NULL_GOTO(tzlaunchimg->obj, error);
- edje_object_file_set (tzlaunchimg->obj, tzlaunchimg->path, APP_DEFINE_GROUP_NAME);
-
- evas_object_move(tzlaunchimg->obj, 0, 0);
- evas_object_resize(tzlaunchimg->obj, e_comp->w, e_comp->h);
- }
-
- if (depth == 32) ec->argb = EINA_TRUE;
- else ec->argb = EINA_FALSE;
-
- if (!e_comp_object_content_set(ec->frame, tzlaunchimg->obj, content_type))
- {
- ERR("Setting comp object content for %p failed!", ec);
- goto error;
- }
-
- evas_object_event_callback_add(tzlaunchimg->obj,
- EVAS_CALLBACK_DEL,
- _launch_img_cb_del, tzlaunchimg);
-
- tzlaunchimg->valid = EINA_TRUE;
-
- ec->ignored = EINA_FALSE;
- ec->visible = EINA_TRUE;
- ec->new_client = EINA_FALSE;
- ec->icccm.accepts_focus = EINA_TRUE;
-
- evas_object_show(ec->frame);
- evas_object_raise(ec->frame);
- EC_CHANGED(ec);
-
- e_client_visibility_calculate();
-
- if (tzlaunchimg->timeout)
- ecore_timer_del(tzlaunchimg->timeout);
- tzlaunchimg->timeout = ecore_timer_add(4.0f, _launch_timeout, tzlaunchimg);
-
- return;
-error:
- ERR("Could not complete %s", __FUNCTION__);
- if (tzlaunchimg->obj)
- evas_object_del(tzlaunchimg->obj);
-}
-
-static void
-_tzlaunchimg_iface_cb_show(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunchimg)
-{
- /* TODO: request launch img show */
-
-}
-
-static void
-_tzlaunchimg_iface_cb_hide(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunchimg)
-{
- /* TODO: request launch img hide */
-}
-
-static void
-_tzlaunchimg_iface_cb_owner(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunchimg, uint32_t pid)
-{
- Pol_Wl_Tzlaunch_Img *tzlaunchimg;
-
- DBG("Launch img(%d) pid: %d", wl_resource_get_id(res_tzlaunchimg), pid);
-
- tzlaunchimg = wl_resource_get_user_data(res_tzlaunchimg);
- EINA_SAFETY_ON_NULL_RETURN(tzlaunchimg);
-
- tzlaunchimg->pid = pid;
- tzlaunchimg->ec->netwm.pid = pid;
-}
-
-
-static const struct tizen_launch_image_interface _tzlaunchimg_iface =
-{
- _tzlaunchimg_iface_cb_destroy,
- _tzlaunchimg_iface_cb_launch,
- _tzlaunchimg_iface_cb_owner,
- _tzlaunchimg_iface_cb_show,
- _tzlaunchimg_iface_cb_hide
-};
-
-static Pol_Wl_Tzlaunch_Img *
-_tzlaunch_img_add(struct wl_resource *res_tzlaunch, struct wl_resource *res_tzlaunch_img)
-{
- Pol_Wl_Tzlaunch *tzlaunch;
- Pol_Wl_Tzlaunch_Img *tzlaunchimg;
-
- tzlaunchimg = E_NEW(Pol_Wl_Tzlaunch_Img, 1);
- EINA_SAFETY_ON_NULL_GOTO(tzlaunchimg, error);
-
- tzlaunch = wl_resource_get_user_data(res_tzlaunch);
- EINA_SAFETY_ON_NULL_GOTO(tzlaunch, error);
-
- tzlaunch->imglist = eina_list_append(tzlaunch->imglist, tzlaunchimg);
-
- tzlaunchimg->tzlaunch = tzlaunch;
- tzlaunchimg->res_tzlaunch_img = res_tzlaunch_img;
-
- tzlaunchimg->ep = e_pixmap_new(E_PIXMAP_TYPE_EXT_OBJECT, 0);
- EINA_SAFETY_ON_NULL_GOTO(tzlaunchimg->ep, error);
- tzlaunchimg->ec = e_client_new(tzlaunchimg->ep, 0, 1);
- EINA_SAFETY_ON_NULL_GOTO(tzlaunchimg->ec, error);
-
- tzlaunchimg->ec->icccm.title = eina_stringshare_add("Launchscreen");
- tzlaunchimg->ec->icccm.name = eina_stringshare_add("Launchscreen");
- tzlaunchimg->ec->ignored = EINA_TRUE;
-
- e_comp->launchscrns = eina_list_append(e_comp->launchscrns, tzlaunchimg->ec);
-
- return tzlaunchimg;
-error:
- if (tzlaunchimg)
- {
- ERR("Could not initialize launchscreen client");
- if (tzlaunchimg->ep)
- e_pixmap_del(tzlaunchimg->ep);
- if (tzlaunchimg->ec)
- e_object_del(E_OBJECT(tzlaunchimg->ec));
- E_FREE(tzlaunchimg);
- }
- return NULL;
-}
-
-static void
-_tzlaunch_img_destroy(struct wl_resource *res_tzlaunchimg)
-{
- Pol_Wl_Tzlaunch_Img *tzlaunchimg;
- Pol_Wl_Tzlaunch *tzlaunch;
-
- EINA_SAFETY_ON_NULL_RETURN(res_tzlaunchimg);
-
- tzlaunchimg = wl_resource_get_user_data(res_tzlaunchimg);
- EINA_SAFETY_ON_NULL_RETURN(tzlaunchimg);
-
- if (tzlaunchimg->obj)
- evas_object_event_callback_del_full(tzlaunchimg->obj, EVAS_CALLBACK_DEL, _launch_img_cb_del, tzlaunchimg);
-
- _launch_img_off(tzlaunchimg);
-
- tzlaunch = tzlaunchimg->tzlaunch;
- tzlaunch->imglist = eina_list_remove(tzlaunch->imglist, tzlaunchimg);
-
- memset(tzlaunchimg, 0x0, sizeof(Pol_Wl_Tzlaunch_Img));
- E_FREE(tzlaunchimg);
-}
-
-
-static void
-_tzlaunch_iface_cb_create_img(struct wl_client *client, struct wl_resource *res_tzlaunch, uint32_t id)
-{
-
- Pol_Wl_Tzlaunch_Img *plaunchimg;
- struct wl_resource *res_tzlaunch_img;
-
- res_tzlaunch_img = wl_resource_create(client,
- &tizen_launch_image_interface,
- wl_resource_get_version(res_tzlaunch),
- id);
- if (!res_tzlaunch_img)
- {
- wl_resource_post_error
- (res_tzlaunch,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "Invalid res_tzlaunch's user data");
- return;
- }
-
- plaunchimg = _tzlaunch_img_add(res_tzlaunch, res_tzlaunch_img);
- EINA_SAFETY_ON_NULL_GOTO(plaunchimg, err);
-
- wl_resource_set_implementation(res_tzlaunch_img,
- &_tzlaunchimg_iface,
- plaunchimg,
- _tzlaunch_img_destroy);
-
- return;
-
-err:
- ERR("Could not create tizen_launch_image_interface res: %m");
- wl_client_post_no_memory(client);
-}
-
-
-static const struct tizen_launchscreen_interface _tzlaunch_iface =
-{
- _tzlaunch_iface_cb_create_img
-};
-
-static void
-_tzlaunch_del(Pol_Wl_Tzlaunch *tzlaunch)
-{
- Pol_Wl_Tzlaunch_Img *plaunchimg;
- Eina_List *l, *ll;
-
- EINA_SAFETY_ON_NULL_RETURN(tzlaunch);
-
- // remove tzlaunch created imglist
- EINA_LIST_FOREACH_SAFE(tzlaunch->imglist, l, ll, plaunchimg)
- {
- if (plaunchimg->tzlaunch != tzlaunch) continue;
- wl_resource_destroy(plaunchimg->res_tzlaunch_img);
- break;
- }
-
- polwl->tzlaunchs = eina_list_remove(polwl->tzlaunchs, tzlaunch);
-
- memset(tzlaunch, 0x0, sizeof(Pol_Wl_Tzlaunch));
- E_FREE(tzlaunch);
-}
-
-static Pol_Wl_Tzlaunch *
-_tzlaunch_add(struct wl_resource *res_tzlaunch)
-{
- Pol_Wl_Tzlaunch *tzlaunch;
-
- tzlaunch = E_NEW(Pol_Wl_Tzlaunch, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch, NULL);
-
- tzlaunch->res_tzlaunch = res_tzlaunch;
-
- polwl->tzlaunchs = eina_list_append(polwl->tzlaunchs, tzlaunch);
-
- return tzlaunch;
-}
-
-static void
-_tzlaunch_cb_unbind(struct wl_resource *res_tzlaunch)
-{
- Pol_Wl_Tzlaunch *tzlaunch = NULL;
- Eina_List *l, *ll;
-
- EINA_LIST_FOREACH_SAFE(polwl->tzlaunchs, l, ll, tzlaunch)
- {
- if (tzlaunch->res_tzlaunch != res_tzlaunch) continue;
- _tzlaunch_del(tzlaunch);
- break;
- }
-}
-
-static void
-_tzlaunch_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t ver, uint32_t id)
-{
- Pol_Wl_Tzlaunch *tzlaunch = NULL;
- struct wl_resource *res_tzlaunch;
-
- EINA_SAFETY_ON_NULL_GOTO(polwl, err);
-
- res_tzlaunch = wl_resource_create(client,
- &tizen_launchscreen_interface,
- ver,
- id);
- EINA_SAFETY_ON_NULL_GOTO(res_tzlaunch, err);
-
- tzlaunch = _tzlaunch_add(res_tzlaunch);
- EINA_SAFETY_ON_NULL_GOTO(tzlaunch, err);
-
- wl_resource_set_implementation(res_tzlaunch,
- &_tzlaunch_iface,
- tzlaunch,
- _tzlaunch_cb_unbind);
-
- return;
-
-err:
- ERR("Could not create tizen_launchscreen_interface res: %m");
- wl_client_post_no_memory(client);
-}
-
-static Eina_Bool
-_pol_wl_cb_scrsaver_on(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
-{
- if (_scrsaver_mng_res)
- tws_service_screensaver_manager_send_idle(_scrsaver_mng_res);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_pol_wl_cb_scrsaver_off(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
-{
- if (_scrsaver_mng_res)
- tws_service_screensaver_manager_send_active(_scrsaver_mng_res);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-// --------------------------------------------------------
-// Pol_Wl_Tz_Indicator
-// --------------------------------------------------------
-static Pol_Wl_Tz_Indicator *
-_pol_wl_tz_indicator_add(struct wl_resource *res_tz_indicator)
-{
- Pol_Wl_Tz_Indicator *tz_indicator;
-
- tz_indicator = E_NEW(Pol_Wl_Tz_Indicator, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tz_indicator, NULL);
-
- tz_indicator->res_tz_indicator = res_tz_indicator;
-
- polwl->tz_indicators = eina_list_append(polwl->tz_indicators, tz_indicator);
-
- return tz_indicator;
-}
-
-static void
-_pol_wl_tz_indicator_del(Pol_Wl_Tz_Indicator *tz_indicator)
-{
- EINA_SAFETY_ON_NULL_RETURN(tz_indicator);
-
- polwl->tz_indicators = eina_list_remove(polwl->tz_indicators, tz_indicator);
- E_FREE(tz_indicator);
-}
-
-static Pol_Wl_Tz_Indicator *
-_pol_wl_tz_indicator_get(struct wl_resource *res_tz_indicator)
-{
- Eina_List *l;
- Pol_Wl_Tz_Indicator *tz_indicator;
-
- EINA_LIST_FOREACH(polwl->tz_indicators, l, tz_indicator)
- {
- if (tz_indicator->res_tz_indicator == res_tz_indicator)
- return tz_indicator;
- }
- return NULL;
-}
-
-static Pol_Wl_Tz_Indicator *
-_pol_wl_tz_indicator_get_from_client(E_Client *ec)
-{
- Eina_List *l;
- Pol_Wl_Tz_Indicator *tz_indicator;
-
- EINA_LIST_FOREACH(polwl->tz_indicators, l, tz_indicator)
- {
- if (tz_indicator->ec == ec)
- {
- return tz_indicator;
- }
- }
-
- return NULL;
-}
-
-static Eina_Bool
-_pol_wl_tz_indicator_set_client(struct wl_resource *res_tz_indicator, E_Client *ec)
-{
- Pol_Wl_Tz_Indicator *tz_indicator = NULL;
-
- tz_indicator = _pol_wl_tz_indicator_get(res_tz_indicator);
- EINA_SAFETY_ON_NULL_RETURN_VAL(tz_indicator, EINA_FALSE);
-
- if (!tz_indicator->ec)
- {
- tz_indicator->ec = ec;
- return EINA_TRUE;
- }
- else
- {
- if (tz_indicator->ec == ec)
- {
- return EINA_TRUE;
- }
- else
- {
- return EINA_FALSE;
- }
- }
-}
-
-static void
-_pol_wl_tz_indicator_unset_client(E_Client *ec)
-{
- Eina_List *l;
- Pol_Wl_Tz_Indicator *tz_indicator;
-
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- EINA_LIST_FOREACH(polwl->tz_indicators, l, tz_indicator)
- {
- if (tz_indicator->ec == ec)
- tz_indicator->ec = NULL;
- }
-}
-
-static void
-_tz_indicator_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tz_indicator)
-{
- wl_resource_destroy(res_tz_indicator);
-}
-
-static void
-_tz_indicator_cb_state_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tz_indicator, struct wl_resource *surf, int32_t state)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- ELOGF("TZ_IND", "STATE:%d", ec->pixmap, ec, state);
- _pol_wl_tz_indicator_set_client(res_tz_indicator, ec);
- ec->indicator.state = state;
-}
-
-static void
-_tz_indicator_cb_opacity_mode_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tz_indicator, struct wl_resource *surf, int32_t mode)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- ELOGF("TZ_IND", "OPACITY_MODE:%d", ec->pixmap, ec, mode);
- _pol_wl_tz_indicator_set_client(res_tz_indicator, ec);
-
- if (ec->indicator.opacity_mode == mode) return;
-
- ec->indicator.opacity_mode = mode;
- if (ec == e_mod_indicator_owner_get())
- {
- _e_tzsh_indicator_srv_property_change_send(ec);
- }
-}
-
-static void
-_tz_indicator_cb_visible_type_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tz_indicator, struct wl_resource *surf, int32_t vtype)
-{
- E_Client *ec;
-
- ec = wl_resource_get_user_data(surf);
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_NULL_RETURN(ec->frame);
-
- ELOGF("TZ_IND", "VIS_TYPE:%d", ec->pixmap, ec, vtype);
- _pol_wl_tz_indicator_set_client(res_tz_indicator, ec);
- ec->indicator.visible_type = vtype;
-}
-
-// --------------------------------------------------------
-// tizen_indicator_interface
-// --------------------------------------------------------
-static const struct tizen_indicator_interface _tz_indicator_iface =
-{
- _tz_indicator_cb_destroy,
- _tz_indicator_cb_state_set,
- _tz_indicator_cb_opacity_mode_set,
- _tz_indicator_cb_visible_type_set,
-};
-
-static void
-_tz_indicator_cb_unbind(struct wl_resource *res_tz_indicator)
-{
- Pol_Wl_Tz_Indicator *tz_indicator;
-
- tz_indicator = _pol_wl_tz_indicator_get(res_tz_indicator);
- EINA_SAFETY_ON_NULL_RETURN(tz_indicator);
-
- _pol_wl_tz_indicator_del(tz_indicator);
-}
-
-static void
-_tz_indicator_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t ver, uint32_t id)
-{
- Pol_Wl_Tz_Indicator *tz_indicator_pol;
- struct wl_resource *res_tz_indicator;
-
- EINA_SAFETY_ON_NULL_GOTO(polwl, err);
-
- res_tz_indicator = wl_resource_create(client,
- &tizen_indicator_interface,
- ver,
- id);
- EINA_SAFETY_ON_NULL_GOTO(res_tz_indicator, err);
-
- tz_indicator_pol = _pol_wl_tz_indicator_add(res_tz_indicator);
- EINA_SAFETY_ON_NULL_GOTO(tz_indicator_pol, err);
-
- wl_resource_set_implementation(res_tz_indicator,
- &_tz_indicator_iface,
- NULL,
- _tz_indicator_cb_unbind);
- return;
-
-err:
- ERR("Could not create tizen_indicator_interface res: %m");
- wl_client_post_no_memory(client);
-}
-
-void
-e_mod_pol_wl_indicator_flick_send(E_Client *ec)
-{
- Pol_Wl_Tz_Indicator *tz_indicator;
- struct wl_resource *surf;
-
- tz_indicator = _pol_wl_tz_indicator_get_from_client(ec);
- EINA_SAFETY_ON_NULL_RETURN(tz_indicator);
-
- if (ec->comp_data)
- surf = ec->comp_data->surface;
- else
- surf = NULL;
-
- ELOGF("TZ_IND", "SEND FLICK EVENT", ec->pixmap, ec);
- tizen_indicator_send_flick(tz_indicator->res_tz_indicator, surf, 0);
-}
-
-static void
-_pol_wl_cb_hook_shell_surface_ready(void *d, E_Client *ec)
-{
- Eina_Bool res;
-
- if (EINA_UNLIKELY(!ec))
- return;
-
- _pol_wl_aux_hint_apply(ec);
-
- res = e_mod_pol_client_maximize(ec);
- if (res)
- {
- if ((ec->comp_data->shell.configure_send) &&
- (ec->comp_data->shell.surface))
- {
- ec->comp_data->shell.configure_send(ec->comp_data->shell.surface,
- 0, ec->w, ec->h);
- }
- }
-}
-
-// --------------------------------------------------------
-// public functions
-// --------------------------------------------------------
-void
-e_mod_pol_wl_client_add(E_Client *ec)
-{
- EINA_SAFETY_ON_NULL_RETURN(ec);
- if (!ec->pixmap) return;
-
- _pol_wl_surf_client_set(ec);
- _pol_wl_tzsh_client_set(ec);
- _pol_wl_pending_bg_client_set(ec);
-}
-
-void
-e_mod_pol_wl_client_del(E_Client *ec)
-{
- EINA_SAFETY_ON_NULL_RETURN(ec);
- if (!ec->pixmap) return;
-
- e_mod_pol_wl_pixmap_del(ec->pixmap);
- _pol_wl_tzsh_client_unset(ec);
- _pol_wl_dpy_surf_del(ec);
- _pol_wl_tz_indicator_unset_client(ec);
-
- polwl->pending_vis = eina_list_remove(polwl->pending_vis, ec);
-}
-
-void
-e_mod_pol_wl_pixmap_del(E_Pixmap *cp)
-{
- Pol_Wl_Tzpol *tzpol;
- Pol_Wl_Surface *psurf;
- Eina_List *l, *ll;
- Eina_Iterator *it;
-
- it = eina_hash_iterator_data_new(polwl->tzpols);
- EINA_ITERATOR_FOREACH(it, tzpol)
- EINA_LIST_FOREACH_SAFE(tzpol->psurfs, l, ll, psurf)
- {
- if (psurf->cp != cp) continue;
- tzpol->psurfs = eina_list_remove_list(tzpol->psurfs, l);
- _pol_wl_surf_del(psurf);
- }
- eina_iterator_free(it);
-}
-
-void
-e_mod_pol_wl_aux_hint_init(void)
-{
- int i, n;
- n = (sizeof(hint_names) / sizeof(char *));
-
- for (i = 0; i < n; i++)
- {
- e_hints_aux_hint_supported_add(hint_names[i]);
- }
- return;
-}
-
-Eina_Bool
-e_mod_pol_wl_defer_job(void)
-{
- struct wl_global *global = NULL;
- EINA_SAFETY_ON_NULL_GOTO(polwl, err);
-
- global = wl_global_create(e_comp_wl->wl.disp,
- &tizen_launchscreen_interface,
- 1,
- NULL,
- _tzlaunch_cb_bind);
- EINA_SAFETY_ON_NULL_GOTO(global, err);
-
- polwl->globals = eina_list_append(polwl->globals, global);
-
- return EINA_TRUE;
-
-err:
- return EINA_FALSE;
-}
-
-#undef E_COMP_WL_HOOK_APPEND
-#define E_COMP_WL_HOOK_APPEND(l, t, cb, d) \
- do \
- { \
- E_Comp_Wl_Hook *_h; \
- _h = e_comp_wl_hook_add(t, cb, d); \
- assert(_h); \
- l = eina_list_append(l, _h); \
- } \
- while (0)
-
-Eina_Bool
-e_mod_pol_wl_init(void)
-{
- struct wl_global *global;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl->wl.disp, EINA_FALSE);
-
- polwl = E_NEW(Pol_Wl, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(polwl, EINA_FALSE);
-
- /* create globals */
- global = wl_global_create(e_comp_wl->wl.disp,
- &tizen_policy_interface,
- 1,
- NULL,
- _tzpol_cb_bind);
- EINA_SAFETY_ON_NULL_GOTO(global, err);
- polwl->globals = eina_list_append(polwl->globals, global);
-
- global = wl_global_create(e_comp_wl->wl.disp,
- &tizen_display_policy_interface,
- 1,
- NULL,
- _tz_dpy_pol_cb_bind);
- EINA_SAFETY_ON_NULL_GOTO(global, err);
- polwl->globals = eina_list_append(polwl->globals, global);
-
- global = wl_global_create(e_comp_wl->wl.disp,
- &tizen_ws_shell_interface,
- 1,
- NULL,
- _tzsh_cb_bind);
- EINA_SAFETY_ON_NULL_GOTO(global, err);
- polwl->globals = eina_list_append(polwl->globals, global);
-
- global = wl_global_create(e_comp_wl->wl.disp,
- &tizen_indicator_interface,
- 1,
- NULL,
- _tz_indicator_cb_bind);
- EINA_SAFETY_ON_NULL_GOTO(global, err);
- polwl->globals = eina_list_append(polwl->globals, global);
-
- polwl->tzpols = eina_hash_pointer_new(_pol_wl_tzpol_del);
-
-#ifdef ENABLE_CYNARA
- if (cynara_initialize(&polwl->p_cynara, NULL) != CYNARA_API_SUCCESS)
- ERR("cynara_initialize failed.");
-#endif
-
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _pol_wl_cb_scrsaver_on, NULL);
- E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _pol_wl_cb_scrsaver_off, NULL);
-
- E_COMP_WL_HOOK_APPEND(hooks_cw, E_COMP_WL_HOOK_SHELL_SURFACE_READY, _pol_wl_cb_hook_shell_surface_ready, NULL);
-
- e_mod_pol_display_init();
-
- return EINA_TRUE;
-
-err:
- if (polwl)
- {
- EINA_LIST_FREE(polwl->globals, global)
- wl_global_destroy(global);
-
- E_FREE(polwl);
- }
- return EINA_FALSE;
-}
-
-void
-e_mod_pol_wl_shutdown(void)
-{
- Pol_Wl_Tzsh *tzsh;
- Pol_Wl_Tzsh_Srv *tzsh_srv;
- Pol_Wl_Tzlaunch *tzlaunch;
- Pol_Wl_Tz_Dpy_Pol *tz_dpy_pol;
- Pol_Wl_Tz_Indicator *tz_indicator;
- struct wl_global *global;
- int i;
-
- e_mod_pol_display_shutdown();
-
- EINA_SAFETY_ON_NULL_RETURN(polwl);
-
- E_FREE_LIST(hooks_cw, e_comp_wl_hook_del);
- E_FREE_LIST(handlers, ecore_event_handler_del);
-
- polwl->pending_vis = eina_list_free(polwl->pending_vis);
-
- for (i = 0; i < TZSH_SRV_ROLE_MAX; i++)
- {
- tzsh_srv = polwl->srvs[i];
- if (!tzsh_srv) continue;
-
- wl_resource_destroy(tzsh_srv->res_tzsh_srv);
- }
-
- EINA_LIST_FREE(polwl->tzshs, tzsh)
- wl_resource_destroy(tzsh->res_tzsh);
-
- EINA_LIST_FREE(polwl->tz_dpy_pols, tz_dpy_pol)
- {
- Pol_Wl_Dpy_Surface *dpy_surf;
- EINA_LIST_FREE(tz_dpy_pol->dpy_surfs, dpy_surf)
- {
- E_FREE(dpy_surf);
- }
- wl_resource_destroy(tz_dpy_pol->res_tz_dpy_pol);
- E_FREE(tz_dpy_pol);
- }
-
- EINA_LIST_FREE(polwl->tzlaunchs, tzlaunch)
- wl_resource_destroy(tzlaunch->res_tzlaunch);
-
- EINA_LIST_FREE(polwl->tz_indicators, tz_indicator)
- wl_resource_destroy(tz_indicator->res_tz_indicator);
-
- EINA_LIST_FREE(polwl->globals, global)
- wl_global_destroy(global);
-
- E_FREE_FUNC(polwl->tzpols, eina_hash_free);
-
-#ifdef ENABLE_CYNARA
- if (polwl->p_cynara)
- cynara_finish(polwl->p_cynara);
-#endif
-
- E_FREE(polwl);
-}
+++ /dev/null
-#ifndef E_MOD_WL_H
-#define E_MOD_WL_H
-
-#include "config.h"
-#ifdef HAVE_WAYLAND_ONLY
-#include <e.h>
-
-Eina_Bool e_mod_pol_wl_init(void);
-void e_mod_pol_wl_shutdown(void);
-Eina_Bool e_mod_pol_wl_defer_job(void);
-void e_mod_pol_wl_client_add(E_Client *ec);
-void e_mod_pol_wl_client_del(E_Client *ec);
-void e_mod_pol_wl_pixmap_del(E_Pixmap *cp);
-
-/* visibility */
-void e_mod_pol_wl_visibility_send(E_Client *ec, int vis);
-
-/* iconify */
-void e_mod_pol_wl_iconify_state_change_send(E_Client *ec, int iconic);
-
-/* position */
-void e_mod_pol_wl_position_send(E_Client *ec);
-
-/* notification */
-void e_mod_pol_wl_notification_level_fetch(E_Client *ec);
-
-/* window screenmode */
-void e_mod_pol_wl_win_scrmode_apply(void);
-
-/* aux_hint */
-void e_mod_pol_wl_aux_hint_init(void);
-void e_mod_pol_wl_eval_pre_post_fetch(E_Client *ec);
-
-/* window brightness */
-Eina_Bool e_mod_pol_wl_win_brightness_apply(E_Client *ec);
-
-/* tzsh quickpanel */
-EINTERN void e_tzsh_qp_state_visible_update(E_Client *ec, Eina_Bool vis);
-EINTERN void e_tzsh_qp_state_orientation_update(E_Client *ec, int ridx);
-EINTERN void e_tzsh_qp_state_scrollable_update(E_Client *ec, Eina_Bool scrollable);
-
-/* tzsh indicator */
-EINTERN void e_tzsh_indicator_srv_property_update(E_Client *ec);
-EINTERN void e_tzsh_indicator_srv_ower_win_update(E_Zone *zone);
-
-
-/* indicator */
-void e_mod_pol_wl_indicator_flick_send(E_Client *ec);
-
-#endif /* HAVE_WAYLAND_ONLY */
-#endif /* E_MOD_WL_H */
+++ /dev/null
-#include "e_mod_wl_display.h"
-#include "e_mod_utils.h"
-
-typedef struct _E_Display_Dbus_Info
-{
- Eldbus_Connection *conn;
-} E_Display_Dbus_Info;
-
-#define BUS_NAME "org.enlightenment.wm"
-
-#define DEVICED_DEST "org.tizen.system.deviced"
-#define DEVICED_PATH "/Org/Tizen/System/DeviceD/Display"
-#define DEVICED_IFACE "org.tizen.system.deviced.display"
-#define DEVICED_LOCK_STATE "lockstate"
-#define DEVICED_UNLOCK_STATE "unlockstate"
-
-#define DEVICED_LCDON "lcdon"
-#define DEVICED_STAY_CUR_STATE "staycurstate"
-#define DEVICED_SLEEP_MARGIN "sleepmargin"
-
-/* static global variables */
-static E_Display_Dbus_Info _e_display_dbus_info;
-static Eina_List *_display_control_hooks = NULL;
-
-/* for screen mode */
-static Eina_List *_screen_mode_client_list = NULL;
-static E_Display_Screen_Mode _e_display_screen_mode;
-
-/* static functions */
-static Eina_Bool _e_mod_pol_display_dbus_init(void);
-static void _e_mod_pol_display_dbus_shutdown(void);
-static void _e_mod_pol_display_dbus_request_name_cb(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED);
-
-static Eina_Bool _e_mod_wl_display_client_add_to_list(Eina_List** list, E_Client *ec);
-static Eina_Bool _e_mod_wl_display_client_remove_from_list(Eina_List** list, E_Client *ec);
-
-static void _e_mod_wl_display_hook_client_del(void *d EINA_UNUSED, E_Client *ec);
-static void _e_mod_wl_display_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec);
-
-/* for screen mode */
-static Eina_Bool _e_mod_wl_display_screen_mode_find_visible_window(void);
-static void _e_mod_wl_display_screen_mode_send(E_Display_Screen_Mode mode);
-
-
-static Eina_Bool
-_e_mod_pol_display_dbus_init(void)
-{
- if (eldbus_init() == 0) return EINA_FALSE;
-
- _e_display_dbus_info.conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
- EINA_SAFETY_ON_NULL_GOTO(_e_display_dbus_info.conn, failed);
-
- eldbus_name_request(_e_display_dbus_info.conn,
- BUS_NAME,
- ELDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE,
- _e_mod_pol_display_dbus_request_name_cb,
- NULL);
-
- return EINA_TRUE;
-
-failed:
- _e_mod_pol_display_dbus_shutdown();
- return EINA_FALSE;
-}
-
-static void
-_e_mod_pol_display_dbus_shutdown(void)
-{
- if (_e_display_dbus_info.conn)
- {
- eldbus_name_release(_e_display_dbus_info.conn, BUS_NAME, NULL, NULL);
- eldbus_connection_unref(_e_display_dbus_info.conn);
- _e_display_dbus_info.conn = NULL;
- }
-
- eldbus_shutdown();
-}
-
-static void
-_e_mod_pol_display_dbus_request_name_cb(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
-{
- unsigned int flag;
-
- if (eldbus_message_error_get(msg, NULL, NULL))
- {
- ERR("Could not request bus name");
- return;
- }
-
- if (!eldbus_message_arguments_get(msg, "u", &flag))
- {
- ERR("Could not get arguments on on_name_request");
- return;
- }
-
- if (!(flag & ELDBUS_NAME_REQUEST_REPLY_PRIMARY_OWNER))
- {
- WRN("Name already in use\n");
- }
-}
-
-static Eina_Bool
-_e_mod_wl_display_client_add_to_list(Eina_List** list, E_Client *ec)
-{
- if (!ec) return EINA_FALSE;
-
- if (eina_list_data_find(*list, ec) == ec)
- return EINA_TRUE;
-
- *list = eina_list_append(*list, ec);
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_e_mod_wl_display_client_remove_from_list(Eina_List** list, E_Client *ec)
-{
- if (!ec) return EINA_FALSE;
-
- if (!eina_list_data_find(*list, ec))
- return EINA_FALSE;
-
- *list = eina_list_remove(*list, ec);
-
- return EINA_TRUE;
-}
-
-static void
-_e_mod_wl_display_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
-{
- _e_mod_wl_display_client_remove_from_list(&_screen_mode_client_list, ec);
-}
-
-static void
-_e_mod_wl_display_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec)
-{
- if (ec->visibility.changed)
- {
- e_mod_pol_display_screen_mode_apply();
- }
-}
-
-static Eina_Bool
-_e_mod_wl_display_screen_mode_find_visible_window(void)
-{
- Eina_List *l = NULL;
- E_Client *ec = NULL;
- Eina_Bool find = EINA_FALSE;
- int ec_visibility;
-
- if (_screen_mode_client_list == NULL) return EINA_FALSE;
-
- EINA_LIST_FOREACH(_screen_mode_client_list, l, ec)
- {
- if (e_object_is_del(E_OBJECT(ec)))
- ec_visibility = E_VISIBILITY_FULLY_OBSCURED;
- else
- ec_visibility = ec->visibility.obscured;
-
- if ((ec_visibility == E_VISIBILITY_UNOBSCURED) ||
- (ec_visibility == E_VISIBILITY_PARTIALLY_OBSCURED))
- {
- find = EINA_TRUE;
- break;
- }
- }
-
- return find;
-}
-
-static void
-_e_mod_wl_display_screen_mode_send(E_Display_Screen_Mode mode)
-{
- Eldbus_Message *msg;
- Eina_Bool ret;
- unsigned int timeout = 0;
-
- if (!_e_display_dbus_info.conn) return;
-
- if (mode == E_DISPLAY_SCREEN_MODE_ALWAYS_ON)
- {
- msg = eldbus_message_method_call_new(DEVICED_DEST,
- DEVICED_PATH,
- DEVICED_IFACE,
- DEVICED_LOCK_STATE);
- if (!msg) return;
-
- ret = eldbus_message_arguments_append(msg, "sssi",
- DEVICED_LCDON,
- DEVICED_STAY_CUR_STATE,
- "",
- timeout);
- }
- else
- {
- msg = eldbus_message_method_call_new(DEVICED_DEST,
- DEVICED_PATH,
- DEVICED_IFACE,
- DEVICED_UNLOCK_STATE);
- if (!msg) return;
-
- ret = eldbus_message_arguments_append(msg, "ss",
- DEVICED_LCDON,
- DEVICED_SLEEP_MARGIN);
- }
-
- if (!ret)
- {
- if (msg)
- eldbus_message_unref(msg);
-
- return;
- }
-
- _e_display_screen_mode = mode;
- DBG("[SCREEN_MODE] Request screen mode:%d\n", mode);
-
- eldbus_connection_send(_e_display_dbus_info.conn, msg, NULL, NULL, -1);
-}
-
-Eina_Bool
-e_mod_pol_display_init(void)
-{
- if (!_e_mod_pol_display_dbus_init()) return EINA_FALSE;
-
- _e_display_screen_mode = E_DISPLAY_SCREEN_MODE_DEFAULT;
-
- /* hook functions */
- E_CLIENT_HOOK_APPEND(_display_control_hooks, E_CLIENT_HOOK_DEL, _e_mod_wl_display_hook_client_del, NULL);
- E_CLIENT_HOOK_APPEND(_display_control_hooks, E_CLIENT_HOOK_EVAL_VISIBILITY, _e_mod_wl_display_hook_client_visibility, NULL);
-
- return EINA_TRUE;
-}
-
-void
-e_mod_pol_display_shutdown(void)
-{
- E_FREE_LIST(_display_control_hooks, e_client_hook_del);
-
- if (_screen_mode_client_list) eina_list_free(_screen_mode_client_list);
-
- _e_mod_pol_display_dbus_shutdown();
-}
-
-void
-e_mod_pol_display_screen_mode_set(E_Client *ec, int mode)
-{
- if (!ec) return;
- if (e_object_is_del(E_OBJECT(ec))) return;
-
- if (mode == 0)
- {
- _e_mod_wl_display_client_remove_from_list(&_screen_mode_client_list, ec);
- e_mod_pol_display_screen_mode_apply();
- }
- else
- {
- _e_mod_wl_display_client_add_to_list(&_screen_mode_client_list, ec);
- e_mod_pol_display_screen_mode_apply();
- }
-}
-
-void
-e_mod_pol_display_screen_mode_apply(void)
-{
- /* check the _screen_mode_client_list and update the lcd locked status */
- if (_e_mod_wl_display_screen_mode_find_visible_window())
- {
- if (_e_display_screen_mode == E_DISPLAY_SCREEN_MODE_DEFAULT)
- _e_mod_wl_display_screen_mode_send(E_DISPLAY_SCREEN_MODE_ALWAYS_ON);
- }
- else
- {
- if (_e_display_screen_mode == E_DISPLAY_SCREEN_MODE_ALWAYS_ON)
- _e_mod_wl_display_screen_mode_send(E_DISPLAY_SCREEN_MODE_DEFAULT);
- }
-}
-
+++ /dev/null
-#ifndef E_MOD_WL_DISPLAY_CONTROL_H
-#define E_MOD_WL_H
-
-#define E_COMP_WL
-#include <e.h>
-
-typedef enum _E_Display_Screen_Mode
-{
- E_DISPLAY_SCREEN_MODE_DEFAULT = 0,
- E_DISPLAY_SCREEN_MODE_ALWAYS_ON = 1,
-} E_Display_Screen_Mode;
-
-Eina_Bool e_mod_pol_display_init(void);
-void e_mod_pol_display_shutdown(void);
-
-void e_mod_pol_display_screen_mode_set(E_Client *ec, int mode);
-void e_mod_pol_display_screen_mode_apply(void);
-
-#endif
* license.
*/
#include "e_mod_rotation.h"
-#include "e_mod_utils.h"
#include "e_mod_rotation_private.h"
#ifdef HAVE_AUTO_ROTATION
+++ /dev/null
-#include "e_mod_main.h"
-#include "e_mod_gesture.h"
-
-struct _Pol_Gesture
-{
- Evas_Object *obj;
- Pol_Gesture_Type type;
-
- Eina_Bool active;
- int angle;
-
- struct
- {
- int x;
- int y;
- int timestamp;
- Eina_Bool pressed; /* to avoid processing that happened mouse move right after mouse up */
- } mouse_info;
-
- struct
- {
- Pol_Gesture_Start_Cb start;
- Pol_Gesture_Move_Cb move;
- Pol_Gesture_End_Cb end;
- void *data;
- } cb;
-};
-
-static void
-_gesture_obj_cb_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj, void *event)
-{
- Pol_Gesture *gesture = data;
- Evas_Event_Mouse_Up *ev = event;
-
- gesture->mouse_info.pressed = EINA_FALSE;
-
- if (!gesture->active)
- return;
-
- gesture->active = EINA_FALSE;
-
- if (gesture->cb.end)
- gesture->cb.end(gesture->cb.data, obj, ev->canvas.x, ev->canvas.y, ev->timestamp);
-}
-
-static Eina_Bool
-_gesture_line_check(Pol_Gesture *gesture, int x, int y)
-{
- int dx, dy;
- const int sensitivity = 50; /* FIXME: hard coded, it sould be configurable. */
-
- dx = x - gesture->mouse_info.x;
- dy = y - gesture->mouse_info.y;
-
- if (gesture->angle == 0 || gesture->angle == 180)
- {
- if (abs(dy) < sensitivity)
- return EINA_FALSE;
- }
- else if (gesture->angle == 90 || gesture->angle == 270)
- {
- if (abs(dx) < sensitivity)
- return EINA_FALSE;
- }
- else
- {
- if ((abs(dy) < sensitivity) &&
- (abs(dx) < sensitivity))
- return EINA_FALSE;
- }
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_gesture_flick_check(Pol_Gesture *gesture, Evas_Object *obj, int x, int y, unsigned int timestamp)
-{
- int dy;
- int ox, oy, ow, oh;
- unsigned int dt;
- float vel = 0.0;
- const float sensitivity = 0.25; /* FIXME: hard coded, it sould be configurable. */
-
- evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
- if (!E_INSIDE(x, y, ox, oy, ow, oh))
- return EINA_FALSE;
-
- dy = y - gesture->mouse_info.y;
- dt = timestamp - gesture->mouse_info.timestamp;
- if (dt == 0)
- return EINA_FALSE;
-
- vel = (float)dy / (float)dt;
- if (fabs(vel) < sensitivity)
- return EINA_FALSE;
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_gesture_check(Pol_Gesture *gesture, Evas_Object *obj, int x, int y, unsigned int timestamp)
-{
- Eina_Bool ret = EINA_FALSE;
-
- switch (gesture->type)
- {
- case POL_GESTURE_TYPE_NONE:
- ret = EINA_TRUE;
- break;
- case POL_GESTURE_TYPE_LINE:
- ret = _gesture_line_check(gesture, x, y);
- break;
- case POL_GESTURE_TYPE_FLICK:
- ret = _gesture_flick_check(gesture, obj, x, y, timestamp);
- break;
- default:
- ERR("Unknown gesture type %d", gesture->type);
- break;
- }
-
- return ret;
-}
-
-static void
-_gesture_obj_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj, void *event)
-{
- Pol_Gesture *gesture = data;
- Evas_Event_Mouse_Move *ev = event;
- int x, y;
- unsigned int timestamp;
-
- if (!gesture->mouse_info.pressed)
- return;
-
- x = ev->cur.canvas.x;
- y = ev->cur.canvas.y;
- timestamp = ev->timestamp;
-
- if (!gesture->active)
- {
- gesture->active = _gesture_check(gesture, obj, x, y, timestamp);
- if (gesture->active)
- {
- /* if gesture is activated, terminate main touch event processing
- * in enlightenment */
- if (gesture->type != POL_GESTURE_TYPE_NONE)
- e_comp_wl_touch_cancel();
-
- if (gesture->cb.start)
- gesture->cb.start(gesture->cb.data, obj, x, y, timestamp);
- }
- return;
- }
-
- if (gesture->cb.move)
- gesture->cb.move(gesture->cb.data, obj, x, y, timestamp);
-}
-
-static void
-_gesture_obj_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj, void *event)
-{
- Pol_Gesture *gesture = data;
- Evas_Event_Mouse_Down *ev = event;
-
- gesture->active = EINA_FALSE;
- gesture->mouse_info.pressed = EINA_TRUE;
- gesture->mouse_info.x = ev->canvas.x;
- gesture->mouse_info.y = ev->canvas.y;
- gesture->mouse_info.timestamp = ev->timestamp;
-
- gesture->active = _gesture_check(gesture, obj, ev->canvas.x, ev->canvas.y, ev->timestamp);
- if (gesture->active)
- {
- if (gesture->cb.start)
- gesture->cb.start(gesture->cb.data, obj, ev->canvas.x, ev->canvas.y, ev->timestamp);
- }
-}
-
-EINTERN Pol_Gesture *
-e_mod_gesture_add(Evas_Object *obj, Pol_Gesture_Type type)
-{
- Pol_Gesture *gesture;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
-
- gesture = E_NEW(Pol_Gesture, 1);
- if (EINA_UNLIKELY(gesture == NULL))
- return NULL;
-
- gesture->obj = obj;
- gesture->type = type;
-
- /* we should to repeat mouse event to below object
- * until we can make sure gesture */
- if (type != POL_GESTURE_TYPE_NONE)
- evas_object_repeat_events_set(obj, EINA_TRUE);
-
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
- _gesture_obj_cb_mouse_down, gesture);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE,
- _gesture_obj_cb_mouse_move, gesture);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
- _gesture_obj_cb_mouse_up, gesture);
-
- return gesture;
-}
-
-EINTERN void
-e_mod_gesture_del(Pol_Gesture *gesture)
-{
- EINA_SAFETY_ON_NULL_RETURN(gesture);
-
- evas_object_event_callback_del(gesture->obj, EVAS_CALLBACK_MOUSE_DOWN,
- _gesture_obj_cb_mouse_down);
- evas_object_event_callback_del(gesture->obj, EVAS_CALLBACK_MOUSE_MOVE,
- _gesture_obj_cb_mouse_move);
- evas_object_event_callback_del(gesture->obj, EVAS_CALLBACK_MOUSE_UP,
- _gesture_obj_cb_mouse_up);
-
- free(gesture);
-}
-
-EINTERN void
-e_mod_gesture_cb_set(Pol_Gesture *gesture, Pol_Gesture_Start_Cb cb_start, Pol_Gesture_Move_Cb cb_move, Pol_Gesture_End_Cb cb_end, void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN(gesture);
-
- gesture->cb.start = cb_start;
- gesture->cb.move = cb_move;
- gesture->cb.end = cb_end;
- gesture->cb.data = data;
-}
-
-EINTERN void
-e_mod_gesture_angle_set(Pol_Gesture *gesture, int angle)
-{
- EINA_SAFETY_ON_NULL_RETURN(gesture);
- gesture->angle = angle;
-}
+++ /dev/null
-#ifndef E_MOD_GESTURE
-#define E_MOD_GESTURE
-
-typedef struct _Pol_Gesture Pol_Gesture;
-
-typedef enum
-{
- POL_GESTURE_TYPE_NONE,
- POL_GESTURE_TYPE_LINE,
- POL_GESTURE_TYPE_FLICK,
-} Pol_Gesture_Type;
-
-typedef void (*Pol_Gesture_Start_Cb)(void *data, Evas_Object *obj, int x, int y, unsigned int timestamp);
-typedef void (*Pol_Gesture_Move_Cb)(void *data, Evas_Object *obj, int x, int y, unsigned int timestamp);
-typedef void (*Pol_Gesture_End_Cb)(void *data, Evas_Object *obj, int x, int y, unsigned int timestamp);
-
-EINTERN Pol_Gesture *e_mod_gesture_add(Evas_Object *obj, Pol_Gesture_Type type);
-EINTERN void e_mod_gesture_del(Pol_Gesture *gesture);
-EINTERN void e_mod_gesture_cb_set(Pol_Gesture *gesture, Pol_Gesture_Start_Cb cb_start, Pol_Gesture_Move_Cb cb_move, Pol_Gesture_End_Cb cb_end, void *data);
-EINTERN void e_mod_gesture_angle_set(Pol_Gesture *gesture, int angle);
-
-
-#endif /* E_MOD_GESTURE */
+++ /dev/null
-#include "e_mod_main.h"
-#include "e_mod_indicator.h"
-#include "e_mod_wl.h"
-
-
-static E_Client *_ind_server = NULL;
-static E_Client *_ind_owner = NULL;
-
-/* event handler */
-static Eina_List *_ind_handlers = NULL;
-static Eina_List *_ind_hooks = NULL;
-
-static Eina_Bool
-_indicator_cb_rot_done(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Client *ec = NULL;
- E_Event_Client_Rotation_Change_End *ev = NULL;
-
- ev = event;
- EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON);
-
- ec = ev->ec;
- if (ec == _ind_owner)
- {
- e_tzsh_indicator_srv_property_update(ec);
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_indicator_client_unset(void)
-{
- E_FREE_LIST(_ind_handlers, ecore_event_handler_del);
- _ind_handlers = NULL;
-
- E_FREE_LIST(_ind_hooks, e_client_hook_del);
- _ind_hooks = NULL;
-
- _ind_server = NULL;
-}
-
-static void
-_indicator_cb_client_del(void *d EINA_UNUSED, E_Client *ec)
-{
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- if (_ind_server != ec) return;
-
- _indicator_client_unset();
-}
-
-EINTERN Eina_Bool
-e_mod_indicator_client_set(E_Client *ec)
-{
- if (!ec)
- {
- if (_ind_server)
- _indicator_client_unset();
-
- return EINA_TRUE;
- }
-
- if (_ind_server)
- {
- ERR("Indicater service is already registered."
- "Multi indicator service is not supported.");
- return EINA_FALSE;
- }
-
- if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
-
- ELOGF("TZ_IND", "Set indicator service", ec->pixmap, ec);
-
- eina_stringshare_replace(&ec->icccm.window_role, "indicator");
-
- E_LIST_HANDLER_APPEND(_ind_handlers, E_EVENT_CLIENT_ROTATION_CHANGE_END, _indicator_cb_rot_done, NULL);
- E_LIST_HOOK_APPEND(_ind_hooks, E_CLIENT_HOOK_DEL, _indicator_cb_client_del, NULL);
-
- _ind_server = ec;
- if (!_ind_owner)
- _ind_owner = e_client_focused_get();
-
- return EINA_TRUE;
-}
-
-EINTERN void
-e_mod_indicator_owner_set(E_Client *ec)
-{
- _ind_owner = ec;
-}
-
-EINTERN E_Client *
-e_mod_indicator_owner_get(void)
-{
- return _ind_owner;
-}
-
-
+++ /dev/null
-#ifndef E_MOD_INDICATOR_H
-#define E_MOD_INDICATOR_H
-
-EINTERN Eina_Bool e_mod_indicator_client_set(E_Client *ec);
-
-EINTERN void e_mod_indicator_owner_set(E_Client *ec);
-EINTERN E_Client *e_mod_indicator_owner_get(void);
-
-
-#endif
+++ /dev/null
-#include "e_mod_main.h"
-#include "e_mod_lockscreen.h"
-
-EINTERN Eina_Bool
-e_mod_lockscreen_client_set(E_Client *ec)
-{
- if (!ec) return EINA_TRUE;
- if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
-
- ELOGF("LOCKSCREEN","Set Client", ec->pixmap, ec);
-
- eina_stringshare_replace(&ec->icccm.window_role, "lockscreen");
-
- // set lockscreen layer
- if (E_LAYER_CLIENT_NOTIFICATION_LOW > evas_object_layer_get(ec->frame))
- {
- evas_object_layer_set(ec->frame, E_LAYER_CLIENT_NOTIFICATION_LOW);
- ec->layer = E_LAYER_CLIENT_NOTIFICATION_LOW;
- }
-
- return EINA_TRUE;
-}
-
+++ /dev/null
-#ifndef E_MOD_LOCKSCREEN_H
-#define E_MOD_LOCKSCREEN_H
-
-EINTERN Eina_Bool e_mod_lockscreen_client_set(E_Client *ec);
-
-#endif
+++ /dev/null
-#include "e_mod_private_data.h"
-#include "e_mod_main.h"
-#include "e_mod_quickpanel.h"
-#include "e_mod_gesture.h"
-#include "e_mod_region.h"
-#include "e_mod_rotation.h"
-#include "e_mod_wl.h"
-
-#define SMART_NAME "quickpanel_object"
-#define INTERNAL_ENTRY \
- Mover_Data *md; \
- md = evas_object_smart_data_get(obj)
-
-#define QP_SHOW(EC) \
-do \
-{ \
- EC->visible = EINA_TRUE; \
- evas_object_show(EC->frame); \
-} while (0)
-
-#define QP_HIDE(EC) \
-do \
-{ \
- EC->visible = EINA_FALSE; \
- evas_object_hide(EC->frame); \
-} while (0)
-
-#define QP_VISIBLE_SET(EC, VIS) \
-do \
-{ \
- if (VIS) QP_SHOW(EC); \
- else QP_HIDE(EC); \
-} while(0)
-
-typedef struct _Pol_Quickpanel Pol_Quickpanel;
-typedef struct _Mover_Data Mover_Data;
-typedef struct _Mover_Effect_Data Mover_Effect_Data;
-
-typedef struct _E_QP_Client E_QP_Client;
-
-struct _Pol_Quickpanel
-{
- E_Client *ec;
- E_Client *below;
- E_Client *stacking;
- Evas_Object *mover;
- Evas_Object *indi_obj;
- Evas_Object *handler_obj;
-
- Eina_List *intercept_hooks;
- Eina_List *hooks;
- Eina_List *events;
- Ecore_Idle_Enterer *idle_enterer;
- Ecore_Event_Handler *buf_change_hdlr;
-
- struct
- {
- Eina_Bool below;
- } changes;
-
- Rot_Idx rotation;
-
- Eina_Bool show_block;
-
- Eina_List *clients; /* list of E_QP_Client */
-};
-
-struct _Mover_Data
-{
- Pol_Quickpanel *qp;
- E_Client *ec;
-
- Evas_Object *smart_obj; //smart object
- Evas_Object *qp_layout_obj; // quickpanel's e_layout_object
- Evas_Object *handler_mirror_obj; // quickpanel handler mirror object
- Evas_Object *base_clip; // clipper for quickapnel base object
- Evas_Object *handler_clip; // clipper for quickpanel handler object
-
- Eina_Rectangle handler_rect;
- Rot_Idx rotation;
-
- struct
- {
- Ecore_Animator *animator;
- Mover_Effect_Data *data;
- int x, y;
- unsigned int timestamp;
- float accel;
- Eina_Bool visible;
- } effect_info;
-};
-
-struct _Mover_Effect_Data
-{
- Ecore_Animator *animator;
- Evas_Object *mover;
- int from;
- int to;
- Eina_Bool visible : 1;
-};
-
-struct _E_QP_Client
-{
- E_Client *ec;
- struct
- {
- Eina_Bool vis;
- Eina_Bool scrollable;
- } hint;
-};
-
-static Pol_Quickpanel *_pol_quickpanel = NULL;
-static Evas_Smart *_mover_smart = NULL;
-static Eina_Bool _changed = EINA_FALSE;
-
-static E_QP_Client * _e_qp_client_ec_get(E_Client *ec);
-static Eina_Bool _e_qp_client_scrollable_update(void);
-
-static Pol_Quickpanel *
-_quickpanel_get()
-{
- return _pol_quickpanel;
-}
-
-static void
-_mover_intercept_show(void *data, Evas_Object *obj)
-{
- Mover_Data *md;
- E_Client *ec;
- Evas *e;
-
- md = data;
- md->qp->show_block = EINA_FALSE;
-
- ec = md->ec;
- QP_SHOW(ec);
-
- /* force update */
- e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
- e_comp_object_dirty(ec->frame);
- e_comp_object_render(ec->frame);
-
- // create base_clip
- e = evas_object_evas_get(obj);
- md->base_clip = evas_object_rectangle_add(e);
- e_layout_pack(md->qp_layout_obj, md->base_clip);
- e_layout_child_move(md->base_clip, 0, 0);
- e_layout_child_resize(md->base_clip, ec->w, ec->h);
- evas_object_color_set(md->base_clip, 255, 255, 255, 255);
- evas_object_show(md->base_clip);
- evas_object_clip_set(ec->frame, md->base_clip);
-
- // create handler_mirror_obj
- md->handler_mirror_obj = e_comp_object_util_mirror_add(ec->frame);
- e_layout_pack(md->qp_layout_obj, md->handler_mirror_obj);
- e_layout_child_move(md->handler_mirror_obj, ec->x, ec->y);
- e_layout_child_resize(md->handler_mirror_obj, ec->w, ec->h);
- evas_object_show(md->handler_mirror_obj);
-
- // create handler_clip
- md->handler_clip = evas_object_rectangle_add(e);
- e_layout_pack(md->qp_layout_obj, md->handler_clip);
- e_layout_child_move(md->handler_clip, md->handler_rect.x, md->handler_rect.y);
- e_layout_child_resize(md->handler_clip, md->handler_rect.w, md->handler_rect.h);
- evas_object_color_set(md->handler_clip, 255, 255, 255, 255);
- evas_object_show(md->handler_clip);
- evas_object_clip_set(md->handler_mirror_obj, md->handler_clip);
-
- evas_object_show(obj);
-}
-
-static void
-_mover_smart_add(Evas_Object *obj)
-{
- Mover_Data *md;
-
- md = E_NEW(Mover_Data, 1);
- if (EINA_UNLIKELY(!md))
- return;
-
- md->smart_obj = obj;
- md->qp_layout_obj = e_layout_add(evas_object_evas_get(obj));
- evas_object_color_set(md->qp_layout_obj, 255, 255, 255, 255);
- evas_object_smart_member_add(md->qp_layout_obj, md->smart_obj);
-
- evas_object_smart_data_set(obj, md);
-
- evas_object_move(obj, -1 , -1);
- evas_object_layer_set(obj, EVAS_LAYER_MAX - 1); // EVAS_LAYER_MAX :L cursor layer
- evas_object_intercept_show_callback_add(obj, _mover_intercept_show, md);
-}
-
-static void
-_mover_smart_del(Evas_Object *obj)
-{
- E_Client *ec;
-
- INTERNAL_ENTRY;
-
- ec = md->qp->ec;
- if (md->base_clip)
- {
- evas_object_clip_unset(md->base_clip);
- e_layout_unpack(md->base_clip);
- evas_object_del(md->base_clip);
- }
- if (md->handler_clip)
- {
- evas_object_clip_unset(md->handler_clip);
- e_layout_unpack(md->handler_clip);
- evas_object_del(md->handler_clip);
- }
- if (md->handler_mirror_obj)
- {
- e_layout_unpack(md->handler_mirror_obj);
- evas_object_del(md->handler_mirror_obj);
- }
-
- if (md->qp_layout_obj) evas_object_del(md->qp_layout_obj);
-
- evas_object_color_set(ec->frame, ec->netwm.opacity, ec->netwm.opacity, ec->netwm.opacity, ec->netwm.opacity);
-
- md->qp->mover = NULL;
-
- e_zone_rotation_block_set(md->qp->ec->zone, "quickpanel-mover", EINA_FALSE);
-
- free(md);
-}
-
-static void
-_mover_smart_show(Evas_Object *obj)
-{
- INTERNAL_ENTRY;
-
- evas_object_show(md->qp_layout_obj);
-}
-
-static void
-_mover_smart_hide(Evas_Object *obj)
-{
- INTERNAL_ENTRY;
-
- evas_object_hide(md->qp_layout_obj);
-}
-
-static void
-_mover_smart_move(Evas_Object *obj, int x, int y)
-{
- INTERNAL_ENTRY;
-
- evas_object_move(md->qp_layout_obj, x, y);
-}
-
-static void
-_mover_smart_resize(Evas_Object *obj, int w, int h)
-{
- INTERNAL_ENTRY;
-
- e_layout_virtual_size_set(md->qp_layout_obj, w, h);
- evas_object_resize(md->qp_layout_obj, w, h);
-}
-
-static void
-_mover_smart_init(void)
-{
- if (_mover_smart) return;
- {
- static const Evas_Smart_Class sc =
- {
- SMART_NAME,
- EVAS_SMART_CLASS_VERSION,
- _mover_smart_add,
- _mover_smart_del,
- _mover_smart_move,
- _mover_smart_resize,
- _mover_smart_show,
- _mover_smart_hide,
- NULL, /* color_set */
- NULL, /* clip_set */
- NULL, /* clip_unset */
- NULL, /* calculate */
- NULL, /* member_add */
- NULL, /* member_del */
-
- NULL, /* parent */
- NULL, /* callbacks */
- NULL, /* interfaces */
- NULL /* data */
- };
- _mover_smart = evas_smart_class_new(&sc);
- }
-}
-
-static Eina_Bool
-_mover_obj_handler_move(Mover_Data *md, int x, int y)
-{
- E_Zone *zone;
- E_Client *ec;
-
- ec = md->ec;
- zone = ec->zone;
- switch (md->rotation)
- {
- case ROT_IDX_90:
- if ((x + md->handler_rect.w) > zone->w) return EINA_FALSE;
-
- md->handler_rect.x = x;
- e_layout_child_resize(md->base_clip, md->handler_rect.x, ec->h);
- e_layout_child_move(md->handler_mirror_obj, md->handler_rect.x - ec->w + md->handler_rect.w, md->handler_rect.y);
- e_layout_child_move(md->handler_clip, md->handler_rect.x, md->handler_rect.y);
- break;
- case ROT_IDX_180:
- if ((y - md->handler_rect.h) < 0) return EINA_FALSE;
-
- md->handler_rect.y = y;
- e_layout_child_move(md->base_clip, md->handler_rect.x, md->handler_rect.y);
- e_layout_child_resize(md->base_clip, ec->w, ec->h - md->handler_rect.y);
- e_layout_child_move(md->handler_mirror_obj, md->handler_rect.x, md->handler_rect.y - md->handler_rect.h);
- e_layout_child_move(md->handler_clip, md->handler_rect.x, md->handler_rect.y - md->handler_rect.h);
- break;
- case ROT_IDX_270:
- if ((x - md->handler_rect.w) < 0) return EINA_FALSE;
-
- md->handler_rect.x = x;
- e_layout_child_move(md->base_clip, md->handler_rect.x, md->handler_rect.y);
- e_layout_child_resize(md->base_clip, ec->w - md->handler_rect.x, ec->h);
- e_layout_child_move(md->handler_mirror_obj, md->handler_rect.x - md->handler_rect.w, md->handler_rect.y);
- e_layout_child_move(md->handler_clip, md->handler_rect.x - md->handler_rect.w, md->handler_rect.y);
- break;
- default:
- if ((y + md->handler_rect.h) > zone->h) return EINA_FALSE;
-
- md->handler_rect.y = y;
- e_layout_child_resize(md->base_clip, ec->w, md->handler_rect.y);
- e_layout_child_move(md->handler_mirror_obj, md->handler_rect.x, md->handler_rect.y - ec->h + md->handler_rect.h);
- e_layout_child_move(md->handler_clip, md->handler_rect.x, md->handler_rect.y);
- }
-
- return EINA_TRUE;
-}
-
-static Evas_Object *
-_mover_obj_new(Pol_Quickpanel *qp)
-{
- Evas_Object *mover;
- Mover_Data *md;
- int x, y, w, h;
-
- /* Pause WM Rotation during mover object is working. */
- e_zone_rotation_block_set(qp->ec->zone, "quickpanel-mover", EINA_TRUE);
-
- _mover_smart_init();
- mover = evas_object_smart_add(evas_object_evas_get(qp->ec->frame), _mover_smart);
-
- /* Should setup 'md' before call evas_object_show() */
- md = evas_object_smart_data_get(mover);
- md->qp = qp;
- md->ec = qp->ec;
- md->rotation = qp->rotation;
-
- e_mod_region_rectangle_get(qp->handler_obj, qp->rotation, &x, &y, &w, &h);
- EINA_RECTANGLE_SET(&md->handler_rect, x, y, w, h);
-
- evas_object_move(mover, 0, 0);
- evas_object_resize(mover, qp->ec->w, qp->ec->h);
- evas_object_show(mover);
-
- qp->mover = mover;
- qp->show_block = EINA_FALSE;
-
- return mover;
-}
-
-static Evas_Object *
-_mover_obj_new_with_move(Pol_Quickpanel *qp, int x, int y, unsigned int timestamp)
-{
- Evas_Object *mover;
- Mover_Data *md;
-
- mover = _mover_obj_new(qp);
- if (!mover)
- return NULL;
-
- md = evas_object_smart_data_get(mover);
- md->effect_info.x = x;
- md->effect_info.y = y;
- md->effect_info.timestamp = timestamp;
-
- _mover_obj_handler_move(md, x, y);
-
- return mover;
-}
-
-static void
-_mover_obj_visible_set(Evas_Object *mover, Eina_Bool visible)
-{
- Mover_Data *md;
- E_Client *ec;
- int x = 0, y = 0;
-
- md = evas_object_smart_data_get(mover);
- ec = md->ec;
-
- switch (md->rotation)
- {
- case ROT_IDX_90:
- x = visible ? ec->zone->w : 0;
- break;
- case ROT_IDX_180:
- y = visible ? 0 : ec->zone->h;
- break;
- case ROT_IDX_270:
- x = visible ? 0 : ec->zone->w;
- break;
- default:
- y = visible ? ec->zone->h : 0;
- break;
- }
-
- _mover_obj_handler_move(md, x, y);
-}
-
-static Eina_Bool
-_mover_obj_move(Evas_Object *mover, int x, int y, unsigned int timestamp)
-{
- Mover_Data *md;
- int dp;
- unsigned int dt;
-
- if (!mover) return EINA_FALSE;
-
- md = evas_object_smart_data_get(mover);
- if (!_mover_obj_handler_move(md, x, y)) return EINA_FALSE;
-
- /* Calculate the acceleration of movement,
- * determine the visibility of quickpanel based on the result. */
- dt = timestamp - md->effect_info.timestamp;
- switch (md->rotation)
- {
- case ROT_IDX_90:
- dp = x - md->effect_info.x;
- break;
- case ROT_IDX_180:
- dp = md->effect_info.y - y;
- break;
- case ROT_IDX_270:
- dp = md->effect_info.x - x;
- break;
- default:
- dp = y - md->effect_info.y;
- break;
- }
- if (dt) md->effect_info.accel = (float)dp / (float)dt;
-
- /* Store current information to next calculation */
- md->effect_info.x = x;
- md->effect_info.y = y;
- md->effect_info.timestamp = timestamp;
-
- return EINA_TRUE;
-}
-
-static Mover_Effect_Data *
-_mover_obj_effect_data_new(Evas_Object *mover, int from, int to, Eina_Bool visible)
-{
- Mover_Effect_Data *ed;
-
- ed = E_NEW(Mover_Effect_Data, 1);
- if (!ed) return NULL;
-
- ed->mover = mover;
- ed->visible = visible;
- ed->from = from;
- ed->to = to;
-
- return ed;
-}
-
-static void
-_mover_obj_effect_cb_mover_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Mover_Effect_Data *ed = data;
- Mover_Data *md;
-
- ed = data;
- md = evas_object_smart_data_get(ed->mover);
- QP_VISIBLE_SET(md->qp->ec, ed->visible);
-
- /* make sure NULL before calling ecore_animator_del() */
- ed->mover = NULL;
-
- ecore_animator_del(ed->animator);
- ed->animator = NULL;
-}
-
-static void
-_mover_obj_effect_data_free(Mover_Effect_Data *ed)
-{
- Pol_Quickpanel *qp;
- Mover_Data *md;
- E_QP_Client *qp_client;
- Eina_List *l;
-
- if (ed->mover)
- {
- md = evas_object_smart_data_get(ed->mover);
- QP_VISIBLE_SET(md->qp->ec, ed->visible);
-
- evas_object_event_callback_del(ed->mover, EVAS_CALLBACK_DEL, _mover_obj_effect_cb_mover_obj_del);
- evas_object_del(ed->mover);
- }
-
- qp = _quickpanel_get();
- if (qp)
- {
- EINA_LIST_FOREACH(qp->clients, l, qp_client)
- e_tzsh_qp_state_visible_update(qp_client->ec,
- ed->visible);
- }
-
- free(ed);
-}
-
-static Eina_Bool
-_mover_obj_effect_update(void *data, double pos)
-{
- Mover_Effect_Data *ed = data;
- Mover_Data *md;
- int new_x = 0, new_y = 0;
- double progress = 0;
-
- progress = ecore_animator_pos_map(pos, ECORE_POS_MAP_DECELERATE, 0, 0);
-
- md = evas_object_smart_data_get(ed->mover);
-
- switch (md->rotation)
- {
- case ROT_IDX_90:
- case ROT_IDX_270:
- new_x = ed->from + (ed->to * progress);
- break;
- default:
- case ROT_IDX_180:
- new_y = ed->from + (ed->to * progress);
- break;
- }
- _mover_obj_handler_move(md, new_x, new_y);
-
- if (pos == 1.0)
- {
- ecore_animator_del(ed->animator);
- ed->animator = NULL;
-
- _mover_obj_effect_data_free(ed);
-
- return ECORE_CALLBACK_CANCEL;
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_mover_obj_effect_start(Evas_Object *mover, Eina_Bool visible)
-{
- Mover_Data *md;
- E_Client *ec;
- Mover_Effect_Data *ed;
- int from;
- int to;
- double duration;
- const double ref = 0.1;
-
- md = evas_object_smart_data_get(mover);
- ec = md->qp->ec;
-
- switch (md->rotation)
- {
- case ROT_IDX_90:
- from = md->handler_rect.x;
- to = (visible) ? (ec->zone->w - from) : (-from);
- duration = ((double)abs(to) / (ec->zone->w / 2)) * ref;
- break;
- case ROT_IDX_180:
- from = md->handler_rect.y;
- to = (visible) ? (-from) : (ec->zone->h - from);
- duration = ((double)abs(to) / (ec->zone->h / 2)) * ref;
- break;
- case ROT_IDX_270:
- from = md->handler_rect.x;
- to = (visible) ? (-from) : (ec->zone->w - from);
- duration = ((double)abs(to) / (ec->zone->w / 2)) * ref;
- break;
- default:
- from = md->handler_rect.y;
- to = (visible) ? (ec->zone->h - from) : (-from);
- duration = ((double)abs(to) / (ec->zone->h / 2)) * ref;
- break;
- }
-
- /* create effect data */
- ed = _mover_obj_effect_data_new(mover, from, to, visible);
-
- /* start move effect */
- ed->animator = ecore_animator_timeline_add(duration,
- _mover_obj_effect_update,
- ed);
-
- evas_object_event_callback_add(mover, EVAS_CALLBACK_DEL, _mover_obj_effect_cb_mover_obj_del, ed);
-
- md->effect_info.animator = ed->animator;
- md->effect_info.visible = visible;
- md->effect_info.data = ed;
-}
-
-static void
-_mover_obj_effect_stop(Evas_Object *mover)
-{
- Mover_Data *md;
-
- md = evas_object_smart_data_get(mover);
- md->effect_info.data->mover = NULL;
-
- evas_object_event_callback_del(mover, EVAS_CALLBACK_DEL, _mover_obj_effect_cb_mover_obj_del);
-
- E_FREE_FUNC(md->effect_info.animator, ecore_animator_del);
-}
-
-static Eina_Bool
-_mover_obj_visibility_eval(Evas_Object *mover)
-{
- E_Client *ec;
- Mover_Data *md;
- Eina_Bool threshold;
- const float sensitivity = 1.5; /* hard coded. (arbitrary) */
-
- md = evas_object_smart_data_get(mover);
- ec = md->ec;
-
- switch (md->rotation)
- {
- case ROT_IDX_90:
- threshold = (md->handler_rect.x > (ec->zone->w / 2));
- break;
- case ROT_IDX_180:
- threshold = (md->handler_rect.y < (ec->zone->h / 2));
- break;
- case ROT_IDX_270:
- threshold = (md->handler_rect.x < (ec->zone->w / 2));
- break;
- default:
- threshold = (md->handler_rect.y > (ec->zone->h / 2));
- break;
- }
-
- if ((md->effect_info.accel > sensitivity) ||
- ((md->effect_info.accel > -sensitivity) && threshold))
- return EINA_TRUE;
-
- return EINA_FALSE;
-}
-
-static Eina_Bool
-_mover_obj_is_animating(Evas_Object *mover)
-{
- Mover_Data *md;
-
- md = evas_object_smart_data_get(mover);
-
- return !!md->effect_info.animator;
-}
-
-static Eina_Bool
-_mover_obj_effect_visible_get(Evas_Object *mover)
-{
- Mover_Data *md;
-
- md = evas_object_smart_data_get(mover);
-
- return md->effect_info.visible;
-}
-
-static Eina_Bool
-_quickpanel_send_gesture_to_indicator(void)
-{
- E_Client *focused;
- focused = e_client_focused_get();
- if (focused)
- {
- ELOGF("TZ_IND", "INDICATOR state:%d, opacity:%d, vtype:%d",
- focused->pixmap, focused, focused->indicator.state, focused->indicator.opacity_mode, focused->indicator.visible_type);
-
- if (focused->indicator.state == 2) // state: on
- {
- if (focused->indicator.visible_type == 0) // visible: hidden
- {
- e_mod_pol_wl_indicator_flick_send(focused);
- return EINA_TRUE;
- }
- }
- else if (focused->indicator.state == 1) // state: off
- {
- return EINA_TRUE;
- }
- }
-
- return EINA_FALSE;
-}
-
-static void
-_region_obj_cb_gesture_start(void *data, Evas_Object *handler, int x, int y, unsigned int timestamp)
-{
- Pol_Quickpanel *qp;
-
- qp = data;
- if (EINA_UNLIKELY(!qp))
- return;
-
- if (EINA_UNLIKELY(!qp->ec))
- return;
-
- if (e_object_is_del(E_OBJECT(qp->ec)))
- return;
-
- if (_quickpanel_send_gesture_to_indicator())
- return;
-
- if (qp->mover)
- {
- if (_mover_obj_is_animating(qp->mover))
- return;
-
- DBG("Mover object already existed");
- evas_object_del(qp->mover);
- }
-
- _mover_obj_new_with_move(qp, x, y, timestamp);
-}
-
-static void
-_region_obj_cb_gesture_move(void *data, Evas_Object *handler, int x, int y, unsigned int timestamp)
-{
- Pol_Quickpanel *qp;
-
- qp = data;
- if (!qp->mover)
- return;
-
- if (_mover_obj_is_animating(qp->mover))
- return;
-
- _mover_obj_move(qp->mover, x, y, timestamp);
-}
-
-static void
-_region_obj_cb_gesture_end(void *data EINA_UNUSED, Evas_Object *handler, int x, int y, unsigned int timestamp)
-{
- Pol_Quickpanel *qp;
- Eina_Bool v;
-
- qp = data;
- if (!qp->mover)
- {
- DBG("Could not find quickpanel mover object");
- return;
- }
-
- if (_mover_obj_is_animating(qp->mover))
- return;
-
- v = _mover_obj_visibility_eval(qp->mover);
- _mover_obj_effect_start(qp->mover, v);
-}
-
-static void
-_quickpanel_free(Pol_Quickpanel *qp)
-{
- E_FREE_LIST(qp->clients, free);
- E_FREE_FUNC(qp->mover, evas_object_del);
- E_FREE_FUNC(qp->indi_obj, evas_object_del);
- E_FREE_FUNC(qp->handler_obj, evas_object_del);
- E_FREE_FUNC(qp->idle_enterer, ecore_idle_enterer_del);
- E_FREE_LIST(qp->events, ecore_event_handler_del);
- E_FREE_LIST(qp->hooks, e_client_hook_del);
- E_FREE_LIST(qp->intercept_hooks, e_comp_object_intercept_hook_del);
- E_FREE(_pol_quickpanel);
-}
-
-static void
-_quickpanel_hook_client_del(void *d, E_Client *ec)
-{
- Pol_Quickpanel *qp;
-
- qp = d;
- if (EINA_UNLIKELY(!qp))
- return;
-
- if (!ec) return;
-
- if (qp->ec != ec)
- return;
-
- _quickpanel_free(qp);
-
- e_mod_pol_rotation_force_update_del(ec->zone, ec);
-}
-
-static void
-_quickpanel_client_evas_cb_show(void *data, Evas *evas, Evas_Object *obj, void *event)
-{
- Pol_Quickpanel *qp;
-
- qp = data;
- if (EINA_UNLIKELY(!qp))
- return;
-
- evas_object_show(qp->handler_obj);
- evas_object_raise(qp->handler_obj);
- evas_object_hide(qp->indi_obj);
-
- E_FREE_FUNC(qp->buf_change_hdlr, ecore_event_handler_del);
-}
-
-static Eina_Bool
-_quickpanel_cb_buffer_change(void *data, int type, void *event)
-{
- Pol_Quickpanel *qp;
- E_Event_Client *ev;
- E_Client *ec;
-
- qp = data;
- if (!qp->ec)
- goto end;
-
- ev = event;
- ec = ev->ec;
- if (qp->ec != ec)
- goto end;
-
- /* render forcibly */
- e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
- e_comp_object_dirty(ec->frame);
- e_comp_object_render(ec->frame);
-
- /* make frame event */
- e_pixmap_image_clear(ec->pixmap, EINA_TRUE);
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_quickpanel_client_evas_cb_hide(void *data, Evas *evas, Evas_Object *obj, void *event)
-{
- Pol_Quickpanel *qp;
-
- qp = data;
- if (EINA_UNLIKELY(!qp))
- return;
-
- evas_object_hide(qp->handler_obj);
- evas_object_show(qp->indi_obj);
-}
-
-static void
-_quickpanel_client_evas_cb_move(void *data, Evas *evas, Evas_Object *obj, void *event)
-{
- Pol_Quickpanel *qp;
- int x, y, hx, hy;
-
- qp = data;
- if (EINA_UNLIKELY(!qp))
- return;
-
- e_mod_region_rectangle_get(qp->handler_obj, qp->rotation, &hx, &hy, NULL, NULL);
- evas_object_geometry_get(obj, &x, &y, NULL, NULL);
- evas_object_move(qp->handler_obj, x + hx, y + hy);
-}
-
-static void
-_quickpanel_handler_rect_add(Pol_Quickpanel *qp, Rot_Idx ridx, int x, int y, int w, int h)
-{
- E_Client *ec;
- Evas_Object *obj;
-
- ec = qp->ec;
-
- ELOGF("QUICKPANEL", "Handler Geo Set | x %d, y %d, w %d, h %d",
- NULL, NULL, x, y, w, h);
-
- if (qp->handler_obj)
- goto end;
-
- obj = e_mod_region_object_new();
- evas_object_name_set(obj, "qp::handler_obj");
- if (!obj)
- return;
-
- e_mod_region_cb_set(obj,
- _region_obj_cb_gesture_start,
- _region_obj_cb_gesture_move,
- _region_obj_cb_gesture_end, qp);
-
- /* Add handler object to smart member to follow the client's stack */
- evas_object_smart_member_add(obj, ec->frame);
- evas_object_propagate_events_set(obj, 0);
- if (evas_object_visible_get(ec->frame))
- evas_object_show(obj);
-
- qp->handler_obj = obj;
-
-end:
- e_mod_region_rectangle_set(qp->handler_obj, ridx, x, y, w, h);
-}
-
-static void
-_quickpanel_handler_region_set(Pol_Quickpanel *qp, Rot_Idx ridx, Eina_Tiler *tiler)
-{
- Eina_Iterator *it;
- Eina_Rectangle *r;
- int x = 0, y = 0;
-
- /* FIXME supported single rectangle, not tiler */
-
- it = eina_tiler_iterator_new(tiler);
- EINA_ITERATOR_FOREACH(it, r)
- {
- _quickpanel_handler_rect_add(qp, ridx, r->x, r->y, r->w, r->h);
-
- /* FIXME: this should be set by another way like indicator */
- if (ridx == ROT_IDX_180)
- {
- x = 0;
- y = qp->ec->zone->h - r->h;
- }
- else if (ridx == ROT_IDX_270)
- {
- x = qp->ec->zone->w - r->w;
- y = 0;
- }
- e_mod_region_rectangle_set(qp->indi_obj, ridx, x, y, r->w, r->h);
-
- break;
- }
- eina_iterator_free(it);
-}
-
-static void
-_e_qp_vis_change(Pol_Quickpanel *qp, Eina_Bool vis, Eina_Bool with_effect)
-{
- E_Client *ec;
- Evas_Object *mover;
- Eina_Bool res, cur_vis = EINA_FALSE;
- int x, y, w, h;
-
- res = _e_qp_client_scrollable_update();
- if (!res) return;
-
- ec = qp->ec;
-
- evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
-
- if (E_INTERSECTS(x, y, w, h, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h))
- cur_vis = evas_object_visible_get(ec->frame);
-
- if (cur_vis == vis)
- return;
-
- mover = qp->mover;
-
- if (with_effect)
- {
- if (mover)
- {
- if (_mover_obj_is_animating(mover))
- {
- if (_mover_obj_effect_visible_get(mover) == vis)
- return;
-
- _mover_obj_effect_stop(mover);
- }
- }
- else
- {
- mover = _mover_obj_new(qp);
- _mover_obj_visible_set(mover, !vis);
- }
-
- _mover_obj_effect_start(mover, vis);
- }
- else
- {
- if (mover)
- {
- if (_mover_obj_is_animating(mover))
- _mover_obj_effect_stop(mover);
- evas_object_del(mover);
- }
-
- QP_VISIBLE_SET(ec, vis);
- }
-}
-
-/* NOTE do we need to control the handler objects during rotation is changed? */
-
-static Eina_Bool
-_quickpanel_cb_rotation_done(void *data, int type, void *event)
-{
- Pol_Quickpanel *qp;
- E_Event_Client *ev = event;
- E_Client *ec;
- E_QP_Client *qp_client;
- Eina_List *l;
-
- qp = data;
- if (EINA_UNLIKELY(!qp))
- goto end;
-
- ec = ev->ec;
- if (EINA_UNLIKELY(!ec))
- goto end;
-
- if (qp->ec != ec)
- goto end;
-
- qp->rotation = e_mod_rotation_angle_to_idx(ec->e.state.rot.ang.curr);
-
- if (evas_object_visible_get(ec->frame))
- evas_object_show(qp->handler_obj);
- else
- evas_object_show(qp->indi_obj);
-
- EINA_LIST_FOREACH(qp->clients, l, qp_client)
- e_tzsh_qp_state_orientation_update(qp_client->ec,
- qp->rotation);
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-/* NOTE: if the state(show/hide/stack) of windows which are stacked below
- * quickpanel is changed, we close the quickpanel.
- * the most major senario is that quickpanel should be closed when WiFi popup to
- * show the available connection list is shown by click the button on
- * the quickpanel to turn on the WiFi.
- * @see _quickpanel_cb_client_show(),
- * _quickpanel_cb_client_hide()
- * _quickpanel_cb_client_stack()
- * _quickpanel_cb_client_remove()
- * _quickpanel_idle_enter()
- */
-static E_Client *
-_quickpanel_below_visible_client_get(Pol_Quickpanel *qp)
-{
- E_Client *ec;
-
- for (ec = e_client_below_get(qp->ec); ec; ec = e_client_below_get(ec))
- {
- if (!ec->visible) continue;
- if (!ec->icccm.accepts_focus) continue;
- if (e_object_is_del(E_OBJECT(ec))) continue;
-
- return ec;
- }
-
- return NULL;
-}
-
-static void
-_quickpanel_below_change_eval(void *data, void *event)
-{
- Pol_Quickpanel *qp;
- E_Event_Client *ev;
-
- qp = data;
- if (EINA_UNLIKELY(!qp))
- return;
-
- ev = event;
- if (EINA_UNLIKELY((!ev) || (!ev->ec)))
- return;
-
- if (e_mod_pol_client_is_cursor(ev->ec))
- return;
-
- qp->changes.below = EINA_TRUE;
- _changed = EINA_TRUE;
-}
-
-static Eina_Bool
-_quickpanel_cb_client_show(void *data, int type, void *event)
-{
- _quickpanel_below_change_eval(data, event);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_quickpanel_cb_client_hide(void *data, int type, void *event)
-{
- _quickpanel_below_change_eval(data, event);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_quickpanel_cb_client_stack(void *data, int type, void *event)
-{
- Pol_Quickpanel *qp;
- E_Event_Client *ev;
-
- qp = data;
- EINA_SAFETY_ON_NULL_GOTO(qp, end);
-
- ev = event;
- EINA_SAFETY_ON_NULL_GOTO(ev, end);
-
- qp->stacking = ev->ec;
-
- DBG("Stacking Client '%s'(%p)",
- ev->ec->icccm.name ? ev->ec->icccm.name : "", ev->ec);
-
- _quickpanel_below_change_eval(data, event);
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_quickpanel_cb_client_remove(void *data, int type, void *event)
-{
- _quickpanel_below_change_eval(data, event);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Evas_Object *
-_quickpanel_indicator_object_new(Pol_Quickpanel *qp)
-{
- Evas_Object *indi_obj;
-
- indi_obj = e_mod_region_object_new();
- evas_object_name_set(indi_obj, "qp::indicator_obj");
- if (!indi_obj)
- return NULL;
-
- evas_object_repeat_events_set(indi_obj, EINA_FALSE);
- /* FIXME: make me move to explicit layer something like POL_LAYER */
- evas_object_layer_set(indi_obj, EVAS_LAYER_MAX - 1);
-
- e_mod_region_cb_set(indi_obj,
- _region_obj_cb_gesture_start,
- _region_obj_cb_gesture_move,
- _region_obj_cb_gesture_end, qp);
-
- evas_object_show(indi_obj);
-
- return indi_obj;
-}
-
-static Eina_Bool
-_quickpanel_idle_enter(void *data)
-{
- Pol_Quickpanel *qp;
-
- if (!_changed)
- goto end;
- _changed = EINA_FALSE;
-
- qp = data;
- if (EINA_UNLIKELY(!qp))
- goto end;
-
- if (qp->changes.below)
- {
- E_Client *below;
-
- below = _quickpanel_below_visible_client_get(qp);
- if (qp->below != below)
- {
- DBG("qp->below '%s'(%p) new_below '%s'(%p)\n",
- qp->below ? (qp->below->icccm.name ? qp->below->icccm.name : "") : "",
- qp->below,
- below ? (below->icccm.name ? below->icccm.name : "") : "",
- below);
-
- qp->below = below;
-
- /* QUICKFIX
- * hide the quickpanel, if below client is the stacking client.
- * it means to find out whether or not it was launched.
- */
- if ((qp->stacking == below) &&
- (qp->ec->visible))
- e_mod_quickpanel_hide();
-
- _e_qp_client_scrollable_update();
- }
-
- qp->changes.below = EINA_FALSE;
- }
-
-end:
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_quickpanel_intercept_hook_show(void *data, E_Client *ec)
-{
- Pol_Quickpanel *qp;
-
- qp = data;
- if (EINA_UNLIKELY(!qp))
- goto end;
-
- if (qp->ec != ec)
- goto end;
-
- if (qp->show_block)
- {
- ec->visible = EINA_FALSE;
- return EINA_FALSE;
- }
-
-end:
- return EINA_TRUE;
-}
-
-static E_QP_Client *
-_e_qp_client_ec_get(E_Client *ec)
-{
- Pol_Quickpanel *qp = _quickpanel_get();
- E_QP_Client *qp_client = NULL;
- Eina_List *l;
-
- EINA_LIST_FOREACH(qp->clients, l, qp_client)
- {
- if (qp_client->ec == ec)
- return qp_client;
- }
-
- return qp_client;
-}
-
-/* return value
- * EINA_TRUE : user can scrool the QP.
- * EINA_FALSE: user can't scroll QP since below window doesn't want.
- */
-static Eina_Bool
-_e_qp_client_scrollable_update(void)
-{
- Pol_Quickpanel *qp;
- E_QP_Client *qp_client;
- Eina_Bool res = EINA_TRUE;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp->ec, EINA_FALSE);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(qp->ec)), EINA_FALSE);
-
- if (!qp->below)
- {
- evas_object_pass_events_set(qp->handler_obj, EINA_FALSE);
- evas_object_pass_events_set(qp->indi_obj, EINA_FALSE);
- return EINA_TRUE;
- }
-
- /* Do not show and scroll the quickpanel window if the qp_client winodw
- * which is placed at the below of the quickpanel window doesn't want
- * to show and scroll the quickpanel window.
- */
- qp_client = _e_qp_client_ec_get(qp->below);
- if ((qp_client) && (!qp_client->hint.scrollable))
- {
- evas_object_pass_events_set(qp->handler_obj, EINA_TRUE);
- evas_object_pass_events_set(qp->indi_obj, EINA_TRUE);
- res = EINA_FALSE;
- }
- else
- {
- evas_object_pass_events_set(qp->handler_obj, EINA_FALSE);
- evas_object_pass_events_set(qp->indi_obj, EINA_FALSE);
- res = EINA_TRUE;
- }
-
- return res;
-}
-
-
-#undef E_CLIENT_HOOK_APPEND
-#define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
- do \
- { \
- E_Client_Hook *_h; \
- _h = e_client_hook_add(t, cb, d); \
- assert(_h); \
- l = eina_list_append(l, _h); \
- } \
- while (0)
-
-/* NOTE: supported single client for quickpanel for now. */
-EINTERN void
-e_mod_quickpanel_client_set(E_Client *ec)
-{
- Pol_Quickpanel *qp;
-
- if (EINA_UNLIKELY(!ec))
- {
- qp = _quickpanel_get();
- if (qp)
- _quickpanel_free(qp);
- return;
- }
-
- /* check for client being deleted */
- if (e_object_is_del(E_OBJECT(ec))) return;
-
- /* check for wayland pixmap */
- if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return;
-
- /* if we have not setup evas callbacks for this client, do it */
- if (_pol_quickpanel) return;
-
- ELOGF("QUICKPANEL", "Set Client | ec %p", NULL, NULL, ec);
-
- qp = calloc(1, sizeof(*qp));
- if (!qp)
- return;
-
- _pol_quickpanel = qp;
-
- qp->ec = ec;
- qp->show_block = EINA_TRUE;
- qp->below = _quickpanel_below_visible_client_get(qp);
- qp->indi_obj = _quickpanel_indicator_object_new(qp);
- if (!qp->indi_obj)
- {
- free(qp);
- return;
- }
-
- eina_stringshare_replace(&ec->icccm.window_role, "quickpanel");
-
- // set quickpanel layer
- if (WM_POL_QUICKPANEL_LAYER != evas_object_layer_get(ec->frame))
- {
- evas_object_layer_set(ec->frame, WM_POL_QUICKPANEL_LAYER);
- }
- ec->layer = WM_POL_QUICKPANEL_LAYER;
-
- // set skip iconify
- ec->exp_iconify.skip_iconify = 1;
- ec->e.state.rot.type = E_CLIENT_ROTATION_TYPE_DEPENDENT;
-
- /* force update rotation for quickpanel */
- e_mod_pol_rotation_force_update_add(ec->zone, ec);
-
- QP_HIDE(ec);
-
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _quickpanel_client_evas_cb_show, qp);
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _quickpanel_client_evas_cb_hide, qp);
- evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _quickpanel_client_evas_cb_move, qp);
-
- E_CLIENT_HOOK_APPEND(qp->hooks, E_CLIENT_HOOK_DEL, _quickpanel_hook_client_del, qp);
- E_LIST_HANDLER_APPEND(qp->events, E_EVENT_CLIENT_ROTATION_CHANGE_END, _quickpanel_cb_rotation_done, qp);
- E_LIST_HANDLER_APPEND(qp->events, E_EVENT_CLIENT_SHOW, _quickpanel_cb_client_show, qp);
- E_LIST_HANDLER_APPEND(qp->events, E_EVENT_CLIENT_HIDE, _quickpanel_cb_client_hide, qp);
- E_LIST_HANDLER_APPEND(qp->events, E_EVENT_CLIENT_STACK, _quickpanel_cb_client_stack, qp);
- E_LIST_HANDLER_APPEND(qp->events, E_EVENT_CLIENT_REMOVE, _quickpanel_cb_client_remove, qp);
- E_LIST_HANDLER_APPEND(qp->events, E_EVENT_CLIENT_BUFFER_CHANGE, _quickpanel_cb_buffer_change, qp);
-
- E_COMP_OBJECT_INTERCEPT_HOOK_APPEND(qp->intercept_hooks, E_COMP_OBJECT_INTERCEPT_HOOK_SHOW_HELPER, _quickpanel_intercept_hook_show, qp);
-
-
- qp->idle_enterer = ecore_idle_enterer_add(_quickpanel_idle_enter, qp);
-}
-
-EINTERN E_Client *
-e_mod_quickpanel_client_get(void)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(_pol_quickpanel, NULL);
-
- return _pol_quickpanel->ec;
-}
-
-EINTERN Eina_Bool
-e_mod_quickpanel_region_set(int type, int angle, Eina_Tiler *tiler)
-{
- Pol_Quickpanel *qp;
- Rot_Idx ridx;
-
- qp = _quickpanel_get();
- if (EINA_UNLIKELY(!qp))
- return EINA_FALSE;
-
- if (EINA_UNLIKELY(!qp->ec))
- return EINA_FALSE;
-
- if (e_object_is_del(E_OBJECT(qp->ec)))
- return EINA_FALSE;
-
- // FIXME: region type
- if (type != 0)
- return EINA_FALSE;
-
- ridx = e_mod_rotation_angle_to_idx(angle);
- _quickpanel_handler_region_set(qp, ridx, tiler);
-
- return EINA_TRUE;
-}
-
-EINTERN void
-e_mod_quickpanel_show(void)
-{
- Pol_Quickpanel *qp;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN(qp);
- EINA_SAFETY_ON_NULL_RETURN(qp->ec);
- EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(qp->ec)));
-
- _e_qp_vis_change(qp, EINA_TRUE, EINA_TRUE);
-}
-
-EINTERN void
-e_mod_quickpanel_hide(void)
-{
- Pol_Quickpanel *qp;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN(qp);
- EINA_SAFETY_ON_NULL_RETURN(qp->ec);
- EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(qp->ec)));
-
- _e_qp_vis_change(qp, EINA_FALSE, EINA_TRUE);
-}
-
-EINTERN Eina_Bool
-e_qp_visible_get(void)
-{
- Pol_Quickpanel *qp;
- E_Client *ec;
- Eina_Bool vis = EINA_FALSE;
- int x, y, w, h;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp->ec, EINA_FALSE);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(qp->ec)), EINA_FALSE);
-
- ec = qp->ec;
- evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
-
- if (E_INTERSECTS(x, y, w, h, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h))
- vis = evas_object_visible_get(ec->frame);
-
- return vis;
-}
-
-EINTERN int
-e_qp_orientation_get(void)
-{
- Pol_Quickpanel *qp;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp, ROT_IDX_0);
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp->ec, ROT_IDX_0);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(qp->ec)), ROT_IDX_0);
-
- return qp->rotation;
-}
-
-EINTERN void
-e_qp_client_add(E_Client *ec)
-{
- Pol_Quickpanel *qp;
- E_QP_Client *qp_client;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN(qp);
- EINA_SAFETY_ON_NULL_RETURN(qp->ec);
- EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(qp->ec)));
- EINA_SAFETY_ON_NULL_RETURN(ec);
- EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(ec)));
-
- qp_client = E_NEW(E_QP_Client, 1);
- qp_client->ec = ec;
- qp_client->hint.vis = EINA_TRUE;
- qp_client->hint.scrollable = EINA_TRUE;
-
- qp->clients = eina_list_append(qp->clients, qp_client);
-}
-
-EINTERN void
-e_qp_client_del(E_Client *ec)
-{
- Pol_Quickpanel *qp;
- E_QP_Client *qp_client;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN(qp);
- EINA_SAFETY_ON_NULL_RETURN(ec);
-
- qp_client = _e_qp_client_ec_get(ec);
- EINA_SAFETY_ON_NULL_RETURN(qp_client);
-
- qp->clients = eina_list_remove(qp->clients, qp_client);
-
- E_FREE(qp_client);
-}
-
-EINTERN void
-e_qp_client_show(E_Client *ec)
-{
- Pol_Quickpanel *qp;
- E_QP_Client *qp_client;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN(qp);
- EINA_SAFETY_ON_NULL_RETURN(qp->ec);
- EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(qp->ec)));
-
- qp_client = _e_qp_client_ec_get(ec);
- EINA_SAFETY_ON_NULL_RETURN(qp_client);
- EINA_SAFETY_ON_FALSE_RETURN(qp_client->hint.scrollable);
-
- _e_qp_vis_change(qp, EINA_TRUE, EINA_TRUE);
-}
-
-EINTERN void
-e_qp_client_hide(E_Client *ec)
-{
- Pol_Quickpanel *qp;
- E_QP_Client *qp_client;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN(qp);
- EINA_SAFETY_ON_NULL_RETURN(qp->ec);
- EINA_SAFETY_ON_TRUE_RETURN(e_object_is_del(E_OBJECT(qp->ec)));
-
- qp_client = _e_qp_client_ec_get(ec);
- EINA_SAFETY_ON_NULL_RETURN(qp_client);
- EINA_SAFETY_ON_FALSE_RETURN(qp_client->hint.scrollable);
-
- _e_qp_vis_change(qp, EINA_FALSE, EINA_TRUE);
-}
-
-EINTERN Eina_Bool
-e_qp_client_scrollable_set(E_Client *ec, Eina_Bool set)
-{
- Pol_Quickpanel *qp;
- E_QP_Client *qp_client;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp->ec, EINA_FALSE);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(qp->ec)), EINA_FALSE);
-
- qp_client = _e_qp_client_ec_get(ec);
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp_client, EINA_FALSE);
-
- if (qp_client->hint.scrollable != set)
- qp_client->hint.scrollable = set;
-
- _e_qp_client_scrollable_update();
-
- return EINA_FALSE;
-}
-
-EINTERN Eina_Bool
-e_qp_client_scrollable_get(E_Client *ec)
-{
- Pol_Quickpanel *qp;
- E_QP_Client *qp_client;
-
- qp = _quickpanel_get();
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp->ec, EINA_FALSE);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(qp->ec)), EINA_FALSE);
-
- qp_client = _e_qp_client_ec_get(ec);
- EINA_SAFETY_ON_NULL_RETURN_VAL(qp_client, EINA_FALSE);
-
- return qp_client->hint.scrollable;
-}
+++ /dev/null
-#ifndef E_MOD_QUICKPANEL_H
-#define E_MOD_QUICKPANEL_H
-
-EINTERN void e_mod_quickpanel_client_set(E_Client *ec);
-EINTERN E_Client *e_mod_quickpanel_client_get(void);
-EINTERN void e_mod_quickpanel_show(void);
-EINTERN void e_mod_quickpanel_hide(void);
-EINTERN Eina_Bool e_mod_quickpanel_region_set(int type, int angle, Eina_Tiler *tiler);
-EINTERN Evas_Object *e_mod_quickpanel_handler_object_add(E_Client *ec, int x, int y, int w, int h);
-EINTERN void e_mod_quickpanel_handler_object_del(Evas_Object *handler);
-
-EINTERN Eina_Bool e_qp_visible_get(void);
-EINTERN int e_qp_orientation_get(void);
-
-EINTERN void e_qp_client_add(E_Client *ec);
-EINTERN void e_qp_client_del(E_Client *ec);
-EINTERN void e_qp_client_show(E_Client *ec);
-EINTERN void e_qp_client_hide(E_Client *ec);
-EINTERN Eina_Bool e_qp_client_scrollable_set(E_Client *ec, Eina_Bool set);
-EINTERN Eina_Bool e_qp_client_scrollable_get(E_Client *ec);
-
-#endif
+++ /dev/null
-#include "e_mod_main.h"
-#include "e_mod_rotation.h"
-#include "e_mod_gesture.h"
-#include "e_mod_region.h"
-
-/* FIXME: temporary use quickpanel to find out ui orientation */
-#include "e_mod_quickpanel.h"
-
-#define ENTRY(...) \
- Pol_Region *region; \
- EINA_SAFETY_ON_NULL_RETURN_VAL(ro, EINA_FALSE); \
- region = evas_object_data_get(ro, EO_DATA_KEY); \
- if (EINA_UNLIKELY(!region)) \
- return __VA_ARGS__
-
-/* FIXME: Implementation for log that can access commonly */
-#ifdef INF
-#undef INF
-#endif
-
-#define INF(f, x...) NULL
-
-#define EO_DATA_KEY "pol-region"
-
-struct _Pol_Region
-{
- Evas_Object *obj;
- Pol_Gesture *gesture;
- Eina_List *event_list;
- Eina_Rectangle geom[ROT_IDX_NUM];
- Rot_Idx rotation;
-};
-
-static void
-_region_rotation_set(Pol_Region *region, int angle)
-{
- if (!e_mod_rotation_angle_valid_check(angle))
- return;
-
- region->rotation = e_mod_rotation_angle_to_idx(angle);
- e_mod_gesture_angle_set(region->gesture, angle);
-}
-
-static void
-_region_obj_geometry_update(Pol_Region *region)
-{
- Rot_Idx r;
-
- r = region->rotation;
-
- INF("Update Geometry: rotation %d x %d y %d w %d h %d",
- e_mod_rotation_idx_to_angle(r), region->geom[r].x, region->geom[r].y, region->geom[r].w, region->geom[r].h);
-
- evas_object_geometry_set(region->obj,
- region->geom[r].x, region->geom[r].y,
- region->geom[r].w, region->geom[r].h);
-}
-
-static Eina_Bool
-_region_rotation_cb_change_end(void *data, int type, void *event)
-{
- Pol_Region *region;
- E_Event_Client *ev;
- E_Client *ec;
-
- region = data;
- if (EINA_UNLIKELY(!region))
- goto end;
-
- ev = event;
- if (EINA_UNLIKELY(!ev))
- goto end;
-
- ec = ev->ec;
- if (EINA_UNLIKELY(!ec))
- goto end;
-
- if (e_mod_quickpanel_client_get() != ec)
- goto end;
-
- _region_rotation_set(region, ec->e.state.rot.ang.curr);
- _region_obj_geometry_update(region);
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_region_rotation_init(Pol_Region *region)
-{
- E_Client *ec;
-
- /* FIXME: temporary use quickpanel to find out ui orientation */
- ec = e_mod_quickpanel_client_get();
- if (ec)
- _region_rotation_set(region, ec->e.state.rot.ang.curr);
-
- E_LIST_HANDLER_APPEND(region->event_list, E_EVENT_CLIENT_ROTATION_CHANGE_END, _region_rotation_cb_change_end, region);
-
- return EINA_TRUE;
-}
-
-static void
-_region_free(Pol_Region *region)
-{
- INF("Free Instant");
- E_FREE_LIST(region->event_list, ecore_event_del);
- E_FREE_FUNC(region->gesture, e_mod_gesture_del);
- E_FREE_FUNC(region->obj, evas_object_del);
- free(region);
-}
-
-static void
-_region_object_cb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
-{
- Pol_Region *region;
-
- region = data;
- if (EINA_UNLIKELY(!region))
- return;
-
- _region_free(region);
-}
-
-EINTERN Evas_Object *
-e_mod_region_object_new(void)
-{
- Pol_Region *region;
- Evas_Object *o;
-
- INF("New Instant");
-
- region = calloc(1, sizeof(*region));
- if (!region)
- return NULL;
-
- o = evas_object_rectangle_add(e_comp->evas);
- evas_object_color_set(o, 0, 0, 0, 0);
- evas_object_repeat_events_set(o, EINA_TRUE);
- region->obj = o;
-
- if (!_region_rotation_init(region))
- goto err_event;
-
- evas_object_data_set(o, EO_DATA_KEY, region);
- evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _region_object_cb_del, region);
-
- return o;
-err_event:
- evas_object_del(o);
- free(region);
-
- return NULL;
-}
-
-EINTERN Eina_Bool
-e_mod_region_cb_set(Evas_Object *ro, Pol_Gesture_Start_Cb cb_start, Pol_Gesture_Move_Cb cb_move, Pol_Gesture_End_Cb cb_end, void *data)
-{
- Pol_Gesture *gesture;
-
- ENTRY(EINA_FALSE);
-
- INF("Set Callback function");
- if (!region->gesture)
- {
- gesture = e_mod_gesture_add(ro, POL_GESTURE_TYPE_LINE);
- if (!gesture)
- return EINA_FALSE;
-
- region->gesture = gesture;
- }
-
- e_mod_gesture_cb_set(region->gesture, cb_start, cb_move, cb_end, data);
-
- return EINA_TRUE;
-}
-
-EINTERN Eina_Bool
-e_mod_region_rectangle_set(Evas_Object *ro, Rot_Idx ridx, int x, int y, int w, int h)
-{
- ENTRY(EINA_FALSE);
-
- INF("Add Rectangle: a %d x %d y %d w %d h %d",
- e_mod_rotation_idx_to_angle(ridx), x, y, w, h);
-
- EINA_RECTANGLE_SET(®ion->geom[ridx], x, y, w, h);
-
- if (ridx == region->rotation)
- _region_obj_geometry_update(region);
-
- return EINA_TRUE;
-}
-
-EINTERN Eina_Bool
-e_mod_region_rectangle_get(Evas_Object *ro, Rot_Idx ridx, int *x, int *y, int *w, int *h)
-{
- ENTRY(EINA_FALSE);
-
- if (x) *x = region->geom[ridx].x;
- if (y) *y = region->geom[ridx].y;
- if (w) *w = region->geom[ridx].w;
- if (h) *h = region->geom[ridx].h;
-
- return EINA_TRUE;
-}
+++ /dev/null
-#ifndef E_MOD_POL_GESTURE_REGION
-#define E_MOD_POL_GESTURE_REGION
-
-#include "e_mod_rotation.h"
-#include "e_mod_gesture.h"
-
-typedef struct _Pol_Region Pol_Region;
-
-EINTERN Evas_Object *e_mod_region_object_new(void);
-EINTERN Eina_Bool e_mod_region_rectangle_set(Evas_Object *ro, Rot_Idx ridx, int x, int y, int w, int h);
-EINTERN Eina_Bool e_mod_region_rectangle_get(Evas_Object *ro, Rot_Idx ridx, int *x, int *y, int *w, int *h);
-EINTERN Eina_Bool e_mod_region_cb_set(Evas_Object *ro, Pol_Gesture_Start_Cb cb_start, Pol_Gesture_Move_Cb cb_move, Pol_Gesture_End_Cb cb_end, void *data);
-
-#endif
+++ /dev/null
-#include "e_mod_private_data.h"
-#include "e_mod_volume.h"
-#include "e_mod_rotation.h"
-
-#include <wayland-server.h>
-#include <tzsh_server.h>
-
-#define REGION_OBJS_FOREACH(l, o) \
- EINA_LIST_FOREACH(_volume_region_objs[_volume_cur_rot_idx], l, o)
-
-#define REGION_OBJS_VISIBLE_CHANGE(V) \
-do { \
- Eina_List *l; \
- Evas_Object *o; \
- EINA_LIST_FOREACH(_volume_region_objs[_volume_cur_rot_idx], l, o) \
- { \
- if (V) evas_object_show(o); \
- else evas_object_hide(o); \
- } \
-} while(0)
-#define REGION_OBJS_SHOW() REGION_OBJS_VISIBLE_CHANGE(EINA_TRUE)
-#define REGION_OBJS_HIDE() REGION_OBJS_VISIBLE_CHANGE(EINA_FALSE)
-
-/* private data for volume */
-static struct wl_resource *_volume_wl_touch = NULL;
-static E_Client *_volume_ec = NULL;
-static Eina_List *_volume_region_objs[ROT_IDX_NUM];
-static Rot_Idx _volume_cur_rot_idx = ROT_IDX_0;
-static Eina_Bool _volume_ec_ev_init = EINA_FALSE;
-
-/* event handler */
-static Ecore_Event_Handler *_rot_handler = NULL;
-static E_Client_Hook *_volume_del_hook = NULL;
-
-EINTERN E_Client *
-e_mod_volume_client_get(void)
-{
- return _volume_ec;
-}
-
-static void
-_volume_region_obj_cb_mouse_move(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
-{
- Evas_Event_Mouse_Move *e = event;
-
- wl_touch_send_motion(_volume_wl_touch, e->timestamp, 0, // id 0 for the 1st figner
- wl_fixed_from_int(e->cur.canvas.x - _volume_ec->client.x),
- wl_fixed_from_int(e->cur.canvas.y - _volume_ec->client.y));
-}
-
-static void
-_volume_region_obj_cb_mouse_down(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
-{
- Evas_Event_Mouse_Down *e = event;
- uint32_t serial;
-
- serial = wl_display_next_serial(e_comp_wl->wl.disp);
- wl_touch_send_down(_volume_wl_touch, serial, e->timestamp,
- _volume_ec->comp_data->surface, 0,
- wl_fixed_from_int(e->canvas.x - _volume_ec->client.x),
- wl_fixed_from_int(e->canvas.y - _volume_ec->client.y));
-}
-
-static void
-_volume_region_obj_cb_mouse_up(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
-{
- Evas_Event_Mouse_Up *e = event;
- uint32_t serial;
-
- serial = wl_display_next_serial(e_comp_wl->wl.disp);
- wl_touch_send_up(_volume_wl_touch, serial, e->timestamp, 0);
-}
-
-static void
-_volume_region_obj_cb_multi_down(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
-{
- Evas_Event_Multi_Down *e = event;
- uint32_t serial;
-
- serial = wl_display_next_serial(e_comp_wl->wl.disp);
- wl_touch_send_down(_volume_wl_touch, serial, e->timestamp,
- _volume_ec->comp_data->surface, e->device,
- wl_fixed_from_int(e->canvas.x - _volume_ec->client.x),
- wl_fixed_from_int(e->canvas.y - _volume_ec->client.y));
-}
-
-static void
-_volume_region_obj_cb_multi_up(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
-{
- Evas_Event_Multi_Up *e = event;
- uint32_t serial;
-
- serial = wl_display_next_serial(e_comp_wl->wl.disp);
- wl_touch_send_up(_volume_wl_touch, serial, e->timestamp, e->device);
-}
-
-static void
-_volume_region_obj_cb_multi_move(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
-{
- Evas_Event_Multi_Move *e = event;
-
- wl_touch_send_motion(_volume_wl_touch, e->timestamp, e->device,
- wl_fixed_from_int(e->cur.canvas.x - _volume_ec->client.x),
- wl_fixed_from_int(e->cur.canvas.y - _volume_ec->client.y));
-}
-
-static void
-_volume_client_evas_cb_show(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
-{
- /* show region objects in current rotation */
- REGION_OBJS_SHOW();
-}
-
-static void
-_volume_client_evas_cb_hide(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
-{
- /* hide region objects in current rotation */
- REGION_OBJS_HIDE();
-}
-
-static void
-_volume_client_evas_cb_move(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *volume_obj, void *event EINA_UNUSED)
-{
- Eina_List *l;
- Eina_Rectangle *r;
- Evas_Object *region_obj;
- int x, y;
-
- REGION_OBJS_FOREACH(l, region_obj)
- {
- r = evas_object_data_get(region_obj, "content_rect");
- if (EINA_UNLIKELY(r == NULL))
- continue;
-
- evas_object_geometry_get(volume_obj, &x, &y, NULL, NULL);
- evas_object_move(region_obj, x + r->x, y + r->y);
- }
-}
-
-static void
-_volume_client_evas_cb_restack(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
-{
- Eina_List *l;
- Evas_Object *region_obj;
-
- REGION_OBJS_FOREACH(l, region_obj)
- evas_object_stack_above(region_obj, _volume_ec->frame);
-}
-
-static Eina_Bool
-_region_objs_is_empty(void)
-{
- int i;
-
- for (i = ROT_IDX_0; i < ROT_IDX_NUM; i++)
- {
- if (_volume_region_objs[i])
- return EINA_FALSE;
- }
-
- return EINA_TRUE;
-}
-
-static void
-_region_obj_del(Evas_Object *obj)
-{
- Eina_Rectangle *r;
-
- r = evas_object_data_get(obj, "content_rect");
- E_FREE_FUNC(r, eina_rectangle_free);
- evas_object_del(obj);
-}
-
-static void
-_region_objs_del(Rot_Idx rot_idx)
-{
- Evas_Object *obj;
-
- EINA_LIST_FREE(_volume_region_objs[rot_idx], obj)
- _region_obj_del(obj);
-
- if ((_volume_ec_ev_init) &&
- (_region_objs_is_empty()))
- {
- _volume_ec_ev_init = EINA_FALSE;
-
- evas_object_event_callback_del(_volume_ec->frame, EVAS_CALLBACK_SHOW,
- _volume_client_evas_cb_show);
- evas_object_event_callback_del(_volume_ec->frame, EVAS_CALLBACK_HIDE,
- _volume_client_evas_cb_hide);
- evas_object_event_callback_del(_volume_ec->frame, EVAS_CALLBACK_MOVE,
- _volume_client_evas_cb_move);
- evas_object_event_callback_del(_volume_ec->frame, EVAS_CALLBACK_RESTACK,
- _volume_client_evas_cb_restack);
- }
-}
-
-static void
-_volume_client_unset(void)
-{
- int i;
-
- for (i = ROT_IDX_0; i < ROT_IDX_NUM; i++)
- _region_objs_del(i);
-
- E_FREE_FUNC(_rot_handler, ecore_event_handler_del);
- E_FREE_FUNC(_volume_del_hook, e_client_hook_del);
-
- _volume_wl_touch = NULL;
- _volume_ec = NULL;
-}
-
-static void
-_volume_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
-{
- if (EINA_UNLIKELY(!ec)) return;
- if (EINA_LIKELY(_volume_ec != ec)) return;
-
- ELOGF("VOLUME","Del Client", ec->pixmap, ec);
-
- _volume_client_unset();
-}
-
-static Eina_Bool
-_volume_client_cb_rot_done(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
- E_Event_Client_Rotation_Change_End *e = event;
- Rot_Idx new_idx;
-
- if (EINA_UNLIKELY(e == NULL))
- goto end;
-
- new_idx = e_mod_rotation_angle_to_idx(_volume_ec->e.state.rot.ang.curr);
- if (EINA_UNLIKELY(new_idx == -1))
- goto end;
-
- if (e->ec != _volume_ec)
- goto end;
-
- /* is new rotation same with previous? */
- if (_volume_cur_rot_idx == new_idx)
- goto end;
-
- /* hide region object in current rotation */
- REGION_OBJS_HIDE();
-
- /* update current rotation */
- _volume_cur_rot_idx = new_idx;
-
- /* show region object in current rotation */
- REGION_OBJS_SHOW();
-
-end:
- return ECORE_CALLBACK_RENEW;
-}
-
-EINTERN Eina_Bool
-e_mod_volume_client_set(E_Client *ec)
-{
- if (!ec)
- {
- if (_volume_ec)
- _volume_client_unset();
-
- return EINA_TRUE;
- }
-
- if (_volume_ec)
- {
- ERR("Volume client is already registered."
- "Multi volume service is not supported.");
- return EINA_FALSE;
- }
-
- if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
-
- ELOGF("VOLUME","Set Client", ec->pixmap, ec);
-
- _volume_ec = ec;
- _volume_cur_rot_idx = e_mod_rotation_angle_to_idx(ec->e.state.rot.ang.curr);
-
- /* repeat events for volume client. */
- evas_object_repeat_events_set(ec->frame, EINA_TRUE);
-
- _rot_handler =
- ecore_event_handler_add(E_EVENT_CLIENT_ROTATION_CHANGE_END,
- (Ecore_Event_Handler_Cb)_volume_client_cb_rot_done,
- NULL);
- _volume_del_hook =
- e_client_hook_add(E_CLIENT_HOOK_DEL, _volume_hook_client_del, NULL);
-
- // set volume layer
- if (WM_POL_VOLUME_LAYER != evas_object_layer_get(ec->frame))
- {
- evas_object_layer_set(ec->frame, WM_POL_VOLUME_LAYER);
- }
- ec->layer = WM_POL_VOLUME_LAYER;
-
- // set skip iconify
- ec->exp_iconify.skip_iconify = 1;
-
- return EINA_TRUE;
-}
-
-static Evas_Object *
-_volume_content_region_obj_new(void)
-{
- Evas_Object *obj;
-
- obj = evas_object_rectangle_add(evas_object_evas_get(_volume_ec->frame));
-
- /* make it transparent */
- evas_object_color_set(obj, 0, 0, 0, 0);
-
- /* set stack of obj object on the volume object. */
- evas_object_layer_set(obj, evas_object_layer_get(_volume_ec->frame));
- evas_object_stack_above(obj, _volume_ec->frame);
-
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE,
- _volume_region_obj_cb_mouse_move, NULL);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
- _volume_region_obj_cb_mouse_down, NULL);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
- _volume_region_obj_cb_mouse_up, NULL);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MULTI_DOWN,
- _volume_region_obj_cb_multi_down, NULL);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MULTI_UP,
- _volume_region_obj_cb_multi_up, NULL);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MULTI_MOVE,
- _volume_region_obj_cb_multi_move, NULL);
-
- return obj;
-}
-
-static void
-_region_objs_tile_set(Rot_Idx rot_idx, Eina_Tiler *tiler)
-{
- Eina_List *objs_list, *l, *ll;
- Eina_Iterator *it;
- Eina_Rectangle *r, *cr;
- Evas_Object *obj;
-
- objs_list = _volume_region_objs[rot_idx];
- it = eina_tiler_iterator_new(tiler);
- EINA_ITERATOR_FOREACH(it, r)
- {
- /* trying to reuse allocated object */
- obj = eina_list_data_get(objs_list);
- if (obj)
- {
- objs_list = eina_list_next(objs_list);
- cr = evas_object_data_get(obj, "content_rect");
- E_FREE_FUNC(cr, eina_rectangle_free);
- }
- else
- {
- obj = _volume_content_region_obj_new();
- _volume_region_objs[rot_idx] = eina_list_append(_volume_region_objs[rot_idx], obj);
- }
-
- INF("\t@@@@@ Region Set: %d %d %d %d", r->x, r->y, r->w, r->h);
- /* set geometry of region object */
- evas_object_move(obj, _volume_ec->client.x + r->x, _volume_ec->client.y + r->y);
- evas_object_resize(obj, r->w, r->h);
-
- /* store the value of reigon as a region object's data */
- cr = eina_rectangle_new(r->x, r->y, r->w, r->h);
- evas_object_data_set(obj, "content_rect", cr);
-
- if (rot_idx == _volume_cur_rot_idx)
- {
- if (evas_object_visible_get(_volume_ec->frame))
- evas_object_show(obj);
- }
- }
- eina_iterator_free(it);
-
- /* delete rest of objects after reusing */
- EINA_LIST_FOREACH_SAFE(objs_list, l, ll, obj)
- {
- _region_obj_del(obj);
- _volume_region_objs[rot_idx] =
- eina_list_remove_list(_volume_region_objs[rot_idx], l);
- }
-}
-
-static void
-_volume_content_region_set(Rot_Idx rot_idx, Eina_Tiler *tiler)
-{
- if (!tiler)
- {
- _region_objs_del(rot_idx);
- return;
- }
-
- _region_objs_tile_set(rot_idx, tiler);
-}
-
-static struct wl_resource *
-_volume_wl_touch_resource_get(void)
-{
- Eina_List *l;
- struct wl_client *wc;
- struct wl_resource *res;
-
- if (_volume_wl_touch) goto end;
-
- wc = wl_resource_get_client(_volume_ec->comp_data->surface);
- EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
-
- _volume_wl_touch = res;
- goto end;
- }
-
-end:
- return _volume_wl_touch;
-}
-
-EINTERN Eina_Bool
-e_mod_volume_region_set(int type, int angle, Eina_Tiler *tiler)
-{
- Rot_Idx rot_idx;
-
- if (EINA_UNLIKELY(!_volume_ec))
- {
- ERR("No registered volume client");
- return EINA_FALSE;
- }
-
- rot_idx = e_mod_rotation_angle_to_idx(angle);
- if (EINA_UNLIKELY(rot_idx == -1))
- return EINA_FALSE;
-
- /* FIXME: use enum instead of constant */
- if (EINA_UNLIKELY(type != 1))
- {
- ERR("Not supported region type %d", type);
- return EINA_FALSE;
- }
-
- if (EINA_UNLIKELY(_volume_wl_touch_resource_get() == NULL))
- {
- ERR("Could not found wl_touch resource for volume");
- return EINA_FALSE;
- }
-
- ELOGF("VOLUME","Content Region Set: angle %d, tiler %p",
- NULL, NULL, angle, tiler);
-
- _volume_content_region_set(rot_idx, tiler);
-
- if (!_volume_ec_ev_init)
- {
- _volume_ec_ev_init = EINA_TRUE;
-
- evas_object_event_callback_add(_volume_ec->frame, EVAS_CALLBACK_SHOW,
- _volume_client_evas_cb_show, NULL);
- evas_object_event_callback_add(_volume_ec->frame, EVAS_CALLBACK_HIDE,
- _volume_client_evas_cb_hide, NULL);
- evas_object_event_callback_add(_volume_ec->frame, EVAS_CALLBACK_MOVE,
- _volume_client_evas_cb_move, NULL);
- evas_object_event_callback_add(_volume_ec->frame, EVAS_CALLBACK_RESTACK,
- _volume_client_evas_cb_restack, NULL);
- }
-
- return EINA_TRUE;
-}
+++ /dev/null
-#ifndef E_MOD_VOLUME_H
-#define E_MOD_VOLUME_H
-
-#include "config.h"
-#ifdef HAVE_WAYLAND_ONLY
-
-#undef E_TYPEDEFS
-#include <e.h>
-
-EINTERN Eina_Bool e_mod_volume_client_set(E_Client *ec);
-EINTERN E_Client *e_mod_volume_client_get(void);
-EINTERN Eina_Bool e_mod_volume_region_set(int region_type, int angle, Eina_Tiler *tiler);
-
-#endif /* HAVE_WAYLAND_ONLY */
-#endif /* E_MOD_VOLUME_H */