--- /dev/null
+#include <libds-tizen/policy.h>
+
+#include "tinyds-tdm-common.h"
+#include "tinyds-policy.h"
+
+struct tinyds_policy
+{
+ policy_free_cb free_cb;
+ void *data;
+
+ struct ds_tizen_policy *policy;
+
+ struct wl_listener destroy;
+ struct wl_listener new_surface;
+ struct wl_listener activate_below_by_univeral_id;
+ struct wl_listener lower_by_universal_id;
+ struct wl_listener set_transient_for;
+ struct wl_listener unset_transient_for;
+ struct wl_listener place_subsurface_below_parent;
+ struct wl_listener set_subsurface_stand_alone;
+ struct wl_listener set_background_state;
+ struct wl_listener unset_background_state;
+ struct wl_listener add_activate_above_by_universal_id;
+ struct wl_listener set_appid;
+ struct wl_listener set_transient_for_below;
+
+ struct wl_list policy_surfaces;
+};
+
+struct tinyds_policy_surface
+{
+ struct ds_tizen_policy_surface *policy_surface;
+
+ struct wl_listener destroy;
+ struct wl_listener new_visibility;
+ struct wl_listener new_position;
+ struct wl_listener activate;
+ struct wl_listener raise;
+ struct wl_listener lower;
+ struct wl_listener set_focus_skip;
+ struct wl_listener unset_focus_skip;
+ struct wl_listener set_role;
+ struct wl_listener set_window_type;
+ struct wl_listener set_conformant;
+ struct wl_listener unset_conformant;
+ struct wl_listener get_conformant;
+ struct wl_listener set_notification_level;
+ struct wl_listener set_window_screen_mode;
+ struct wl_listener get_subsurface;
+ struct wl_listener iconify;
+ struct wl_listener uniconify;
+ struct wl_listener add_aux_hint;
+ struct wl_listener change_aux_hint;
+ struct wl_listener delete_aux_hint;
+ struct wl_listener get_supported_aux_hints;
+ struct wl_listener set_floating_mode;
+ struct wl_listener unset_floating_mode;
+ struct wl_listener set_stack_mode;
+ struct wl_listener new_subsurface_watcher;
+ struct wl_listener set_parent;
+ struct wl_listener ack_conformant_region;
+ struct wl_listener set_video;
+ struct wl_listener show;
+ struct wl_listener hide;
+ struct wl_listener set_parent_with_below;
+
+ struct wl_list visibilities;
+ struct wl_list positions;
+ struct wl_list subsurface_watchers;
+
+ struct wl_list link; //tinyds_policy::policy_surfaces
+};
+
+struct tinyds_policy_visibility
+{
+ struct ds_tizen_policy_visibility *visibility;
+
+ struct wl_listener destroy;
+
+ struct wl_list link; //tinyds_policy::visibilities
+};
+
+struct tinyds_policy_position
+{
+ struct ds_tizen_policy_position *position;
+
+ struct wl_listener destroy;
+ struct wl_listener set;
+
+ struct wl_list link; //tinyds_policy::positions
+};
+
+struct tinyds_policy_subsurface_watcher
+{
+ struct ds_tizen_policy_subsurface_watcher *subsurface_watcher;
+
+ struct wl_listener destroy;
+
+ struct wl_list link; //tinyds_policy::subsurface_watchers
+};
+
+
+static void
+visibility_handle_destroy(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_visibility *visibility;
+
+ visibility = wl_container_of(listener, visibility, destroy);
+
+ ds_inf("Policy Visibility(%p) destroy", visibility);
+
+ wl_list_remove(&visibility->destroy.link);
+ wl_list_remove(&visibility->link);
+ free(visibility);
+}
+
+static void
+position_handle_destroy(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_position *position;
+
+ position = wl_container_of(listener, position, destroy);
+
+ ds_inf("Policy Position(%p) destroy", position);
+
+ wl_list_remove(&position->destroy.link);
+ wl_list_remove(&position->set.link);
+ wl_list_remove(&position->link);
+ free(position);
+}
+
+static void
+position_handle_set(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_position *position;
+
+ position = wl_container_of(listener, position, set);
+
+ ds_inf("Policy Position(%p) set", position);
+
+ // TODO:
+}
+
+static void
+subsurface_watcher_handle_destroy(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_subsurface_watcher *subsurface_watcher;
+
+ subsurface_watcher = wl_container_of(listener, subsurface_watcher, destroy);
+
+ ds_inf("Policy Subsurface_Watcher(%p) destroy", subsurface_watcher);
+
+ wl_list_remove(&subsurface_watcher->destroy.link);
+ wl_list_remove(&subsurface_watcher->link);
+ free(subsurface_watcher);
+}
+
+static void
+policy_surface_handle_destroy(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, destroy);
+
+ ds_inf("Policy Info(%p) destroy", policy_surface);
+
+ wl_list_remove(&policy_surface->destroy.link);
+ wl_list_remove(&policy_surface->new_visibility.link);
+ wl_list_remove(&policy_surface->new_position.link);
+ wl_list_remove(&policy_surface->activate.link);
+ wl_list_remove(&policy_surface->raise.link);
+ wl_list_remove(&policy_surface->lower.link);
+ wl_list_remove(&policy_surface->set_focus_skip.link);
+ wl_list_remove(&policy_surface->unset_focus_skip.link);
+ wl_list_remove(&policy_surface->set_role.link);
+ wl_list_remove(&policy_surface->set_window_type.link);
+ wl_list_remove(&policy_surface->set_conformant.link);
+ wl_list_remove(&policy_surface->unset_conformant.link);
+ wl_list_remove(&policy_surface->get_conformant.link);
+ wl_list_remove(&policy_surface->set_notification_level.link);
+ wl_list_remove(&policy_surface->set_window_screen_mode.link);
+ wl_list_remove(&policy_surface->get_subsurface.link);
+ wl_list_remove(&policy_surface->iconify.link);
+ wl_list_remove(&policy_surface->uniconify.link);
+ wl_list_remove(&policy_surface->add_aux_hint.link);
+ wl_list_remove(&policy_surface->change_aux_hint.link);
+ wl_list_remove(&policy_surface->delete_aux_hint.link);
+ wl_list_remove(&policy_surface->get_supported_aux_hints.link);
+ wl_list_remove(&policy_surface->set_floating_mode.link);
+ wl_list_remove(&policy_surface->unset_floating_mode.link);
+ wl_list_remove(&policy_surface->set_stack_mode.link);
+ wl_list_remove(&policy_surface->new_subsurface_watcher.link);
+ wl_list_remove(&policy_surface->set_parent.link);
+ wl_list_remove(&policy_surface->ack_conformant_region.link);
+ wl_list_remove(&policy_surface->set_video.link);
+ wl_list_remove(&policy_surface->show.link);
+ wl_list_remove(&policy_surface->hide.link);
+ wl_list_remove(&policy_surface->set_parent_with_below.link);
+ wl_list_remove(&policy_surface->link);
+ free(policy_surface);
+}
+
+static void
+policy_surface_handle_new_visibility(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+ struct tinyds_policy_visibility *visibility;
+ struct ds_tizen_event_policy_surface_new_visibility *event;
+
+ policy_surface = wl_container_of(listener, policy_surface, new_visibility);
+ event = (struct ds_tizen_event_policy_surface_new_visibility *)data;
+
+ ds_inf("Policy Info(%p) new_visibility", policy_surface);
+
+ visibility = calloc(1, sizeof *visibility);
+ if (!visibility)
+ return;
+
+ visibility->visibility = event->visibility;
+
+ visibility->destroy.notify = visibility_handle_destroy;
+ ds_tizen_policy_visibility_add_destroy_listener(visibility->visibility,
+ &visibility->destroy);
+
+ wl_list_insert(&policy_surface->visibilities, &visibility->link);
+}
+
+static void
+policy_surface_handle_new_position(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+ struct tinyds_policy_position *position;
+ struct ds_tizen_event_policy_surface_new_position *event;
+
+ policy_surface = wl_container_of(listener, policy_surface, new_position);
+ event = (struct ds_tizen_event_policy_surface_new_position *)data;
+
+ ds_inf("Policy Info(%p) new_position", policy_surface);
+
+ position = calloc(1, sizeof *position);
+ if (!position)
+ return;
+
+ position->position = event->position;
+
+ position->destroy.notify = position_handle_destroy;
+ ds_tizen_policy_position_add_destroy_listener(position->position,
+ &position->destroy);
+
+ position->set.notify = position_handle_set;
+ ds_tizen_policy_position_add_set_listener(position->position,
+ &position->set);
+
+ wl_list_insert(&policy_surface->positions, &position->link);
+}
+
+static void
+policy_surface_handle_activate(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, activate);
+
+ ds_inf("Policy Info(%p) activate", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_raise(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, raise);
+
+ ds_inf("Policy Info(%p) raise", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_lower(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, raise);
+
+ ds_inf("Policy Info(%p) lower", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_focus_skip(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_focus_skip);
+
+ ds_inf("Policy Info(%p) set_focus_skip", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_unset_focus_skip(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, unset_focus_skip);
+
+ ds_inf("Policy Info(%p) unset_focus_skip", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_role(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_role);
+
+ ds_inf("Policy Info(%p) set_role", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_window_type(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_window_type);
+
+ ds_inf("Policy Info(%p) set_window_type", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_conformant(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_conformant);
+
+ ds_inf("Policy Info(%p) set_conformant", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_unset_conformant(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, unset_conformant);
+
+ ds_inf("Policy Info(%p) unset_conformant", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_get_conformant(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, get_conformant);
+
+ ds_inf("Policy Info(%p) get_conformant", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_notification_level(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_notification_level);
+
+ ds_inf("Policy Info(%p) set_notification_level", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_window_screen_mode(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_window_screen_mode);
+
+ ds_inf("Policy Info(%p) set_window_screen_mode", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_get_subsurface(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, get_subsurface);
+
+ ds_inf("Policy Info(%p) get_subsurface", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_iconify(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, iconify);
+
+ ds_inf("Policy Info(%p) iconify", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_uniconify(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, uniconify);
+
+ ds_inf("Policy Info(%p) uniconify", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_add_aux_hint(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, add_aux_hint);
+
+ ds_inf("Policy Info(%p) add_aux_hint", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_change_aux_hint(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, change_aux_hint);
+
+ ds_inf("Policy Info(%p) change_aux_hint", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_delete_aux_hint(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, delete_aux_hint);
+
+ ds_inf("Policy Info(%p) delete_aux_hint", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_get_supported_aux_hints(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, get_supported_aux_hints);
+
+ ds_inf("Policy Info(%p) get_supported_aux_hints", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_floating_mode(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_floating_mode);
+
+ ds_inf("Policy Info(%p) set_floating_mode", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_unset_floating_mode(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, unset_floating_mode);
+
+ ds_inf("Policy Info(%p) unset_floating_mode", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_stack_mode(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_stack_mode);
+
+ ds_inf("Policy Info(%p) set_stack_mode", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_new_subsurface_watcher(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+ struct tinyds_policy_subsurface_watcher*subsurface_watcher;
+ struct ds_tizen_event_policy_surface_new_subsurface_watcher *event;
+
+ policy_surface = wl_container_of(listener, policy_surface, new_subsurface_watcher);
+ event = (struct ds_tizen_event_policy_surface_new_subsurface_watcher *)data;
+
+ ds_inf("Policy Info(%p) new_subsurface_watcher", policy_surface);
+
+ subsurface_watcher = calloc(1, sizeof *subsurface_watcher);
+ if (!subsurface_watcher)
+ return;
+
+ subsurface_watcher->subsurface_watcher = event->subsurface_watcher;
+
+ subsurface_watcher->destroy.notify = subsurface_watcher_handle_destroy;
+ ds_tizen_policy_subsurface_watcher_add_destroy_listener(subsurface_watcher->subsurface_watcher,
+ &subsurface_watcher->destroy);
+
+ wl_list_insert(&policy_surface->subsurface_watchers, &subsurface_watcher->link);
+}
+
+static void
+policy_surface_handle_set_parent(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_parent);
+
+ ds_inf("Policy Info(%p) set_parent", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_ack_conformant_region(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, ack_conformant_region);
+
+ ds_inf("Policy Info(%p) ack_conformant_region", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_video(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_video);
+
+ ds_inf("Policy Info(%p) set_video", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_show(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, show);
+
+ ds_inf("Policy Info(%p) show", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_hide(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, hide);
+
+ ds_inf("Policy Info(%p) hide", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_surface_handle_set_parent_with_below(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy_surface *policy_surface;
+
+ policy_surface = wl_container_of(listener, policy_surface, set_parent_with_below);
+
+ ds_inf("Policy Info(%p) set_parent_with_below", policy_surface);
+
+ // TODO:
+}
+
+static void
+policy_handle_destroy(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, destroy);
+
+ ds_inf("Policy(%p) destroy", policy);
+
+ policy->free_cb(data);
+
+ wl_list_remove(&policy->destroy.link);
+ wl_list_remove(&policy->new_surface.link);
+ wl_list_remove(&policy->activate_below_by_univeral_id.link);
+ wl_list_remove(&policy->lower_by_universal_id.link);
+ wl_list_remove(&policy->set_transient_for.link);
+ wl_list_remove(&policy->unset_transient_for.link);
+ wl_list_remove(&policy->place_subsurface_below_parent.link);
+ wl_list_remove(&policy->set_subsurface_stand_alone.link);
+ wl_list_remove(&policy->set_background_state.link);
+ wl_list_remove(&policy->unset_background_state.link);
+ wl_list_remove(&policy->add_activate_above_by_universal_id.link);
+ wl_list_remove(&policy->set_appid.link);
+ wl_list_remove(&policy->set_transient_for_below.link);
+
+ free(policy);
+}
+
+static void
+policy_handle_new_surface(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+ struct tinyds_policy_surface *policy_surface;
+ struct ds_tizen_event_policy_new_surface *event;
+
+ policy = wl_container_of(listener, policy, new_surface);
+ event = (struct ds_tizen_event_policy_new_surface *)data;
+
+ ds_inf("Policy(%p) new_surface", policy);
+
+ policy_surface = calloc(1, sizeof *policy_surface);
+ if (!policy_surface)
+ return;
+
+ policy_surface->policy_surface = event->policy_surface;
+
+ policy_surface->destroy.notify = policy_surface_handle_destroy;
+ ds_tizen_policy_surface_add_destroy_listener(policy_surface->policy_surface,
+ &policy_surface->destroy);
+
+ policy_surface->new_visibility.notify = policy_surface_handle_new_visibility;
+ ds_tizen_policy_surface_add_new_visibility_listener(policy_surface->policy_surface,
+ &policy_surface->new_visibility);
+
+ policy_surface->new_position.notify = policy_surface_handle_new_position;
+ ds_tizen_policy_surface_add_new_position_listener(policy_surface->policy_surface,
+ &policy_surface->new_position);
+
+ policy_surface->activate.notify = policy_surface_handle_activate;
+ ds_tizen_policy_surface_add_activate_listener(policy_surface->policy_surface,
+ &policy_surface->activate);
+
+ policy_surface->raise.notify = policy_surface_handle_raise;
+ ds_tizen_policy_surface_add_raise_listener(policy_surface->policy_surface,
+ &policy_surface->raise);
+
+ policy_surface->lower.notify = policy_surface_handle_lower;
+ ds_tizen_policy_surface_add_lower_listener(policy_surface->policy_surface,
+ &policy_surface->lower);
+
+ policy_surface->set_focus_skip.notify = policy_surface_handle_set_focus_skip;
+ ds_tizen_policy_surface_add_set_focus_skip_listener(policy_surface->policy_surface,
+ &policy_surface->set_focus_skip);
+
+ policy_surface->unset_focus_skip.notify = policy_surface_handle_unset_focus_skip;
+ ds_tizen_policy_surface_add_unset_focus_skip_listener(policy_surface->policy_surface,
+ &policy_surface->unset_focus_skip);
+
+ policy_surface->set_role.notify = policy_surface_handle_set_role;
+ ds_tizen_policy_surface_add_set_role_listener(policy_surface->policy_surface,
+ &policy_surface->set_role);
+
+ policy_surface->set_window_type.notify = policy_surface_handle_set_window_type;
+ ds_tizen_policy_surface_add_set_window_type_listener(policy_surface->policy_surface,
+ &policy_surface->set_window_type);
+
+ policy_surface->set_conformant.notify = policy_surface_handle_set_conformant;
+ ds_tizen_policy_surface_add_set_conformant_listener(policy_surface->policy_surface,
+ &policy_surface->set_conformant);
+
+ policy_surface->unset_conformant.notify = policy_surface_handle_unset_conformant;
+ ds_tizen_policy_surface_add_unset_conformant_listener(policy_surface->policy_surface,
+ &policy_surface->unset_conformant);
+
+ policy_surface->get_conformant.notify = policy_surface_handle_get_conformant;
+ ds_tizen_policy_surface_add_get_conformant_listener(policy_surface->policy_surface,
+ &policy_surface->get_conformant);
+
+ policy_surface->set_notification_level.notify =
+ policy_surface_handle_set_notification_level;
+ ds_tizen_policy_surface_add_set_notification_level_listener(
+ policy_surface->policy_surface, &policy_surface->set_notification_level);
+
+ policy_surface->set_window_screen_mode.notify =
+ policy_surface_handle_set_window_screen_mode;
+ ds_tizen_policy_surface_add_set_window_screen_mode_listener(
+ policy_surface->policy_surface, &policy_surface->set_window_screen_mode);
+
+ policy_surface->get_subsurface.notify = policy_surface_handle_get_subsurface;
+ ds_tizen_policy_surface_add_get_subsurface_listener(policy_surface->policy_surface,
+ &policy_surface->get_subsurface);
+
+ policy_surface->iconify.notify = policy_surface_handle_iconify;
+ ds_tizen_policy_surface_add_iconify_listener(policy_surface->policy_surface,
+ &policy_surface->iconify);
+
+ policy_surface->uniconify.notify = policy_surface_handle_uniconify;
+ ds_tizen_policy_surface_add_uniconify_listener(policy_surface->policy_surface,
+ &policy_surface->uniconify);
+
+ policy_surface->add_aux_hint.notify = policy_surface_handle_add_aux_hint;
+ ds_tizen_policy_surface_add_add_aux_hint_listener(policy_surface->policy_surface,
+ &policy_surface->add_aux_hint);
+
+ policy_surface->change_aux_hint.notify = policy_surface_handle_change_aux_hint;
+ ds_tizen_policy_surface_add_change_aux_hint_listener(policy_surface->policy_surface,
+ &policy_surface->change_aux_hint);
+
+ policy_surface->delete_aux_hint.notify = policy_surface_handle_delete_aux_hint;
+ ds_tizen_policy_surface_add_delete_aux_hint_listener(policy_surface->policy_surface,
+ &policy_surface->delete_aux_hint);
+
+ policy_surface->get_supported_aux_hints.notify =
+ policy_surface_handle_get_supported_aux_hints;
+ ds_tizen_policy_surface_add_get_supported_aux_hints_listener(
+ policy_surface->policy_surface, &policy_surface->get_supported_aux_hints);
+
+ policy_surface->set_floating_mode.notify =
+ policy_surface_handle_set_floating_mode;
+ ds_tizen_policy_surface_add_set_floating_mode_listener(
+ policy_surface->policy_surface, &policy_surface->set_floating_mode);
+
+ policy_surface->unset_floating_mode.notify =
+ policy_surface_handle_unset_floating_mode;
+ ds_tizen_policy_surface_add_unset_floating_mode_listener(
+ policy_surface->policy_surface, &policy_surface->unset_floating_mode);
+
+ policy_surface->set_stack_mode.notify = policy_surface_handle_set_stack_mode;
+ ds_tizen_policy_surface_add_set_stack_mode_listener(policy_surface->policy_surface,
+ &policy_surface->set_stack_mode);
+
+ policy_surface->new_subsurface_watcher.notify =
+ policy_surface_handle_new_subsurface_watcher;
+ ds_tizen_policy_surface_add_new_subsurface_watcher_listener(
+ policy_surface->policy_surface, &policy_surface->new_subsurface_watcher);
+
+ policy_surface->set_parent.notify = policy_surface_handle_set_parent;
+ ds_tizen_policy_surface_add_set_parent_listener(policy_surface->policy_surface,
+ &policy_surface->set_parent);
+
+ policy_surface->ack_conformant_region.notify =
+ policy_surface_handle_ack_conformant_region;
+ ds_tizen_policy_surface_add_ack_conformant_region_listener(
+ policy_surface->policy_surface, &policy_surface->ack_conformant_region);
+
+ policy_surface->set_video.notify = policy_surface_handle_set_video;
+ ds_tizen_policy_surface_add_set_video_listener(policy_surface->policy_surface,
+ &policy_surface->set_video);
+
+ policy_surface->show.notify = policy_surface_handle_show;
+ ds_tizen_policy_surface_add_show_listener(policy_surface->policy_surface,
+ &policy_surface->show);
+
+ policy_surface->hide.notify = policy_surface_handle_hide;
+ ds_tizen_policy_surface_add_hide_listener(policy_surface->policy_surface,
+ &policy_surface->hide);
+
+ policy_surface->set_parent_with_below.notify =
+ policy_surface_handle_set_parent_with_below;
+ ds_tizen_policy_surface_add_set_parent_with_below_listener(
+ policy_surface->policy_surface, &policy_surface->set_parent_with_below);
+
+
+ wl_list_init(&policy_surface->visibilities);
+ wl_list_init(&policy_surface->positions);
+ wl_list_init(&policy_surface->subsurface_watchers);
+
+ wl_list_insert(&policy->policy_surfaces, &policy_surface->link);
+}
+
+static void
+policy_handle_activate_below_by_univeral_id(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, activate_below_by_univeral_id);
+
+ ds_inf("Policy(%p) activate_below_by_univeral_id", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_lower_by_universal_id(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, lower_by_universal_id);
+
+ ds_inf("Policy(%p) lower_by_universal_id", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_set_transient_for(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, set_transient_for);
+
+ ds_inf("Policy(%p) set_transient_for", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_unset_transient_for(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, unset_transient_for);
+
+ ds_inf("Policy(%p) unset_transient_for", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_place_subsurface_below_parent(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, place_subsurface_below_parent);
+
+ ds_inf("Policy(%p) place_subsurface_below_parent", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_set_subsurface_stand_alone(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, set_subsurface_stand_alone);
+
+ ds_inf("Policy(%p) set_subsurface_stand_alone", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_set_background_state(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, set_background_state);
+
+ ds_inf("Policy(%p) set_background_state", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_unset_background_state(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, unset_background_state);
+
+ ds_inf("Policy(%p) unset_background_state", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_add_activate_above_by_universal_id(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, add_activate_above_by_universal_id);
+
+ ds_inf("Policy(%p) add_activate_above_by_universal_id", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_set_appid(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, set_appid);
+
+ ds_inf("Policy(%p) set_appid", policy);
+
+ // TODO:
+}
+
+static void
+policy_handle_set_transient_for_below(struct wl_listener *listener, void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = wl_container_of(listener, policy, set_transient_for_below);
+
+ ds_inf("Policy(%p) set_transient_for_below", policy);
+
+ // TODO:
+}
+
+struct tinyds_policy *
+tinyds_policy_init(struct wl_display *display, policy_free_cb free_cb,
+ void *data)
+{
+ struct tinyds_policy *policy;
+
+ policy = calloc(1, sizeof *policy);
+ if (!policy)
+ return NULL;
+
+ policy->free_cb = free_cb;
+ data = data;
+
+ policy->policy = ds_tizen_policy_create(display);
+ if (!policy->policy) {
+ free(policy);
+ ds_err("Could not create ds_tizen_policy");
+ return NULL;
+ }
+
+ policy->destroy.notify = policy_handle_destroy;
+ ds_tizen_policy_add_destroy_listener(policy->policy, &policy->destroy);
+
+ policy->new_surface.notify = policy_handle_new_surface;
+ ds_tizen_policy_add_new_surface_listener(policy->policy, &policy->new_surface);
+
+ policy->activate_below_by_univeral_id.notify =
+ policy_handle_activate_below_by_univeral_id;
+ ds_tizen_policy_add_activate_below_by_univeral_id_listener(policy->policy,
+ &policy->activate_below_by_univeral_id);
+
+ policy->lower_by_universal_id.notify = policy_handle_lower_by_universal_id;
+ ds_tizen_policy_add_lower_by_universal_id_listener(policy->policy,
+ &policy->lower_by_universal_id);
+
+ policy->set_transient_for.notify = policy_handle_set_transient_for;
+ ds_tizen_policy_add_set_transient_for_listener(policy->policy,
+ &policy->set_transient_for);
+
+ policy->unset_transient_for.notify = policy_handle_unset_transient_for;
+ ds_tizen_policy_add_unset_transient_for_listener(policy->policy,
+ &policy->unset_transient_for);
+
+ policy->place_subsurface_below_parent.notify =
+ policy_handle_place_subsurface_below_parent;
+ ds_tizen_policy_add_place_subsurface_below_parent_listener(policy->policy,
+ &policy->place_subsurface_below_parent);
+
+ policy->set_subsurface_stand_alone.notify =
+ policy_handle_set_subsurface_stand_alone;
+ ds_tizen_policy_add_set_subsurface_stand_alone_listener(policy->policy,
+ &policy->set_subsurface_stand_alone);
+
+ policy->set_background_state.notify = policy_handle_set_background_state;
+ ds_tizen_policy_add_set_background_state_listener(policy->policy,
+ &policy->set_background_state);
+
+ policy->unset_background_state.notify = policy_handle_unset_background_state;
+ ds_tizen_policy_add_unset_background_state_listener(policy->policy,
+ &policy->unset_background_state);
+
+ policy->add_activate_above_by_universal_id.notify =
+ policy_handle_add_activate_above_by_universal_id;
+ ds_tizen_policy_add_activate_above_by_universal_id_listener(policy->policy,
+ &policy->add_activate_above_by_universal_id);
+
+ policy->set_appid.notify = policy_handle_set_appid;
+ ds_tizen_policy_add_set_appid_listener(policy->policy, &policy->set_appid);
+
+ policy->set_transient_for_below.notify =
+ policy_handle_set_transient_for_below;
+ ds_tizen_policy_add_set_transient_for_below_listener(policy->policy,
+ &policy->set_transient_for_below);
+
+ wl_list_init(&policy->policy_surfaces);
+
+ ds_inf("Policy (%p) created", policy);
+
+ return policy;
+}
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <time.h>
-
-#include <drm_fourcc.h>
-#include <pixman.h>
-#include <wayland-server.h>
-#include <libds/log.h>
-#include <libds/backend.h>
-#include <libds/output.h>
-#include <libds/compositor.h>
-#include <libds/xdg_shell.h>
-#include <libds-tizen/allocator/tbm.h>
-#include <libds-tizen/backend/tdm.h>
-#include <libds/backend/libinput.h>
-#include <libds-tizen/tbm_server.h>
-#include <libds-tizen/dpms.h>
-#include <libds/input_device.h>
-#include <libds/keyboard.h>
-#include <libds/touch.h>
-#include <libds/pointer.h>
-#include <libds/seat.h>
-#include <libds-tizen/input_devicemgr.h>
-#include <xkbcommon/xkbcommon.h>
-#include <libds/interfaces/keyboard.h>
-#include <libds-tizen/launch.h>
-#include <libds-tizen/backend/tdm_output_hwc.h>
-#include <libds-tizen/input_method.h>
-#include <libds-tizen/text_input.h>
-#include <libds-tizen/policy.h>
-
-#define USE_TDM_BUFFER_QUEUE
-#define CURSOR_W 10
-#define CURSOR_H 16
-
-#ifdef USE_TDM_BUFFER_QUEUE
-#include "pixman-tbm-helper.h"
-#include "tinyds-tdm-renderer.h"
-#else
-#include <libds/swapchain.h>
-#endif
-
-#include "pixman-helper.h"
-#include "protocol-trace.h"
-
-#define TINYDS_UNUSED __attribute__((unused))
-struct tinyds_keyboard;
-struct tinyds_pointer;
+#include "tinyds-tdm.h"
struct tinyds_output
{
struct wl_listener get_dpms;
};
-struct tinyds_policy
-{
- struct ds_tizen_policy *policy;
-
- struct wl_listener destroy;
- struct wl_listener new_surface;
- struct wl_listener activate_below_by_univeral_id;
- struct wl_listener lower_by_universal_id;
- struct wl_listener set_transient_for;
- struct wl_listener unset_transient_for;
- struct wl_listener place_subsurface_below_parent;
- struct wl_listener set_subsurface_stand_alone;
- struct wl_listener set_background_state;
- struct wl_listener unset_background_state;
- struct wl_listener add_activate_above_by_universal_id;
- struct wl_listener set_appid;
- struct wl_listener set_transient_for_below;
-
- struct wl_list policy_surfaces;
-};
-
-struct tinyds_policy_surface
-{
- struct ds_tizen_policy_surface *policy_surface;
-
- struct wl_listener destroy;
- struct wl_listener new_visibility;
- struct wl_listener new_position;
- struct wl_listener activate;
- struct wl_listener raise;
- struct wl_listener lower;
- struct wl_listener set_focus_skip;
- struct wl_listener unset_focus_skip;
- struct wl_listener set_role;
- struct wl_listener set_window_type;
- struct wl_listener set_conformant;
- struct wl_listener unset_conformant;
- struct wl_listener get_conformant;
- struct wl_listener set_notification_level;
- struct wl_listener set_window_screen_mode;
- struct wl_listener get_subsurface;
- struct wl_listener iconify;
- struct wl_listener uniconify;
- struct wl_listener add_aux_hint;
- struct wl_listener change_aux_hint;
- struct wl_listener delete_aux_hint;
- struct wl_listener get_supported_aux_hints;
- struct wl_listener set_floating_mode;
- struct wl_listener unset_floating_mode;
- struct wl_listener set_stack_mode;
- struct wl_listener new_subsurface_watcher;
- struct wl_listener set_parent;
- struct wl_listener ack_conformant_region;
- struct wl_listener set_video;
- struct wl_listener show;
- struct wl_listener hide;
- struct wl_listener set_parent_with_below;
-
- struct wl_list visibilities;
- struct wl_list positions;
- struct wl_list subsurface_watchers;
-
- struct wl_list link; //tinyds_policy::policy_surfaces
-};
-
-struct tinyds_policy_visibility
-{
- struct ds_tizen_policy_visibility *visibility;
-
- struct wl_listener destroy;
-
- struct wl_list link; //tinyds_policy::visibilities
-};
-
-struct tinyds_policy_position
-{
- struct ds_tizen_policy_position *position;
-
- struct wl_listener destroy;
- struct wl_listener set;
-
- struct wl_list link; //tinyds_policy::positions
-};
-
-struct tinyds_policy_subsurface_watcher
-{
- struct ds_tizen_policy_subsurface_watcher *subsurface_watcher;
-
- struct wl_listener destroy;
-
- struct wl_list link; //tinyds_policy::subsurface_watchers
-};
-
-struct tinyds_server
-{
- struct ds_tbm_server *tbm_server;
-
- struct wl_display *display;
-
- struct ds_backend *backend;
- struct ds_backend *input_backend;
- struct ds_compositor *compositor;
- struct ds_xdg_shell *xdg_shell;
- struct ds_seat *seat;
- uint32_t seat_caps;
- double output_x, output_y;
- struct ds_tizen_input_devicemgr *devicemgr;
- struct ds_tizen_launch_effect *effect;
- struct ds_tizen_launch_splash *splash;
-
- struct tinyds_output *output;
- struct tinyds_dpms *dpms;
- struct tinyds_policy *policy;
-
- struct wl_event_source *stdin_source;
-
- struct wl_list views;
-
- struct wl_listener new_output;
- struct wl_listener new_input;
- struct wl_listener new_xdg_surface;
- struct wl_listener devicemgr_destroy;
- struct wl_listener pointer_warp;
- struct wl_listener effect_destroy;
- struct wl_listener effect_type_set;
- struct wl_listener effect_type_unset;
- struct wl_listener new_splash;
- struct wl_listener splash_owner;
-
- struct wl_list keyboards;
- struct wl_list pointers;
-
- struct tinyds_text_input *text_input;
- struct tinyds_input_method *input_method;
-};
-
struct tinyds_view
{
struct tinyds_server *server;
struct ds_input_device *dev);
static void server_add_touch(struct tinyds_server *server,
struct ds_input_device *dev);
-static bool new_policy(struct tinyds_server *server);
static struct tinyds_view *
server_view_at(struct tinyds_server *server, double lx, double ly,
double *sx, double *sy);
&server->splash_owner);
}
+static void
+policy_free_func(void *data)
+{
+ struct tinyds_server *server = (struct tinyds_server *)data;
+
+ server->policy = NULL;
+}
+
static bool
init_server(struct tinyds_server *server, struct wl_display *display)
{
if (!add_new_dpms(server))
goto err;
- if (!new_policy(server))
+ server->policy = tinyds_policy_init(server->display, policy_free_func, (void *)server);
+ if (!server->policy)
goto err;
server->seat = ds_seat_create(display, "seat0" /* arbitrary name */);
return true;
}
-
-static void
-visibility_handle_destroy(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_visibility *visibility;
-
- visibility = wl_container_of(listener, visibility, destroy);
-
- ds_inf("Policy Visibility(%p) destroy", visibility);
-
- wl_list_remove(&visibility->destroy.link);
- wl_list_remove(&visibility->link);
- free(visibility);
-}
-
-static void
-position_handle_destroy(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_position *position;
-
- position = wl_container_of(listener, position, destroy);
-
- ds_inf("Policy Position(%p) destroy", position);
-
- wl_list_remove(&position->destroy.link);
- wl_list_remove(&position->set.link);
- wl_list_remove(&position->link);
- free(position);
-}
-
-static void
-position_handle_set(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_position *position;
-
- position = wl_container_of(listener, position, set);
-
- ds_inf("Policy Position(%p) set", position);
-
- // TODO:
-}
-
-static void
-subsurface_watcher_handle_destroy(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_subsurface_watcher *subsurface_watcher;
-
- subsurface_watcher = wl_container_of(listener, subsurface_watcher, destroy);
-
- ds_inf("Policy Subsurface_Watcher(%p) destroy", subsurface_watcher);
-
- wl_list_remove(&subsurface_watcher->destroy.link);
- wl_list_remove(&subsurface_watcher->link);
- free(subsurface_watcher);
-}
-
-static void
-policy_surface_handle_destroy(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, destroy);
-
- ds_inf("Policy Info(%p) destroy", policy_surface);
-
- wl_list_remove(&policy_surface->destroy.link);
- wl_list_remove(&policy_surface->new_visibility.link);
- wl_list_remove(&policy_surface->new_position.link);
- wl_list_remove(&policy_surface->activate.link);
- wl_list_remove(&policy_surface->raise.link);
- wl_list_remove(&policy_surface->lower.link);
- wl_list_remove(&policy_surface->set_focus_skip.link);
- wl_list_remove(&policy_surface->unset_focus_skip.link);
- wl_list_remove(&policy_surface->set_role.link);
- wl_list_remove(&policy_surface->set_window_type.link);
- wl_list_remove(&policy_surface->set_conformant.link);
- wl_list_remove(&policy_surface->unset_conformant.link);
- wl_list_remove(&policy_surface->get_conformant.link);
- wl_list_remove(&policy_surface->set_notification_level.link);
- wl_list_remove(&policy_surface->set_window_screen_mode.link);
- wl_list_remove(&policy_surface->get_subsurface.link);
- wl_list_remove(&policy_surface->iconify.link);
- wl_list_remove(&policy_surface->uniconify.link);
- wl_list_remove(&policy_surface->add_aux_hint.link);
- wl_list_remove(&policy_surface->change_aux_hint.link);
- wl_list_remove(&policy_surface->delete_aux_hint.link);
- wl_list_remove(&policy_surface->get_supported_aux_hints.link);
- wl_list_remove(&policy_surface->set_floating_mode.link);
- wl_list_remove(&policy_surface->unset_floating_mode.link);
- wl_list_remove(&policy_surface->set_stack_mode.link);
- wl_list_remove(&policy_surface->new_subsurface_watcher.link);
- wl_list_remove(&policy_surface->set_parent.link);
- wl_list_remove(&policy_surface->ack_conformant_region.link);
- wl_list_remove(&policy_surface->set_video.link);
- wl_list_remove(&policy_surface->show.link);
- wl_list_remove(&policy_surface->hide.link);
- wl_list_remove(&policy_surface->set_parent_with_below.link);
- wl_list_remove(&policy_surface->link);
- free(policy_surface);
-}
-
-static void
-policy_surface_handle_new_visibility(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
- struct tinyds_policy_visibility *visibility;
- struct ds_tizen_event_policy_surface_new_visibility *event;
-
- policy_surface = wl_container_of(listener, policy_surface, new_visibility);
- event = (struct ds_tizen_event_policy_surface_new_visibility *)data;
-
- ds_inf("Policy Info(%p) new_visibility", policy_surface);
-
- visibility = calloc(1, sizeof *visibility);
- if (!visibility)
- return;
-
- visibility->visibility = event->visibility;
-
- visibility->destroy.notify = visibility_handle_destroy;
- ds_tizen_policy_visibility_add_destroy_listener(visibility->visibility,
- &visibility->destroy);
-
- wl_list_insert(&policy_surface->visibilities, &visibility->link);
-}
-
-static void
-policy_surface_handle_new_position(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
- struct tinyds_policy_position *position;
- struct ds_tizen_event_policy_surface_new_position *event;
-
- policy_surface = wl_container_of(listener, policy_surface, new_position);
- event = (struct ds_tizen_event_policy_surface_new_position *)data;
-
- ds_inf("Policy Info(%p) new_position", policy_surface);
-
- position = calloc(1, sizeof *position);
- if (!position)
- return;
-
- position->position = event->position;
-
- position->destroy.notify = position_handle_destroy;
- ds_tizen_policy_position_add_destroy_listener(position->position,
- &position->destroy);
-
- position->set.notify = position_handle_set;
- ds_tizen_policy_position_add_set_listener(position->position,
- &position->set);
-
- wl_list_insert(&policy_surface->positions, &position->link);
-}
-
-static void
-policy_surface_handle_activate(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, activate);
-
- ds_inf("Policy Info(%p) activate", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_raise(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, raise);
-
- ds_inf("Policy Info(%p) raise", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_lower(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, raise);
-
- ds_inf("Policy Info(%p) lower", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_focus_skip(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_focus_skip);
-
- ds_inf("Policy Info(%p) set_focus_skip", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_unset_focus_skip(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, unset_focus_skip);
-
- ds_inf("Policy Info(%p) unset_focus_skip", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_role(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_role);
-
- ds_inf("Policy Info(%p) set_role", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_window_type(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_window_type);
-
- ds_inf("Policy Info(%p) set_window_type", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_conformant(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_conformant);
-
- ds_inf("Policy Info(%p) set_conformant", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_unset_conformant(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, unset_conformant);
-
- ds_inf("Policy Info(%p) unset_conformant", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_get_conformant(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, get_conformant);
-
- ds_inf("Policy Info(%p) get_conformant", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_notification_level(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_notification_level);
-
- ds_inf("Policy Info(%p) set_notification_level", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_window_screen_mode(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_window_screen_mode);
-
- ds_inf("Policy Info(%p) set_window_screen_mode", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_get_subsurface(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, get_subsurface);
-
- ds_inf("Policy Info(%p) get_subsurface", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_iconify(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, iconify);
-
- ds_inf("Policy Info(%p) iconify", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_uniconify(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, uniconify);
-
- ds_inf("Policy Info(%p) uniconify", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_add_aux_hint(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, add_aux_hint);
-
- ds_inf("Policy Info(%p) add_aux_hint", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_change_aux_hint(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, change_aux_hint);
-
- ds_inf("Policy Info(%p) change_aux_hint", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_delete_aux_hint(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, delete_aux_hint);
-
- ds_inf("Policy Info(%p) delete_aux_hint", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_get_supported_aux_hints(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, get_supported_aux_hints);
-
- ds_inf("Policy Info(%p) get_supported_aux_hints", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_floating_mode(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_floating_mode);
-
- ds_inf("Policy Info(%p) set_floating_mode", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_unset_floating_mode(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, unset_floating_mode);
-
- ds_inf("Policy Info(%p) unset_floating_mode", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_stack_mode(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_stack_mode);
-
- ds_inf("Policy Info(%p) set_stack_mode", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_new_subsurface_watcher(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
- struct tinyds_policy_subsurface_watcher*subsurface_watcher;
- struct ds_tizen_event_policy_surface_new_subsurface_watcher *event;
-
- policy_surface = wl_container_of(listener, policy_surface, new_subsurface_watcher);
- event = (struct ds_tizen_event_policy_surface_new_subsurface_watcher *)data;
-
- ds_inf("Policy Info(%p) new_subsurface_watcher", policy_surface);
-
- subsurface_watcher = calloc(1, sizeof *subsurface_watcher);
- if (!subsurface_watcher)
- return;
-
- subsurface_watcher->subsurface_watcher = event->subsurface_watcher;
-
- subsurface_watcher->destroy.notify = subsurface_watcher_handle_destroy;
- ds_tizen_policy_subsurface_watcher_add_destroy_listener(subsurface_watcher->subsurface_watcher,
- &subsurface_watcher->destroy);
-
- wl_list_insert(&policy_surface->subsurface_watchers, &subsurface_watcher->link);
-}
-
-static void
-policy_surface_handle_set_parent(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_parent);
-
- ds_inf("Policy Info(%p) set_parent", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_ack_conformant_region(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, ack_conformant_region);
-
- ds_inf("Policy Info(%p) ack_conformant_region", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_video(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_video);
-
- ds_inf("Policy Info(%p) set_video", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_show(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, show);
-
- ds_inf("Policy Info(%p) show", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_hide(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, hide);
-
- ds_inf("Policy Info(%p) hide", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_surface_handle_set_parent_with_below(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy_surface *policy_surface;
-
- policy_surface = wl_container_of(listener, policy_surface, set_parent_with_below);
-
- ds_inf("Policy Info(%p) set_parent_with_below", policy_surface);
-
- // TODO:
-}
-
-static void
-policy_handle_destroy(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, destroy);
-
- ds_inf("Policy(%p) destroy", policy);
-
- wl_list_remove(&policy->destroy.link);
- wl_list_remove(&policy->new_surface.link);
- wl_list_remove(&policy->activate_below_by_univeral_id.link);
- wl_list_remove(&policy->lower_by_universal_id.link);
- wl_list_remove(&policy->set_transient_for.link);
- wl_list_remove(&policy->unset_transient_for.link);
- wl_list_remove(&policy->place_subsurface_below_parent.link);
- wl_list_remove(&policy->set_subsurface_stand_alone.link);
- wl_list_remove(&policy->set_background_state.link);
- wl_list_remove(&policy->unset_background_state.link);
- wl_list_remove(&policy->add_activate_above_by_universal_id.link);
- wl_list_remove(&policy->set_appid.link);
- wl_list_remove(&policy->set_transient_for_below.link);
-
- free(policy);
-}
-
-static void
-policy_handle_new_surface(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
- struct tinyds_policy_surface *policy_surface;
- struct ds_tizen_event_policy_new_surface *event;
-
- policy = wl_container_of(listener, policy, new_surface);
- event = (struct ds_tizen_event_policy_new_surface *)data;
-
- ds_inf("Policy(%p) new_surface", policy);
-
- policy_surface = calloc(1, sizeof *policy_surface);
- if (!policy_surface)
- return;
-
- policy_surface->policy_surface = event->policy_surface;
-
- policy_surface->destroy.notify = policy_surface_handle_destroy;
- ds_tizen_policy_surface_add_destroy_listener(policy_surface->policy_surface,
- &policy_surface->destroy);
-
- policy_surface->new_visibility.notify = policy_surface_handle_new_visibility;
- ds_tizen_policy_surface_add_new_visibility_listener(policy_surface->policy_surface,
- &policy_surface->new_visibility);
-
- policy_surface->new_position.notify = policy_surface_handle_new_position;
- ds_tizen_policy_surface_add_new_position_listener(policy_surface->policy_surface,
- &policy_surface->new_position);
-
- policy_surface->activate.notify = policy_surface_handle_activate;
- ds_tizen_policy_surface_add_activate_listener(policy_surface->policy_surface,
- &policy_surface->activate);
-
- policy_surface->raise.notify = policy_surface_handle_raise;
- ds_tizen_policy_surface_add_raise_listener(policy_surface->policy_surface,
- &policy_surface->raise);
-
- policy_surface->lower.notify = policy_surface_handle_lower;
- ds_tizen_policy_surface_add_lower_listener(policy_surface->policy_surface,
- &policy_surface->lower);
-
- policy_surface->set_focus_skip.notify = policy_surface_handle_set_focus_skip;
- ds_tizen_policy_surface_add_set_focus_skip_listener(policy_surface->policy_surface,
- &policy_surface->set_focus_skip);
-
- policy_surface->unset_focus_skip.notify = policy_surface_handle_unset_focus_skip;
- ds_tizen_policy_surface_add_unset_focus_skip_listener(policy_surface->policy_surface,
- &policy_surface->unset_focus_skip);
-
- policy_surface->set_role.notify = policy_surface_handle_set_role;
- ds_tizen_policy_surface_add_set_role_listener(policy_surface->policy_surface,
- &policy_surface->set_role);
-
- policy_surface->set_window_type.notify = policy_surface_handle_set_window_type;
- ds_tizen_policy_surface_add_set_window_type_listener(policy_surface->policy_surface,
- &policy_surface->set_window_type);
-
- policy_surface->set_conformant.notify = policy_surface_handle_set_conformant;
- ds_tizen_policy_surface_add_set_conformant_listener(policy_surface->policy_surface,
- &policy_surface->set_conformant);
-
- policy_surface->unset_conformant.notify = policy_surface_handle_unset_conformant;
- ds_tizen_policy_surface_add_unset_conformant_listener(policy_surface->policy_surface,
- &policy_surface->unset_conformant);
-
- policy_surface->get_conformant.notify = policy_surface_handle_get_conformant;
- ds_tizen_policy_surface_add_get_conformant_listener(policy_surface->policy_surface,
- &policy_surface->get_conformant);
-
- policy_surface->set_notification_level.notify =
- policy_surface_handle_set_notification_level;
- ds_tizen_policy_surface_add_set_notification_level_listener(
- policy_surface->policy_surface, &policy_surface->set_notification_level);
-
- policy_surface->set_window_screen_mode.notify =
- policy_surface_handle_set_window_screen_mode;
- ds_tizen_policy_surface_add_set_window_screen_mode_listener(
- policy_surface->policy_surface, &policy_surface->set_window_screen_mode);
-
- policy_surface->get_subsurface.notify = policy_surface_handle_get_subsurface;
- ds_tizen_policy_surface_add_get_subsurface_listener(policy_surface->policy_surface,
- &policy_surface->get_subsurface);
-
- policy_surface->iconify.notify = policy_surface_handle_iconify;
- ds_tizen_policy_surface_add_iconify_listener(policy_surface->policy_surface,
- &policy_surface->iconify);
-
- policy_surface->uniconify.notify = policy_surface_handle_uniconify;
- ds_tizen_policy_surface_add_uniconify_listener(policy_surface->policy_surface,
- &policy_surface->uniconify);
-
- policy_surface->add_aux_hint.notify = policy_surface_handle_add_aux_hint;
- ds_tizen_policy_surface_add_add_aux_hint_listener(policy_surface->policy_surface,
- &policy_surface->add_aux_hint);
-
- policy_surface->change_aux_hint.notify = policy_surface_handle_change_aux_hint;
- ds_tizen_policy_surface_add_change_aux_hint_listener(policy_surface->policy_surface,
- &policy_surface->change_aux_hint);
-
- policy_surface->delete_aux_hint.notify = policy_surface_handle_delete_aux_hint;
- ds_tizen_policy_surface_add_delete_aux_hint_listener(policy_surface->policy_surface,
- &policy_surface->delete_aux_hint);
-
- policy_surface->get_supported_aux_hints.notify =
- policy_surface_handle_get_supported_aux_hints;
- ds_tizen_policy_surface_add_get_supported_aux_hints_listener(
- policy_surface->policy_surface, &policy_surface->get_supported_aux_hints);
-
- policy_surface->set_floating_mode.notify =
- policy_surface_handle_set_floating_mode;
- ds_tizen_policy_surface_add_set_floating_mode_listener(
- policy_surface->policy_surface, &policy_surface->set_floating_mode);
-
- policy_surface->unset_floating_mode.notify =
- policy_surface_handle_unset_floating_mode;
- ds_tizen_policy_surface_add_unset_floating_mode_listener(
- policy_surface->policy_surface, &policy_surface->unset_floating_mode);
-
- policy_surface->set_stack_mode.notify = policy_surface_handle_set_stack_mode;
- ds_tizen_policy_surface_add_set_stack_mode_listener(policy_surface->policy_surface,
- &policy_surface->set_stack_mode);
-
- policy_surface->new_subsurface_watcher.notify =
- policy_surface_handle_new_subsurface_watcher;
- ds_tizen_policy_surface_add_new_subsurface_watcher_listener(
- policy_surface->policy_surface, &policy_surface->new_subsurface_watcher);
-
- policy_surface->set_parent.notify = policy_surface_handle_set_parent;
- ds_tizen_policy_surface_add_set_parent_listener(policy_surface->policy_surface,
- &policy_surface->set_parent);
-
- policy_surface->ack_conformant_region.notify =
- policy_surface_handle_ack_conformant_region;
- ds_tizen_policy_surface_add_ack_conformant_region_listener(
- policy_surface->policy_surface, &policy_surface->ack_conformant_region);
-
- policy_surface->set_video.notify = policy_surface_handle_set_video;
- ds_tizen_policy_surface_add_set_video_listener(policy_surface->policy_surface,
- &policy_surface->set_video);
-
- policy_surface->show.notify = policy_surface_handle_show;
- ds_tizen_policy_surface_add_show_listener(policy_surface->policy_surface,
- &policy_surface->show);
-
- policy_surface->hide.notify = policy_surface_handle_hide;
- ds_tizen_policy_surface_add_hide_listener(policy_surface->policy_surface,
- &policy_surface->hide);
-
- policy_surface->set_parent_with_below.notify =
- policy_surface_handle_set_parent_with_below;
- ds_tizen_policy_surface_add_set_parent_with_below_listener(
- policy_surface->policy_surface, &policy_surface->set_parent_with_below);
-
-
- wl_list_init(&policy_surface->visibilities);
- wl_list_init(&policy_surface->positions);
- wl_list_init(&policy_surface->subsurface_watchers);
-
- wl_list_insert(&policy->policy_surfaces, &policy_surface->link);
-}
-
-static void
-policy_handle_activate_below_by_univeral_id(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, activate_below_by_univeral_id);
-
- ds_inf("Policy(%p) activate_below_by_univeral_id", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_lower_by_universal_id(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, lower_by_universal_id);
-
- ds_inf("Policy(%p) lower_by_universal_id", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_set_transient_for(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, set_transient_for);
-
- ds_inf("Policy(%p) set_transient_for", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_unset_transient_for(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, unset_transient_for);
-
- ds_inf("Policy(%p) unset_transient_for", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_place_subsurface_below_parent(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, place_subsurface_below_parent);
-
- ds_inf("Policy(%p) place_subsurface_below_parent", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_set_subsurface_stand_alone(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, set_subsurface_stand_alone);
-
- ds_inf("Policy(%p) set_subsurface_stand_alone", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_set_background_state(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, set_background_state);
-
- ds_inf("Policy(%p) set_background_state", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_unset_background_state(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, unset_background_state);
-
- ds_inf("Policy(%p) unset_background_state", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_add_activate_above_by_universal_id(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, add_activate_above_by_universal_id);
-
- ds_inf("Policy(%p) add_activate_above_by_universal_id", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_set_appid(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, set_appid);
-
- ds_inf("Policy(%p) set_appid", policy);
-
- // TODO:
-}
-
-static void
-policy_handle_set_transient_for_below(struct wl_listener *listener, void *data)
-{
- struct tinyds_policy *policy;
-
- policy = wl_container_of(listener, policy, set_transient_for_below);
-
- ds_inf("Policy(%p) set_transient_for_below", policy);
-
- // TODO:
-}
-
-static bool
-new_policy(struct tinyds_server *server)
-{
- struct tinyds_policy *policy;
-
- policy = calloc(1, sizeof *policy);
- if (!policy)
- return false;
-
- policy->policy = ds_tizen_policy_create(server->display);
- if (!policy->policy) {
- free(policy);
- ds_err("Could not create ds_tizen_policy");
- return false;
- }
-
- policy->destroy.notify = policy_handle_destroy;
- ds_tizen_policy_add_destroy_listener(policy->policy, &policy->destroy);
-
- policy->new_surface.notify = policy_handle_new_surface;
- ds_tizen_policy_add_new_surface_listener(policy->policy, &policy->new_surface);
-
- policy->activate_below_by_univeral_id.notify =
- policy_handle_activate_below_by_univeral_id;
- ds_tizen_policy_add_activate_below_by_univeral_id_listener(policy->policy,
- &policy->activate_below_by_univeral_id);
-
- policy->lower_by_universal_id.notify = policy_handle_lower_by_universal_id;
- ds_tizen_policy_add_lower_by_universal_id_listener(policy->policy,
- &policy->lower_by_universal_id);
-
- policy->set_transient_for.notify = policy_handle_set_transient_for;
- ds_tizen_policy_add_set_transient_for_listener(policy->policy,
- &policy->set_transient_for);
-
- policy->unset_transient_for.notify = policy_handle_unset_transient_for;
- ds_tizen_policy_add_unset_transient_for_listener(policy->policy,
- &policy->unset_transient_for);
-
- policy->place_subsurface_below_parent.notify =
- policy_handle_place_subsurface_below_parent;
- ds_tizen_policy_add_place_subsurface_below_parent_listener(policy->policy,
- &policy->place_subsurface_below_parent);
-
- policy->set_subsurface_stand_alone.notify =
- policy_handle_set_subsurface_stand_alone;
- ds_tizen_policy_add_set_subsurface_stand_alone_listener(policy->policy,
- &policy->set_subsurface_stand_alone);
-
- policy->set_background_state.notify = policy_handle_set_background_state;
- ds_tizen_policy_add_set_background_state_listener(policy->policy,
- &policy->set_background_state);
-
- policy->unset_background_state.notify = policy_handle_unset_background_state;
- ds_tizen_policy_add_unset_background_state_listener(policy->policy,
- &policy->unset_background_state);
-
- policy->add_activate_above_by_universal_id.notify =
- policy_handle_add_activate_above_by_universal_id;
- ds_tizen_policy_add_activate_above_by_universal_id_listener(policy->policy,
- &policy->add_activate_above_by_universal_id);
-
- policy->set_appid.notify = policy_handle_set_appid;
- ds_tizen_policy_add_set_appid_listener(policy->policy, &policy->set_appid);
-
- policy->set_transient_for_below.notify =
- policy_handle_set_transient_for_below;
- ds_tizen_policy_add_set_transient_for_below_listener(policy->policy,
- &policy->set_transient_for_below);
-
- wl_list_init(&policy->policy_surfaces);
-
- server->policy = policy;
-
- ds_inf("Policy (%p) created", policy);
-
- return true;
-}