The legacy libds is not used anymore.
The new libds source code will be merge.
Change-Id: I78ac63c3f064271f6dd4293127cb775189e6b129
+++ /dev/null
-# This is a comment.
-# Each line is a file pattern followed by one or more owners.
-
-# These owners will be the default owners for everything in
-# the repo. Unless a later match takes precedence,
-# @global-owner1 and @global-owner2 will be requested for
-# review when someone opens a pull request.
-* @cyeon-lee @doyoun-kang @gl77-lee @jhyuni-kang @jk0430-kim @joonbum-ko @juns-kim @dyamy-lee @lsj119 @sc1-lim @shiin-lee @sj76-park @duna-oh
-
+++ /dev/null
-Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice (including the next
-paragraph) shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
----
-
-The above is the version of the MIT "Expat" License used by X.org:
-
- http://cgit.freedesktop.org/xorg/xserver/tree/COPYING
+++ /dev/null
-# libds
-Requires:
- c++17 standard feature support
- - std::variant(>=gcc-7, >=clang4, >=MSVC19.10x)
-
-# Ground Rule
- ## Committer rule
- - Committer는 Commit message와 Description을 영어로 작성한다.
- - Committer는 Reviewer가 patch의 목적을 이해할 수 있도록 Commit message와 Description을 충실히 작성한다.
- - Committer는 patch를 간단한 단일기능 혹은 단일 주제를 가지도록 만든다. 단일 주제를 가지는 Commit message를 작성할 수 있도록 한다.
- - Committer는 코드 수정들을 가장 작은 단위의 patch들도 나누어 Commit한다.
- - Committer는 2명 이상의 Reviewer들에게 리뷰 요청을 한다.
- - Committer는 빌드 및 동작검증을 한 후에 PR을 요청한다.
- - Committer는 PR에 하나 혹은 그 이상의 patch들을 포함할 수 있다.
- - Committer는 patch를 SE의 C++ coding rule을 준수하여 작성한다. (C++ Coding Rule)
- ## Reviewer rule
- - Reviewer는 한글/영어로 review comment를 작성한다.
- - Reviewer는 Merge가 될 수 있는 PR이면 Approve를 체크한다.
- - Reviewer는 reviewer로 등록되면 working day 1일 이내에 리뷰하도록 노력한다.
- - Reviewer는 Code에 대한 의견만 제시한다.
- - Reviewer는 리뷰 시에는 반드시 Comment를 기록한다.
- ## Merge rule
- - Rebase and Submit를 원칙으로 한다.
- - Approve가 두 개 이상일 경우에만 merge가 가능하다.
-
+++ /dev/null
-[Unit]
-Description=Display manager (libds)
-
-[Service]
-EnvironmentFile=/etc/sysconfig/libds.env
-SmackProcessLabel=System
-ExecStartPre=-/usr/bin/keymap_update.sh
-ExecStart=/usr/bin/bash -c "/usr/bin/exampleCompositor"
-ExecStartPost=/usr/bin/bash -c "/usr/bin/touch $XDG_RUNTIME_DIR/.wm_ready;devicectl display start;devicectl display stop"
-Restart=always
-RestartSec=10
-
-[Install]
-WantedBy=graphical.target
-
+++ /dev/null
-# env for exampleCompositor (libds)
-E_CONF_PROFILE=tizen-mobile
-XDG_RUNTIME_DIR=/run
-XDG_CACHE_HOME=/run
-ECORE_EVAS_FORCE_SYNC_RENDER=1
-ELM_PROFILE=mobile
-HOME=/var/lib/enlightenment
-EINA_LOG_DLOG_ENABLE=1
-DSLOG_DLOG_ENABLE=1
-LIBINPUT_IGNORE_JOYSTICK=1
-#E_INFO_RULE_FILE=/opt/rule/rule
-#E_INFO_TRACE_FILE=/tmp/trace
+++ /dev/null
-project(
- 'libds',
- ['c', 'cpp'],
- version : '0.0.1',
- license : 'MIT',
- default_options : ['c_std=c11', 'cpp_std=c++17', 'b_pie=true']
- )
-
-libds_version = meson.project_version().split('.')
-libds_prefix = get_option('prefix')
-libds_prefix_bindir = join_paths(libds_prefix, get_option('bindir'))
-libds_prefix_libdir = join_paths(libds_prefix, get_option('libdir'))
-
-subdir('src')
-subdir('tests')
-subdir('samples')
+++ /dev/null
-<manifest>
- <request>
- <domain name="_"/>
- </request>
-</manifest>
+++ /dev/null
-%define USE_GCOV 0
-
-Name: libds
-Version: 0.0.1
-Release: 0
-Summary: Display Server library
-License: MIT
-URL: http://www.tizen.org/
-Source: %name-%version.tar.xz
-Source1001: %name.manifest
-
-BuildRequires: meson
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(gmock)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(libtdm)
-BuildRequires: pkgconfig(libtbm)
-BuildRequires: pkgconfig(wayland-tbm-server)
-BuildRequires: pkgconfig(wayland-server)
-BuildRequires: pkgconfig(tizen-extension-server)
-BuildRequires: pkgconfig(input-method-server)
-BuildRequires: pkgconfig(text-server)
-BuildRequires: pkgconfig(tizen-launch-server)
-BuildRequires: pkgconfig(tizen-surface-server)
-BuildRequires: pkgconfig(xdg-shell-unstable-v6-server)
-BuildRequires: pkgconfig(xdg-shell-server)
-BuildRequires: pkgconfig(ecore)
-BuildRequires: pkgconfig(ecore-evas)
-BuildRequires: pkgconfig(libinput)
-BuildRequires: pkgconfig(libudev)
-BuildRequires: pkgconfig(xkbcommon)
-BuildRequires: pkgconfig(dali2-core)
-BuildRequires: pkgconfig(dali2-adaptor)
-BuildRequires: pkgconfig(dali2-toolkit)
-BuildRequires: pkgconfig(dali2-extension)
-
-# For samples and tests
-BuildRequires: pkgconfig(wayland-client)
-BuildRequires: pkgconfig(xkbcommon)
-BuildRequires: pkgconfig(wayland-tbm-client)
-BuildRequires: pkgconfig(xdg-shell-client)
-BuildRequires: pkgconfig(xdg-shell-unstable-v6-client)
-
-%description
-
-Test DS c++ server
-
-%package devel
-Summary: Test DS c++ server
-Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
-
-
-%description devel
-
-Test DS c++ server and lib
-
-%package tests
-Summary: libds unit tests
-Group: System/Libraries
-
-%description tests
-Test module for testing libtbm APIs
-
-%package boot
-Summary: package for boot with libds-based display server
-Group: System/Libraries
-
-%description boot
-Package for boot with libds-based display server
-
-%prep
-%setup -q
-cp %{SOURCE1001} .
-
-%build
-%if "%{USE_GCOV}" == "1"
-CXXFLAGS+=" -fprofile-arcs -ftest-coverage -DTIZEN_TEST_GCOV"
-LDFLAGS+=" -lgcov"
-%endif
-meson setup \
- --prefix /usr \
- --libdir %{_libdir} \
- --bindir %{_bindir} \
- builddir
-ninja -C builddir all
-
-%install
-export DESTDIR=%{buildroot}
-ninja -C builddir install
-
-%define daemon_user display
-%define daemon_group display
-
-# install service
-#%__mkdir_p %{buildroot}%{_unitdir}
-#install -m 644 data/units/display-manager.service %{buildroot}%{_unitdir}
-
-# install env file for service
-#%__mkdir_p %{buildroot}%{_sysconfdir}/sysconfig
-#install -m 0644 data/units/libds.env %{buildroot}%{_sysconfdir}/sysconfig
-
-#%pre
-# create groups 'display'
-#getent group %{daemon_group} >/dev/null || %{_sbindir}/groupadd -r -o %{daemon_group}
-# create user 'display'
-#getent passwd %{daemon_user} >/dev/null || %{_sbindir}/useradd -r -g %{daemon_group} -d /run/display -s /bin/false -c "Display daemon" %{daemon_user}
-
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
-
-%files
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%license COPYING
-%{_libdir}/*.so.*
-%{_bindir}/*
-
-%files devel
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%license COPYING
-%{_includedir}/*
-%{_libdir}/*.so
-%{_libdir}/pkgconfig/*
-
-%files tests
-%defattr(-,root,root,-)
-%license COPYING
-%{_bindir}/libds-tests
-
-%files boot
-%defattr(-,root,root,-)
-%license COPYING
-#%{_unitdir}/display-manager.service
-#%config %{_sysconfdir}/sysconfig/libds.env
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <assert.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <fcntl.h>
-#include <xkbcommon/xkbcommon.h>
-#include <wayland-client.h>
-#include <wayland-client-protocol.h>
-#include <wayland-extension/tizen-extension-client-protocol.h>
-#include <wayland-extension/tizen-launch-client-protocol.h>
-#include <wayland-extension/xdg-shell-unstable-v6-client-protocol.h>
-
-struct wl_display *display = NULL;
-struct wl_compositor *compositor = NULL;
-struct wl_seat *seat = NULL;
-struct wl_surface *surface = NULL;
-struct wl_pointer *pointer = NULL;
-struct wl_keyboard *keyboard = NULL;
-struct wl_touch *touch = NULL;
-struct wl_output *output = NULL;
-struct xkb_context *xkb_context = NULL;
-struct xkb_keymap *keymap = NULL;
-struct tizen_policy *tz_policy = NULL;
-struct tizen_launch_appinfo *tz_appinfo = NULL;
-struct tizen_launch_effect *tz_launcheffect = NULL;
-struct tizen_launch_splash *tz_launchsplash = NULL;
-struct zxdg_shell_v6 *zxdg_shell;
-struct zxdg_surface_v6 *zxdg_surface;
-struct zxdg_toplevel_v6 *zxdg_toplevel;
-
-static void pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y)
-{
- (void) data;
- (void) wl_pointer;
- (void) serial;
- (void) surface;
- (void) surface_x;
- (void) surface_y;
-
- printf("... serial=%d, x=%.f, y=%.f\n", serial, wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y));
-}
-
-static void pointer_leave(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface)
-{
- (void) data;
- (void) wl_pointer;
- (void) serial;
- (void) surface;
-
- printf("... serial=%d\n", serial);
-}
-
-static void pointer_motion(void *data, struct wl_pointer *wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)
-{
- (void) data;
- (void) wl_pointer;
- (void) time;
- (void) surface_x;
- (void) surface_y;
-
- printf("... time=%d, x=%.f, y=%.f\n", time, wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y));
-}
-
-static void pointer_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
-{
- (void) data;
- (void) wl_pointer;
- (void) serial;
- (void) time;
- (void) button;
- (void) state;
-
- printf("... serial=%d, time=%d, button=%d, state=%d\n", serial, time, button, state);
-}
-
-static void pointer_axis(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value)
-{
- (void) data;
- (void) wl_pointer;
- (void) time;
- (void) axis;
- (void) value;
-
- printf("... time=%d, axis=%d, value=%.f\n", time, axis, wl_fixed_to_double(value));
-}
-
-static void
-keyboard_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int fd, uint32_t size)
-{
- (void) data;
- (void) keyboard;
- (void) format;
- (void) fd;
- (void) size;
-
- char *map = NULL;
-
- printf("...WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1=%d, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP=%d\n",
- WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP);
- printf("[Keyboard Keymap] ... format=%d, fd=%d, size=%d\n", format, fd, size);
-
- if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1)
- {
- printf("... Invalid format: %d\n", format);
- close(fd);
- return;
- }
-
- map = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
-
- if (map == MAP_FAILED)
- {
- printf("... Failed to mmap from fd(%d) size(%d)\n", fd, size);
- close(fd);
- return;
- }
-
- printf("... Succeed to mmap from fd(%d) size(%d)\n", fd, size);
-
- keymap = xkb_map_new_from_string(xkb_context, map,
- XKB_KEYMAP_FORMAT_TEXT_V1, 0);
- if (!keymap)
- printf("... Failed to get keymap from fd(%d)\n", fd);
- else
- printf("... Succeed to get keymap from fd(%d)\n", fd);
-
- munmap(map, size);
- close(fd);
-}
-
-static void
-keyboard_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys)
-{
- (void) data;
- (void) keyboard;
- (void) serial;
- (void) surface;
- (void) keys;
-
- printf("[Keyboard Enter] ... serial=%d\n", serial);
-}
-
-static void
-keyboard_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface)
-{
- (void) data;
- (void) keyboard;
- (void) serial;
- (void) surface;
-
- printf("[Keyboard Leave] ... serial=%d\n", serial);
-}
-
-static void
-keyboard_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
-{
- (void) data;
- (void) keyboard;
- (void) serial;
- (void) time;
- (void) key;
- (void) state;
-
- printf("[Keyboard Key]... serial=%d, time=%d, key=%d, state=%d\n", serial, time, key, state);
-}
-
-static void
-keyboard_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
-{
- (void) data;
- (void) keyboard;
- (void) serial;
- (void) mods_depressed;
- (void) mods_latched;
- (void) mods_locked;
- (void) group;
-
- printf("[Keyboard Modifiers]... serial=%d, mods_depressed=%d, mods_latched=%d, mods_locked=%d, group=%d\n", serial, mods_depressed, mods_latched, mods_locked, group);
-}
-
- static void
-keyboard_repeatinfo(void *data, struct wl_keyboard *keyboard, int32_t rate, int32_t delay)
-{
- (void) data;
- (void) keyboard;
-
- printf("... repeat rate=%u, repeat delay=%u\n", rate, delay);
-}
-
-static void
-touch_down(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, struct wl_surface *surface, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
-{
- (void) data;
- (void) wl_touch;
- (void) serial;
- (void) time;
- (void) surface;
- (void) id;
- (void) x_w;
- (void) y_w;
-
- printf("... serial=%d, time=%d, id=%d, x_w=%.f, y_w=%.f\n", serial, time, id, wl_fixed_to_double(x_w), wl_fixed_to_double(y_w));
-}
-
-static void
-touch_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, int32_t id)
-{
- (void) data;
- (void) wl_touch;
- (void) serial;
- (void) time;
- (void) id;
-
- printf("... serial=%d, time=%d, id=%d\n", serial, time, id);
-}
-
-static void
-touch_motion(void *data, struct wl_touch *wl_touch, uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
-{
- (void) data;
- (void) wl_touch;
- (void) time;
- (void) id;
- (void) x_w;
- (void) y_w;
-
- printf("... time=%d, id=%d, x_w=%.f, y_w=%.f\n", time, id, wl_fixed_to_double(x_w), wl_fixed_to_double(y_w));
-}
-
-static void
-touch_frame(void *data, struct wl_touch *wl_touch)
-{
- (void) data;
- (void) wl_touch;
-
- printf("...\n");
-}
-
-static void
-touch_cancel(void *data, struct wl_touch *wl_touch)
-{
- (void) data;
- (void) wl_touch;
-
- printf("...\n");
-}
-
-static const struct wl_pointer_listener pointer_listener = {
- pointer_enter,
- pointer_leave,
- pointer_motion,
- pointer_button,
- pointer_axis,
-};
-
-
-static const struct wl_touch_listener touch_listener = {
- touch_down,
- touch_up,
- touch_motion,
- touch_frame,
- touch_cancel
-};
-
-static const struct wl_keyboard_listener keyboard_listener = {
- keyboard_keymap,
- keyboard_enter,
- keyboard_leave,
- keyboard_key,
- keyboard_modifiers,
- keyboard_repeatinfo
-};
-
-static void
-seat_handle_capabilities(void *data, struct wl_seat *seat,
- enum wl_seat_capability caps)
-{
- printf("Capabilities events ! (caps=%d)\n", caps);
-
- if (caps & WL_SEAT_CAPABILITY_POINTER)
- {
- if (!pointer)
- {
- printf("Display has a pointer.\n");
- pointer = wl_seat_get_pointer(seat);
- wl_pointer_add_listener(pointer, &pointer_listener, NULL);
- }
- }
- else
- {
- if (pointer)
- {
- printf("Pointer has been removed.\n");
- wl_pointer_release(pointer);
- pointer = NULL;
- }
- }
-
- if (caps & WL_SEAT_CAPABILITY_KEYBOARD)
- {
- if (!keyboard)
- {
- printf("Display has a keyboard.\n");
- keyboard = wl_seat_get_keyboard(seat);
- wl_keyboard_add_listener(keyboard, &keyboard_listener, NULL);
- }
- }
- else
- {
- if (keyboard)
- {
- printf("Keyboard has been removed.\n");
- wl_keyboard_release(keyboard);
- keyboard = NULL;
- }
- }
-
- if (caps & WL_SEAT_CAPABILITY_TOUCH)
- {
- if (!touch)
- {
- printf("Display has a touch screen.\n");
- touch = wl_seat_get_touch(seat);
- wl_touch_add_listener(touch, &touch_listener, NULL);
- }
- }
- else
- {
- if (touch)
- {
- printf("Touch has been removed.\n");
- wl_touch_release(touch);
- touch = NULL;
- }
- }
-}
-
-static void
-seat_handle_name(void *data, struct wl_seat *seat, const char *name)
-{
- printf("Seat has a name (%s)\n", name);
-}
-
-static const struct wl_seat_listener seat_listener = {
- seat_handle_capabilities,
- seat_handle_name,
-};
-
-
-static void
-_tizen_policy_cb_conformant(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, uint32_t is_conformant)
-{
-}
-
-static void
-_tizen_policy_cb_conformant_area(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
-{
-}
-
-static void
-_tizen_policy_cb_notification_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, int32_t level, uint32_t state)
-{
-}
-
-static void
-_tizen_policy_cb_transient_for_done(void *data, struct tizen_policy *tizen_policy, uint32_t child_id)
-{
-}
-
-static void
-_tizen_policy_cb_window_screen_mode_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t mode, uint32_t state)
-{
-}
-
-static void
-_tizen_policy_cb_iconify_state_changed(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, uint32_t iconified, uint32_t force)
-{
-}
-
-static void
-_tizen_policy_cb_supported_aux_hints(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints)
-{
-}
-
-static void
-_tizen_policy_cb_allowed_aux_hint(void *data, struct tizen_policy *tizen_policy , struct wl_surface *surface_resource, int id)
-{
-}
-
-static void
-_tizen_policy_cb_aux_message(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, const char *key, const char *val, struct wl_array *options)
-{
-}
-
-static void
-_tizen_policy_cb_conformant_region(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial)
-{
-}
-
-static const struct tizen_policy_listener tz_policy_listener = {
- _tizen_policy_cb_conformant,
- _tizen_policy_cb_conformant_area,
- _tizen_policy_cb_notification_done,
- _tizen_policy_cb_transient_for_done,
- _tizen_policy_cb_window_screen_mode_done,
- _tizen_policy_cb_iconify_state_changed,
- _tizen_policy_cb_supported_aux_hints,
- _tizen_policy_cb_allowed_aux_hint,
- _tizen_policy_cb_aux_message,
- _tizen_policy_cb_conformant_region,
-};
-
-static void
-_tizen_launch_appinfo_cb_base_output_resolution_done(void *data, struct tizen_launch_appinfo *tizen_appinfo, uint32_t pid, uint32_t width, uint32_t height)
-{
- printf("Tizen Appinfo callback: base_output_resolution_done pid:(%d) w,h:(%d,%d)\n", pid, width, height);
-}
-
-static const struct tizen_launch_appinfo_listener tz_appinfo_listener = {
- _tizen_launch_appinfo_cb_base_output_resolution_done,
-};
-
-static void
-global_registry_handler(void *data, struct wl_registry *registry, uint32_t id,
- const char *interface, uint32_t version)
-{
- printf("Registry event : global added (interface:%s, id:%d, version:%d)\n", interface, id, version);
-
- if (strcmp(interface, "wl_compositor") == 0)
- {
- compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
- }
- else if(strcmp(interface, "wl_seat") == 0)
- {
- seat = wl_registry_bind(registry, id, &wl_seat_interface, 4);
- wl_seat_add_listener(seat, &seat_listener, NULL);
- }
- else if(strcmp(interface, "tizen_policy") == 0)
- {
- tz_policy = wl_registry_bind(registry, id, &tizen_policy_interface, 7);
- tizen_policy_add_listener(tz_policy, &tz_policy_listener, NULL);
- }
- else if(strcmp(interface, "zxdg_shell_v6") == 0)
- {
- zxdg_shell = wl_registry_bind(registry, id, &zxdg_shell_v6_interface, 1);
- }
- else if(strcmp(interface, "tizen_launch_appinfo") == 0)
- {
- tz_appinfo = wl_registry_bind(registry, id, &tizen_launch_appinfo_interface, 1);
-
- /* TODO: This request should be used by AMD.*/
- tizen_launch_appinfo_add_listener(tz_appinfo, &tz_appinfo_listener, NULL);
- tizen_launch_appinfo_register_appid(tz_appinfo, "com.samsung.clocksetting");
- tizen_launch_appinfo_set_pid(tz_appinfo, "com.samsung.clocksetting", 4077);
- }
- else if(strcmp(interface, "wl_output") == 0)
- {
- output = wl_registry_bind(registry, id, &wl_output_interface, 2);
- }
- else if(strcmp(interface, "tizen_launch_effect") == 0)
- {
- tz_launcheffect = wl_registry_bind(registry, id, &tizen_launch_effect_interface, 1);
-
- tz_launchsplash = tizen_launch_effect_create_splash_img(tz_launcheffect);
- }
-}
-
-static void
-global_registry_remover(void *data, struct wl_registry *registry, uint32_t id)
-{
- printf("Registry event : global removed (id:%d)\n", id);
-}
-
-static const struct wl_registry_listener registry_listener = {
- global_registry_handler,
- global_registry_remover
-};
-
-static void
-_zxdg_v6_shell_surface_create(struct wl_surface *surface)
-{
- if (zxdg_surface) return;
-
- printf("Request get xdg_surface. zxdg_shell:%p", zxdg_shell);
-
- zxdg_surface = zxdg_shell_v6_get_xdg_surface(zxdg_shell, surface);
- // zxdg_surface_v6_add_listener(zxdg_surface, &_zxdg_surface_listener, NULL);
-
- printf("create zxdg_surface:%p", zxdg_surface);
-
- zxdg_toplevel = zxdg_surface_v6_get_toplevel(zxdg_surface);
- //zxdg_toplevel_v6_add_listener(zxdg_toplevel, &_zxdg_toplevel_listener, NULL);
-
- zxdg_toplevel_v6_set_title(zxdg_toplevel, "zxdg_toplevel");
-}
-
-
-int main(int argc, char **argv) {
-
- xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
-
- display = wl_display_connect(NULL);
-
- if (display == NULL)
- {
- fprintf(stderr, "Can't connect to display\n");
- exit(1);
- }
-
- printf("connected to display\n");
-
- struct wl_registry *registry = wl_display_get_registry(display);
- wl_registry_add_listener(registry, ®istry_listener, NULL);
- wl_display_dispatch(display);
- wl_display_roundtrip(display);
-
- if (compositor == NULL)
- {
- fprintf(stderr, "Can't find compositor\n");
- exit(1);
- }
- else
- {
- fprintf(stderr, "Found compositor\n");
- }
-
- surface = wl_compositor_create_surface(compositor);
-
- if (surface == NULL)
- {
- fprintf(stderr, "Can't create surface\n");
- exit(1);
- }
- else
- {
- fprintf(stderr, "Surface created.\n");
-
- _zxdg_v6_shell_surface_create(surface);
- }
-
- while (wl_display_dispatch(display) != -1)
- {
- ;
- }
-
- wl_display_disconnect(display);
- printf("disconnected from display\n");
-
- exit(0);
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <iostream>
-#include <memory>
-#include <Ecore_Wl2.h>
-#include <tbm_surface.h>
-#include <wayland-client.h>
-#include <wayland-tbm-client.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-#define BUF_WIDTH 400
-#define BUF_HEIGHT 200
-#define TEST_COUNT 200
-#define BUF_NUM 3
-
-class WlClientSimpleRendering {
- int __width;
- int __height;
- int __stride;
- int __size;
- int __count;
- tbm_format __format;
- tbm_surface_h __tbmSurface[BUF_NUM];
-
- Ecore_Wl2_Display *__ecoreWl2Dpy;
- struct wl_display *__wlDisplay;
- struct wl_registry *__wlRegistry;
-
-public:
- WlClientSimpleRendering(int width, int height, tbm_format format)
- :__width(width),
- __height(height),
- __format(format)
- {
- __stride = width * 4;
- __size = height * __stride;
- __count = 0;
-
- for (int i = 0; i < BUF_NUM; i++)
- {
- __tbmSurface[i] = nullptr;
- __wlBuffer[i] = nullptr;
- }
-
- __ecoreWl2Dpy = nullptr;
- __wlDisplay = nullptr;
- __wlRegistry = nullptr;
- __wlCompositor = nullptr;
- __wlSurface = nullptr;
- __wlTbmClient = nullptr;
- }
-
- ~WlClientSimpleRendering()
- {
- for (int i = 0; i < BUF_NUM; i++)
- {
- if (__wlBuffer[i] != nullptr) wl_buffer_destroy(__wlBuffer[i]);
- if (__tbmSurface[i] != nullptr) tbm_surface_destroy(__tbmSurface[i]);
- }
- if (__wlTbmClient != nullptr) wayland_tbm_client_deinit(__wlTbmClient);
- if (__wlCompositor != nullptr) wl_compositor_destroy(__wlCompositor);
-
- if (__wlRegistry != nullptr) wl_registry_destroy(__wlRegistry);
- if (__ecoreWl2Dpy != nullptr) ecore_wl2_display_disconnect(__ecoreWl2Dpy);
- }
-
- int ConnectDisplay();
- void DisconnectDisplay();
- int CreateBuffer(int bufferNum);
- void DestroyBuffer(int bufferNum);
- int RenderingBuffer(int bufferNum, unsigned char color);
- void CommitBuffer(int bufferNum);
-
- struct wl_compositor *__wlCompositor;
- struct wl_surface *__wlSurface;
- struct wl_buffer *__wlBuffer[BUF_NUM];
- struct wayland_tbm_client *__wlTbmClient;
-};
-
-static void
-handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
-{
- WlClientSimpleRendering *temp = (WlClientSimpleRendering *)data;
-
- if (strcmp(interface, "wl_compositor") == 0) {
- temp->__wlCompositor = (struct wl_compositor *)wl_registry_bind(registry, name, &wl_compositor_interface, 3);
- if (temp->__wlCompositor == nullptr)
- std::cout << __func__ << " Error. fail to bind " << interface << std::endl;
- else
- std::cout << __func__ << " bind " << interface << std::endl;
- } else {
- std::cout << __func__ << " Not bind" << interface << std::endl;
- }
-}
-
-static void
-handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
-{
-}
-
-static const struct wl_registry_listener registry_listener = {
- handle_global,
- handle_global_remove
-};
-
-int WlClientSimpleRendering::ConnectDisplay()
-{
- __ecoreWl2Dpy = ecore_wl2_display_connect(NULL);
- if (__ecoreWl2Dpy == nullptr)
- {
- std::cout << __func__ << " Error. fail ecore_wl2_display_connect" << std::endl;
- return -1;
- }
-
- __wlDisplay = ecore_wl2_display_get(__ecoreWl2Dpy);
- if (__wlDisplay == nullptr)
- {
- std::cout << __func__ << " Error. fail ecore_wl2_display_get" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- __wlRegistry = wl_display_get_registry(__wlDisplay);
- if (__wlRegistry == nullptr)
- {
- std::cout << __func__ << " Error. fail wl_display_get_registry" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- wl_registry_add_listener(__wlRegistry, ®istry_listener, this);
- wl_display_dispatch(__wlDisplay);
- wl_display_roundtrip(__wlDisplay);
-
- if (__wlCompositor == nullptr)
- {
- std::cout << __func__ << " Error. fail binding" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- __wlTbmClient = wayland_tbm_client_init(__wlDisplay);
- if (__wlTbmClient == nullptr)
- {
- std::cout << __func__ << " Error. fail wayland_tbm_client_init" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- __wlSurface = wl_compositor_create_surface(__wlCompositor);
- if (__wlSurface == nullptr)
- {
- std::cout << __func__ << " Error. fail wl_compositor_create_surface" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- return 0;
-}
-
-void WlClientSimpleRendering::DisconnectDisplay()
-{
- int i;
-
- for (i = 0; i < BUF_NUM; i++)
- {
- this->DestroyBuffer(i);
- }
- if (__wlTbmClient != nullptr) wayland_tbm_client_deinit(__wlTbmClient);
- __wlTbmClient = nullptr;
-
- if (__wlCompositor) wl_compositor_destroy(__wlCompositor);
- __wlCompositor = nullptr;
-
- if (__wlRegistry != nullptr) wl_registry_destroy(__wlRegistry);
- __wlRegistry = nullptr;
- __wlDisplay = nullptr;
- if (__ecoreWl2Dpy != nullptr) ecore_wl2_display_disconnect(__ecoreWl2Dpy);
- __ecoreWl2Dpy = nullptr;
-}
-
-int WlClientSimpleRendering::CreateBuffer(int bufferNum)
-{
- tbm_surface_h tbm_surface;
-
- if (bufferNum >= BUF_NUM)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return -1;
- }
-
- if (__wlTbmClient == nullptr)
- {
- std::cout << __func__ << " Error. no __wlTbmClient. execute ConnectDisplay first" << std::endl;
- return -1;
- }
-
- tbm_surface = tbm_surface_create(__width, __height, __format);
- if (tbm_surface == nullptr)
- {
- std::cout << __func__ << " Error. fail to create tbm_surface" << std::endl;
- return -1;
- }
-
- if (__tbmSurface[bufferNum] != nullptr)
- {
- std::cout << __func__ << " destroy prev tbm_surface " << bufferNum << ":" << __tbmSurface[bufferNum] << std::endl;
- this->DestroyBuffer(bufferNum);
- }
- __tbmSurface[bufferNum] = tbm_surface;
-
- __wlBuffer[bufferNum] = wayland_tbm_client_create_buffer(__wlTbmClient, __tbmSurface[bufferNum]);
- if (__wlBuffer[bufferNum] == nullptr)
- {
- std::cout << __func__ << " Error. fail to create wl_buffer" << std::endl;
- tbm_surface_destroy(__tbmSurface[bufferNum]);
- __tbmSurface[bufferNum] = nullptr;
- return -1;
- }
-
- std::cout << __func__ << " create " << bufferNum << " buffer(tbm_surface:" << __tbmSurface[bufferNum] << ", wl_buffer:" << __wlBuffer[bufferNum] << ")" << std::endl;
-
- return 0;
-}
-
-void WlClientSimpleRendering::DestroyBuffer(int bufferNum)
-{
- if (bufferNum >= BUF_NUM)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return;
- }
-
- if (__tbmSurface[bufferNum] == nullptr)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return;
- }
-
- std::cout << __func__ << " destroy " << bufferNum << " buffer(tbm_surface:" << __tbmSurface[bufferNum] << ", wl_buffer:" << __wlBuffer[bufferNum] << ")" << std::endl;
-
- wl_buffer_destroy(__wlBuffer[bufferNum]);
- __wlBuffer[bufferNum] = nullptr;
- tbm_surface_destroy(__tbmSurface[bufferNum]);
- __tbmSurface[bufferNum] = nullptr;
-}
-
-int WlClientSimpleRendering::RenderingBuffer(int bufferNum, unsigned char color)
-{
- tbm_surface_h tbm_surface;
- tbm_surface_info_s info;
- int ret = 0;
-
- if (bufferNum >= BUF_NUM)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return -1;
- }
-
- tbm_surface = __tbmSurface[bufferNum];
- if (tbm_surface == nullptr)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return -1;
- }
-
- ret = tbm_surface_map(tbm_surface, TBM_SURF_OPTION_WRITE, &info);
- if (ret != 0)
- {
- std::cout << __func__ << " Error. fail to tbm_surface_map " << ret << std::endl;
- return ret;
- }
-
- memset(info.planes[0].ptr, color, info.planes[0].stride * info.height);
-
- tbm_surface_unmap(tbm_surface);
-
- return ret;
-}
-
-void WlClientSimpleRendering::CommitBuffer(int bufferNum)
-{
- if (__wlSurface == nullptr || __wlDisplay == nullptr)
- {
- std::cout << __func__ << " Error. execute connect first" << std::endl;
- return;
- }
-
- if (bufferNum >= BUF_NUM || __wlBuffer[bufferNum] == nullptr)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return;
- }
-
- wl_surface_attach(__wlSurface, __wlBuffer[bufferNum], 0, 0);
- wl_surface_damage(__wlSurface, 0, 0, __width, __height);
- wl_surface_commit(__wlSurface);
-
- std::cout << __func__ << " commit " << bufferNum << " buffer(tbm_surface:" << __tbmSurface[bufferNum] << ", wl_buffer:" << __wlBuffer[bufferNum] << ")" << std::endl;
-#if 0
- int ret = 0;
-
- ret = wl_display_dispatch(__wlDisplay);
- if (ret < 0) {
- std::cout << __func__ << " Error. wl_display_dispatch error:" << ret << std::endl;
- return;
- }
-#endif
- wl_display_roundtrip(__wlDisplay);
-}
-
-int main (void)
-{
- WlClientSimpleRendering *simpleRenderSample = nullptr;
- int count = 0;
- int ret = 0;
- int i;
- unsigned char color;
-
- ecore_wl2_init();
-
- simpleRenderSample = new WlClientSimpleRendering(BUF_WIDTH, BUF_HEIGHT, TBM_FORMAT_ARGB8888);
- if (simpleRenderSample == nullptr)
- {
- std::cout << __func__ << " Error. fail create WlClientSimpleRendering" << std::endl;
- ecore_wl2_shutdown();
- return -1;
- }
-
- ret = simpleRenderSample->ConnectDisplay();
- if (ret)
- {
- std::cout << __func__ << " Error. fail ConnectDisplay" << std::endl;
- ecore_wl2_shutdown();
- return -1;
- }
-
- for (i = 0; i < BUF_NUM; i++)
- {
- ret = simpleRenderSample->CreateBuffer(i);
- if (ret)
- {
- std::cout << __func__ << " Error. fail CreateBuffer " << i << std::endl;
- goto finish;
- }
- }
-
- /* main loop */
- i = 0;
- color = 0x11;
- std::cout << __func__ << " loop start." << std::endl;
- while (count < TEST_COUNT) {
- simpleRenderSample->RenderingBuffer(i, color);
- simpleRenderSample->CommitBuffer(i);
- count++;
- i++;
- if (i == BUF_NUM) i = 0;
- if (color == 0xff)
- color = 0x11;
- else
- color += 0x11;
- std::cout << __func__ << " loop running " << count << std::endl;
- usleep(100000);
- }
- std::cout << __func__ << " loop end." << std::endl;
-
-finish:
- simpleRenderSample->DisconnectDisplay();
-
- delete simpleRenderSample;
-
- ecore_wl2_shutdown();
-
- return 0;
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <iostream>
-#include <memory>
-#include <Ecore_Wl2.h>
-#include <tbm_surface.h>
-#include <wayland-client.h>
-#include <wayland-client-protocol.h>
-#include <wayland-extension/xdg-shell-unstable-v6-client-protocol.h>
-#include <wayland-tbm-client.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-#define BUF_WIDTH 400
-#define BUF_HEIGHT 200
-#define TEST_COUNT 200
-#define BUF_NUM 3
-
-class WlClientSimpleRendering {
- int __width;
- int __height;
- int __stride;
- int __size;
- int __count;
- tbm_format __format;
- tbm_surface_h __tbmSurface[BUF_NUM];
-
- Ecore_Wl2_Display *__ecoreWl2Dpy;
- struct wl_display *__wlDisplay;
- struct wl_registry *__wlRegistry;
-
-public:
- WlClientSimpleRendering(int width, int height, tbm_format format)
- :__width(width),
- __height(height),
- __format(format)
- {
- __stride = width * 4;
- __size = height * __stride;
- __count = 0;
-
- for (int i = 0; i < BUF_NUM; i++)
- {
- __tbmSurface[i] = nullptr;
- __wlBuffer[i] = nullptr;
- }
-
- __ecoreWl2Dpy = nullptr;
- __wlDisplay = nullptr;
- __wlRegistry = nullptr;
- __wlCompositor = nullptr;
- __zxdgShell = nullptr;
- __wlSurface = nullptr;
- __zxdgShellSurface = nullptr;
- __wlTbmClient = nullptr;
- }
-
- ~WlClientSimpleRendering()
- {
- if (__zxdgShellSurface != nullptr) zxdg_surface_v6_destroy(__zxdgShellSurface);
- if (__wlSurface != nullptr) wl_surface_destroy(__wlSurface);
- for (int i = 0; i < BUF_NUM; i++)
- {
- if (__wlBuffer[i] != nullptr) wl_buffer_destroy(__wlBuffer[i]);
- if (__tbmSurface[i] != nullptr) tbm_surface_destroy(__tbmSurface[i]);
- }
- if (__wlTbmClient != nullptr) wayland_tbm_client_deinit(__wlTbmClient);
- if (__zxdgShell != nullptr) zxdg_shell_v6_destroy(__zxdgShell);
- if (__wlCompositor != nullptr) wl_compositor_destroy(__wlCompositor);
-
- if (__wlRegistry != nullptr) wl_registry_destroy(__wlRegistry);
- if (__ecoreWl2Dpy != nullptr) ecore_wl2_display_disconnect(__ecoreWl2Dpy);
- }
-
- int ConnectDisplay();
- void DisconnectDisplay();
- int CreateBuffer(int bufferNum);
- void DestroyBuffer(int bufferNum);
- int RenderingBuffer(int bufferNum, unsigned char color);
- void CommitBuffer(int bufferNum);
-
- struct wl_compositor *__wlCompositor;
- struct zxdg_shell_v6 *__zxdgShell;
- struct wl_surface *__wlSurface;
- struct zxdg_surface_v6 *__zxdgShellSurface;
- struct wl_buffer *__wlBuffer[BUF_NUM];
- struct wayland_tbm_client *__wlTbmClient;
-};
-
-static void
-handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
-{
- WlClientSimpleRendering *temp = (WlClientSimpleRendering *)data;
-
- if (strcmp(interface, "wl_compositor") == 0) {
- temp->__wlCompositor = (struct wl_compositor *)wl_registry_bind(registry, name, &wl_compositor_interface, 3);
- if (temp->__wlCompositor == nullptr)
- std::cout << __func__ << " Error. fail to bind " << interface << std::endl;
- else
- std::cout << __func__ << " bind " << interface << std::endl;
- } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
- temp->__zxdgShell = (struct zxdg_shell_v6 *)wl_registry_bind(registry, name, &zxdg_shell_v6_interface, 1);
- if (temp->__zxdgShell == nullptr)
- std::cout << __func__ << " Error. fail to bind " << interface << std::endl;
- else
- std::cout << __func__ << " bind " << interface << std::endl;
- } else {
- std::cout << __func__ << " Not bind" << interface << std::endl;
- }
-}
-
-static void
-handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
-{
-}
-
-static const struct wl_registry_listener registry_listener = {
- handle_global,
- handle_global_remove
-};
-
-int WlClientSimpleRendering::ConnectDisplay()
-{
- __ecoreWl2Dpy = ecore_wl2_display_connect(NULL);
- if (__ecoreWl2Dpy == nullptr)
- {
- std::cout << __func__ << " Error. fail ecore_wl2_display_connect" << std::endl;
- return -1;
- }
-
- __wlDisplay = ecore_wl2_display_get(__ecoreWl2Dpy);
- if (__wlDisplay == nullptr)
- {
- std::cout << __func__ << " Error. fail ecore_wl2_display_get" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- __wlRegistry = wl_display_get_registry(__wlDisplay);
- if (__wlRegistry == nullptr)
- {
- std::cout << __func__ << " Error. fail wl_display_get_registry" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- wl_registry_add_listener(__wlRegistry, ®istry_listener, this);
- wl_display_dispatch(__wlDisplay);
- wl_display_roundtrip(__wlDisplay);
-
- if (__wlCompositor == nullptr || __zxdgShell == nullptr)
- {
- std::cout << __func__ << " Error. fail binding" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- __wlTbmClient = wayland_tbm_client_init(__wlDisplay);
- if (__wlTbmClient == nullptr)
- {
- std::cout << __func__ << " Error. fail wayland_tbm_client_init" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- __wlSurface = wl_compositor_create_surface(__wlCompositor);
- if (__wlSurface == nullptr)
- {
- std::cout << __func__ << " Error. fail wl_compositor_create_surface" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- __zxdgShellSurface = zxdg_shell_v6_get_xdg_surface(__zxdgShell, __wlSurface);
- if (__zxdgShellSurface == nullptr)
- {
- std::cout << __func__ << " Error. fail zxdg_shell_v6_get_xdg_surface" << std::endl;
- this->DisconnectDisplay();
- return -1;
- }
-
- return 0;
-}
-
-void WlClientSimpleRendering::DisconnectDisplay()
-{
- int i;
-
- if (__zxdgShellSurface != nullptr) zxdg_surface_v6_destroy(__zxdgShellSurface);
- __zxdgShellSurface = nullptr;
- if (__wlSurface != nullptr) wl_surface_destroy(__wlSurface);
- __wlSurface = nullptr;
- for (i = 0; i < BUF_NUM; i++)
- {
- this->DestroyBuffer(i);
- }
- if (__wlTbmClient != nullptr) wayland_tbm_client_deinit(__wlTbmClient);
- __wlTbmClient = nullptr;
-
- if (__zxdgShell != nullptr) zxdg_shell_v6_destroy(__zxdgShell);
- __zxdgShell = nullptr;
- if (__wlCompositor) wl_compositor_destroy(__wlCompositor);
- __wlCompositor = nullptr;
-
- if (__wlRegistry != nullptr) wl_registry_destroy(__wlRegistry);
- __wlRegistry = nullptr;
- __wlDisplay = nullptr;
- if (__ecoreWl2Dpy != nullptr) ecore_wl2_display_disconnect(__ecoreWl2Dpy);
- __ecoreWl2Dpy = nullptr;
-}
-
-int WlClientSimpleRendering::CreateBuffer(int bufferNum)
-{
- tbm_surface_h tbm_surface;
-
- if (bufferNum >= BUF_NUM)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return -1;
- }
-
- if (__wlTbmClient == nullptr)
- {
- std::cout << __func__ << " Error. no __wlTbmClient. execute ConnectDisplay first" << std::endl;
- return -1;
- }
-
- tbm_surface = tbm_surface_create(__width, __height, __format);
- if (tbm_surface == nullptr)
- {
- std::cout << __func__ << " Error. fail to create tbm_surface" << std::endl;
- return -1;
- }
-
- if (__tbmSurface[bufferNum] != nullptr)
- {
- std::cout << __func__ << " destroy prev tbm_surface " << bufferNum << ":" << __tbmSurface[bufferNum] << std::endl;
- this->DestroyBuffer(bufferNum);
- }
- __tbmSurface[bufferNum] = tbm_surface;
-
- __wlBuffer[bufferNum] = wayland_tbm_client_create_buffer(__wlTbmClient, __tbmSurface[bufferNum]);
- if (__wlBuffer[bufferNum] == nullptr)
- {
- std::cout << __func__ << " Error. fail to create wl_buffer" << std::endl;
- tbm_surface_destroy(__tbmSurface[bufferNum]);
- __tbmSurface[bufferNum] = nullptr;
- return -1;
- }
-
- std::cout << __func__ << " create " << bufferNum << " buffer(tbm_surface:" << __tbmSurface[bufferNum] << ", wl_buffer:" << __wlBuffer[bufferNum] << ")" << std::endl;
-
- return 0;
-}
-
-void WlClientSimpleRendering::DestroyBuffer(int bufferNum)
-{
- if (bufferNum >= BUF_NUM)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return;
- }
-
- if (__tbmSurface[bufferNum] == nullptr)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return;
- }
-
- std::cout << __func__ << " destroy " << bufferNum << " buffer(tbm_surface:" << __tbmSurface[bufferNum] << ", wl_buffer:" << __wlBuffer[bufferNum] << ")" << std::endl;
-
- wl_buffer_destroy(__wlBuffer[bufferNum]);
- __wlBuffer[bufferNum] = nullptr;
- tbm_surface_destroy(__tbmSurface[bufferNum]);
- __tbmSurface[bufferNum] = nullptr;
-}
-
-int WlClientSimpleRendering::RenderingBuffer(int bufferNum, unsigned char color)
-{
- tbm_surface_h tbm_surface;
- tbm_surface_info_s info;
- int ret = 0;
-
- if (bufferNum >= BUF_NUM)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return -1;
- }
-
- tbm_surface = __tbmSurface[bufferNum];
- if (tbm_surface == nullptr)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return -1;
- }
-
- ret = tbm_surface_map(tbm_surface, TBM_SURF_OPTION_WRITE, &info);
- if (ret != 0)
- {
- std::cout << __func__ << " Error. fail to tbm_surface_map " << ret << std::endl;
- return ret;
- }
-
- memset(info.planes[0].ptr, color, info.planes[0].stride * info.height);
-
- tbm_surface_unmap(tbm_surface);
-
- return ret;
-}
-
-void WlClientSimpleRendering::CommitBuffer(int bufferNum)
-{
- if (__wlSurface == nullptr || __wlDisplay == nullptr)
- {
- std::cout << __func__ << " Error. execute connect first" << std::endl;
- return;
- }
-
- if (bufferNum >= BUF_NUM || __wlBuffer[bufferNum] == nullptr)
- {
- std::cout << __func__ << " Error. invalid buffer number" << bufferNum << std::endl;
- return;
- }
-
- wl_surface_attach(__wlSurface, __wlBuffer[bufferNum], 0, 0);
- wl_surface_damage(__wlSurface, 0, 0, __width, __height);
- wl_surface_commit(__wlSurface);
-
- std::cout << __func__ << " commit " << bufferNum << " buffer(tbm_surface:" << __tbmSurface[bufferNum] << ", wl_buffer:" << __wlBuffer[bufferNum] << ")" << std::endl;
-
-#if 0
- int ret = 0;
-
- ret = wl_display_dispatch(__wlDisplay);
- if (ret < 0) {
- std::cout << __func__ << " Error. wl_display_dispatch error:" << ret << std::endl;
- return;
- }
-#endif
-
- wl_display_roundtrip(__wlDisplay);
-}
-
-int main (void)
-{
- WlClientSimpleRendering *simpleRenderSample = nullptr;
- int count = 0;
- int ret = 0;
- int i;
- unsigned char color;
-
- ecore_wl2_init();
-
- simpleRenderSample = new WlClientSimpleRendering(BUF_WIDTH, BUF_HEIGHT, TBM_FORMAT_ARGB8888);
- if (simpleRenderSample == nullptr)
- {
- std::cout << __func__ << " Error. fail create WlClientSimpleRendering" << std::endl;
- ecore_wl2_shutdown();
- return -1;
- }
-
- ret = simpleRenderSample->ConnectDisplay();
- if (ret)
- {
- std::cout << __func__ << " Error. fail ConnectDisplay" << std::endl;
- ecore_wl2_shutdown();
- return -1;
- }
-
- for (i = 0; i < BUF_NUM; i++)
- {
- ret = simpleRenderSample->CreateBuffer(i);
- if (ret)
- {
- std::cout << __func__ << " Error. fail CreateBuffer " << i << std::endl;
- goto finish;
- }
- }
-
- zxdg_surface_v6_get_toplevel(simpleRenderSample->__zxdgShellSurface);
-
- /* main loop */
- i = 0;
- color = 0x11;
- std::cout << __func__ << " loop start." << std::endl;
- while (count < TEST_COUNT) {
- simpleRenderSample->RenderingBuffer(i, color);
- simpleRenderSample->CommitBuffer(i);
- count++;
- i++;
- if (i == BUF_NUM) i = 0;
- if (color == 0xff)
- color = 0x11;
- else
- color += 0x11;
- std::cout << __func__ << " loop running " << count << std::endl;
- usleep(100000);
- }
- std::cout << __func__ << " loop end." << std::endl;
-
-finish:
- simpleRenderSample->DisconnectDisplay();
-
- delete simpleRenderSample;
-
- ecore_wl2_shutdown();
-
- return 0;
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <DSCompositor.h>
-#include <IDSOutput.h>
-#include <DSInput.h>
-#include <DSCanvas.h>
-#include <DSSeat.h>
-#include <DSPolicyArea.h>
-#include <DSDisplayArea.h>
-#include <DSTextInput.h>
-#include <DSTraceInfo.h>
-#include "DSDebugLog.h"
-
-using namespace display_server;
-
-// MyCompositor has to inherit DSCompositor.
-class MyCompositor : public DSCompositor
-{
-public:
- MyCompositor()
- : __canvas{nullptr},
- __seat{nullptr},
- __policyArea{nullptr},
- __displayArea{nullptr}
- {}
-
- virtual ~MyCompositor()
- {}
-
- // The _onInitialized is called when the DSCompositor is ready to run.
- // Make a seat and a policy area. Attach the seat to the policy area.
- // Attach the policy area and the display area to canvas and return it.
- std::shared_ptr<DSCanvas> _onInitialized() override
- {
- int width = __displayArea->getWidth();
- int height = __displayArea->getHeight();
-
- /* create a seat */
- __seat = std::make_shared<DSSeat>(this, "default");
-
- __policyArea = std::make_shared<DSPolicyArea>();
- __policyArea->setPosition(0, 0);
- __policyArea->setSize(width, height);
- __policyArea->attachSeat(__seat);
-
- __canvas = std::make_shared<DSCanvas>();
-
- if (!__canvas->attachPolicyArea(__policyArea))
- return nullptr;
-
- if (!__canvas->attachDisplayArea(__displayArea))
- return nullptr;
-
- __textInput = std::make_shared<DSTextInput>();
-
- __traceInfo = std::make_shared<DSTraceInfo>();
- __traceInfo->attachPolicyArea(__policyArea);
-
- return __canvas;
- }
-
- // The _onOutputAdded is called when the IDSOutput is added.
- void _onOutputAdded(std::shared_ptr<IDSOutput> output) override
- {
- // set the resolution.
- output->applyResolutionAuto();
-
- // make a display area.
- __displayArea = std::make_shared<DSDisplayArea>(output);
- }
-
- // The _onOutputAdded is called when the IDSOutput is removed.
- void _onOutputRemoved(std::shared_ptr<IDSOutput> output) override
- {
- __displayArea.reset(); // delete shared_ptr
- }
-
- // TODO:
- void _onInputAdded(std::shared_ptr<DSInput> input) override
- {}
-
- // TODO:
- void _onInputRemoved(std::shared_ptr<DSInput> input) override
- {}
-
-private:
- std::shared_ptr<DSCanvas> __canvas;
- std::shared_ptr<DSSeat> __seat;
- std::shared_ptr<DSPolicyArea> __policyArea;
- std::shared_ptr<DSDisplayArea> __displayArea;
- std::shared_ptr<DSTextInput> __textInput;
- std::shared_ptr<DSTraceInfo> __traceInfo;
-};
-
-int main() {
- DSCompositor *compositor = new MyCompositor();
-
- compositor->run();
-
- delete compositor;
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <DSObject.h>
-#include <memory>
-#include <string>
-
-/* RESULT
-
-=== ObjectPimpl *myobj = new ObjectPimpl() ===
-Constructor 'ObjectPimplPrivate' : ObjectPimplPrivate::ObjectPimplPrivate(ObjectPimpl*)
-Constructor 'ObjectPimpl' : ObjectPimpl::ObjectPimpl()
-
-=== ObjectPimpl *myobj2 = new ObjectPimpl() ===
-Constructor 'ObjectPimplPrivate' : ObjectPimplPrivate::ObjectPimplPrivate(ObjectPimpl*)
-Constructor 'ObjectPimpl' : ObjectPimpl::ObjectPimpl()
-
-=== delete myobj ===
-Destructor 'ObjectPimpl' : virtual ObjectPimpl::~ObjectPimpl()
-Destructor 'ObjectPimplPrivate' : virtual ObjectPimplPrivate::~ObjectPimplPrivate()
-
-=== delete myobj2 ===
-Destructor 'ObjectPimpl' : virtual ObjectPimpl::~ObjectPimpl()
-Destructor 'ObjectPimplPrivate' : virtual ObjectPimplPrivate::~ObjectPimplPrivate()
-
-*/
-
-using namespace display_server;
-
-class ObjectPimpl;
-
-class ObjectPimplPrivate : public DSObjectPrivate
-{
-public:
- ObjectPimplPrivate() = delete;
- ObjectPimplPrivate(ObjectPimpl *p_ptr);
- ~ObjectPimplPrivate();
-};
-
-class ObjectPimpl : public DSObject
-{
-public:
- explicit ObjectPimpl();
- virtual ~ObjectPimpl();
-
-private:
- inline ObjectPimplPrivate *__d_func()
- {
- return reinterpret_cast<ObjectPimplPrivate *>(_d_ptr.get());
- }
- inline const ObjectPimplPrivate *__d_func() const
- {
- return reinterpret_cast<ObjectPimplPrivate *>(_d_ptr.get());
- }
- friend class ObjectPimplPrivate;
-};
-
-ObjectPimplPrivate::ObjectPimplPrivate(ObjectPimpl *p_ptr)
- : DSObjectPrivate(p_ptr)
-{
- std::cout << "Constructor 'ObjectPimplPrivate' : " << __PRETTY_FUNCTION__ << std::endl;
-}
-
-ObjectPimplPrivate::~ObjectPimplPrivate()
-{
- std::cout << "Destructor 'ObjectPimplPrivate' : " << __PRETTY_FUNCTION__ << std::endl;
-}
-
-ObjectPimpl::ObjectPimpl()
- : DSObject(std::make_unique<ObjectPimplPrivate>(this))
-{
- std::cout << "Constructor 'ObjectPimpl' : " << __PRETTY_FUNCTION__ << std::endl;
-}
-
-ObjectPimpl::~ObjectPimpl()
-{
- std::cout << "Destructor 'ObjectPimpl' : " << __PRETTY_FUNCTION__ << std::endl;
-}
-
-int exampleObjectPimpl(void)
-{
- std::cout << "\n=== ObjectPimpl *myobj = new ObjectPimpl() ===" << std::endl;
- ObjectPimpl *myobj = new ObjectPimpl();
-
- std::cout << "\n=== ObjectPimpl *myobj2 = new ObjectPimpl() ===" << std::endl;
- ObjectPimpl *myobj2 = new ObjectPimpl();
-
- std::cout << "\n=== delete myobj ===" << std::endl;
- delete myobj;
-
- std::cout << "\n=== delete myobj2 ===" << std::endl;
- delete myobj2;
-
- return 0;
-}
-
-int main()
-{
- return exampleObjectPimpl();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <DSObject.h>
-#include <memory>
-#include <string>
-
-/* RESULT
-=== Property *myproperty = new Property() ===
-Constructor 'Property' : Property::Property()
-
-=== Property *myproperty2 = new Property() ===
-Constructor 'Property' : Property::Property()
-
-=== Add Property [myProperty:1234(int)] to myproperty
-Try get Property (key:"myProperty", type:int) of myproperty
-myProperty: 1234
-Try get Property (key:"myProperty", type:float) of myproperty
-ERR: Unexpected index
-
-=== Add Property [myProperty:0x11fd378(ptr)] to myproperty ===
-Try get Property (key:"myProperty", type:int) of myproperty
-ERR: Unexpected index
-Try get Property (key:"myProperty", type:void *) of myproperty
-myProperty: 0x#######
-Try get Property (key:"yourProperty", type:DSPropertyVariant&) of myproperty
-SUCCESS: NOT_EXIST
-
-=== delete myproperty ===
-Destructor 'Property' : virtual Property::~Property()
-
-=== delete myproperty2 ===
-Destructor 'Property' : virtual Property::~Property()
-*/
-
-using namespace display_server;
-
-class Property : public DSObject
-{
-public:
- explicit Property();
- virtual ~Property();
-};
-
-Property::Property()
-{
- std::cout << "Constructor 'Property' : " << __PRETTY_FUNCTION__ << std::endl;
-}
-
-Property::~Property()
-{
- std::cout << "Destructor 'Property' : " << __PRETTY_FUNCTION__ << std::endl;
-}
-
-int main()
-{
- std::cout << "\n=== Property *myproperty = new Property() ===" << std::endl;
- Property *myproperty = new Property();
-
- std::cout << "\n=== Property *myproperty2 = new Property() ==="
- << std::endl;
- Property *myproperty2 = new Property();
-
- std::cout << "\n=== Add Property [myProperty:1234(int)] to myproperty ==="
- << std::endl;
- myproperty->setProperty("myProperty", 1234, DSPropertyType::INTEGER);
-
- try {
- std::cout
- << "Try get Property (key:\"myProperty\", type:int) of myproperty"
- << std::endl;
- std::cout << "myProperty: "
- << std::get<int>(myproperty->getProperty("myProperty"))
- << std::endl;
- } catch (std::exception &e) {
- std::cout << "ERR: " << e.what() << std::endl;
- }
-
- try {
- std::cout
- << "Try get Property (key:\"myProperty\", type:float) of myproperty"
- << std::endl;
- std::cout << std::get<float>(myproperty->getProperty("myProperty"))
- << std::endl;
- } catch (std::exception &e) {
- std::cout << "ERR: " << e.what() << std::endl;
- }
-
- std::cout << "\n=== Add Property [myProperty:" << myproperty2
- << "(ptr)] to myproperty ===" << std::endl;
- myproperty->setProperty("myProperty", static_cast<void *>(myproperty2),
- DSPropertyType::POINTER);
-
- try {
- std::cout
- << "Try get Property (key:\"myProperty\", type:int) of myproperty"
- << std::endl;
- std::cout << std::get<int>(myproperty->getProperty("myProperty"))
- << std::endl;
- } catch (std::exception &e) {
- std::cout << "ERR: " << e.what() << std::endl;
- }
-
- try {
- std::cout
- << "Try get Property (key:\"myProperty\", type:void *) of myproperty"
- << std::endl;
- Property *mypropertyptr = static_cast<Property *>(
- std::get<void *>(myproperty->getProperty("myProperty")));
- std::cout << "myProperty: " << mypropertyptr << std::endl;
- } catch (std::exception &e) {
- std::cout << "ERR: " << e.what() << std::endl;
- }
-
- try {
- std::cout
- << "Try get Property (key:\"yourProperty\", type:DSPropertyVariant&) of myproperty"
- << std::endl;
- const DSPropertyVariant &ptr = myproperty->getProperty("yourProperty");
- std::cout << " THIS LINE SHOULD BE NOT PRINTED! yourProperty: " << &ptr
- << std::endl;
- } catch (std::exception &e) {
- std::cout << "SUCCESS: " << e.what() << std::endl;
- }
-
- std::cout << "\n=== delete myproperty ===" << std::endl;
- delete myproperty;
-
- std::cout << "\n=== delete myproperty2 ===" << std::endl;
- delete myproperty2;
-
- return 0;
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <DSObject.h>
-#include <DSRefBase.h>
-#include <DSSignal.h>
-#include <string>
-
-/* RESULT
-construct Sender
-construct Sender
-construct Receiver
-construct Receiver
-slotA invoked! a:1234
-slotA2 invoked! a:1234
-slotB invoked! a:45.67
-Lambda slot invoked! val: 45.67
-destruct Receiver(ref: 0)
-slotB invoked! a:5678
-slotA invoked! a:90
-destruct Sender
-destruct Sender
-destruct Receiver(ref: 1)
- */
-
-using namespace display_server;
-
-using SignalAType = DSSignal<int>;
-using SignalBType = DSSignal<double>;
-
-class Sender : public DSObject
-{
-public:
- Sender() : DSObject()
- {
- std::cout << "construct Sender" << std::endl;
- }
- ~Sender()
- {
- std::cout << "destruct Sender " << getName() << std::endl;
- }
-
- struct SignalA : public SignalAType
- {
- void emit(int val)
- {
- SignalAType::emit(val);
- }
- } signalA;
-
- struct SignalB : public SignalBType
- {
- void emit(double val)
- {
- SignalBType::emit(val);
- }
- } signalB;
-};
-
-class Receiver : public DSObject, public DSRefBase
-{
-public:
- Receiver() : DSObject(), DSRefBase()
- {
- std::cout << "construct Receiver" << std::endl;
- }
- ~Receiver()
- {
- std::cout << "destruct Receiver(ref: " << getref() << ") " << getName()
- << std::endl;
- }
-
- static void slotA(int a)
- {
- std::cout << "slotA invoked! a:" << a << std::endl;
- };
- static void slotA2(int a)
- {
- std::cout << "slotA2 invoked! a:" << a << std::endl;
- }
- static void slotB(double a)
- {
- std::cout << "slotB invoked! a:" << a << std::endl;
- };
-};
-
-int main(void)
-{
- Sender *sender = new Sender();
- Sender *sender2 = new Sender();
- Receiver *receiver = new Receiver();
- Receiver *receiver2 = new Receiver();
-
- sender->signalA.connect(receiver, Receiver::slotA);
- sender->signalA.connect(receiver2, Receiver::slotA2);
- sender->signalB.connect(receiver, Receiver::slotB);
- sender->signalB.connect(receiver2, [](double val) {
- std::cout << "Lambda slot invoked! val: " << val << std::endl;
- });
-
- sender->signalA.emit(1234);
- sender->signalB.emit(45.67);
-
- if (receiver2->getref() == 1) {
- receiver2->unref();
- receiver2 = nullptr;
- }
-
- sender->signalB.emit(5678);
- sender->signalA.emit(90.1);
-
- delete sender;
- delete sender2;
- delete receiver;
-
- return 0;
-}
+++ /dev/null
-executable('exampleSignalSlot',
- 'exampleSignalSlot.cpp',
- dependencies : libds_declared_dep,
- install_dir : libds_prefix_bindir,
- install : true
- )
-
-executable('exampleObjectPimpl',
- 'exampleObjectPimpl.cpp',
- dependencies : libds_declared_dep,
- install_dir : libds_prefix_bindir,
- install : true
- )
-
-executable('exampleProperty',
- 'exampleProperty.cpp',
- dependencies : libds_declared_dep,
- install_dir : libds_prefix_bindir,
- install : true
- )
-
-executable('exampleCompositor',
- 'exampleCompositor.cpp',
- dependencies : libds_declared_dep,
- install_dir : libds_prefix_bindir,
- install : true
- )
-
-# exampleClient written for testing exampleCompositor
-wayland_client_dep = dependency('wayland-client')
-tizen_extension_client_dep = dependency('tizen-extension-client')
-xdg_shell_client_dep = dependency('xdg-shell-unstable-v6-client')
-tizen_launch_client_dep = dependency('tizen-launch-client')
-libxkbcommon_dep = dependency('xkbcommon')
-executable('exampleClient',
- 'exampleClient.c',
- dependencies : [libds_declared_dep, wayland_client_dep, tizen_extension_client_dep, xdg_shell_client_dep, libxkbcommon_dep, tizen_launch_client_dep],
- install_dir : libds_prefix_bindir,
- install : true
- )
-
-
-ecore_wayland2_dep = dependency('ecore-wl2')
-wayland_tbm_client_dep = dependency('wayland-tbm-client')
-executable('exampleClientNoShellRendering',
- 'exampleClientNoShellRendering.cpp',
- dependencies : [libds_declared_dep, wayland_client_dep, tizen_extension_client_dep, ecore_wayland2_dep, wayland_tbm_client_dep],
- install_dir : libds_prefix_bindir,
- install : true
- )
-
-wayland_tbm_client_dep = dependency('wayland-tbm-client')
-xdg_shell_client_dep = dependency('xdg-shell-client')
-xdg_shell_unstable_v6_client_dep = dependency('xdg-shell-unstable-v6-client')
-executable('exampleClientShellRendering',
- 'exampleClientShellRendering.cpp',
- dependencies : [libds_declared_dep, wayland_client_dep, xdg_shell_client_dep, xdg_shell_unstable_v6_client_dep, ecore_wayland2_dep, wayland_tbm_client_dep],
- install_dir : libds_prefix_bindir,
- install : true
- )
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_REF_BASE_H_
-#define __DS_REF_BASE_H_
-
-namespace display_server
-{
-
-class DSRefBase
-{
-public:
- DSRefBase()
- : __count(1)
- {}
- virtual ~DSRefBase()
- {}
-
- void ref()
- {
- ++__count;
- }
-
- inline void unref()
- {
- if (--__count == 0)
- delete this;
- }
-
- const int getref() const
- {
- return __count;
- }
-
-private:
- int __count;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSBufferManager.h"
-#include "DSBufferManagerPrivate.h"
-#include "DSDebugLog.h"
-#include "DSBufferTBMImpl.h"
-#include "DSUtilSocket.h"
-
-namespace display_server
-{
-
-int DSBufferManager::__refCount { 0 };
-std::mutex DSBufferManager::__mutex;
-DSBufferManager* DSBufferManager::__bufferManager { nullptr };
-
-struct BufferDestroyListener : ::wl_listener
-{
- BufferDestroyListener()
- {
- notify = DSBufferManagerPrivate::bufferDestroyListenerCallback;
- wl_list_init(&this->link);
- }
-
- DSBufferManagerPrivate *bufferManager = nullptr;
-};
-
-/* Begin Public Class Implementation */
-DSBufferManager::DSBufferManager(DSObject *parent)
- : DS_INIT_PRIVATE_PTR(DSBufferManager)
-{
-}
-
-DSBufferManager::~DSBufferManager()
-{
-}
-
-DSBufferManager *DSBufferManager::getInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- if (!__bufferManager && (__refCount == 0))
- {
- __bufferManager = new DSBufferManager(new DSObject);
- DSLOG_INF("DSBufferManager",
- "DSBufferManager instance has been created !");
- }
-
- ++__refCount;
- return __bufferManager;
-}
-
-void DSBufferManager::releaseInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- --__refCount;
- if (__refCount < 0)
- __refCount = 0;
-
- if ((0 == __refCount) && __bufferManager)
- {
- delete __bufferManager;
- __bufferManager = nullptr;
- DSLOG_INF("DSBufferManager",
- "DSBufferManager instance has been removed !");
- }
-}
-
-void DSBufferManagerPrivate::bufferDestroyListenerCallback(struct ::wl_listener *listener, void *data)
-{
- BufferDestroyListener *destroyListener = static_cast<BufferDestroyListener *>(listener);
- struct ::wl_resource *bufferResource = static_cast<struct ::wl_resource *>(data);
- DSBufferManagerPrivate *bufferManager = destroyListener->bufferManager;
- std::shared_ptr<IDSBuffer> dsBuffer = nullptr;
-
- wl_list_remove(&destroyListener->link);
- delete destroyListener;
-
- auto it = bufferManager->__resourceMap.find(bufferResource);
- if (it == bufferManager->__resourceMap.end())
- return;
-
- dsBuffer = it->second;
- dsBuffer->setClientDestroyed();
- bufferManager->__resourceMap.erase(it);
-}
-
-std::shared_ptr<IDSBuffer> DSBufferManager::getDSBuffer(struct ::wl_resource *bufferResource)
-{
- DS_GET_PRIV(DSBufferManager);
-
- return priv->getDSBuffer(bufferResource);
-}
-
-DSBufferManagerPrivate::DSBufferManagerPrivate(DSBufferManager *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __wlTbmServer(nullptr)
-{
- tbm_bufmgr bufmgr = nullptr;
-
- __waylandCompositor = DSWaylandCompositor::getInstance();
-
- if (__waylandCompositor) {
- wl_display_init_shm(__waylandCompositor->display());
- __wlTbmServer = wayland_tbm_server_init(__waylandCompositor->display(), NULL, -1, 0);
- } else {
- DSLOG_ERR("DSBufferManagerPrivate", "fail to get DSWaylandCompostior");
- }
-
- if (__wlTbmServer) {
- bufmgr = static_cast<tbm_bufmgr>(wayland_tbm_server_get_bufmgr(__wlTbmServer));
- } else {
- DSLOG_ERR("DSBufferManagerPrivate", "fail to get tbm_bufmgr");
- }
-
- if (__waylandCompositor && bufmgr)
- tbm_bufmgr_bind_native_display(bufmgr, __waylandCompositor->display());
-
- DSUtilSocket *utilSocket = DSUtilSocket::getInstance();
- utilSocket->initSocket("tbm-drm-auth");
- utilSocket->releaseInstance();
-
-}
-
-std::shared_ptr<IDSBuffer> DSBufferManagerPrivate::getDSBuffer(struct ::wl_resource *bufferResource)
-{
- std::shared_ptr<IDSBuffer> dsBuffer;
- tbm_surface_h tbm_surface;
-
- auto it = __resourceMap.find(bufferResource);
- if (it != __resourceMap.end()) {
- return it->second;
- }
-
- tbm_surface = wayland_tbm_server_get_surface(NULL, bufferResource);
- if (tbm_surface)
- dsBuffer = std::make_shared<DSBufferTBMImpl>(tbm_surface, bufferResource);
-
- if (dsBuffer.get() == nullptr) {
- return nullptr;
- }
-
- auto [itr, success] = __resourceMap.emplace(bufferResource, dsBuffer);
- if (!success)
- return nullptr;
-
- auto *destroyListener = new BufferDestroyListener;
- destroyListener->bufferManager = this;
- wl_resource_add_destroy_listener(bufferResource, destroyListener);
-
- return dsBuffer;
-}
-
-DSBufferManagerPrivate::~DSBufferManagerPrivate()
-{
- wayland_tbm_server_deinit(__wlTbmServer);
- DSWaylandCompositor::releaseInstance();
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_BUFFER_MANAGER_H__
-#define __DS_BUFFER_MANAGER_H__
-
-#include <DSCore.h>
-#include <DSObject.h>
-#include <IDSBuffer.h>
-#include <DSWaylandCompositor.h>
-#include "dswayland-server-wayland.h"
-
-namespace display_server
-{
-
-class DSBufferManagerPrivate;
-
-class DSBufferManager : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSBufferManager);
-public:
- static DSBufferManager *getInstance();
- static void releaseInstance();
-
- std::shared_ptr<IDSBuffer> getDSBuffer(struct ::wl_resource *bufferResource);
-
-private:
- static std::mutex __mutex;
- static DSBufferManager *__bufferManager;
- static int __refCount;
-
- DSBufferManager() = delete;
- ~DSBufferManager();
- DSBufferManager(DSObject *parent);
- DSBufferManager& operator=(const DSBufferManager&) = delete;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_BUFFER_MANAGER_PRIVATE_H__
-#define __DS_BUFFER_MANAGER_PRIVATE_H__
-
-#include "DSBufferManager.h"
-#include <unordered_map>
-#include <tbm_surface.h>
-#include <tbm_surface_internal.h>
-#include <wayland-tbm-server.h>
-
-namespace display_server
-{
-
-class DSBufferManagerPrivate : public DSObjectPrivate
-{
- DS_PIMPL_USE_PUBLIC(DSBufferManager);
-public:
- DSBufferManagerPrivate() = delete;
- DSBufferManagerPrivate(DSBufferManager *p_ptr);
- ~DSBufferManagerPrivate();
-
- std::shared_ptr<IDSBuffer> getDSBuffer(struct ::wl_resource *bufferResource);
-
-private:
- struct ::wayland_tbm_server * __wlTbmServer;
- DSWaylandCompositor *__waylandCompositor;
- std::unordered_map <struct ::wl_resource *, std::shared_ptr<IDSBuffer>> __resourceMap;
-
- friend struct BufferDestroyListener;
- static void bufferDestroyListenerCallback(struct ::wl_listener *listener, void *data);
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSBufferQueueTBMImpl.h"
-#include "DSBufferTBMImpl.h"
-#include "DSDebugLog.h"
-#include <algorithm>
-
-namespace display_server
-{
-
-// the static variables.
-DSSignal<void *> DSBufferQueueTBMImpl::__aquirableSignal;
-
-DSBufferQueueTBMImpl::DSBufferQueueTBMImpl(int slotSize, int bufferWidth, int bufferHeight, IDSBuffer::Format format)
- : __slotSize{slotSize},
- __bufferWidth{bufferWidth},
- __bufferHeight{bufferHeight},
- __format{format}
-{
- __tqueue = tbm_surface_queue_create(__slotSize, __bufferWidth, __bufferHeight, DSBufferTBMImpl::getTBMFormat(__format), TBM_BO_SCANOUT);
- if (!__tqueue) {
- DSLOG_ERR("DSBufferTBM", "tbm_surface_queue_create fails.");
- }
-
- tbm_surface_queue_add_acquirable_cb(__tqueue, __onAquireable, this);
-}
-
-DSBufferQueueTBMImpl::DSBufferQueueTBMImpl(tbm_surface_queue_h tqueue)
- : __slotSize{tbm_surface_queue_get_size(tqueue)},
- __bufferWidth{tbm_surface_queue_get_width(tqueue)},
- __bufferHeight{tbm_surface_queue_get_height(tqueue)},
- __format{DSBufferTBMImpl::getBufferFormat(tbm_surface_queue_get_format(tqueue))},
- __tqueue{tqueue}
-{
- tbm_surface_queue_add_acquirable_cb(__tqueue, __onAquireable, this);
-}
-
-DSBufferQueueTBMImpl::~DSBufferQueueTBMImpl()
-{
- __bufferVector.erase(__bufferVector.begin(), __bufferVector.end());
- tbm_surface_queue_destroy(__tqueue);
-}
-
-int DSBufferQueueTBMImpl::getBufferWidth()
-{
- return __bufferWidth;
-}
-
-int DSBufferQueueTBMImpl::getBufferHeight()
-{
- return __bufferHeight;
-}
-
-void *DSBufferQueueTBMImpl::getNativeBufferQueue()
-{
- return (void *)__tqueue;
-}
-
-std::shared_ptr<IDSBuffer> DSBufferQueueTBMImpl::dequeueBuffer()
-{
- tbm_surface_queue_error_e terror = TBM_SURFACE_QUEUE_ERROR_NONE;
- tbm_surface_h tsurface;
-
- terror = tbm_surface_queue_dequeue(__tqueue, &tsurface);
- if (terror != TBM_SURFACE_QUEUE_ERROR_NONE) {
- DSLOG_ERR("BuffeQueueTBM", "tbm_surface_queue_dequeue fails.");
- return nullptr;
- }
-
- auto isMatchFunc = [tsurface](std::shared_ptr<IDSBuffer> buffer) -> bool {
- return ((tbm_surface_h)buffer->getNativeBuffer() == tsurface);
- };
-
- auto iter= std::find_if(__bufferVector.begin(), __bufferVector.end(), isMatchFunc);
- if (iter == __bufferVector.end()) {
- // create a IDSBuffer with tsurface.
- __bufferVector.push_back(std::make_shared<DSBufferTBMImpl>(__bufferWidth, __bufferWidth, __format, tsurface));
-
- return __bufferVector.back();
- }
-
- return *iter;
-}
-
-bool DSBufferQueueTBMImpl::enqueueBuffer(std::shared_ptr<IDSBuffer> buffer)
-{
- tbm_surface_queue_error_e terror = TBM_SURFACE_QUEUE_ERROR_NONE;
- tbm_surface_h tsurface = (tbm_surface_h)buffer->getNativeBuffer();
-
- terror = tbm_surface_queue_enqueue(__tqueue, tsurface);
- if (terror != TBM_SURFACE_QUEUE_ERROR_NONE) {
- DSLOG_ERR("BuffeQueueTBM", "tbm_surface_queue_enqueue fails.");
- return false;
- }
-
- return true;
-}
-
-std::shared_ptr<IDSBuffer> DSBufferQueueTBMImpl::acquireBuffer()
-{
- tbm_surface_queue_error_e terror = TBM_SURFACE_QUEUE_ERROR_NONE;
- tbm_surface_h tsurface;
-
- terror = tbm_surface_queue_acquire(__tqueue, &tsurface);
- if (terror != TBM_SURFACE_QUEUE_ERROR_NONE) {
- DSLOG_ERR("BuffeQueueTBM", "tbm_surface_queue_enqueue fails.");
- return nullptr;
- }
-
- auto isMatchFunc = [tsurface](std::shared_ptr<IDSBuffer> buffer) -> bool {
- return ((tbm_surface_h)buffer->getNativeBuffer() == tsurface);
- };
-
- auto iter= std::find_if(__bufferVector.begin(), __bufferVector.end(), isMatchFunc);
- if (iter == __bufferVector.end()) {
- // create a IDSBuffer with tsurface.
- __bufferVector.push_back(std::make_shared<DSBufferTBMImpl>(__bufferWidth, __bufferWidth, __format, tsurface));
-
- return __bufferVector.back();
- }
-
- return *iter;
-}
-
-bool DSBufferQueueTBMImpl::releaseBuffer(std::shared_ptr<IDSBuffer> buffer)
-{
- tbm_surface_queue_error_e terror = TBM_SURFACE_QUEUE_ERROR_NONE;
-
- terror = tbm_surface_queue_release(__tqueue, (tbm_surface_h)buffer->getNativeBuffer());
- if (terror != TBM_SURFACE_QUEUE_ERROR_NONE) {
- DSLOG_ERR("BuffeQueueTBM", "tbm_surface_queue_release fails.");
- return false;
- }
-
- return true;
-}
-
-bool DSBufferQueueTBMImpl::canAcquireBuffer(bool wait)
-{
- if (!tbm_surface_queue_can_acquire(__tqueue, wait))
- return false;
-
- return true;
-}
-
-void DSBufferQueueTBMImpl::registerCallbackAcquirable(DSObject *slot, std::function<void(void *)> func)
-{
- __aquirableSignal.connect(slot, func);
-}
-
-void DSBufferQueueTBMImpl::__onAquireable(tbm_surface_queue_h surface_queue, void *data)
-{
- __aquirableSignal.emit(data);
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_BUFFER_QUEUE_TBM_IMPL_H_
-#define __DS_BUFFER_QUEUE_TBM_IMPL_H_
-
-#include "IDSBufferQueue.h"
-#include "DSSignal.h"
-#include <tbm_surface_queue.h>
-#include <vector>
-
-namespace display_server
-{
-
-class DSBufferQueueTBMImpl : public IDSBufferQueue
-{
-public:
- DSBufferQueueTBMImpl(int slotSize, int bufferWidth, int bufferHeight, IDSBuffer::Format format);
- DSBufferQueueTBMImpl(tbm_surface_queue_h tqueue);
- ~DSBufferQueueTBMImpl();
-
- int getBufferWidth() override;
- int getBufferHeight() override;
- void *getNativeBufferQueue() override;
-
- std::shared_ptr<IDSBuffer> dequeueBuffer() override;
- bool enqueueBuffer(std::shared_ptr<IDSBuffer> buffer) override;
- std::shared_ptr<IDSBuffer> acquireBuffer() override;
- bool releaseBuffer(std::shared_ptr<IDSBuffer> buffer) override;
-
- bool canAcquireBuffer(bool wait) override;
- void registerCallbackAcquirable(DSObject *slot, std::function<void(void *)> func) override;
-
-private:
- int __slotSize;
- int __bufferWidth;
- int __bufferHeight;
- IDSBuffer::Format __format;
- tbm_surface_queue_h __tqueue;
- std::vector<std::shared_ptr<IDSBuffer>> __bufferVector;
-
- static void __onAquireable(tbm_surface_queue_h surface_queue, void *data);
- static DSSignal<void *> __aquirableSignal;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSBufferRef.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-DSBufferRef::DSBufferRef(std::shared_ptr<IDSBuffer> dsBuffer)
- : __dsBuffer(dsBuffer)
-{
- __dsBuffer->ref();
-}
-
-DSBufferRef::~DSBufferRef()
-{
- __dsBuffer->unref();
-}
-
-std::shared_ptr<IDSBuffer> DSBufferRef::refDSBufferGet()
-{
- return __dsBuffer;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_BUFFER_REF_H__
-#define __DS_BUFFER_REF_H__
-
-#include <DSCore.h>
-#include <IDSBuffer.h>
-
-namespace display_server
-{
-
-class DSBufferRef
-{
-public:
- explicit DSBufferRef(std::shared_ptr<IDSBuffer> dsBuffer);
- virtual ~DSBufferRef();
-
- std::shared_ptr<IDSBuffer> refDSBufferGet();
-
-private:
- std::shared_ptr<IDSBuffer> __dsBuffer;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSBufferTBMImpl.h"
-#include "DSDebugLog.h"
-#include <tbm_surface_internal.h>
-
-namespace display_server
-{
-
-DSBufferTBMImpl::DSBufferTBMImpl(int width, int height, IDSBuffer::Format format)
- : __width{width},
- __height{height},
- __format{format},
- __refCount(0),
- __resource(nullptr),
- __type(DSBufferTBMImpl::Type::SERVER)
-
-{
- __tsurface = tbm_surface_create(__width, __height, getTBMFormat(__format));
- if (!__tsurface) {
- DSLOG_ERR("DSBufferTBM", "tbm_surface_create fails.");
- }
-}
-
-DSBufferTBMImpl::DSBufferTBMImpl(int width, int height, IDSBuffer::Format format, tbm_surface_h tsurface)
- : __width{width},
- __height{height},
- __format{format},
- __refCount(0),
- __tsurface(tsurface),
- __resource(nullptr),
- __type(DSBufferTBMImpl::Type::SERVER)
-{}
-
-DSBufferTBMImpl::DSBufferTBMImpl(tbm_surface_h tsurface, struct ::wl_resource *resource)
- : __refCount(0),
- __tsurface(tsurface),
- __resource(resource),
- __type(DSBufferTBMImpl::Type::CLIENT)
-{
- __width = tbm_surface_get_width(tsurface);
- __height = tbm_surface_get_height(tsurface);
- __format = getBufferFormat(tbm_surface_get_format(tsurface));
-
- tbm_surface_internal_ref(tsurface);
-}
-
-DSBufferTBMImpl::~DSBufferTBMImpl()
-{
- tbm_surface_destroy(__tsurface);
-}
-
-void *DSBufferTBMImpl::getNativeBuffer()
-{
- return (void *)__tsurface;
-}
-
-void DSBufferTBMImpl::setClientDestroyed()
-{
- this->__resource = nullptr;
-}
-
-void DSBufferTBMImpl::ref()
-{
- __refCount++;
-}
-
-void DSBufferTBMImpl::unref()
-{
- __refCount--;
-
- if (__refCount <= 0) {
- if (this->__type == display_server::DSBufferTBMImpl::Type::CLIENT) {
- if (this->__resource)
- wl_buffer_send_release(this->__resource);
- }
- }
-}
-
-std::shared_ptr<stSize> DSBufferTBMImpl::getSize()
-{
- std::shared_ptr<stSize> bufferSize = std::make_shared<stSize>();
- bufferSize->w = __width;
- bufferSize->h = __height;
-
- return bufferSize;
-}
-
-tbm_format DSBufferTBMImpl::getTBMFormat(const IDSBuffer::Format &format)
-{
- tbm_format tformat = 0; // what is the error format?
-
- switch (format) {
- case IDSBuffer::Format::FORMAT_ARGB8888 :
- tformat = TBM_FORMAT_ARGB8888;
- break;
- default:
- DSLOG_ERR("DSBufferTBM", "(%d) format is not supported.", format);
- }
-
- return tformat;
-}
-
-IDSBuffer::Format DSBufferTBMImpl::getBufferFormat(const tbm_format &tformat)
-{
- IDSBuffer::Format format = IDSBuffer::Format::FORMAT_ARGB8888;
-
- switch (tformat) {
- case TBM_FORMAT_ARGB8888 :
- format = IDSBuffer::Format::FORMAT_ARGB8888 ;
- break;
- default:
- DSLOG_ERR("DSBufferTBM", "(%d) format is not supported.", tformat);
- }
-
- return format;
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_BUFFER_TBM_IMPL_H_
-#define __DS_BUFFER_TBM_IMPL_H_
-
-#include "IDSBuffer.h"
-#include "dswayland-server-wayland.h"
-#include <tbm_surface.h>
-
-namespace display_server
-{
-
-class DSBufferTBMImpl : public IDSBuffer
-{
-public:
- DSBufferTBMImpl(int width, int height, IDSBuffer::Format format);
- DSBufferTBMImpl(int width, int height, IDSBuffer::Format format, tbm_surface_h tsurface);
- DSBufferTBMImpl(tbm_surface_h tsurface, struct ::wl_resource *resource);
- ~DSBufferTBMImpl();
-
- void *getNativeBuffer() override;
- void setClientDestroyed() override;
- void ref() override;
- void unref() override;
- std::shared_ptr<stSize> getSize() override;
-
- static tbm_format getTBMFormat(const IDSBuffer::Format &format);
- static IDSBuffer::Format getBufferFormat(const tbm_format &tformat);
-
- enum Type {
- SERVER,
- CLIENT
- };
-
-private:
- int __width;
- int __height;
- IDSBuffer::Format __format;
- int __refCount;
- tbm_surface_h __tsurface;
- struct ::wl_resource *__resource;
- DSBufferTBMImpl::Type __type;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __I_DS_BUFFER_H_
-#define __I_DS_BUFFER_H_
-
-#include "DSCore.h"
-#include "DSStruct.h"
-
-namespace display_server
-{
-
-class IDSBuffer
-{
-public:
- enum Format {
- FORMAT_ARGB8888
- };
-
-public:
- virtual ~IDSBuffer() = default;
-
- virtual void *getNativeBuffer() = 0;
- virtual void setClientDestroyed() = 0;
- virtual void ref() = 0;
- virtual void unref() = 0;
- virtual std::shared_ptr<stSize> getSize() = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __I_DS_BUFFER_QUEUE_H__
-#define __I_DS_BUFFER_QUEUE_H__
-
-#include "IDSBuffer.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class IDSBufferQueue : public DSObject
-{
-public:
- virtual ~IDSBufferQueue() = default;
-
- virtual int getBufferWidth() = 0;
- virtual int getBufferHeight() = 0;
- virtual void *getNativeBufferQueue() = 0;
- virtual std::shared_ptr<IDSBuffer> dequeueBuffer() = 0;
- virtual bool enqueueBuffer(std::shared_ptr<IDSBuffer> ) = 0;
- virtual std::shared_ptr<IDSBuffer> acquireBuffer() = 0;
- virtual bool releaseBuffer(std::shared_ptr<IDSBuffer> ) = 0;
-
- virtual bool canAcquireBuffer(bool wait) = 0;
- virtual void registerCallbackAcquirable(DSObject *slot, std::function<void(void *)> func) = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-# DSBuffer
-Buffer
-
-## Requirements
-
-* Buffer를 생성해야 한다. with w, h, format
-* drmbuf fd(TBM)를 받아서 Buffer를 생성할 수 있어야 한다.
-* drmbuf fd(TBM)을 Buffer로 부터 얻을 수 있어야 한다.
-* shm_id를 받아서 Buffer를 생성할 수 있어야 한다.
-* Buffer를 Reference 관리할 수 있어야 한다.(ref/unref)
-* NativeBuffer가 있어야 한다. NativeBuffer라 함은, tbmBuffer, shmBuffer and others
-* Buffer에서 virtual address(memory 시작 pointer)를 얻을 수 있어야 한다.
-
-
+++ /dev/null
-class Client
-{
-}
-
-Client "1" o-right- "0..*" IDSBuffer
-
-interface IDSBuffer
-{
-}
-
-IDSBuffer <|-down-- DSBufferTBMImpl
-IDSBuffer <|-down-- DSBufferSHMImpl
-
-class DSBufferTBMImpl
-{
- + DSBufferTBMImpl(int width, int height, IDSBuffer::Format format);
- + DSBufferTBMImpl();
- + static tbm_format &getTBMFormat(IDSBuffer::Format &format);
-
- - int __width;
- - int __height;
- - IDSBuffer::Format __format;
- - tbm_surface_h __tsurface;
-}
-
+++ /dev/null
-@startuml
-class Client
-{
-}
-
-Client "1" o-right- "0..*" IDSBufferQueue
-Client -[hidden]- IDSBuffer
-
-interface IDSBufferQueue
-{
- + virtual bool enqueueBuffer(std::shared_ptr<IDSBuffer> buffer) = 0;
- + virtual std::shared_ptr<IDSBuffer> dequeueBuffer() = 0;
- + virtual std::shared_ptr<IDSBuffer> acquireBuffer() = 0;
- + virtual bool releaseBuffer(std::shared_ptr<IDSBuffer> buffer) = 0;
-}
-
-IDSBuffer "0..*" *-up- "1" DSBufferQueueTBMImpl
-IDSBuffer "0..*" *-up- "1" DSBufferQueueSHMImpl
-
-abstract class IDSBuffer
-{
-}
-
-IDSBufferQueue <|-down-- DSBufferQueueTBMImpl
-IDSBufferQueue <|-down-- DSBufferQueueSHMImpl
-
-class DSBufferQueueTBMImpl
-{
- + DSBufferQueueTBMImpl(int slotSize, int bufferWidth, int bufferHeight, IDSBuffer::Format format);
- + ~DSBufferQueueTBMImpl();
-
- + bool enqueueBuffer(std::shared_ptr<IDSBuffer> buffer) override;
- + IDSBuffer *dequeueBuffer() override;
- + IDSBuffer *acquireBuffer() override;
- + bool releaseBuffer(std::shared_ptr<IDSBuffer> buffer) override;
-
- - int __slotSize;
- - int __bufferWidth;
- - int __bufferHeight;
- - IDSBuffer::Format __format;
- - tbm_surface_queue_h __tqueue;
-}
-
-IDSBuffer <|-down-- DSBufferTBMImpl
-IDSBuffer <|-down-- DSBufferSHMImpl
-@enduml
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_CALLBACK_H_
-#define __DS_CALLBACK_H_
-
-#include <functional>
-
-namespace display_server
-{
-template <typename... Args>
-class DSCallback
-{
-protected:
- DSCallback(const DSCallback &cb)
- {}
- virtual ~DSCallback()
- {}
-
- bool operator==(const DSCallback &cb);
-
-private:
- std::function<Args...> __function;
-};
-
-template <typename... Args>
-class DSCallbackUnique : public DSCallback<Args...>
-{
-public:
- DSCallbackUnique((void)(*function)(Args...));
-};
-
-template <typename... Args>
-class DSCallbackMember : public DSCallback<Args...>
-{
-
-};
-
-template <typename... Args>
-class DSCallbackSignal : public DSCallback<Args...>
-{
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSCanvas.h"
-#include "DSCanvasPrivate.h"
-#include "DSPolicyAreaPrivate.h"
-#include "DSDisplayAreaPrivate.h"
-
-namespace display_server
-{
-
-DSCanvas::DSCanvas()
- : DS_INIT_PRIVATE_PTR(DSCanvas)
-{}
-
-DSCanvas::~DSCanvas()
-{}
-
-bool DSCanvas::attachPolicyArea(std::shared_ptr<DSPolicyArea> policyArea)
-{
- DS_GET_PRIV(DSCanvas);
-
- if (!priv->attachPolicyArea(policyArea))
- return false;
-
- return true;
-}
-
-bool DSCanvas::attachDisplayArea(std::shared_ptr<DSDisplayArea> displayArea)
-{
- DS_GET_PRIV(DSCanvas);
-
- if (!priv->attachDisplayArea(displayArea))
- return false;
-
- return true;
-}
-
-DSCanvasPrivate::DSCanvasPrivate(DSCanvas *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __zone(nullptr),
- __policyArea(nullptr),
- __displayArea(nullptr)
-{}
-
-DSCanvasPrivate::~DSCanvasPrivate()
-{}
-
-bool DSCanvasPrivate::attachPolicyArea(std::shared_ptr<DSPolicyArea> policyArea)
-{
- if (__policyArea) {
- DSLOG_ERR("DSCanvasPrivate", "canvas has already policyArea(%p).", __policyArea);
- return false;
- }
-
- __policyArea = policyArea;
-
- // add zone to DSDisplayAreaPrivate
- if (__displayArea) {
- DSDisplayAreaPrivate *displayAreaPriv = DSDisplayAreaPrivate::getPrivate(__displayArea.get());
- if (displayAreaPriv) {
- DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get());
- displayAreaPriv->addZone(policyAreaPriv->getZone());
- }
- }
-
- return true;
-}
-
-bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr<DSDisplayArea> displayArea)
-{
- if (__displayArea) {
- DSLOG_ERR("DSCanvasPrivate", "canvas has already displayArea(%p).", __displayArea);
- return false;
- }
-
- __displayArea = displayArea;
-
- // add zone to DSDisplayAreaPrivate
- if (__policyArea) {
- DSDisplayAreaPrivate *displayAreaPriv = DSDisplayAreaPrivate::getPrivate(__displayArea.get());
- if (displayAreaPriv) {
- DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get());
- displayAreaPriv->addZone(policyAreaPriv->getZone());
- }
- }
-
- return true;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_CANVAS_H__
-#define __DS_CANVAS_H__
-
-#include <DSCore.h>
-#include <DSObject.h>
-#include <DSPolicyArea.h>
-#include <DSDisplayArea.h>
-
-namespace display_server
-{
-
-class DSCanvasPrivate;
-
-class DSCanvas : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSCanvas);
-public:
- explicit DSCanvas();
- virtual ~DSCanvas();
-
- bool attachPolicyArea(std::shared_ptr<DSPolicyArea> polcyArea);
- bool attachDisplayArea(std::shared_ptr<DSDisplayArea> displayArea);
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_CANVAS_PRIVATE_H__
-#define __DS_CANVAS_PRIVATE_H__
-
-#include "DSCanvas.h"
-#include "DSZone.h"
-
-namespace display_server
-{
-
-class DSCanvasPrivate : public DSObjectPrivate, public DSObject
-{
-DS_PIMPL_USE_PUBLIC(DSCanvas);
-public:
- DSCanvasPrivate() = delete;
- DSCanvasPrivate(DSCanvas *p_ptr);
- ~DSCanvasPrivate();
-
- static DSCanvasPrivate *getPrivate(DSCanvas *q) { return q->__d_func(); }
- bool attachPolicyArea(std::shared_ptr<DSPolicyArea> polcyArea);
- bool attachDisplayArea(std::shared_ptr<DSDisplayArea> displayArea);
-
-private:
- std::shared_ptr<DSZone> __zone;
- std::shared_ptr<DSPolicyArea> __policyArea;
- std::shared_ptr<DSDisplayArea> __displayArea;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSClient.h"
-#include "DSClientPrivate.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandClient.h"
-#include "DSWindow.h"
-
-namespace display_server
-{
-
-/* Begin Private Class Implementation */
-DSClientPrivate::DSClientPrivate(DSClient *client, DSWaylandClient *dswlClient)
- : DSObjectPrivate(client),
- __p_ptr(client),
- __dswlComp(nullptr),
- __dswlClient(dswlClient),
- __numWindows(0)
-{
- __windows.clear();
-}
-
-DSClientPrivate::~DSClientPrivate()
-{
- __windows.clear();
-}
-
-bool DSClientPrivate::addWindow(DSWindow *window)
-{
- if (window == nullptr) return false;
-
- for (auto win : __windows)
- {
- if (window == win)
- {
- DSLOG_ERR("DSClient", "Window(%p) exists already.", window);
- return true;
- }
- }
-
- __windows.push_back(window);
- __numWindows++;
- return true;
-}
-
-bool DSClientPrivate::delWindow(DSWindow *window)
-{
- if (window == nullptr) return false;
-
- for (auto win : __windows)
- {
- if (window == win)
- {
- __windows.remove(window);
- DSLOG_ERR("DSClient", "Window(%p) has been removed.", window);
- __numWindows--;
- if (__numWindows < 0) __numWindows = 0;
- return true;
- }
- }
-
- return false;
-}
-
-/* Begin Public Class Implementation */
-DSClient::DSClient(DSCompositor *compositor)
- : _d_ptr(std::make_unique<DSClientPrivate>(this, nullptr)),
- __compositor(compositor)
-{
-
-}
-DSClient::DSClient(DSCompositor *compositor, DSWaylandClient *dswlClient)
- : _d_ptr(std::make_unique<DSClientPrivate>(this, dswlClient)),
- __compositor(compositor)
-{
-
-}
-
-DSClient::~DSClient()
-{
-}
-
-bool DSClient::addWindow(DSWindow *window)
-{
- DS_GET_PRIV(DSClient);
-
- return priv->addWindow(window);
-}
-
-bool DSClient::removeWindow(DSWindow *window)
-{
- DS_GET_PRIV(DSClient);
-
- return priv->delWindow(window);
-}
-
-std::list<DSWindow *> DSClient::getWindows()
-{
- DS_GET_PRIV(DSClient);
-
- return priv->__windows;
-}
-
-uint32_t DSClient::numWindows()
-{
- DS_GET_PRIV(DSClient);
-
- return priv->__numWindows;
-}
-
-bool DSClient::hasWindow()
-{
- DS_GET_PRIV(DSClient);
-
- return priv->__numWindows ? true : false;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_SEAT_H__
-#define __DS_SEAT_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSClientPrivate;
-class DSWaylandClient;
-class DSCompositor;
-class DSWindow;
-
-class DSClient : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSClient)
-public:
- DSClient() = delete;
- DSClient(DSCompositor *compositor);
- DSClient(DSCompositor *compositor, DSWaylandClient *dswlClient);
- ~DSClient() override;
-
- bool addWindow(DSWindow *window);
- bool removeWindow(DSWindow *window);
- std::list<DSWindow *> getWindows();
- uint32_t numWindows();
- bool hasWindow();
-
-private:
- DSCompositor *__compositor;
-};
-
-}
-
-#endif //__DS_SEAT_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_SEAT_PRIVATE_H__
-#define __DS_SEAT_PRIVATE_H__
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-
-namespace display_server
-{
-
-class DSClient;
-class DSWaylandCompositor;
-
-class DSClientPrivate : public DSObjectPrivate
-{
- DS_PIMPL_USE_PUBLIC(DSClient);
-public:
- DSClientPrivate() = delete;
- DSClientPrivate(DSClient *client, DSWaylandClient *dswlClient);
- ~DSClientPrivate() override;
-
- bool addWindow(DSWindow *win);
- bool delWindow(DSWindow *win);
-
-private:
- DSWaylandCompositor *__dswlComp;
- DSWaylandClient *__dswlClient;
- std::list<DSWindow *> __windows;//use if one or more windows in a client
- int __numWindows;
-};
-
-}
-
-#endif //__DS_SEAT_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSCore.h"
-#include "DSCompositor.h"
-#include "DSCompositorPrivate.h"
-#include "DSDebugLog.h"
-#include "DSDisplayDeviceTDMImpl.h"
-#include "DSOutputImpl.h"
-#include "DSSeat.h"
-#include "DSInput.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandProtocolTrace.h"
-#include <list>
-
-namespace display_server
-{
-
-DSCompositor::DSCompositor()
- : DS_INIT_PRIVATE_PTR(DSCompositor)
-{}
-
-DSCompositor::~DSCompositor()
-{}
-
-bool DSCompositor::run()
-{
- DS_GET_PRIV(DSCompositor);
-
- if (!priv->run()) {
- DSLOG_ERR("Compositor", "priv->run() fails.");
- return false;
- }
-
- return true;
-}
-
-bool DSCompositor::quit()
-{
- DS_GET_PRIV(DSCompositor);
-
- if (!priv->quit()) {
- DSLOG_ERR("Compositor", "priv->quit() fails.");
- return false;
- }
-
- return true;
-}
-
-DSCompositorPrivate::DSCompositorPrivate(DSCompositor *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __displayDevice(nullptr),
- __canvas(nullptr),
- __dsBufferManager(nullptr),
- __dsAppinfoMgr(nullptr),
- __dsWindowMgr(nullptr),
- __protocolTrace(nullptr)
-
-{
- __eventLoop = DSEventLoop::getInstance();
- __wlCompositor = DSWaylandCompositor::getInstance();
- __displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
-}
-
-DSCompositorPrivate::~DSCompositorPrivate()
-{
- DSWindowManager::releaseInstance();
- DSWaylandCompositor::releaseInstance();
- DSBufferManager::releaseInstance();
- DSEventLoop::releaseInstance();
- DSTizenAppinfoMgr::releaseInstance();
- DSWaylandProtocolTrace::releaseInstance();
-}
-
-bool DSCompositorPrivate::run()
-{
- DS_GET_PUB(DSCompositor);
-
- __initializeWlDisplay();
- __initializeOutputs();
- __initializeBufferManager();
- __initializeTizenAppinfoMgr();
- __initializeWindowManager();
- __initializeProtocolTrace();
- __canvas = pub->_onInitialized();
- if (!__canvas) {
- DSLOG_ERR("Compositor", "_onInitialized() fails.");
- return false;
- }
-
- if (!__eventLoop->run()) {
- DSLOG_ERR("Compositor", "__eventLoop->run() fails.");
- return false;
- }
-
- return true;
-}
-
-bool DSCompositorPrivate::quit()
-{
- if (!__eventLoop->quit()) {
- DSLOG_ERR("Compositor", "__eventLoop->quit() fails.");
- return false;
- }
-
- return true;
-}
-
-void DSCompositorPrivate::__initializeWlDisplay()
-{
- __wlCompositor->create();
-}
-
-void DSCompositorPrivate::__initializeOutputs()
-{
- DS_GET_PUB(DSCompositor);
-
- auto displayDeviceOutputList = __displayDevice->getOutputList();
- if (displayDeviceOutputList.empty()) {
- DSLOG_INF("Compositor", "displayDeviceOutputList.empty().");
- return;
- }
-
- // make a IDSOutput only when the IDSDisplayDeviceOutput is connected and
- // then call the _onOutputAdded()
- for (auto displayDeviceOutput : displayDeviceOutputList) {
- if (displayDeviceOutput->getConnectState() == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- __outputList.push_back(std::make_shared<DSOutputImpl>(displayDeviceOutput));
- pub->_onOutputAdded(__outputList.back());
- }
-}
-
-void DSCompositorPrivate::__initializeBufferManager()
-{
- __dsBufferManager = DSBufferManager::getInstance();
-}
-
-void DSCompositorPrivate::__initializeTizenAppinfoMgr()
-{
- __dsAppinfoMgr = DSTizenAppinfoMgr::getInstance();
-}
-
-void DSCompositorPrivate::__initializeWindowManager()
-{
- __dsWindowMgr = DSWindowManager::getInstance();
-}
-
-void DSCompositorPrivate::__initializeProtocolTrace()
-{
- __protocolTrace = DSWaylandProtocolTrace::getInstance();
- if(__protocolTrace){
- if(__protocolTrace->init())
- __protocolTrace->enableProtocolTrace(true);
- }
-}
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_COMPOSITOR_H__
-#define __DS_COMPOSITOR_H__
-
-#include <DSCore.h>
-#include <DSObject.h>
-#include <IDSOutput.h>
-#include <DSInput.h>
-#include <DSCanvas.h>
-
-namespace display_server
-{
-
-class DSCompositorPrivate;
-
-class DSCompositor : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSCompositor);
-public:
- explicit DSCompositor();
- virtual ~DSCompositor();
-
- bool run();
- bool quit();
-
-protected:
- virtual std::shared_ptr<DSCanvas> _onInitialized() = 0;
- virtual void _onOutputAdded(std::shared_ptr<IDSOutput> output) = 0;
- virtual void _onOutputRemoved(std::shared_ptr<IDSOutput> output) = 0;
- virtual void _onInputAdded(std::shared_ptr<DSInput> input) = 0;
- virtual void _onInputRemoved(std::shared_ptr<DSInput> input) = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_COMPOSITORPRIVATE_H__
-#define __DS_COMPOSITORPRIVATE_H__
-
-#include "DSCompositor.h"
-#include "DSEventLoop.h"
-#include "IDSDisplayDevice.h"
-#include "DSBufferManager.h"
-#include "DSTizenAppinfoMgr.h"
-#include "DSWindowManager.h"
-#include "DSWaylandProtocolTrace.h"
-
-namespace display_server
-{
-
-class DSSeat;
-class DSInput;
-class DSWaylandCompositor;
-class DSTizenAppinfoMgr;
-
-class DSCompositorPrivate : public DSObjectPrivate
-{
-DS_PIMPL_USE_PUBLIC(DSCompositor);
-public:
- DSCompositorPrivate() = delete;
- DSCompositorPrivate(DSCompositor *p_ptr);
- ~DSCompositorPrivate();
-
- bool run();
- bool quit();
-
- static DSCompositorPrivate *getPrivate(DSCompositor *q) { return q->__d_func(); }
-
-protected:
-
-private:
- DSEventLoop *__eventLoop;
- std::unique_ptr<IDSDisplayDevice> __displayDevice;
- DSWaylandCompositor *__wlCompositor;
-
- std::list<std::shared_ptr<IDSOutput>> __outputList;
- std::shared_ptr<DSCanvas> __canvas;
- DSBufferManager *__dsBufferManager;
- DSTizenAppinfoMgr * __dsAppinfoMgr;
- DSWindowManager *__dsWindowMgr;
- DSWaylandProtocolTrace *__protocolTrace;
-
- void __initializeWlDisplay();
- void __initializeOutputs();
- void __initializeBufferManager();
- void __initializeTizenAppinfoMgr();
- void __initializeWindowManager();
- void __initializeProtocolTrace();
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_CORE_H__
-#define __DS_CORE_H__
-
-#include <DSDebugLog.h>
-#include <iostream>
-#include <string>
-#include <list>
-#include <memory>
-#include <functional>
-#include <cassert>
-#include <variant>
-#include <map>
-
-/* Macros for visibility */
-#define DS_DECL_EXPORT __attribute__((visibility("default")))
-#define DS_DECL_HIDDEN __attribute__((visibility("hidden")))
-
-/* Macros for supporting PImpl(Pointer to implementation) Idiom */
-/* Regarding PImpl Idiom, refer to https://www.geeksforgeeks.org/pimpl-idiom-in-c-with-examples */
-#define DS_PIMPL_USE_PRIVATE(Class) \
- protected: \
- std::unique_ptr<Class##Private> _d_ptr; \
- \
- private: \
- inline Class##Private *__d_func() \
- { return reinterpret_cast<Class##Private *>(_d_ptr.get()); } \
- inline const Class##Private *__d_func() const \
- { return reinterpret_cast<Class##Private *>(_d_ptr.get()); } \
- friend class Class##Private;
-
-#define DS_PIMPL_USE_PUBLIC(Class) \
- protected: \
- inline Class* p_func() { return static_cast<Class *>(__p_ptr); } \
- inline const Class* p_func() const { return static_cast<const Class *>(__p_ptr); } \
- friend class Class; \
- \
- private: \
- Class* __p_ptr;
-
-#define DS_INIT_PRIVATE_PTR(Class) \
- _d_ptr(std::make_unique<Class##Private>(this))
-
-#define DS_GET_PRIV(Class) \
- Class##Private* const priv = __d_func()
-
-#define DS_GET_PUB(Class) \
- Class * const pub = p_func()
-
-/* Macros for getting the pointer of the given 'Class'
- * from the wl_resource via the Private class of the given 'Class'
- */
-#define DS_WAYLAND_DEFINE_FROM_RESOURCE(Class) \
- public: \
- static Class *fromWlResource(struct ::wl_resource *resource);
-
-#define DS_WAYLAND_IMPL_FROM_RESOURCE(Class) \
- static Class##Private *__getPrivatePtrFromWlResource(struct ::wl_resource *resource) \
- { \
- auto rsrc = std::remove_pointer<Class##Private>::type::Resource::fromResource(resource); \
- return rsrc ? static_cast<Class##Private *>(rsrc->object()) : nullptr; \
- } \
- \
- Class *Class::fromWlResource(struct ::wl_resource *resource) \
- { \
- Class##Private* privat = __getPrivatePtrFromWlResource(resource); \
- return privat? privat->p_func() : nullptr; \
- }
-
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-
-#endif //__DS_CORE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_STRUCT_H__
-#define __DS_STRUCT_H__
-
-#include <cstdint>
-
-namespace display_server
-{
-
-using stPosition = struct _stPosition;
-using stSize = struct _stSize;
-using stRect = struct _stRect;
-using stGeometry = struct _stGeometry;
-
-struct _stPosition
-{
- int x;
- int y;
-};
-
-struct _stSize
-{
- unsigned int w;
- unsigned int h;
-};
-
-struct _stRect
-{
- int x;
- int y;
- uint32_t w;
- uint32_t h;
-};
-
-struct _stGeometry
-{
- int x;
- int y;
- unsigned int w;
- unsigned int h;
-};
-
-} // namespace display_server
-
-#endif //__DS_STRUCT_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "DSDebugLog.h"
-#include <dlog.h>
-
-#define COLOR_RED "\x1b[31m" /* for error */
-#define COLOR_YELLOW "\x1b[33m" /* for warning */
-#define COLOR_GREEN "\x1b[32m" /* for info */
-#define COLOR_RESET "\x1b[0m"
-
-namespace display_server
-{
-/*LCOV_EXCL_START*/
-
-DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG), __enableDlog(false)
-{
- char *tmp = getenv("DSLOG_DLOG_ENABLE");
- if (!tmp) return;
-
- char *env = strdup(tmp);
- if (!env) return;
-
- int value = atoi(env);
-
- free(env);
-
- if (value == 1)
- __enableDlog = true;
-}
-
-DSDebugLog::~DSDebugLog()
-{}
-
-DSDebugLog *DSDebugLog::mInstance { nullptr };
-std::mutex DSDebugLog::mMutex;
-
-DSDebugLog *DSDebugLog::GetInstance()
-{
- if (mInstance == nullptr) {
- std::lock_guard<std::mutex> lock(mMutex);
- if (mInstance == nullptr) {
- mInstance = new DSDebugLog();
- }
- }
-
- return mInstance;
-}
-
-void DSDebugLog::printLog(int logLevel, const char *domain, const char *funcName, int line, const char *fmt, ...)
-{
- //TODO: apply logLevel
- //TODO: use dlog or stdout
- //TODO: use dlog filters
- va_list arg;
-
- if (__enableDlog)
- {
- const log_priority dlogLevel[] = { DLOG_DEBUG, DLOG_INFO, DLOG_WARN, DLOG_ERROR };
- char buf[512] = {0,};
-
- va_start(arg, fmt);
- vsnprintf((char *)buf, sizeof(buf), fmt, arg);
- va_end(arg);
-
- dlog_print(dlogLevel[logLevel], "LIBDS", "[%s][%s:%d] %s", domain, funcName, line, buf);
- }
- else
- {
- const char *lvl_str[] = { "DS_DBG", "DS_INF", "DS_WRN", "DS_ERR" };
- const char *color[] = { COLOR_RESET, COLOR_GREEN, COLOR_YELLOW, COLOR_RED };
-
- va_start(arg, fmt);
- printf( "%s", color[logLevel]);
- printf( "[%s]", lvl_str[logLevel]);
- printf( "[%s]", domain);
- printf( ":[%s(%d)]:", funcName, line);
- vprintf( fmt, arg);
- printf( "\n");
- va_end(arg);
- }
-}
-
-int DSDebugLog::getLogLevel()
-{
- return mLogLevel;
-}
-
-/*LCOV_EXCL_STOP*/
-} // namespace display_serer
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DSDEBUG_H_
-#define _DSDEBUG_H_
-
-#include <string>
-#include <mutex>
-
-namespace display_server
-{
-class DSDebugLog
-{
-public:
- enum Log_Level
- {
- LOG_LEVEL_DEBUG,
- LOG_LEVEL_INFO,
- LOG_LEVEL_WARN,
- LOG_LEVEL_ERR,
- };
-
-public:
- DSDebugLog(DSDebugLog &other) = delete; // should not be cloneable
- void operator=(const DSDebugLog &) = delete; // should not be assignable
-
- static DSDebugLog *GetInstance();
- void printLog(int logLevel, const char *domain, const char *funcName, int line, const char *fmt, ...);
- int getLogLevel();
-
-private:
- DSDebugLog(); // private constructor
- ~DSDebugLog(); // private desctructor
-
- static DSDebugLog *mInstance; // singleton instance
- static std::mutex mMutex; // mutex
- int mLogLevel; // current log level
- bool __enableDlog;
-};
-
-#define DSLOG_DBG(domain, fmt, args...) \
- do { \
- DSDebugLog *log = DSDebugLog::GetInstance(); \
- log->printLog(DSDebugLog::LOG_LEVEL_DEBUG, domain, __func__, __LINE__, fmt, \
- ##args); \
- } while (0)
-
-#define DSLOG_INF(domain, fmt, args...) \
- do { \
- DSDebugLog *log = DSDebugLog::GetInstance(); \
- log->printLog(DSDebugLog::LOG_LEVEL_INFO, domain, __func__, __LINE__, fmt, \
- ##args); \
- } while (0)
-
-#define DSLOG_WRN(domain, fmt, args...) \
- do { \
- DSDebugLog *log = DSDebugLog::GetInstance(); \
- log->printLog(DSDebugLog::LOG_LEVEL_WARN, domain, __func__, __LINE__, fmt, \
- ##args); \
- } while (0)
-
-#define DSLOG_ERR(domain, fmt, args...) \
- do { \
- DSDebugLog *log = DSDebugLog::GetInstance(); \
- log->printLog(DSDebugLog::LOG_LEVEL_ERR, domain, __func__, __LINE__, fmt, \
- ##args); \
- } while (0)
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSDisplayArea.h"
-#include "DSDisplayAreaPrivate.h"
-#include "DSOutputImpl.h"
-#include "DSRenderEngineEcoreEvasImpl.h"
-#include "DSRenderEngineDaliImpl.h"
-
-namespace display_server
-{
-
-DSDisplayArea::DSDisplayArea(std::shared_ptr<IDSOutput> output)
- : _d_ptr(std::make_unique<DSDisplayAreaPrivate>(this, output))
-{}
-
-DSDisplayArea::~DSDisplayArea()
-{}
-
-int DSDisplayArea::getWidth()
-{
- DS_GET_PRIV(DSDisplayArea);
-
- return priv->getWidth();
-}
-
-int DSDisplayArea::getHeight()
-{
- DS_GET_PRIV(DSDisplayArea);
-
- return priv->getHeight();
-}
-
-std::shared_ptr<IDSOutput> DSDisplayArea::getOutput()
-{
- DS_GET_PRIV(DSDisplayArea);
-
- return priv->getOutput();
-}
-
-DSDisplayAreaPrivate::DSDisplayAreaPrivate(DSDisplayArea *p_ptr, std::shared_ptr<IDSOutput> output)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __output(output),
- __displayDeviceOutput(nullptr),
- __displayDeviceHWC(nullptr),
- __zone(nullptr),
- __renderEngine(nullptr),
- __eventLoop(nullptr),
- __x(0),
- __y(0),
- __width(0),
- __height(0)
-{
- auto outputImpl = std::dynamic_pointer_cast<DSOutputImpl>(output); // down-casting of std::shared_ptr
-
- __displayDeviceOutput = outputImpl->getDisplayDeviceOutput();
- if (!__displayDeviceOutput)
- DSLOG_ERR("DSCanvasPrivate", "__displayDeviceOutput is null.");
-
- __displayDeviceHWC = __displayDeviceOutput->getHWC();
- if (!__displayDeviceHWC)
- DSLOG_ERR("DSCanvasPrivate", "__displayDeviceHWC is null.");
-
- auto bufferQueue = __displayDeviceHWC->getTargetBufferQueue();
- if (!bufferQueue)
- DSLOG_ERR("DSDisplayAreaPrivate", "bufferQueue is null.");
-
- __renderEngine = std::make_shared<DSRenderEngineDaliImpl>(bufferQueue);
- if (!__renderEngine)
- DSLOG_ERR("DSCanvasPrivate", "__RenderEngine is null.");
-
- __eventLoop = DSEventLoop::getInstance();
-
- // register idle enterer callback on __onEventIdleEnterer for rendereing and displaying
- __eventLoop->registerCallbackIdleEnterer(this, std::bind(&DSDisplayAreaPrivate::__onEventIdleEnterer, this, std::placeholders::_1));
-
- // The size of DSDisplayArea is the one of DSOutput
- __width = outputImpl->getResolutionWidth();
- __height = outputImpl->getResolutionHeight();
-}
-
-DSDisplayAreaPrivate::~DSDisplayAreaPrivate()
-{
- DSEventLoop::releaseInstance();
-}
-
-int DSDisplayAreaPrivate::getWidth()
-{
- if (__output == nullptr)
- return -1;
-
- return __width;
-}
-
-int DSDisplayAreaPrivate::getHeight()
-{
- if (__output == nullptr)
- return -1;
-
- return __height;
-}
-
-std::shared_ptr<IDSOutput> DSDisplayAreaPrivate::getOutput()
-{
- return __output;
-}
-
-bool DSDisplayAreaPrivate::addZone(std::shared_ptr<DSZone> zone)
-{
- __zone = zone;
- __zone->registerCallbackWindowCreated(this, std::bind(&DSDisplayAreaPrivate::__onWindowCreated, this, std::placeholders::_1));
-
- return true;
-}
-
-void DSDisplayAreaPrivate::__onWindowCreated(std::shared_ptr<DSWindow> window)
-{
- // make a render view and set to the window.
- auto renderView = __renderEngine->makeRenderView();
- window->setRenderView(renderView);
-
- // make a hwc window and set to the window.
- auto displayDeviceHWCWindow = __displayDeviceHWC->makeHWCWindow();
- window->setDisplayDeviceHWCWindow(displayDeviceHWCWindow);
-}
-
-void DSDisplayAreaPrivate::__onEventIdleEnterer(void *data)
-{
- //DSLOG_INF("DSDisplayAreaPrivate", "__onEventIdleEnterer");
-
- __displayDeviceHWC->commit();
- __renderEngine->renderFrame();
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_DISPLAY_AREA_H__
-#define __DS_DISPLAY_AREA_H__
-
-#include <DSCore.h>
-#include <DSObject.h>
-#include <IDSOutput.h>
-
-namespace display_server
-{
-class DSDisplayAreaPrivate;
-
-class DSDisplayArea : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSDisplayArea);
-public:
- explicit DSDisplayArea(std::shared_ptr<IDSOutput> output);
- virtual ~DSDisplayArea();
-
- int getWidth();
- int getHeight();
- std::shared_ptr<IDSOutput> getOutput();
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_DISPLAY_AREA_PRIVATE_H__
-#define __DS_DISPLAY_AREA_PRIVATE_H__
-
-#include "DSDisplayArea.h"
-#include "DSWindow.h"
-#include "DSZone.h"
-#include "IDSRenderEngine.h"
-#include <IDSOutput.h>
-#include "IDSDisplayDeviceOutput.h"
-#include "IDSDisplayDeviceHWC.h"
-#include "DSEventLoop.h"
-
-namespace display_server
-{
-
-class DSDisplayAreaPrivate : public DSObjectPrivate, public DSObject
-{
-DS_PIMPL_USE_PUBLIC(DSDisplayArea);
-public:
- DSDisplayAreaPrivate() = delete;
- DSDisplayAreaPrivate(DSDisplayArea *p_ptr, std::shared_ptr<IDSOutput> output);
- virtual ~DSDisplayAreaPrivate();
-
- static DSDisplayAreaPrivate *getPrivate(DSDisplayArea *q) { return q->__d_func(); }
- int getWidth();
- int getHeight();
-
- bool setOutput(std::shared_ptr<IDSOutput> output);
- std::shared_ptr<IDSOutput> getOutput();
- bool addZone(std::shared_ptr<DSZone> zone);
-
-private:
- void __onWindowCreated(std::shared_ptr<DSWindow> window);
- void __onEventIdleEnterer(void *data);
-
- std::shared_ptr<IDSOutput> __output;
- std::shared_ptr<IDSDisplayDeviceOutput> __displayDeviceOutput;
- std::shared_ptr<IDSDisplayDeviceHWC> __displayDeviceHWC;
- std::shared_ptr<DSZone> __zone;
- std::shared_ptr<IDSRenderEngine> __renderEngine;
- DSEventLoop *__eventLoop;
- int __x, __y;
- int __width, __height;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSDisplayDeviceHWCTDMImpl.h"
-#include "DSDisplayDeviceHWCWindowTDMImpl.h"
-#include "DSDisplayDeviceHWCWindowTDMTargetImpl.h"
-#include "DSDebugLog.h"
-#include <cstring>
-
-namespace display_server
-{
-
-DSDisplayDeviceHWCTDMImpl::DSDisplayDeviceHWCTDMImpl(tdm_hwc *thwc)
- : __thwc(thwc),
- __bufferQueue(nullptr)
-{}
-
-DSDisplayDeviceHWCTDMImpl::~DSDisplayDeviceHWCTDMImpl()
-{
- clearVisibleHWCWindows();
-}
-
-std::shared_ptr<IDSBufferQueue> DSDisplayDeviceHWCTDMImpl::getTargetBufferQueue()
-{
- tdm_error terror;
- tbm_surface_queue_h tqueue;
-
- if (__bufferQueue) {
- DSLOG_INF("TDM_HWC", "return the existed IDSBufferQueue.");
- return __bufferQueue;
- }
-
- tqueue = tdm_hwc_get_client_target_buffer_queue(__thwc, &terror);
- if (terror != TDM_ERROR_NONE) {
-/*LCOV_EXCL_START*/
- DSLOG_ERR("HWCTDM", "tdm_hwc_get_client_target_buffer_queue fails.");
-/*LCOV_EXCL_STOP*/
- }
-
- __bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(tqueue);
-
- __targetWindow = std::make_unique<DSDisplayDeviceHWCWindowTDMTargetImpl>(this, __bufferQueue);
-
- return __bufferQueue;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::setTargetBuffer(std::shared_ptr<IDSBuffer> buffer)
-{
- tdm_error terror;
- tdm_region fb_damage;
- std::memset(&fb_damage, 0, sizeof (tdm_region));
-
- terror = tdm_hwc_set_client_target_buffer(__thwc, (tbm_surface_h)buffer->getNativeBuffer(), fb_damage);
- if (terror != TDM_ERROR_NONE) {
-/*LCOV_EXCL_START*/
- DSLOG_ERR("TDM_HWC", "tdm_hwc_set_client_target_buffer fails.");
- return false;
-/*LCOV_EXCL_STOP*/
- }
-
- return true;
-}
-
-std::shared_ptr<IDSDisplayDeviceHWCWindow> DSDisplayDeviceHWCTDMImpl::makeHWCWindow()
-{
- std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow;
- tdm_error terror;
- tdm_hwc_window *twindow;
-
- twindow = tdm_hwc_create_window(__thwc, &terror);
- if (!twindow) {
-/*LCOV_EXCL_START*/
- DSLOG_ERR("HWCTDM", "tdm_hwc_create_window fails.");
- return nullptr;
-/*LCOV_EXCL_STOP*/
- }
-
- deviceHWCWindow = std::make_shared<DSDisplayDeviceHWCWindowTDMImpl>(twindow);
- if (!deviceHWCWindow) {
-/*LCOV_EXCL_START*/
- DSLOG_ERR("HWCTDM", "new DSDisplayDeviceHWCWindowTDMImpl fails.");
- return nullptr;
-/*LCOV_EXCL_STOP*/
- }
-
- return deviceHWCWindow;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::addVisibleHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow)
-{
- __visibleDeviceHWCWindowList.push_back(deviceHWCWindow);
-
- return true;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::removeVisibleHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow)
-{
- __visibleDeviceHWCWindowList.remove(deviceHWCWindow);
-
- return true;
-}
-
-void DSDisplayDeviceHWCTDMImpl::clearVisibleHWCWindows()
-{
- __visibleDeviceHWCWindowList.clear();
-}
-
-bool DSDisplayDeviceHWCTDMImpl::commit()
-{
- tdm_error terror;
- uint32_t numChanges;
-
- if (!__updateFrameWindows()) {
- //DSLOG_INF("HWCTDM", "no update windows.");
- return false;
- }
-
- if (!__validate(numChanges)) {
- DSLOG_ERR("HWCTDM", "__validate fails.");
- return false;
- }
-
- if (numChanges > 0) {
- if (!__updateChanges(numChanges)) {
- DSLOG_ERR("HWCTDM", "__updateChanges fails.");
- return false;
- }
- }
-
- if (!__acceptValidation()) {
- DSLOG_ERR("HWCTDM", "__acceptValidation fails.");
- return false;
- }
-
- if (!__presentFrameWindows()) {
- DSLOG_ERR("HWCTDM", "__presentFrameWindows fails.");
- return false;
- }
-
- //TODO: commit with async
- terror = tdm_hwc_commit(__thwc, true, NULL, NULL);
- if (terror != TDM_ERROR_NONE) {
-/*LCOV_EXCL_START*/
- DSLOG_ERR("HWCTDM", "tdm_hwc_commit fails.");
- __presentFrameDoneWindows();
- return false;
-/*LCOV_EXCL_STOP*/
- }
-
- DSLOG_INF("HWCTDM", "HWC COMMIT COMMIT COMMIT ~#######");
-
- __presentFrameDoneWindows();
-
- return true;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::__validate(uint32_t &numChanges)
-{
- int numVisibleHWCWins = __visibleDeviceHWCWindowList.size();
- tdm_error terror;
- tdm_hwc_window **thwc_windows;
- int i = 0;
-
- // get the thwc_windows to request validate.
- thwc_windows = (tdm_hwc_window **)calloc(numVisibleHWCWins, sizeof(tdm_hwc_window *));
- if (thwc_windows == nullptr) {
- DSLOG_ERR("TDM_HWC", "calloc thwc_windows fails.");
- return false;
- }
-
- for (auto &&deviceHWCWindow : __visibleDeviceHWCWindowList) {
- auto deviceHWCWindowTDM = std::dynamic_pointer_cast<DSDisplayDeviceHWCWindowTDMImpl>(deviceHWCWindow);
- thwc_windows[i++] = deviceHWCWindowTDM->getNativeHWCWindow();
- }
-
- // validate thwc_windows
- terror = tdm_hwc_validate(__thwc, thwc_windows, numVisibleHWCWins, &numChanges);
- if (terror != TDM_ERROR_NONE) {
-/*LCOV_EXCL_START*/
- DSLOG_ERR("TDM_HWC", "tdm_hwc_validate fails.");
- free(thwc_windows);
- return false;
-/*LCOV_EXCL_STOP*/
- }
-
- free(thwc_windows);
-
- return true;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::__updateChanges(uint32_t numChanges)
-{
- tdm_error terror;
- tdm_hwc_window **changed_thwc_window = NULL;
- tdm_hwc_window_composition *tcomposition_types = NULL;
- int i;
-
- changed_thwc_window = (tdm_hwc_window **)calloc(numChanges, sizeof(tdm_hwc_window *));
- if (changed_thwc_window == nullptr) {
- DSLOG_ERR("TDM_HWC", "calloc changed_thwc_window fails.");
- return false;
- }
-
- // get changed_types
- tcomposition_types = (tdm_hwc_window_composition *)calloc(numChanges, sizeof(tdm_hwc_window_composition));
- if (tcomposition_types == nullptr) {
- DSLOG_ERR("TDM_HWC", "calloc changed_thwc_window fails.");
- free(changed_thwc_window);
- return false;
- }
-
- terror = tdm_hwc_get_changed_composition_types(__thwc, &numChanges, changed_thwc_window, tcomposition_types);
- if (terror != TDM_ERROR_NONE) {
- DSLOG_ERR("TDM_HWC", "tdm_hwc_get_changed_composition_types fails.");
- free(tcomposition_types);
- free(changed_thwc_window);
- return false;
- }
-
- for (i = 0; i < (int)numChanges; ++i) {
- //TODO: change the TYPES of HWCWindows
- }
-
- free(tcomposition_types);
- free(changed_thwc_window);
-
- return true;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::__acceptValidation()
-{
- tdm_error terror;
-
- // TODO: accept_validation is depending on the transitions.
- terror = tdm_hwc_accept_validation(__thwc);
- if (terror != TDM_ERROR_NONE) {
-/*LCOV_EXCL_STOP*/
- DSLOG_ERR("TDM_HWC", "tdm_hwc_accept_validation fails.");
- return false;
-/*LCOV_EXCL_STOP*/
- }
-
- return true;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::__updateFrameWindows()
-{
- if (!__targetWindow->updateFrame()) {
- return false;
- }
-
- return true;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::__presentFrameWindows()
-{
- __targetWindow->presentFrame();
-
- return true;
-}
-
-bool DSDisplayDeviceHWCTDMImpl::__presentFrameDoneWindows()
-{
- __targetWindow->onPresentFrameDone();
-
- return true;
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_DISPLAY_DEVICE_HWC_TDM_IMPL_H_
-#define _DS_DISPLAY_DEVICE_HWC_TDM_IMPL_H_
-
-#include "IDSDisplayDeviceHWC.h"
-#include "DSBufferQueueTBMImpl.h"
-#include <tdm.h>
-#include <list>
-
-namespace display_server
-{
-class DSDisplayDeviceHWCTDMImpl : public IDSDisplayDeviceHWC
-{
-public:
- DSDisplayDeviceHWCTDMImpl(tdm_hwc *thwc);
- ~DSDisplayDeviceHWCTDMImpl();
-
- std::shared_ptr<IDSBufferQueue> getTargetBufferQueue() override;
- bool setTargetBuffer(std::shared_ptr<IDSBuffer> buffer) override;
- std::shared_ptr<IDSDisplayDeviceHWCWindow> makeHWCWindow() override;
- bool addVisibleHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow) override;
- bool removeVisibleHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow) override;
- void clearVisibleHWCWindows() override;
- bool commit() override;
-
-private:
- tdm_hwc *__thwc;
- std::shared_ptr<DSBufferQueueTBMImpl> __bufferQueue;
- std::list<std::shared_ptr<IDSDisplayDeviceHWCWindow>> __visibleDeviceHWCWindowList;
- std::unique_ptr<IDSDisplayDeviceHWCWindow> __targetWindow;
-
-
- bool __validate(uint32_t &numChanges);
- bool __updateChanges(uint32_t numChanges);
- bool __acceptValidation();
- bool __updateFrameWindows();
- bool __presentFrameWindows();
- bool __presentFrameDoneWindows();
-};
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSDisplayDeviceHWCWindowTDMImpl.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-DSDisplayDeviceHWCWindowTDMImpl::DSDisplayDeviceHWCWindowTDMImpl(tdm_hwc_window *twindow)
- : __twindow(twindow)
-{}
-
-DSDisplayDeviceHWCWindowTDMImpl::~DSDisplayDeviceHWCWindowTDMImpl()
-{
- tdm_hwc_window_destroy(__twindow);
-}
-tdm_hwc_window *DSDisplayDeviceHWCWindowTDMImpl::getNativeHWCWindow()
-{
- return __twindow;
-}
-
-bool DSDisplayDeviceHWCWindowTDMImpl::updateFrame()
-{
- // temp always false update
- return false;
-}
-
-void DSDisplayDeviceHWCWindowTDMImpl::presentFrame()
-{
- /* TODO:: */
-}
-
-void DSDisplayDeviceHWCWindowTDMImpl::onPresentFrameDone()
-{
- /* TODO:: */
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _I_DS_DISPLAY_DEVICE_HWC_WINDOW_TDM_IMPL_H_
-#define _I_DS_DISPLAY_DEVICE_HWC_WINDOW_TDM_IMPL_H_
-
-#include "IDSDisplayDeviceHWCWindow.h"
-#include "DSWindow.h"
-#include "IDSBuffer.h"
-#include <tdm.h>
-
-namespace display_server
-{
-class DSDisplayDeviceHWCWindowTDMImpl : public IDSDisplayDeviceHWCWindow
-{
-public:
- DSDisplayDeviceHWCWindowTDMImpl(tdm_hwc_window *twindow);
- ~DSDisplayDeviceHWCWindowTDMImpl();
- tdm_hwc_window *getNativeHWCWindow();
-
- bool updateFrame() override;
- void presentFrame() override;
- void onPresentFrameDone() override;
-
-private:
- tdm_hwc_window *__twindow;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSDisplayDeviceHWCWindowTDMTargetImpl.h"
-#include "DSDebugLog.h"
-# include <sys/eventfd.h>
-
-namespace display_server
-{
-
-DSDisplayDeviceHWCWindowTDMTargetImpl::DSDisplayDeviceHWCWindowTDMTargetImpl(IDSDisplayDeviceHWC *deviceHWC, std::shared_ptr<IDSBufferQueue> bufferQueue)
- : __deviceHWC(deviceHWC),
- __bufferQueue(bufferQueue),
- __ecoreFdHandler(nullptr)
-{
- if (!ecore_init()) {
-/*LCOV_EXCL_START*/
- DSLOG_ERR("EventLoop", "ecore_init() fails.");
-/*LCOV_EXCL_STOP*/
- }
-
- __eventFd = eventfd(0, EFD_NONBLOCK);
- __ecoreFdHandler = ecore_main_fd_handler_add(__eventFd, ECORE_FD_READ, __onFdHandler, this, NULL, NULL);
- __bufferQueue->registerCallbackAcquirable(this, std::bind(&DSDisplayDeviceHWCWindowTDMTargetImpl::__onAcquirable, this, std::placeholders::_1));
-}
-
-DSDisplayDeviceHWCWindowTDMTargetImpl::~DSDisplayDeviceHWCWindowTDMTargetImpl()
-{
- ecore_main_fd_handler_del(__ecoreFdHandler);
- close(__eventFd);
-
- ecore_shutdown();
-}
-
-bool DSDisplayDeviceHWCWindowTDMTargetImpl::updateFrame()
-{
- std::shared_ptr<IDSBuffer> dsBuffer;
-
- if (!__bufferQueue->canAcquireBuffer(false)) {
- //DSLOG_INF("TDM_HWC", "no acquirable buffer.");
- return false;
- }
-
- dsBuffer = __bufferQueue->acquireBuffer();
- if (!dsBuffer) {
- DSLOG_ERR("TDM_HWC", "acquire buffer fails.");
- return false;
- }
-
- if (__buffer) {
- __bufferQueue->releaseBuffer(__buffer);
- __buffer = nullptr;
- }
-
- __buffer = dsBuffer;
- __deviceHWC->setTargetBuffer(__buffer);
-
- return true;
-}
-
-void DSDisplayDeviceHWCWindowTDMTargetImpl::presentFrame()
-{
- if (__buffer) {
- __presentBuffer = std::move(__buffer);
- }
-}
-
-void DSDisplayDeviceHWCWindowTDMTargetImpl::onPresentFrameDone()
-{
- if (__presentedBuffer)
- __bufferQueue->releaseBuffer(__presentedBuffer);
-
- __presentedBuffer = std::move(__presentBuffer);
-}
-
-Eina_Bool DSDisplayDeviceHWCWindowTDMTargetImpl::__onFdHandler(void *data, Ecore_Fd_Handler *hdlr)
-{
-/*LCOV_EXCL_START*/
- int len;
- int fd;
- char buffer[64];
-
- fd = ecore_main_fd_handler_fd_get(hdlr);
- if (fd < 0)
- return ECORE_CALLBACK_RENEW;
-
- len = read(fd, buffer, sizeof(buffer));
- if (len == -1)
- DSLOG_WRN("DSDisplayDeviceHWCWindowTDMTargetImpl", "failed to read buffer from event fd:%m");
-
- return ECORE_CALLBACK_RENEW;
-/*LCOV_EXCL_STOP*/
-}
-
-void DSDisplayDeviceHWCWindowTDMTargetImpl::__onAcquirable(void *data)
-{
- uint64_t value = 1;
- int ret;
-
- ret = write(__eventFd, &value, sizeof(value));
- if (ret == -1) {
-/*LCOV_EXCL_START*/
- DSLOG_WRN("DSDisplayDeviceHWCWindowTDMTargetImpl", "failed to write a value on event fd:%m");
-/*LCOV_EXCL_STOP*/
- }
-
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _I_DS_DISPLAY_DEVICE_HWC_WINDOW_TDM_TARGET_IMPL_H_
-#define _I_DS_DISPLAY_DEVICE_HWC_WINDOW_TDM_TARGET_IMPL_H_
-
-#include "IDSDisplayDeviceHWCWindow.h"
-#include "IDSDisplayDeviceHWC.h"
-#include "IDSBufferQueue.h"
-#include "IDSBuffer.h"
-#include <tdm.h>
-#include <Ecore.h>
-
-namespace display_server
-{
-class DSDisplayDeviceHWCWindowTDMTargetImpl : public IDSDisplayDeviceHWCWindow, public DSObject
-{
-public:
- DSDisplayDeviceHWCWindowTDMTargetImpl(IDSDisplayDeviceHWC *deviceHWC, std::shared_ptr<IDSBufferQueue> __bufferQueue);
- ~DSDisplayDeviceHWCWindowTDMTargetImpl();
-
- bool updateFrame() override;
- void presentFrame() override;
- void onPresentFrameDone() override;
-
-private:
- static Eina_Bool __onFdHandler(void *data, Ecore_Fd_Handler *hdlr);
- void __onAcquirable(void *data);
-
- IDSDisplayDeviceHWC *__deviceHWC;
- std::shared_ptr<IDSBufferQueue> __bufferQueue;
- std::shared_ptr<IDSBuffer> __buffer;
- std::shared_ptr<IDSBuffer> __presentBuffer;
- std::shared_ptr<IDSBuffer> __presentedBuffer;
- int __eventFd;
- Ecore_Fd_Handler *__ecoreFdHandler;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSDisplayDeviceOutputModeTDMImpl.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-DSDisplayDeviceOutputModeTDMImpl::DSDisplayDeviceOutputModeTDMImpl(const tdm_output_mode *tmode)
- : __tmode{tmode}
-{}
-
-DSDisplayDeviceOutputModeTDMImpl::~DSDisplayDeviceOutputModeTDMImpl()
-{}
-
-unsigned int DSDisplayDeviceOutputModeTDMImpl::getRefreshRate()
-{
- return __tmode->vrefresh;
-}
-
-unsigned int DSDisplayDeviceOutputModeTDMImpl::getHorizontalSize()
-{
- return __tmode->hdisplay;
-}
-
-unsigned int DSDisplayDeviceOutputModeTDMImpl::getVertialSize()
-{
- return __tmode->vdisplay;
-}
-
-std::string DSDisplayDeviceOutputModeTDMImpl::getName()
-{
- std::string name(__tmode->name);
-
- return name;
-}
-
-const tdm_output_mode *DSDisplayDeviceOutputModeTDMImpl::getNative()
-{
- return __tmode;
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_DISPLAY_DEVICE_OUTPUT_MODE_TDM_IMPL_H__
-#define __DS_DISPLAY_DEVICE_OUTPUT_MODE_TDM_IMPL_H__
-
-#include "IDSDisplayDeviceOutputMode.h"
-#include <tdm.h>
-
-namespace display_server
-{
-
-class DSDisplayDeviceOutputModeTDMImpl : public IDSDisplayDeviceOutputMode
-{
-public:
- DSDisplayDeviceOutputModeTDMImpl(const tdm_output_mode *tmode);
- ~DSDisplayDeviceOutputModeTDMImpl();
-
- unsigned int getRefreshRate() override;
- unsigned int getHorizontalSize() override;
- unsigned int getVertialSize() override;
- std::string getName() override;
-
- const tdm_output_mode *getNative();
-
-private:
- const tdm_output_mode *__tmode;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSDisplayDeviceOutputTDMImpl.h"
-#include "DSDisplayDeviceHWCTDMImpl.h"
-#include "DSDisplayDeviceOutputModeTDMImpl.h"
-#include "DSDebugLog.h"
-#include <cstring>
-
-namespace display_server
-{
-
-DSDisplayDeviceOutputTDMImpl::DSDisplayDeviceOutputTDMImpl()
- : __toutput(nullptr),
- __resolutionWidth(0),
- __resolutionHeight(0),
- __physicalMMWidth(0),
- __physicalMMHeight(0),
- __refreshRate(0),
- __outputMode(nullptr),
- __dpmsMode(IDSDisplayDeviceOutput::DPMS_OFF),
- __displayDeviceHWC(nullptr)
-{
- __initializeConnectorType();
- __updateConnectState();
-}
-
-DSDisplayDeviceOutputTDMImpl::DSDisplayDeviceOutputTDMImpl(tdm_output *toutput)
- : __toutput(toutput),
- __resolutionWidth(0),
- __resolutionHeight(0),
- __physicalMMWidth(0),
- __physicalMMHeight(0),
- __refreshRate(0),
- __outputMode(nullptr),
- __dpmsMode(IDSDisplayDeviceOutput::DPMS_OFF),
- __displayDeviceHWC(nullptr)
-{
- tdm_error terror;
- tdm_hwc *thwc;
-
- __initializeConnectorType();
- __updateConnectState();
- if (__connectState != IDSDisplayDeviceOutput::STATE_DISCONNECTED) {
- __updatePhysicalMMSize();
- __updateAvailableModeList();
- }
-
- thwc = tdm_output_get_hwc(toutput, &terror);
- if (thwc) {
- __displayDeviceHWC = std::make_shared<DSDisplayDeviceHWCTDMImpl>(thwc);
- } else {
- //TODO: need fallback for HWC
- DSLOG_WRN("TDM OUTPUT", "tdm_output_get_hwc fails.");
- }
-}
-
-DSDisplayDeviceOutputTDMImpl::~DSDisplayDeviceOutputTDMImpl()
-{
- __deleteAvailableModeList();
-}
-
-IDSDisplayDeviceOutput::ConnectorType DSDisplayDeviceOutputTDMImpl::getConnectType()
-{
- return __connectorType;
-}
-
-IDSDisplayDeviceOutput::ConnectState DSDisplayDeviceOutputTDMImpl::getConnectState()
-{
- return __connectState;
-}
-
-std::list<std::shared_ptr<IDSDisplayDeviceOutputMode>> DSDisplayDeviceOutputTDMImpl::getAvailableModes()
-{
- return __availableModeList;
-}
-
-int DSDisplayDeviceOutputTDMImpl::getResolutionWidth()
-{
- return __resolutionWidth;
-}
-
-int DSDisplayDeviceOutputTDMImpl::getResolutionHeight()
-{
- return __resolutionHeight;
-}
-
-int DSDisplayDeviceOutputTDMImpl::getPhysicalMMWidth()
-{
- return __physicalMMWidth;
-}
-
-int DSDisplayDeviceOutputTDMImpl::getPhysicalMMHeight()
-{
- return __physicalMMHeight;
-}
-
-int DSDisplayDeviceOutputTDMImpl::getRefreshRate()
-{
- return __refreshRate;
-}
-
-std::string DSDisplayDeviceOutputTDMImpl::getName()
-{
- return __name;
-}
-
-bool DSDisplayDeviceOutputTDMImpl::setMode(std::shared_ptr<IDSDisplayDeviceOutputMode> outputMode)
-{
- tdm_error terror;
- auto outputModeTDM = std::dynamic_pointer_cast<DSDisplayDeviceOutputModeTDMImpl>(outputMode); // down-casting of std::shared_ptr
- const tdm_output_mode *ttmode = outputModeTDM->getNative();
-
- terror = tdm_output_set_mode(__toutput, ttmode);
- if (terror != TDM_ERROR_NONE) {
- DSLOG_ERR("TDM OUTPUT", "tdm_output_set_mode fails.");
- return false;
- }
-
- __outputMode = outputMode;
- __resolutionWidth = __outputMode->getHorizontalSize();
- __resolutionHeight = __outputMode->getVertialSize();
- __refreshRate = __outputMode->getRefreshRate();
- __name = __outputMode->getName();
-
- return true;
-}
-
-std::shared_ptr<IDSDisplayDeviceOutputMode> DSDisplayDeviceOutputTDMImpl::getMode()
-{
- return __outputMode;
-}
-
-bool DSDisplayDeviceOutputTDMImpl::setDPMSMode(DPMSMode dpmsMode)
-{
- return false;
-}
-
-IDSDisplayDeviceOutput::DPMSMode DSDisplayDeviceOutputTDMImpl::getDPMSMode()
-{
- return __dpmsMode;
-}
-
-std::shared_ptr<IDSDisplayDeviceHWC> DSDisplayDeviceOutputTDMImpl::getHWC()
-{
- return __displayDeviceHWC;
-}
-
-void DSDisplayDeviceOutputTDMImpl::__initializeConnectorType()
-{
- tdm_error terror;
- tdm_output_type ttype;
-
- terror = tdm_output_get_output_type(__toutput, &ttype);
- if (terror != TDM_ERROR_NONE) {
- DSLOG_ERR("TDM OUTPUT", "tdm_output_get_output_type fails.");
- return;
- }
-
- if (ttype == TDM_OUTPUT_TYPE_Unknown)
- __connectorType = IDSDisplayDeviceOutput::TYPE_UNKNOWN;
- else if (ttype == TDM_OUTPUT_TYPE_VGA)
- __connectorType = IDSDisplayDeviceOutput::TYPE_VGA;
- else if (ttype == TDM_OUTPUT_TYPE_DVII)
- __connectorType = IDSDisplayDeviceOutput::TYPE_DVII;
- if (ttype == TDM_OUTPUT_TYPE_DVID)
- __connectorType = IDSDisplayDeviceOutput::TYPE_DVID;
- if (ttype == TDM_OUTPUT_TYPE_DVIA)
- __connectorType = IDSDisplayDeviceOutput::TYPE_DVIA;
- if (ttype == TDM_OUTPUT_TYPE_Composite)
- __connectorType = IDSDisplayDeviceOutput::TYPE_COMPOSITE;
- if (ttype == TDM_OUTPUT_TYPE_SVIDEO)
- __connectorType = IDSDisplayDeviceOutput::TYPE_SVIDEO;
- if (ttype == TDM_OUTPUT_TYPE_LVDS)
- __connectorType = IDSDisplayDeviceOutput::TYPE_LVDS;
- if (ttype == TDM_OUTPUT_TYPE_Component)
- __connectorType = IDSDisplayDeviceOutput::TYPE_COMPONENT;
- if (ttype == TDM_OUTPUT_TYPE_9PinDIN)
- __connectorType = IDSDisplayDeviceOutput::TYPE_9PinDIN;
- if (ttype == TDM_OUTPUT_TYPE_DisplayPort)
- __connectorType = IDSDisplayDeviceOutput::TYPE_DISPLAYPORT;
- if (ttype == TDM_OUTPUT_TYPE_HDMIA)
- __connectorType = IDSDisplayDeviceOutput::TYPE_HDMIA;
- if (ttype == TDM_OUTPUT_TYPE_HDMIB)
- __connectorType = IDSDisplayDeviceOutput::TYPE_HDMIB;
- if (ttype == TDM_OUTPUT_TYPE_TV)
- __connectorType = IDSDisplayDeviceOutput::TYPE_TV;
- if (ttype == TDM_OUTPUT_TYPE_eDP)
- __connectorType = IDSDisplayDeviceOutput::TYPE_EDP;
- if (ttype == TDM_OUTPUT_TYPE_VIRTUAL)
- __connectorType = IDSDisplayDeviceOutput::TYPE_VIRTUAL;
- if (ttype == TDM_OUTPUT_TYPE_DSI)
- __connectorType = IDSDisplayDeviceOutput::TYPE_DSI;
- else
- __connectorType = IDSDisplayDeviceOutput::TYPE_UNKNOWN;
-}
-
-void DSDisplayDeviceOutputTDMImpl::__updateConnectState()
-{
- tdm_error terror;
- tdm_output_conn_status tstatus;
-
- terror = tdm_output_get_conn_status(__toutput, &tstatus);
- if (terror != TDM_ERROR_NONE) {
- DSLOG_ERR("TDM OUTPUT", "tdm_output_get_conn_status fails.");
- return;
- }
-
- if (tstatus == TDM_OUTPUT_CONN_STATUS_DISCONNECTED)
- __connectState = IDSDisplayDeviceOutput::STATE_DISCONNECTED;
- else if (tstatus == TDM_OUTPUT_CONN_STATUS_CONNECTED)
- __connectState = IDSDisplayDeviceOutput::STATE_CONNECTED;
- else if (tstatus == TDM_OUTPUT_CONN_STATUS_MODE_SETTED)
- __connectState = IDSDisplayDeviceOutput::STATE_MODESET;
- else
- __connectState = IDSDisplayDeviceOutput::STATE_NONE;
-}
-
-
-void DSDisplayDeviceOutputTDMImpl::__updatePhysicalMMSize()
-{
- tdm_error terror;
-
- terror = tdm_output_get_physical_size(__toutput, &__physicalMMWidth, &__physicalMMHeight);
- if (terror != TDM_ERROR_NONE) {
- DSLOG_ERR("TDM OUTPUT", "tdm_output_get_physical_size fails.");
- __physicalMMWidth = 0;
- __physicalMMHeight = 0;
- }
-}
-
-void DSDisplayDeviceOutputTDMImpl::__deleteAvailableModeList()
-{
- __availableModeList.clear();
-}
-
-void DSDisplayDeviceOutputTDMImpl::__updateAvailableModeList()
-{
- tdm_error terror;
- const tdm_output_mode *tmodes, *tmode;
- int count = 0;
-
- // delete the existing availableModeList.
- __deleteAvailableModeList();
-
- terror = tdm_output_get_available_modes(__toutput, &tmodes, &count);
- if (terror != TDM_ERROR_NONE) {
- DSLOG_ERR("TDM OUTPUT", "tdm_output_get_available_modes fails.");
- return;
- }
-
- for (int i = 0; i < count; i++) {
- tmode = &tmodes[i];
- __availableModeList.push_back(std::make_shared<DSDisplayDeviceOutputModeTDMImpl>(tmode));
- }
-
- auto sortBestModeFunc = [](auto first, auto second) -> bool {
- unsigned int firstPrio = first->getRefreshRate() * first->getHorizontalSize() * first->getVertialSize();
- unsigned int secondPrio = second->getRefreshRate() * second->getHorizontalSize() * second->getVertialSize();
- return firstPrio < secondPrio;
- };
-
- __availableModeList.sort(sortBestModeFunc);
-}
-
-void DSDisplayDeviceOutputTDMImpl::registerCallbackOutputConnected(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func)
-{
- this->__connectedSignal.connect(slot, func);
-}
-
-void DSDisplayDeviceOutputTDMImpl::registerCallbackOutputDisconnected(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func)
-{
- this->__disconnectedSignal.connect(slot, func);
-}
-
-void DSDisplayDeviceOutputTDMImpl::registerCallbackOutputResolutionSet(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func)
-{
- this->__resolutionSetSignal.connect(slot, func);
-}
-
-void DSDisplayDeviceOutputTDMImpl::callCallbackOutputConnected()
-{
- this->__connectedSignal.emit(shared_from_this());
-}
-
-void DSDisplayDeviceOutputTDMImpl::callCallbackOutputDisconnected()
-{
- this->__disconnectedSignal.emit(shared_from_this());
-}
-
-void DSDisplayDeviceOutputTDMImpl::callCallbackOutputResolutionSet()
-{
- this->__resolutionSetSignal.emit(shared_from_this());
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _I_DS_DISPLAY_DEVICE_OUTPUT_TDM_IMPL_H_
-#define _I_DS_DISPLAY_DEVICE_OUTPUT_TDM_IMPL_H_
-
-#include "IDSDisplayDeviceOutput.h"
-#include "IDSDisplayDeviceHWC.h"
-#include "DSSignal.h"
-#include <tdm.h>
-
-namespace display_server
-{
-class DSDisplayDeviceOutputTDMImpl : public IDSDisplayDeviceOutput, public std::enable_shared_from_this<DSDisplayDeviceOutputTDMImpl>
-{
-public:
- DSDisplayDeviceOutputTDMImpl();
- DSDisplayDeviceOutputTDMImpl(tdm_output *toutput);
- ~DSDisplayDeviceOutputTDMImpl();
-
- IDSDisplayDeviceOutput::ConnectorType getConnectType() override;
- IDSDisplayDeviceOutput::ConnectState getConnectState() override;
-
- int getResolutionWidth() override;
- int getResolutionHeight() override;
- int getPhysicalMMWidth() override;
- int getPhysicalMMHeight() override;
- int getRefreshRate() override;
- std::string getName() override;
-
- std::list<std::shared_ptr<IDSDisplayDeviceOutputMode>> getAvailableModes() override;
- bool setMode(std::shared_ptr<IDSDisplayDeviceOutputMode> outputMode) override;
- std::shared_ptr<IDSDisplayDeviceOutputMode> getMode() override;
-
- bool setDPMSMode(IDSDisplayDeviceOutput::DPMSMode dpmsMode) override;
- DPMSMode getDPMSMode() override;
-
- std::shared_ptr<IDSDisplayDeviceHWC> getHWC() override;
-
- // register callback functions
- void registerCallbackOutputConnected(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) override;
- void registerCallbackOutputDisconnected(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) override;
- void registerCallbackOutputResolutionSet(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) override;
-
- // emit functions
- void callCallbackOutputConnected();
- void callCallbackOutputDisconnected();
- void callCallbackOutputResolutionSet();
-
-private:
- void __initializeConnectorType();
- void __updateConnectState();
- void __updatePhysicalMMSize();
- void __deleteAvailableModeList();
- void __updateAvailableModeList();
-
- tdm_output *__toutput;
-
- IDSDisplayDeviceOutput::ConnectState __connectState;
- IDSDisplayDeviceOutput::ConnectorType __connectorType;
- std::list<std::shared_ptr<IDSDisplayDeviceOutputMode>> __availableModeList;
- unsigned int __resolutionWidth, __resolutionHeight;
- unsigned int __physicalMMWidth, __physicalMMHeight;
- unsigned int __refreshRate;
- std::string __name;
- std::shared_ptr<IDSDisplayDeviceOutputMode> __outputMode;
- IDSDisplayDeviceOutput::DPMSMode __dpmsMode;
-
- std::shared_ptr<IDSDisplayDeviceHWC> __displayDeviceHWC;
-
- // signals
- DSSignal<std::shared_ptr<IDSDisplayDeviceOutput>> __connectedSignal;
- DSSignal<std::shared_ptr<IDSDisplayDeviceOutput>> __disconnectedSignal;
- DSSignal<std::shared_ptr<IDSDisplayDeviceOutput>> __resolutionSetSignal;
-};
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSDisplayDeviceTDMImpl.h"
-#include "DSDisplayDeviceOutputTDMImpl.h"
-#include "DSDisplayDeviceHWCTDMImpl.h"
-#include "DSDebugLog.h"
-#include "DSUtilSocket.h"
-
-namespace display_server
-{
-
-DSDisplayDeviceTDMImpl::DSDisplayDeviceTDMImpl()
- : __numOutputs(0)
-{
- tdm_error terror;
- tdm_output *toutput;
-
- __tdisplay = tdm_display_init(&terror);
- if (terror != TDM_ERROR_NONE) {
- DSLOG_ERR("TDM DEVICE", "tdm_display_init fails.");
- }
-
- terror = tdm_display_get_output_count(__tdisplay, &__numOutputs);
- if (__numOutputs <= 0) {
- DSLOG_ERR("TDM DEVICE", "tdm_display_get_output_count fails.");
- return;
- }
-
- for (int i = 0; i < __numOutputs; ++i) {
- toutput = tdm_display_get_output(__tdisplay, i, &terror);
- if (terror != TDM_ERROR_NONE) {
- DSLOG_ERR("TDM DEVICE", "tdm_display_get_output fails.(output num: %d)", i);
- return;
- }
-
- __outputList.emplace_back(std::make_shared<DSDisplayDeviceOutputTDMImpl>(toutput));
- }
-
- DSUtilSocket *utilSocket = DSUtilSocket::getInstance();
- utilSocket->initSocket("tdm-socket");
- utilSocket->releaseInstance();
-}
-
-DSDisplayDeviceTDMImpl::~DSDisplayDeviceTDMImpl()
-{
- // Clear the visible hwc windows before tdm_display_deinit.
- // Otherwise, the process will block inside libtdm
- // when it calls tdm_hwc_window_destroy() function at ~DSDisplayDeviceHWCWindowTDMImpl()
- // because the mutex_lock(private_display->lock) is destroyed at tdm_display_deinit().
- for (auto displayDeviceOutput: __outputList) {
- std::shared_ptr<IDSDisplayDeviceHWC> displayDeviceHWC = displayDeviceOutput->getHWC();
- if (displayDeviceHWC) {
- displayDeviceHWC->clearVisibleHWCWindows();
- }
- }
-
- tdm_display_deinit(__tdisplay);
-}
-
-std::list<std::shared_ptr<IDSDisplayDeviceOutput>> DSDisplayDeviceTDMImpl::getOutputList()
-{
- return __outputList;
-}
-
-void DSDisplayDeviceTDMImpl::registerCallbackOutputAdded(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func)
-{
- this->__outputAddedSignal.connect(slot, func);
-}
-
-void DSDisplayDeviceTDMImpl::registerCallbackOutputRemoved(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func)
-{
- this->__outputRemovedSignal.connect(slot, func);
-}
-
-void DSDisplayDeviceTDMImpl::callCallbackOutputAdded()
-{
- //TODO: create the new IDSDisplayDeviceOutput instance and put the parameter of the emit function.
- this->__outputAddedSignal.emit(nullptr);
-}
-
-void DSDisplayDeviceTDMImpl::callCallbackOutputRemoved()
-{
- //TODO: create the new IDSDisplayDeviceOutput instance and put the parameter of the emit function.
- this->__outputRemovedSignal.emit(nullptr);
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_DISPLAY_DEVICE_TDM_IMPL_H_
-#define _DS_DISPLAY_DEVICE_TDM_IMPL_H_
-
-#include "IDSDisplayDevice.h"
-#include "DSSignal.h"
-#include <tdm.h>
-
-namespace display_server
-{
-
-class DSDisplayDeviceTDMImpl : public IDSDisplayDevice
-{
-public:
- DSDisplayDeviceTDMImpl();
- ~DSDisplayDeviceTDMImpl();
-
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> getOutputList() override;
-
- // register callback functions
- void registerCallbackOutputAdded(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) override;
- void registerCallbackOutputRemoved(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) override;
-
- // emit functions
- void callCallbackOutputAdded();
- void callCallbackOutputRemoved();
-
-private:
- tdm_display *__tdisplay;
- int __numOutputs;
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> __outputList;
-
- // signals
- DSSignal<std::shared_ptr<IDSDisplayDeviceOutput>> __outputAddedSignal;
- DSSignal<std::shared_ptr<IDSDisplayDeviceOutput>> __outputRemovedSignal;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _I_DS_DISPLAY_DEVICE_H_
-#define _I_DS_DISPLAY_DEVICE_H_
-
-#include "DSObject.h"
-#include "IDSDisplayDeviceOutput.h"
-#include <list>
-
-namespace display_server
-{
-class IDSDisplayDevice : public DSObject
-{
-public:
- virtual ~IDSDisplayDevice() = default;
-
- virtual std::list<std::shared_ptr<IDSDisplayDeviceOutput>> getOutputList() = 0;
- virtual void registerCallbackOutputAdded(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) = 0;
- virtual void registerCallbackOutputRemoved(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) = 0;
-};
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _I_DS_DISPLAY_DEVICE_HWC_H_
-#define _I_DS_DISPLAY_DEVICE_HWC_H_
-
-#include "IDSDisplayDeviceHWCWindow.h"
-#include "IDSBufferQueue.h"
-
-namespace display_server
-{
-
-class DSWindow;
-
-class IDSDisplayDeviceHWC
-{
-public:
- virtual ~IDSDisplayDeviceHWC() = default;
-
- virtual std::shared_ptr<IDSBufferQueue> getTargetBufferQueue() = 0;
- virtual bool setTargetBuffer(std::shared_ptr<IDSBuffer> buffer) = 0;
- virtual std::shared_ptr<IDSDisplayDeviceHWCWindow> makeHWCWindow() = 0;
- virtual bool addVisibleHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow) = 0;
- virtual bool removeVisibleHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow) = 0;
- virtual void clearVisibleHWCWindows() = 0;
- virtual bool commit() = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _I_DS_DISPLAY_DEVICE_HWC_WINDOW_H_
-#define _I_DS_DISPLAY_DEVICE_HWC_WINDOW_H_
-
-namespace display_server
-{
-class IDSDisplayDeviceHWCWindow
-{
-public:
- virtual ~IDSDisplayDeviceHWCWindow() = default;
- virtual bool updateFrame() = 0;
- virtual void presentFrame() = 0;
- virtual void onPresentFrameDone() = 0;
-};
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _I_DS_DISPLAY_DEVICE_OUTPUT_H_
-#define _I_DS_DISPLAY_DEVICE_OUTPUT_H_
-
-#include "DSObject.h"
-#include "IDSDisplayDeviceHWC.h"
-#include "IDSDisplayDeviceOutputMode.h"
-#include <list>
-#include <string>
-#include <functional>
-
-#define NAME_LEN 64
-
-namespace display_server
-{
-
-class IDSDisplayDeviceOutput : public DSObject
-{
-public:
- enum ConnectState {
- STATE_NONE,
- STATE_DISCONNECTED,
- STATE_CONNECTED,
- STATE_MODESET
- };
- enum ConnectorType {
- TYPE_UNKNOWN, /**< unknown */
- TYPE_VGA, /**< VGA connection */
- TYPE_DVII, /**< DVII connection */
- TYPE_DVID, /**< DVID connection */
- TYPE_DVIA, /**< DVIA connection */
- TYPE_COMPOSITE, /**< Composite connection */
- TYPE_SVIDEO, /**< SVIDEO connection */
- TYPE_LVDS, /**< LVDS connection */
- TYPE_COMPONENT, /**< Component connection */
- TYPE_9PinDIN, /**< 9PinDIN connection */
- TYPE_DISPLAYPORT, /**< DisplayPort connection */
- TYPE_HDMIA, /**< HDMIA connection */
- TYPE_HDMIB, /**< HDMIB connection */
- TYPE_TV, /**< TV connection */
- TYPE_EDP, /**< eDP connection */
- TYPE_VIRTUAL, /**< Virtual connection for WiFi Display */
- TYPE_DSI /**< DSI connection */
- };
- enum DPMSMode {
- DPMS_ON,
- DPMS_STANDBY,
- DPMS_SUSPEND,
- DPMS_OFF
- };
-
-public:
- virtual ~IDSDisplayDeviceOutput() = default;
-
- virtual ConnectorType getConnectType() = 0;
- virtual ConnectState getConnectState() = 0;
-
- virtual int getResolutionWidth() = 0;
- virtual int getResolutionHeight() = 0;
- virtual int getPhysicalMMWidth() = 0;
- virtual int getPhysicalMMHeight() = 0;
- virtual int getRefreshRate() = 0;
- virtual std::string getName() = 0;
-
- virtual std::list<std::shared_ptr<IDSDisplayDeviceOutputMode>> getAvailableModes() = 0;
- virtual bool setMode(std::shared_ptr<IDSDisplayDeviceOutputMode> outputMode) = 0;
- virtual std::shared_ptr<IDSDisplayDeviceOutputMode> getMode() = 0;
-
- virtual bool setDPMSMode(DPMSMode dpmsMode) = 0;
- virtual DPMSMode getDPMSMode() = 0;
-
- virtual std::shared_ptr<IDSDisplayDeviceHWC> getHWC() = 0;
-
- // Callback methods
- virtual void registerCallbackOutputConnected(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) = 0;
- virtual void registerCallbackOutputDisconnected(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) = 0;
- virtual void registerCallbackOutputResolutionSet(DSObject *slot, std::function<void(std::shared_ptr<IDSDisplayDeviceOutput>)> func) = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __I_DS_DISPLAY_DEVICE_OUTPUT_MODE_H__
-#define __I_DS_DISPLAY_DEVICE_OUTPUT_MODE_H__
-
-#include <string>
-
-namespace display_server
-{
-
-class IDSDisplayDeviceOutputMode
-{
-public:
- virtual ~IDSDisplayDeviceOutputMode() = default;
-
- virtual unsigned int getRefreshRate() = 0;
- virtual unsigned int getHorizontalSize() = 0;
- virtual unsigned int getVertialSize() = 0;
- virtual std::string getName() = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSEventLoop.h"
-#include "DSDebugLog.h"
-#include <Ecore.h>
-
-namespace display_server
-{
-
-DSEventLoop *DSEventLoop::__instance { nullptr };
-std::mutex DSEventLoop::__mutex;
-int DSEventLoop::__refCount { 0 };
-Ecore_Idle_Enterer *DSEventLoop::__ecoreIdleEnterer { nullptr };
-DSSignal<void *> DSEventLoop::__idleEntererSignal;
-
-DSEventLoop::DSEventLoop()
- : __running(false)
-{
- if (!ecore_init()) {
- DSLOG_ERR("EventLoop", "ecore_init() fails.");
- }
-}
-
-DSEventLoop::~DSEventLoop()
-{
- if (__ecoreIdleEnterer)
- ecore_idle_enterer_del(__ecoreIdleEnterer);
-
- ecore_shutdown();
-}
-
-DSEventLoop *DSEventLoop::getInstance()
-{
- std::lock_guard<std::mutex> lock(__mutex);
-
- if (!__instance) {
- __instance = new DSEventLoop();
- if (!__instance) {
- DSLOG_ERR("DSEventLoop", "new DSEventLoop() fails.");
- return nullptr;
- }
- DSLOG_INF("DSEventLoop", "DSEventLoop instance has been created !");
-
- __ecoreIdleEnterer = ecore_idle_enterer_add(&DSEventLoop::__emitIdleEntererFuncs, nullptr);
- if (!__ecoreIdleEnterer)
- DSLOG_ERR("DSEventLoop", "ecore_idle_enterer_add() fails.");
- }
-
- ++__refCount;
-
- return __instance;
-}
-
-void DSEventLoop::releaseInstance()
-{
- std::lock_guard<std::mutex> lock(__mutex);
-
- --__refCount;
- DSLOG_INF("DSEventLoop", "__refCount=%d", __refCount);
- if (__refCount <= 0) {
- delete __instance;
- __instance = nullptr;
- __ecoreIdleEnterer = nullptr;
- DSLOG_INF("DSEventLoop", "DSEventLoop instance has been removed !");
- }
-}
-
-bool DSEventLoop::isRunning()
-{
- return __running;
-}
-
-bool DSEventLoop::run()
-{
- if (__running)
- return true;
-
- __running = true;
- ecore_main_loop_begin();
- __running = false;
-
- return true;
-}
-
-bool DSEventLoop::quit()
-{
- if (!__running) {
- return false;
- }
-
- ecore_main_loop_quit();
-
- return true;
-}
-
-void DSEventLoop::registerCallbackIdleEnterer(DSObject *slot, std::function<void(void *data)> func)
-{
- __idleEntererSignal.connect(slot, func);
-}
-
-Eina_Bool DSEventLoop::__emitIdleEntererFuncs(void *data)
-{
- __idleEntererSignal.emit(data);
-
- return EINA_TRUE;
-}
-
-// for test cases only
-Eina_Bool DSEventLoop::testEmitIdleEntererFuncs(void *data)
-{
- __idleEntererSignal.emit(data);
-
- return EINA_TRUE;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_EVENT_LOOP_H__
-#define __DS_EVENT_LOOP_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSSignal.h"
-#include <Ecore.h>
-#include <mutex>
-
-namespace display_server
-{
-
-class DSEventLoop : public DSObject
-{
-public:
- static DSEventLoop *getInstance();
- static void releaseInstance();
-
- bool run();
- bool quit();
-
- bool isRunning();
-
- // register callback functions
- void registerCallbackIdleEnterer(DSObject *slot, std::function<void(void *data)> func);
-
- static Eina_Bool testEmitIdleEntererFuncs(void *data); // for test cases only
-
-private:
- DSEventLoop(); // private constructor
- ~DSEventLoop(); // private desctructor
- DSEventLoop(DSEventLoop &other) = delete; // should not be cloneable
- void operator=(const DSEventLoop &) = delete; // should not be assignable
-
- static Eina_Bool __emitIdleEntererFuncs(void *data); // emit functions which registered at registerCallbackIdleEnterer
-
- static DSEventLoop *__instance; // singleton instance
- static std::mutex __mutex; // mutex
- static int __refCount;
-
- bool __running;
-
- static Ecore_Idle_Enterer *__ecoreIdleEnterer;
- static DSSignal<void *> __idleEntererSignal;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSInput.h"
-#include "DSInputPrivate.h"
-#include "DSSeat.h"
-#include "DSInputEvent.h"
-#include "DSXkb.h"
-
-namespace display_server
-{
-
-DSInputPrivate::DSInputPrivate(DSInput * p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __dsLibinput(nullptr)
-{
-}
-
-DSInputPrivate::~DSInputPrivate()
-{
- if (__dsLibinput)
- delete __dsLibinput;
-}
-
-void DSInputPrivate::Init()
-{
- __dsLibinput = new DSLibinput(this);
- DS_ASSERT(__dsLibinput != nullptr);
-}
-
-void DSInputPrivate::PostDeviceAddEvent(std::string seat, std::string name, std::string identifier, DSInput::DeviceClass devClass)
-{
- DS_GET_PUB(DSInput);
-
- pub->deviceAdd(name, identifier, devClass, DSInput::NoneSubclass);
-}
-
-void DSInputPrivate::PostDeviceRemoveEvent(std::string seat, std::string name, std::string identifier, DSInput::DeviceClass devClass)
-{
- DS_GET_PUB(DSInput);
-
- pub->deviceRemove(name, identifier, devClass, DSInput::NoneSubclass);
-}
-
-/*LCOV_EXCL_START*/
-void DSInputPrivate::PostKeyboardEvent(int keycode, bool pressed, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DS_GET_PUB(DSInput);
-
- if (pressed)
- pub->keyDown(keycode, devIdentifier, devClass, timestamp);
- else
- pub->keyUp(keycode, devIdentifier, devClass, timestamp);
-}
-
-void DSInputPrivate::PostPointerEvent(int button, int x, int y, int z, DSInputEvent::Type type, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DS_GET_PUB(DSInput);
-
- if (type == DSInputEvent::MouseDownEvent)
- pub->mouseDown(button, x, y, z, devIdentifier, devClass, timestamp);
- else if (type == DSInputEvent::MouseMoveEvent)
- pub->mouseMove(button, x, y, z, devIdentifier, devClass, timestamp);
- else if (type == DSInputEvent::MouseUpEvent)
- pub->mouseUp(button, x, y, z, devIdentifier, devClass, timestamp);
-}
-
-void DSInputPrivate::PostTouchEvent(int index, int x, int y, DSInputEvent::Type type, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DS_GET_PUB(DSInput);
-
- if (type == DSInputEvent::TouchDownEvent)
- pub->touchDown(index, x, y, devIdentifier, devClass, timestamp);
- else if (type == DSInputEvent::TouchMoveEvent)
- pub->touchMove(index, x, y, devIdentifier, devClass, timestamp);
- else if (type == DSInputEvent::TouchUpEvent)
- pub->touchUp(index, x, y, devIdentifier, devClass, timestamp);
-}
-/*LCOV_EXCL_STOP*/
-
-int DSInput::DS_INPUT_EVENT_KEY_DOWN = 0;
-int DSInput::DS_INPUT_EVENT_KEY_UP = 0;
-int DSInput::DS_INPUT_EVENT_MOUSE_DOWN = 0;
-int DSInput::DS_INPUT_EVENT_MOUSE_MOVE = 0;
-int DSInput::DS_INPUT_EVENT_MOUSE_UP = 0;
-int DSInput::DS_INPUT_EVENT_TOUCH_DOWN = 0;
-int DSInput::DS_INPUT_EVENT_TOUCH_MOVE = 0;
-int DSInput::DS_INPUT_EVENT_TOUCH_UP = 0;
-
-void DSInput::__initiaiize_ecore_event_types()
-{
- if (!DS_INPUT_EVENT_KEY_DOWN)
- DS_INPUT_EVENT_KEY_DOWN = ecore_event_type_new();
- if (!DS_INPUT_EVENT_KEY_UP)
- DS_INPUT_EVENT_KEY_UP = ecore_event_type_new();
- if (!DS_INPUT_EVENT_MOUSE_DOWN)
- DS_INPUT_EVENT_MOUSE_DOWN = ecore_event_type_new();
- if (!DS_INPUT_EVENT_MOUSE_MOVE)
- DS_INPUT_EVENT_MOUSE_MOVE = ecore_event_type_new();
- if (!DS_INPUT_EVENT_MOUSE_UP)
- DS_INPUT_EVENT_MOUSE_UP = ecore_event_type_new();
- if (!DS_INPUT_EVENT_TOUCH_DOWN)
- DS_INPUT_EVENT_TOUCH_DOWN = ecore_event_type_new();
- if (!DS_INPUT_EVENT_TOUCH_MOVE)
- DS_INPUT_EVENT_TOUCH_MOVE = ecore_event_type_new();
- if (!DS_INPUT_EVENT_TOUCH_UP)
- DS_INPUT_EVENT_TOUCH_UP = ecore_event_type_new();
-}
-
-DSInput::DSInput()
- : DS_INIT_PRIVATE_PTR(DSInput),
- __seat(nullptr),
- __xkb(nullptr)
-{
- __initiaiize_ecore_event_types();
-}
-
-DSInput::DSInput(DSSeat *seat)
- : DS_INIT_PRIVATE_PTR(DSInput),
- __seat(seat),
- __xkb(nullptr)
-{
- if (seat == nullptr)
- {
- DSLOG_ERR("DSInput", "DSSeat ptr is required.");
- return;
- }
-
- __initiaiize_ecore_event_types();
-}
-
-DSInput::DSInput(DSSeat *seat, DSXkb *xkb)
- : DS_INIT_PRIVATE_PTR(DSInput),
- __seat(seat),
- __xkb(xkb)
-{
- if (seat == nullptr)
- {
- DSLOG_ERR("DSInput", "DSSeat ptr is required.");
- return;
- }
-
- __initiaiize_ecore_event_types();
-}
-
-
-DSInput::~DSInput()
-{
- for (auto eventHandler : __eventHandlerList)
- {
- ecore_event_handler_del(eventHandler);
- }
- __eventHandlerList.clear();
-}
-
-void DSInput::init()
-{
- DS_GET_PRIV(DSInput);
-
- priv->Init();
-}
-
-void DSInput::deviceAdd(std::string name, std::string identifier, DSInput::DeviceClass devClass, DSInput::DeviceSubclass devSubclass)
-{
- DSInputDevice *device = new DSInputDevice(name, identifier, devClass, devSubclass);
-
- for (auto dev : devList)
- {
- if (*dev == *device)
- {
- delete device;
- return;
- }
- }
-
- this->__deviceAddSignal.emit(std::make_shared<DSInputDevice>(*device));
-
- devList.push_back(device);
-}
-
-void DSInput::deviceRemove(std::string name, std::string identifier, DSInput::DeviceClass devClass, DSInput::DeviceSubclass devSubclass)
-{
- DSInputDevice *device = new DSInputDevice(name, identifier, devClass, devSubclass);
-
- for (auto dev : devList)
- {
- if (*dev == *device)
- {
- this->__deviceRemoveSignal.emit(std::make_shared<DSInputDevice>(*dev));
-
- devList.remove(dev);
- delete dev;
- break;
- }
- }
-
- delete device;
-}
-
-/*LCOV_EXCL_START*/
-DSInputDevice *DSInput::findDevice(std::string devIdentifier, DSInput::DeviceClass devClass)
-{
- for (auto dev : devList)
- {
- if ((dev->getClass() == devClass) && (dev->getIdentifier().compare(devIdentifier) == 0))
- {
- return dev;
- }
- }
- return nullptr;
-}
-
-void DSInput::keyDown(int keycode, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DSLOG_DBG("DSInput", "[keyDown] keycode: %d, identifier: %d\n", keycode, devIdentifier);
- DSInputDevice *device = findDevice(devIdentifier, devClass);
- DSInputKeyboardEvent *ev = new DSInputKeyboardEvent(std::make_shared<DSInputDevice>(*device), DSInputEvent::KeyDownEvent, timestamp, keycode);
- if (__xkb)
- {
- __xkb->updateModifier(keycode, true);
- ev->setKeyname(__xkb->getKeyname(keycode));
- }
- ecore_event_add(DS_INPUT_EVENT_KEY_DOWN, (void *)ev, nullptr, nullptr);
-}
-
-void DSInput::keyUp(int keycode, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DSLOG_DBG("DSInput", "[keyUp] keycode: %d, identifier: %d\n", keycode, devIdentifier);
- DSInputDevice *device = findDevice(devIdentifier, devClass);
- DSInputKeyboardEvent *ev = new DSInputKeyboardEvent(std::make_shared<DSInputDevice>(*device), DSInputEvent::KeyUpEvent, timestamp, keycode);
- if (__xkb)
- {
- __xkb->updateModifier(keycode, false);
- ev->setKeyname(__xkb->getKeyname(keycode));
- }
- ecore_event_add(DS_INPUT_EVENT_KEY_UP, (void *)ev, nullptr, nullptr);
-}
-
-void DSInput::mouseDown(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DSLOG_DBG("DSInput", "[mouseDown] button: %d (%d, %d, %d), identifier: %d\n", button, x, y, z, devIdentifier);
- DSInputDevice *device = findDevice(devIdentifier, devClass);
- DSInputMouseEvent *ev = new DSInputMouseEvent(std::make_shared<DSInputDevice>(*device), DSInputEvent::MouseDownEvent, timestamp, button, x, y, z);
- ecore_event_add(DS_INPUT_EVENT_MOUSE_DOWN, (void *)ev, nullptr, nullptr);
-}
-
-void DSInput::mouseMove(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DSLOG_DBG("DSInput", "[mouseMove] button: %d (%d, %d, %d), identifier: %d\n", button, x, y, z, devIdentifier);
- DSInputDevice *device = findDevice(devIdentifier, devClass);
- DSInputMouseEvent *ev = new DSInputMouseEvent(std::make_shared<DSInputDevice>(*device), DSInputEvent::MouseMoveEvent, timestamp, button, x, y, z);
- ecore_event_add(DS_INPUT_EVENT_MOUSE_MOVE, (void *)ev, nullptr, nullptr);
-}
-
-void DSInput::mouseUp(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DSLOG_DBG("DSInput", "[mouseUp] button: %d (%d, %d, %d), identifier: %d\n", button, x, y, z, devIdentifier);
- DSInputDevice *device = findDevice(devIdentifier, devClass);
- DSInputMouseEvent *ev = new DSInputMouseEvent(std::make_shared<DSInputDevice>(*device), DSInputEvent::MouseUpEvent, timestamp, button, x, y, z);
- ecore_event_add(DS_INPUT_EVENT_MOUSE_UP, (void *)ev, nullptr, nullptr);
-}
-
-void DSInput::touchDown(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DSLOG_DBG("DSInput", "[touchDown] index: %d (%d, %d), identifier: %d\n", index, x, y, devIdentifier);
- DSInputDevice *device = findDevice(devIdentifier, devClass);
- DSInputTouchEvent *ev = new DSInputTouchEvent(std::make_shared<DSInputDevice>(*device), DSInputEvent::TouchDownEvent, timestamp, index, x, y);
- ecore_event_add(DS_INPUT_EVENT_TOUCH_DOWN, (void *)ev, nullptr, nullptr);
-}
-
-void DSInput::touchMove(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DSLOG_DBG("DSInput", "[touchMove] index: %d (%d, %d), identifier: %d\n", index, x, y, devIdentifier);
- DSInputDevice *device = findDevice(devIdentifier, devClass);
- DSInputTouchEvent *ev = new DSInputTouchEvent(std::make_shared<DSInputDevice>(*device), DSInputEvent::TouchMoveEvent, timestamp, index, x, y);
- ecore_event_add(DS_INPUT_EVENT_TOUCH_MOVE, (void *)ev, nullptr, nullptr);
-}
-
-void DSInput::touchUp(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp)
-{
- DSLOG_DBG("DSInput", "[touchUp] index: %d (%d, %d), identifier: %d\n", index, x, y, devIdentifier);
- DSInputDevice *device = findDevice(devIdentifier, devClass);
- DSInputTouchEvent *ev = new DSInputTouchEvent(std::make_shared<DSInputDevice>(*device), DSInputEvent::TouchUpEvent, timestamp, index, x, y);
- ecore_event_add(DS_INPUT_EVENT_TOUCH_UP, (void *)ev, nullptr, nullptr);
-}
-/*LCOV_EXCL_STOP*/
-
-void DSInput::registerCallbackDeviceAdd(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func)
-{
- this->__deviceAddSignal.connect(slot, func);
-}
-
-void DSInput::registerCallbackDeviceRemove(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func)
-{
- this->__deviceRemoveSignal.connect(slot, func);
-}
-
-void DSInput::registerCallbackKeyDown(DSObject *slot, Ecore_Event_Handler_Cb func)
-{
- __eventHandlerList.push_back(ecore_event_handler_add(DS_INPUT_EVENT_KEY_DOWN, func, slot));
-}
-
-void DSInput::registerCallbackKeyUp(DSObject *slot, Ecore_Event_Handler_Cb func)
-{
- __eventHandlerList.push_back(ecore_event_handler_add(DS_INPUT_EVENT_KEY_UP, func, slot));
-}
-
-void DSInput::registerCallbackMouseDown(DSObject *slot, Ecore_Event_Handler_Cb func)
-{
- __eventHandlerList.push_back(ecore_event_handler_add(DS_INPUT_EVENT_MOUSE_DOWN, func, slot));
-}
-
-void DSInput::registerCallbackMouseMove(DSObject *slot, Ecore_Event_Handler_Cb func)
-{
- __eventHandlerList.push_back(ecore_event_handler_add(DS_INPUT_EVENT_MOUSE_MOVE, func, slot));
-}
-
-void DSInput::registerCallbackMouseUp(DSObject *slot, Ecore_Event_Handler_Cb func)
-{
- __eventHandlerList.push_back(ecore_event_handler_add(DS_INPUT_EVENT_MOUSE_UP, func, slot));
-}
-
-void DSInput::registerCallbackTouchDown(DSObject *slot, Ecore_Event_Handler_Cb func)
-{
- __eventHandlerList.push_back(ecore_event_handler_add(DS_INPUT_EVENT_TOUCH_DOWN, func, slot));
-}
-
-void DSInput::registerCallbackTouchMove(DSObject *slot, Ecore_Event_Handler_Cb func)
-{
- __eventHandlerList.push_back(ecore_event_handler_add(DS_INPUT_EVENT_TOUCH_MOVE, func, slot));
-}
-
-void DSInput::registerCallbackTouchUp(DSObject *slot, Ecore_Event_Handler_Cb func)
-{
- __eventHandlerList.push_back(ecore_event_handler_add(DS_INPUT_EVENT_TOUCH_UP, func, slot));
-}
-
-
-DSInputDevice::DSInputDevice()
- : __deviceName(""),
- __deviceIdentifier(""),
- __deviceClass(DSInput::DeviceClass::NoneClass),
- __deviceSubclass(DSInput::DeviceSubclass::NoneSubclass)
-{
-}
-
-DSInputDevice::DSInputDevice(std::string name, std::string identifier, DSInput::DeviceClass devClass, DSInput::DeviceSubclass devSubclass)
- : __deviceName(name),
- __deviceIdentifier(identifier),
- __deviceClass(devClass),
- __deviceSubclass(devSubclass)
-{
-}
-
-DSInputDevice::~DSInputDevice()
-{
-}
-
-void DSInputDevice::print()
-{
- DSLOG_INF("DSInputDevice", "DeviceInfo: name: %s, identifier: %s , class: %d, subclass: %d", getName().c_str(), getIdentifier().c_str(), getClass(), getSubclass());
-}
-
-bool DSInputDevice::operator==(DSInputDevice& device)
-{
- if ((getName().compare(device.getName()) == 0) &&
- (getIdentifier().compare(device.getIdentifier()) == 0) &&
- (getClass() == device.getClass()))
- {
- return true;
- }
-
- return false;
-}
-
-std::string DSInputDevice::getName() const
-{
- return __deviceName;
-}
-
-void DSInputDevice::setName(std::string name)
-{
- __deviceName = name;
-}
-
-std::string DSInputDevice::getIdentifier() const
-{
- return __deviceIdentifier;
-}
-
-void DSInputDevice::setIdentifier(std::string identifier)
-{
- __deviceIdentifier = identifier;
-}
-
-DSInput::DeviceClass DSInputDevice::getClass() const
-{
- return __deviceClass;
-}
-
-void DSInputDevice::setClass(DSInput::DeviceClass devClass)
-{
- __deviceClass = devClass;
-}
-
-DSInput::DeviceSubclass DSInputDevice::getSubclass() const
-{
- return __deviceSubclass;
-}
-
-void DSInputDevice::setSubclass(DSInput::DeviceSubclass devSubclass)
-{
- __deviceSubclass = devSubclass;
-}
-
-DSInputEvent::DSInputEvent(std::shared_ptr<DSInputDevice> device, Type type, uint32_t timestamp)
- : __device(device),
- __type(type),
- __timestamp(timestamp)
-{
-}
-
-DSInputEvent::~DSInputEvent()
-{
-}
-
-std::shared_ptr<DSInputDevice> DSInputEvent::getDevice()
-{
- return __device;
-}
-
-const DSInputEvent::Type DSInputEvent::getType()
-{
- return __type;
-}
-
-const int DSInputEvent::getTimestamp()
-{
- return __timestamp;
-}
-
-void DSInputEvent::registerEventDeviceBroadcater(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func)
-{
- __eventDeviceBroadCastSignal.connect(slot, func);
-}
-
-void DSInputEvent::eventDeviceBroadcast(std::shared_ptr<DSInputDevice> device)
-{
- __eventDeviceBroadCastSignal.emit(device);
-}
-
-DSInputKeyboardEvent::DSInputKeyboardEvent()
- : DSInputEvent(nullptr, NoneEvent, 0),
- __keycode(0),
- __keyname("")
-{
-}
-
-DSInputKeyboardEvent::DSInputKeyboardEvent(std::shared_ptr<DSInputDevice> device, Type type, uint32_t timestamp, int keycode)
- : DSInputEvent(device, type, timestamp),
- __keycode(keycode),
- __keyname("")
-{
- /* FIXME: __keyname will be defined after xkb is implied */
-}
-
-
-DSInputKeyboardEvent::~DSInputKeyboardEvent()
-{
-}
-
-const int DSInputKeyboardEvent::getKeycode()
-{
- return __keycode;
-}
-
-const std::string DSInputKeyboardEvent::getKeyname()
-{
- return __keyname;
-}
-
-void DSInputKeyboardEvent::setKeyname(std::string name)
-{
- __keyname = name;
-}
-
-
-DSInputMouseEvent::DSInputMouseEvent()
- : DSInputEvent(nullptr, NoneEvent, 0),
- __button(0), __x(0), __y(0), __z(0), __winX(0), __winY(0), __winZ(0)
-{
-}
-
-DSInputMouseEvent::DSInputMouseEvent(std::shared_ptr<DSInputDevice> device, Type type, uint32_t timestamp, int button, int x, int y, int z)
- : DSInputEvent(device, type, timestamp),
- __button(button), __x(x), __y(y), __z(z), __winX(0), __winY(0), __winZ(0)
-{
-}
-
-
-DSInputMouseEvent::~DSInputMouseEvent()
-{
-}
-
-const int DSInputMouseEvent::getButton()
-{
- return __button;
-}
-
-const int DSInputMouseEvent::getX()
-{
- return __x;
-}
-
-const int DSInputMouseEvent::getY()
-{
- return __y;
-}
-
-const int DSInputMouseEvent::getZ()
-{
- return __z;
-}
-
-const int DSInputMouseEvent::getWinX()
-{
- return __winX;
-}
-
-const int DSInputMouseEvent::getWinY()
-{
- return __winY;
-}
-
-const int DSInputMouseEvent::getWinZ()
-{
- return __winZ;
-}
-
-void DSInputMouseEvent::setWinX(int winX)
-{
- __winX = winX;
-}
-
-void DSInputMouseEvent::setWinY(int winY)
-{
- __winY = winY;
-}
-
-void DSInputMouseEvent::setWinZ(int winZ)
-{
- __winZ = winZ;
-}
-
-DSInputTouchEvent::DSInputTouchEvent()
- : DSInputEvent(nullptr, NoneEvent, 0),
- __index(0), __x(0), __y(0), __winX(0), __winY(0)
-{
-}
-
-DSInputTouchEvent::DSInputTouchEvent(std::shared_ptr<DSInputDevice> device, Type type, uint32_t timestamp, int index, int x, int y)
- : DSInputEvent(device, type, timestamp),
- __index(index), __x(x), __y(y), __winX(0), __winY(0)
-{
-}
-
-DSInputTouchEvent::~DSInputTouchEvent()
-{
-}
-
-const int DSInputTouchEvent::getIndex()
-{
- return __index;
-}
-
-const int DSInputTouchEvent::getX()
-{
- return __x;
-}
-
-const int DSInputTouchEvent::getY()
-{
- return __y;
-}
-
-const int DSInputTouchEvent::getWinX()
-{
- return __winX;
-}
-
-const int DSInputTouchEvent::getWinY()
-{
- return __winY;
-}
-
-void DSInputTouchEvent::setWinX(int winX)
-{
- __winX = winX;
-}
-
-void DSInputTouchEvent::setWinY(int winY)
-{
- __winY = winY;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DSINPUT_H_
-#define _DSINPUT_H_
-
-#include <DSCore.h>
-#include <DSObject.h>
-#include <DSSignal.h>
-
-#include <Ecore.h>
-
-namespace display_server
-{
-
-class DSSeat;
-class DSInputPrivate;
-class DSInputDevice;
-class DSXkb;
-
-class DSInput : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSInput);
-public:
- enum DeviceClass {
- NoneClass,
- PointerClass,
- KeyboardClass,
- TouchClass,
- };
- enum DeviceSubclass {
- NoneSubclass,
- };
-public:
- DSInput();
- DSInput(DSSeat *seat);
- DSInput(DSSeat *seat, DSXkb *xkb);
- ~DSInput() override;
-
- void init();
-
- void deviceAdd(std::string name, std::string identifier, DSInput::DeviceClass devClass, DSInput::DeviceSubclass devSubclass);
- void deviceRemove(std::string name, std::string identifier, DSInput::DeviceClass devClass, DSInput::DeviceSubclass devSubclass);
- void keyDown(int keycode, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void keyUp(int keycode, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void mouseDown(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void mouseMove(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void mouseUp(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void touchDown(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void touchMove(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void touchUp(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
-
- void registerCallbackDeviceAdd(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func);
- void registerCallbackDeviceRemove(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func);
- void registerCallbackKeyDown(DSObject *slot, Ecore_Event_Handler_Cb func);
- void registerCallbackKeyUp(DSObject *slot, Ecore_Event_Handler_Cb func);
- void registerCallbackMouseDown(DSObject *slot, Ecore_Event_Handler_Cb func);
- void registerCallbackMouseMove(DSObject *slot, Ecore_Event_Handler_Cb func);
- void registerCallbackMouseUp(DSObject *slot, Ecore_Event_Handler_Cb func);
- void registerCallbackTouchDown(DSObject *slot, Ecore_Event_Handler_Cb func);
- void registerCallbackTouchMove(DSObject *slot, Ecore_Event_Handler_Cb func);
- void registerCallbackTouchUp(DSObject *slot, Ecore_Event_Handler_Cb func);
-
- DSInputDevice *findDevice(std::string devIdentifier, DSInput::DeviceClass devClass);
-
-private:
- DSSeat* __seat;
- DSXkb* __xkb;
- std::list<DSInputDevice*> devList;
-
- DSSignal<std::shared_ptr<DSInputDevice>> __deviceAddSignal;
- DSSignal<std::shared_ptr<DSInputDevice>> __deviceRemoveSignal;
-
- std::list<Ecore_Event_Handler*> __eventHandlerList;
-
- static int DS_INPUT_EVENT_KEY_DOWN;
- static int DS_INPUT_EVENT_KEY_UP;
- static int DS_INPUT_EVENT_MOUSE_DOWN;
- static int DS_INPUT_EVENT_MOUSE_MOVE;
- static int DS_INPUT_EVENT_MOUSE_UP;
- static int DS_INPUT_EVENT_TOUCH_DOWN;
- static int DS_INPUT_EVENT_TOUCH_MOVE;
- static int DS_INPUT_EVENT_TOUCH_UP;
-
- void __initiaiize_ecore_event_types();
-};
-
-class DSInputDevice
-{
-public:
- DSInputDevice();
- DSInputDevice(std::string name, std::string identifier, DSInput::DeviceClass devClass, DSInput::DeviceSubclass devSubclass);
- ~DSInputDevice();
-
- void print();
- bool operator==(DSInputDevice& device);
-
- std::string getName() const;
- void setName(std::string name);
-
- std::string getIdentifier() const;
- void setIdentifier(std::string identifier);
-
- DSInput::DeviceClass getClass() const;
- void setClass(DSInput::DeviceClass devClass);
-
- DSInput::DeviceSubclass getSubclass() const;
- void setSubclass(DSInput::DeviceSubclass devSubclass);
-
-private:
- std::string __deviceName;
- std::string __deviceIdentifier;
- DSInput::DeviceClass __deviceClass;
- DSInput::DeviceSubclass __deviceSubclass;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_INPUT_EVENT_H_
-#define _DS_INPUT_EVENT_H_
-
-#include "DSInput.h"
-
-namespace display_server
-{
-
-class DSInputEvent
-{
-public:
- enum Type {
- NoneEvent,
- KeyEnterEvent,
- KeyLeaveEvent,
- KeyDownEvent,
- KeyUpEvent,
- MouseInEvent,
- MouseOutEvent,
- MouseDownEvent,
- MouseMoveEvent,
- MouseUpEvent,
- MouseWheelEvent,
- MouseHWheelEvent,
- TouchDownEvent,
- TouchMoveEvent,
- TouchUpEvent
- };
-
- DSInputEvent(std::shared_ptr<DSInputDevice> device, Type type, uint32_t timestamp);
- virtual ~DSInputEvent();
-
- std::shared_ptr<DSInputDevice> getDevice();
- const Type getType();
- const int getTimestamp();
- //DSWindow getTargetWindow();
-
- void registerEventDeviceBroadcater(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func);
- void eventDeviceBroadcast(std::shared_ptr<DSInputDevice> device);
-
-protected:
- std::shared_ptr<DSInputDevice> __device;
- Type __type;
- uint32_t __timestamp;
- DSSignal<std::shared_ptr<DSInputDevice>> __eventDeviceBroadCastSignal;
- //DSWindow __targetWindow;
-};
-
-class DSInputKeyboardEvent : public DSInputEvent
-{
-public:
- DSInputKeyboardEvent();
- DSInputKeyboardEvent(std::shared_ptr<DSInputDevice> device, Type type, uint32_t timestamp, int keycode);
- ~DSInputKeyboardEvent() override;
-
- const int getKeycode();
- const std::string getKeyname();
- void setKeyname(std::string name);
-
-protected:
- int __keycode;
- std::string __keyname;
-};
-
-class DSInputMouseEvent : public DSInputEvent
-{
-public:
- DSInputMouseEvent();
- DSInputMouseEvent(std::shared_ptr<DSInputDevice> device, Type type, uint32_t timestamp, int button, int x, int y, int z);
- ~DSInputMouseEvent() override;
-
- const int getButton();
- const int getX();
- const int getY();
- const int getZ();
- const int getWinX();
- const int getWinY();
- const int getWinZ();
- void setWinX(int winX);
- void setWinY(int winY);
- void setWinZ(int winZ);
-
-protected:
- int __button;
- int __x;
- int __y;
- int __z;
- int __winX;
- int __winY;
- int __winZ;
-};
-
-class DSInputTouchEvent : public DSInputEvent
-{
-public:
- DSInputTouchEvent();
- DSInputTouchEvent(std::shared_ptr<DSInputDevice> device, Type type, uint32_t timestamp, int index, int x, int y);
- ~DSInputTouchEvent() override;
-
- const int getIndex();
- const int getX();
- const int getY();
- const int getWinX();
- const int getWinY();
- void setWinX(int winX);
- void setWinY(int winY);
-
-protected:
- int __index;
- int __x;
- int __y;
- int __winX;
- int __winY;
-};
-
-}
-
-#endif
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DSINPUTPRIVATE_H_
-#define _DSINPUTPRIVATE_H_
-
-#include "DSInput.h"
-#include "DSLibinput.h"
-#include "DSInputEvent.h"
-
-namespace display_server
-{
-
-class DSLibinput;
-
-class DSInputPrivate : public DSObjectPrivate
-{
-DS_PIMPL_USE_PUBLIC(DSInput);
-public:
- DSInputPrivate() = delete;
- DSInputPrivate(DSInput *p_ptr);
- ~DSInputPrivate() override;
-
- void Init();
-
- void PostDeviceAddEvent(std::string seat, std::string name, std::string identifier, DSInput::DeviceClass devClass);
- void PostDeviceRemoveEvent(std::string seat, std::string name, std::string identifier, DSInput::DeviceClass devClass);
- void PostKeyboardEvent(int keycode, bool pressed, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void PostPointerEvent(int button, int x, int y, int z, DSInputEvent::Type type, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
- void PostTouchEvent(int index, int x, int y, DSInputEvent::Type type, std::string devIdentifier, DSInput::DeviceClass devClass, uint32_t timestamp);
-
-private:
- DSLibinput *__dsLibinput;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSLibinput.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <iostream>
-
-namespace display_server
-{
-
-const struct ::libinput_interface DSLibinput::__input_interface = {
- .open_restricted = DSLibinput::__handleOpenRestricted,
- .close_restricted = DSLibinput::__handleCloseRestricted
-};
-
-DSLibinput::DSLibinput(DSInputPrivate *p_ptr)
- : __libinput(nullptr),
- __udev(nullptr),
- __libinput_handler(nullptr)
-{
- inputPrivate = p_ptr;
- ecore_init();
- __udev = udev_new();
- DS_ASSERT(__udev);
- __libinput = libinput_udev_create_context(&__input_interface, this, __udev);
- if (!__libinput)
- {
- udev_unref(__udev);
- DS_ASSERT(false);
- }
-
- if (libinput_udev_assign_seat(__libinput, "seat0"))
- {
- libinput_unref(__libinput);
- udev_unref(__udev);
- DS_ASSERT(false);
- }
-
- __fd = libinput_get_fd(__libinput);
- __libinput_handler = ecore_main_fd_handler_add(__fd, ECORE_FD_READ, __handleEvents, this, NULL, NULL);
-
- this->__handleEvents(this, __libinput_handler);
-}
-
-DSLibinput::~DSLibinput()
-{
- if (__libinput_handler)
- {
- ecore_main_fd_handler_del(__libinput_handler);
- }
- ecore_shutdown();
- libinput_unref(__libinput);
- udev_unref(__udev);
-}
-
-int DSLibinput::__handleOpenRestricted(const char *path, int flags, void *user_data)
-{
- int fd = open(path, flags);
-
- return fd;
-}
-
-void DSLibinput::__handleCloseRestricted(int fd, void *user_data)
-{
- close(fd);
-}
-
-Eina_Bool DSLibinput::__handleEvents(void *data, Ecore_Fd_Handler *hdlr)
-{
- DSLibinput *dsLibinput = (DSLibinput *)data;
- struct ::libinput_event *event;
-
- if (libinput_dispatch(dsLibinput->__libinput) != 0)
- {
- //log("Failed to dispatch libinput events: %m");
- }
-
- while ((event = libinput_get_event(dsLibinput->__libinput)))
- {
- switch (libinput_event_get_type(event))
- {
- case LIBINPUT_EVENT_DEVICE_ADDED:
- dsLibinput->__processDeviceAddEvent(event);
- break;
- case LIBINPUT_EVENT_DEVICE_REMOVED:
- dsLibinput->__processDeviceRemoveEvent(event);
- break;
-/*LCOV_EXCL_START*/
- case LIBINPUT_EVENT_KEYBOARD_KEY:
- dsLibinput->__processKeyboardKeyEvent(event);
- break;
- case LIBINPUT_EVENT_POINTER_MOTION:
- dsLibinput->__processPointerMotionEvent(event);
- break;
- case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
- dsLibinput->__processPointerMotionAbsoluteEvent(event);
- break;
- case LIBINPUT_EVENT_POINTER_BUTTON:
- dsLibinput->__processPointerButtonEvent(event);
- break;
- case LIBINPUT_EVENT_POINTER_AXIS:
- dsLibinput->__processPointerAxisEvent(event);
- break;
- case LIBINPUT_EVENT_TOUCH_DOWN:
- dsLibinput->__processTouchDownEvent(event);
- break;
- case LIBINPUT_EVENT_TOUCH_MOTION:
- dsLibinput->__processTouchMotionEvent(event);
- break;
- case LIBINPUT_EVENT_TOUCH_UP:
- dsLibinput->__processTouchUpEvent(event);
- break;
- case LIBINPUT_EVENT_TOUCH_CANCEL:
- dsLibinput->__processTouchCancelEvent(event);
- break;
- case LIBINPUT_EVENT_TOUCH_FRAME:
- dsLibinput->__processTouchFrameEvent(event);
- break;
- case LIBINPUT_EVENT_TOUCH_AUX_DATA:
- dsLibinput->__processTouchAuxDataEvent(event);
- break;
- default:
- break;
-/*LCOV_EXCL_STOP*/
- }
- libinput_event_destroy(event);
- }
- return EINA_TRUE;
-}
-
-void DSLibinput::__processDeviceAddEvent(struct ::libinput_event *event)
-{
- struct ::libinput_seat *libinput_seat;
- struct ::libinput_device *device;
- std::string seatName, devName, identifier;
-
- device = libinput_event_get_device(event);
- libinput_seat = libinput_device_get_seat(device);
-
- seatName = libinput_seat_get_logical_name(libinput_seat);
- devName = libinput_device_get_name(device);
- identifier= (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
-
- if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD))
- {
- inputPrivate->PostDeviceAddEvent(seatName, devName, identifier, DSInput::KeyboardClass);
- }
- else if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER))
- {
- inputPrivate->PostDeviceAddEvent(seatName, devName, identifier, DSInput::PointerClass);
- }
- else if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH))
- {
- inputPrivate->PostDeviceAddEvent(seatName, devName, identifier, DSInput::TouchClass);
- }
-}
-
-void DSLibinput::__processDeviceRemoveEvent(struct ::libinput_event *event)
-{
- struct ::libinput_seat *libinput_seat;
- struct ::libinput_device *device;
- std::string seatName, devName, identifier;
-
- device = libinput_event_get_device(event);
- libinput_seat = libinput_device_get_seat(device);
-
- seatName = libinput_seat_get_logical_name(libinput_seat);
- devName = libinput_device_get_name(device);
- identifier= (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
-
- if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD))
- {
- inputPrivate->PostDeviceRemoveEvent(seatName, devName, identifier, DSInput::KeyboardClass);
- }
- else if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER))
- {
- inputPrivate->PostDeviceRemoveEvent(seatName, devName, identifier, DSInput::PointerClass);
- }
- else if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH))
- {
- inputPrivate->PostDeviceRemoveEvent(seatName, devName, identifier, DSInput::TouchClass);
- }
-}
-
-/*LCOV_EXCL_START*/
-void DSLibinput::__processKeyboardKeyEvent(struct:: libinput_event *event)
-{
- struct:: libinput_event_keyboard *keyboard_event = libinput_event_get_keyboard_event(event);
- int keycode = libinput_event_keyboard_get_key(keyboard_event) + 8;
- int state = libinput_event_keyboard_get_key_state(keyboard_event);
- uint32_t timestamp = libinput_event_keyboard_get_time(keyboard_event);
- bool pressed = false;
-
- if (state == LIBINPUT_KEY_STATE_PRESSED) pressed = true;
-
- struct ::libinput_device *device = libinput_event_get_device(event);
- std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
-
- inputPrivate->PostKeyboardEvent(keycode, pressed, identifier, DSInput::KeyboardClass, timestamp);
-}
-
-void DSLibinput::__processPointerMotionEvent(struct ::libinput_event *event)
-{
- struct:: libinput_event_pointer *pointer_event = libinput_event_get_pointer_event(event);
- int dx, dy;
- uint32_t timestamp = libinput_event_pointer_get_time(pointer_event);
- struct ::libinput_device *device = libinput_event_get_device(event);
- std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
-
- dx = libinput_event_pointer_get_dx(pointer_event);
- dy = libinput_event_pointer_get_dy(pointer_event);
-
- inputPrivate->PostPointerEvent(0, dx, dy, 0, DSInputEvent::MouseMoveEvent, identifier, DSInput::PointerClass, timestamp);
-}
-
-void DSLibinput::__processPointerMotionAbsoluteEvent(struct ::libinput_event *event)
-{
- ;
-}
-
-void DSLibinput::__processPointerButtonEvent(struct ::libinput_event *event)
-{
- struct:: libinput_event_pointer *pointer_event = libinput_event_get_pointer_event(event);
- DSInputEvent::Type eventType;
- int button;
- int state;
- uint32_t timestamp = libinput_event_pointer_get_time(pointer_event);
-
- struct ::libinput_device *device = libinput_event_get_device(event);
- std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
-
- button = libinput_event_pointer_get_button(pointer_event);
- state = libinput_event_pointer_get_button_state(pointer_event);
-
- if (state)
- eventType = DSInputEvent::MouseDownEvent;
- else
- eventType = DSInputEvent::MouseUpEvent;
-
- inputPrivate->PostPointerEvent(button, 0, 0, 0, eventType, identifier, DSInput::PointerClass, timestamp);
-}
-
-void DSLibinput::__processPointerAxisEvent(struct ::libinput_event *event)
-{
- ;
-}
-
-void DSLibinput::__processTouchDownEvent(struct ::libinput_event *event)
-{
- struct:: libinput_event_touch *touch_event = libinput_event_get_touch_event(event);
- int index, x, y;
- uint32_t timestamp = libinput_event_touch_get_time(touch_event);
-
- struct ::libinput_device *device = libinput_event_get_device(event);
- std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
-
- index = libinput_event_touch_get_slot(touch_event);
- x = libinput_event_touch_get_x(touch_event);
- y = libinput_event_touch_get_y(touch_event);
-
- inputPrivate->PostTouchEvent(index, x, y, DSInputEvent::TouchDownEvent, identifier, DSInput::TouchClass, timestamp);
-}
-
-void DSLibinput::__processTouchMotionEvent(struct ::libinput_event *event)
-{
- struct:: libinput_event_touch *touch_event = libinput_event_get_touch_event(event);
- int index, x, y;
- uint32_t timestamp = libinput_event_touch_get_time(touch_event);
-
- struct ::libinput_device *device = libinput_event_get_device(event);
- std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
-
- index = libinput_event_touch_get_slot(touch_event);
- x = libinput_event_touch_get_x(touch_event);
- y = libinput_event_touch_get_y(touch_event);
-
- inputPrivate->PostTouchEvent(index, x, y, DSInputEvent::TouchMoveEvent, identifier, DSInput::TouchClass, timestamp);
-}
-
-void DSLibinput::__processTouchUpEvent(struct ::libinput_event *event)
-{
- struct:: libinput_event_touch *touch_event = libinput_event_get_touch_event(event);
- int index, x, y;
- uint32_t timestamp = libinput_event_touch_get_time(touch_event);
-
- struct ::libinput_device *device = libinput_event_get_device(event);
- std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
-
- index = libinput_event_touch_get_slot(touch_event);
- x = 0;
- y = 0;
-
- inputPrivate->PostTouchEvent(index, x, y, DSInputEvent::TouchUpEvent, identifier, DSInput::TouchClass, timestamp);
-}
-
-void DSLibinput::__processTouchCancelEvent(struct ::libinput_event *event)
-{
- ;
-}
-
-void DSLibinput::__processTouchFrameEvent(struct ::libinput_event *event)
-{
- ;
-}
-
-void DSLibinput::__processTouchAuxDataEvent(struct ::libinput_event *event)
-{
- ;
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DSLIBINPUT_H_
-#define _DSLIBINPUT_H_
-
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-#include <libinput.h>
-#include <libudev.h>
-#include <Ecore.h>
-#include "DSInputPrivate.h"
-
-namespace display_server
-{
-
-class DSLibinput
-{
-public:
- DSLibinput() = delete;
- DSLibinput(DSInputPrivate *p_ptr);
- ~DSLibinput();
-
-private:
- DSInputPrivate *inputPrivate;
- struct ::libinput *__libinput;
- udev *__udev;
- int __fd;
- Ecore_Fd_Handler *__libinput_handler;
-
- static const struct ::libinput_interface __input_interface;
-
- static int __handleOpenRestricted(const char *path, int flags, void *user_data);
- static void __handleCloseRestricted(int fd, void *user_data);
- static Eina_Bool __handleEvents(void *data, Ecore_Fd_Handler *hdlr);
-
- void __processDeviceAddEvent(struct ::libinput_event *event);
- void __processDeviceRemoveEvent(struct ::libinput_event *event);
- void __processKeyboardKeyEvent(struct ::libinput_event *event);
- void __processPointerMotionEvent(struct ::libinput_event *event);
- void __processPointerMotionAbsoluteEvent(struct ::libinput_event *event);
- void __processPointerButtonEvent(struct ::libinput_event *event);
- void __processPointerAxisEvent(struct ::libinput_event *event);
- void __processTouchDownEvent(struct ::libinput_event *event);
- void __processTouchMotionEvent(struct ::libinput_event *event);
- void __processTouchUpEvent(struct ::libinput_event *event);
- void __processTouchCancelEvent(struct ::libinput_event *event);
- void __processTouchFrameEvent(struct ::libinput_event *event);
- void __processTouchAuxDataEvent(struct ::libinput_event *event);
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSObject.h"
-
-namespace display_server
-{
-
-DSObject::DSObject()
- : _d_ptr(std::make_unique<DSObjectPrivate>(this))
-{}
-
-DSObject::~DSObject()
-{
- __d_func()->notifyDestroy();
-}
-
-void DSObject::attachDestroyObserver(IDSObjectObserver *ob)
-{
- __d_func()->attachDestroyObserver(ob);
-}
-
-void DSObject::detachDestroyObserver(IDSObjectObserver *ob)
-{
- __d_func()->detachDestroyObserver(ob);
-}
-
-void DSObject::setProperty(std::string key, const DSPropertyVariant &data, DSPropertyType type)
-{
- __d_func()->setProperty(key, data, type);
-}
-
-const DSPropertyVariant &DSObject::getProperty(std::string key)
-{
- return __d_func()->getProperty(key);
-}
-
-std::string DSObject::getName(void)
-{
- return __d_func()->getName();
-}
-
-void DSObject::setName(std::string name)
-{
- __d_func()->setName(name);
-}
-
-DSObject::DSObject(std::unique_ptr<DSObjectPrivate> ptr)
-{
- _d_ptr = std::move(ptr);
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_OBJECT_H_
-#define __DS_OBJECT_H_
-
-#include "DSCore.h"
-#include "IDSObjectObserver.h"
-#include "DSObjectPrivate.h"
-#include "DSProperty.h"
-
-namespace display_server
-{
-
-class DSObject
-{
-public:
- explicit DSObject();
- virtual ~DSObject();
-
- void attachDestroyObserver(IDSObjectObserver *ob);
- void detachDestroyObserver(IDSObjectObserver *ob);
- void setProperty(std::string key, const DSPropertyVariant &data, DSPropertyType type);
- const DSPropertyVariant &getProperty(std::string key);
- std::string getName(void);
- void setName(std::string name);
-
-protected:
- DSObject(std::unique_ptr<DSObjectPrivate> ptr);
- std::unique_ptr<DSObjectPrivate> _d_ptr;
-
-private:
- inline DSObjectPrivate *__d_func()
- {
- return _d_ptr.get();
- }
- inline const DSObjectPrivate *__d_func() const
- {
- return _d_ptr.get();
- }
-};
-
-} // namespace display_server
-
-#endif
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSObject.h"
-
-namespace display_server
-{
- DSObjectPrivate::DSObjectPrivate(DSObject *p_ptr) :
- __p_ptr(p_ptr)
- {}
-
- DSObjectPrivate::~DSObjectPrivate()
- {
- __type_info.name.clear();
- __observers.clear();
- __properties.clear();
- }
-
- void DSObjectPrivate::attachDestroyObserver(IDSObjectObserver *ob)
- {
- __observers.push_back(ob);
- }
-
- void DSObjectPrivate::detachDestroyObserver(IDSObjectObserver *ob)
- {
- __observers.remove(ob);
- }
-
- void DSObjectPrivate::setProperty(std::string key, const DSPropertyVariant &data, DSPropertyType type)
- {
- std::unordered_map<std::string, DSProperty>::const_iterator ci = __properties.find(key);
-
- if (ci == __properties.end()) {
- __properties.emplace(key, DSProperty(key, data, type));
- } else {
- __properties[key] = DSProperty(key, data, type);
- }
- }
-
- const DSPropertyVariant &DSObjectPrivate::getProperty(std::string key)
- {
- std::unordered_map<std::string, DSProperty>::const_iterator ci = __properties.find(key);
-
- if (ci == __properties.end()) {
- throw DSPropertyException("NOT_EXIST");
- }
- return __properties[key].getData();
- }
-
- void DSObjectPrivate::notifyDestroy(void)
- {
- for (IDSObjectObserver *ob : __observers)
- ob->destroyed(__p_ptr);
- __observers.clear();
- }
-
- std::string DSObjectPrivate::getName(void)
- {
- return __type_info.name;
- }
-
- void DSObjectPrivate::setName(std::string name)
- {
- __type_info.name = name;
- }
-
-/*LCOV_EXCL_START*/
- DSObjectPrivate& DSObjectPrivate::operator=(DSObjectPrivate &&p)
- {
- if (__p_ptr)
- return *this;
-
- __type_info.name = p.__type_info.name;
- __p_ptr = p.__p_ptr;
- __observers = std::move(p.__observers);
- __properties = std::move(p.__properties);
-
- p.__type_info.name.clear();
- p.__p_ptr = nullptr;
- p.__observers.clear();
- p.__properties.clear();
-
- return *this;
- }
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_OBJECT_PRIVATE_H_
-#define __DS_OBJECT_PRIVATE_H_
-
-#include "DSObject.h"
-#include "DSProperty.h"
-#include <iostream>
-#include <list>
-#include <string>
-#include <unordered_map>
-
-namespace display_server
-{
-
-class DSObject;
-
-class DSObjectPrivate {
-public:
- DSObjectPrivate() = delete;
- DSObjectPrivate(DSObject *p_ptr);
- virtual ~DSObjectPrivate();
-
- void attachDestroyObserver(IDSObjectObserver *ob);
- void detachDestroyObserver(IDSObjectObserver *ob);
- void notifyDestroy();
- void setProperty(std::string key, const DSPropertyVariant &data, DSPropertyType type);
- const DSPropertyVariant &getProperty(std::string key);
- std::string getName(void);
- void setName(std::string name);
-
- DSObjectPrivate &operator=(DSObjectPrivate &&p); //move assignment
-
- inline const DSObject *p_func() const
- {
- return __p_ptr;
- }
-
-private:
- struct
- {
- std::string name;
- } __type_info;
-
- DSObject *__p_ptr;
-
- std::list<IDSObjectObserver *> __observers;
- std::unordered_map<std::string, DSProperty> __properties;
-};
-
-} // namespace display_server
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __I_DS_OBJECT_OBSERVER_H_
-#define __I_DS_OBJECT_OBSERVER_H_
-
-namespace display_server
-{
-
-class DSObject;
-
-class IDSObjectObserver
-{
-public:
- virtual ~IDSObjectObserver() = default;
- virtual void destroyed(DSObject *slot) = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSOutputImpl.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-DSOutputImpl::DSOutputImpl(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOutput)
- : __displayDeviceOutput{displayDeviceOutput}
-{}
-
-DSOutputImpl::~DSOutputImpl()
-{}
-
-int DSOutputImpl::getResolutionWidth()
-{
- return __displayDeviceOutput->getResolutionWidth();
-}
-
-int DSOutputImpl::getResolutionHeight()
-{
- return __displayDeviceOutput->getResolutionHeight();
-}
-
-bool DSOutputImpl::applyResolutionAuto()
-{
- if (!__displayDeviceOutput) {
- DSLOG_ERR("DSOutputImpl", "__displayDeviceOutput is null.");
- return false;
- }
-
- std::list<std::shared_ptr<IDSDisplayDeviceOutputMode>> modes = __displayDeviceOutput->getAvailableModes();
- if (modes.empty()) {
- DSLOG_ERR("DSOutputImpl", "modes are empty.");
- return false;
- }
-
- auto bestMode = modes.front();
- if (!bestMode) {
- DSLOG_ERR("DSOutputImpl", "bestMode is null.");
- return false;
- }
-
- if (!__displayDeviceOutput->setMode(bestMode)) {
- DSLOG_ERR("DSOutputImpl", "output->setMode(bestMode) fails.");
- return false;
- }
-
- // TODO: get more information from DSOutputImpl to set them toDSWaylandOutput.
- __waylandOutput = std::make_shared<DSWaylandOutput>(DSWaylandCompositor::getInstance(),
- __displayDeviceOutput->getName(), "tm1", "tm1",
- 0, 0, __displayDeviceOutput->getResolutionWidth(), __displayDeviceOutput->getResolutionHeight(),
- __displayDeviceOutput->getPhysicalMMWidth(), __displayDeviceOutput->getPhysicalMMHeight(),
- __displayDeviceOutput->getRefreshRate(), 0, 0);
- DSWaylandCompositor::releaseInstance();
-
- // send output information
- __waylandOutput->sendWaylandOutputInfo();
-
- return true;
-}
-
-std::shared_ptr<IDSDisplayDeviceOutput> DSOutputImpl::getDisplayDeviceOutput()
-{
- return __displayDeviceOutput;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __I_DS_OUTPUT_IMPL_H__
-#define __I_DS_OUTPUT_IMPL_H__
-
-#include "IDSOutput.h"
-#include "IDSDisplayDeviceOutput.h"
-#include "DSWaylandOutput.h"
-
-namespace display_server
-{
-
-class DSOutputImpl : public IDSOutput
-{
-public:
- DSOutputImpl(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOutput);
- ~DSOutputImpl();
-
- int getResolutionWidth() override;
- int getResolutionHeight() override;
- bool applyResolutionAuto() override;
-
- std::shared_ptr<IDSDisplayDeviceOutput> getDisplayDeviceOutput();
-
-private:
- std::shared_ptr<IDSDisplayDeviceOutput> __displayDeviceOutput;
- std::shared_ptr<DSWaylandOutput> __waylandOutput;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __I_DS_OUTPUT_H__
-#define __I_DS_OUTPUT_H__
-
-namespace display_server
-{
-
-class IDSOutput
-{
-public:
- virtual ~IDSOutput() = default;
-
- virtual int getResolutionWidth() = 0;
- virtual int getResolutionHeight() = 0;
- virtual bool applyResolutionAuto() = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-# DSOutput
-Output
-
-## Requirements
-* Output의 정보를 받을 수 있어야 한다.
- * state 변경 - connect, disconnect, create, destroy
- * dpms 변경 - dpms on, stanby, suspend, off
-* Output state 변경 Noti를 보낼 수 있어야 한다.
-* Output mode setting을 할 수 있어야 한다.(virtual mode도 setting가능해야 한다.DSOutput에서 관리해서 transform하여 display할 수 있는)
-* Output dpms를 set/get을 할 수 있어야 한다.
-* Output property set/get을 할 수 있어야 한다.
-* Output commit을 할 수 있어야 한다.
-* Output transform을 setting할 수 있어야 한다.
-* <<향후 추가>>
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSPolicyArea.h"
-#include "DSPolicyAreaPrivate.h"
-
-namespace display_server
-{
-
-DSPolicyArea::DSPolicyArea()
- : DS_INIT_PRIVATE_PTR(DSPolicyArea)
-{}
-
-DSPolicyArea::~DSPolicyArea()
-{}
-
-bool DSPolicyArea::setPosition(int x, int y)
-{
- DS_GET_PRIV(DSPolicyArea);
-
- if (!priv->setPosition(x, y))
- return false;
-
- return true;
-}
-
-bool DSPolicyArea::setSize(int width, int height)
-{
- DS_GET_PRIV(DSPolicyArea);
-
- if (!priv->setSize(width, height))
- return false;
-
- return true;
-}
-
-bool DSPolicyArea::attachSeat(std::shared_ptr<DSSeat> seat)
-{
- DS_GET_PRIV(DSPolicyArea);
-
- if (!priv->attachSeat(seat))
- return false;
-
- return true;
-}
-
-DSPolicyAreaPrivate::DSPolicyAreaPrivate(DSPolicyArea *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __x(0),
- __y(0),
- __width(0),
- __height(0),
- __seat(nullptr)
-{
- __zone = std::make_shared<DSZone>();
-}
-
-DSPolicyAreaPrivate::~DSPolicyAreaPrivate()
-{}
-
-bool DSPolicyAreaPrivate::setPosition(int x, int y)
-{
- stPosition position;
-
- position.x = x;
- position.y = y;
-
- __zone->setPosition(position);
-
- return true;
-}
-
-bool DSPolicyAreaPrivate::setSize(int width, int height)
-{
- stSize size;
-
- size.w = width;
- size.h = height;
-
- __zone->setSize(size);
-
- return true;
-}
-
-bool DSPolicyAreaPrivate::attachSeat(std::shared_ptr<DSSeat> seat)
-{
- if (__seat)
- {
- DSLOG_INF("DSPolicyAreaPrivate", "Seat has been changed. (%p -> %p)", __seat, seat);
- }
-
- __seat = seat;
- __seat->attachZone(__zone);
-
- return true;
-}
-
-std::shared_ptr<DSZone> DSPolicyAreaPrivate::getZone()
-{
- return __zone;
-}
-
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_POLICY_AREA_H__
-#define __DS_POLICY_AREA_H__
-
-#include <DSCore.h>
-#include <DSObject.h>
-#include <DSSeat.h>
-
-namespace display_server
-{
-
-class DSPolicyAreaPrivate;
-
-class DSPolicyArea : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSPolicyArea);
-public:
- DSPolicyArea();
- virtual ~DSPolicyArea();
-
- bool setPosition(int x, int y);
- bool setSize(int width, int height);
- bool attachSeat(std::shared_ptr<DSSeat> seat);
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_POLICY_AREA_PRIVATE_H__
-#define __DS_POLICY_AREA_PRIVATE_H__
-
-#include "DSPolicyArea.h"
-#include "DSZone.h"
-
-namespace display_server
-{
-
-class DSPolicyAreaPrivate : public DSObjectPrivate
-{
-DS_PIMPL_USE_PUBLIC(DSPolicyArea);
-public:
- DSPolicyAreaPrivate() = delete;
- DSPolicyAreaPrivate(DSPolicyArea *p_ptr);
- virtual ~DSPolicyAreaPrivate();
-
- static DSPolicyAreaPrivate *getPrivate(DSPolicyArea *q) { return q->__d_func(); }
- bool setPosition(int x, int y);
- bool setSize(int width, int height);
- bool attachSeat(std::shared_ptr<DSSeat> seat);
- std::shared_ptr<DSZone> getZone();
-
-private:
- int __x, __y;
- int __width, __height;
- std::shared_ptr<DSSeat> __seat;
- std::shared_ptr<DSZone> __zone;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSProperty.h"
-
-namespace display_server
-{
-
-DSProperty::DSProperty()
- : __d_ptr(new DSPropertyPrivate(this))
-{}
-
-DSProperty::DSProperty(std::string key, const DSPropertyVariant &data, DSPropertyType type)
- : __d_ptr(new DSPropertyPrivate(this, key, data, type))
-{
- __d_func()->__setKey(key);
- __d_func()->__setData(data, type);
-}
-
-DSProperty::DSProperty(const DSProperty &property)
- : __d_ptr(new DSPropertyPrivate(this))
-{
- __d_func()->__setKey(property.getKey());
- __d_func()->__setData(property.getData(), property.getType());
-}
-
-DSProperty::~DSProperty()
-{}
-
-DSProperty &DSProperty::operator=(DSProperty &property) // Copy Assign
-{
- __d_func()->__setKey(property.getKey());
- __d_func()->__setData(property.getData(), property.getType());
-
- return *this;
-}
-
-DSProperty &DSProperty::operator=(const DSProperty &property) // Copy Assign
-{
- __d_func()->__setKey(property.getKey());
- __d_func()->__setData(property.getData(), property.getType());
-
- return *this;
-}
-
-const DSPropertyVariant &DSProperty::getData(void) const
-{
- return __d_func()->__getData();
-}
-
-const std::string DSProperty::getKey(void) const
-{
- return __d_func()->__getKey();
-}
-
-const DSPropertyType DSProperty::getType(void) const
-{
- return __d_func()->__getType();
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_PROPERTY_H_
-#define __DS_PROPERTY_H_
-
-#include "DSCore.h"
-#include "DSPropertyPrivate.h"
-
-namespace display_server
-{
-
-class DSPropertyPrivate;
-
-struct DSPropertyException : public std::exception
-{
-public:
- DSPropertyException(std::string str)
- : __msg(str)
- {}
-
- virtual const char *what() const noexcept override
- {
- return __msg.c_str();
- }
-
-private:
- std::string __msg;
-};
-
-class DSProperty
-{
-public:
- DSProperty();
- DSProperty(std::string key, const DSPropertyVariant &data, DSPropertyType type);
- DSProperty(const DSProperty &property);
- virtual ~DSProperty();
-
- const DSPropertyVariant &getData(void) const;
- const std::string getKey(void) const;
- const DSPropertyType getType(void) const;
-
- DSProperty &operator=(DSProperty &property);
- DSProperty &operator=(const DSProperty &property);
-
-private:
- std::unique_ptr<DSPropertyPrivate> __d_ptr;
-
- inline DSPropertyPrivate *__d_func()
- {
- return __d_ptr.get();
- }
- inline const DSPropertyPrivate *__d_func() const
- {
- return __d_ptr.get();
- }
-
- friend class DSPropertyPrivate;
- friend class DSObject;
-};
-
-} // namespace display_server
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSProperty.h"
-
-namespace display_server {
-
-DSPropertyPrivate::DSPropertyPrivate(DSProperty *p_ptr)
- : __p_ptr(p_ptr)
-{
- __type = DSPropertyType::NONE;
-}
-
-DSPropertyPrivate::DSPropertyPrivate(DSProperty *p_ptr, std::string key, const DSPropertyVariant &data, DSPropertyType type)
- : __p_ptr(p_ptr), __key(key), __type(type)
-{
- switch (__type) { // copy case
- case DSPropertyType::INTEGER:
- case DSPropertyType::DOUBLE:
- case DSPropertyType::FLOAT:
- case DSPropertyType::STRING:
- __data = data; // value copy
- break;
- case DSPropertyType::POINTER:
- __data = data; // address copy
- break;
- default:
- break;
- }
-}
-
-DSPropertyPrivate::~DSPropertyPrivate()
-{
- __key.clear();
-}
-
-const std::string DSPropertyPrivate::__getKey() const
-{
- return __key;
-}
-
-const DSPropertyVariant &DSPropertyPrivate::__getData() const
-{
- return __data;
-}
-
-const DSPropertyType DSPropertyPrivate::__getType() const
-{
- return __type;
-}
-
-void DSPropertyPrivate::__setKey(std::string key)
-{
- __key = key;
-}
-
-void DSPropertyPrivate::__setData(DSPropertyVariant data, DSPropertyType type)
-{
- __type = type;
-
- switch (__type) { // copy case
- case DSPropertyType::INTEGER:
- case DSPropertyType::DOUBLE:
- case DSPropertyType::FLOAT:
- case DSPropertyType::STRING:
- __data = data; // value copy
- break;
- case DSPropertyType::POINTER:
- __data = data; // address copy
- break;
- default:
- break;
- }
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_PROPERTY_PRIVATE_H_
-#define __DS_PROPERTY_PRIVATE_H_
-
-#include "DSCore.h"
-#include "DSProperty.h"
-
-namespace display_server
-{
-
-class DSProperty;
-
-using DSPropertyType = enum type {
- NONE,
- INTEGER, //int
- FLOAT, //float
- DOUBLE, //double
- STRING, //std::string
- POINTER, //void*
-};
-
-using DSPropertyVariant = std::variant<int, float, double, std::string, void *>;
-
-class DSPropertyPrivate
-{
-public:
- DSPropertyPrivate() = delete;
- DSPropertyPrivate(DSProperty *p_ptr);
- DSPropertyPrivate(DSProperty *p_ptr, std::string key, const DSPropertyVariant &data, DSPropertyType type);
- virtual ~DSPropertyPrivate();
-
- inline const DSProperty *p_func() const
- {
- return __p_ptr;
- }
-
-private:
- DSProperty *__p_ptr;
- std::string __key;
- DSPropertyVariant __data;
- DSPropertyType __type;
-
- const std::string __getKey(void) const;
- const DSPropertyVariant &__getData(void) const;
- const DSPropertyType __getType(void) const;
-
- void __setKey(std::string key);
- void __setData(DSPropertyVariant data, DSPropertyType type);
-
- friend class DSProperty;
-};
-
-} // namespace display_server
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSRenderEngineDaliImpl.h"
-#include "DSRenderViewDaliImpl.h"
-#include "DSDebugLog.h"
-
-#include <dali/devel-api/actors/actor-devel.h>
-
-#include <tbm_surface_queue.h>
-
-using namespace Dali;
-
-namespace display_server
-{
-
-DSRenderEngineDaliImpl::DSRenderEngineDaliImpl(std::shared_ptr<IDSBufferQueue> bufferQueue)
- : __bufferQueue(bufferQueue),
- __needToRender(false)
-{
- tbm_surface_queue_h nativeBufferQueue = (tbm_surface_queue_h)bufferQueue->getNativeBufferQueue();
- __offscreenApplication = OffscreenApplication::New(nativeBufferQueue, OffscreenApplication::RenderMode::MANUAL);
-
- __offscreenApplication.InitSignal().Connect(this, &DSRenderEngineDaliImpl::onInitialize);
-
- __offscreenApplication.Start();
-}
-
-DSRenderEngineDaliImpl::~DSRenderEngineDaliImpl()
-{
-}
-
-void DSRenderEngineDaliImpl::onInitialize()
-{
- OffscreenWindow window = __offscreenApplication.GetWindow();
- window.SetBackgroundColor(Color::TRANSPARENT);
-}
-
-std::shared_ptr<DSRenderView> DSRenderEngineDaliImpl::makeRenderView()
-{
- std::shared_ptr<DSRenderView> renderView = std::make_shared<DSRenderViewDaliImpl>(__offscreenApplication.GetWindow());
-
- // callbacks
- renderView->registerCallbackUpdated(this, std::bind(&DSRenderEngineDaliImpl::__onRenderViewUpdated, this, std::placeholders::_1));
-
- return renderView;
-}
-
-bool DSRenderEngineDaliImpl::renderFrame()
-{
- if (__needToRender) {
- Adaptor::Get().RenderOnce();
- DSLOG_DBG("DSRenderEngineDaliImpl", "RENDER RENDER RENDER~!!!!");
- }
-
- __needToRender = false;
-
- return true;
-}
-
-void DSRenderEngineDaliImpl::__onRenderViewUpdated(void *data)
-{
- if (!__needToRender) {
- DSLOG_DBG("DSRenderEngineDaliImpl", "Something updated on RenderView!! with buffer(%p)");
- __needToRender = true;
- }
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_RENDER_ENGINE_DALI_IMPL_H_
-#define __DS_RENDER_ENGINE_DALI_IMPL_H_
-
-#include "IDSRenderEngine.h"
-#include "IDSBufferQueue.h"
-
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali/devel-api/adaptor-framework/offscreen-application.h>
-#include <dali/devel-api/adaptor-framework/offscreen-window.h>
-#include <dali/integration-api/adaptor-framework/adaptor.h>
-
-namespace display_server
-{
-
-class DSRenderEngineDaliImpl : public IDSRenderEngine, public Dali::ConnectionTracker, public DSObject
-{
-public:
- DSRenderEngineDaliImpl(std::shared_ptr<IDSBufferQueue> bufferQueue);
- ~DSRenderEngineDaliImpl();
-
- std::shared_ptr<DSRenderView> makeRenderView() override;
- bool renderFrame() override;
-
- void onInitialize();
-
-private:
- void __onRenderViewUpdated(void *data);
-
- std::shared_ptr<IDSBufferQueue> __bufferQueue;
- Dali::OffscreenApplication __offscreenApplication;
-
- bool __needToRender;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSRenderEngineEcoreEvasImpl.h"
-#include "DSRenderViewEcoreEvasImpl.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-DSRenderEngineEcoreEvasImpl::DSRenderEngineEcoreEvasImpl(std::shared_ptr<IDSBufferQueue> bufferQueue)
- : __bufferQueue(bufferQueue),
- __bufferWidth{bufferQueue->getBufferWidth()},
- __bufferHeight{bufferQueue->getBufferHeight()},
- __ee{nullptr}
-{
- if (!evas_init()) {
- DSLOG_ERR("RENDER_ENGINE_ECORE_EVAS", "evas_init fails");
- }
-
- if (!ecore_evas_init()) {
- DSLOG_ERR("RENDER_ENGINE_ECORE_EVAS", "ecore_evas_init fails");
- }
-
- auto alloc_func = [](void *data, int w, int h) -> void * {
- IDSBufferQueue *bufferQueue = static_cast<IDSBufferQueue *>(data);
- void *nativeBufferQueue = bufferQueue->getNativeBufferQueue();
-
- return nativeBufferQueue;
- };
-
- auto free_func = [](void *data, void *tqueue) -> void {};
-
- __ee = ecore_evas_tbm_allocfunc_new("gl_tbm", __bufferWidth, __bufferHeight, alloc_func, free_func, (void *)bufferQueue.get());
- if (!__ee) {
- DSLOG_ERR("RENDER_ENGINE_ECORE_EVAS", "ecore_evas_tbm_allocfunc_new fails.");
- }
-
- ecore_evas_manual_render_set(__ee, 1);
- ecore_evas_show(__ee);
-}
-
-DSRenderEngineEcoreEvasImpl::~DSRenderEngineEcoreEvasImpl()
-{
- ecore_evas_free(__ee);
- ecore_evas_shutdown();
- evas_shutdown();
-}
-
-std::shared_ptr<DSRenderView> DSRenderEngineEcoreEvasImpl::makeRenderView()
-{
- std::shared_ptr<DSRenderView> renderView = std::make_shared<DSRenderViewEcoreEvasImpl>(__ee);
-
- return renderView;
-}
-
-bool DSRenderEngineEcoreEvasImpl::renderFrame()
-{
- ecore_evas_manual_render(__ee);
-
- return true;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_RENDER_ENGINE_ECORE_EVAS_IMPL_H_
-#define __DS_RENDER_ENGINE_ECORE_EVAS_IMPL_H_
-
-#include "IDSRenderEngine.h"
-#include "IDSBufferQueue.h"
-#include <Ecore_Evas.h>
-
-namespace display_server
-{
-
-class DSRenderEngineEcoreEvasImpl : public IDSRenderEngine
-{
-public:
- DSRenderEngineEcoreEvasImpl(std::shared_ptr<IDSBufferQueue> bufferQueue);
- ~DSRenderEngineEcoreEvasImpl();
-
- std::shared_ptr<DSRenderView> makeRenderView() override;
- bool renderFrame() override;
-
-private:
- std::shared_ptr<IDSBufferQueue> __bufferQueue;
- int __bufferWidth;
- int __bufferHeight;
- Ecore_Evas *__ee;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSRenderView.h"
-
-namespace display_server
-{
-
-DSRenderView::DSRenderView()
-{}
-
-DSRenderView::~DSRenderView()
-{}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_RENDER_VIEW_H__
-#define __DS_RENDER_VIEW_H__
-
-#include "IDSBuffer.h"
-#include "DSObject.h"
-#include "DSSignal.h"
-
-namespace display_server
-{
-
-class DSRenderView
-{
-public:
- DSRenderView();
- virtual ~DSRenderView();
-
- virtual bool setBuffer(std::shared_ptr<IDSBuffer> buffer) = 0;
- virtual void raiseToTop() = 0;
- virtual void lowerToBottom() = 0;
- virtual void setPosition(int x, int y) = 0;
- virtual void registerCallbackUpdated(DSObject *slot, std::function<void(void *)> func) = 0;
-
-private:
- /* data */
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSRenderViewDaliImpl.h"
-#include <tbm_surface.h>
-
-using namespace Dali;
-
-namespace display_server
-{
-
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- varying mediump vec2 vTexCoord;\n
- uniform highp mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- varying mediump vec2 sTexCoordRect;\n
- void main()\n
- {\n
- gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);\n
- vTexCoord = aPosition + vec2(0.5);\n
- }\n
-);
-
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
- uniform lowp vec4 uColor;\n
- varying mediump vec2 vTexCoord;\n
- uniform samplerExternalOES sTexture;\n
- void main()\n
- {\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
- }\n
-);
-
-Geometry DSRenderViewDaliImpl::CreateTexturedQuad()
-{
- struct Vertex
- {
- Vector2 position;
- Vector2 texCoord;
- };
-
- static const Vertex data[] = { { Vector2(-0.5f, -0.5f), Vector2(0.0f, 0.0f) },
- { Vector2(0.5f, -0.5f), Vector2(1.0f, 0.0f) },
- { Vector2(-0.5f, 0.5f), Vector2(0.0f, 1.0f) },
- { Vector2(0.5f, 0.5f), Vector2(1.0f, 1.0f) } };
-
- VertexBuffer vertexBuffer;
- Property::Map vertexFormat;
- vertexFormat["aPosition"] = Property::VECTOR2;
- vertexFormat["aTexCoord"] = Property::VECTOR2;
-
- //Create a vertex buffer for vertex positions and texture coordinates
- vertexBuffer = VertexBuffer::New(vertexFormat);
- vertexBuffer.SetData(data, 4u);
-
- //Create the geometry
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer(vertexBuffer);
- geometry.SetType(Geometry::TRIANGLE_STRIP);
-
- return geometry;
-}
-
-DSRenderViewDaliImpl::DSRenderViewDaliImpl(Dali::OffscreenWindow offscreenWindow)
- : __offscreenWindow(offscreenWindow)
-{
- std::string fragmentShader = "#extension GL_OES_EGL_image_external:require\n";
- fragmentShader += FRAGMENT_SHADER;
- Dali::Shader __shader = Shader::New(VERTEX_SHADER, fragmentShader);
- Dali::Geometry __geometry = DSRenderViewDaliImpl::CreateTexturedQuad();
-
- __renderer = Renderer::New(__geometry, __shader);
- __textureViewActor = Actor::New();
-
- __textureViewActor.AddRenderer(__renderer);
-
- // Actor's default properties
- __textureViewActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
- __textureViewActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
- __textureViewActor.SetProperty(Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
-
- offscreenWindow.Add(__textureViewActor);
-
- DSLOG_INF("DSRenderViewDaliImpl", "RenderView(%p) created.", this);
-}
-
-DSRenderViewDaliImpl::~DSRenderViewDaliImpl()
-{
- DSLOG_INF("DSRenderViewDaliImpl", "RenderView(%p) destroyed", this);
-
- __textureViewActor.RemoveRenderer(__renderer);
- __offscreenWindow.Remove(__textureViewActor);
-
- __updatedSignal.emit(nullptr);
-}
-
-bool DSRenderViewDaliImpl::setBuffer(std::shared_ptr<IDSBuffer> buffer)
-{
- if (buffer) {
- std::shared_ptr<stSize> bufferSize = buffer->getSize();
-
- __textureViewActor.SetProperty(Actor::Property::VISIBLE, true);
- __textureViewActor.SetProperty(Actor::Property::SIZE, Vector2(bufferSize->w, bufferSize->h));
-
- tbm_surface_h nativeBuffer = (tbm_surface_h)buffer->getNativeBuffer();
-
- NativeImageSourcePtr nativeImageSource = NativeImageSource::New(Any(nativeBuffer));
-
- Texture nativeTexture = Texture::New(*nativeImageSource);
-
- TextureSet textureSet = TextureSet::New();
- textureSet.SetTexture(0u, nativeTexture);
-
- __renderer.SetTextures(textureSet);
-
- DSLOG_INF("DSRenderViewDaliImpl", "Buffer set. buffer(%p) size(%d, %d)", buffer.get(), bufferSize->w, bufferSize->h);
- } else {
- __textureViewActor.SetProperty(Actor::Property::VISIBLE, false);
-
- DSLOG_INF("DSRenderViewDaliImpl", "buffer set NULL.");
- }
-
- __updatedSignal.emit(nullptr);
-
- return true;
-}
-
-void DSRenderViewDaliImpl::raiseToTop()
-{
- DSLOG_INF("DSRenderViewDaliImpl", "");
-
- __textureViewActor.SetProperty(Actor::Property::VISIBLE, true);
- __textureViewActor.RaiseToTop();
-
- __updatedSignal.emit(nullptr);
-}
-
-void DSRenderViewDaliImpl::lowerToBottom()
-{
- DSLOG_INF("DSRenderViewDaliImpl", "");
-
- __textureViewActor.SetProperty(Actor::Property::VISIBLE, true);
- __textureViewActor.LowerToBottom();
-
- __updatedSignal.emit(nullptr);
-}
-
-void DSRenderViewDaliImpl::setPosition(int x, int y)
-{
- DSLOG_INF("DSRenderViewDaliImpl", "");
-
- __textureViewActor.SetProperty(Actor::Property::VISIBLE, true);
- __textureViewActor.SetProperty(Actor::Property::POSITION, Vector3(x, y, 0.0f));
-
- __updatedSignal.emit(nullptr);
-}
-
-void DSRenderViewDaliImpl::registerCallbackUpdated(DSObject *slot, std::function<void(void *)> func)
-{
- __updatedSignal.connect(slot, func);
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_RENDER_VIEW_DALI_IMPL_H_
-#define __DS_RENDER_VIEW_DALI_IMPL_H_
-
-#include "DSRenderView.h"
-#include "DSObject.h"
-
-#include <dali/dali.h>
-#include <dali/public-api/actors/actor.h>
-#include <dali/devel-api/adaptor-framework/offscreen-window.h>
-
-namespace display_server
-{
-
-class DSRenderViewDaliImpl : public DSRenderView, public DSObject
-{
-public:
- DSRenderViewDaliImpl(Dali::OffscreenWindow offscreenWindow);
- ~DSRenderViewDaliImpl();
-
- bool setBuffer(std::shared_ptr<IDSBuffer> buffer) override;
- void raiseToTop() override;
- void lowerToBottom() override;
- void setPosition(int x, int y) override;
-
- void registerCallbackUpdated(DSObject *slot, std::function<void(void *)> func) override;
-
- Dali::Geometry CreateTexturedQuad();
-
-private:
- void __onWindowBufferChanged(std::shared_ptr<IDSBuffer> buffer);
- void __onWindowRaiseToTopChanged(void *data);
- void __onWindowLowerToBottomChanged(void *data);
- void __onWindowPositionChanged(void *data);
-
- Dali::OffscreenWindow __offscreenWindow;
- Dali::Renderer __renderer;
- Dali::Actor __textureViewActor;
-
- DSSignal<void *> __updatedSignal;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSRenderViewEcoreEvasImpl.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-DSRenderViewEcoreEvasImpl::DSRenderViewEcoreEvasImpl(Ecore_Evas *ee)
-{
- __evasView = evas_object_image_filled_add(ecore_evas_get(ee));
- evas_object_image_border_center_fill_set(__evasView, EVAS_BORDER_FILL_SOLID);
- evas_object_image_colorspace_set(__evasView, EVAS_COLORSPACE_ARGB8888);
-}
-
-DSRenderViewEcoreEvasImpl::~DSRenderViewEcoreEvasImpl()
-{
- evas_object_del(__evasView);
-}
-
-bool DSRenderViewEcoreEvasImpl::setBuffer(std::shared_ptr<IDSBuffer> buffer)
-{
- Evas_Native_Surface ns;
-
- ns.type = EVAS_NATIVE_SURFACE_TBM;
- ns.version = EVAS_NATIVE_SURFACE_VERSION;
- ns.data.tbm.buffer = buffer->getNativeBuffer();
- evas_object_image_native_surface_set(__evasView, &ns);
-
- std::shared_ptr<stSize> bufferSize = buffer->getSize();
-
- evas_object_image_size_set(__evasView, bufferSize->w, bufferSize->h);
- evas_object_image_pixels_dirty_set(__evasView, 1);
- evas_object_resize(__evasView, bufferSize->w, bufferSize->h);
- evas_object_show(__evasView);
-
- DSLOG_INF("DSRenderViewEcoreEvasImpl", "Window Buffer changed. buffer(%p) size(%d, %d)", buffer.get(), bufferSize->w, bufferSize->h);
-
- return true;
-}
-
-void DSRenderViewEcoreEvasImpl::raiseToTop()
-{
- //TODO:
-}
-
-void DSRenderViewEcoreEvasImpl::lowerToBottom()
-{
- //TODO:
-}
-
-void DSRenderViewEcoreEvasImpl::setPosition(int x, int y)
-{
- //TODO:
-}
-
-void DSRenderViewEcoreEvasImpl::registerCallbackUpdated(DSObject *slot, std::function<void(void *)> func)
-{
- // No updated signal at ecore evas implementation yet.
- //__updatedSignal.connect(slot, func);
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_RENDER_VIEW_ECORE_EVAS_IMPL_H_
-#define __DS_RENDER_VIEW_ECORE_EVAS_IMPL_H_
-
-#include "DSRenderView.h"
-#include "DSObject.h"
-#include <Ecore_Evas.h>
-
-namespace display_server
-{
-
-class DSRenderViewEcoreEvasImpl : public DSRenderView, public DSObject
-{
-public:
- DSRenderViewEcoreEvasImpl(Ecore_Evas *ee);
- ~DSRenderViewEcoreEvasImpl();
-
- bool setBuffer(std::shared_ptr<IDSBuffer> buffer) override;
- void raiseToTop() override;
- void lowerToBottom() override;
- void setPosition(int x, int y) override;
-
- void registerCallbackUpdated(DSObject *slot, std::function<void(void *)> func) override;
-
-private:
- Evas_Object *__evasView;
-
- DSSignal<void *> __updatedSignal;
-};
-
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __I_DS_RENDER_ENGINE_H_
-#define __I_DS_RENDER_ENGINE_H_
-
-#include "DSRenderView.h"
-
-namespace display_server
-{
-
-class IDSRenderEngine
-{
-public:
- virtual ~IDSRenderEngine() = default;
-
- virtual std::shared_ptr<DSRenderView> makeRenderView() = 0;
- virtual bool renderFrame() = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-# DSRender
-Render and View.
-
-## Requirements
-### Render
- * Renderer를 Trigger할 수 있어야 한다. (feat. ecore_evas_manual_render())
- ** View들의 상하관계에 따라서 Rendering을 DSTBUFFER(????????)에 할 수 있어야 한다.
- * View들을 Renderer에 add할 수 있어야 한다.
- * tbm_surface_queue를 Renderer에 setting할 수 있어야 한다.
- * Renderer는 size가 있어야 한다.(feat. canvas)
- * <<향후 추가>>
-### View
- * View는 Renderer의 Src이다.
- * buffer를 View에 넣어 View 내부적으로 texture mapping할 수 있어야 한다.
- * View는 Render좌표계에서 상대좌표를 가진다.(x,y)
- * View는 size를 가진다.
- * View의 position은 Renderer size를 벗어날 수 있다.(?)
- * <<향후 추가>>
+++ /dev/null
-class Client
-{
-}
-
-interface IDSRenderEngine
-{
- + virtual std::shared_ptr<DSRenderView> makeRenderView() = 0;
- + virtual bool renderFrame() = 0;
-}
-
-Client "1" o-right- "0..*" IDSRenderEngine
-
-DSRenderEngineEcoreEvasImpl -up..|> IDSRenderEngine
-DSRenderEngineDaliImpl -up..|> IDSRenderEngine
-
-class DSRenderEngineEcoreEvasImpl
-{
-}
-
-class DSRenderEngineDaliImpl
-{
-}
-
-abstract class DSRenderView
-{
- + virtual bool setBuffer(std::shared_ptr<IDSBuffer> buffer) = 0;
-}
-
-DSRenderView <|-down-- DSRenderViewEcoreEvasImpl
-DSRenderView <|-down-- DSRenderViewDaliImpl
-
-
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSKeyboard.h"
-#include "DSSeat.h"
-#include "DSWindow.h"
-#include "DSInputEvent.h"
-#include "DSWaylandKeyboard.h"
-#include "DSWaylandSurface.h"
-
-namespace display_server
-{
-
-DSKeyboard::DSKeyboard(DSSeat *seat)
- : __seat(seat),
- __dswlKeyboard(nullptr),
- __dswlCompositor(nullptr),
- __kbdFocus(nullptr)
-{
- if (nullptr == __dswlKeyboard)
- {
- //TODO : register slot for monitoring the creation of DSWaylandKeyboard
- ;
- }
-}
-
-DSKeyboard::DSKeyboard(DSSeat *seat, DSWaylandKeyboard *keyboard)
- : __seat(seat),
- __dswlKeyboard(keyboard),
- __dswlCompositor(nullptr),
- __kbdFocus(nullptr)
-{
-}
-
-DSKeyboard::~DSKeyboard()
-{}
-
-/*LCOV_EXCL_START*/
-void DSKeyboard::processEvent(DSInputKeyboardEvent *ev, void *data)
-{
- //TODO : get kbdFocus and send event to it via DSWaylandKeyboard instance
-
- if (!__kbdFocus)
- {
- DSLOG_ERR("DSKeyboard", "No kbdFocus available.");
- return;
- }
-
- if (ev->getType() == DSInputEvent::KeyDownEvent)
- {
- DSLOG_DBG("DSSeat", "[keyDown] name: %s, keycode: %d, devicename: %s, timestamp: %u\n",
- ev->getKeyname().c_str(), ev->getKeycode(), ev->getDevice()->getName().c_str(), ev->getTimestamp());
- keyDown(ev->getKeycode());
- }
- else
- {
- DSLOG_DBG("DSSeat", "[keyUp] name: %s, keycode: %d, devicename: %s, timestamp: %u\n",
- ev->getKeyname().c_str(), ev->getKeycode(), ev->getDevice()->getName().c_str(), ev->getTimestamp());
- keyDown(ev->getKeycode());
- }
-
-}
-/*LCOV_EXCL_STOP*/
-
-void DSKeyboard::keyDown(uint32_t keycode)
-{
- if (__dswlKeyboard)
- {
- __dswlKeyboard->sendKeyDown(keycode);
- }
-}
-
-void DSKeyboard::keyUp(uint32_t keycode)
-{
- if (__dswlKeyboard)
- {
- __dswlKeyboard->sendKeyUp(keycode);
- }
-}
-
-void DSKeyboard::setRepeatRate(uint32_t rate)
-{
- if (__dswlKeyboard)
- {
- __dswlKeyboard->setRepeatRate(rate);
- }
-}
-
-void DSKeyboard::setRepeatDelay(uint32_t delay)
-{
- if (__dswlKeyboard)
- {
- __dswlKeyboard->setRepeatDelay(delay);
- }
-}
-
-/*LCOV_EXCL_START*/
-void DSKeyboard::setFocus(std::shared_ptr<DSWindow> window)
-{
- if (!window)
- {
- DSLOG_ERR("DSKeyboard", "Given window is INVALID. (window : %p)", window);
- __kbdFocus = window;
- if (__dswlKeyboard)
- __dswlKeyboard->setFocus(nullptr);
- return;
- }
-
- DSWaylandSurface * waylandSurface = window->surface();
-
- if (!waylandSurface)
- {
- DSLOG_ERR("DSKeyboard", "Wayland surface of the given window is INVALID. (window : %p (%p), surface : %p)", window, window.get(), waylandSurface);
- return;
- }
-
- DSLOG_INF("DSKeyboard", "focus window has been changed. (%p -> %p)", __kbdFocus ? __kbdFocus.get() : nullptr, window ? window.get() : nullptr);
- __kbdFocus = window;
-
- if (!__dswlKeyboard)
- {
- DSLOG_ERR("DSKeyboard", "waylandKeyboard is NOT available !");
- return;
- }
-
- __dswlKeyboard->setFocus(waylandSurface);
-
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSKeyboard::resetFocus()
-{
- if (__kbdFocus)
- {
- __kbdFocus = nullptr;
- DSLOG_INF("DSKeyboard", "kbdFocus has been reset.");
- }
-
- if (__dswlKeyboard)
- __dswlKeyboard->resetFocus();
-}
-/*LCOV_EXCL_STOP*/
-
-std::shared_ptr<DSWindow> DSKeyboard::getFocus()
-{
- return __kbdFocus;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DSKEYBOARD_H__
-#define __DSKEYBOARD_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSSeat;
-class DSWindow;
-class DSInputKeyboardEvent;
-class DSWaylandKeyboard;
-class DSWaylandCompositor;
-
-class DSKeyboard : public DSObject
-{
-public:
- DSKeyboard() = delete;
- DSKeyboard(DSSeat *seat);
- DSKeyboard(DSSeat *seat, DSWaylandKeyboard *keyboard);
- virtual ~DSKeyboard();
-
- void processEvent(DSInputKeyboardEvent *ev, void *data);
-
- void keyDown(uint32_t keycode);
- void keyUp(uint32_t keycode);
-
- void setRepeatRate(uint32_t rate);
- void setRepeatDelay(uint32_t delay);
-
- void setFocus(std::shared_ptr<DSWindow> window);
- void resetFocus();
- std::shared_ptr<DSWindow> getFocus();
-
-private:
- DSSeat *__seat;
- DSWaylandKeyboard *__dswlKeyboard;
- DSWaylandCompositor *__dswlCompositor;
- std::shared_ptr<DSWindow> __kbdFocus;
-};
-
-}
-
-#endif //__DSKEYBOARD_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSPointer.h"
-#include "DSSeat.h"
-#include "DSWindow.h"
-#include "DSInputEvent.h"
-#include "DSWaylandPointer.h"
-#include "DSWaylandSurface.h"
-#include "DSStruct.h"
-
-namespace display_server
-{
-
-DSPointer::DSPointer(DSSeat *seat)
- : __seat(seat),
- __dswlPointer(nullptr),
- __dswlCompositor(nullptr),
- __ptrFocus(nullptr)
-{
-}
-
-DSPointer::DSPointer(DSSeat *seat, DSWaylandPointer *pointer)
- : __seat(seat),
- __dswlPointer(pointer),
- __dswlCompositor(nullptr),
- __ptrFocus(nullptr)
-{
-}
-
-DSPointer::~DSPointer()
-{}
-
-/*LCOV_EXCL_START*/
-void DSPointer::processEvent(DSInputMouseEvent *ev, void *data)
-{
- //TODO : get ptrFocus and send event to it via DSWaylandPointer instance
-
- if (!__ptrFocus)
- {
- DSLOG_ERR("DSPointer", "No ptrFocus available.");
- return;
- }
-
- if (ev->getType() == DSInputEvent::MouseInEvent)
- {
- DSLOG_DBG("DSTouch", "[mouseIn] devicename: %s, timestamp: %u, x: %d (winX: %d), y: %d (winY: %d)\n",
- ev->getDevice()->getName().c_str(), ev->getTimestamp(),
- ev->getX(), ev->getWinX(), ev->getY(), ev->getWinY());
- mouseIn(ev->getWinX(), ev->getWinY());
- }
- else if (ev->getType() == DSInputEvent::MouseOutEvent)
- {
- DSLOG_DBG("DSTouch", "[mouseOut] devicename: %s, timestamp: %u\n",
- ev->getDevice()->getName().c_str(), ev->getTimestamp());
- mouseOut();
- }
- else if (ev->getType() == DSInputEvent::MouseDownEvent)
- {
- DSLOG_DBG("DSTouch", "[MouseDown] devicename: %s, timestamp: %u\n",
- ev->getDevice()->getName().c_str(), ev->getTimestamp());
- mouseDown(ev->getButton());
- }
- else if (ev->getType() == DSInputEvent::MouseMoveEvent)
- {
- DSLOG_DBG("DSTouch", "[mouseMove] devicename: %s, timestamp: %u, x: %d (winX: %d), y: %d (winY: %d)\n",
- ev->getDevice()->getName().c_str(), ev->getTimestamp(),
- ev->getX(), ev->getWinX(), ev->getY(), ev->getWinY());
- mouseMove(ev->getWinX(), ev->getWinY());
- }
- else if (ev->getType() == DSInputEvent::MouseUpEvent)
- {
- DSLOG_DBG("DSTouch", "[mouseUp] devicename: %s, timestamp: %u\n",
- ev->getDevice()->getName().c_str(), ev->getTimestamp());
- mouseUp(ev->getButton());
- }
- else
- {
- DSLOG_INF("DSPointer", "Event type %d won't be handled right now.", ev->getType());
- return;
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSPointer::mouseDown(uint32_t button)
-{
- if (__ptrFocus && __dswlPointer)
- {
- __dswlPointer->sendButtonDown(button);
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSPointer::mouseUp(uint32_t button)
-{
- if (__ptrFocus && __dswlPointer)
- {
- __dswlPointer->sendButtonUp(button);
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSPointer::mouseMove(int x, int y)
-{
- if (__ptrFocus && __dswlPointer)
- {
- __dswlPointer->sendMotion(x, y);
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSPointer::mouseIn(int x, int y)
-{
- if (__dswlPointer)
- {
- __dswlPointer->sendEnter(x, y);
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSPointer::mouseOut()
-{
- if (__dswlPointer)
- {
- __dswlPointer->sendLeave();
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSPointer::setFocus(std::shared_ptr<DSWindow> window)
-{
- if (!window)
- {
- DSLOG_ERR("DSPointer", "__ptrFocus has been changed (%p -> %p)", __ptrFocus, window);
- __ptrFocus = window;
- if (__dswlPointer)
- __dswlPointer->setFocus(nullptr);
- return;
- }
-
- DSWaylandSurface * waylandSurface = window->surface();
-
- if (!waylandSurface)
- {
- DSLOG_ERR("DSPointer", "Wayland surface of the given window is INVALID. (window : %p, surface : %p)", window, waylandSurface);
- return;
- }
-
- DSLOG_INF("DSPointer", "focus window has been changed. (%p -> %p)", __ptrFocus, window);
- __ptrFocus = window;
-
- if (!__dswlPointer)
- {
- DSLOG_ERR("DSPointer", "waylandPointer is NOT available !");
- return;
- }
-
- __dswlPointer->setFocus(waylandSurface);
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSPointer::resetFocus()
-{
- if (__ptrFocus)
- {
- __ptrFocus = nullptr;
- DSLOG_INF("DSPointer", "ptrFocus has been reset.");
- }
-
- if (__dswlPointer)
- __dswlPointer->resetFocus();
-}
-/*LCOV_EXCL_STOP*/
-
-std::shared_ptr<DSWindow> DSPointer::getFocus()
-{
- return __ptrFocus;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DSPOINTER_H__
-#define __DSPOINTER_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSSeat;
-class DSWindow;
-class DSInputMouseEvent;
-class DSWaylandPointer;
-class DSWaylandCompositor;
-
-class DSPointer : public DSObject
-{
-public:
- DSPointer() = delete;
- DSPointer(DSSeat *seat);
- DSPointer(DSSeat *seat, DSWaylandPointer *pointer);
- virtual ~DSPointer();
-
- void processEvent(DSInputMouseEvent *ev, void *data);
- void mouseDown(uint32_t button);
- void mouseUp(uint32_t button);
- void mouseMove(int x, int y);
- void mouseIn(int x, int y);
- void mouseOut();
- void setFocus(std::shared_ptr<DSWindow> window);
- void resetFocus();
- std::shared_ptr<DSWindow> getFocus();
-
-private:
- DSSeat *__seat;
- DSWaylandPointer *__dswlPointer;
- DSWaylandCompositor *__dswlCompositor;
- std::shared_ptr<DSWindow> __ptrFocus;
-};
-
-}
-
-#endif //__DSPOINTER_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSSeat.h"
-#include "DSInput.h"
-#include "DSCompositor.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandCompositor.h"
-#include "DSInputEvent.h"
-#include "DSXkb.h"
-#include "DSZone.h"
-#include "DSWindow.h"
-
-#include "DSPointer.h"
-#include "DSKeyboard.h"
-#include "DSTouch.h"
-#include "DSWaylandPointer.h"
-#include "DSWaylandKeyboard.h"
-#include "DSWaylandTouch.h"
-
-namespace display_server
-{
-
-DSSignal<DSInputKeyboardEvent *> DSSeat::__signalHandleKeyEvent;
-DSSignal<DSInputMouseEvent *> DSSeat::__signalHandlePointerEvent;
-DSSignal<DSInputTouchEvent *> DSSeat::__signalHandleTouchEvent;
-
-DSSeat::DSSeat()
- : __input(nullptr),
- __dswlSeat(nullptr),
- __dswlComp(nullptr),
- __compositor(nullptr),
- __xkb(new DSXkb(this)),
- __zone(nullptr),
- __keyboard(nullptr),
- __pointer(nullptr),
- __touch(nullptr),
- __numPointer(0),
- __numKeyboard(0),
- __numTouch(0),
- __focusWin(nullptr),
- __stackChanged(false)
-{
-}
-
-DSSeat::DSSeat(DSCompositor *compositor, std::string name)
- : __input(nullptr),
- __dswlSeat(nullptr),
- __dswlComp(nullptr),
- __compositor(compositor),
- __xkb(new DSXkb(this)),
- __zone(nullptr),
- __keyboard(nullptr),
- __pointer(nullptr),
- __touch(nullptr),
- __numPointer(0),
- __numKeyboard(0),
- __numTouch(0),
- __focusWin(nullptr),
- __stackChanged(false)
-{
- if (!compositor)
- return;
-
- __dswlComp = DSWaylandCompositor::getInstance();
- DS_ASSERT(__dswlComp != nullptr);
-
- __dswlSeat = __dswlComp->addSeat(DSWaylandSeat::capNone);
- DS_ASSERT(__dswlSeat != nullptr);
-
- __dswlSeat->setXkb(__xkb);
-
- if (!name.empty())
- __dswlSeat->setName(name);
-
- __input = new DSInput(this, __xkb);
- DS_ASSERT(__input != nullptr);
-
- __initSlots();
- __initEventHandlers();
- __input->init();
-}
-
-DSSeat::~DSSeat()
-{
- if (__input)
- delete __input;
-
- if (__dswlComp && __dswlSeat)
- __dswlComp->removeSeat(__dswlSeat);
-
- if (__dswlComp)
- DSWaylandCompositor::releaseInstance();
-}
-
-void DSSeat::__initSlots()
-{
- __signalHandleKeyEvent.connect(this, std::bind(&DSSeat::__onKeyEvent, this, std::placeholders::_1));
- __signalHandlePointerEvent.connect(this, std::bind(&DSSeat::__onPointerEvent, this, std::placeholders::_1));
- __signalHandleTouchEvent.connect(this, std::bind(&DSSeat::__onTouchEvent, this, std::placeholders::_1));
-}
-
-void DSSeat:: __initEventHandlers()
-{
- __input->registerCallbackDeviceAdd(this, std::bind(&DSSeat::slotDeviceAdd, this, std::placeholders::_1));
- __input->registerCallbackDeviceRemove(this, std::bind(&DSSeat::slotDeviceRemove, this, std::placeholders::_1));
- __input->registerCallbackKeyDown(this, inputEventHandlerKey);
- __input->registerCallbackKeyUp(this, inputEventHandlerKey);
- __input->registerCallbackMouseDown(this, inputEventHandlerMouse);
- __input->registerCallbackMouseMove(this, inputEventHandlerMouse);
- __input->registerCallbackMouseUp(this, inputEventHandlerMouse);
- __input->registerCallbackTouchDown(this, inputEventHandlerTouch);
- __input->registerCallbackTouchMove(this, inputEventHandlerTouch);
- __input->registerCallbackTouchUp(this, inputEventHandlerTouch);
-}
-
-bool DSSeat::attachZone(std::shared_ptr<DSZone> zone)
-{
- DSLOG_INF("DSSeat", "The attached zone has been changed (%p -> %p)", __zone, zone);
-
- __zone = zone;
- __zone->registerCallbackWindowCreated(this, std::bind(&DSSeat::__onWindowCreated, this, std::placeholders::_1));
- __zone->registerCallbackWindowStackChanged(this, std::bind(&DSSeat::__onWindowStackChanged, this, std::placeholders::_1));
- __zone->registerCallbackWindowDestroy(this, std::bind(&DSSeat::__onWindowDestroy, this, std::placeholders::_1));
-
- return true;
-}
-
-std::shared_ptr<DSZone> DSSeat::getZone()
-{
- return __zone;
-}
-
-bool DSSeat::detachZone()
-{
- if (!__zone)
- {
- DSLOG_ERR("DSSeat", "No Zone is not available !");
- return false;
- }
-
- //__zone->deregisterCallbackWindowCreated(this, std::bind(&DSSeat::__onWindowCreated, this, std::placeholders::_1));
-
- DSLOG_INF("DSSeat", "Zone(%p) has been detached !", __zone);
- __zone = nullptr;
-
- return true;
-}
-
-void DSSeat::slotDeviceAdd(std::shared_ptr<DSInputDevice> device)
-{
- DSLOG_INF("DSSeat", "");
- device->print();
-
- uint32_t cap = (uint32_t)__dswlSeat->getCapability();
-
- if ((device->getClass() == DSInput::PointerClass) && (__numPointer++ == 0))
- {
- cap = cap | DSWaylandSeat::capPointer;
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- DSWaylandPointer *dswlPointer = __dswlSeat->getPointer();
- __pointer = new DSPointer(this, dswlPointer);
- DS_ASSERT(__pointer != nullptr);
- }
- else if ((device->getClass() == DSInput::KeyboardClass) && (__numKeyboard++ == 0))
- {
- cap = cap | DSWaylandSeat::capKeyboard;
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- DSWaylandKeyboard *dswlKeyboard = __dswlSeat->getKeyboard();
- __keyboard = new DSKeyboard(this, dswlKeyboard);
- DS_ASSERT(__keyboard != nullptr);
- }
- else if ((device->getClass() == DSInput::TouchClass) && (__numTouch++ == 0))
- {
- cap = cap | DSWaylandSeat::capTouch;
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- DSWaylandTouch *dswlTouch = __dswlSeat->getTouch();
- __touch = new DSTouch(this, dswlTouch);
- DS_ASSERT(__touch != nullptr);
- }
-}
-
-/*LCOV_EXCL_START*/
-void DSSeat::slotDeviceRemove(std::shared_ptr<DSInputDevice> device)
-{
- DSLOG_INF("DSSeat", "");
- device->print();
-
- uint32_t cap = (uint32_t)__dswlSeat->getCapability();
- bool capNeedUpdate = false;
-
- if ((device->getClass() == DSInput::PointerClass) && ((--__numPointer) == 0))
- {
- cap = cap & (~DSWaylandSeat::capPointer);
- capNeedUpdate = true;
-
- if (__pointer)
- {
- delete __pointer;
- __pointer = nullptr;
- }
- }
- else if ((device->getClass() == DSInput::KeyboardClass) && ((--__numKeyboard) == 0))
- {
- cap = cap & (~DSWaylandSeat::capKeyboard);
- capNeedUpdate = true;
-
- if (__keyboard)
- {
- delete __keyboard;
- __keyboard = nullptr;
- }
- }
- else if ((device->getClass() == DSInput::TouchClass) && ((--__numTouch) == 0))
- {
- cap = cap & (~DSWaylandSeat::capTouch);
- capNeedUpdate = true;
-
- if (__touch)
- {
- delete __touch;
- __touch = nullptr;
- }
- }
-
- if (capNeedUpdate)
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-}
-/*LCOV_EXCL_STOP*/
-
-void DSSeat::addPointer()
-{
- if (0 < __numPointer)
- {
- DSLOG_INF("DSSeat", "Pointer exists already. (num=%d)", __numPointer);
- __numPointer++;
- return;
- }
-
- uint32_t cap = (uint32_t)__dswlSeat->getCapability();
- cap = cap | DSWaylandSeat::capPointer;
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- DSWaylandPointer *dswlPointer = __dswlSeat->getPointer();
- __pointer = new DSPointer(this, dswlPointer);
- DS_ASSERT(__pointer != nullptr);
-
- __numPointer++;
-}
-
-/*LCOV_EXCL_START*/
-void DSSeat::addKeyboard()
-{
- if (0 < __numKeyboard)
- {
- DSLOG_INF("DSSeat", "Keyboard exists already. (num=%d)", __numKeyboard);
- __numKeyboard++;
- return;
- }
-
- uint32_t cap = (uint32_t)__dswlSeat->getCapability();
- cap = cap | DSWaylandSeat::capKeyboard;
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- DSWaylandKeyboard *dswlKeyboard = __dswlSeat->getKeyboard();
- __keyboard = new DSKeyboard(this, dswlKeyboard);
- DS_ASSERT(__keyboard != nullptr);
-
- __numKeyboard++;
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::addTouch()
-{
- if (0 < __numTouch)
- {
- DSLOG_INF("DSSeat", "Touch exists already. (num=%d)", __numTouch);
- __numTouch++;
- return;
- }
-
- uint32_t cap = (uint32_t)__dswlSeat->getCapability();
- cap = cap | DSWaylandSeat::capTouch;
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- DSWaylandTouch *dswlTouch = __dswlSeat->getTouch();
- __touch = new DSTouch(this, dswlTouch);
- DS_ASSERT(__touch != nullptr);
-
- __numTouch++;
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::removePointer()
-{
- if (0 >= __numPointer)
- {
- DSLOG_INF("DSSeat", "No pointer exists already. (num=%d)", __numPointer);
- return;
- }
-
- DS_ASSERT(__pointer != nullptr);
- --__numPointer;
-
- if (0 == __numPointer)
- {
- uint32_t cap = (uint32_t)__dswlSeat->getCapability();
- cap = cap & (~DSWaylandSeat::capPointer);
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- delete __pointer;
- __pointer = nullptr;
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::removeKeyboard()
-{
- if (0 >= __numKeyboard)
- {
- DSLOG_INF("DSSeat", "No keyboard exists already. (num=%d)", __numKeyboard);
- return;
- }
-
- DS_ASSERT(__keyboard != nullptr);
- --__numKeyboard;
-
- if (0 == __numKeyboard)
- {
- uint32_t cap = (uint32_t)__dswlSeat->getCapability();
- cap = cap & (~DSWaylandSeat::capKeyboard);
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- delete __keyboard;
- __keyboard = nullptr;
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::removeTouch()
-{
- if (0 >= __numTouch)
- {
- DSLOG_INF("DSSeat", "No touch exists already. (num=%d)", __numTouch);
- return;
- }
-
- DS_ASSERT(__touch != nullptr);
- --__numTouch;
-
- if (0 == __numTouch)
- {
- uint32_t cap = (uint32_t)__dswlSeat->getCapability();
- cap = cap & (~DSWaylandSeat::capTouch);
- __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
-
- delete __touch;
- __touch = nullptr;
- }
-}
-/*LCOV_EXCL_STOP*/
-
-bool DSSeat::hasPointer()
-{
- return !!__numPointer;
-}
-
-bool DSSeat::hasKeyboard()
-{
- return !!__numKeyboard;
-}
-
-bool DSSeat::hasTouch()
-{
- return !!__numTouch;
-}
-
-DSXkb *DSSeat::getXkb()
-{
- return __xkb;
-}
-
-std::string DSSeat::getName()
-{
- return __dswlSeat->getName();
-}
-
-/*LCOV_EXCL_START*/
-void DSSeat::__onKeyEvent(DSInputKeyboardEvent *ev)
-{
- if (__keyboard == nullptr)
- {
- DSLOG_DBG("DSSeat", "No keyboard device exists. Key events will be dropped.");
- return;
- }
-
- __dswlSeat->setCurrentEventTime(ev->getTimestamp());
- __keyboard->processEvent(ev, nullptr);
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::__onPointerEvent(DSInputMouseEvent *ev)
-{
- if (__pointer == nullptr)
- {
- DSLOG_DBG("DSSeat", "No pointer device exists. Mouse events will be dropped.");
- return;
- }
-
- __dswlSeat->setCurrentEventTime(ev->getTimestamp());
-
- if (ev->getType() == DSInputEvent::MouseMoveEvent)
- {
- //get window whose geometry has intersection with the mouse coordinates
- auto window = getTopWindowOnPosition(ev->getX(), ev->getY());
-
- //check if the window is equal to the current pointer focus window
- auto currentPointerFocus = __pointer->getFocus();
-
- //if equal, no need to set focus / pointer enter/leave activities
- if (window.get() != currentPointerFocus.get())
- {
- //if not equal, send pointer leave to the current pointer focus window
- std::shared_ptr evMouseOut = std::make_shared<DSInputMouseEvent>(ev->getDevice(), DSInputEvent::MouseOutEvent, ev->getTimestamp(), ev->getButton(), ev->getX(), ev->getY(), 0);
- __pointer->processEvent(evMouseOut.get(), nullptr);
- //TODO : emit MouseOut signal
-
- //set the window as pointer focus window
- if (window)
- {
- int winX;
- int winY;
- stPosition pos;
-
- pos = window->getPosition();
- winX = ev->getX() - pos.x;
- winY = ev->getY() - pos.y;
- ev->setWinX(winX);
- ev->setWinY(winY);
-
- __pointer->setFocus(window);
- }
-
- //send pointer enter to the new pointer focus window
- std::shared_ptr evMouseIn = std::make_shared<DSInputMouseEvent>(ev->getDevice(), DSInputEvent::MouseInEvent, ev->getTimestamp(), ev->getButton(), 0, 0, 0);
- __pointer->processEvent(evMouseIn.get(), nullptr);
- //TODO : emit MouseIn signal
- }
- }
-
- __pointer->processEvent(ev, nullptr);
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::__onTouchEvent(DSInputTouchEvent *ev)
-{
- int winX;
- int winY;
- stPosition pos;
-
- if (__touch == nullptr)
- {
- DSLOG_DBG("DSSeat", "No touch device exists. Touch events will be dropped.");
- return;
- }
-
- if (ev->getType() == DSInputEvent::TouchDownEvent)
- {
- //get window whose geometry has intersection with the touch coordinates
- auto window = getTopWindowOnPosition(ev->getX(), ev->getY());
-
- DSLOG_INF("DSSeat", "window=%p, window.get()=%p", window, window.get());
-
- //set the window as touch focus window
- if (window)
- {
- pos = window->getPosition();
- winX = ev->getX() - pos.x;
- winY = ev->getY() - pos.y;
- ev->setWinX(winX);
- ev->setWinY(winY);
-
- __touch->setFocus(window);
- }
-
- //TODO : emit touch focus changed signal
- }
- else if (ev->getType() == DSInputEvent::TouchMoveEvent)
- {
- auto window = __touch->getFocus();
-
- if (window)
- {
- pos = window->getPosition();
- winX = ev->getX() - pos.x;
- winY = ev->getY() - pos.y;
- ev->setWinX(winX);
- ev->setWinY(winY);
- }
- }
-
- __dswlSeat->setCurrentEventTime(ev->getTimestamp());
- __touch->processEvent(ev, nullptr);
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::__onWindowStackChanged(std::shared_ptr<DSWindow> topWindow)
-{
- __stackChanged = true;
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::__onWindowCreated(std::shared_ptr<DSWindow> window)
-{
- DSLOG_INF("DSSeat", "window created : %p (%p)", window, window.get());
-
- /* FIXME : get focus window for keyboard from DSWindowManager/DSWindowPolicy later */
- if (__keyboard)
- {
- std::shared_ptr<DSWindow> focusWin = getTopWindow(nullptr);
- DSWindow *currentWin = __focusWin ? __focusWin.get() : nullptr;
- DSWindow *newWin = focusWin ? focusWin.get() : nullptr;
-
- if (currentWin != newWin)
- {
- DSLOG_INF("DSSeat", "keyboard focus : %p -> %p", currentWin, newWin);
-
- if (focusWin)
- {
- if (__focusWin && __focusWin->hasFocus())
- __focusWin->unsetFocus();
-
- __focusWin = focusWin;
- __keyboard->setFocus(focusWin);
- focusWin->setFocus();
- }
- }
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSSeat::__onWindowDestroy(std::shared_ptr<DSWindow> window)
-{
- DSLOG_INF("DSSeat", "window destroy : %p (%p)", window, window.get());
-
- std::shared_ptr<DSWindow> currentFocus = nullptr;
-
- if (__keyboard && (currentFocus = __keyboard->getFocus()) && (currentFocus.get() == window.get()))
- __keyboard->resetFocus();
- if (__pointer && (currentFocus = __pointer->getFocus()) && (currentFocus.get() == window.get()))
- __pointer->resetFocus();
- if (__touch && (currentFocus = __touch->getFocus()) && (currentFocus.get() == window.get()))
- __touch->resetFocus();
-
- /* FIXME : get focus window for keyboard from DSWindowManager/DSWindowPolicy later */
- if (__keyboard)
- {
- std::shared_ptr<DSWindow> focusWin = getTopWindow(window);
- DSWindow *currentWin = __focusWin ? __focusWin.get() : nullptr;
- DSWindow *newWin = focusWin ? focusWin.get() : nullptr;
-
- if (currentWin != newWin)
- {
- DSLOG_INF("DSSeat", "keyboard focus : %p -> %p", currentWin, newWin);
-
- if (focusWin)
- {
- if (__focusWin && __focusWin->hasFocus())
- __focusWin->unsetFocus();
-
- __focusWin = focusWin;
- __keyboard->setFocus(focusWin);
- focusWin->setFocus();
- }
- else
- {
- __focusWin = nullptr;
- }
- }
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-Eina_Bool DSSeat::inputEventHandlerKey(void *data, int type, void *event)
-{
- DSInputKeyboardEvent *ev = static_cast< DSInputKeyboardEvent* >(event);
- __signalHandleKeyEvent.emit(ev);
-
- return EINA_TRUE;
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-Eina_Bool DSSeat::inputEventHandlerMouse(void *data, int type, void *event)
-{
- DSInputMouseEvent *ev = static_cast< DSInputMouseEvent* >(event);
- __signalHandlePointerEvent.emit(ev);
-
- return EINA_TRUE;
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-Eina_Bool DSSeat::inputEventHandlerTouch(void *data, int type, void *event)
-{
- DSInputTouchEvent *ev = static_cast< DSInputTouchEvent* >(event);
- __signalHandleTouchEvent.emit(ev);
-
- return EINA_TRUE;
-}
-/*LCOV_EXCL_STOP*/
-
-std::shared_ptr<DSWindow> DSSeat::getTopWindow(std::shared_ptr<DSWindow> winExcl)
-{
- for (std::shared_ptr<DSWindow> w : __zone->getWindowList())
- {
- /* skip if w is not valid or has skip focus */
- if (!w || w->getSkipFocus())
- continue;
- /* skip if w equals to winExcl */
- if (winExcl && winExcl.get() == w.get())
- continue;
-
- /* We suppose that the window located at the top of the window stack is at the front of the list. */
- return w;
-
- }
-
- return nullptr;
-}
-
-std::shared_ptr<DSWindow> DSSeat::getTopWindowOnPosition(int x, int y)
-{
- stPosition wPos;
- stSize wSize;
-
- for (std::shared_ptr<DSWindow> w : __zone->getWindowList())
- {
- wSize = w->getSize();
- wPos = w->getPosition();
-
- if (x >= wPos.x && y >= wPos.y && x <= (int)(wPos.x+wSize.w) && y <= (int)(wPos.y+wSize.h))
- {
- DSLOG_INF("DSSeat", "window(%p, x:%d, y:%d, w:%u, h:%u) contains (x:%d, y:%d)", w.get(), wPos.x, wPos.y, wSize.w, wSize.h, x, y);
- return w;
- }
- }
-
- return nullptr;
-}
-
-} // namespace display_server
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DSSEAT_H_
-#define _DSSEAT_H_
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSSignal.h"
-#include <memory>
-#include <Ecore.h>
-
-namespace display_server
-{
-
-class DSInput;
-class DSKeyboard;
-class DSPointer;
-class DSTouch;
-class DSInputDevice;
-class DSCompositor;
-class DSWaylandSeat;
-class DSWaylandCompositor;
-class DSXkb;
-class DSZone;
-class DSWindow;
-class DSInputKeyboardEvent;
-class DSInputMouseEvent;
-class DSInputTouchEvent;
-
-class DSSeat : public DSObject
-{
-public:
- DSSeat();
- DSSeat(DSCompositor *compositor, std::string name);
- virtual ~DSSeat();
-
- bool attachZone(std::shared_ptr<DSZone> zone);
- std::shared_ptr<DSZone> getZone();
- bool detachZone();
-
- void slotDeviceAdd(std::shared_ptr<DSInputDevice> device);
- void slotDeviceRemove(std::shared_ptr<DSInputDevice> device);
-
- std::string getName();
-
- void addPointer();
- void addKeyboard();
- void addTouch();
- void removePointer();
- void removeKeyboard();
- void removeTouch();
- bool hasPointer();
- bool hasKeyboard();
- bool hasTouch();
-
- DSXkb *getXkb();
- std::shared_ptr<DSWindow> getTopWindow(std::shared_ptr<DSWindow> winExcl);
- std::shared_ptr<DSWindow> getTopWindowOnPosition(int x, int y);
-
-private:
- DSInput *__input;
- DSWaylandSeat *__dswlSeat;
- DSWaylandCompositor *__dswlComp;
- DSCompositor *__compositor;
- DSXkb *__xkb;
- std::shared_ptr<DSZone> __zone;
-
- DSKeyboard *__keyboard;
- DSPointer *__pointer;
- DSTouch *__touch;
- uint32_t __numPointer;
- uint32_t __numKeyboard;
- uint32_t __numTouch;
-
- std::shared_ptr<DSWindow> __focusWin;
- bool __stackChanged;
-
- void __initSlots();
- void __initEventHandlers();
-
- /* ecore key/mouse/touch event handler */
- static Eina_Bool inputEventHandlerKey(void *data, int type, void *event);
- static Eina_Bool inputEventHandlerMouse(void *data, int type, void *event);
- static Eina_Bool inputEventHandlerTouch(void *data, int type, void *event);
-
- /* signals */
- static DSSignal<DSInputKeyboardEvent *> __signalHandleKeyEvent;
- static DSSignal<DSInputMouseEvent *> __signalHandlePointerEvent;
- static DSSignal<DSInputTouchEvent *> __signalHandleTouchEvent;
-
- /* slots */
- void __onKeyEvent(DSInputKeyboardEvent *ev);
- void __onPointerEvent(DSInputMouseEvent *ev);
- void __onTouchEvent(DSInputTouchEvent *ev);
- void __onWindowStackChanged(std::shared_ptr<DSWindow> topWindow);
- void __onWindowCreated(std::shared_ptr<DSWindow> window);
- void __onWindowDestroy(std::shared_ptr<DSWindow> window);
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSTouch.h"
-#include "DSSeat.h"
-#include "DSWindow.h"
-#include "DSInputEvent.h"
-#include "DSWaylandTouch.h"
-
-namespace display_server
-{
-
-DSTouch::DSTouch(DSSeat *seat)
- : __seat(seat),
- __dswlTouch(nullptr),
- __dswlCompositor(nullptr),
- __touchFocus(nullptr)
-{
-}
-
-DSTouch::DSTouch(DSSeat *seat, DSWaylandTouch *touch)
- : __seat(seat),
- __dswlTouch(touch),
- __dswlCompositor(nullptr),
- __touchFocus(nullptr)
-{
-}
-
-DSTouch::~DSTouch()
-{}
-
-/*LCOV_EXCL_START*/
-void DSTouch::processEvent(DSInputTouchEvent *ev, void *data)
-{
- //TODO : get touchFocus and send event to it via DSWaylandTouch instance
-
- if (!__touchFocus)
- {
- DSLOG_ERR("DSTouch", "No touchFocus available.");
- return;
- }
-
- if (ev->getType() == DSInputEvent::TouchDownEvent)
- {
- DSLOG_DBG("DSTouch", "[touchDown] devicename: %s, timestamp: %u, x: %d (winX: %d), y: %d (winY: %d)\n",
- ev->getDevice()->getName().c_str(), ev->getTimestamp(),
- ev->getX(), ev->getWinX(), ev->getY(), ev->getWinY());
- touchDown(ev->getIndex(), ev->getWinX(), ev->getWinY());
- }
- else if (ev->getType() == DSInputEvent::TouchUpEvent)
- {
- DSLOG_DBG("DSTouch", "[touchDown] devicename: %s, timestamp: %u\n",
- ev->getDevice()->getName().c_str(), ev->getTimestamp());
- touchUp(ev->getIndex());
- }
- else//DSInputEvent::TouchMoveEvent
- {
- DSLOG_DBG("DSTouch", "[touchDown] devicename: %s, timestamp: %u, x: %d (winX: %d), y: %d (winY: %d)\n",
- ev->getDevice()->getName().c_str(), ev->getTimestamp(),
- ev->getX(), ev->getWinX(), ev->getY(), ev->getWinY());
- touchMove(ev->getIndex(), ev->getWinX(), ev->getWinY());
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSTouch::touchDown(int32_t id, int x, int y)
-{
- if (__touchFocus && __dswlTouch)
- {
- __dswlTouch->sendDown(id, x, y);
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSTouch::touchUp(int32_t id)
-{
- if (__touchFocus && __dswlTouch)
- {
- __dswlTouch->sendUp(id);
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSTouch::touchMove(int32_t id, int x, int y)
-{
- if (__touchFocus && __dswlTouch)
- {
- __dswlTouch->sendMotion(id, x, y);
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSTouch::setFocus(std::shared_ptr<DSWindow> window)
-{
- if (!window)
- {
- DSLOG_ERR("DSTouch", "Given window is INVALID. (window : %p)", window);
- __touchFocus = window;
- if (__dswlTouch)
- __dswlTouch->setFocus(nullptr);
- return;
- }
-
- DSWaylandSurface * waylandSurface = window->surface();
-
- if (!waylandSurface)
- {
- DSLOG_ERR("DSTouch", "Wayland surface of the given window is INVALID. (window : %p, surface : %p)", window, waylandSurface);
- return;
- }
-
- DSLOG_INF("DSTouch", "focus window has been changed. (%p -> %p)", __touchFocus, window);
- __touchFocus = window;
-
- if (!__dswlTouch)
- {
- DSLOG_ERR("DSTouch", "waylandTouch is NOT available !");
- return;
- }
-
- __dswlTouch->setFocus(waylandSurface);
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSTouch::resetFocus()
-{
- if (__touchFocus)
- {
- __touchFocus = nullptr;
- DSLOG_INF("DSTouch", "touchFocus has been reset.");
- }
-
- if (__dswlTouch)
- __dswlTouch->resetFocus();
-}
-/*LCOV_EXCL_STOP*/
-
-std::shared_ptr<DSWindow> DSTouch::getFocus()
-{
- return __touchFocus;
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DSTOUCH_H__
-#define __DSTOUCH_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSSeat;
-class DSWindow;
-class DSWaylandTouch;
-class DSInputTouchEvent;
-class DSWaylandCompositor;
-
-class DSTouch : public DSObject
-{
-public:
- DSTouch() = delete;
- DSTouch(DSSeat *seat);
- DSTouch(DSSeat *seat, DSWaylandTouch *touch);
- virtual ~DSTouch();
-
- void processEvent(DSInputTouchEvent *ev, void *data);
- void touchDown(int32_t id, int x, int y);
- void touchUp(int32_t id);
- void touchMove(int32_t id, int x, int y);
- void setFocus(std::shared_ptr<DSWindow> window);
- void resetFocus();
- std::shared_ptr<DSWindow> getFocus();
-
-private:
- DSSeat *__seat;
- DSWaylandTouch *__dswlTouch;
- DSWaylandCompositor *__dswlCompositor;
- std::shared_ptr<DSWindow> __touchFocus;
-};
-
-}
-
-#endif //__DSTOUCH_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSSignal.h"
-
-namespace display_server {
-void DSSlotsObserver::addSlot(DSObject *slot)
-{
- _slotList.push_back(slot);
-}
-
-void DSSlotsObserver::destroyed(DSObject *slot)
-{
- _slotList.remove(slot);
- if (_slotList.empty())
- delete this;
-}
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_SIGNAL_H_
-#define __DS_SIGNAL_H_
-
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSSlotsObserver : public IDSObjectObserver
-{
-public:
- DSSlotsObserver() = default;
- ~DSSlotsObserver() = default;
-
- virtual void destroyed(DSObject *slot);
- virtual void addSlot(DSObject *slot);
-
-protected:
- std::list<DSObject *> _slotList;
-};
-
-template <typename... Args>
-class DSSlotConnection : public DSSlotsObserver
-{
-public:
- DSSlotConnection()
- : __func(nullptr)
- {};
- DSSlotConnection(DSObject *slot, std::function<void(Args...)> func)
- : __func(std::move(func))
- {
- //TODO: make callback as callback iface
- //std::unique_ptr<DSCallbackIface> ptr(new DSCallbackIface(func));
- //__func = std::move(ptr);
- addSlot(slot);
- }
-
- virtual ~DSSlotConnection()
- {
- for (auto &&slot : _slotList)
- slot->detachDestroyObserver(this);
-
- _slotList.clear();
- }
-
- void addSlot(DSObject *slot) override
- {
- slot->attachDestroyObserver(this);
-
- _slotList.push_back(slot);
- }
-
- void destroyed(DSObject *slot) override
- {
- _slotList.remove(slot);
-
- if (_slotList.empty())
- ;//TODO: delete from DSSignal connections list with [guard pointer]
- }
-
- void invoke(Args... args)
- {
- if (!_slotList.empty())
- std::invoke(__func, args...);
- }
-
-private:
- //TODO: make callback as callback iface
- //std::unique_ptr<DSCallbackIface> __func;
- std::function<void(Args...)> __func;
- template <typename... _Args>
- friend class DSSignal;
-};
-
-template <typename... Args>
-class DSSignal
-{
-public:
- DSSignal() = default;
- virtual ~DSSignal() = default;
-
- // functor
- DSSignal<Args...> &operator()(void)
- {
- return *this;
- }
-
- void connect(DSObject *slot, std::function<void(Args...)> func)
- {
- if ((!slot) || (!func))
- return;
-
- if (auto connection = __findConnection(func))
- connection->addSlot(slot);
- else
- __connectionList.emplace_back(new DSSlotConnection<Args...>(slot, func));
- }
-
- void emit(Args... args)
- {
- for (auto &&connection : __connectionList)
- connection->invoke(args...);
- }
-
-private:
- DSSlotConnection<Args...> *__findConnection(std::function<void(Args...)> func)
- {
- for (auto &&connection : __connectionList) {
- if (&connection->__func == &func)
- return connection.get();
- }
-
- return nullptr;
- }
-
- std::list<std::unique_ptr<DSSlotConnection<Args...>>> __connectionList;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <DSSignalBroker.h>
-
-namespace display_server
-{
-
-std::mutex DSSignalBroker::__mutex;
-DSSignalBroker* DSSignalBroker::__signalBroker { nullptr };
-
-DSSignalBroker::DSSignalBroker(DSObject *parent)
-{
-}
-
-DSSignalBroker::~DSSignalBroker()
-{
- if (__signalBroker)
- {
- if (!__signalBroker->__signalHash.empty())
- {
- for (auto hashpairs : __signalBroker->__signalHash)
- {
- delete hashpairs.second.signal;
- }
- }
- }
-}
-
-DSSignalBroker *DSSignalBroker::getInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- if (!__signalBroker)
- {
- __signalBroker = new DSSignalBroker(new DSObject);
- DSLOG_INF("DSSignalBroker", "DSSignalBroker instance has been created !");
- }
-
- return __signalBroker;
-}
-
-void DSSignalBroker::releaseInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- if (__signalBroker && __signalBroker->__signalHash.empty())
- {
- delete __signalBroker;
- __signalBroker = nullptr;
- DSLOG_INF("DSSignalBroker", "DSSignalBroker instance has been removed !");
- }
-}
-
-} // end of namespace display_server
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_SIGNAL_BROKER_H__
-#define __DS_SIGNAL_BROKER_H__
-
-#include <DSCore.h>
-#include <DSObject.h>
-#include <DSSignal.h>
-
-namespace display_server
-{
-
-class DSSignalBroker : public DSObject
-{
-public:
- static DSSignalBroker *getInstance();
- static void releaseInstance();
-
- template <typename... Args>
- bool registerSignal(std::string signalStr, DSObject *obj);
- template <typename... Args>
- bool emitSignal(std::string signalStr, DSObject *obj, Args...);
- template <typename... Args>
- bool registerCallback(std::string signalStr, DSObject *slot, std::function<void(Args...)> func);
- template <typename... Args>
- bool deregisterCallback(std::string signalStr, DSObject *slot, std::function<void(Args...)> func);
-
-private:
- static std::mutex __mutex;
- static DSSignalBroker *__signalBroker;
-
- struct stRegisteredSignal
- {
- std::string signalName;
- std::string className;
- DSObject *obj;
- DSSignal<void *> *signal;
-
- public:
- stRegisteredSignal(std::string sn, DSObject *inpObj, DSSignal<void *> *inpSignal)
- {
- signalName = sn;
- className = inpObj->getName();
- obj = inpObj;
- signal = inpSignal;
- }
-
- };
-
- std::unordered_multimap<std::string, stRegisteredSignal> __signalHash;
-
- DSSignalBroker() = delete;
- ~DSSignalBroker();
- DSSignalBroker(DSObject *parent);
-};
-
-template <typename... Args>
-bool DSSignalBroker::registerSignal(std::string signalStr, DSObject *obj)
-{
- if (!__signalBroker) return false;
-
- if (__signalBroker->__signalHash.find(signalStr) != __signalBroker->__signalHash.end())
- {
- auto range = __signalBroker->__signalHash.equal_range(signalStr);
- for (auto iter = range.first;
- iter != range.second;
- iter++)
- {
- if (iter->second.obj == obj)
- {
- DSLOG_INF("DSSignalBroker","emitSignal:: already registered signal: %s", signalStr.c_str());
- return false;
- }
- else
- {
- DSLOG_DBG("DSSignalBroker", "searching same item: %s, obj(%p):%s", iter->second.signalName.c_str(), iter->second.obj, iter->second.className.c_str());
- }
-
- }
- }
- DSSignal<void *> *signal = reinterpret_cast<DSSignal<void *> *> (new DSSignal<Args...>());
- __signalBroker->__signalHash.insert(std::make_pair(signalStr, stRegisteredSignal(signalStr, obj, signal)));
-
- DSLOG_DBG("DSSignalBroker","registerSignal:: registered new signal (name:%s, class(%p):%s, signal:%p)",
- signalStr.c_str(), obj, obj->getName().c_str(), signal);
-
- return true;
-}
-
-template <typename... Args>
-bool DSSignalBroker::emitSignal(std::string signalStr, DSObject *obj, Args... args)
-{
- if (!__signalBroker) return false;
-
- if (__signalBroker->__signalHash.find(signalStr) != __signalBroker->__signalHash.end())
- {
- auto range = __signalBroker->__signalHash.equal_range(signalStr);
- for (auto iter = range.first;
- iter != range.second;
- iter++)
- {
- if (iter->second.obj == obj)// || iter->second.className == obj->getName())
- {
- DSSignal<Args...> *signal = reinterpret_cast<DSSignal<Args...> *>(iter->second.signal);
- if (signal)
- {
- signal->emit(args...);
- DSLOG_DBG("DSSignalBroker","emitSignal:: signal emit (name:%s, class(%p):%s, signal:%p)",
- iter->second.signalName.c_str(), iter->second.obj, iter->second.obj->getName().c_str(), iter->second.signal);
- }
- else
- return false;
-
- return true;
- }
- }
- }
- else
- {
- DSLOG_INF("DSSignalBroker","emitSignal:: cannot find registered signal: %s", signalStr.c_str());
- return false;
- }
-
- return false;
-}
-
-template <typename... Args>
-bool DSSignalBroker::registerCallback(std::string signalStr, DSObject *slot, std::function<void(Args...)> func)
-{
- if (!__signalBroker) return false;
-
- if (__signalBroker->__signalHash.find(signalStr) != __signalBroker->__signalHash.end())
- {
- auto range = __signalBroker->__signalHash.equal_range(signalStr);
- for (auto iter = range.first;
- iter != range.second;
- iter++)
- {
- DSSignal<Args...> *signal = reinterpret_cast<DSSignal<Args...> *>(iter->second.signal);
- if (signal)
- signal->connect(slot, func);
- }
- }
- else
- {
- DSLOG_INF("DSSignalBroker","registerCallback:: cannot find signal: %s", signalStr.c_str());
- return false;
- }
-
- return true;
-}
-
-template <typename... Args>
-bool DSSignalBroker::deregisterCallback(std::string signalStr, DSObject *slot, std::function<void(Args...)> func)
-{
- // TODO: have to impl disconnect method in DSSignal
- /*
- if (!__signalBroker) return false;
-
- if (__signalBroker->__signalHash.find(signalStr) != __signalBroker->__signalHash.end())
- {
- auto range = __signalBroker->__signalHash.equal_range(signalStr);
- for (auto iter = range.first;
- iter != range.second;
- iter++)
- {
- DSSignal<Args...> *signal = reinterpret_cast<DSSignal<Args...> *>(iter->second.signal);
- if (signal)
- signal->disconnect(slot, func);
- }
- }
- */
- return true;
-}
-
-} // end of namespace display_server
-
-#endif // end of __DS_SIGNAL_BROKER_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSTextInput.h"
-#include "DSTextInputPrivate.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandTextInputManager.h"
-#include "DSWaylandInputMethod.h"
-#include "DSWaylandInputPanel.h"
-
-namespace display_server
-{
-
-DSTextInputPrivate::DSTextInputPrivate(DSTextInput *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr),
- __inputPanelState(InputPanelStateDidHide)
-{
- __wlCompositor = DSWaylandCompositor::getInstance();
- __wlInputMethod = new DSWaylandInputMethod(__wlCompositor, this);
- __wlInputPanel = new DSWaylandInputPanel(__wlCompositor, this);
- __wlTextInputManager = new DSWaylandTextInputManager(__wlCompositor, this);
-}
-
-DSTextInputPrivate::~DSTextInputPrivate()
-{
- delete __wlTextInputManager;
- delete __wlInputPanel;
- delete __wlInputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-/*LCOV_EXCL_START*/
-void DSTextInputPrivate::setInputPanelState(InputPanelState state)
-{
- __inputPanelState = state;
-}
-
-DSTextInputPrivate::InputPanelState DSTextInputPrivate::getInputPanelState()
-{
- return __inputPanelState;
-}
-
-void DSTextInputPrivate::activateTextInput(DSWaylandTextInput *wlTextInput, int id)
-{
- __wlInputMethod->activate(id);
-}
-
-void DSTextInputPrivate::deactivateTextInput(DSWaylandTextInput *wlTextInput)
-{
- __wlInputMethod->deactivate();
-}
-
-void DSTextInputPrivate::showInputPanel(DSWaylandTextInput *wlTextInput, int id)
-{
- __wlInputMethod->showInputPanel(id);
-}
-
-void DSTextInputPrivate::hideInputPanel(int id)
-{
- __wlInputMethod->hideInputPanel(id);
-}
-
-void DSTextInputPrivate::resetTextInput()
-{
- __wlInputMethod->resetTextInput();
-}
-
-void DSTextInputPrivate::setContentType(unsigned int hint, unsigned int purpose)
-{
- __wlInputMethod->setContentType(hint, purpose);
-}
-
-void DSTextInputPrivate::setPreferredLanguage(const std::string language)
-{
- __wlInputMethod->setPreferredLanguage(language);
-}
-
-void DSTextInputPrivate::commitState(unsigned int serial)
-{
- __wlInputMethod->commitState(serial);
-}
-
-void DSTextInputPrivate::invokeAction(unsigned int button, unsigned int index)
-{
- __wlInputMethod->invokeAction(button, index);
-}
-
-void DSTextInputPrivate::setReturnKeyType(unsigned int returnKeyType)
-{
- __wlInputMethod->setReturnKeyType(returnKeyType);
-}
-
-void DSTextInputPrivate::returnKeyDisabled(unsigned int returnKeyDisabled)
-{
- __wlInputMethod->returnKeyDisabled(returnKeyDisabled);
-}
-
-void DSTextInputPrivate::setInputPanelData(std::string inputPanelData, unsigned int inputPanelLength)
-{
- __wlInputMethod->setInputPanelData(inputPanelData, inputPanelLength);
-}
-
-void DSTextInputPrivate::bidiDirection(unsigned int direction)
-{
- __wlInputMethod->bidiDirection(direction);
-}
-
-void DSTextInputPrivate::setCursorPosition(unsigned int cursorPosition)
-{
- __wlInputMethod->setCursorPosition(cursorPosition);
-}
-
-void DSTextInputPrivate::processInputDeviceEvent(unsigned int eventType, std::string eventData, unsigned int eventLength)
-{
- __wlInputMethod->processInputDeviceEvent(eventType, eventData, eventLength);
-}
-
-void DSTextInputPrivate::filterKeyEvent(unsigned int serial, unsigned int time, std::string keyName, unsigned int state, unsigned int modifiers, std::string devName, unsigned int devClass, unsigned int devSubclass, unsigned int keycode)
-{
- __wlInputMethod->filterKeyEvent(serial, time, keyName, state, modifiers, devName, devClass, devSubclass, keycode);
-}
-
-void DSTextInputPrivate::setCapitalMode(unsigned int mode)
-{
- __wlInputMethod->setCapitalMode(mode);
-}
-
-void DSTextInputPrivate::predictionHint(std::string text)
-{
- __wlInputMethod->predictionHint(text);
-}
-
-void DSTextInputPrivate::setMimeType(std::string type)
-{
- __wlInputMethod->setMimeType(type);
-}
-
-void DSTextInputPrivate::finalizeContent(std::string text, unsigned int cursorPosition)
-{
- __wlInputMethod->finalizeContent(text, cursorPosition);
-}
-
-void DSTextInputPrivate::predictionHintData(std::string key, std::string value)
-{
- __wlInputMethod->predictionHintData(key, value);
-}
-
-void DSTextInputPrivate::updateTextInputPanelState(bool state)
-{
- __wlTextInputManager->updateTextInputPanelState(state);
-}
-
-void DSTextInputPrivate::setGeometryUpdated(bool updated)
-{
- __wlTextInputManager->setGeometryUpdated(updated);
-}
-
-DSWaylandSurface *DSTextInputPrivate::getTextInputSurface()
-{
- return __wlTextInputManager->getTextInputSurface();
-}
-
-
-void DSTextInputPrivate::contextCommitString(unsigned int serial, std::string text)
-{
- __wlTextInputManager->contextCommitString(serial, text);
-}
-
-void DSTextInputPrivate::contextPreeditString(unsigned int serial, std::string text, std::string commit)
-{
- __wlTextInputManager->contextPreeditString(serial, text, commit);
-}
-
-void DSTextInputPrivate::contextPreeditStyling(int index, unsigned int length, unsigned int style)
-{
- __wlTextInputManager->contextPreeditStyling(index, length, style);
-}
-
-void DSTextInputPrivate::contextPreeditCursor(int index)
-{
- __wlTextInputManager->contextPreeditCursor(index);
-}
-
-void DSTextInputPrivate::contextDeleteSurroundingText(int index, unsigned int length)
-{
- __wlTextInputManager->contextDeleteSurroundingText(index, length);
-}
-
-void DSTextInputPrivate::contextCursorPosition(int index, int anchor)
-{
- __wlTextInputManager->contextCursorPosition(index, anchor);
-}
-
-void DSTextInputPrivate::contextModifiersMap(std::string map)
-{
- __wlTextInputManager->contextModifiersMap(map);
-}
-
-void DSTextInputPrivate::contextKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers)
-{
- __wlTextInputManager->contextKeysym(serial, time, sym, state, modifiers);
-}
-
-void DSTextInputPrivate::contextLanguage(unsigned int serial, std::string language)
-{
- __wlTextInputManager->contextLanguage(serial, language);
-}
-
-void DSTextInputPrivate::contextTextDirection(unsigned int serial, unsigned int direction)
-{
- __wlTextInputManager->contextTextDirection(serial, direction);
-}
-
-void DSTextInputPrivate::contextSelectionRegion(unsigned int serial, int start, int end)
-{
- __wlTextInputManager->contextSelectionRegion(serial, start, end);
-}
-
-void DSTextInputPrivate::contextPrivateCommand(unsigned int serial, std::string command)
-{
- __wlTextInputManager->contextPrivateCommand(serial, command);
-}
-
-void DSTextInputPrivate::contextUpdateInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength)
-{
- __wlTextInputManager->contextUpdateInputPanelData(serial, inputPanelData, inputPanelDataLength);
-}
-
-void DSTextInputPrivate::contextShowInputPanel()
-{
- __wlTextInputManager->contextShowInputPanel();
-}
-
-void DSTextInputPrivate::contextHideInputPanel()
-{
- __wlTextInputManager->contextHideInputPanel();
-}
-
-void DSTextInputPrivate::contextGetSelectionText(int fd)
-{
- __wlTextInputManager->contextGetSelectionText(fd);
-}
-
-void DSTextInputPrivate::contextGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd)
-{
- __wlTextInputManager->contextGetSurroundingText(maxlenBefore, maxlenAfter, fd);
-}
-
-void DSTextInputPrivate::contextFilterKeyEventDone(unsigned int serial, unsigned int state)
-{
- __wlTextInputManager->contextFilterKeyEventDone(serial, state);
-}
-
-void DSTextInputPrivate::contextUpdateIseGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int height)
-{
- __wlTextInputManager->contextUpdateIseGeometry(x, y, width, height);
-}
-
-void DSTextInputPrivate::contextRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit)
-{
- __wlTextInputManager->contextRecaptureString(serial, index, length, preedit, preeditCommit, commit);
-}
-
-void DSTextInputPrivate::contextInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value)
-{
- __wlTextInputManager->contextInputPanelEvent(serial, eventType, value);
-}
-
-void DSTextInputPrivate::contextCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes)
-{
- __wlTextInputManager->contextCommitContent(serial, content, description, mimeTypes);
-}
-
-void DSTextInputPrivate::updateInputPanelState(bool waitUpdate)
-{
- __wlInputPanel->updateInputPanelState(waitUpdate);
-}
-
-void DSTextInputPrivate::setInputPanelTransientFor(DSWaylandSurface *window)
-{
- __wlInputPanel->setTransientFor(window);
-}
-
-void DSTextInputPrivate::changeInputPanelVisibility(bool visible)
-{
- __wlInputPanel->changeVisibility(visible);
-}
-
-stGeometry DSTextInputPrivate::inputPanelGetGeometry(DSWaylandSurface *window)
-{
- return __wlInputPanel->getSurfaceGeometry(window);
-}
-/*LCOV_EXCL_STOP*/
-
-DSTextInput::DSTextInput()
- : DS_INIT_PRIVATE_PTR(DSTextInput)
-{
-}
-
-DSTextInput::~DSTextInput()
-{
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_TEXT_INPUT_H__
-#define __DS_TEXT_INPUT_H__
-
-#include <DSCore.h>
-#include <DSObject.h>
-#include <DSCompositor.h>
-
-namespace display_server
-{
-
-class DSTextInputPrivate;
-
-class DSTextInput : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSTextInput);
-public:
- DSTextInput();
- ~DSTextInput() override;
-
-private:
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_TEXT_INPUT_PRIVATE_H__
-#define __DS_TEXT_INPUT_PRIVATE_H__
-
-#include <DSCore.h>
-#include <DSTextInput.h>
-#include <DSStruct.h>
-
-namespace display_server
-{
-
-class DSWaylandCompositor;
-class DSWaylandTextInput;
-class DSWaylandTextInputManager;
-class DSWaylandInputMethod;
-class DSWaylandInputMethodContext;
-class DSWaylandInputPanel;
-class DSWaylandInputPanelSurface;
-class DSWaylandSurface;
-
-class DSTextInputPrivate : public DSObjectPrivate
-{
-DS_PIMPL_USE_PUBLIC(DSTextInput);
-public:
- enum InputPanelState
- {
- InputPanelStateDidHide,
- InputPanelStateWillHide,
- InputPanelStateDidShow,
- InputPanelStateWillShow
- };
-
- DSTextInputPrivate() = delete;
- DSTextInputPrivate(DSTextInput *p_ptr);
- ~DSTextInputPrivate();
-
- void setInputPanelState(InputPanelState state);
- InputPanelState getInputPanelState();
-
- /* DSWaylandTextInput request */
- void activateTextInput(DSWaylandTextInput *wlTextInput, int id);
- void deactivateTextInput(DSWaylandTextInput *wlTextInput);
- void showInputPanel(DSWaylandTextInput *wlTextInput, int id);
- void hideInputPanel(int id);
- void resetTextInput();
- void setContentType(unsigned int hint, unsigned int purpose);
- void setPreferredLanguage(const std::string language);
- void commitState(unsigned int serial);
- void invokeAction(unsigned int button, unsigned int index);
- void setReturnKeyType(unsigned int returnKeyType);
- void returnKeyDisabled(unsigned int returnKeyDisabled);
- void setInputPanelData(std::string inputPanelData, unsigned int inputPanelLength);
- void bidiDirection(unsigned int direction);
- void setCursorPosition(unsigned int cursorPosition);
- void processInputDeviceEvent(unsigned int eventType, std::string eventData, unsigned int eventLength);
- void filterKeyEvent(unsigned int serial, unsigned int time, std::string keyName, unsigned int state, unsigned int modifiers, std::string devName, unsigned int devClass, unsigned int devSubclass, unsigned int keycode);
- void setCapitalMode(unsigned int mode);
- void predictionHint(std::string text);
- void setMimeType(std::string type);
- void finalizeContent(std::string text, unsigned int cursorPosition);
- void predictionHintData(std::string key, std::string value);
- void updateTextInputPanelState(bool state);
- void setGeometryUpdated(bool updated);
- DSWaylandSurface *getTextInputSurface();
-
- /* DSWaylandInputMethodContext request */
- void contextCommitString(unsigned int serial, std::string text);
- void contextPreeditString(unsigned int serial, std::string text, std::string commit);
- void contextPreeditStyling(int index, unsigned int length, unsigned int style);
- void contextPreeditCursor(int index);
- void contextDeleteSurroundingText(int index, unsigned int length);
- void contextCursorPosition(int index, int anchor);
- void contextModifiersMap(std::string map);
- void contextKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers);
- void contextLanguage(unsigned int serial, std::string language);
- void contextTextDirection(unsigned int serial, unsigned int direction);
- void contextSelectionRegion(unsigned int serial, int start, int end);
- void contextPrivateCommand(unsigned int serial, std::string command);
- void contextUpdateInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength);
- void contextShowInputPanel();
- void contextHideInputPanel();
- void contextGetSelectionText(int fd);
- void contextGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd);
- void contextFilterKeyEventDone(unsigned int serial, unsigned int state);
- void contextUpdateIseGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int height);
- void contextRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit);
- void contextInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value);
- void contextCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes);
-
- /* DSWaylandInputPanel */
- void updateInputPanelState(bool waitUpdate);
- void setInputPanelTransientFor(DSWaylandSurface *window);
- void changeInputPanelVisibility(bool visible);
- stGeometry inputPanelGetGeometry(DSWaylandSurface *window);
-
-private:
- DSWaylandCompositor *__wlCompositor;
- DSWaylandInputMethod *__wlInputMethod;
- DSWaylandInputPanel *__wlInputPanel;
- DSWaylandTextInputManager *__wlTextInputManager;
- InputPanelState __inputPanelState;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <DSTizenAppinfo.h>
-
-namespace display_server
-{
-DSTizenAppinfo::DSTizenAppinfo(std::string appid)
- : __pid(-1),
- __base_output_available(false),
- __base_output_width(0),
- __base_output_height(0)
-{
- __appId = appid;
-}
-
-DSTizenAppinfo::~DSTizenAppinfo()
-{
-}
-
-void DSTizenAppinfo::setAppId(std::string appId)
-{
- __appId = appId;
-}
-
-void DSTizenAppinfo::setPid(pid_t pid)
-{
- __pid = pid;
-}
-
-void DSTizenAppinfo::setBaseOutputAvailable(bool isAvailable)
-{
- __base_output_available = isAvailable;
-}
-
-void DSTizenAppinfo::setBaseOutputWidth(int w)
-{
- __base_output_width = w;
-}
-
-void DSTizenAppinfo::setBaseOutputHeight(int h)
-{
- __base_output_height = h;
-}
-
-pid_t DSTizenAppinfo::getPid()
-{
- return __pid;
-}
-
-std::string DSTizenAppinfo::getAppId()
-{
- return __appId;
-}
-
-bool DSTizenAppinfo::getBaseOutputAvailable()
-{
- return __base_output_available;
-}
-
-int DSTizenAppinfo::getBaseOutputWidth()
-{
- return __base_output_width;
-}
-
-int DSTizenAppinfo::getBaseOutputHeight()
-{
- return __base_output_height;
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_TIZENAPPINFO_H_
-#define _DS_TIZENAPPINFO_H_
-
-#include <DSWaylandTizenAppinfo.h>
-
-namespace display_server
-{
-
-class DSTizenAppinfo : public DSObject
-{
-public:
- DSTizenAppinfo() = delete;
- DSTizenAppinfo(std::string appid);
- virtual ~DSTizenAppinfo();
-
- void setAppId(std::string appId);
- void setPid(pid_t pid);
- void setBaseOutputAvailable(bool isAvailable);
- void setBaseOutputWidth(int w);
- void setBaseOutputHeight(int h);
-
- std::string getAppId(void);
- pid_t getPid(void);
- bool getBaseOutputAvailable(void);
- int getBaseOutputWidth(void);
- int getBaseOutputHeight(void);
-
-private:
- std::string __appId;
- pid_t __pid;
- bool __base_output_available;
- int __base_output_width;
- int __base_output_height;
-};
-
-}
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSTizenAppinfoMgr.h"
-#include "DSTizenAppinfoMgrPrivate.h"
-#include "DSWaylandTizenAppinfo.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-int DSTizenAppinfoMgr::__refCount { 0 };
-std::mutex DSTizenAppinfoMgr::__mutex;
-DSTizenAppinfoMgr* DSTizenAppinfoMgr::__appinfoMgr { nullptr };
-
-DSTizenAppinfoMgrPrivate::DSTizenAppinfoMgrPrivate(DSTizenAppinfoMgr *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{
-}
-
-DSTizenAppinfoMgrPrivate::~DSTizenAppinfoMgrPrivate()
-{
-}
-
-std::shared_ptr<DSTizenAppinfo> DSTizenAppinfoMgrPrivate::getTizenAppinfo(std::string appId)
-{
- auto it = __appIdMap.find(appId);
- if (it != __appIdMap.end()) {
- return it->second;
- }
- return nullptr;
-}
-
-std::shared_ptr<DSTizenAppinfo> DSTizenAppinfoMgrPrivate::getTizenAppinfo(pid_t pid)
-{
- std::shared_ptr<DSTizenAppinfo> ptr_appinfo(nullptr);
- DSTizenAppinfo * appinfo(nullptr);
-
- for (auto it = __appIdMap.begin(); it != __appIdMap.end(); it++) {
- ptr_appinfo = it->second;
- if (ptr_appinfo)
- {
- appinfo = ptr_appinfo.get() ;
- if ((appinfo) && (appinfo->getPid() == pid)) {
- return ptr_appinfo;
- }
- }
- }
- return nullptr;
-}
-
-std::shared_ptr<DSTizenAppinfo> DSTizenAppinfoMgrPrivate::addTizenAppinfo(std::string appId)
-{
- std::shared_ptr<DSTizenAppinfo> appinfo(nullptr);
-
- appinfo = std::make_shared<DSTizenAppinfo>(appId);
- if (appinfo != nullptr) {
- __appIdMap.emplace(appId, appinfo);
- }
- return appinfo;
-}
-
-bool DSTizenAppinfoMgrPrivate::removeTizenAppinfo(std::string appId)
-{
- auto it = __appIdMap.find(appId);
- if (it != __appIdMap.end()) {
- __appIdMap.erase(it);
- return true;
- }
- return false;
-}
-
-DSTizenAppinfoMgr::DSTizenAppinfoMgr(DSObject *parent)
- : DS_INIT_PRIVATE_PTR(DSTizenAppinfoMgr)
-{
-}
-
-DSTizenAppinfoMgr::~DSTizenAppinfoMgr()
-{
-}
-
-DSTizenAppinfoMgr *DSTizenAppinfoMgr::getInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- if (!__appinfoMgr && (__refCount == 0))
- {
- __appinfoMgr = new DSTizenAppinfoMgr(new DSObject);
- DSLOG_INF("DSTizenAppinfoMgr",
- "DSTizenAppinfoMgr instance has been created !");
- }
-
- ++__refCount;
- return __appinfoMgr;
-}
-
-void DSTizenAppinfoMgr::releaseInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- --__refCount;
- if (__refCount < 0)
- __refCount = 0;
-
- if ((0 == __refCount) && __appinfoMgr)
- {
- delete __appinfoMgr;
- __appinfoMgr = nullptr;
- DSLOG_INF("DSTizenAppinfoMgr",
- "DSTizenAppinfoMgr instance has been removed !");
- }
-}
-
-std::shared_ptr<DSTizenAppinfo> DSTizenAppinfoMgr::getTizenAppinfo(std::string appId)
-{
- DS_GET_PRIV(DSTizenAppinfoMgr);
-
- return priv->getTizenAppinfo(appId);
-}
-
-std::shared_ptr<DSTizenAppinfo> DSTizenAppinfoMgr::getTizenAppinfo(pid_t pid)
-{
- DS_GET_PRIV(DSTizenAppinfoMgr);
-
- return priv->getTizenAppinfo(pid);
-}
-
-std::shared_ptr<DSTizenAppinfo> DSTizenAppinfoMgr::addTizenAppinfo(std::string appId)
-{
- DS_GET_PRIV(DSTizenAppinfoMgr);
-
- std::shared_ptr<DSTizenAppinfo> appinfo = getTizenAppinfo(appId);
- if (appinfo == nullptr) {
- appinfo = priv->addTizenAppinfo(appId);
- DSLOG_INF("DSTizenAppinfoMgr", "New TizenAppinfo(apppId:%s) added", appId.c_str());
- return appinfo;
- }
- else {
- DSLOG_INF("DSTizenAppinfoMgr", "Adding TizenAppinfo(apppId:%s) failed..", appId.c_str());
- return nullptr;
- }
-}
-
-bool DSTizenAppinfoMgr::removeTizenAppinfo(std::string appId)
-{
- DS_GET_PRIV(DSTizenAppinfoMgr);
- bool ret = false;
-
- ret = priv->removeTizenAppinfo(appId);
- if (ret)
- DSLOG_INF("DSTizenAppinfoMgr", "TizenAppinfo(appId:%s) removed", appId.c_str());
- else
- DSLOG_INF("DSTizenAppinfoMgr", "Removing TizenAppinfo(appId:%s) failed..", appId.c_str());
- return ret;
-}
-
-void DSTizenAppinfoMgr::updateTizenAppinfo(std::string appId, pid_t pid)
-{
- std::shared_ptr<DSTizenAppinfo> ptr_appinfo(nullptr);
- DSTizenAppinfo * appinfo(nullptr);
-
- ptr_appinfo = getTizenAppinfo(appId);
- if (ptr_appinfo == nullptr)
- return;
-
- appinfo = ptr_appinfo.get();
- if (appinfo != nullptr)
- {
- appinfo->setPid(pid);
- DSLOG_INF("DSTizenAppinfoMgr", "TizenAppinfo(appId:%s) set to pid:%d", appId.c_str(), pid);
- }
-}
-
-bool DSTizenAppinfoMgr::getBaseOutputResolution(pid_t pid, int *res_w, int *res_h)
-{
- std::shared_ptr<DSTizenAppinfo> ptr_appinfo(nullptr);
- DSTizenAppinfo * appinfo(nullptr);
-
- ptr_appinfo = getTizenAppinfo(pid);
- if (ptr_appinfo == nullptr)
- return false;
-
- appinfo = ptr_appinfo.get();
- if ((appinfo) && (appinfo->getBaseOutputAvailable())) {
- if (res_w) *res_w = appinfo->getBaseOutputWidth();
- if (res_h) *res_h = appinfo->getBaseOutputHeight();
-
- return true;
- }
- return false;
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_TIZENAPPINFO_MGR_H_
-#define _DS_TIZENAPPINFO_MGR_H_
-
-#include <DSTizenAppinfo.h>
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-class DSTizenAppinfoMgrPrivate;
-
-class DSTizenAppinfoMgr : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSTizenAppinfoMgr);
-public:
- static DSTizenAppinfoMgr *getInstance();
- static void releaseInstance();
-
- std::shared_ptr<DSTizenAppinfo> getTizenAppinfo(std::string appId);
- std::shared_ptr<DSTizenAppinfo> getTizenAppinfo(pid_t pid);
-
- std::shared_ptr<DSTizenAppinfo> addTizenAppinfo(std::string appId);
-
- bool removeTizenAppinfo(std::string appId);
-
- void updateTizenAppinfo(std::string appId, pid_t pid);
-
- bool getBaseOutputResolution(pid_t pid, int *res_w, int *res_h);
-
-private:
- static std::mutex __mutex;
- static DSTizenAppinfoMgr *__appinfoMgr;
- static int __refCount;
-
- DSTizenAppinfoMgr() = delete;
- ~DSTizenAppinfoMgr();
- DSTizenAppinfoMgr(DSObject *parent);
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_TIZENAPPINFO_MGR_PRIVATE_H_
-#define _DS_TIZENAPPINFO_MGR_PRIVATE_H_
-
-#include "DSTizenAppinfoMgr.h"
-
-namespace display_server
-{
-
-class DSTizenAppinfoMgrPrivate : public DSObjectPrivate
-{
- DS_PIMPL_USE_PUBLIC(DSTizenAppinfoMgr);
-public:
- DSTizenAppinfoMgrPrivate() = delete;
- DSTizenAppinfoMgrPrivate(DSTizenAppinfoMgr *p_ptr);
- ~DSTizenAppinfoMgrPrivate();
-
- std::shared_ptr<DSTizenAppinfo> getTizenAppinfo(std::string appId);
- std::shared_ptr<DSTizenAppinfo> getTizenAppinfo(pid_t pid);
-
- std::shared_ptr<DSTizenAppinfo> addTizenAppinfo(std::string appId);
- bool removeTizenAppinfo(std::string appId);
-
-private:
- std::unordered_map <std::string, std::shared_ptr<DSTizenAppinfo>> __appIdMap;
-
-};
-
-}
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSTraceInfo.h"
-#include "DSPolicyAreaPrivate.h"
-
-namespace display_server
-{
-DSTraceInfo::DSTraceInfo()
- : __policyArea(nullptr),
- __zone(nullptr),
- __eventLoop(nullptr),
- __windowUpdated(false)
-{
- __eventLoop = DSEventLoop::getInstance();
- if (__eventLoop)
- __eventLoop->registerCallbackIdleEnterer(this, std::bind(&DSTraceInfo::__onEventIdleEnterer, this, std::placeholders::_1));
-}
-
-DSTraceInfo::~DSTraceInfo()
-{
- if (__eventLoop)
- DSEventLoop::releaseInstance();
-}
-
-bool DSTraceInfo::attachPolicyArea(std::shared_ptr<DSPolicyArea> policyArea)
-{
- __policyArea = policyArea;
-
- DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get());
- __zone = policyAreaPriv->getZone();
-
- if (__zone) {
- __zone->registerCallbackWindowCreated(this, std::bind(&DSTraceInfo::__onWindowCreated, this, std::placeholders::_1));
- __zone->registerCallbackWindowStackChanged(this, std::bind(&DSTraceInfo::__onWindowStackChanged, this, std::placeholders::_1));
- __zone->registerCallbackWindowDestroy(this, std::bind(&DSTraceInfo::__onWindowDestroy, this, std::placeholders::_1));
-
- __windowList = __zone->getWindowList();
- return true;
- }
-
- DSLOG_ERR("DSTraceInfo", "No zone attached to this policyArea(%p)", policyArea);
- return false;
-}
-
-void DSTraceInfo::__onEventIdleEnterer(void *data)
-{
- if (__windowUpdated)
- {
- printWindowsInfo();
- __windowUpdated = false;
- }
-}
-
-void DSTraceInfo::printWindowsInfo()
-{
- stPosition pos{0,0};
- stSize sz{0,0};
- DSWaylandSurface *dwlSurface{nullptr};
- DSWaylandClient *dwClient{nullptr};
- pid_t pid = -1;
-
- DSLOG_INF("DSTraceInfo", "--------------Top level windows: %d--------------", __windowList.size());
- DSLOG_INF("DSTraceInfo", " No Win_ID PID w h x y (S)kipFoc has(F)ocus (U)serGeom (V)kbdFloating Parent Title");
-
- for (std::shared_ptr<DSWindow> w : __windowList)
- {
- pos = w->getPosition();
- sz = w->getSize();
- dwlSurface = w->surface();
- if (dwlSurface) {
- dwClient = dwlSurface->getClient();
- if (dwClient) pid = dwClient->pid();
- }
-
- DSLOG_INF("DSTraceInfo", " %d: %p %d %4d %4d %4d %4d %c %c %c %c %p %s", w->getZOrder(), w.get(), pid, \
- sz.w, sz.h, pos.x, pos.y, w->getSkipFocus()?'S':' ', w->hasFocus()?'F':' ', w->isAllowUserGeometry()?'U':' ', w->getVkbdFloating()?'V':' ', \
- w->getParent(), (w->getTitle().compare("") == 0)?"No Title":w->getTitle().c_str());
- }
-
- DSLOG_INF("DSTraceInfo", "------------------------------------------------");
-}
-
-void DSTraceInfo::__onWindowCreated(std::shared_ptr<DSWindow> window)
-{
- __windowList.remove(window);
- __windowList.push_front(window);
-
- __windowUpdated = true;
-}
-
-void DSTraceInfo::__onWindowStackChanged(std::shared_ptr<DSWindow> window)
-{
- __windowList = __zone->getWindowList();
-
- __windowUpdated = true;
-}
-
-void DSTraceInfo::__onWindowDestroy(std::shared_ptr<DSWindow> window)
-{
- __windowList.remove(window);
-
- __windowUpdated = true;
-}
-
-std::shared_ptr<DSZone> DSTraceInfo::getZone()
-{
- return __zone;
-}
-
-}
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_TRACE_INFO_H__
-#define __DS_TRACE_INFO_H__
-
-#include <DSCore.h>
-#include "DSSignal.h"
-#include "DSWindow.h"
-#include "DSPolicyArea.h"
-#include "DSZone.h"
-#include "DSEventLoop.h"
-
-namespace display_server
-{
-
-class DSTraceInfo : public DSObject
-{
-public:
- explicit DSTraceInfo();
- virtual ~DSTraceInfo();
-
- bool attachPolicyArea(std::shared_ptr<DSPolicyArea> policyArea);
- void printWindowsInfo();
- std::shared_ptr<DSZone> getZone();
-
-private:
- void __onWindowCreated(std::shared_ptr<DSWindow> window);
- void __onWindowStackChanged(std::shared_ptr<DSWindow> window);
- void __onWindowDestroy(std::shared_ptr<DSWindow> window);
-
- void __onEventIdleEnterer(void *data);
-
- std::shared_ptr<DSPolicyArea> __policyArea;
- std::shared_ptr<DSZone> __zone;
- std::list<std::shared_ptr<DSWindow>> __windowList;
-
- DSEventLoop *__eventLoop;
- bool __windowUpdated;
-};
-
-}
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSUtilSocket.h"
-#include <malloc.h>
-#include <sys/xattr.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
-
-namespace display_server
-{
-
-/* reference count, mutex and compositor pointer for DSUtilSocket singleton */
-int DSUtilSocket::__refCount { 0 };
-std::mutex DSUtilSocket::__mutex;
-DSUtilSocket* DSUtilSocket::__utilSocket { nullptr };
-
-DSUtilSocket::DSUtilSocket()
-{
-}
-
-DSUtilSocket::~DSUtilSocket()
-{
-}
-
-/* getInstance for DSUtilSocket singleton */
-//static
-DSUtilSocket *DSUtilSocket::getInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- DSLOG_INF("DSUtilSocket",
- "[Get] instance __refCount=%d !", __refCount);
-
- if (!__utilSocket && (__refCount == 0))
- {
- __utilSocket = new DSUtilSocket();
- DSLOG_INF("DSUtilSocket",
- "DSUtilSocket instance has been created !");
- }
-
- ++__refCount;
- return __utilSocket;
-}
-
-/* releaseInstance for DSUtilSocket singleton */
-// static
-void DSUtilSocket::releaseInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- --__refCount;
- if (__refCount < 0)
- __refCount = 0;
- DSLOG_INF("DSUtilSocket",
- "[Release] instance __refCount=%d !", __refCount);
-
- if ((0 == __refCount) && __utilSocket)
- {
- delete __utilSocket;
- __utilSocket = nullptr;
- DSLOG_INF("DSUtilSocket",
- "DSUtilSocket instance has been removed !");
- }
-}
-
-void DSUtilSocket::initSocket(std::string socketName)
-{
- char *dir = nullptr;
- int res;
-#undef STRERR_BUFSIZE
-#define STRERR_BUFSIZE 1024
- char buf[STRERR_BUFSIZE];
-
- if (socketName.empty()) return;
-
- dir = getenv("XDG_RUNTIME_DIR");
- if (!dir) return;
-
- std::string xdgDir(dir);
-
- /* check whether buffer size is less than concatenated string which
- * is made of XDG_RUNTIME_DIR, '/', socket name and NULL.
- */
-
- int dirLength = xdgDir.length();
- int nameLength = socketName.length();
- if ((dirLength + nameLength + 2) > STRERR_BUFSIZE)
- {
- /*LCOV_EXCL_START*/
- DSLOG_WRN("DSUtilSocket", "Size of buffer is not enough. dir:%s name:%s", xdgDir, socketName);
- return;
- /*LCOV_EXCL_STOP*/
- }
-
- //snprintf(socket_path, sizeof(socket_path), "%s/%s", dir, name);
- std::string socketPath = xdgDir + "/" + socketName;
-
- uid_t uid = __getpwnam("root");
- gid_t gid = __getgrnam("display");
-
- res = chmod(socketPath.c_str(), 509);
- if (res < 0)
- {
- /*LCOV_EXCL_START*/
- DSLOG_WRN("DSUtilSocket", "Could not change modes of socket file:%s (%s)", socketPath.c_str(), strerror_r(errno, buf, STRERR_BUFSIZE));
- //PRCTL("[Winsys] Could not chane modes of socket file: %s", socketPath.c_str());
- return;
- /*LCOV_EXCL_STOP*/
- }
-
- res = chown(socketPath.c_str(), uid, gid);
- if (res < 0)
- {
- /*LCOV_EXCL_START*/
- DSLOG_WRN("DSUtilSocket", "Could not change owner of socket file:%s (%s)", socketPath.c_str(), strerror_r(errno, buf, STRERR_BUFSIZE));
- //PRCTL("[Winsys] Could not change owner of socket file: %s", socketPath.c_str());
- return;
- /*LCOV_EXCL_STOP*/
- }
-}
-
-int DSUtilSocket::__getpwnam(std::string name)
-{
- struct ::passwd *u;
- struct ::passwd *uRes;
- char* buf;
- size_t bufLen;
- int ret;
-#undef BUFLEN
-#define BUFLEN 2048
- bufLen = sysconf(_SC_GETPW_R_SIZE_MAX);
- if ((int)bufLen == -1) /* Value was indeterminate */
- bufLen = BUFLEN; /* Should be more than enough */
-#undef BUFLEN
-
- buf = (char *)malloc(bufLen);
- if (buf == NULL)
- {
- /*LCOV_EXCL_START*/
- DSLOG_WRN("DSUtilSocket", "failed to create buffer");
- return 0;
- /*LCOV_EXCL_STOP*/
- }
-
- u = (struct ::passwd *)malloc(sizeof(struct passwd));
- if (!u)
- {
- /*LCOV_EXCL_START*/
- DSLOG_WRN("DSUtilSocket", "failed to create password struct");
- free(buf);
- return 0;
- /*LCOV_EXCL_STOP*/
- }
-
- ret = getpwnam_r(name.c_str(), u, buf, bufLen, &uRes);
- if (uRes == nullptr)
- {
- /*LCOV_EXCL_START*/
- if (ret == 0) DSLOG_WRN("DSUtilSocket", "password not found");
- else DSLOG_WRN("DSUtilSocket", "errno returned by getpwnam_r is %d", ret);
- free(buf);
- free(u);
- return 0;
- /*LCOV_EXCL_STOP*/
- }
- ret = u->pw_uid;
- free(buf);
- free(u);
-
- return ret;
-}
-
-int DSUtilSocket::__getgrnam(std::string name)
-{
- struct ::group *g;
- struct ::group *grpRes;
- char* buf;
- size_t bufLen;
- int ret;
-#undef BUFLEN
-#define BUFLEN 2048
- bufLen = sysconf(_SC_GETGR_R_SIZE_MAX);
- if ((int)bufLen == -1) /* Value was indeterminate */
- bufLen = BUFLEN; /* Should be more than enough */
-#undef BUFLEN
-
- buf = (char *)malloc(bufLen);
- if (buf == nullptr)
- {
- /*LCOV_EXCL_START*/
- DSLOG_WRN("DSUtilSocket", "failed to create buffer");
- return 0;
- /*LCOV_EXCL_STOP*/
- }
-
- g = (struct ::group *)malloc(sizeof(struct group));
- if (!g)
- {
- /*LCOV_EXCL_START*/
- DSLOG_WRN("DSUtilSocket", "failed to create group struct");
- free(buf);
- return 0;
- /*LCOV_EXCL_STOP*/
- }
-
- ret = getgrnam_r(name.c_str(), g, buf, bufLen, &grpRes);
- if (grpRes == NULL)
- {
- /*LCOV_EXCL_START*/
- if (ret == 0) DSLOG_WRN("DSUtilSocket", "Group not found");
- else DSLOG_WRN("DSUtilSocket", "errno returned by getpwnam_r is %d", ret);
- free(buf);
- free(g);
- return 0;
- /*LCOV_EXCL_STOP*/
- }
-
- ret = g->gr_gid;
- free(buf);
- free(g);
- return ret;
-}
-
-
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_UTIL_SOCKET_H_
-#define __DS_UTIL_SOCKET_H_
-
-#include <DSCore.h>
-
-namespace display_server
-{
-
-class DSUtilSocket
-{
-public:
- static DSUtilSocket *getInstance();
- static void releaseInstance();
-
- void initSocket(std::string socketName);
-
-private:
- DSUtilSocket();
- ~DSUtilSocket();
- DSUtilSocket& operator=(const DSUtilSocket&) = delete;
- int __getpwnam(std::string name);
- int __getgrnam(std::string name);
-
- static std::mutex __mutex;
- static DSUtilSocket *__utilSocket;
- static int __refCount;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandExtension.h"
-#include "DSWaylandExtensionPrivate.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandZxdgShellV6.h"
-#include "DSWaylandTizenPolicy.h"
-#include "DSWaylandTizenAppinfo.h"
-#include "DSWaylandTizenLaunchEffect.h"
-#include "DSWaylandTizenSurface.h"
-#include "DSWaylandTizenPolicyExt.h"
-
-namespace display_server
-{
-
-DSWaylandExtensionPrivate::DSWaylandExtensionPrivate(DSWaylandExtension *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), __compositor(nullptr)
-{
-}
-
-DSWaylandExtensionPrivate::~DSWaylandExtensionPrivate()
-{
-
-}
-
-bool DSWaylandExtensionPrivate::init(DSWaylandCompositor *compositor)
-{
- if (__compositor)
- {
- DSLOG_ERR("DSWaylandExtension", "ERROR. Compositor already exist!");
- return false;
- }
-
- __compositor = compositor;
-
- try
- {
- __initShell();
- __initTizenPolicy();
- __initTizenAppinfo();
- __initTizenLaunchEffect();
- __initTizenSurface();
- __initTizenPolicyExt();
- }
- catch(const std::runtime_error& e)
- {
- DSLOG_ERR("DSWaylandExtension", "ERROR. %s is failed.", e.what());
- /*
- do something for release resource
- */
- return false;
- }
-
- DSLOG_INF("DSWaylandExtension", "Initialize succeed");
- return true;
-}
-
-bool DSWaylandExtensionPrivate::__initShell(void)
-{
- __zxdgShell = std::make_shared<DSWaylandZxdgShellV6>(__compositor);
- if (__zxdgShell == nullptr)
- {
- throw std::runtime_error(__func__);
- return false;
- }
-
- __compositor->setShell(__zxdgShell.get());
-
- return true;
-}
-
-bool DSWaylandExtensionPrivate::__initTizenPolicy(void)
-{
- __tzPolicy = std::make_shared<DSWaylandTizenPolicy>(__compositor);
- if (__tzPolicy == nullptr)
- {
- throw std::runtime_error(__func__);
- return false;
- }
-
- return true;
-}
-
-bool DSWaylandExtensionPrivate::__initTizenAppinfo(void)
-{
- __tzAppinfo = std::make_shared<DSWaylandTizenAppinfo>(__compositor);
- if (__tzAppinfo == nullptr)
- {
- throw std::runtime_error(__func__);
- return false;
- }
-
- return true;
-}
-
-bool DSWaylandExtensionPrivate::__initTizenLaunchEffect(void)
-{
- __tzLaunchEffect = std::make_shared<DSWaylandTizenLaunchEffect>(__compositor);
- if (__tzLaunchEffect == nullptr)
- {
- throw std::runtime_error(__func__);
- return false;
- }
-
- return true;
-}
-
-bool DSWaylandExtensionPrivate::__initTizenSurface(void)
-{
- __tzSurface = std::make_shared<DSWaylandTizenSurface>(__compositor);
- if (__tzSurface == nullptr)
- {
- throw std::runtime_error(__func__);
- return false;
- }
-
- return true;
-}
-
-bool DSWaylandExtensionPrivate::__initTizenPolicyExt(void)
-{
- __tzPolicyExt = std::make_shared<DSWaylandTizenPolicyExt>(__compositor);
- if (__tzPolicyExt == nullptr)
- {
- throw std::runtime_error(__func__);
- return false;
- }
-
- return true;
-}
-
-
-DSWaylandExtension::DSWaylandExtension(DSWaylandCompositor *compositor)
- : DS_INIT_PRIVATE_PTR(DSWaylandExtension)
-{
- __init(compositor);
-}
-
-DSWaylandExtension::~DSWaylandExtension()
-{
-}
-
-bool DSWaylandExtension::__init(DSWaylandCompositor *compositor)
-{
- if (compositor == nullptr)
- {
- DSLOG_ERR("DSWaylandExtension", "There is no compositor. CRITICAL!");
- return false;
- }
-
- struct ::wl_display *display = nullptr;
- display = compositor->display();
- if (display == nullptr)
- {
- DSLOG_ERR("DSWaylandExtension", "There is no wl_display. CRITICAL!");
- return false;
- }
-
- DS_GET_PRIV(DSWaylandExtension);
-
- return priv->init(compositor);
-}
-
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_EXTENSION_H__
-#define __DS_WAYLAND_EXTENSION_H__
-
-#include "DSCore.h"
-#include "DSStruct.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSWaylandExtensionPrivate;
-class DSWaylandCompositor;
-
-class DSWaylandExtension : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandExtension)
-
-public:
- DSWaylandExtension() = delete;
- DSWaylandExtension(DSWaylandCompositor *compositor);
- virtual ~DSWaylandExtension();
-
-private:
- bool __init(DSWaylandCompositor *compositor);
-
-private:
-};
-
-} // namespace display_server
-
-#endif // __DS_WAYLAND_EXTENSION_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_EXTENSION_PRIVATE_H__
-#define __DS_WAYLAND_EXTENSION_PRIVATE_H__
-
-namespace display_server
-{
-
-class DSWaylandZxdgShellV6;
-class DSWaylandTizenPolicy;
-class DSWaylandTizenAppinfo;
-class DSWaylandTizenLaunchEffect;
-class DSWaylandTizenSurface;
-class DSWaylandTizenPolicyExt;
-
-class DSWaylandExtensionPrivate : public DSObjectPrivate
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandExtension)
-
-public:
- DSWaylandExtensionPrivate() = delete;
- DSWaylandExtensionPrivate(DSWaylandExtension *p_ptr);
- virtual ~DSWaylandExtensionPrivate();
-
- bool init(DSWaylandCompositor *compositor);
-
-private:
- bool __initShell(void);
- bool __initTizenPolicy(void);
- bool __initTizenAppinfo(void);
- bool __initTizenLaunchEffect(void);
- bool __initTizenSurface(void);
- bool __initTizenPolicyExt(void);
-
-private:
- DSWaylandCompositor *__compositor;
- std::shared_ptr<DSWaylandZxdgShellV6> __zxdgShell;
- std::shared_ptr<DSWaylandTizenPolicy> __tzPolicy;
- std::shared_ptr<DSWaylandTizenAppinfo> __tzAppinfo;
- std::shared_ptr<DSWaylandTizenLaunchEffect> __tzLaunchEffect;
- std::shared_ptr<DSWaylandTizenSurface> __tzSurface;
- std::shared_ptr<DSWaylandTizenPolicyExt> __tzPolicyExt;
-
-};
-
-} // namespace display_server
-
-#endif // __DS_WAYLAND_EXTENSION_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandBuffer.h"
-#include "DSWaylandBufferPrivate.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-DSWaylandBufferPrivate::DSWaylandBufferPrivate(DSWaylandBuffer *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{
-}
-
-DSWaylandBufferPrivate::~DSWaylandBufferPrivate()
-{
-}
-
-void DSWaylandBufferPrivate::buffer_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandBufferPrivate::buffer_destroy_resource(Resource *resource)
-{
-}
-
-DSWaylandBuffer::DSWaylandBuffer()
- : DSObject(std::make_unique<DSWaylandBufferPrivate>(this))
-{
-}
-
-DSWaylandBuffer::~DSWaylandBuffer()
-{
-}
-
-void DSWaylandBuffer::sendRelease()
-{
- DS_GET_PRIV(DSWaylandBuffer);
-
- priv->send_release();
-}
-/*LCOV_EXCL_STOP*/
-
-} /* namespace display_server */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_BUFFER_H_
-#define _DS_WAYLAND_BUFFER_H_
-
-#include <DSObject.h>
-#include <DSCore.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandBufferPrivate;
-
-class DSWaylandBuffer : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandBuffer);
-public:
- DSWaylandBuffer();
- virtual ~DSWaylandBuffer();
-
- void sendRelease();
-};
-/*LCOV_EXCL_STOP*/
-
-} /* namespace display_server */
-
-#endif /* _DS_WAYLAND_BUFFER_H_ */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_BUFFER_PRIVATE_H_
-#define _DS_WAYLAND_BUFFER_PRIVATE_H_
-
-#include "dswayland-server-wayland.h"
-#include "DSWaylandBuffer.h"
-
-namespace display_server
-{
-
-class DSWaylandBufferPrivate : public DSObjectPrivate, public DSWaylandServer::wl_buffer
-{
- DS_PIMPL_USE_PUBLIC(DSWaylandBuffer);
-public:
- DSWaylandBufferPrivate() = delete;
- DSWaylandBufferPrivate(DSWaylandBuffer *p_ptr);
- ~DSWaylandBufferPrivate() override;
-
-protected:
- void buffer_bind_resource(Resource *resource) override;
- void buffer_destroy_resource(Resource *resource) override;
-
-private:
-
-};
-
-} /* namespace display_server */
-
-#endif /* _DS_WAYLAND_BUFFER_PRIVATE_H_ */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandCallback.h"
-#include "DSWaylandCallbackPrivate.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-DSWaylandCallbackPrivate::DSWaylandCallbackPrivate(DSWaylandCallback *p_ptr)
- : DSObjectPrivate(p_ptr)
-{
-}
-
-DSWaylandCallbackPrivate::~DSWaylandCallbackPrivate()
-{
-}
-
-void DSWaylandCallbackPrivate::callback_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandCallbackPrivate::callback_destroy_resource(Resource *resource)
-{
-}
-
-DSWaylandCallback::DSWaylandCallback()
- : DSObject(std::make_unique<DSWaylandCallbackPrivate>(this))
-{
-}
-
-DSWaylandCallback::~DSWaylandCallback()
-{
-}
-/*LCOV_EXCL_STOP*/
-
-} /* namespace display_server */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_CALLBACK_H_
-#define _DS_WAYLAND_CALLBACK_H_
-
-#include <DSObject.h>
-
-namespace display_server
-{
-
-class DSWaylandCallbackPrivate;
-
-
-class DSWaylandCallback : public DSObject
-{
-public:
- DSWaylandCallback();
- virtual ~DSWaylandCallback();
-
-private:
- inline DSWaylandCallbackPrivate *__d_func()
- {
- return reinterpret_cast<DSWaylandCallbackPrivate *>(_d_ptr.get());
- }
-
- inline const DSWaylandCallbackPrivate *__d_func() const
- {
- return reinterpret_cast<DSWaylandCallbackPrivate *>(_d_ptr.get());
- }
-
- friend class DSWaylandCallbackPrivate;
-};
-
-} /* namespace display_server */
-
-#endif /* _DS_WAYLAND_CALLBACK_H_ */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_CALLBACK_PRIVATE_H_
-#define _DS_WAYLAND_CALLBACK_PRIVATE_H_
-
-#include "dswayland-server-wayland.h"
-#include "DSWaylandCallback.h"
-
-namespace display_server
-{
-
-class DSWaylandCallbackPrivate : public DSObjectPrivate, public DSWaylandServer::wl_callback
-{
-public:
- DSWaylandCallbackPrivate() = delete;
- DSWaylandCallbackPrivate(DSWaylandCallback *p_ptr);
- ~DSWaylandCallbackPrivate() override;
-
-protected:
- void callback_bind_resource(Resource *resource) override;
- void callback_destroy_resource(Resource *resource) override;
-
-private:
-
-};
-
-} /* namespace display_server */
-
-#endif /* _DS_WAYLAND_CALLBACK_PRIVATE_H_ */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandClient.h"
-#include "DSWaylandClientPrivate.h"
-#include "DSWaylandCompositor.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-/* Begin Private Class Implementation */
-DSWaylandClientPrivate::DSWaylandClientPrivate(DSWaylandCompositor *compositor, DSWaylandClient *client)
- : DSObjectPrivate(client),
- __p_ptr(client),
- __wlClient(nullptr),
- __pid(0),
- __uid(0),
- __gid(0),
- __compositor(compositor)
-{
-}
-
-DSWaylandClientPrivate::~DSWaylandClientPrivate()
-{
-}
-
-void DSWaylandClientPrivate::client_destroy_callback(struct ::wl_listener *listener, void *data)
-{
- struct ::wl_client *wlClient = (struct ::wl_client *)data;
-
- (void) wlClient;
-
- DSWaylandClient *client = reinterpret_cast<ClientDestroyListener *>(listener)->parent;
- if (client != nullptr)
- {
- DSLOG_INF("DSWaylandClientPrivate", "Client(%p) is going to be destroyed with wlClient(%p) ! (pid:%d, uid:%d, gid:%d)",
- client, wlClient, client->pid(), client->uid(), client->gid());
-
- delete client;
- }
-}
-
-/* Begin Public Class Implementation */
-DSWaylandClient::DSWaylandClient(DSWaylandCompositor *compositor, struct ::wl_client *wlClient)
- : DSObject(),
- _d_ptr(std::make_unique<DSWaylandClientPrivate>(compositor, this))
-{
- pid_t pid = 0;
- uid_t uid = 0;
- gid_t gid = 0;
-
- DS_GET_PRIV(DSWaylandClient);
-
- if (wlClient)
- {
- wl_client_get_credentials(wlClient, &pid, &uid, &gid);
-
- priv->__pid = pid;
- priv->__uid = uid;
- priv->__gid = gid;
- priv->__wlClient = wlClient;
-
- priv->m_clientDestroyListener.parent = this;
- priv->m_clientDestroyListener.listener.notify = DSWaylandClientPrivate::client_destroy_callback;
- wl_client_add_destroy_listener(wlClient, &priv->m_clientDestroyListener.listener);
-
- DSLOG_INF("DSWaylandClient", "wlClient=%p", wlClient);
-
- DSWaylandCompositor::getInstance();
- compositor->addClient(this);
- }
- else
- {
- priv->__pid = 0;
- priv->__uid = 0;
- priv->__gid = 0;
- priv->__wlClient = nullptr;
-
- DSLOG_ERR("DSWaylandClient", "wlClient is invalid.");
- }
-}
-
-DSWaylandClient::~DSWaylandClient()
-{
- DS_GET_PRIV(DSWaylandClient);
-
- if (priv->__wlClient)
- {
- wl_list_remove(&priv->m_clientDestroyListener.listener.link);
-
- DSLOG_INF("DSWaylandClient", "priv->__wlClient=%p", priv->__wlClient);
- getCompositor()->removeClient(this);
- DSWaylandCompositor::releaseInstance();
- }
- else
- {
- DSLOG_ERR("DSWaylandClient", "wlClient is invalid.");
- }
-}
-
-DSWaylandClient *DSWaylandClient::fromWlClient(wl_client *wlClient)
-{
- if (!wlClient)
- {
- DSLOG_ERR("DSWaylandClient", "Invalid wlClient !");
- return nullptr;
- }
-
- struct ::wl_listener *listener = wl_client_get_destroy_listener(
- wlClient,
- DSWaylandClientPrivate::client_destroy_callback);
-
- if (!listener)
- {
- DSLOG_ERR("DSWaylandClient", "No listener from the given wlClient(%p) !", wlClient);
- return nullptr;
- }
-
- DSWaylandClient *dswlClient = reinterpret_cast<DSWaylandClientPrivate::ClientDestroyListener *>(
- wl_container_of(listener,
- (DSWaylandClientPrivate::ClientDestroyListener *)nullptr,
- listener))->parent;
-
- if (!dswlClient)
- {
- DSLOG_ERR("DSWaylandClient", "No DSWaylandClient pointer available from listener(%p) !", listener);
- return nullptr;
- }
-
- DSLOG_INF("DSWaylandClient", "wlClient=%p, dswlClient=%p", wlClient, dswlClient);
-
- return dswlClient;
-}
-
-pid_t DSWaylandClient::pid(void)
-{
- DS_GET_PRIV(DSWaylandClient);
-
- return priv->__pid;
-}
-
-uid_t DSWaylandClient::uid(void)
-{
- DS_GET_PRIV(DSWaylandClient);
-
- return priv->__uid;
-}
-
-gid_t DSWaylandClient::gid(void)
-{
- DS_GET_PRIV(DSWaylandClient);
-
- return priv->__gid;
-}
-
-wl_client *DSWaylandClient::wlClient(void)
-{
- DS_GET_PRIV(DSWaylandClient);
-
- return priv->__wlClient;
-}
-
-DSWaylandCompositor *DSWaylandClient::getCompositor()
-{
- DS_GET_PRIV(DSWaylandClient);
-
- return priv->__compositor;
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_CLIENT_H__
-#define __DS_WAYLAND_CLIENT_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-struct wl_client;
-
-namespace display_server
-{
-
-class DSWaylandClientPrivate;
-class DSWaylandCompositor;
-class DS_DECL_EXPORT DSWaylandClient : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWaylandClient);
-public:
- DSWaylandClient(DSWaylandCompositor *compositor, struct ::wl_client *wlClient);
- ~DSWaylandClient() override;
-
- static DSWaylandClient *fromWlClient(wl_client *wlClient);
-
- pid_t pid(void);
- uid_t uid(void);
- gid_t gid(void);
-
- wl_client *wlClient(void);
- DSWaylandCompositor *getCompositor(void);
-
- //TODO
-
-protected:
-
-private:
-
-};
-
-}
-
-#endif //__DS_WAYLAND_CLIENT_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_CLIENT_PRIVATE_H__
-#define __DS_WAYLAND_CLIENT_PRIVATE_H__
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-
-#include <wayland-server-core.h>
-
-namespace display_server
-{
-
-class DSWaylandClient;
-class DSWaylandCompositor;
-class DS_DECL_EXPORT DSWaylandClientPrivate : public DSObjectPrivate
-{
- DS_PIMPL_USE_PUBLIC(DSWaylandClient);
-public:
- DSWaylandClientPrivate(DSWaylandCompositor *compositor, DSWaylandClient *client);
- ~DSWaylandClientPrivate() override;
-
- static void client_destroy_callback(struct ::wl_listener *listener, void *data);
- struct ClientDestroyListener
- {
- struct ::wl_listener listener;
- DSWaylandClient *parent = nullptr;
- };
- ClientDestroyListener m_clientDestroyListener;
-
-protected:
-
-private:
- wl_client *__wlClient;
- pid_t __pid;
- uid_t __uid;
- gid_t __gid;
- DSWaylandCompositor *__compositor;
-};
-
-}
-
-#endif //__DS_WAYLAND_CLIENT_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandCompositor.h"
-#include "DSWaylandCompositorPrivate.h"
-#include "DSWaylandExtension.h"
-#include "DSWaylandClient.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandSurface.h"
-#include "DSWaylandRegion.h"
-#include "DSDebugLog.h"
-#include "DSUtilSocket.h"
-
-namespace display_server
-{
-
-/* reference count, mutex and compositor pointer for DSWaylandCompositor singleton */
-int DSWaylandCompositor::__refCount { 0 };
-std::mutex DSWaylandCompositor::__mutex;
-DSWaylandCompositor* DSWaylandCompositor::__comp { nullptr };
-
-/* Begin Private Class Implementation */
-DSWaylandCompositorPrivate::DSWaylandCompositorPrivate(DSWaylandCompositor *compositor)
- : DSObjectPrivate(compositor),
- __p_ptr(compositor),
- m_clientCreatedListener({nullptr, nullptr}),
- _created(false),
- _socketFD(-1),
- _socketName(),
- _display(nullptr),
- _loop(nullptr),
- _socket_fd_handler(nullptr),
- _compositor(compositor),
- __wlExtension(nullptr),
- __shell(nullptr)
-{
- if (!ecore_init())
- {
- DSLOG_ERR("DSWaylandCompositor", "ecore_init() fails.\n");
- return;
- }
-
- _display = wl_display_create();
- DS_ASSERT(_display != nullptr);
-
- m_clientCreatedListener.notify = DSWaylandCompositorPrivate::client_created_callback;
- m_clientCreatedListener.parent = this;
- wl_display_add_client_created_listener(_display, &m_clientCreatedListener);
-}
-
-DSWaylandCompositorPrivate::~DSWaylandCompositorPrivate()
-{
- //TODO : destroy all allocated resources
-
- wl_list_remove(&m_clientCreatedListener.link);
-
- _clients.clear();
- _seats.clear();
- _socketName.clear();
-
- if (_socket_fd_handler)
- {
- ecore_main_fd_handler_del(_socket_fd_handler);
- ecore_main_fd_handler_prepare_callback_set(_socket_fd_handler, nullptr, nullptr);
- _socket_fd_handler = nullptr;
- }
-
- if (_display)
- {
- wl_display_destroy(_display);
- _display = nullptr;
- }
-
- _created = false;
- _socketFD = -1;
- _loop = nullptr;
- _compositor = nullptr;
- __p_ptr = nullptr;
-
- ecore_shutdown();
-}
-
-void DSWaylandCompositorPrivate::client_created_callback(struct ::wl_listener *listener, void *data)
-{
- struct ::wl_client *wlClient = (struct ::wl_client *)data;
- DS_ASSERT(wlClient != nullptr);
-
- DSWaylandClient *client = nullptr;
- DSWaylandCompositorPrivate *compPriv = reinterpret_cast<ClientCreatedListener *>(listener)->parent;
-
- if (compPriv != nullptr)
- {
- client = new DSWaylandClient(compPriv->_compositor, wlClient);
- DS_ASSERT(client != nullptr);
-
- DSLOG_INF("DSWaylandCompositorPrivate", "Client created ! (pid:%d, uid:%d, gid:%d)",
- client->pid(), client->uid(), client->gid());
- }
-}
-
-void DSWaylandCompositorPrivate::initSocket(std::string sName, std::string sDir)
-{
- std::string socketPath = std::move(sDir);
-
- socketPath.append(1, '/');
- socketPath.append(_socketName);
-
- (void) socketPath;
-
- DSUtilSocket *utilSocket = DSUtilSocket::getInstance();
- utilSocket->initSocket(sName);
- utilSocket->releaseInstance();
-
- //TODO : set permissions for Owner, Group and Other
- //TODO : set Smack attributes for socket
- //TODO : set symbolic link for socket
-}
-
-bool DSWaylandCompositorPrivate::initCompositor()
-{
- if (!_display)
- {
- DSLOG_ERR("DSWaylandCompositor", "_display(wl_display) is NULL !\n");
- return false;
- }
-
- //Initialize needed interfaces
- //TODO : get/set DSConfig::version("wl_compositor")
- wl_compositor::init(_display, 4);
-
- //TODO : get socketName from DSConfig::socketName()
- //TODO : create socket with wl_display_add_socket() if socketName not empty
- _socketName = wl_display_add_socket_auto(_display);
-
- if (_socketName.empty())
- {
- DSLOG_ERR("DSWaylandCompositor", "_socketName is empty()\n");
- return false;
- }
-
- initSocket(_socketName, "/run");
-
- //TODO : DSConfig::setEnv("WAYLAND_DISPLAY", _socketName);
-
- //TODO : initialize compositor signals (signals.surface.create/activate/kill)
- //ex> implment using DSWaylandSignal class
- //wl_signal_init(&cdata->signals.surface.create);
- //-> DSWayalndSignal::add("surface_create", wl_notify_func_t *notify or ¬ify_func);
-
- //TODO : add event dispatcher for wayland socket and other fd(s)
- _loop = wl_display_get_event_loop(_display);
-
- if (!_loop)
- {
- DSLOG_ERR("DSWaylandCompositor", "_loop is nullptr.\n");
- return false;
- }
-
- _socketFD = wl_event_loop_get_fd(_loop);
-
- if (0 > _socketFD)
- {
- DSLOG_ERR("DSWaylandCompositor", "_socketFD is invalid. (_socketFD=%d)\n", _socketFD);
- return false;
- }
-
- auto evFlags = ECORE_FD_READ | ECORE_FD_ERROR;
-
- _socket_fd_handler = ecore_main_fd_handler_add(_socketFD,
- static_cast<Ecore_Fd_Handler_Flags >(evFlags),
- __readEvents, this, NULL, NULL);
-
- if (!_socket_fd_handler)
- {
- DSLOG_ERR("DSWaylandCompositor", "_socket_fd_handler is invalid.\n");
- }
-
- ecore_main_fd_handler_prepare_callback_set(_socket_fd_handler,
- __prepareFunc, this);
-
- return true;
-}
-
-bool DSWaylandCompositorPrivate::initExtension()
-{
- if (__wlExtension)
- {
- DSLOG_INF("DSWaylandCompositor", "Already initialize Extension");
- return true;
- }
-
- __wlExtension = std::make_unique<DSWaylandExtension>(_compositor);
- if (!__wlExtension) return false;
-
- return true;
-}
-
-Eina_Bool DSWaylandCompositorPrivate::__readEvents(void *data, Ecore_Fd_Handler *hdlr)
-{
- DSWaylandCompositorPrivate *compPrivate = (DSWaylandCompositorPrivate *) data;
-
- if (!compPrivate)
- {
- DSLOG_DBG("DSWaylandCompositor", "compPrivate is invalid.\n");
- return ECORE_CALLBACK_RENEW;
- }
-
- (void) hdlr;
-
- /* dispatch pending wayland events */
- int ret = wl_event_loop_dispatch(compPrivate->_loop, 0);
-
- if (ret)
- {
- DSLOG_ERR("DSWaylandCompositor", "Failed on wl_event_loop_dispatch()\n");
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-void DSWaylandCompositorPrivate::__prepareFunc(void *data, Ecore_Fd_Handler *hdlr)
-{
- DSWaylandCompositorPrivate *compPrivate = (DSWaylandCompositorPrivate *) data;
-
- if (!compPrivate)
- {
- DSLOG_DBG("DSWaylandCompositor", "compPrivate is invalid.\n");
- return;
- }
-
- (void) hdlr;
-
- /* flush pending client events */
- wl_display_flush_clients(compPrivate->_display);
-}
-
-void DSWaylandCompositorPrivate::compositor_bind_resource(wl_compositor::Resource *resource)
-{
- //TODO : Leave log (pid/uid/gid and process name)
- //TODO : Update connected client list (add)
-}
-
-void DSWaylandCompositorPrivate::compositor_destroy_resource(wl_compositor::Resource *resource)
-{
- //TODO : Leave log (pid/uid/gid and process name)
- //TODO : Update connected client list (remove)
-}
-
-void DSWaylandCompositorPrivate::compositor_create_surface(wl_compositor::Resource *resource, uint32_t id)
-{
- DS_GET_PUB(DSWaylandCompositor);
-
- DSWaylandClient *waylandClient = DSWaylandClient::fromWlClient(resource->client());
- auto waylandSruface = std::make_shared<DSWaylandSurface>(waylandClient, id);
-
- pub->__surfaceList.push_front(waylandSruface);
-
- // emit a signal of the surface created
- pub->__surfaceCreatedSignal.emit(waylandSruface);
-}
-
-void DSWaylandCompositorPrivate::compositor_create_region(wl_compositor::Resource *resource, uint32_t id)
-{
- DS_GET_PUB(DSWaylandCompositor);
-
- DSWaylandClient *waylandClient = DSWaylandClient::fromWlClient(resource->client());
- auto waylandRegion = std::make_shared<DSWaylandRegion>(waylandClient, id);
-
- pub->__regionList.push_front(waylandRegion);
-}
-
-/* Begin Public Class Implementation */
-DSWaylandCompositor::DSWaylandCompositor(DSObject *parent)
- : DS_INIT_PRIVATE_PTR(DSWaylandCompositor)
-{
- //TODO
-}
-
-DSWaylandCompositor::~DSWaylandCompositor()
-{
- //TODO
-}
-
-/* getInstance for DSWaylandCompositor singleton */
-DSWaylandCompositor *DSWaylandCompositor::getInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- DSLOG_INF("DSWaylandCompositor",
- "[Get] instance __refCount=%d !", __refCount);
-
- if (!__comp && (__refCount == 0))
- {
- __comp = new DSWaylandCompositor(new DSObject);
- DSLOG_INF("DSWaylandCompositor",
- "DSWaylandCompositor instance has been created !");
- }
-
- ++__refCount;
- return __comp;
-}
-
-/* releaseInstance for DSWaylandCompositor singleton */
-void DSWaylandCompositor::releaseInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- --__refCount;
- if (__refCount < 0)
- __refCount = 0;
- DSLOG_INF("DSWaylandCompositor",
- "[Release] instance __refCount=%d !", __refCount);
-
- if ((0 == __refCount) && __comp)
- {
- delete __comp;
- __comp = nullptr;
- DSLOG_INF("DSWaylandCompositor",
- "DSWaylandCompositor instance has been removed !");
- }
-}
-
-bool DSWaylandCompositor::create()
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- bool res = false;
-
- res = priv->initCompositor();
- if (!res)
- {
- DSLOG_ERR("DSWaylandCompositor", "Failed on initCompositor ! (res=%d)\n", res);
- return false;
- }
-
- res = priv->initExtension();
- if (!res)
- {
- DSLOG_ERR("DSWaylandCompositor", "Failed on initExtension ! (res=%d)\n", res);
- return false;
- }
-
- priv->_created = true;
- return true;
-}
-
-bool DSWaylandCompositor::isCreated()
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- return priv->_created;
-}
-
-DSWaylandSeat *DSWaylandCompositorPrivate::addSeat(uint32_t cap)
-{
- DSWaylandSeat *dswlSeat = new DSWaylandSeat(_compositor, (DSWaylandSeat::seatCapability)cap);
-
- if (!dswlSeat)
- {
- DSLOG_ERR("DSWaylandCompositorPrivate", "Failed to create DSWaylandSeat !");
- return nullptr;
- }
-
- //TODO : check if the client is in clients already ?
- _seats.push_back(dswlSeat);
-
- DSLOG_INF("DSWaylandCompositorPrivate", "Seat(%p) has been added.", dswlSeat);
-
- //TODO : emit seatAdded signal
-
- return dswlSeat;
-}
-
-void DSWaylandCompositorPrivate::removeSeat(DSWaylandSeat *dswlSeat)
-{
- DS_ASSERT(dswlSeat != nullptr);
-
- //TODO : check if the client is in clients already ?
- _seats.remove(dswlSeat);
- DSLOG_INF("DSWaylandCompositorPrivate", "Seat(%p) has been removed.", dswlSeat);
-
- //TODO : emit seatRemoved signal before deleting a seat;
- delete dswlSeat;
-}
-
-bool DSWaylandCompositorPrivate::setShell(IDSWaylandShell *shell)
-{
- if (__shell)
- {
- DSLOG_ERR("DSWaylandCompositor", "Already register IDSWaylandShell!");
- return false;
- }
-
- __shell = shell;
- return true;
-}
-
-IDSWaylandShell *DSWaylandCompositorPrivate::getShell(void)
-{
- return __shell;
-}
-
-
-std::string DSWaylandCompositor::socketName()
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- return priv->_socketName;
-}
-
-struct ::wl_display *DSWaylandCompositor::display()
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- return priv->_display;
-}
-
-uint32_t DSWaylandCompositor::nextSerial()
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- return wl_display_next_serial(priv->_display);
-}
-
-uint32_t DSWaylandCompositor::currentTime()
-{
- return ecore_time_unix_get();
-}
-
-void DSWaylandCompositor::addClient(DSWaylandClient *client)
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- priv->addClient(client);
-}
-
-void DSWaylandCompositor::removeClient(DSWaylandClient *client)
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- priv->removeClient(client);
-}
-
-DSWaylandSeat *DSWaylandCompositor::addSeat(uint32_t cap)
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- return priv->addSeat(cap);
-}
-
-void DSWaylandCompositor::removeSeat(DSWaylandSeat *seat)
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- priv->removeSeat(seat);
-}
-
-std::list<DSWaylandClient *> DSWaylandCompositor::clients()
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- return priv->_clients;
-}
-
-DSWaylandSeat *DSWaylandCompositor::defaultSeat()
-{
- DS_GET_PRIV(DSWaylandCompositor);
-
- if (!priv->_seats.empty())
- {
- return priv->_seats.front();
- }
-
- return nullptr;
-}
-
-bool DSWaylandCompositor::setShell(IDSWaylandShell *shell)
-{
- DS_GET_PRIV(DSWaylandCompositor);
- return priv->setShell(shell);
-}
-
-IDSWaylandShell *DSWaylandCompositor::getShell(void)
-{
- DS_GET_PRIV(DSWaylandCompositor);
- return priv->getShell();
-}
-
-DSWaylandSurface *DSWaylandCompositor::getSurface(uint32_t id)
-{
- for (auto s : __surfaceList)
- {
- if (s->getResourceId() == id)
- {
- return s.get();
- }
- }
-
- return nullptr;
-}
-
-DSWaylandSurface *DSWaylandCompositor::getSurface(struct ::wl_resource *surface)
-{
- for (auto s : __surfaceList)
- {
- if (s->getWlResource() == surface)
- {
- return s.get();
- }
- }
-
- return nullptr;
-}
-
-void DSWaylandCompositor::sendSurfaceDestroy(DSWaylandSurface *dswSurface)
-{
- for (auto s : __surfaceList)
- {
- if (s.get() == dswSurface)
- {
- __surfaceDestroySignal.emit(s);
- __surfaceList.remove(s);
- break;
- }
- }
-}
-
-void DSWaylandCompositor::regionDestroy(DSWaylandRegion *dswRegion)
-{
- for (auto s : __regionList)
- {
- if (s.get() == dswRegion)
- {
- __regionList.remove(s);
- break;
- }
- }
-}
-
-void DSWaylandCompositor::registerCallbackSurfaceCreated(DSObject *slot, std::function<void(std::shared_ptr<DSWaylandSurface>)> func)
-{
- this->__surfaceCreatedSignal.connect(slot, func);
-}
-
-void DSWaylandCompositor::registerCallbackSurfaceDestroy(DSObject *slot, std::function<void(std::shared_ptr<DSWaylandSurface>)> func)
-{
- __surfaceDestroySignal.connect(slot, func);
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_COMPOSITOR_H__
-#define __DS_WAYLAND_COMPOSITOR_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSSignal.h"
-#include <mutex>
-
-struct wl_display;
-struct wl_resource;
-
-namespace display_server
-{
-
-class DSWaylandClient;
-class DSWaylandSeat;
-class DSWaylandSurface;
-class IDSWaylandShell;
-class DSWaylandRegion;
-
-class DSWaylandCompositorPrivate;
-
-class DS_DECL_EXPORT DSWaylandCompositor : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWaylandCompositor);
-public:
- static DSWaylandCompositor *getInstance();
- static void releaseInstance();
-
- bool create();
- bool isCreated();
-
- void addClient(DSWaylandClient *client);
- void removeClient(DSWaylandClient *client);
- DSWaylandSeat *addSeat(uint32_t cap);
- void removeSeat(DSWaylandSeat *seat);
-
- std::string socketName();
- struct ::wl_display *display();
- uint32_t nextSerial();
- uint32_t currentTime();
- std::list<DSWaylandClient *> clients();
- DSWaylandSeat *defaultSeat();
-
- bool setShell(IDSWaylandShell *shell);
- IDSWaylandShell *getShell(void);
-
- DSWaylandSurface *getSurface(uint32_t id);
- DSWaylandSurface *getSurface(struct ::wl_resource *surface);
-
- void sendSurfaceDestroy(DSWaylandSurface *dswSurface);
- void regionDestroy(DSWaylandRegion *dswRegion);
-
- // Callback methods
- void registerCallbackSurfaceCreated(DSObject *slot, std::function<void(std::shared_ptr<DSWaylandSurface>)> func);
- void registerCallbackSurfaceDestroy(DSObject *slot, std::function<void(std::shared_ptr<DSWaylandSurface>)> func);
-
-protected:
- //TODO
-
-private:
- static std::mutex __mutex;
- static DSWaylandCompositor *__comp;
- static int __refCount;
-
- DSWaylandCompositor() = delete;
- ~DSWaylandCompositor();
- DSWaylandCompositor(DSObject *parent);
- DSWaylandCompositor& operator=(const DSWaylandCompositor&) = delete;
-
- std::list<std::shared_ptr<DSWaylandSurface>> __surfaceList;
- std::list<std::shared_ptr<DSWaylandRegion>> __regionList;
-
- // signals
- DSSignal<std::shared_ptr<DSWaylandSurface>> __surfaceCreatedSignal;
- DSSignal<std::shared_ptr<DSWaylandSurface>> __surfaceDestroySignal;
-};
-
-}
-
-#endif //__DS_WAYLAND_COMPOSITOR_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_COMPOSITOR_PRIVATE_H__
-#define __DS_WAYLAND_COMPOSITOR_PRIVATE_H__
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "dswayland-server-wayland.h"
-#include "DSWaylandClient.h"
-#include "DSDebugLog.h"
-
-#include <wayland-server-core.h>
-#include <Ecore.h>
-
-namespace display_server
-{
-
-class DSWaylandClient;
-class DSWaylandSeat;
-class DSWaylandCompositor;
-class DSWaylandExtension;
-
-class DS_DECL_EXPORT DSWaylandCompositorPrivate : public DSObjectPrivate, public DSWaylandServer::wl_compositor
-{
- DS_PIMPL_USE_PUBLIC(DSWaylandCompositor);
-public:
- DSWaylandCompositorPrivate(DSWaylandCompositor *compositor);
- ~DSWaylandCompositorPrivate() override;
-
- bool initCompositor();
- bool initExtension();
- void initSocket(std::string sName, std::string sDir);
- inline void addClient(DSWaylandClient *client);
- inline void removeClient(DSWaylandClient *client);
- DSWaylandSeat *addSeat(uint32_t cap);
- void removeSeat(DSWaylandSeat *seat);
-
- bool setShell(IDSWaylandShell *shell);
- IDSWaylandShell *getShell(void);
-
- static void client_created_callback(struct ::wl_listener *listener, void *data);
- struct ClientCreatedListener : ::wl_listener {
- DSWaylandCompositorPrivate *parent;
- };
- ClientCreatedListener m_clientCreatedListener;
-
-protected:
- //virtual Resource *compositor_allocate();
- void compositor_bind_resource(Resource *resource) override;
- void compositor_destroy_resource(Resource *resource) override;
- void compositor_create_surface(Resource *resource, uint32_t id) override;
- void compositor_create_region(Resource *resource, uint32_t id) override;
-
- std::list<DSWaylandClient *> _clients;
- std::list<DSWaylandSeat *> _seats;
-
- bool _created;
- int _socketFD;
- std::string _socketName;
- struct ::wl_display *_display;
- wl_event_loop *_loop;
- Ecore_Fd_Handler *_socket_fd_handler;
- DSWaylandCompositor *_compositor;
-
- //TODO : add DSOutput list
- //TODO : add DSWindow (DSSurface ?) list
-
-private:
- static Eina_Bool __readEvents(void *data, Ecore_Fd_Handler *hdlr);
- static void __prepareFunc(void *data, Ecore_Fd_Handler *hdlr);
-
- std::unique_ptr<DSWaylandExtension> __wlExtension;
- IDSWaylandShell *__shell;
-};
-
-void DSWaylandCompositorPrivate::addClient(DSWaylandClient *client)
-{
- DS_ASSERT(client != nullptr);
-
- //TODO : check if the client is in clients already ?
- _clients.push_back(client);
- DSLOG_INF("DSWaylandCompositorPrivate", "Client(%p, PID:%d) has been added.", client, client->pid());
-}
-
-void DSWaylandCompositorPrivate::removeClient(DSWaylandClient *client)
-{
- DS_ASSERT(client != nullptr);
-
- //TODO : check if the client is in clients already ?
- _clients.remove(client);
- DSLOG_INF("DSWaylandCompositorPrivate", "Client(%p, PID:%d) has been removed.", client, client->pid());
-}
-
-}
-
-#endif //__DS_WAYLAND_COMPOSITOR_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandInputMethodContext.h"
-#include "DSWaylandInputMethodContextPrivate.h"
-#include "DSWaylandInputMethod.h"
-#include "DSWaylandInputMethodPrivate.h"
-
-namespace display_server {
-
-/*LCOV_EXCL_START*/
-DSWaylandInputMethodContextPrivate::DSWaylandInputMethodContextPrivate(DSWaylandInputMethodContext *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __compositor(compositor)
-{
-}
-
-DSWaylandInputMethodContextPrivate::~DSWaylandInputMethodContextPrivate()
-{
-}
-
-void* DSWaylandInputMethodContextPrivate::createGlobal(void *client)
-{
- Resource *resource = add((struct ::wl_client *)client, 1);
- return resource->handle;
- //init((struct ::wl_client *)client, 0, 1);
-}
-
-void DSWaylandInputMethodContextPrivate::sendReset(void *contextResource)
-{
- send_reset((struct ::wl_resource *)contextResource);
-}
-
-void DSWaylandInputMethodContextPrivate::sendContentType(void *contextResource, unsigned int hint, unsigned int purpose)
-{
- send_content_type((struct ::wl_resource *)contextResource, hint, purpose);
-}
-
-void DSWaylandInputMethodContextPrivate::sendPreferredLanguage(void *contextResource, const std::string language)
-{
- send_preferred_language((struct ::wl_resource *)contextResource, language);
-}
-
-void DSWaylandInputMethodContextPrivate::sendCommitState(void *contextResource, unsigned int serial)
-{
- send_commit_state((struct ::wl_resource *)contextResource, serial);
-}
-
-void DSWaylandInputMethodContextPrivate::sendInvokeAction(void *contextResource, unsigned int button, unsigned int index)
-{
- send_invoke_action((struct ::wl_resource *)contextResource, button, index);
-}
-
-void DSWaylandInputMethodContextPrivate::sendReturnKeyType(void *contextResource, unsigned int returnKeyType)
-{
- send_return_key_type((struct ::wl_resource *)contextResource, returnKeyType);
-}
-
-void DSWaylandInputMethodContextPrivate::sendReturnKeyDisabled(void *contextResource, unsigned int returnKeyDisabled)
-{
- send_return_key_disabled((struct ::wl_resource *)contextResource, returnKeyDisabled);
-}
-
-void DSWaylandInputMethodContextPrivate::sendInputPanelData(void *contextResource, std::string inputPanelData, unsigned int inputPanelLength)
-{
- send_input_panel_data((struct ::wl_resource *)contextResource, inputPanelData, inputPanelLength);
-}
-
-void DSWaylandInputMethodContextPrivate::sendBidiDirection(void *contextResource, unsigned int direction)
-{
- send_bidi_direction((struct ::wl_resource *)contextResource, direction);
-}
-
-void DSWaylandInputMethodContextPrivate::sendCursorPosition(void *contextResource, unsigned int cursorPosition)
-{
- send_cursor_position((struct ::wl_resource *)contextResource, cursorPosition);
-}
-
-void DSWaylandInputMethodContextPrivate::sendProcessInputDeviceEvent(void *contextResource, unsigned int eventType, std::string eventData, unsigned int eventLength)
-{
- send_process_input_device_event((struct ::wl_resource *)contextResource, eventType, eventData, eventLength);
-}
-
-void DSWaylandInputMethodContextPrivate::sendFilterKeyEvent(void *contextResource, unsigned int serial, unsigned int time, std::string keyName, unsigned int state, unsigned int modifiers, std::string devName, unsigned int devClass, unsigned int devSubclass, unsigned int keycode)
-{
- send_filter_key_event((struct ::wl_resource *)contextResource, serial, time, keyName, state, modifiers, devName, devClass, devSubclass, keycode);
-}
-
-void DSWaylandInputMethodContextPrivate::sendCapitalMode(void *contextResource, unsigned int mode)
-{
- send_capital_mode((struct ::wl_resource *)contextResource, mode);
-}
-
-void DSWaylandInputMethodContextPrivate::sendPredictionHint(void *contextResource, std::string text)
-{
- send_prediction_hint((struct ::wl_resource *)contextResource, text);
-}
-
-void DSWaylandInputMethodContextPrivate::sendMimeType(void *contextResource, std::string type)
-{
- send_mime_type((struct ::wl_resource *)contextResource, type);
-}
-
-void DSWaylandInputMethodContextPrivate::sendFinalizedContent(void *contextResource, std::string text, unsigned int cursorPosition)
-{
- send_finalized_content((struct ::wl_resource *)contextResource, text, cursorPosition);
-}
-
-void DSWaylandInputMethodContextPrivate::sendPredictionHintData(void *contextResource, std::string key, std::string value)
-{
- send_prediction_hint_data((struct ::wl_resource *)contextResource, key, value);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_destroy(Resource *resource)
-{
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_commit_string(Resource *resource, uint32_t serial, const std::string &text)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextCommitString(serial, text);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_preedit_string(Resource *resource, uint32_t serial, const std::string &text, const std::string &commit)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextPreeditString(serial, text, commit);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextPreeditStyling(index, length, style);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_preedit_cursor(Resource *resource, int32_t index)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextPreeditCursor(index);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextDeleteSurroundingText(index, length);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_cursor_position(Resource *resource, int32_t index, int32_t anchor)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextCursorPosition(index, anchor);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_modifiers_map(Resource *resource, wl_array *map)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
- std::string mapData = (char *)map->data;
-
- pub->__inputMethod->contextModifiersMap(mapData);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- if (pub->__inputMethod->contextActivated())
- {
- pub->__inputMethod->contextKeysym(serial, time, sym, state, modifiers);
- }
- else
- {
- /* TODO: generate key events for server */
- }
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_grab_keyboard(Resource *resource, uint32_t keyboard)
-{
- /* TODO: this is optional, currently disable this option */
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
-{
- /* Nothing to do in this request */
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
-{
- /* Nothing to do in this request */
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_language(Resource *resource, uint32_t serial, const std::string &language)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextLanguage(serial, language);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_text_direction(Resource *resource, uint32_t serial, uint32_t direction)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextTextDirection(serial, direction);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_selection_region(Resource *resource, uint32_t serial, int32_t start, int32_t end)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextSelectionRegion(serial, start, end);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_private_command(Resource *resource, uint32_t serial, const std::string &command)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextPrivateCommand(serial, command);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_update_input_panel_data(Resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextUpdateInputPanelData(serial, input_panel_data, input_panel_data_length);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_hide_input_panel(Resource *resource, uint32_t serial)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextHideInputPanel(serial);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_get_selection_text(Resource *resource, int32_t fd)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextGetSelectionText(fd);
-
- close(fd);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_get_surrounding_text(Resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextGetSurroundingText(maxlen_before, maxlen_after, fd);
-
- close(fd);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_filter_key_event_done(Resource *resource, uint32_t serial, uint32_t state)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextFilterKeyEventDone(serial, state);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_update_ise_geometry(Resource *resource, uint32_t serial, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextUpdateIseGeometry(serial, x, y, width, height);
- pub->__inputMethod->setGeometryUpdated(true);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_recapture_string(Resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextRecaptureString(serial, index, length, preedit, preedit_commit, commit);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_input_panel_event(Resource *resource, uint32_t serial, uint32_t event_type, uint32_t value)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextInputPanelEvent(serial, event_type, value);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_commit_content(Resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextCommitContent(serial, content, description, mime_types);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_update_candidate_state(Resource *resource, uint32_t state)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextUpdateCandidateState(state);
-}
-
-void DSWaylandInputMethodContextPrivate::input_method_context_reshow_input_panel(Resource *resource)
-{
- DS_GET_PUB(DSWaylandInputMethodContext);
-
- pub->__inputMethod->contextReshowInputPanel();
-}
-
-
-DSWaylandInputMethodContext::DSWaylandInputMethodContext(DSWaylandCompositor *compositor, DSWaylandInputMethod *inputMethod)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandInputMethodContextPrivate>(this, compositor)),
- __compositor(compositor),
- __inputMethod(inputMethod)
-{
-}
-
-DSWaylandInputMethodContext::~DSWaylandInputMethodContext()
-{
-}
-
-void* DSWaylandInputMethodContext::createGlobal(void *client)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- return priv->createGlobal(client);
-}
-
-void DSWaylandInputMethodContext::sendReset(void *contextResource)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendReset(contextResource);
-}
-
-void DSWaylandInputMethodContext::sendContentType(void *contextResource, unsigned int hint, unsigned int purpose)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendContentType(contextResource, hint, purpose);
-}
-
-void DSWaylandInputMethodContext::sendPreferredLanguage(void *contextResource, const std::string language)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendPreferredLanguage(contextResource, language);
-}
-
-void DSWaylandInputMethodContext::sendCommitState(void *contextResource, unsigned int serial)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendCommitState(contextResource, serial);
-}
-
-void DSWaylandInputMethodContext::sendInvokeAction(void *contextResource, unsigned int button, unsigned int index)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendInvokeAction(contextResource, button, index);
-}
-
-void DSWaylandInputMethodContext::sendReturnKeyType(void *contextResource, unsigned int returnKeyType)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendReturnKeyType(contextResource, returnKeyType);
-}
-
-void DSWaylandInputMethodContext::sendReturnKeyDisabled(void *contextResource, unsigned int returnKeyDisabled)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendReturnKeyDisabled(contextResource, returnKeyDisabled);
-}
-
-void DSWaylandInputMethodContext::sendInputPanelData(void *contextResource, std::string inputPanelData, unsigned int inputPanelLength)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendInputPanelData(contextResource, inputPanelData, inputPanelLength);
-}
-
-void DSWaylandInputMethodContext::sendBidiDirection(void *contextResource, unsigned int direction)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendBidiDirection(contextResource, direction);
-}
-
-void DSWaylandInputMethodContext::sendCursorPosition(void *contextResource, unsigned int cursorPosition)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendCursorPosition(contextResource, cursorPosition);
-}
-
-void DSWaylandInputMethodContext::sendProcessInputDeviceEvent(void *contextResource, unsigned int eventType, std::string eventData, unsigned int eventLength)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendProcessInputDeviceEvent(contextResource, eventType, eventData, eventLength);
-}
-
-void DSWaylandInputMethodContext::sendFilterKeyEvent(void *contextResource, unsigned int serial, unsigned int time, std::string keyName, unsigned int state, unsigned int modifiers, std::string devName, unsigned int devClass, unsigned int devSubclass, unsigned int keycode)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendFilterKeyEvent(contextResource, serial, time, keyName, state, modifiers, devName, devClass, devSubclass, keycode);
-}
-
-void DSWaylandInputMethodContext::sendCapitalMode(void *contextResource, unsigned int mode)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendCapitalMode(contextResource, mode);
-}
-
-void DSWaylandInputMethodContext::sendPredictionHint(void *contextResource, std::string text)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendPredictionHint(contextResource, text);
-}
-
-void DSWaylandInputMethodContext::sendMimeType(void *contextResource, std::string type)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendMimeType(contextResource, type);
-}
-
-void DSWaylandInputMethodContext::sendFinalizedContent(void *contextResource, std::string text, unsigned int cursorPosition)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendFinalizedContent(contextResource, text, cursorPosition);
-}
-
-void DSWaylandInputMethodContext::sendPredictionHintData(void *contextResource, std::string key, std::string value)
-{
- DS_GET_PRIV(DSWaylandInputMethodContext);
-
- if (contextResource)
- return priv->sendPredictionHintData(contextResource, key, value);
-}
-
-
-DSWaylandInputMethodPrivate::DSWaylandInputMethodPrivate(DSWaylandInputMethod *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __compositor(compositor),
- __resource(nullptr)
-{
- if (!compositor)
- return;
-
- zwp_input_method_v1::init(__compositor->display(), 1);
-}
-
-DSWaylandInputMethodPrivate::~DSWaylandInputMethodPrivate()
-{
-}
-
-int DSWaylandInputMethodPrivate::getResourceId(DSWaylandInputMethodContextPrivate::Resource *resource)
-{
- int id = -1;
-
- std::multimap<DSWaylandInputMethodContextPrivate::Resource*, int>::iterator it;
- for (it = __contextMap.begin(); it != __contextMap.end(); it++)
- {
- if (resource == (*it).first)
- {
- id = (*it).second;
- break;
- }
- }
-
- return id;
-}
-
-DSWaylandInputMethodContextPrivate::Resource* DSWaylandInputMethodPrivate::getResource(int id)
-{
- DSWaylandInputMethodContextPrivate::Resource *resource = nullptr;
-
-
- std::multimap<DSWaylandInputMethodContextPrivate::Resource*, int>::iterator it;
- for (it = __contextMap.begin(); it != __contextMap.end(); it++)
- {
- if (id == (*it).second)
- {
- resource = (*it).first;
- break;
- }
- }
-
- return resource;
-}
-
-void DSWaylandInputMethodPrivate::sendActivate(void *contextResource, int textInputId)
-{
- DSWaylandInputMethodContextPrivate::Resource *resource = DSWaylandInputMethodContextPrivate::Resource::fromResource((struct ::wl_resource *)contextResource);
- __contextMap.insert(std::pair<DSWaylandInputMethodContextPrivate::Resource*, int>(resource, textInputId));
- send_activate(__resource->handle, (struct ::wl_resource *)contextResource);
-}
-
-void DSWaylandInputMethodPrivate::sendDeactivate(void *contextResource)
-{
- DSWaylandInputMethodContextPrivate::Resource *resource = DSWaylandInputMethodContextPrivate::Resource::fromResource((struct ::wl_resource *)contextResource);
- __contextMap.erase(resource);
- send_deactivate(__resource->handle, (struct ::wl_resource *)contextResource);
-}
-
-void DSWaylandInputMethodPrivate::showInputPanel(void *contextResource, int textInputId)
-{
- //Resource *resource = getResource(textInputId);
- //FIXME: please, replace with current client's rotation degree
- send_show_input_panel(__resource->handle, (struct ::wl_resource *)contextResource, 0);
-}
-
-void DSWaylandInputMethodPrivate::hideInputPanel(void *contextResource, int textInputId)
-{
- //Resource *resource = getResource(textInputId);
- send_hide_input_panel(__resource->handle, (struct ::wl_resource *)contextResource);
-}
-
-void DSWaylandInputMethodPrivate::openConnection(void *contextResource)
-{
- //Resource *resource = getResource(textInputId);
- send_open_connection(__resource->handle, (struct ::wl_resource *)contextResource);
-}
-
-void DSWaylandInputMethodPrivate::closeConnection(void *contextResource)
-{
- //Resource *resource = getResource(textInputId);
- send_close_connection(__resource->handle, (struct ::wl_resource *)contextResource);
-}
-
-void DSWaylandInputMethodPrivate::setTextInputId(void *contextResource, int textInputId)
-{
- //Resource *resource = getResource(textInputId);
- send_set_text_input_id(__resource->handle, (struct ::wl_resource *)contextResource, textInputId);
-}
-
-void DSWaylandInputMethodPrivate::input_method_bind_resource(Resource *resource)
-{
- __resource = resource;
- //if (vconf_set_bool(VCONFKEY_ISF_BIND, 1) != 0)
-}
-
-void DSWaylandInputMethodPrivate::input_method_destroy_resource(Resource *resource)
-{
- __resource = nullptr;
- //if (vconf_set_bool(VCONFKEY_ISF_BIND, 0) != 0)
-}
-
-
-DSWaylandInputMethod::DSWaylandInputMethod(DSWaylandCompositor *compositor)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandInputMethodPrivate>(this, compositor)),
- __dsTextInputPrivate(nullptr),
- __compositor(compositor),
- __activateContext(nullptr),
- __candidateState(0)
-{
- __inputMethodContext = new DSWaylandInputMethodContext(compositor, this);
-}
-
-DSWaylandInputMethod::DSWaylandInputMethod(DSWaylandCompositor *compositor, DSTextInputPrivate *dsTextInputPrivate)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandInputMethodPrivate>(this, compositor)),
- __dsTextInputPrivate(dsTextInputPrivate),
- __compositor(compositor),
- __activateContext(nullptr),
- __candidateState(0)
-{
- __inputMethodContext = new DSWaylandInputMethodContext(compositor, this);
-}
-
-DSWaylandInputMethod::~DSWaylandInputMethod()
-{
-}
-
-DSWaylandInputMethodContext* DSWaylandInputMethod::getContext()
-{
- return __inputMethodContext;
-}
-
-bool DSWaylandInputMethod::contextActivated()
-{
- if (__activateContext) return true;
- else return false;
-}
-
-void DSWaylandInputMethod::activate(int textInputId)
-{
- DS_GET_PRIV(DSWaylandInputMethod);
-
- if (!__activateContext)
- {
- if (priv->__resource)
- __activateContext = __inputMethodContext->createGlobal((void *)(priv->__resource->client()));
- }
-
- if (__activateContext)
- priv->sendActivate(__activateContext, textInputId);
-}
-
-void DSWaylandInputMethod::deactivate()
-{
- DS_GET_PRIV(DSWaylandInputMethod);
-
- if (__activateContext)
- {
- priv->sendDeactivate(__activateContext);
- __activateContext = nullptr;
- }
-}
-
-void DSWaylandInputMethod::showInputPanel(int textInputId)
-{
- DS_GET_PRIV(DSWaylandInputMethod);
-
- if (__activateContext)
- priv->showInputPanel(__activateContext, textInputId);
-}
-
-void DSWaylandInputMethod::hideInputPanel(int textInputId)
-{
- DS_GET_PRIV(DSWaylandInputMethod);
-
- if (textInputId < 0)
- {
- textInputId = priv->getResourceId(DSWaylandInputMethodContextPrivate::Resource::fromResource((struct ::wl_resource *)__activateContext));
- }
-
- if (__activateContext)
- priv->hideInputPanel(__activateContext, textInputId);
-}
-
-void DSWaylandInputMethod::openConnection()
-{
- DS_GET_PRIV(DSWaylandInputMethod);
-
- if (__activateContext)
- priv->openConnection(__activateContext);
-}
-
-void DSWaylandInputMethod::closeConnection()
-{
- DS_GET_PRIV(DSWaylandInputMethod);
-
- if (__activateContext)
- priv->closeConnection(__activateContext);
-}
-
-void DSWaylandInputMethod::setTextInputId(int textInputId)
-{
- DS_GET_PRIV(DSWaylandInputMethod);
-
- if (__activateContext)
- priv->setTextInputId(__activateContext, textInputId);
-}
-
-void DSWaylandInputMethod::resetTextInput()
-{
- __inputMethodContext->sendReset(__activateContext);
-}
-
-void DSWaylandInputMethod::setContentType(unsigned int hint, unsigned int purpose)
-{
- __inputMethodContext->sendContentType(__activateContext, hint, purpose);
-}
-
-void DSWaylandInputMethod::setPreferredLanguage(const std::string language)
-{
- __inputMethodContext->sendPreferredLanguage(__activateContext, language);
-}
-
-void DSWaylandInputMethod::commitState(unsigned int serial)
-{
- __inputMethodContext->sendCommitState(__activateContext, serial);
-}
-
-void DSWaylandInputMethod::invokeAction(unsigned int button, unsigned int index)
-{
- __inputMethodContext->sendInvokeAction(__activateContext, button, index);
-}
-
-void DSWaylandInputMethod::setReturnKeyType(unsigned int returnKeyType)
-{
- __inputMethodContext->sendReturnKeyType(__activateContext, returnKeyType);
-}
-
-void DSWaylandInputMethod::returnKeyDisabled(unsigned int returnKeyDisabled)
-{
- __inputMethodContext->sendReturnKeyDisabled(__activateContext, returnKeyDisabled);
-}
-
-void DSWaylandInputMethod::setInputPanelData(std::string inputPanelData, unsigned int inputPanelLength)
-{
- __inputMethodContext->sendInputPanelData(__activateContext, inputPanelData, inputPanelLength);
-}
-
-void DSWaylandInputMethod::bidiDirection(unsigned int direction)
-{
- __inputMethodContext->sendBidiDirection(__activateContext, direction);
-}
-
-void DSWaylandInputMethod::setCursorPosition(unsigned int cursorPosition)
-{
- __inputMethodContext->sendCursorPosition(__activateContext, cursorPosition);
-}
-
-void DSWaylandInputMethod::processInputDeviceEvent(unsigned int eventType, std::string eventData, unsigned int eventLength)
-{
- __inputMethodContext->sendProcessInputDeviceEvent(__activateContext, eventType, eventData, eventLength);
-}
-
-void DSWaylandInputMethod::filterKeyEvent(unsigned int serial, unsigned int time, std::string keyName, unsigned int state, unsigned int modifiers, std::string devName, unsigned int devClass, unsigned int devSubclass, unsigned int keycode)
-{
- __inputMethodContext->sendFilterKeyEvent(__activateContext, serial, time, keyName, state, modifiers, devName, devClass, devSubclass, keycode);
-}
-
-void DSWaylandInputMethod::setCapitalMode(unsigned int mode)
-{
- __inputMethodContext->sendCapitalMode(__activateContext, mode);
-}
-
-void DSWaylandInputMethod::predictionHint(std::string text)
-{
- __inputMethodContext->sendPredictionHint(__activateContext, text);
-}
-
-void DSWaylandInputMethod::setMimeType(std::string type)
-{
- __inputMethodContext->sendMimeType(__activateContext, type);
-}
-
-void DSWaylandInputMethod::finalizeContent(std::string text, unsigned int cursorPosition)
-{
- __inputMethodContext->sendFinalizedContent(__activateContext, text, cursorPosition);
-}
-
-void DSWaylandInputMethod::predictionHintData(std::string key, std::string value)
-{
- __inputMethodContext->sendPredictionHintData(__activateContext, key, value);
-}
-
-void DSWaylandInputMethod::contextCommitString(unsigned int serial, std::string text)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextCommitString(serial, text);
-}
-
-void DSWaylandInputMethod::contextPreeditString(unsigned int serial, std::string text, std::string commit)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextPreeditString(serial, text, commit);
-}
-
-void DSWaylandInputMethod::contextPreeditStyling(int index, unsigned int length, unsigned int style)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextPreeditStyling(index, length, style);
-}
-
-void DSWaylandInputMethod::contextPreeditCursor(int index)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextPreeditCursor(index);
-}
-
-void DSWaylandInputMethod::contextDeleteSurroundingText(int index, unsigned int length)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextDeleteSurroundingText(index, length);
-}
-
-void DSWaylandInputMethod::contextCursorPosition(int index, int anchor)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextCursorPosition(index, anchor);
-}
-
-void DSWaylandInputMethod::contextModifiersMap(std::string map)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextModifiersMap(map);
-}
-
-void DSWaylandInputMethod::contextKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextKeysym(serial, time, sym, state, modifiers);
-}
-
-void DSWaylandInputMethod::contextLanguage(unsigned int serial, std::string language)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextLanguage(serial, language);
-}
-
-void DSWaylandInputMethod::contextTextDirection(unsigned int serial, unsigned int direction)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextTextDirection(serial, direction);
-}
-
-void DSWaylandInputMethod::contextSelectionRegion(unsigned int serial, int start, int end)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextSelectionRegion(serial, start, end);
-}
-
-void DSWaylandInputMethod::contextPrivateCommand(unsigned int serial, std::string command)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextPrivateCommand(serial, command);
-}
-
-void DSWaylandInputMethod::contextUpdateInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextUpdateInputPanelData(serial, inputPanelData, inputPanelDataLength);
-}
-
-void DSWaylandInputMethod::contextHideInputPanel(unsigned int serial)
-{
- DS_GET_PRIV(DSWaylandInputMethod);
-
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextHideInputPanel();
-
- if (__activateContext)
- {
- priv->hideInputPanel(__activateContext, -1);
- }
-}
-
-void DSWaylandInputMethod::contextGetSelectionText(int fd)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextGetSelectionText(fd);
-}
-
-void DSWaylandInputMethod::contextGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextGetSurroundingText(maxlenBefore, maxlenAfter, fd);
-}
-
-void DSWaylandInputMethod::contextFilterKeyEventDone(unsigned int serial, unsigned int state)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextFilterKeyEventDone(serial, state);
-}
-
-void DSWaylandInputMethod::contextUpdateIseGeometry(unsigned int serial, unsigned int x, unsigned int y, unsigned int width, unsigned int height)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextUpdateIseGeometry(x, y, width, height);
-}
-
-void DSWaylandInputMethod::contextRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextRecaptureString(serial, index, length, preedit, preeditCommit, commit);
-}
-
-void DSWaylandInputMethod::contextInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextInputPanelEvent(serial, eventType, value);
-}
-
-void DSWaylandInputMethod::contextCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes)
-{
- if (__dsTextInputPrivate)
- __dsTextInputPrivate->contextCommitContent(serial, content, description, mimeTypes);
-}
-
-void DSWaylandInputMethod::contextUpdateCandidateState(unsigned int state)
-{
- if (!__dsTextInputPrivate) return;
-
- unsigned int prevCandidateState = __candidateState;
- __candidateState = state;
-
- if (__dsTextInputPrivate->getInputPanelState() == DSTextInputPrivate::InputPanelStateDidHide)
- {
- prevCandidateState = (unsigned int)false;
- }
-
- if (!state)
- {
- /* TODO: need to check g_disable_show_panel */
- if (!__candidateState && prevCandidateState)
- {
- __dsTextInputPrivate->contextHideInputPanel();
- }
- }
- else
- {
- /* TODO: need to check g_disable_show_panel */
- if (__candidateState && !prevCandidateState)
- {
- __dsTextInputPrivate->contextShowInputPanel();
- int x = 0, y = 0, w = 0, h = 0;
- stGeometry geometry = __dsTextInputPrivate->inputPanelGetGeometry(nullptr);
- x = geometry.x;
- y = geometry.y;
- w = geometry.w;
- h = geometry.h;
- __dsTextInputPrivate->contextUpdateIseGeometry(x, y, w, h);
- }
- }
-}
-
-void DSWaylandInputMethod::contextReshowInputPanel()
-{
- /* TODO: update input panel */
-}
-
-void DSWaylandInputMethod::setGeometryUpdated(bool updated)
-{
- if (!__dsTextInputPrivate) return;
-
- __dsTextInputPrivate->setGeometryUpdated(updated);
-}
-/*LCOV_EXCL_STOP*/
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_INPUT_METHOD_H__
-#define __DS_WAYLAND_INPUT_METHOD_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSWaylandCompositor.h"
-#include "DSTextInputPrivate.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandInputMethodPrivate;
-class DSWaylandInputMethodContext;
-
-class DS_DECL_EXPORT DSWaylandInputMethod : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandInputMethod);
-public:
- DSWaylandInputMethod(DSWaylandCompositor *compositor);
- DSWaylandInputMethod(DSWaylandCompositor *compositor, DSTextInputPrivate *dsTextInputPrivate);
- ~DSWaylandInputMethod() override;
-
- DSWaylandInputMethodContext* getContext();
- bool contextActivated();
- void activate(int textInputId);
- void deactivate();
- void showInputPanel(int textInputId);
- void hideInputPanel(int textInputId);
- void openConnection();
- void closeConnection();
- void setTextInputId(int textInputId);
- void resetTextInput();
- void setContentType(unsigned int hint, unsigned int purpose);
- void setPreferredLanguage(const std::string language);
- void commitState(unsigned int serial);
- void invokeAction(unsigned int button, unsigned int index);
- void setReturnKeyType(unsigned int returnKeyType);
- void returnKeyDisabled(unsigned int returnKeyDisabled);
- void setInputPanelData(std::string inputPanelData, unsigned int inputPanelLength);
- void bidiDirection(unsigned int direction);
- void setCursorPosition(unsigned int cursorPosition);
- void processInputDeviceEvent(unsigned int eventType, std::string eventData, unsigned int eventLength);
- void filterKeyEvent(unsigned int serial, unsigned int time, std::string keyName, unsigned int state, unsigned int modifiers, std::string devName, unsigned int devClass, unsigned int devSubclass, unsigned int keycode);
- void setCapitalMode(unsigned int mode);
- void predictionHint(std::string text);
- void setMimeType(std::string type);
- void finalizeContent(std::string text, unsigned int cursorPosition);
- void predictionHintData(std::string key, std::string value);
-
- void contextCommitString(unsigned int serial, std::string text);
- void contextPreeditString(unsigned int serial, std::string text, std::string commit);
- void contextPreeditStyling(int index, unsigned int length, unsigned int style);
- void contextPreeditCursor(int index);
- void contextDeleteSurroundingText(int index, unsigned int length);
- void contextCursorPosition(int index, int anchor);
- void contextModifiersMap(std::string map);
- void contextKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers);
- void contextLanguage(unsigned int serial, std::string language);
- void contextTextDirection(unsigned int serial, unsigned int direction);
- void contextSelectionRegion(unsigned int serial, int start, int end);
- void contextPrivateCommand(unsigned int serial, std::string command);
- void contextUpdateInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength);
- void contextHideInputPanel(unsigned int serial);
- void contextGetSelectionText(int fd);
- void contextGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd);
- void contextFilterKeyEventDone(unsigned int serial, unsigned int state);
- void contextUpdateIseGeometry(unsigned int serial, unsigned int x, unsigned int y, unsigned int width, unsigned int height);
- void contextRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit);
- void contextInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value);
- void contextCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes);
- void contextUpdateCandidateState(unsigned int state);
- void contextReshowInputPanel();
-
- void setGeometryUpdated(bool updated);
-
-protected:
-
-private:
- DSTextInputPrivate *__dsTextInputPrivate;
- DSWaylandCompositor *__compositor;
- DSWaylandInputMethodContext *__inputMethodContext;
- void *__activateContext;
- unsigned int __candidateState;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_INPUT_METHOD_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_INPUT_METHOD_CONTEXT_H__
-#define __DS_WAYLAND_INPUT_METHOD_CONTEXT_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandInputMethodContextPrivate;
-class DSWaylandInputMethod;
-
-class DS_DECL_EXPORT DSWaylandInputMethodContext : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandInputMethodContext);
-public:
- DSWaylandInputMethodContext(DSWaylandCompositor *compositor, DSWaylandInputMethod *inputMethod);
- ~DSWaylandInputMethodContext() override;
-
- void* createGlobal(void *client);
- void sendReset(void *contextResource);
- void sendContentType(void *contextResource, unsigned int hint, unsigned int purpose);
- void sendPreferredLanguage(void *contextResource, const std::string language);
- void sendCommitState(void *contextResource, unsigned int serial);
- void sendInvokeAction(void *contextResource, unsigned int button, unsigned int index);
- void sendReturnKeyType(void *contextResource, unsigned int returnKeyType);
- void sendReturnKeyDisabled(void *contextResource, unsigned int returnKeyDisabled);
- void sendInputPanelData(void *contextResource, std::string inputPanelData, unsigned int inputPanelLength);
- void sendBidiDirection(void *contextResource, unsigned int direction);
- void sendCursorPosition(void *contextResource, unsigned int cursorPosition);
- void sendProcessInputDeviceEvent(void *contextResource, unsigned int eventType, std::string eventData, unsigned int eventLength);
- void sendFilterKeyEvent(void *contextResource, unsigned int serial, unsigned int time, std::string keyName, unsigned int state, unsigned int modifiers, std::string devName, unsigned int devClass, unsigned int devSubclass, unsigned int keycode);
- void sendCapitalMode(void *contextResource, unsigned int mode);
- void sendPredictionHint(void *contextResource, std::string text);
- void sendMimeType(void *contextResource, std::string type);
- void sendFinalizedContent(void *contextResource, std::string text, unsigned int cursorPosition);
- void sendPredictionHintData(void *contextResource, std::string key, std::string value);
-
-protected:
-
-private:
- DSWaylandCompositor *__compositor;
- DSWaylandInputMethod *__inputMethod;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_INPUT_METHOD_CONTEXT_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_INPUT_METHOD_CONTEXT_PRIVATE_H__
-#define __DS_WAYLAND_INPUT_METHOD_CONTEXT_PRIVATE_H__
-
-#include "dswayland-server-input-method-unstable-v1.h"
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "DSWaylandInputMethodContext.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DS_DECL_EXPORT DSWaylandInputMethodContextPrivate : public DSObjectPrivate, public DSWaylandServer::zwp_input_method_context_v1
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandInputMethodContext);
-public:
- DSWaylandInputMethodContextPrivate(DSWaylandInputMethodContext *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandInputMethodContextPrivate() override;
-
- void* createGlobal(void *client);
- void sendReset(void *contextResource);
- void sendContentType(void *contextResource, unsigned int hint, unsigned int purpose);
- void sendPreferredLanguage(void *contextResource, const std::string language);
- void sendCommitState(void *contextResource, unsigned int serial);
- void sendInvokeAction(void *contextResource, unsigned int button, unsigned int index);
- void sendReturnKeyType(void *contextResource, unsigned int returnKeyType);
- void sendReturnKeyDisabled(void *contextResource, unsigned int returnKeyDisabled);
- void sendInputPanelData(void *contextResource, std::string inputPanelData, unsigned int inputPanelLength);
- void sendBidiDirection(void *contextResource, unsigned int direction);
- void sendCursorPosition(void *contextResource, unsigned int cursorPosition);
- void sendProcessInputDeviceEvent(void *contextResource, unsigned int eventType, std::string eventData, unsigned int eventLength);
- void sendFilterKeyEvent(void *contextResource, unsigned int serial, unsigned int time, std::string keyName, unsigned int state, unsigned int modifiers, std::string devName, unsigned int devClass, unsigned int devSubclass, unsigned int keycode);
- void sendCapitalMode(void *contextResource, unsigned int mode);
- void sendPredictionHint(void *contextResource, std::string text);
- void sendMimeType(void *contextResource, std::string type);
- void sendFinalizedContent(void *contextResource, std::string text, unsigned int cursorPosition);
- void sendPredictionHintData(void *contextResource, std::string key, std::string value);
-
-protected:
- void input_method_context_destroy(Resource *resource);
- void input_method_context_commit_string(Resource *resource, uint32_t serial, const std::string &text);
- void input_method_context_preedit_string(Resource *resource, uint32_t serial, const std::string &text, const std::string &commit);
- void input_method_context_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style);
- void input_method_context_preedit_cursor(Resource *resource, int32_t index);
- void input_method_context_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length);
- void input_method_context_cursor_position(Resource *resource, int32_t index, int32_t anchor);
- void input_method_context_modifiers_map(Resource *resource, wl_array *map);
- void input_method_context_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers);
- void input_method_context_grab_keyboard(Resource *resource, uint32_t keyboard);
- void input_method_context_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state);
- void input_method_context_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
- void input_method_context_language(Resource *resource, uint32_t serial, const std::string &language);
- void input_method_context_text_direction(Resource *resource, uint32_t serial, uint32_t direction);
- void input_method_context_selection_region(Resource *resource, uint32_t serial, int32_t start, int32_t end);
- void input_method_context_private_command(Resource *resource, uint32_t serial, const std::string &command);
- void input_method_context_update_input_panel_data(Resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length);
- void input_method_context_hide_input_panel(Resource *resource, uint32_t serial);
- void input_method_context_get_selection_text(Resource *resource, int32_t fd);
- void input_method_context_get_surrounding_text(Resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd);
- void input_method_context_filter_key_event_done(Resource *resource, uint32_t serial, uint32_t state);
- void input_method_context_update_ise_geometry(Resource *resource, uint32_t serial, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
- void input_method_context_recapture_string(Resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit);
- void input_method_context_input_panel_event(Resource *resource, uint32_t serial, uint32_t event_type, uint32_t value);
- void input_method_context_commit_content(Resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types);
- void input_method_context_update_candidate_state(Resource *resource, uint32_t state);
- void input_method_context_reshow_input_panel(Resource *resource);
-
-private:
- DSWaylandCompositor *__compositor;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_INPUT_METHOD_CONTEXT_PRIVATE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_INPUT_METHOD_PRIVATE_H__
-#define __DS_WAYLAND_INPUT_METHOD_PRIVATE_H__
-
-#include "dswayland-server-input-method-unstable-v1.h"
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "DSWaylandInputMethod.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandInputMethodContextPrivate;
-
-class DS_DECL_EXPORT DSWaylandInputMethodPrivate : public DSObjectPrivate, public DSWaylandServer::zwp_input_method_v1
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandInputMethod);
-public:
- DSWaylandInputMethodPrivate(DSWaylandInputMethod *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandInputMethodPrivate() override;
-
- void sendActivate(void *contextResource, int textInputId);
- void sendDeactivate(void *contextResource);
- void showInputPanel(void *contextResource, int textInputId);
- void hideInputPanel(void *contextResource, int textInputId);
- void openConnection(void *contextResource);
- void closeConnection(void *contextResource);
- void setTextInputId(void *contextResource, int textInputId);
- int getResourceId(DSWaylandInputMethodContextPrivate::Resource *resource);
- DSWaylandInputMethodContextPrivate::Resource* getResource(int id);
-
-protected:
- void input_method_bind_resource(Resource *resource);
- void input_method_destroy_resource(Resource *resource);
-
-private:
- DSWaylandCompositor *__compositor;
- Resource *__resource;
- std::multimap<DSWaylandInputMethodContextPrivate::Resource*, int> __contextMap;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_INPUT_METHOD_PRIVATE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandInputPanel.h"
-#include "DSWaylandInputPanelPrivate.h"
-#include "DSWaylandInputPanelSurface.h"
-#include "DSWaylandInputPanelSurfacePrivate.h"
-#include "DSWaylandSurface.h"
-#include "DSStruct.h"
-#include "DSWindowManager.h"
-#include "IDSBuffer.h"
-
-namespace display_server {
-
-/*LCOV_EXCL_START*/
-class DSWaylandInputPanelFloating
-{
-public:
- DSWaylandInputPanelFloating(DSWaylandInputPanel *inputPanel)
- : movingRequest(false), mousePressed(false), initPortraitPos(false), initLandscapePos(false),
- beforePos({0,0}), startPortraitPos({0,0}), startLandscapePos({0,0}), __inputPanel(inputPanel) {}
- ~DSWaylandInputPanelFloating() {}
-
- void setPortraitPos(int x, int y) { startPortraitPos.x = x; startPortraitPos.y = y; initPortraitPos = true; }
- void setLandscapePos(int x, int y) { startLandscapePos.x = x; startLandscapePos.y = y; initLandscapePos = true; }
-
- bool movingRequest;
- bool mousePressed;
- bool initPortraitPos;
- bool initLandscapePos;
- stPosition beforePos;
- stPosition startPortraitPos;
- stPosition startLandscapePos;
-
-private:
- DSWaylandInputPanel *__inputPanel;
-};
-
-class DSWaylandInputPanelSurfaceData
-{
-public:
- DSWaylandInputPanelSurfaceData(DSWaylandServer::zwp_input_panel_surface_v1::Resource *resource, void *inputPanelResource)
- : panel(false), showing(false), needShow(false), resizing(false),
- __resource(resource),
- __inputPanelResource(inputPanelResource), __wlSurface(nullptr) {}
- DSWaylandInputPanelSurfaceData(DSWaylandServer::zwp_input_panel_surface_v1::Resource *resource, void *inputPanelResource, void *surfaceResource)
- : panel(false), showing(false), needShow(false), resizing(false),
- __resource(resource),
- __inputPanelResource(inputPanelResource) { __wlSurface = DSWaylandSurface::fromWlResource((struct ::wl_resource *)surfaceResource); }
- ~DSWaylandInputPanelSurfaceData() {}
-
- void *getInputPanelResource() {return __inputPanelResource;}
- DSWaylandSurface* getWlSurface() {return __wlSurface;}
-
- bool panel;
- bool showing;
- bool needShow;
- bool resizing;
-
-private:
- DSWaylandServer::zwp_input_panel_surface_v1::Resource *__resource;
- void *__inputPanelResource;
- DSWaylandSurface *__wlSurface;
-};
-
-DSWaylandInputPanelPrivate::DSWaylandInputPanelPrivate(DSWaylandInputPanel *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr),
- __compositor(compositor)
-{
- if (!compositor)
- return;
-
- zwp_input_panel_v1::init(__compositor->display(), 1);
-}
-
-DSWaylandInputPanelPrivate::~DSWaylandInputPanelPrivate()
-{
-}
-
-void DSWaylandInputPanelPrivate::input_panel_destroy_resource(Resource *resource)
-{
- DS_GET_PUB(DSWaylandInputPanel);
-
- pub->clearSurfaces(resource->handle);
-}
-
-void DSWaylandInputPanelPrivate::input_panel_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface)
-{
- DS_GET_PUB(DSWaylandInputPanel);
-
- pub->createSurface((void *)resource->client(), (void *)resource->handle, id, (void *)surface);
-}
-
-
-DSWaylandInputPanel::DSWaylandInputPanel(DSWaylandCompositor *compositor)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandInputPanelPrivate>(this, compositor)),
- __compositor(compositor),
- __dsTextInputPrivate(nullptr),
- __eventLoop(nullptr),
- __waitUpdate(false),
- __rerunPanelShow(false),
- __wlSurface(nullptr)
-{
- __inputPanelSurface = new DSWaylandInputPanelSurface(__compositor, this);
- __inputPanelFloating = new DSWaylandInputPanelFloating(this);
-
- __eventLoop = DSEventLoop::getInstance();
- __eventLoop->registerCallbackIdleEnterer(this, std::bind(&DSWaylandInputPanel::__onEventIdleEnterer, this, std::placeholders::_1));
-}
-
-DSWaylandInputPanel::DSWaylandInputPanel(DSWaylandCompositor *compositor, DSTextInputPrivate *dsTextInputPrivate)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandInputPanelPrivate>(this, compositor)),
- __compositor(compositor),
- __dsTextInputPrivate(dsTextInputPrivate),
- __eventLoop(nullptr),
- __waitUpdate(false),
- __rerunPanelShow(false),
- __wlSurface(nullptr)
-{
- __inputPanelSurface = new DSWaylandInputPanelSurface(__compositor, this);
- __inputPanelFloating = new DSWaylandInputPanelFloating(this);
-
- __eventLoop = DSEventLoop::getInstance();
- __eventLoop->registerCallbackIdleEnterer(this, std::bind(&DSWaylandInputPanel::__onEventIdleEnterer, this, std::placeholders::_1));
-}
-
-
-DSWaylandInputPanel::~DSWaylandInputPanel()
-{
- DSEventLoop::releaseInstance();
- delete __inputPanelFloating;
- delete __inputPanelSurface;
-}
-
-void DSWaylandInputPanel::createSurface(void *client, void *inputPanelResource, unsigned int id, void *surface)
-{
- __inputPanelSurface->createGlobal(client, inputPanelResource, id, surface);
-
- /* TODO: Find window from surface and set some data */
- DSWaylandSurface *wlSurface = DSWaylandSurface::fromWlResource((struct ::wl_resource *)surface);
- __wlSurface = wlSurface;
-
- if (!wlSurface)
- {
- DSLOG_WRN("DSWaylandInputPanel", "%p wl_surface has no DSWaylandSurface", surface);
- return;
- }
-
- DSWindowManager *windowManager = DSWindowManager::getInstance();
- windowManager->setWindowTitle(wlSurface, "Keyboard");
- windowManager->setWindowAllowUserGeometry(wlSurface, true);
- windowManager->releaseInstance();
-
- wlSurface->registerCallbackSurfaceCommitted(this, std::bind(&DSWaylandInputPanel::__onSurfaceCommitted, this, std::placeholders::_1));
-}
-
-void DSWaylandInputPanel::clearSurfaces(void *inputPanelResource)
-{
- __inputPanelSurface->clearGlobals(inputPanelResource);
-}
-
-bool DSWaylandInputPanel::getWaitUpdate()
-{
- return __waitUpdate;
-}
-
-void DSWaylandInputPanel::setWaitUpdate(bool waitUpdate)
-{
- __waitUpdate = waitUpdate;
-}
-
-void DSWaylandInputPanel::updateInputPanelState(bool waitUpdate)
-{
- __waitUpdate = waitUpdate;
-
- if (__waitUpdate)
- {
- /* TODO: Add Timer */
- __inputPanelSurface->flushFrame();
- /* TODO: Add buffer change event handler */
- }
- else
- {
- /* TODO: remove buffer change event handler */
- }
-}
-
-bool DSWaylandInputPanel::getRerunPanelShow()
-{
- return __rerunPanelShow;
-}
-
-void DSWaylandInputPanel::setRerunPanelShow(bool needShow)
-{
- __rerunPanelShow = needShow;
-}
-
-void DSWaylandInputPanel::setFloatingMovingRequest(bool enabled)
-{
- if (!__inputPanelFloating) return;
-
- __inputPanelFloating->movingRequest = enabled;
-}
-
-void DSWaylandInputPanel::setTransientFor(DSWaylandSurface *parent)
-{
- DSWaylandSurface *curParent = parent;
- if (curParent)
- {
- /* TODO:
- * if curParent->remoteSurface.onScreenParent
- * curParent = curParent->remoteSurface.onScreenParent
- */
- }
-
- __inputPanelSurface->setTransientForSurface(curParent);
-}
-
-void DSWaylandInputPanel::changeVisibility(bool visible)
-{
- __rerunPanelShow = visible;
- //vconf_set_int (VCONFKEY_ISF_INPUT_PANEL_STATE, visible ? VCONFKEY_ISF_INPUT_PANEL_STATE_SHOW : VCONFKEY_ISF_INPUT_PANEL_STATE_HIDE);
- __inputPanelSurface->updateSurfaceVisibility(visible);
- /* TODO: delete waitTimer */
-}
-
-bool DSWaylandInputPanel::isEffectRunning(DSWaylandSurface *window)
-{
- /* TODO:
- * if window is animating
- * return true
- */
- return false;
-}
-
-void DSWaylandInputPanel::setFloatingPosition(int x, int y)
-{
- __inputPanelSurface->setFloatingPosition(x, y);
-}
-
-DSWaylandInputPanelFloating* DSWaylandInputPanel::getFloatingData()
-{
- return __inputPanelFloating;
-}
-
-stGeometry DSWaylandInputPanel::getSurfaceGeometry(DSWaylandSurface *wlSurface)
-{
- return __inputPanelSurface->getGeometry(wlSurface);
-}
-
-void DSWaylandInputPanel::updateTextInputPanelState(bool state)
-{
- if (!__dsTextInputPrivate) return;
-
- __dsTextInputPrivate->updateTextInputPanelState(state);
-}
-
-DSWaylandSurface *DSWaylandInputPanel::getTextInputSurface()
-{
- if (!__dsTextInputPrivate) return nullptr;
-
- return __dsTextInputPrivate->getTextInputSurface();
-}
-
-void DSWaylandInputPanel::__onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo)
-{
- if (!waylandSurfaceCommitInfo->bufferChanged())
- return;
-
- std::shared_ptr<IDSBuffer> buffer = waylandSurfaceCommitInfo->getBuffer();
- std::shared_ptr<stSize> bufferSize = buffer->getSize();
-
- DSWindowManager *windowManager = DSWindowManager::getInstance();
- stGeometry geo = windowManager->getWindowGeometry(__wlSurface);
-
- /* FIXME: This calc is only for 0 angle. Use others calc if window is rotated */
- int nx = geo.x + (geo.w - bufferSize->w) / 2;
- int ny = geo.y + geo.h - bufferSize->h;
-
- windowManager->setWindowGeometry(__wlSurface, nx, ny, bufferSize->w, bufferSize->h);
- windowManager->releaseInstance();
-}
-
-void DSWaylandInputPanel::__onEventIdleEnterer(void *data)
-{
-}
-
-
-DSWaylandInputPanelSurfacePrivate::DSWaylandInputPanelSurfacePrivate(DSWaylandInputPanelSurface *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr),
- __compositor(compositor)
-{
-}
-
-DSWaylandInputPanelSurfacePrivate::~DSWaylandInputPanelSurfacePrivate()
-{
-}
-
-void DSWaylandInputPanelSurfacePrivate::createGlobal(void *client, void *inputPanelResource, unsigned int id, void *surface)
-{
- Resource *resource = add((struct ::wl_client *)client, id, 1);
- __appendSurface(resource, inputPanelResource, surface);
-}
-
-void DSWaylandInputPanelSurfacePrivate::clearGlobals(void *inputPanelResource)
-{
- for (auto it = __dataMap.begin(); it != __dataMap.end(); it++)
- {
- DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
- if (surfaceData->getInputPanelResource() == inputPanelResource)
- {
- it = __dataMap.erase(it);
- /* TODO: clear window's data */
- }
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::flushFrame()
-{
- for (auto it = __dataMap.begin(); it != __dataMap.end(); it++)
- {
- DSWaylandInputPanelSurfaceData *_surfaceData = (*it).second;
- if (_surfaceData->getWlSurface())
- {
- /* TODO: clear pixmap image */
- }
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::show(DSWaylandInputPanelSurfaceData *surfaceData)
-{
- DS_GET_PUB(DSWaylandInputPanelSurface);
-
-#if false
- if (!surfaceData)
- {
- for (auto it = __dataMap.begin(); it != __dataMap.end(); it++)
- {
- DSWaylandInputPanelSurfaceData *data = (*it).second;
- if (!data) continue;
-
- DSWaylandSurface *wlSurface = data->getWlSurface();
- if (wlSurface->parent == DSKeyboard::getFocus())
- {
- surfaceData = data;
- break;
- }
- }
- }
-#endif
-
- if (!surfaceData) return;
-
- if (pub->__inputPanel->getWaitUpdate())
- {
- pub->__inputPanel->setWaitUpdate(false);
- pub->__inputPanel->changeVisibility(true);
- pub->__inputPanel->updateTextInputPanelState(true);
- /* TODO:
- * if (getfocus(surfaceData->getWlSurface())->parent)
- * {
- * if (getfocus(surfaceData->getWlSurface())->parent == focused)
- * {
- * pub->__inputPanel->visibilityChange(true);
- * pub->__inputPanel->updateInputPanelState(true);
- * }
- * else
- * pub->__inputPanel->visibilityChange(false);
- * }
- * else
- * pub->__inputPanel->visibilityChange(false);
- */
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::directShow(DSWaylandInputPanelSurfaceData *surfaceData)
-{
- DS_GET_PUB(DSWaylandInputPanelSurface);
-
- pub->setPosition(nullptr, 0, 0); /* FIXME: set correct value */
- DSWindowManager *windowManager = DSWindowManager::getInstance();
- windowManager->activateWindow(surfaceData->getWlSurface());
-
- windowManager->releaseInstance();
-
- /* TODO: change window geometry */
-}
-
-void DSWaylandInputPanelSurfacePrivate::setTransientForSurface(DSWaylandSurface *parent)
-{
- for (auto it = __dataMap.begin(); it != __dataMap.end(); it++)
- {
- DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
- DSWaylandSurface *child = surfaceData->getWlSurface();
-
- // TODO: if current child has parent reset this
-
- DSWindowManager *windowManager = DSWindowManager::getInstance();
- windowManager->setWindowParent(child, parent);
- windowManager->releaseInstance();
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::updateSurfaceVisibility(bool visible)
-{
- for (auto it = __dataMap.begin(); it != __dataMap.end(); it++)
- {
- DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
- surfaceData->showing = visible;
- __updateSurfaceVisibility(surfaceData);
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::setFloatingPosition(int x, int y)
-{
- DS_GET_PUB(DSWaylandInputPanelSurface);
- DSWaylandInputPanelSurfaceData *floatingData = nullptr;
- DSWaylandInputPanelFloating *inputPanelFloating;
-
- for (auto it = __dataMap.begin(); it != __dataMap.end(); it++)
- {
- //DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
-
- /* TODO:
- * if vkbd.floating
- * floatingData = surfaceData
- */
- }
-
- inputPanelFloating = pub->__inputPanel->getFloatingData();
- (void) inputPanelFloating;
- (void) floatingData;
-
-#if 0//Unreachable code ! Thus, disable temporarily.
- if (!floatingData || !inputPanelFloating) return;
-
- int curAngle = 0;
-
- /* TODO:
- * if (floatingData->showing)
- * curAngle = get ec angle
- * else
- * curAngle = get zone angle
- */
-
- switch (curAngle)
- {
- case 90:
- case 270:
- inputPanelFloating->setLandscapePos(x, y);
- //__inputPanelFloating->startLandscapePos.x = x;
- //__inputPanelFloating->startLandscapePos.y = y;
- //__inputPanelFloating->initLandscapePos = true;
- break;
-// case 0:
-// case 180:
- default:
- inputPanelFloating->setPortraitPos(x, y);
- //__inputPanelFloating->startPortraitPos.x = x;
- //__inputPanelFloating->startPortraitPos.y = y;
- //__inputPanelFloating->initPortraitPos = true;
- break;
- }
-
- if (floatingData->showing)
- pub->setPosition(nullptr, 0, 0); /* FIXME: set correct window and data */
-#endif
-}
-
-stGeometry DSWaylandInputPanelSurfacePrivate::getGeometry(DSWaylandSurface *wlSurface)
-{
- DSWindowManager *windowManager = DSWindowManager::getInstance();
- stGeometry geometry = {0, };
- for (auto it = __dataMap.begin(); it != __dataMap.end(); it++)
- {
- DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
- if (!wlSurface || (wlSurface == surfaceData->getWlSurface()))
- {
- return windowManager->getWindowGeometry(surfaceData->getWlSurface());
- }
- }
- windowManager->releaseInstance();
- return geometry;
-}
-
-void DSWaylandInputPanelSurfacePrivate::input_panel_surface_destroy_resource(Resource *resource)
-{
- auto it = __dataMap.find(resource);
- if (it != __dataMap.end())
- {
- DSWaylandInputPanelSurfaceData *destroyData = (*it).second;
- delete destroyData;
- __dataMap.erase(resource);
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_toplevel(Resource *resource, struct ::wl_resource *output, uint32_t position)
-{
- /* TODO? If this surface is not included in __dataMap, add this surface */
-
- auto it = __dataMap.find(resource);
- if (it != __dataMap.end())
- {
- DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
- surfaceData->panel = true;
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_overlay_panel(Resource *resource)
-{
- /* TODO? If this surface is not included in __dataMap, add this surface */
-
- auto it = __dataMap.find(resource);
- if (it != __dataMap.end())
- {
- DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
- surfaceData->panel = true;
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_ready(Resource *resource, uint32_t state)
-{
- auto it = __dataMap.find(resource);
- if (it != __dataMap.end())
- {
- DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
- /* TODO: find DSWaylandSurface and update base_output resolution */
- show(surfaceData);
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_floating_panel(Resource *resource, uint32_t state)
-{
- /* TODO:
- * set DSWaylandSurface's vkbd.floating = !!state
- * if true
- * policy_conformant_part_del
- * else
- * policy_conformant_part_add
- */
-}
-
-void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_floating_drag_enabled(Resource *resource, uint32_t enabled)
-{
- DS_GET_PUB(DSWaylandInputPanelSurface);
-
- pub->__inputPanel->setFloatingMovingRequest(!!enabled);
-}
-
-void DSWaylandInputPanelSurfacePrivate::__updateSurfaceVisibility(DSWaylandInputPanelSurfaceData *surfaceData)
-{
- DS_GET_PUB(DSWaylandInputPanelSurface);
-
- if (surfaceData->showing) /* TODO: check pixmap is usable too*/
- {
- if (pub->__inputPanel->getRerunPanelShow())
- pub->__inputPanel->setRerunPanelShow(false);
- if (pub->isEffectRunning(nullptr)) // FIXME: change this to get window surfaceData->getDSWaylandSurface()
- surfaceData->needShow = true;
- else if (surfaceData->resizing)
- surfaceData->needShow = true;
- else
- {
- directShow(surfaceData);
- surfaceData->needShow = false;
- }
- }
- else
- {
- /* TODO:
- * change window's property
- */
- surfaceData->needShow = false;
- }
-}
-
-void DSWaylandInputPanelSurfacePrivate::__appendSurface(Resource *resource, void *inputPanelResource, void *surface)
-{
- DS_GET_PUB(DSWaylandInputPanelSurface);
- DSWaylandInputPanelSurfaceData *data = new DSWaylandInputPanelSurfaceData(resource, inputPanelResource, surface);
- __dataMap.insert(std::pair<Resource*, DSWaylandInputPanelSurfaceData *>(resource, data));
-
- DSWaylandSurface *textInputSurface = pub->__inputPanel->getTextInputSurface();
-
- if (textInputSurface)
- {
- pub->__inputPanel->setTransientFor(textInputSurface);
- }
-
- if (pub->__inputPanel->getRerunPanelShow())
- {
- pub->__inputPanel->changeVisibility(true);
- }
-}
-
-
-DSWaylandInputPanelSurface::DSWaylandInputPanelSurface(DSWaylandCompositor *compositor, DSWaylandInputPanel *inputPanel)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandInputPanelSurfacePrivate>(this, compositor)),
- __compositor(compositor),
- __inputPanel(inputPanel)
-{
-}
-
-DSWaylandInputPanelSurface::~DSWaylandInputPanelSurface()
-{
-}
-
-void DSWaylandInputPanelSurface::createGlobal(void *client, void *inputPanelResource, unsigned int id, void *surface)
-{
- DS_GET_PRIV(DSWaylandInputPanelSurface);
-
- if (!client || !inputPanelResource || !surface) return;
-
- priv->createGlobal(client, inputPanelResource, id, surface);
-}
-
-void DSWaylandInputPanelSurface::clearGlobals(void *inputPanelResource)
-{
- DS_GET_PRIV(DSWaylandInputPanelSurface);
-
- if (!inputPanelResource) return;
-
- priv->clearGlobals(inputPanelResource);
-}
-
-void DSWaylandInputPanelSurface::flushFrame()
-{
- DS_GET_PRIV(DSWaylandInputPanelSurface);
-
- priv->flushFrame();
-}
-
-void DSWaylandInputPanelSurface::setTransientForSurface(DSWaylandSurface *parent)
-{
- DS_GET_PRIV(DSWaylandInputPanelSurface);
-
- priv->setTransientForSurface(parent);
-}
-
-void DSWaylandInputPanelSurface::updateSurfaceVisibility(bool visible)
-{
- DS_GET_PRIV(DSWaylandInputPanelSurface);
-
- priv->updateSurfaceVisibility(visible);
-}
-
-bool DSWaylandInputPanelSurface::isEffectRunning(DSWaylandSurface *window)
-{
- return __inputPanel->isEffectRunning(window);
-}
-
-void DSWaylandInputPanelSurface::setPosition(DSWaylandSurface *window, int width, int height)
-{
-}
-
-void DSWaylandInputPanelSurface::setFloatingPosition(int x, int y)
-{
- DS_GET_PRIV(DSWaylandInputPanelSurface);
-
- priv->setFloatingPosition(x, y);
-}
-
-stGeometry DSWaylandInputPanelSurface::getGeometry(DSWaylandSurface *wlSurface)
-{
- DS_GET_PRIV(DSWaylandInputPanelSurface);
-
- return priv->getGeometry(wlSurface);
-}
-/*LCOV_EXCL_STOP*/
-
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_INPUT_PANEL_H__
-#define __DS_WAYLAND_INPUT_PANEL_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSStruct.h"
-#include "DSWaylandCompositor.h"
-#include "DSEventLoop.h"
-#include "DSTextInputPrivate.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandInputPanelPrivate;
-class DSWaylandInputPanelSurface;
-class DSWaylandInputPanelFloating;
-class DSWaylandSurface;
-class DSWaylandSurfaceCommitInfo;
-
-class DS_DECL_EXPORT DSWaylandInputPanel : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandInputPanel);
-public:
- DSWaylandInputPanel(DSWaylandCompositor *compositor);
- DSWaylandInputPanel(DSWaylandCompositor *compositor, DSTextInputPrivate *dsTextInputPrivate);
- ~DSWaylandInputPanel() override;
-
- void createSurface(void *client, void *inputPanelResource, unsigned int id, void *surface);
- void clearSurfaces(void *inputPanelResource);
- bool getWaitUpdate();
- void setWaitUpdate(bool waitUpdate);
- void updateInputPanelState(bool waitUpdate);
- bool getRerunPanelShow();
- void setRerunPanelShow(bool needShow);
-
- void setFloatingMovingRequest(bool enabled);
- void setTransientFor(DSWaylandSurface *parent);
- void changeVisibility(bool visible);
- bool isEffectRunning(DSWaylandSurface *window);
- void setFloatingPosition(int x, int y);
- DSWaylandInputPanelFloating *getFloatingData();
- stGeometry getSurfaceGeometry(DSWaylandSurface *wlSurface);
- void updateTextInputPanelState(bool state);
- DSWaylandSurface *getTextInputSurface();
-
-private:
- DSWaylandCompositor *__compositor;
- DSTextInputPrivate *__dsTextInputPrivate;
- DSEventLoop *__eventLoop;
- DSWaylandInputPanelSurface *__inputPanelSurface;
- DSWaylandInputPanelFloating *__inputPanelFloating;
- bool __waitUpdate;
- bool __rerunPanelShow;
- DSWaylandSurface *__wlSurface;
-
- void __onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo);
- void __onEventIdleEnterer(void *data);
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_INPUT_PANEL_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_INPUT_PANEL_PRIVATE_H__
-#define __DS_WAYLAND_INPUT_PANEL_PRIVATE_H__
-
-#include "dswayland-server-input-method-unstable-v1.h"
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "DSWaylandInputPanel.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DS_DECL_EXPORT DSWaylandInputPanelPrivate : public DSObjectPrivate, public DSWaylandServer::zwp_input_panel_v1
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandInputPanel);
-public:
- DSWaylandInputPanelPrivate(DSWaylandInputPanel *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandInputPanelPrivate() override;
-
-protected:
- void input_panel_destroy_resource(Resource *resource);
- void input_panel_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface);
-
-private:
- DSWaylandCompositor *__compositor;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_INPUT_PANEL_PRIVATE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_INPUT_PANEL_SURFACE_H__
-#define __DS_WAYLAND_INPUT_PANEL_SURFACE_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSStruct.h"
-#include "DSWaylandInputPanel.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandInputPanelSurfacePrivate;
-class DSWaylandSurface;
-
-class DS_DECL_EXPORT DSWaylandInputPanelSurface : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandInputPanelSurface);
-public:
- DSWaylandInputPanelSurface(DSWaylandCompositor *compositor, DSWaylandInputPanel *inputPanel);
- ~DSWaylandInputPanelSurface() override;
-
- void createGlobal(void *client, void *inputPanelResource, unsigned int id, void *surface);
- void clearGlobals(void *inputPanelResource);
- void flushFrame();
- void setTransientForSurface(DSWaylandSurface *parent);
- void updateSurfaceVisibility(bool visible);
- bool isEffectRunning(DSWaylandSurface *window);
- void setPosition(DSWaylandSurface *window, int width, int height);
- void setFloatingPosition(int x, int y);
- stGeometry getGeometry(DSWaylandSurface *wlSurface);
-
-protected:
-
-private:
- DSWaylandCompositor *__compositor;
- DSWaylandInputPanel *__inputPanel;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_INPUT_PANEL_SURFACE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_INPUT_PANEL_SURFACE_PRIVATE_H__
-#define __DS_WAYLAND_INPUT_PANEL_SURFACE_PRIVATE_H__
-
-#include "dswayland-server-input-method-unstable-v1.h"
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "DSStruct.h"
-#include "DSWaylandInputPanelSurface.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandInputPanelSurfaceData;
-
-class DS_DECL_EXPORT DSWaylandInputPanelSurfacePrivate : public DSObjectPrivate, public DSWaylandServer::zwp_input_panel_surface_v1
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandInputPanelSurface);
-public:
- DSWaylandInputPanelSurfacePrivate(DSWaylandInputPanelSurface *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandInputPanelSurfacePrivate() override;
-
- void createGlobal(void *client, void *inputPanelResource, unsigned int id, void *surface);
- void clearGlobals(void *inputPanelResource);
-
- void show(DSWaylandInputPanelSurfaceData *surfaceData);
- void directShow(DSWaylandInputPanelSurfaceData *surfaceData);
- void flushFrame();
- void setTransientForSurface(DSWaylandSurface *parent);
- void updateSurfaceVisibility(bool visible);
- void setFloatingPosition(int x, int y);
- stGeometry getGeometry(DSWaylandSurface *wlSurface);
-
-protected:
- void input_panel_surface_destroy_resource(Resource *resource);
-
- void input_panel_surface_set_toplevel(Resource *resource, struct ::wl_resource *output, uint32_t position);
- void input_panel_surface_set_overlay_panel(Resource *resource);
- void input_panel_surface_set_ready(Resource *resource, uint32_t state);
- void input_panel_surface_set_floating_panel(Resource *resource, uint32_t state);
- void input_panel_surface_set_floating_drag_enabled(Resource *resource, uint32_t enabled);
-
-private:
- DSWaylandCompositor *__compositor;
- std::multimap<Resource*, DSWaylandInputPanelSurfaceData *> __dataMap;
-
- void __updateSurfaceVisibility(DSWaylandInputPanelSurfaceData *surfaceData);
- void __appendSurface(Resource *resource, void *inputPanelResource, void *surface);
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_INPUT_PANEL_SURFACE_PRIVATE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandKeyboard.h"
-#include "DSWaylandKeyboardPrivate.h"
-#include "DSWaylandClient.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandSurface.h"
-#include "DSWaylandCompositor.h"
-#include "DSXkb.h"
-
-#include <fcntl.h>
-
-namespace display_server
-{
-
-/* Begin Private Class Implementation */
-DSWaylandKeyboardPrivate::DSWaylandKeyboardPrivate(DSWaylandSeat *seat, DSWaylandKeyboard *keyboard)
- : DSObjectPrivate(keyboard),
- __p_ptr(keyboard),
- __seat(seat),
- __xkb(seat ? (seat->getXkb()) : nullptr),
- __compositor(seat ? (seat->getCompositor()) : nullptr),
- __focusSurface(nullptr),
- __focusClient(nullptr),
- __repeatRate(0),
- __repeatDelay(0)
-{
- if (__xkb)
- {
- __fdKeymap = __xkb->getKeymapFd();
- __fdKeymapSize = __xkb->getKeymapSize();
- __formatKeymap = WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1;
- __depressed = __xkb->getModifierDepressed();
- __latched = __xkb->getModifierLatched();
- __locked = __xkb->getModifierLocked();
- __group = __xkb->getModifierGroup();
- }
- else
- {
- /* open fd of null keymap */
- __fdKeymap = open("/dev/null", O_RDONLY);
- __fdKeymapSize = 0;
- __formatKeymap = WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP;
- __depressed = 0;
- __latched = 0;
- __locked = 0;
- __group = 0;
- }
-
- DSLOG_INF("DSWaylandKeyboardPrivate", "__fdKeymap=%d, __fdKeymapSize=%d, __formatKeymap=%d",
- __fdKeymap, __fdKeymapSize, __formatKeymap);
-
- wl_keyboard();
- wl_array_init(&__keys);
-}
-
-DSWaylandKeyboardPrivate::~DSWaylandKeyboardPrivate()
-{
- if (__fdKeymap >= 0)
- close(__fdKeymap);
-
- wl_array_release(&__keys);
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandKeyboardPrivate::keyboard_bind_resource(Resource *resource)
-{
- DSLOG_INF("DSWaylandKeyboardPrivate","");
-
- sendKeymap(resource);
- sendRepeatInfo(resource);
-
- if (__focusSurface && __focusSurface->hasResource())
- {
- DSLOG_INF("DSWaylandKeyboardPrivate", "Send enter to focusSurface(%p)", __focusSurface);
- sendEnter(__focusSurface->getWlResource());
- }
-}
-
-void DSWaylandKeyboardPrivate::keyboard_destroy_resource(Resource *resource)
-{
- DSLOG_INF("DSWaylandKeyboardPrivate","");
-}
-
-void DSWaylandKeyboardPrivate::keyboard_release(Resource *resource)
-{
- DSLOG_INF("DSWaylandKeyboardPrivate","");
- wl_resource_destroy(resource->handle);
-}
-
-void DSWaylandKeyboardPrivate::sendKeymap(Resource *resource)
-{
- send_keymap(resource->handle, __formatKeymap, __fdKeymap, __fdKeymapSize);
-}
-
-void DSWaylandKeyboardPrivate::sendRepeatInfo(Resource *resource)
-{
- if (WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION > resource->version())
- return;
-
- send_repeat_info(resource->handle, __repeatRate, __repeatDelay);
-}
-
-void DSWaylandKeyboardPrivate::sendEnter(struct ::wl_resource *surface)
-{
- auto client = wl_resource_get_client(surface);
- auto resMap = resourceMap();
- auto func = [&](std::pair<struct ::wl_client*, Resource*> res)
- {
- if (res.first == client)
- {
- send_enter(res.second->handle, __compositor->nextSerial(), surface, &__keys);
- }
- };
-
- std::for_each(resMap.begin(), resMap.end(), func);
-
- //TODO : send key press event(s) of the pressed key(s) to current focus window
-}
-
-void DSWaylandKeyboardPrivate::sendLeave(struct ::wl_resource *surface)
-{
- auto client = wl_resource_get_client(surface);
- auto resMap = resourceMap();
- auto func = [&](std::pair<struct ::wl_client*, Resource*> res)
- {
- if (res.first == client)
- {
- send_leave(res.second->handle, __compositor->nextSerial(), surface);
- }
- };
-
- //TODO : send key release events of the pressed keys to current focus window
-
- std::for_each(resMap.begin(), resMap.end(), func);
-}
-
-void DSWaylandKeyboardPrivate::sendModifiers(struct ::wl_resource *surface)
-{
- bool need_send = false;
- uint32_t mod = 0;
-
- if (!__xkb)
- return;
-
- mod = __xkb->getModifierDepressed();
- need_send |= (__depressed != mod);
- __depressed = mod;
-
- mod = __xkb->getModifierLatched();
- need_send |= (__latched != mod);
- __latched = mod;
-
- mod = __xkb->getModifierLocked();
- need_send |= (__locked != mod);
- __locked = mod;
-
- mod = __xkb->getModifierGroup();
- need_send |= (__group != mod);
- __group = mod;
-
- if (!need_send)
- return;
-
- auto client = wl_resource_get_client(surface);
- auto resMap = resourceMap();
- auto func = [&](std::pair<struct ::wl_client*, Resource*> res)
- {
- if (res.first == client)
- {
- send_modifiers(res.second->handle, __compositor->nextSerial(), __depressed, __latched, __locked, __group);
- }
- };
- std::for_each(resMap.begin(), resMap.end(), func);
-}
-
-void DSWaylandKeyboardPrivate::sendKey(uint32_t key, uint32_t state)
-{
- if (!__focusSurface)
- {
- DSLOG_INF("DSWaylandKeyboardPrivate", "No focusSurface !");
- return;
- }
-
- auto resMap = resourceMap();
- auto func = [&](std::pair<struct ::wl_client*, Resource*> res)
- {
- if (res.first == __focusClient)
- send_key(res.second->handle, __compositor->nextSerial(), __seat->getCurrentEventTime(), key - 8, state);
- };
- std::for_each(resMap.begin(), resMap.end(), func);
-}
-
-void DSWaylandKeyboardPrivate::__addClient(struct ::wl_client *wlClient, uint32_t id, int version)
-{
- wl_keyboard::add(wlClient, id, version);
-
- if (__focusSurface && __focusSurface->hasResource())
- {
- DSWaylandClient *waylandClient = __focusSurface->getClient();
- if (waylandClient && (waylandClient->wlClient() == wlClient))
- {
- DSLOG_INF("DSWaylandKeyboardPrivate", "Send enter to focusSurface(%p)", __focusSurface);
- sendEnter(__focusSurface->getWlResource());
- }
- }
-}
-/*LCOV_EXCL_STOP*/
-
-/* Begin Public Class Implementation */
-DSWaylandKeyboard::DSWaylandKeyboard(DSWaylandSeat *seat)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandKeyboardPrivate>(seat, this))
-{
- //TODO : emit signal
-}
-
-DSWaylandKeyboard::~DSWaylandKeyboard()
-{
- //TODO : emit signal
-}
-
-DSWaylandSeat *DSWaylandKeyboard::seat()
-{
- DS_GET_PRIV(DSWaylandKeyboard);
-
- return priv->__seat;
-}
-
-void DSWaylandKeyboard::setRepeatRate(uint32_t rate)
-{
- DS_GET_PRIV(DSWaylandKeyboard);
-
- priv->__repeatRate = rate;
-}
-
-void DSWaylandKeyboard::setRepeatDelay(uint32_t delay)
-{
- DS_GET_PRIV(DSWaylandKeyboard);
-
- priv->__repeatDelay = delay;
-}
-
-uint32_t DSWaylandKeyboard::repeatRate(void)
-{
- DS_GET_PRIV(DSWaylandKeyboard);
-
- return priv->__repeatRate;
-}
-
-uint32_t DSWaylandKeyboard::repeatDelay(void)
-{
- DS_GET_PRIV(DSWaylandKeyboard);
-
- return priv->__repeatDelay;
-}
-
-void DSWaylandKeyboard::addClient(DSWaylandClient *client, uint32_t id, int version)
-{
- DS_GET_PRIV(DSWaylandKeyboard);
-
- DSLOG_INF("DSWaylandKeyboard", "addClient(dswlClient=%p, id=%u, version=%d", client, id, version);
-
- priv->__addClient(client->wlClient(), id, version);
-}
-
-void DSWaylandKeyboard::setFocus(DSWaylandSurface *waylandSurface)
-{
- DS_GET_PRIV(DSWaylandKeyboard);
-
- if (priv->__focusSurface != waylandSurface)
- {
- if (priv->__focusSurface && priv->__focusSurface->hasResource())
- {
- struct ::wl_resource *surfaceToLeave = priv->__focusSurface->getWlResource();
- priv->sendModifiers(surfaceToLeave);
- priv->sendLeave(surfaceToLeave);
- }
-
- if (waylandSurface && waylandSurface->hasResource())
- {
- struct ::wl_resource *surfaceToEnter = waylandSurface->getWlResource();
- priv->sendEnter(surfaceToEnter);
-
- priv->__focusSurface = waylandSurface;
- priv->__focusClient = wl_resource_get_client(waylandSurface->getWlResource());
- }
- }
-}
-
-void DSWaylandKeyboard::resetFocus()
-{
- DS_GET_PRIV(DSWaylandKeyboard);
- priv->__focusSurface = nullptr;
- priv->__focusClient = nullptr;
-}
-
-DSWaylandSurface *DSWaylandKeyboard::getFocus()
-{
- DS_GET_PRIV(DSWaylandKeyboard);
- return priv->__focusSurface;
-}
-
-void DSWaylandKeyboard::sendKeyDown(uint32_t keycode)
-{
- DS_GET_PRIV(DSWaylandKeyboard);
- priv->sendKey(keycode, WL_KEYBOARD_KEY_STATE_PRESSED);
-
- if (priv->__focusSurface)
- priv->sendModifiers(priv->__focusSurface->getWlResource());
-}
-
-void DSWaylandKeyboard::sendKeyUp(uint32_t keycode)
-{
- DS_GET_PRIV(DSWaylandKeyboard);
- priv->sendKey(keycode, WL_KEYBOARD_KEY_STATE_RELEASED);
-
- if (priv->__focusSurface)
- priv->sendModifiers(priv->__focusSurface->getWlResource());
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_KEYBOARD_H__
-#define __DS_WAYLAND_KEYBOARD_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSWaylandSeat;
-class DSWaylandKeyboardPrivate;
-class DSWaylandClient;
-class DSWaylandSurface;
-
-class DS_DECL_EXPORT DSWaylandKeyboard : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWaylandKeyboard);
-public:
- DSWaylandKeyboard(DSWaylandSeat *seat);
- ~DSWaylandKeyboard() override;
-
- DSWaylandSeat *seat();
-
- void setRepeatRate(uint32_t rate);
- void setRepeatDelay(uint32_t delay);
- uint32_t repeatRate(void);
- uint32_t repeatDelay(void);
-
- void addClient(DSWaylandClient *client, uint32_t id, int version);
- void setFocus(DSWaylandSurface *waylandSurface);
- void resetFocus();
- DSWaylandSurface *getFocus();
-
- void sendKeyDown(uint32_t keycode);
- void sendKeyUp(uint32_t keycode);
-
-protected:
-
-private:
-
-};
-
-}
-
-#endif //__DS_WAYLAND_KEYBOARD_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_KEYBOARD_PRIVATE_H__
-#define __DS_WAYLAND_KEYBOARD_PRIVATE_H__
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "dswayland-server-wayland.h"
-#include "wayland-util.h"
-
-struct wl_client;
-struct wl_array;
-
-namespace display_server
-{
-
-class DSXkb;
-class DSWaylandSeat;
-class DSWaylandSurface;
-class DSWaylandCompositor;
-
-class DS_DECL_EXPORT DSWaylandKeyboardPrivate : public DSObjectPrivate, public DSWaylandServer::wl_keyboard
-{
- DS_PIMPL_USE_PUBLIC(DSWaylandKeyboard);
-public:
- DSWaylandKeyboardPrivate(DSWaylandSeat *seat, DSWaylandKeyboard *keyboard);
- ~DSWaylandKeyboardPrivate() override;
-
- //TO DO
-
-protected:
- //virtual Resource *keyboard_allocate();
- virtual void keyboard_bind_resource(Resource *resource);
- virtual void keyboard_destroy_resource(Resource *resource);
- virtual void keyboard_release(Resource *resource);
-
- /* APIs must be provided */
- void sendKey(uint32_t key, uint32_t state);
- void sendKeymap(Resource *resource);
- void sendRepeatInfo(Resource *resource);
- void sendEnter(struct ::wl_resource *surface);
- void sendLeave(struct ::wl_resource *surface);
- void sendModifiers(struct ::wl_resource *surface);
-
-private:
- void __addClient(struct ::wl_client *wlClient, uint32_t id, int version);
-
- DSWaylandSeat *__seat;
- DSXkb *__xkb;
- DSWaylandCompositor *__compositor;
- DSWaylandSurface *__focusSurface;
- struct ::wl_client *__focusClient;
-
- uint32_t __repeatRate;
- uint32_t __repeatDelay;
- struct ::wl_array __keys;
-
- int __fdKeymap;
- uint32_t __fdKeymapSize;
- uint32_t __formatKeymap;
-
- /* modifiers status */
- uint32_t __depressed;
- uint32_t __latched;
- uint32_t __locked;
- uint32_t __group;
-};
-
-}
-
-#endif //__DS_WAYLAND_KEYBOARD_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandOutput.h"
-#include "DSWaylandOutputPrivate.h"
-#include "DSWaylandClient.h"
-#include "DSTizenAppinfoMgr.h"
-
-namespace display_server
-{
-
-DSWaylandOutputPrivate::DSWaylandOutputPrivate(DSWaylandOutput *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __outputRect({0,0,0,0}),
- __phyWidth(0),
- __phyHeight(0),
- __refresh(0),
- __subpixel(0),
- __transform(0),
- __scale(1.0)
-{
- if (!compositor) return;
-
- wl_output::init(compositor->display(), 3);
-}
-
-DSWaylandOutputPrivate::~DSWaylandOutputPrivate()
-{
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandOutputPrivate::output_bind_resource(wl_output::Resource *resource)
-{
- DSLOG_DBG("DSWaylandOutputPriv", "");
- int res_w, res_h;
-
- /* TODO: if the config of configured_output_resolution.use is set, use the congigured resolution values */
- //if (e_config->configured_output_resolution.use)
- //{
- if (!getBaseResolutionFromAppinfo(resource, &res_w, &res_h)) {
- /* TODO: Read configured resolution values */
- }
- //}
- //else
- //{
- res_w = __outputRect.w;
- res_h = __outputRect.h;
- //}
- sendWaylandOutputInfo(resource, res_w, res_h);
-}
-
-void DSWaylandOutputPrivate::output_destroy_resource(Resource *resource)
-{
-}
-
-void DSWaylandOutputPrivate::output_release(wl_output::Resource *resource)
-{
-}
-
-void DSWaylandOutputPrivate::sendWaylandOutputInfo(Resource *resource)
-{
- DSLOG_DBG("DSWaylandOutputPriv", "outputRect.x,y,w,h: (%d,%d,%d,%d), phyWidth,Height: (%d,%d)", __outputRect.x, __outputRect.y, __outputRect.w, __outputRect.h, __phyWidth, __phyHeight);
- wl_output::send_scale(resource->handle, __scale);
- wl_output::send_geometry(resource->handle, __outputRect.x, __outputRect.y, __phyWidth, __phyHeight, __subpixel, __make, __model, __transform);
- wl_output::send_mode(resource->handle, mode_current | mode_preferred, __outputRect.w, __outputRect.h, __refresh);
- wl_output::send_done(resource->handle);
-}
-
-void DSWaylandOutputPrivate::sendWaylandOutputInfo(Resource *resource, int res_w, int res_h)
-{
- DSLOG_DBG("DSWaylandOutputPriv", "resolution width,hight: (%d,%d)", res_w, res_h);
- int w, h, phyw, phyh;
-
- /* TODO: calculate the ratio of resolution width/height and output values and change the configured output resolution and configured physical size */
- w = __outputRect.w;
- h = __outputRect.h;
- phyw = __phyWidth;
- phyh = __phyHeight;
-
- wl_output::send_scale(resource->handle, __scale);
- wl_output::send_geometry(resource->handle, __outputRect.x, __outputRect.y, phyw, phyh, __subpixel, __make, __model, __transform);
- wl_output::send_mode(resource->handle, mode_current | mode_preferred, w, h, __refresh);
- wl_output::send_done(resource->handle);
-}
-
-bool DSWaylandOutputPrivate::getBaseResolutionFromAppinfo(Resource *resource, int *w, int *h)
-{
- DSWaylandClient *client = DSWaylandClient::fromWlClient(resource->client());
- DSTizenAppinfoMgr *appinfoMgr = DSTizenAppinfoMgr::getInstance();
- pid_t pid = -1;
- int res_w, res_h;
- bool res = false;
-
- pid = client->pid();
- if (pid <= 0) {
- return false;
- }
- res = appinfoMgr->getBaseOutputResolution(pid, &res_w, &res_h);
- if (!res)
- return false;
-
- if (w) *w = res_w;
- if (h) *h = res_h;
-
- DSTizenAppinfoMgr::releaseInstance();
- return true;
-}
-/*LCOV_EXCL_STOP*/
-
-void DSWaylandOutputPrivate::sendWaylandOutputInfo(void)
-{
- std::multimap<struct ::wl_client*, Resource*>::iterator iter;
- std::multimap<struct ::wl_client*, Resource*> resMap = resourceMap();
-
- for (iter = resMap.begin(); iter != resMap.end(); iter++)
- {
- Resource *res = (*iter).second;
- sendWaylandOutputInfo(res);
- }
-}
-
-void DSWaylandOutputPrivate::setWaylandOutputResolution(int x, int y, int w, int h)
-{
- __outputRect.x = x;
- __outputRect.y = y;
- __outputRect.w = w;
- __outputRect.h = h;
-}
-
-void DSWaylandOutputPrivate::setWaylandOutputPhysicalSize(int phyWidth, int phyHeight)
-{
- __phyWidth = phyWidth;
- __phyHeight = phyHeight;
-}
-
-void DSWaylandOutputPrivate::setWaylandOutputId(std::string id)
-{
- __id = id;
-}
-
-void DSWaylandOutputPrivate::setWaylandOutputMake(std::string make)
-{
- __make = make;
-}
-
-void DSWaylandOutputPrivate::setWaylandOutputModel(std::string model)
-{
- __model = model;
-}
-
-void DSWaylandOutputPrivate::setWaylandOutputRefresh(unsigned int refresh)
-{
- __refresh = refresh;
-}
-
-void DSWaylandOutputPrivate::setWaylandOutputSubpixel(unsigned int subpixel)
-{
- __subpixel = subpixel;
-}
-
-void DSWaylandOutputPrivate::setWaylandOutputTransform(unsigned int transform)
-{
- __transform = transform;
-}
-
-DSWaylandOutput::DSWaylandOutput(DSWaylandCompositor *compositor,
- std::string id, std::string make, std::string model,
- int x, int y, int w, int h, int pw, int ph,
- unsigned int refresh, unsigned int subpixel, unsigned int transform)
- : _d_ptr(std::make_unique<DSWaylandOutputPrivate>(this, compositor))
-{
- _d_ptr->setWaylandOutputResolution(x, y, w, h);
- _d_ptr->setWaylandOutputPhysicalSize(pw, ph);
- _d_ptr->setWaylandOutputId(id);
- _d_ptr->setWaylandOutputMake(make);
- _d_ptr->setWaylandOutputModel(model);
- _d_ptr->setWaylandOutputRefresh(refresh);
- _d_ptr->setWaylandOutputSubpixel(subpixel);
- _d_ptr->setWaylandOutputTransform(transform);
-}
-
-DSWaylandOutput::~DSWaylandOutput()
-{
-}
-
-void DSWaylandOutput::sendWaylandOutputInfo(void)
-{
- DSLOG_INF("DSWaylandOutput", "send wayland output info to all client");
- DS_GET_PRIV(DSWaylandOutput);
-
- priv->sendWaylandOutputInfo();
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_OUTPUT_H_
-#define _DS_WAYLAND_OUTPUT_H_
-
-#include <DSObject.h>
-#include <DSCore.h>
-#include <DSStruct.h>
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-class DSWaylandOutputPrivate;
-
-class DS_DECL_EXPORT DSWaylandOutput : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandOutput);
-
-public:
- DSWaylandOutput(DSWaylandCompositor *compositor,
- std::string id, std::string make, std::string model,
- int x, int y, int w, int h, int pw, int ph,
- unsigned int refresh, unsigned int subpixel, unsigned int transform);
- virtual ~DSWaylandOutput();
-
- void sendWaylandOutputInfo(void);
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_OUTPUT_PRIVATE_H_
-#define _DS_WAYLAND_OUTPUT_PRIVATE_H_
-
-#include "dswayland-server-wayland.h"
-#include "DSWaylandOutput.h"
-
-namespace display_server
-{
-
-class DS_DECL_EXPORT DSWaylandOutputPrivate : public DSObjectPrivate, public DSWaylandServer::wl_output
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandOutput);
-
-public:
- DSWaylandOutputPrivate() = delete;
- DSWaylandOutputPrivate(DSWaylandOutput *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandOutputPrivate() override;
-
-protected:
- void output_bind_resource(Resource *resource) override;
- void output_destroy_resource(Resource *resource) override;
- void output_release(Resource *resource) override;
-
- void sendWaylandOutputInfo(Resource *resource);
- void sendWaylandOutputInfo(Resource *resource, int res_w, int res_h);
- void sendWaylandOutputInfo(void);
-
- void setWaylandOutputResolution(int x, int y, int w, int h);
- void setWaylandOutputPhysicalSize(int phyWidth, int phyHeight);
- void setWaylandOutputId(std::string id);
- void setWaylandOutputMake(std::string make);
- void setWaylandOutputModel(std::string model);
- void setWaylandOutputRefresh(unsigned int refresh);
- void setWaylandOutputSubpixel(unsigned int subpixel);
- void setWaylandOutputTransform(unsigned int transform);
-
- bool getBaseResolutionFromAppinfo(Resource *resource, int *w, int *h);
-
-private:
- stRect __outputRect;
- int __phyWidth;
- int __phyHeight;
- unsigned int __refresh;
- unsigned int __subpixel;
- unsigned int __transform;
- double __scale;
- std::string __id;
- std::string __make;
- std::string __model;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandPointer.h"
-#include "DSWaylandPointerPrivate.h"
-#include "DSWaylandClient.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandSurface.h"
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-/* Begin Private Class Implementation */
-DSWaylandPointerPrivate::DSWaylandPointerPrivate(DSWaylandSeat *seat, DSWaylandPointer *pointer)
- : DSObjectPrivate(pointer),
- __p_ptr(pointer),
- __seat(seat),
- __compositor(seat ? (seat->getCompositor()) : nullptr),
- __waylandSurface(nullptr),
- __wlPointerResource(nullptr)
-{
- wl_pointer();
-}
-
-DSWaylandPointerPrivate::~DSWaylandPointerPrivate()
-{
-}
-
-void DSWaylandPointerPrivate::setFocus(DSWaylandSurface *waylandSurface)
-{
- DSLOG_INF("DSWaylandPointerPrivate", "pointer focus changed (%p -> %p)", __waylandSurface, waylandSurface);
-
- __waylandSurface = waylandSurface;
-
- if (!waylandSurface || !waylandSurface->hasResource())
- {
- __wlPointerResource = nullptr;
- DSLOG_INF("DSWaylandPointerPrivate", "wlPointerResource has been set to null.");
- return;
- }
-
- /*LCOV_EXCL_START*/
- struct ::wl_resource *surface = waylandSurface->getWlResource();
- auto client = wl_resource_get_client(surface);
-
- std::multimap<struct ::wl_client*, Resource*>::iterator iter;
- std::multimap<struct ::wl_client*, Resource*> resMap = resourceMap();
-
- for (iter = resMap.begin(); iter != resMap.end(); iter++)
- {
- Resource *res = (*iter).second;
- if (res->client() == client)
- {
- __wlPointerResource = res->handle;
- break;
- }
-
- }
-
- if (!__wlPointerResource)
- {
- DSLOG_INF("DSWaylandPointerPrivate", "no wlPointerResource available");
- return;
- }
- /*LCOV_EXCL_STOP*/
-}
-
-DSWaylandSurface *DSWaylandPointerPrivate::getFocus()
-{
- return __waylandSurface;
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandPointerPrivate::pointer_bind_resource(Resource *resource)
-{
- DSLOG_INF("DSWaylandPointerPrivate","");
-}
-
-void DSWaylandPointerPrivate::pointer_destroy_resource(Resource *resource)
-{
- DSLOG_INF("DSWaylandPointerPrivate","");
-}
-
-void DSWaylandPointerPrivate::pointer_set_cursor(Resource *resource, uint32_t serial, struct ::wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y)
-{
- DSLOG_INF("DSWaylandPointerPrivate","");
-}
-
-void DSWaylandPointerPrivate::pointer_release(Resource *resource)
-{
- DSLOG_INF("DSWaylandPointerPrivate","");
- wl_resource_destroy(resource->handle);
-}
-
-void DSWaylandPointerPrivate::sendEnter(struct ::wl_resource *wlResource, struct ::wl_resource *surface, int surface_x, int surface_y)
-{
- if (!__wlPointerResource)
- return;
-
- wl_fixed_t surface_x_fixed = wl_fixed_from_int(surface_x);
- wl_fixed_t surface_y_fixed = wl_fixed_from_int(surface_y);
-
- send_enter(__wlPointerResource, __compositor->nextSerial(), surface, surface_x_fixed, surface_y_fixed);
-}
-
-void DSWaylandPointerPrivate::sendLeave(struct ::wl_resource *wlResource, struct ::wl_resource *surface)
-{
- if (!__wlPointerResource)
- return;
-
- send_leave(__wlPointerResource, __compositor->nextSerial(), surface);
-}
-
-void DSWaylandPointerPrivate::sendMotion(int surface_x, int surface_y)
-{
- if (!__wlPointerResource)
- return;
-
- wl_fixed_t surface_x_fixed = wl_fixed_from_int(surface_x);
- wl_fixed_t surface_y_fixed = wl_fixed_from_int(surface_y);
-
- send_motion(__wlPointerResource, __seat->getCurrentEventTime(), surface_x_fixed, surface_y_fixed);
-}
-
-void DSWaylandPointerPrivate::sendButton(uint32_t button, uint32_t state)
-{
- if (!__wlPointerResource)
- return;
-
- send_button(__wlPointerResource, __compositor->nextSerial(), __seat->getCurrentEventTime(), button, state);
-}
-/*LCOV_EXCL_STOP*/
-
-/* Begin Public Class Implementation */
-DSWaylandPointer::DSWaylandPointer(DSWaylandSeat *seat)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandPointerPrivate>(seat, this))
-{
- //TODO : emit signal
-}
-
-DSWaylandPointer::~DSWaylandPointer()
-{
- //TODO : emit signal
-}
-
-DSWaylandSeat *DSWaylandPointer::seat()
-{
- DS_GET_PRIV(DSWaylandPointer);
-
- return priv->__seat;
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandPointer::addClient(DSWaylandClient *client, uint32_t id, int version)
-{
- DS_GET_PRIV(DSWaylandPointer);
-
- DSLOG_INF("DSWaylandPointer", "addClient(dswlClient=%p, id=%u, version=%d", client, id, version);
-
- priv->add(client->wlClient(), id, version);
-}
-/*LCOV_EXCL_STOP*/
-
-void DSWaylandPointer::setFocus(DSWaylandSurface *waylandSurface)
-{
- DS_GET_PRIV(DSWaylandPointer);
- priv->setFocus(waylandSurface);
-}
-
-void DSWaylandPointer::resetFocus()
-{
- DS_GET_PRIV(DSWaylandPointer);
- priv->__waylandSurface = nullptr;
- priv->__wlPointerResource = nullptr;
-}
-
-DSWaylandSurface *DSWaylandPointer::getFocus()
-{
- DS_GET_PRIV(DSWaylandPointer);
- return priv->getFocus();
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandPointer::sendEnter(int surface_x, int surface_y)
-{
- DS_GET_PRIV(DSWaylandPointer);
- priv->sendEnter(priv->__wlPointerResource, priv->__waylandSurface->getWlResource(), surface_x, surface_y);
-}
-
-void DSWaylandPointer::sendLeave()
-{
- DS_GET_PRIV(DSWaylandPointer);
- priv->sendLeave(priv->__wlPointerResource, priv->__waylandSurface->getWlResource());
-}
-
-void DSWaylandPointer::sendMotion(int surface_x, int surface_y)
-{
- DS_GET_PRIV(DSWaylandPointer);
- priv->sendMotion(surface_x, surface_y);
-}
-
-void DSWaylandPointer::sendButtonDown(uint32_t button)
-{
- DS_GET_PRIV(DSWaylandPointer);
- priv->sendButton(button, WL_POINTER_BUTTON_STATE_PRESSED);
-}
-
-void DSWaylandPointer::sendButtonUp(uint32_t button)
-{
- DS_GET_PRIV(DSWaylandPointer);
- priv->sendButton(button, WL_POINTER_BUTTON_STATE_RELEASED);
-}
-/*LCOV_EXCL_STOP*/
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_POINTER_H__
-#define __DS_WAYLAND_POINTER_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSWaylandSeat;
-class DSWaylandPointerPrivate;
-class DSWaylandClient;
-class DSWaylandSurface;
-
-class DS_DECL_EXPORT DSWaylandPointer : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWaylandPointer);
-public:
- DSWaylandPointer(DSWaylandSeat *seat);
- ~DSWaylandPointer() override;
-
- DSWaylandSeat *seat();
-
- void addClient(DSWaylandClient *client, uint32_t id, int version);
- void resetFocus();
- void setFocus(DSWaylandSurface *waylandSurface);
- DSWaylandSurface *getFocus();
-
- void sendEnter(int surface_x, int surface_y);
- void sendLeave(void);
- void sendMotion(int surface_x, int surface_y);
- void sendButtonDown(uint32_t button);
- void sendButtonUp(uint32_t button);
-
-protected:
-
-private:
-
-};
-
-}
-
-#endif //__DS_WAYLAND_POINTER_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_POINTER_PRIVATE_H__
-#define __DS_WAYLAND_POINTER_PRIVATE_H__
-
-#include "dswayland-server-wayland.h"
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-
-struct wl_resource;
-
-namespace display_server
-{
-
-class DSWaylandSeat;
-class DSWaylandCompositor;
-class DSWaylandSurface;
-
-class DS_DECL_EXPORT DSWaylandPointerPrivate : public DSObjectPrivate, public DSWaylandServer::wl_pointer
-{
- DS_PIMPL_USE_PUBLIC(DSWaylandPointer);
-public:
- DSWaylandPointerPrivate(DSWaylandSeat *seat, DSWaylandPointer *pointer);
- ~DSWaylandPointerPrivate() override;
-
- void setFocus(DSWaylandSurface *waylandSurface);
- DSWaylandSurface *getFocus();
-
-protected:
- //virtual Resource *pointer_allocate();
- void pointer_bind_resource(Resource *resource) override;
- void pointer_destroy_resource(Resource *resource) override;
- void pointer_set_cursor(Resource *resource, uint32_t serial, struct ::wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) override;
- void pointer_release(Resource *resource) override;
-
- /* APIs must be provided */
- void sendEnter(struct ::wl_resource *wlResource, struct ::wl_resource *surface, int surface_x, int surface_y);
- void sendLeave(struct ::wl_resource *wlResource, struct ::wl_resource *surface);
- void sendMotion(int surface_x, int surface_y);
- void sendButton(uint32_t button, uint32_t state);
- /* APIs don't need to provide */
- /*
- void sendAxis(struct ::wl_resource *resource, uint32_t time, uint32_t axis, wl_fixed_t value);
- void send_frame(struct ::wl_resource *resource);
- void send_axis_source(struct ::wl_resource *resource, uint32_t axis_source);
- void send_axis_stop(struct ::wl_resource *resource, uint32_t time, uint32_t axis);
- void send_axis_discrete(struct ::wl_resource *resource, uint32_t axis, int32_t discrete);
- */
-
-private:
- DSWaylandSeat *__seat;
- DSWaylandCompositor *__compositor;
- DSWaylandSurface *__waylandSurface;
- struct ::wl_resource *__wlPointerResource;
-};
-
-}
-
-#endif //__DS_WAYLAND_POINTER_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandProtocolTrace.h"
-#include "DSWaylandProtocolTracePrivate.h"
-#include "DSWaylandClient.h"
-#include <fcntl.h>
-#include <unistd.h>
-
-namespace display_server
-{
-/*LCOV_EXCL_START*/
-int DSWaylandProtocolTrace::__refCount { 0 };
-std::mutex DSWaylandProtocolTrace::__mutex;
-DSWaylandProtocolTrace* DSWaylandProtocolTrace::__protocolTrace { nullptr };
-
-static FILE *log_fp_ptrace = NULL;
-static struct wl_protocol_logger *ds_wl_protocol_logger;
-static ProtocolTrace_Rule_Checker *rc = nullptr;
-
-static struct
-{
- const char *token_char;
- const int token_length;
- ProtocolTrace_Token token_name;
-} token_table[] =
-{
- {"\0", 1, PROTOCOLTRACE_TOKEN_EOS},
- {"\t", 1, PROTOCOLTRACE_TOKEN_SPACE},
- {" ", 1, PROTOCOLTRACE_TOKEN_SPACE},
- {"!=", 2, PROTOCOLTRACE_TOKEN_NOT_EQ},
- {"&", 1, PROTOCOLTRACE_TOKEN_AND},
- {"&&", 2, PROTOCOLTRACE_TOKEN_AND},
- {"(", 1, PROTOCOLTRACE_TOKEN_L_BR},
- {")", 1, PROTOCOLTRACE_TOKEN_R_BR},
- {"<", 1, PROTOCOLTRACE_TOKEN_LSS_THAN},
- {"<=", 2, PROTOCOLTRACE_TOKEN_LSS_EQ},
- {"<>", 2, PROTOCOLTRACE_TOKEN_NOT_EQ},
- {"=", 1, PROTOCOLTRACE_TOKEN_EQUAL},
- {"==", 2, PROTOCOLTRACE_TOKEN_EQUAL},
- {">", 1, PROTOCOLTRACE_TOKEN_GRT_THAN},
- {">=", 2, PROTOCOLTRACE_TOKEN_GRT_EQ},
- {"and", 3, PROTOCOLTRACE_TOKEN_AND},
- {"or", 2, PROTOCOLTRACE_TOKEN_OR},
- {"|", 1, PROTOCOLTRACE_TOKEN_OR},
- {"||", 2, PROTOCOLTRACE_TOKEN_OR},
-};
-
-const char *get_next_argument(const char *signature, struct argument_details *details)
-{
- details->nullable = 0;
- for(; *signature; ++signature)
- {
- switch(*signature)
- {
- case 'i':
- case 'u':
- case 'f':
- case 's':
- case 'o':
- case 'n':
- case 'a':
- case 'h':
- details->type = *signature;
- return signature +1;
- case '?':
- details->nullable = 1;
- }
- }
- details->type = '\0';
- return signature;
-}
-
-DSWaylandProtocolTrace::DSWaylandProtocolTrace(DSObject *parent)
- : DS_INIT_PRIVATE_PTR(DSWaylandProtocolTrace)
-{
-}
-
-DSWaylandProtocolTrace::~DSWaylandProtocolTrace()
-{
- DSWaylandCompositor::releaseInstance();
-}
-
-DSWaylandProtocolTrace *DSWaylandProtocolTrace::getInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- if(!__protocolTrace && (__refCount == 0))
- {
- __protocolTrace = new DSWaylandProtocolTrace(new DSObject);
- DSLOG_INF("DSWaylandProtocolTrace", "DSWaylandProtocolTrace instance has been created !");
- }
-
- ++__refCount;
- return __protocolTrace;
-}
-
-void DSWaylandProtocolTrace::releaseInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- --__refCount;
- if(__refCount < 0)
- __refCount = 0;
-
- if((0==__refCount) && __protocolTrace)
- {
- delete __protocolTrace;
- __protocolTrace = nullptr;
- DSLOG_INF("DSWaylandProtocolTrace", "DSWaylandProtocolTrace instance has been removed !");
- }
-}
-
-bool DSWaylandProtocolTrace::init(void)
-{
- DS_GET_PRIV(DSWaylandProtocolTrace);
- bool ret = false;
- char *env_path = nullptr;
-
- rc = priv->rulechecker_init();
-
- // set rule file path
- env_path = getenv("E_INFO_RULE_FILE");
- DSLOG_DBG("DSWaylandProtocolTrace", "==================================================== rule file path = %s", env_path);
- ret = priv->protocol_rule_init(env_path);
- DSLOG_DBG("DSWaylandProtocolTrace", "result of protocol rule init = %d", ret);
-
- if(env_path)
- {
- char *tmp = strdup(env_path);
- if(!tmp) return false;
- free(tmp);
- env_path = nullptr;
- }
- if(!ret) return ret;
-
- // set trace file path
- DSLOG_DBG("DSWaylandProtocolTrace", "========================================================================================================");
- env_path = getenv("E_INFO_TRACE_FILE");
- DSLOG_DBG("DSWaylandProtocolTrace", "==================================================== trace file path = %s", env_path);
- ret = priv->protocol_trace_init(env_path);
- DSLOG_DBG("DSWaylandProtocolTrace", "result of protocol trace init = %d", ret);
-
- if(env_path)
- {
- char *tmp = strdup(env_path);
- if(!tmp) return false;
- free(tmp);
- env_path = nullptr;
- }
- return ret;
-}
-
-int DSWaylandProtocolTrace::enableProtocolTrace(bool state)
-{
- DS_GET_PRIV(DSWaylandProtocolTrace);
- //following state : enable, disable trace
- DSLOG_DBG("DSWaylandProtocolTrace", "state = %d", state);
-
- if(log_fp_ptrace != nullptr)
- {
- fclose(log_fp_ptrace);
- log_fp_ptrace = nullptr;
- }
-
- if(state)
- {
- //TODO: can change trace file path by cmd
- DSLOG_DBG("DSWaylandProtocolTrace", "state true == %d", state);
- priv->protocol_trace_set();
- return 1;
- }
- else
- {
- DSLOG_DBG("DSWaylandProtocolTrace", "state false == %d", state);
- priv->protocol_trace_unset();
- return 0;
- }
-
- return -1;
-}
-
-
-bool DSWaylandProtocolTrace::updateProtocolRule(const int argc, const char **argv)
-{
- DS_GET_PRIV(DSWaylandProtocolTrace);
- DSLOG_DBG("DSWaylandProtocolTrace", "argc = %d, argv[0] = %s, argv[1] = %s", argc, argv[0], argv[1]);
-
- bool ret = false;
- ret = priv->protocol_rule_set(argc, argv);
-
- return ret;
-}
-
-DSWaylandProtocolTracePrivate::DSWaylandProtocolTracePrivate(DSWaylandProtocolTrace *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr)
-{
- __wlCompositor = DSWaylandCompositor::getInstance();
-}
-
-DSWaylandProtocolTracePrivate::~DSWaylandProtocolTracePrivate()
-{
-
-}
-
-bool DSWaylandProtocolTracePrivate::protocol_rule_init(char *rule_path)
-{
- bool ret = false;
- const char *argv[2];
- int argc = 2;
-
- if(!rule_path || strlen(rule_path) <= 0)
- {
- DSLOG_ERR("DSWaylandProtocolTracePrivate", "rule path is null");
- return false;
- }
-
- argv[0] = "file";
- argv[1] = rule_path;
-
- DSLOG_DBG("DSWaylandProtocolTracePriv", "rule_path = %s", rule_path);
-
- ret = protocol_rule_set(argc, (const char**)&(argv[0]));
-
- return ret;
-}
-
-bool DSWaylandProtocolTracePrivate::protocol_trace_init(char *trace_path)
-{
- DSLOG_DBG("DSWaylandProtocolTracePriv", "IN >> protocol_trace_init");
- if(!trace_path || strlen(trace_path) <= 0)
- {
- DSLOG_ERR("DSWaylandProtocolTracePrivate", "trace path is null");
- return false;
- }
-
- trace_env_path = trace_path;
- DSLOG_DBG("DSWaylandProtocolTracePriv", "saved trace path = %s", trace_env_path);
-
- //enable
- protocol_trace_unset();
- DSLOG_DBG("DSWaylandProtocolTracePriv", "OUT << protocol_trace_init");
- /*
- log_fp_ptrace = fopen(trace_path, "a");
-
- setvbuf(log_fp_ptrace, NULL, _IOLBF, 512);
-
- if(ds_wl_protocol_logger)
- {
- wl_protocol_logger_destroy(ds_wl_protocol_logger);
- ds_wl_protocol_logger = NULL;
- }
- ::wl_display *display;
- display = __wlCompositor->display();
- ds_wl_protocol_logger = wl_display_add_protocol_logger(display, protocol_trace_func, nullptr);
- */
- return true;
-}
-
-int DSWaylandProtocolTracePrivate::chk(const char *str)
-{
- char *endptr;
- int index = strtol(str, &endptr, 10);
- if(errno == ERANGE)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Rule remove fail : overflow");
- return -1;
- }
- if(errno != 0)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Rule remove fail : other error");
- return -1;
- }
- if(endptr == 0)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Rule remove fail : non-numeric");
- return -1;
- }
- if(*endptr != '\0')
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Rule remove fail : non-numeric at end");
- return -1;
- }
- if(isspace(*str))
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Rule remove fail : space at beginning");
- return -1;
- }
- return index;
-}
-
-bool DSWaylandProtocolTracePrivate::protocol_rule_set(const int argc, const char **argv)
-{
- DSLOG_DBG("DSWaylandProtocolTracePriv", "IN >> protocol_rule_set");
- DSLOG_DBG("DSWaylandProtocolTracePriv", "(parameter) argc = %d, argv[0] = %s", argc, argv[0]);
- const char * command;
-
- if(argc == 0)
- {
- rulechecker_rule_print(rc);
- return true;
- }
-
- command = argv[0];
-
- if(!strcasecmp(command, "add"))
- {
- DSLOG_DBG("DSWaylandProtocolTracePriv", "ADD");
- ProtocolTrace_Policy_Type policy_type;
- ProtocolTrace_Rule_Set_Result result;
- const char * policy = argv[1]; //allow, deny
- char merge[8192] = {0,}, rule[8192] = {0,};
- int i, index=0, size_rule, apply = 0, size_merge;
-
- if(argc <3)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Error: Too few argumens.");
- //REPLY("Error : Too few arguments.");
- return false;
- }
-
- if(!strcasecmp(policy, "ALLOW"))
- policy_type = PROTOCOLTRACE_TYPE_ALLOW;
- else if(!strcasecmp(policy, "DENY"))
- policy_type = PROTOCOLTRACE_TYPE_DENY;
- else
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Error : Unknown policy : [%s].\n Policy should be ALLOW or DENY.", policy);
- //REPLY;
- return false;
- }
-
- // protocol arguments merge
- protocol_arguments_merge(merge, sizeof(merge), argc -2, &(argv[2]));
-
- size_rule = sizeof(rule) -1;
- size_merge = strlen(merge);
-
- for(i=0; i<size_merge; i++)
- {
- if(merge[i] == '\"' || merge[i] == '\'')
- {
- rule[index++] = ' ';
- if(index > size_rule)
- return false;
- continue;
- }
- if(merge[i] == '+')
- {
- rule[index++] = ' ';
- if(index > size_rule)
- return false;
- if(apply ==0)
- {
- const char * plus = "|| type=reply || type=error";
- int size_plus = strlen(plus);
- int len = MIN(size_rule - index, size_plus);
- snprintf(rule, sizeof(rule), "%s", plus);
- index += len;
- if(index >size_rule)
- return false;
- apply =1;
- }
- continue;
- }
- rule[index++] = merge[i];
- if(index >size_rule)
- return false;
- }
- DSLOG_DBG("DSWaylandProtocolTracePriv", "ADD :: rule = %s", rule);
-
- result = rulechecker_rule_add(rc, policy_type, rule);
-
- if(result == PROTOCOLTRACE_RULE_SET_ERR_TOO_MANY_RULES)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Error: Too many rules were added.");
- return false;
- }
- else if(result == PROTOCOLTRACE_RULE_SET_ERR_PARSE)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Error: An error occurred during parsing the rule [%s]", rule);
- return false;
- }
- DSLOG_INF("DSWaylandProtocolTracePriv", "The rule was successfully added");
- rulechecker_rule_print(rc);
-
- return true;
- }
- else if(!strcasecmp(command, "remove"))
- {
- DSLOG_DBG("DSWaylandProtocolTracePriv", "REMOVE");
- const char * remove_idx;
- int i;
-
- if(argc < 2)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Error: Too few arguments");
- return false;
- }
-
- for(i =0; i<argc -1; i++)
- {
- remove_idx = argv[i+1];
- if(!strcasecmp(remove_idx, "all"))
- {
- DSLOG_DBG("DSWaylandProtocolTracePriv", "REMOVE :: all");
- rulechecker_destroy(rc);
- rc = rulechecker_init();
- if(!rc)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Error: rules not removed");
- return false;
- }
- DSLOG_INF("DSWaylandProtocolTracePriv", "Every rules were successfully removed");
- }
- else
- {
- int index = chk(remove_idx);
- if(index == -1)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Rule remove fail : overflow");
- }
- else
- {
- DSLOG_DBG("DSWaylandProtocolTracePriv", "REMOVE :: remove idx = %d", index);
-
- if(isdigit(*remove_idx) && rulechecker_rule_remove(rc, index) == 0)
- DSLOG_INF("DSWaylandProtocolTracePriv", "The rule [%d] was successfully removed.", index);
- else
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Rule remove fail : No such rule [%s]", remove_idx);
- }
- }
- }
- rulechecker_rule_print(rc);
-
- return true;
- }
- else if(!strcasecmp(command, "file"))
- {
- DSLOG_DBG("DSWaylandProtocolTracePriv", "FILE");
- if(argc <2)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Error: Too few argumens.");
- //REPLY("Error : Too few arguments.");
- return false;
- }
- if(!protocol_rule_file_set(argv[1]))
- return false;
-
- rulechecker_rule_print(rc);
-
- return true;
- }
- else if(!strcasecmp(command, "print"))
- {
- rulechecker_rule_print(rc);
- return true;
- }
- else if(!strcasecmp(command, "help"))
- {
- DSLOG_INF("DSWaylandProtocolTracePriv", "%s", rulechecker_usage_print());
- return true;
- }
-
- DSLOG_ERR("DSWaylandProtocolTracePriv", "%s\nUnknown command : [%s] ", rulechecker_usage_print(), command);
-
- DSLOG_DBG("DSWaylandProtocolTracePriv", "OUT << protocol_rule_set");
-
- return true;
-}
-
-bool DSWaylandProtocolTracePrivate::protocol_rule_file_set(const char *filename)
-{
- DSLOG_DBG("DSWaylandProtocolTracePriv", "IN >> protocol_rule_file_set");
- int fd = -1, rule_len;
- char fs[8096], *pfs;
-
- fd = open(filename, O_RDONLY);
- if(fd<0)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "failed: open '%s'", filename);
- return false;
- }
-
- rule_len = read(fd, fs, sizeof(fs));
- pfs = fs;
-
- while(pfs -fs < rule_len)
- {
- int i, new_argc =3;
- const char *new_argv[3] = {"add", };
- char policy[64] = {0,};
- char rule[1024] = {0,};
-
- if(pfs[0] == ' ' || pfs[0] == '\n')
- {
- pfs++;
- continue;
- }
- for(i=0; pfs[i] != ' '; i++)
- policy[i] = pfs[i];
-
- new_argv[1] = policy;
- pfs += (strlen(new_argv[1])+1);
-
- memset(rule, 0, sizeof(rule));
- for(i=0; pfs[i]!='\n'; i++)
- rule[i] = pfs[i];
-
- new_argv[2] = rule;
-
- pfs += (strlen(new_argv[2]) +1);
-
- if(!protocol_rule_set((const int) new_argc, (const char**) new_argv))
- {
- close(fd);
- return false;
- }
- }
- close(fd);
-
- DSLOG_DBG("DSWaylandProtocolTracePriv", "OUT << protocol_rule_file_set");
- return true;
-}
-
-bool DSWaylandProtocolTracePrivate::protocol_rule_validate(ProtocolTrace_Protocol_Log *log)
-{
- const char *cmd = "";
-
- if(!rc)
- return false;
-
- cmd = protocol_cmd_get(log->cmd);
-
- return rulechecker_rule_validate(rc, log->type, log->target_id, log->name, log->client_pid, cmd);
-}
-
-void DSWaylandProtocolTracePrivate::wl_client_proc_name_get(pid_t pid, char *name, int size)
- {
- if(!name) return;
-
- FILE *h;
- char proc[512], pname[512];
- size_t len;
-
- snprintf(proc, 512, "/proc/%d/cmdline", pid);
-
- h = fopen(proc, "r");
- if(!h) return;
-
- len = fread(pname, sizeof(char), 512, h);
- if(len >0)
- pname[len-1]='\0';
- else
- {
- strncpy(pname, "NO NAME", sizeof(pname));
- }
- fclose(h);
-
- strncpy(name, pname, size);
-}
-
-void DSWaylandProtocolTracePrivate::protocol_trace_set(void)
-{
- DSLOG_DBG("DSWaylandProtocolTracePriv","IN >> protocol trace set");
- log_fp_ptrace = fopen(trace_env_path, "a");
- if(!log_fp_ptrace)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv","failed open file(%s)", trace_env_path);
- return;
- }
- setvbuf(log_fp_ptrace, NULL, _IOLBF, 512);
- DSLOG_DBG("DSWaylandProtocolTracePriv","has log_fp_ptrace");
-
- if(ds_wl_protocol_logger)
- {
- DSLOG_DBG("DSWaylandProtocolTracePriv","if has ds_wl_protocol_logger -> destroy");
- wl_protocol_logger_destroy(ds_wl_protocol_logger);
- ds_wl_protocol_logger = NULL;
- }
- ::wl_display *display;
- display = __wlCompositor->display();
- DSLOG_DBG("DSWaylandProtocolTracePriv","get display ");
-
- //check working
- ds_wl_protocol_logger = wl_display_add_protocol_logger(display, protocol_trace_func, __wlCompositor);
- DSLOG_DBG("DSWaylandProtocolTracePriv","OUT << protocol trace set");
-}
-
-void DSWaylandProtocolTracePrivate::protocol_trace_unset(void)
-{
- DSLOG_DBG("DSWaylandProtocolTracePriv","IN >> protocol_trace_unset");
- if(ds_wl_protocol_logger)
- {
- wl_protocol_logger_destroy(ds_wl_protocol_logger);
- ds_wl_protocol_logger = NULL;
- }
- DSLOG_DBG("DSWaylandProtocolTracePriv","OUT << protocol_trace_unset");
-}
-
-void DSWaylandProtocolTracePrivate::wl_protocol_cb_client_destroy(struct wl_listener *listener, void *data)
-{
- struct wl_client *wc = (struct wl_client *)data;
- struct timespec tp;
- unsigned int time;
- pid_t client_pid =-1;
-
-
- char strbuf[512], *str_buff = strbuf;
- int str_r, str_l;
-
- str_buff[0] = '\0';
- str_r = sizeof(strbuf);
-
- wl_client_get_credentials(wc, &client_pid, nullptr, nullptr);
-
- clock_gettime(CLOCK_MONOTONIC, &tp);
- time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
-
- //TODO: get client name
- BUF_SNPRINTF("[%10.3f] Server [PID:%d] client destroying", time/1000.0, client_pid);
-
- if(log_fp_ptrace)
- fprintf(log_fp_ptrace, "%s\n", strbuf);
- else
- DSLOG_INF("DSWaylandProtocolTracePriv", "%s", strbuf);
-
- wl_list_remove(&listener->link);
- free(listener);
- listener = nullptr;
-}
-
-void DSWaylandProtocolTracePrivate::protocol_client_destroy_listener_reg(struct wl_client *client)
-{
- struct wl_listener *destroy_listener;
-
- destroy_listener = wl_client_get_destroy_listener(client, wl_protocol_cb_client_destroy);
- if(destroy_listener) {
- return;
- }
-
- destroy_listener = (struct wl_listener *)calloc(1, sizeof(wl_listener));
- //EINA_SAFETY_ON_NULL_RETURN(destroy_listener);
- if(!destroy_listener)
- return;
-
- destroy_listener->notify = wl_protocol_cb_client_destroy;
- wl_client_add_destroy_listener(client, destroy_listener);
-}
-
-void DSWaylandProtocolTracePrivate::protocol_trace_func(void *user_data, enum wl_protocol_logger_type direction, const struct wl_protocol_logger_message *message)
-{
- int i;
- struct argument_details arg;
- struct wl_client *wc = wl_resource_get_client(message->resource);
- const char *signature = message->message->signature;
- pid_t client_pid = -1;
- struct timespec tp;
- unsigned int time;
-
- char strbuf[512], *str_buff = strbuf;
- int str_r, str_l;
-
- str_buff[0] = '\0';
- str_r = sizeof(strbuf);
-
- if(wc)
- {
- protocol_client_destroy_listener_reg(wc);
- wl_client_get_credentials(wc, &client_pid, nullptr, nullptr);
- }
-
- clock_gettime(CLOCK_MONOTONIC, &tp);
- time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
-
- ProtocolTrace_Protocol_Log elog = {PROTOCOL_TYPE_REQUEST,};
- elog.type = (direction == WL_PROTOCOL_LOGGER_EVENT)? PROTOCOL_TYPE_EVENT:PROTOCOL_TYPE_REQUEST;
- elog.client_pid = client_pid;
- elog.target_id = wl_resource_get_id(message->resource);
- snprintf(elog.name, PATH_MAX,"%s:%s", wl_resource_get_class(message->resource), message->message->name);
-
- DSWaylandCompositor * comp = (DSWaylandCompositor * )user_data;
- std::list<DSWaylandClient *> clients = comp->clients();
- for(auto client : clients)
- {
- char name[512];
- wl_client_proc_name_get(client->pid(), name, sizeof(name));
- if(client->pid() == client_pid)
- {
- snprintf(elog.cmd, PATH_MAX, "%s", name);
- }
- }
-
- if(!protocol_rule_validate(&elog)) return;
-
- BUF_SNPRINTF("[%10.3f] %s%d%s%s@%u.%s(",
- time / 1000.0,
- elog.type ? "Server->Client [PID:" : "Server<-Client [PID:",
- client_pid, "]",
- wl_resource_get_class(message->resource),
- wl_resource_get_id(message->resource),
- message->message->name);
-
- for (i=0; i<message->arguments_count; i++)
- {
- signature = get_next_argument(signature, &arg);
- if(i>0) BUF_SNPRINTF(", ");
-
- switch(arg.type)
- {
- case 'u':
- BUF_SNPRINTF("%u", message->arguments[i].u);
- break;
- case 'i':
- BUF_SNPRINTF("%i", message->arguments[i].i);
- break;
- case 'f':
- BUF_SNPRINTF("%f", wl_fixed_to_double(message->arguments[i].f));
- break;
- case 's':
- BUF_SNPRINTF("\"%s\"", message->arguments[i].s);
- break;
- case 'o':
- if(message->arguments[i].o)
- BUF_SNPRINTF("%s@%u", wl_resource_get_class((struct wl_resource*)message->arguments[i].o),
- wl_resource_get_id((struct wl_resource*)message->arguments[i].o));
- else
- BUF_SNPRINTF("nil");
- break;
- case 'n':
- BUF_SNPRINTF("new id %s@", (message->message->types[i]) ? message->message->types[i]->name : "[unknown]");
- if(message->arguments[i].n != 0)
- BUF_SNPRINTF("%u", message->arguments[i].n);
- else
- BUF_SNPRINTF("nil");
- break;
- case 'a':
- BUF_SNPRINTF("array");
- break;
- case 'h':
- BUF_SNPRINTF("fd %d", message->arguments[i].h);
- break;
- }
- }
-
- BUF_SNPRINTF("), cmd: %s", elog.cmd ? elog.cmd : "cmd is NULL");
-
- if(log_fp_ptrace)
- fprintf(log_fp_ptrace, "%s\n", strbuf);
- else
- DSLOG_INF("DSWaylandProtocolTracePriv","%s", strbuf);
-}
-
-ProtocolTrace_Tree_Node *DSWaylandProtocolTracePrivate::bintree_create_node(ProtocolTrace_Tree *tree)
-{
- ProtocolTrace_Tree_Node *node = (ProtocolTrace_Tree_Node*) calloc(1, sizeof(ProtocolTrace_Tree_Node) + tree->size);
- // enia safety
- if(!node)
- return nullptr;
-
- node->left = nullptr;
- node->right = nullptr;
-
- return node;
-}
-
-ProtocolTrace_Tree *DSWaylandProtocolTracePrivate::bintree_create_tree(int size)
-{
- ProtocolTrace_Tree *tree = (ProtocolTrace_Tree *)calloc(1, sizeof(ProtocolTrace_Tree) + size);
- // eina safety
- if(!tree)
- return nullptr;
-
- tree->size = size;
- tree->head = nullptr;
- return tree;
-}
-
-void DSWaylandProtocolTracePrivate::bintree_destroy_tree(ProtocolTrace_Tree *tree)
-{
- if(tree->head)
- bintree_remove_node_recursive(tree->head);
- free(tree);
-}
-
-ProtocolTrace_Tree_Node *DSWaylandProtocolTracePrivate::bintree_get_head(ProtocolTrace_Tree *tree)
-{
- return tree->head;
-}
-
-ProtocolTrace_Tree_Node *DSWaylandProtocolTracePrivate::bintree_get_left_child(ProtocolTrace_Tree_Node *node)
-{
- return node->left;
-}
-
-void *DSWaylandProtocolTracePrivate::bintree_get_node_data(ProtocolTrace_Tree_Node *node)
-{
- return (void*)(node+1);
-}
-
-ProtocolTrace_Tree_Node *DSWaylandProtocolTracePrivate::bintree_get_right_child(ProtocolTrace_Tree_Node *node)
-{
- return node->right;
-}
-
-void DSWaylandProtocolTracePrivate::bintree_inorder_traverse(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Traverse_Cb func, void *arg)
-{
- if(tree->head)
- bintree_inorder_traverse_recursive(tree, tree->head, tree->head, func, arg);
-}
-
-int DSWaylandProtocolTracePrivate::bintree_inorder_traverse_recursive(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, ProtocolTrace_Tree_Traverse_Cb func, void *arg)
-{
- if(node->left)
- if(bintree_inorder_traverse_recursive(tree, node->left, node, func, arg)!=0)
- return 1;
-
- if(func(tree, node, parent, arg))
- return 1;
-
- if(node->right)
- if(bintree_inorder_traverse_recursive(tree,node->right, node, func, arg)!=0)
- return 1;
- return 0;
-}
-
-void DSWaylandProtocolTracePrivate::bintree_postorder_traverse(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Traverse_Cb func, void *arg)
-{
- if(tree->head)
- bintree_postorder_traverse_recursive(tree, tree->head, tree->head, func, arg);
-}
-
-int DSWaylandProtocolTracePrivate::bintree_postorder_traverse_recursive(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, ProtocolTrace_Tree_Traverse_Cb func, void *arg)
-{
- if(node->left)
- if(bintree_postorder_traverse_recursive(tree, node->left, node, func, arg)!=0)
- return 1;
- if(node->right)
- if(bintree_postorder_traverse_recursive(tree, node->right, node, func, arg)!=0)
- return 1;
-
- return func(tree, node,parent, arg);
-}
-
-void DSWaylandProtocolTracePrivate::bintree_remove_node(ProtocolTrace_Tree_Node *node)
-{
- free(node);
-}
-
-void DSWaylandProtocolTracePrivate::bintree_remove_node_recursive(ProtocolTrace_Tree_Node *node)
-{
- if(node->left)
- bintree_remove_node_recursive(node->left);
- if(node->right)
- bintree_remove_node_recursive(node->right);
-
- bintree_remove_node(node);
-}
-
-void DSWaylandProtocolTracePrivate::bintree_set_head(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *head)
-{
- tree->head = head;
-}
-
-void DSWaylandProtocolTracePrivate::bintree_set_left_child(ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *child)
-{
- node->left = child;
-}
-
-void DSWaylandProtocolTracePrivate::bintree_set_right_child(ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *child)
-{
- node->right = child;
-}
-
-ProtocolTrace_Token DSWaylandProtocolTracePrivate::parser_next_token_get(const char **string)
-{
- static int token_cnt = sizeof(token_table) / sizeof(token_table[0]);
- int i, compare_res, found =0, first, last;
-
- first = 0;
- last = token_cnt -1;
-
- i = (first + last) /2;
- while(1)
- {
- compare_res = strncmp(*string, token_table[i].token_char, token_table[i].token_length);
- while(compare_res == 0)
- {
- found = 1;
- i++;
- if(i==token_cnt)
- break;
- compare_res = strncmp(*string, token_table[i].token_char, token_table[i].token_length);
- }
-
- if(found)
- {
- i--;
- *string += token_table[i].token_length;
- return token_table[i].token_name;
- }
-
- if(first >= last)
- break;
-
- if(compare_res > 0)
- first = i+1;
- else
- last = i-1;
-
- i = (first + last) /2;
-
- }
- if(isalpha(**string))
- {
- (*string)++;
- while(isalpha(**string) || isdigit(**string) || **string == '_' || **string == '-')
- {
- (*string)++;
- }
-
- return PROTOCOLTRACE_TOKEN_SYMBOL;
- }
- if(isdigit(**string))
- {
- (*string)++;
- while(isdigit(**string))
- (*string)++;
-
- return PROTOCOLTRACE_TOKEN_NUMBER;
- }
- return PROTOCOLTRACE_TOKEN_UNKNOWN;
-}
-
-ProtocolTrace_Tree *DSWaylandProtocolTracePrivate::protocol_parser_rule_string_parse(const char *string)
-{
- ProtocolTrace_Tree *tree;
- ProtocolTrace_Tree_Node *node;
- ProtocolTrace_Token_Data token;
-
- token.string = &string;
- parser_token_process(&token);
-
- tree = bintree_create_tree(sizeof(ProtocolTrace_Rule_Node));
- if(!tree) return nullptr;
-
- node = parser_token_parse(tree, &token);
-
- if(!node)
- {
- bintree_destroy_tree(tree);
- DSLOG_DBG("DSWaylandProtocolTracePriv", "finish destroy tree & return null");
- return nullptr;
- }
-
- bintree_set_head(tree, node);
-
- return tree;
-}
-
-ProtocolTrace_Tree_Node *DSWaylandProtocolTracePrivate::parser_statement_parse(ProtocolTrace_Tree *tree, ProtocolTrace_Token_Data *token)
-{
- ProtocolTrace_Tree_Node *node = nullptr;
- ProtocolTrace_Rule_Node *data;
-
- if(token->last_token == PROTOCOLTRACE_TOKEN_L_BR)
- {
- parser_token_process(token);
-
- node = parser_token_parse(tree, token);
- if(!node)
- return nullptr;
-
- if(token->last_token != PROTOCOLTRACE_TOKEN_R_BR)
- goto fail;
-
- parser_token_process(token);
-
- return node;
- }
-
- if(token->last_token != PROTOCOLTRACE_TOKEN_SYMBOL)
- goto fail;
-
- node = bintree_create_node(tree);
- //eina safety
-
- data = (ProtocolTrace_Rule_Node *) bintree_get_node_data(node);
-
- strncpy(data->variable_name, token->last_symbol, token->symbol_len);
- data->variable_name[token->symbol_len] = '\0';
-
- if(!strcasecmp(data->variable_name, "all"))
- {
- DSLOG_DBG("DSWaylandProtocolTracePriv", "data = all");
- data->node_type = PROTOCOLTRACE_NODE_TYPE_ALL;
- parser_token_process(token);
-
- return node;
- }
-
- data->node_type = PROTOCOLTRACE_NODE_TYPE_DATA;
-
- parser_token_process(token);
-
- switch(token->last_token)
- {
- case PROTOCOLTRACE_TOKEN_NOT_EQ:
- data->comparer = PROTOCOLTRACE_COMPARER_NOT_EQ;
- break;
- case PROTOCOLTRACE_TOKEN_EQUAL:
- data->comparer = PROTOCOLTRACE_COMPARER_EQUAL;
- break;
- case PROTOCOLTRACE_TOKEN_LSS_THAN:
- data->comparer = PROTOCOLTRACE_COMPARER_LESS_EQ;
- break;
- case PROTOCOLTRACE_TOKEN_GRT_THAN:
- data->comparer = PROTOCOLTRACE_COMPARER_GREATER;
- break;
- case PROTOCOLTRACE_TOKEN_GRT_EQ:
- data->comparer = PROTOCOLTRACE_COMPARER_GREATE_EQ;
- break;
- default:
- goto fail;
- }
-
- parser_token_process(token);
-
- if(token->last_token == PROTOCOLTRACE_TOKEN_NUMBER)
- {
- data->value_type = PROTOCOLTRACE_DATA_TYPE_INTEGER;
- data->value.integer = atoi(token->last_symbol);
- }
- else if (token->last_token == PROTOCOLTRACE_TOKEN_SYMBOL)
- {
- data->value_type = PROTOCOLTRACE_DATA_TYPE_STRING;
- strncpy(data->value.string, token->last_symbol, token->symbol_len);
- data->value.string[token->symbol_len] = '\0';
- }
- else
- {
- goto fail;
- }
-
- parser_token_process(token);
-
- return node;
-
- fail:
- if(node)
- bintree_remove_node_recursive(node);
- return nullptr;
-}
-
-ProtocolTrace_Tree_Node *DSWaylandProtocolTracePrivate::parser_token_parse(ProtocolTrace_Tree *tree, ProtocolTrace_Token_Data *token)
-{
-
- ProtocolTrace_Tree_Node *node, *left = nullptr, *right = nullptr;
- ProtocolTrace_Rule_Node *data;
-
- node = parser_statement_parse(tree,token);
-
- if(!node)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "PARSE statement error\n");
- goto fail;
- }
-
- while(token->last_token == PROTOCOLTRACE_TOKEN_AND)
- {
- left = node;
- node = nullptr;
-
- parser_token_process(token);
-
- right = parser_statement_parse(tree, token);
- if(!right)
- goto fail;
-
- node = bintree_create_node(tree);
- // eina safety
-
- data = (ProtocolTrace_Rule_Node *) bintree_get_node_data(node);
- data->node_type = PROTOCOLTRACE_NODE_TYPE_AND;
- bintree_set_left_child(node, left);
- bintree_set_right_child(node, right);
- }
-
- if(token->last_token == PROTOCOLTRACE_TOKEN_OR)
- {
- left = node;
- node = nullptr;
-
- parser_token_process(token);
-
- right = parser_token_parse(tree, token);
- if(!right)
- goto fail;
-
- node = bintree_create_node(tree);
- //eina safety
-
- data = (ProtocolTrace_Rule_Node *) bintree_get_node_data(node);
- data->node_type = PROTOCOLTRACE_NODE_TYPE_OR;
- bintree_set_left_child(node, left);
- bintree_set_right_child(node, right);
- }
- return node;
-
- fail:
- DSLOG_DBG("DSWaylandProtocolTracePriv", "[fail] recursive remove node");
- if(left)
- bintree_remove_node_recursive(left);
- return nullptr;
-}
-
-void DSWaylandProtocolTracePrivate::parser_token_process(ProtocolTrace_Token_Data *token)
-{
- do
- {
- token->last_symbol = *(token->string);
- token->last_token = parser_next_token_get(token->string);
- token->symbol_len = *(token->string) - token->last_symbol;
- } while (token->last_token == PROTOCOLTRACE_TOKEN_SPACE);
-}
-
-void DSWaylandProtocolTracePrivate::protocol_arguments_merge(char *target, int target_size, int argc, const char **argv)
-{
- int i, len;
-
- for(i=0; i<argc; i++)
- {
- len = snprintf(target, target_size, "%s", argv[i]);
- target += len;
- target_size -= len;
-
- if(i!=argc-1)
- {
- *(target++) = ' ';
- target_size--;
- }
- }
-}
-
-char * DSWaylandProtocolTracePrivate::protocol_cmd_get(char *path)
-{
- char *p;
- if(!path) return nullptr;
-
- p = strrchr(path, '/');
-
- return (p)?p+1:path;
-}
-
-void DSWaylandProtocolTracePrivate::rulechecker_destroy(ProtocolTrace_Rule_Checker *rc)
-{
- int i;
- for(i=rc->count-1; i>=0; i--)
- rulechecker_rule_remove(rc,i);
-
- free(rc);
-}
-
-ProtocolTrace_Rule_Checker *DSWaylandProtocolTracePrivate::rulechecker_init()
-{
- ProtocolTrace_Rule_Checker *rc = (ProtocolTrace_Rule_Checker *) calloc(1, sizeof(ProtocolTrace_Rule_Checker));
- if (!rc)
- return nullptr;
-
- rc->count = 0;
-
- return rc;
-}
-
-int DSWaylandProtocolTracePrivate::rulechecker_int_compare(ProtocolTrace_Comparer comparer, int int2, int int1)
-{
- switch (comparer)
- {
- case PROTOCOLTRACE_COMPARER_EQUAL:
- return int1 == int2;
- case PROTOCOLTRACE_COMPARER_LESS:
- return int1 < int2;
- case PROTOCOLTRACE_COMPARER_GREATER:
- return int1 > int2;
- case PROTOCOLTRACE_COMPARER_LESS_EQ:
- return int1 <= int2;
- case PROTOCOLTRACE_COMPARER_GREATE_EQ:
- return int1 >= int2;
- case PROTOCOLTRACE_COMPARER_NOT_EQ:
- return int1 != int2;
- }
- return 0;
-}
-
-ProtocolTrace_Rule_Set_Result DSWaylandProtocolTracePrivate::rulechecker_rule_add(ProtocolTrace_Rule_Checker *rc, ProtocolTrace_Policy_Type policy, const char *rule_string)
-{
- if(rc->count == MAX_RULE)
- return PROTOCOLTRACE_RULE_SET_ERR_TOO_MANY_RULES;
-
- rc->rules[rc->count].tree = protocol_parser_rule_string_parse(rule_string);
- if(!rc->rules[rc->count].tree)
- {
- DSLOG_DBG("DSWaylandProtocolTracePriv", "parse error");
- return PROTOCOLTRACE_RULE_SET_ERR_PARSE;
- }
-
- rc->rules[rc->count].policy = policy;
- rc->count++;
- return PROTOCOLTRACE_RULE_SET_OK;
-}
-
-void DSWaylandProtocolTracePrivate::rulechecker_rule_print(ProtocolTrace_Rule_Checker *rc)
-{
- char tmpReply[4096];
- int tmpLen = sizeof(tmpReply);
- char *reply = tmpReply;
- int *len = &tmpLen;
- ProtocolTrace_Reply_Buffer buffer = {&reply, len};
- int i;
-
- DSLOG_INF("DSWaylandProtocolTracePriv"," --------------------------[ Protocol Filter Rules ]--------------------------\n");
- DSLOG_INF("DSWaylandProtocolTracePriv"," No Policy Rule\n");
- DSLOG_INF("DSWaylandProtocolTracePriv"," -----------------------------------------------------------------------------\n");
-
- for(i =0; i < rc->count; i++)
- {
- DSLOG_INF("DSWaylandProtocolTracePriv"," %3d %10s \"", i, rc->rules[i].policy == PROTOCOLTRACE_TYPE_ALLOW ? "ALLOW" : "DENY");
- bintree_inorder_traverse(rc->rules[i].tree, rule_print_func, (void*) & buffer);
- DSLOG_INF("DSWaylandProtocolTracePriv","\"\n");
-
- }
-}
-
-ProtocolTrace_Rule_Set_Result DSWaylandProtocolTracePrivate::rulechecker_rule_remove(ProtocolTrace_Rule_Checker *rc, int index)
-{
- if(index <0 || index >= rc->count)
- return PROTOCOLTRACE_RULE_SET_ERR_NO_RULE;
-
- bintree_destroy_tree(rc->rules[index].tree);
- rc->count--;
- if(index!=rc->count)
- memmove(&rc->rules[index], &rc->rules[index+1], sizeof(ProtocolTrace_Rule)*(rc->count - index));
-
- return PROTOCOLTRACE_RULE_SET_OK;
-}
-
-int DSWaylandProtocolTracePrivate::rulechecker_rule_validate(ProtocolTrace_Rule_Checker *rc, int type, int target_id, const char *name, int pid, const char *cmd)
-{
- ProtocolTrace_Validate_Args args = {type, target_id, name, pid, cmd};
- ProtocolTrace_Tree_Node *node;
- ProtocolTrace_Rule_Node *data;
- ProtocolTrace_Policy_Type default_policy = PROTOCOLTRACE_TYPE_DENY;
- int i;
-
- for(i=rc->count-1; i>=0; i--)
- {
- bintree_postorder_traverse(rc->rules[i].tree, rule_validate_func, &args);
- node = (ProtocolTrace_Tree_Node *) bintree_get_head(rc->rules[i].tree);
- data = (ProtocolTrace_Rule_Node *) bintree_get_node_data(node);
-
- if(data->result == PROTOCOLTRACE_RESULT_TRUE)
- {
- return rc->rules[i].policy == PROTOCOLTRACE_TYPE_ALLOW;
- }
- }
- return default_policy == PROTOCOLTRACE_TYPE_ALLOW;
-}
-
-int DSWaylandProtocolTracePrivate::rulechecker_string_compare(ProtocolTrace_Comparer comparer, char *str2, const char *str1)
-{
- int result = strcasecmp(str2, str1);
-
- switch (comparer)
- {
- case PROTOCOLTRACE_COMPARER_EQUAL:
- return result == 0;
- case PROTOCOLTRACE_COMPARER_LESS:
- return result < 0;
- case PROTOCOLTRACE_COMPARER_GREATER:
- return result > 0;
- case PROTOCOLTRACE_COMPARER_LESS_EQ:
- return result <= 0;
- case PROTOCOLTRACE_COMPARER_GREATE_EQ:
- return result >= 0;
- case PROTOCOLTRACE_COMPARER_NOT_EQ:
- return result != 0;
- }
- return 0;
-}
-
-const char * DSWaylandProtocolTracePrivate::rulechecker_usage_print()
-{
- return
- "##########################################################\n"
- "### Enlightenment Protocol Log filtering. ###\n"
- "##########################################################\n"
- "\n"
- "-----------------------------------------------------------------\n"
- "How to read enlightenment_info protocol messages :\n"
- "[timestamp] Server --> Client [PID: [pid]] interface@id.message(arguments..) cmd: CMD\n"
- " ex)\n"
- "[1476930.145] Server --> Client [PID: 103] wl_touch@10.down(758, 6769315, wl_surface@23, 0, 408.000, 831.000) cmd: /usr/bin/launchpad-loader\n"
- " ==> type = event && pid = 103 && cmd = launchpad-loader && iface = wl_touch && msg = up\n"
- "[4234234.123] Server <-- Client [PID: 123] wl_seat@32.get_touch(new id wl_touch@22) cmd: /usr/bin/launchpad-loader\n"
- " ==> type = request && pid = 123 && cmd = launchpad-loader && iface = wl_seat && msg = get_touch\n"
- "-----------------------------------------------------------------\n"
- "Usage : enlightenment_info -protocol_rule add [POLICY] [RULE]\n"
- " enlightenment_info -protocol_rule remove [INDEX]\n"
- " enlightenment_info -protocol_rule file [RULE_FILE]\n"
- " enlightenment_info -protocol_rule print\n"
- " enlightenment_info -protocol_rule help\n"
- " [POLICY] : allow / deny \n"
- " [RULE] : C Language-style boolean expression syntax. [VARIABLE] [COMPAROTOR] [VALUE]\n"
- " [VARIABLE] : type / iface / msg / cmd(command) / pid\n"
- " [COMPARATOR] : & / && / and / | / || / or / = / == / != / > / >= / < / <=\n"
- " [VALUE] : string / number \n"
- " ex)\n"
- " enlightenment_info -protocol_rule add allow \"(type=request) && (iface == wl_pointer and (msg = down or msg = up))\"\n"
- " enlightenment_info -protocol_rule add deny cmd!= launch-loader\n"
- " enlightenment_info -protocol_rule remove all\n"
- " enlightenment_info -protocol_rule remove 3\n"
- "\n";
-}
-
-int DSWaylandProtocolTracePrivate::rule_print_func(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg)
-{
- ProtocolTrace_Reply_Buffer *buffer = (ProtocolTrace_Reply_Buffer *)arg;
- char *reply = *buffer->reply;
- //int *len = buffer->len;
- const char *operators[] = {"==", "<", ">", "<=", ">=", "!=" };
- ProtocolTrace_Rule_Node *data;
-
- data = (ProtocolTrace_Rule_Node *)bintree_get_node_data(node);
-
- if(data->node_type == PROTOCOLTRACE_NODE_TYPE_ALL)
- DSLOG_INF("DSWaylandProtocolTracePriv", "------------------------------------------------- ALL");
- else if(data->node_type == PROTOCOLTRACE_NODE_TYPE_AND)
- DSLOG_INF("DSWaylandProtocolTracePriv", "------------------------------------------------- AND");
- else if(data->node_type == PROTOCOLTRACE_NODE_TYPE_OR)
- DSLOG_INF("DSWaylandProtocolTracePriv", "------------------------------------------------- OR");
- else // data->node_type == PROTOCOLTRACE_NODE_TYPE_DATA
- {
- if(node == bintree_get_left_child(parent))
- DSLOG_INF("DSWaylandProtocolTracePriv", "------------------------------------------------- (");
- DSLOG_INF("DSWaylandProtocolTracePriv", "------------------------------------------------- %s %s ", data->variable_name, operators[data->comparer]);
-
- if(data->value_type == PROTOCOLTRACE_DATA_TYPE_INTEGER)
- DSLOG_INF("DSWaylandProtocolTracePriv", "------------------------------------------------- %d", data->value.integer);
- else
- DSLOG_INF("DSWaylandProtocolTracePriv", "------------------------------------------------- %s", data->value.string);
-
- if(node == bintree_get_right_child(parent))
- DSLOG_INF("DSWaylandProtocolTracePriv", "------------------------------------------------- )");
- }
-
- *buffer->reply = reply;
- //DSLOG_DBG("DSWaylandProtocolTracePriv", "buffer->reply = %s", reply);
-
- return 0;
-}
-
-int DSWaylandProtocolTracePrivate::rule_validate_func(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg)
-{
- ProtocolTrace_Validate_Args *args = (ProtocolTrace_Validate_Args *)arg;
- ProtocolTrace_Tree_Node *left, *right;
- ProtocolTrace_Rule_Node *data, *left_data =nullptr, *right_data = nullptr;
-
- data = (ProtocolTrace_Rule_Node *)bintree_get_node_data(node);
- data->result = PROTOCOLTRACE_RESULT_UNKNOWN;
-
- if(data->node_type == PROTOCOLTRACE_NODE_TYPE_AND || data->node_type == PROTOCOLTRACE_NODE_TYPE_OR)
- {
- left = bintree_get_left_child(node);
- right = bintree_get_right_child(node);
- if(!left || !right)
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Node error");
- return -1;
- }
-
- left_data = (ProtocolTrace_Rule_Node *)bintree_get_node_data(left);
- right_data = (ProtocolTrace_Rule_Node *)bintree_get_node_data(right);
- }
-
- if(data->node_type == PROTOCOLTRACE_NODE_TYPE_ALL)
- {
- data->result = PROTOCOLTRACE_RESULT_TRUE;
- }
- else if(data->node_type == PROTOCOLTRACE_NODE_TYPE_DATA)
- {
- char iface[64] = {0,};
- char *msg = nullptr;
-
- if(args->name)
- {
- msg = (char *) strchr(args->name, ':');
- }
- if(msg)
- {
- int size_iface = sizeof(iface) -1;
- int min = MIN(size_iface, msg-args->name);
- strncpy(iface, args->name, min);
- iface[min] = '\0';
- msg++;
- }
- if(!strcasecmp(data->variable_name, "TYPE"))
- {
- const char *type_string;
- if(args->type == 0)
- type_string = "REQUEST";
- else if(args->type == 1)
- type_string = "EVENT";
- else
- {
- DSLOG_ERR("DSWaylandProtocolTracePriv", "Invalid type %d", args->type);
- return -1;
- }
-
- if(rulechecker_string_compare(data->comparer, data->value.string, type_string))
- data->result = PROTOCOLTRACE_RESULT_TRUE;
- else
- data->result = PROTOCOLTRACE_RESULT_FALSE;
- }
- else if(!strcasecmp(data->variable_name, "IFACE"))
- {
- if(msg && iface[0] && rulechecker_string_compare(data->comparer, data->value.string, (const char *)iface))
- data->result = PROTOCOLTRACE_RESULT_TRUE;
- else
- data->result = PROTOCOLTRACE_RESULT_FALSE;
- }
- else if(!strcasecmp(data->variable_name, "MSG"))
- {
- if(msg && rulechecker_string_compare(data->comparer, data->value.string, msg))
- data->result = PROTOCOLTRACE_RESULT_TRUE;
- else
- data->result = PROTOCOLTRACE_RESULT_FALSE;
- }
- else if(!strcasecmp(data->variable_name, "PID"))
- {
- if(rulechecker_int_compare(data->comparer, data->value.integer, args->pid))
- data->result = PROTOCOLTRACE_RESULT_TRUE;
- else
- data->result = PROTOCOLTRACE_RESULT_FALSE;
- }
- else if(!strcasecmp(data->variable_name, "CMD") || !strcasecmp(data->variable_name, "COMMAND"))
- {
- if(msg && rulechecker_string_compare(data->comparer, data->value.string, args->cmd))
- data->result = PROTOCOLTRACE_RESULT_TRUE;
- else
- data->result = PROTOCOLTRACE_RESULT_FALSE;
- }
- }
- else if(data->node_type == PROTOCOLTRACE_NODE_TYPE_AND)
- {
- if(left_data->result == PROTOCOLTRACE_RESULT_TRUE && right_data->result == PROTOCOLTRACE_RESULT_TRUE)
- data->result = PROTOCOLTRACE_RESULT_TRUE;
- else
- data->result = PROTOCOLTRACE_RESULT_FALSE;
- }
- else if(data->node_type == PROTOCOLTRACE_NODE_TYPE_OR)
- {
- if(left_data->result == PROTOCOLTRACE_RESULT_TRUE || right_data->result == PROTOCOLTRACE_RESULT_TRUE)
- data->result = PROTOCOLTRACE_RESULT_TRUE;
- else
- data->result = PROTOCOLTRACE_RESULT_FALSE;
- }
- else
- {
- return -1;
- }
- return 0;
-}
-/*LCOV_EXCL_STOP*/
-} // namespace display_server
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_PROTOCOL_TRACE_H__
-#define __DS_WAYLAND_PROTOCOL_TRACE_H__
-
-#include <DSObject.h>
-#include <DSCore.h>
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-class DSWaylandProtocolTracePrivate;
-
-class DSWaylandProtocolTrace : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandProtocolTrace);
-
-public:
- DSWaylandProtocolTrace(DSObject *parent);
- virtual ~DSWaylandProtocolTrace();
- static DSWaylandProtocolTrace *getInstance();
- static void releaseInstance();
-
- bool init(void);
- int enableProtocolTrace(bool state);
- bool updateProtocolRule(const int argc, const char **argv);
-
-private:
- static std::mutex __mutex;
- static DSWaylandProtocolTrace *__protocolTrace;
- static int __refCount;
-};
-
-}
-
-#endif // __DS_WAYLAND_PROTOCOL_TRACE_H__
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_PROTOCOL_TRACE_PRIVATE_H__
-#define __DS_WAYLAND_PROTOCOL_TRACE_PRIVATE_H__
-
-#include "DSWaylandProtocolTrace.h"
-#include "DSWaylandProtocolTraceStruct.h"
-#include <wayland-server.h>
-#include <wayland-server-core.h>
-#include <wayland-util.h>
-#include <cstring>
-
-
-namespace display_server
-{
-class DSWaylandProtocolTracePrivate : public DSObjectPrivate
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandProtocolTrace);
-
-public:
- DSWaylandProtocolTracePrivate() = delete;
- DSWaylandProtocolTracePrivate(DSWaylandProtocolTrace *p_ptr);
- ~DSWaylandProtocolTracePrivate();
-
-
-protected:
-
- bool protocol_rule_init(char *rule_path);
- bool protocol_trace_init(char *trace_path);
-
- bool protocol_rule_set(const int argc, const char **argv);
- bool protocol_rule_file_set(const char *filename);
- static bool protocol_rule_validate(ProtocolTrace_Protocol_Log *log);
-
- void protocol_trace_set(void);
- void protocol_trace_unset(void);
-
-private:
- DSWaylandCompositor *__wlCompositor;
- char *trace_env_path = nullptr;
-
- static void wl_protocol_cb_client_destroy(struct wl_listener *listener, void *data);
- static void protocol_client_destroy_listener_reg(struct wl_client *client);
- static void protocol_trace_func(void *user_data, enum wl_protocol_logger_type direction, const struct wl_protocol_logger_message *message);
-
- ProtocolTrace_Tree_Node *bintree_create_node(ProtocolTrace_Tree *tree);
- ProtocolTrace_Tree *bintree_create_tree(int size);
- void bintree_destroy_tree(ProtocolTrace_Tree *tree);
- static ProtocolTrace_Tree_Node *bintree_get_head(ProtocolTrace_Tree *tree);
- static ProtocolTrace_Tree_Node *bintree_get_left_child(ProtocolTrace_Tree_Node *node);
- static void * bintree_get_node_data(ProtocolTrace_Tree_Node *node);
- static ProtocolTrace_Tree_Node *bintree_get_right_child(ProtocolTrace_Tree_Node *node);
- void bintree_inorder_traverse(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Traverse_Cb func, void *arg);
- int bintree_inorder_traverse_recursive(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, ProtocolTrace_Tree_Traverse_Cb func, void *arg);
- static void bintree_postorder_traverse(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Traverse_Cb func, void *arg);
- static int bintree_postorder_traverse_recursive(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, ProtocolTrace_Tree_Traverse_Cb func, void *arg);
- void bintree_remove_node(ProtocolTrace_Tree_Node *node);
- void bintree_remove_node_recursive(ProtocolTrace_Tree_Node *node);
- void bintree_set_head(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *head);
- void bintree_set_left_child(ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *child);
- void bintree_set_right_child(ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *child);
- ProtocolTrace_Token parser_next_token_get(const char **string);
- ProtocolTrace_Tree *protocol_parser_rule_string_parse(const char *string);
- ProtocolTrace_Tree_Node *parser_statement_parse(ProtocolTrace_Tree *tree, ProtocolTrace_Token_Data *token);
- ProtocolTrace_Tree_Node *parser_token_parse(ProtocolTrace_Tree *tree, ProtocolTrace_Token_Data *token);
- void parser_token_process(ProtocolTrace_Token_Data *token);
- static void protocol_arguments_merge(char *target, int target_size, int argc, const char **argv);
- static char * protocol_cmd_get(char *path);
- void rulechecker_destroy(ProtocolTrace_Rule_Checker *rc);
- ProtocolTrace_Rule_Checker *rulechecker_init();
- static int rulechecker_int_compare(ProtocolTrace_Comparer comparer, int int2, int int1);
- ProtocolTrace_Rule_Set_Result rulechecker_rule_add(_ProtocolTrace_Rule_Checker *rc, ProtocolTrace_Policy_Type policy, const char *rule_string);
- void rulechecker_rule_print(ProtocolTrace_Rule_Checker *rc);
- ProtocolTrace_Rule_Set_Result rulechecker_rule_remove(ProtocolTrace_Rule_Checker *rc, int index);
- static int rulechecker_rule_validate(ProtocolTrace_Rule_Checker *rc, int type, int target_id, const char *name, int pid, const char *cmd);
- static int rulechecker_string_compare(ProtocolTrace_Comparer comparer, char *str2, const char *str1);
- const char * rulechecker_usage_print();
- static int rule_print_func(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg);
- static int rule_validate_func(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg);
- int chk(const char *str);
- static void wl_client_proc_name_get(pid_t pid, char *name, int size);
-};
-
-}
-
-
-
-#endif // __DS_WAYLAND_PROTOCOL_TRACE_PRIVATE_H__
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_PROTOCOL_TRACE_STRUCT_H__
-#define __DS_WAYLAND_PROTOCOL_TRACE_STRUCT_H__
-
-#define PATH_MAX 512
-#define MAX_RULE 64
-#define STRING_MAX 64
-
-#ifndef MAX
-#define MAX(x, y) (((x) > (y)) ? (x) : (y))
-#endif
-
-#ifndef MIN
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#endif
-
-#define BUF_SNPRINTF(fmt, ARG...) do { \
- str_l = snprintf(str_buff, str_r, fmt, ##ARG); \
- str_buff += str_l; \
- str_r -= str_l; \
-} while(0)
-
-/*
-#ifndef REPLY
- #define REPLY(fmt, ARG...) \
- do { \
- if (reply && len && *len > 0) \
- { \
- int s = snprintf(reply, *len, fmt, ##ARG); \
- reply += s; \
- *len -= s; \
- } \
- } while (0)
-#endif
-*/
-
-namespace display_server
-{
-
-typedef struct _ProtocolTrace_Tree_Node ProtocolTrace_Tree_Node;
-typedef struct _ProtocolTrace_Tree ProtocolTrace_Tree;
-typedef struct _ProtocolTrace_Token_Data ProtocolTrace_Token_Data;
-typedef struct _ProtocolTrace_Rule_Node ProtocolTrace_Rule_Node;
-typedef struct _ProtocolTrace_Rule ProtocolTrace_Rule;
-typedef struct _ProtocolTrace_Rule_Checker ProtocolTrace_Rule_Checker;
-typedef struct _ProtocolTrace_Protocol_Log ProtocolTrace_Protocol_Log;
-
-typedef int (*ProtocolTrace_Tree_Traverse_Cb) (ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg);
-
-struct _ProtocolTrace_Tree_Node
-{
- ProtocolTrace_Tree_Node *left;
- ProtocolTrace_Tree_Node *right;
-};
-
-struct _ProtocolTrace_Tree
-{
- int size;
- ProtocolTrace_Tree_Node *head;
-};
-
-typedef enum
-{
- PROTOCOLTRACE_TOKEN_UNKNOWN = 0,
- PROTOCOLTRACE_TOKEN_L_BR =1,
- PROTOCOLTRACE_TOKEN_R_BR =2,
- PROTOCOLTRACE_TOKEN_NOT_EQ=3,
- PROTOCOLTRACE_TOKEN_EQUAL=4,
- PROTOCOLTRACE_TOKEN_LSS_THAN=5,
- PROTOCOLTRACE_TOKEN_LSS_EQ =6,
- PROTOCOLTRACE_TOKEN_GRT_THAN=7,
- PROTOCOLTRACE_TOKEN_GRT_EQ =8,
- PROTOCOLTRACE_TOKEN_AND=9,
- PROTOCOLTRACE_TOKEN_OR=10,
- PROTOCOLTRACE_TOKEN_SPACE=11,
- PROTOCOLTRACE_TOKEN_SYMBOL=12,
- PROTOCOLTRACE_TOKEN_NUMBER=13,
- PROTOCOLTRACE_TOKEN_EOS=14,
-} ProtocolTrace_Token;
-
-struct _ProtocolTrace_Token_Data
-{
- const char **string;
- ProtocolTrace_Token last_token;
- const char *last_symbol;
- int symbol_len;
-};
-typedef enum
-{
- PROTOCOLTRACE_NODE_TYPE_NONE,
- PROTOCOLTRACE_NODE_TYPE_AND,
- PROTOCOLTRACE_NODE_TYPE_OR,
- PROTOCOLTRACE_NODE_TYPE_DATA,
- PROTOCOLTRACE_NODE_TYPE_ALL
-} ProtocolTrace_Node_Type;
-
-typedef enum
-{
- PROTOCOLTRACE_COMPARER_EQUAL,
- PROTOCOLTRACE_COMPARER_LESS,
- PROTOCOLTRACE_COMPARER_GREATER,
- PROTOCOLTRACE_COMPARER_LESS_EQ,
- PROTOCOLTRACE_COMPARER_GREATE_EQ,
- PROTOCOLTRACE_COMPARER_NOT_EQ
-} ProtocolTrace_Comparer;
-
-typedef enum
-{
- PROTOCOLTRACE_DATA_TYPE_INTEGER,
- PROTOCOLTRACE_DATA_TYPE_STRING
-} ProtocolTrace_Data_Type;
-
-typedef enum
-{
- PROTOCOLTRACE_RESULT_UNKNOWN,
- PROTOCOLTRACE_RESULT_TRUE,
- PROTOCOLTRACE_RESULT_FALSE
-} ProtocolTrace_Result_Type;
-
-struct _ProtocolTrace_Rule_Node
-{
- ProtocolTrace_Node_Type node_type;
- char variable_name[STRING_MAX];
- ProtocolTrace_Comparer comparer;
- ProtocolTrace_Data_Type value_type;
-
- union
- {
- char string[STRING_MAX];
- int integer;
- }value;
-
- ProtocolTrace_Result_Type result;
-};
-
-typedef enum
-{
- PROTOCOLTRACE_POLICY_TYPE_UNDEFINED,
- PROTOCOLTRACE_TYPE_ALLOW,
- PROTOCOLTRACE_TYPE_DENY
-} ProtocolTrace_Policy_Type;
-
-struct _ProtocolTrace_Rule
-{
- ProtocolTrace_Policy_Type policy;
- ProtocolTrace_Tree *tree;
-};
-
-struct _ProtocolTrace_Rule_Checker
-{
- ProtocolTrace_Rule rules[MAX_RULE];
- int count;
-};
-typedef enum
-{
- PROTOCOLTRACE_RULE_SET_OK,
- PROTOCOLTRACE_RULE_SET_ERR_TOO_MANY_RULES,
- PROTOCOLTRACE_RULE_SET_ERR_PARSE,
- PROTOCOLTRACE_RULE_SET_ERR_NO_RULE
- } ProtocolTrace_Rule_Set_Result;
-typedef enum{
- PROTOCOL_TYPE_REQUEST,
- PROTOCOL_TYPE_EVENT
-} ProtocolTrace_Protocol_Type;
-struct _ProtocolTrace_Protocol_Log
-{
- ProtocolTrace_Protocol_Type type;
- int client_pid;
- int target_id;
- char name[PATH_MAX +1];
- char cmd[PATH_MAX +1];
-};
-struct argument_details {
- char type;
- int nullable;
-};
-
-typedef struct
-{
- int type;
- int target_id;
- const char *name;
- int pid;
- const char *cmd;
-} ProtocolTrace_Validate_Args;
-
-typedef struct
-{
- char **reply;
- int *len;
-} ProtocolTrace_Reply_Buffer;
-
-}
-
-
-#endif //__DS_WAYLAND_PROTOCOL_TRACE_STRUCT_H__
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandRegion.h"
-#include "DSWaylandRegionPrivate.h"
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-/* DSWaylandRegionPrivate */
-DSWaylandRegionPrivate::DSWaylandRegionPrivate(DSWaylandRegion *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{}
-
-DSWaylandRegionPrivate::DSWaylandRegionPrivate(DSWaylandRegion *p_ptr, DSWaylandClient *waylandClient, uint32_t id)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{
- if (id > 0)
- {
- init(waylandClient->wlClient(), (int)id, 1);
- }
-}
-
-DSWaylandRegionPrivate::~DSWaylandRegionPrivate()
-{}
-
-void DSWaylandRegionPrivate::region_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandRegionPrivate::region_destroy_resource(Resource *resource)
-{
- DS_GET_PUB(DSWaylandRegion);
-
- DSWaylandCompositor *dswCompositor = DSWaylandCompositor::getInstance();
- if (dswCompositor)
- {
- dswCompositor->regionDestroy(pub);
- }
- DSWaylandCompositor::releaseInstance();
-}
-
-void DSWaylandRegionPrivate::region_destroy(Resource *resource)
-{
-}
-
-void DSWaylandRegionPrivate::region_add(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
-}
-
-void DSWaylandRegionPrivate::region_subtract(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
-}
-
-DS_WAYLAND_IMPL_FROM_RESOURCE(DSWaylandRegion);
-
-
-DSWaylandRegion::DSWaylandRegion()
- : DS_INIT_PRIVATE_PTR(DSWaylandRegion)
-{}
-
-DSWaylandRegion::DSWaylandRegion(DSWaylandClient *waylandClient, uint32_t id)
- : _d_ptr(std::make_unique<DSWaylandRegionPrivate>(this, waylandClient, id))
-{}
-
-DSWaylandRegion::~DSWaylandRegion()
-{}
-
-struct ::wl_resource *DSWaylandRegion::getWlResource()
-{
- DS_GET_PRIV(DSWaylandRegion);
-
- return priv->resource()->handle;
-}
-
-bool DSWaylandRegion::hasResource()
-{
- DS_GET_PRIV(DSWaylandRegion);
-
- if (priv->resource())
- return true;
- return false;
-}
-/*LCOV_EXCL_STOP*/
-
-} /* namespace display_server */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_REGION_H__
-#define __DS_WAYLAND_REGION_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSStruct.h"
-#include "DSWaylandClient.h"
-
-struct wl_resource;
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandRegionPrivate;
-
-class DSWaylandRegion : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWaylandRegion);
- DS_WAYLAND_DEFINE_FROM_RESOURCE(DSWaylandRegion);
-public:
- DSWaylandRegion();
- DSWaylandRegion(DSWaylandClient *waylandClient, uint32_t id);
- virtual ~DSWaylandRegion();
-
- struct ::wl_resource *getWlResource();
- bool hasResource();
-
-private:
-
-};
-/*LCOV_EXCL_STOP*/
-
-} /* namespace display_server */
-
-#endif /* _DS_WAYLAND_REGION_H_ */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_REGION_PRIVATE_H__
-#define __DS_WAYLAND_REGION_PRIVATE_H__
-
-#include "dswayland-server-wayland.h"
-#include "DSWaylandRegion.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandRegion;
-
-class DSWaylandRegionPrivate : public DSObjectPrivate, public DSWaylandServer::wl_region
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandRegion);
-public:
- DSWaylandRegionPrivate() = delete;
- DSWaylandRegionPrivate(DSWaylandRegion *p_ptr);
- DSWaylandRegionPrivate(DSWaylandRegion *p_ptr, DSWaylandClient *waylandClient, uint32_t id);
- ~DSWaylandRegionPrivate() override;
-
-protected:
- void region_bind_resource(Resource *resource);
- void region_destroy_resource(Resource *resource);
-
- void region_destroy(Resource *resource);
- void region_add(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- void region_subtract(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
-
-private:
-};
-/*LCOV_EXCL_STOP*/
-
-} /*namespace display_server */
-
-#endif /* _DS_WAYLAND_REGION_PRIVATE_H_ */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandSeat.h"
-#include "DSWaylandSeatPrivate.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandClient.h"
-#include "DSWaylandPointer.h"
-#include "DSWaylandKeyboard.h"
-#include "DSWaylandTouch.h"
-#include "DSXkb.h"
-
-namespace display_server
-{
-
-/* Begin Private Class Implementation */
-DSWaylandSeatPrivate::DSWaylandSeatPrivate(DSWaylandCompositor *compositor, DSWaylandSeat *seat)
- : DSObjectPrivate(seat),
- __p_ptr(seat),
- __cap(DSWaylandSeat::capNone),
- __compositor(compositor),
- __xkb(nullptr),
- __pointer(nullptr),
- __keyboard(nullptr),
- __touch(nullptr),
- __currentEventTime(0)
-{
- if (!compositor)
- return;
-
- wl_seat::init(compositor->display(), 4);
-}
-
-DSWaylandSeatPrivate::~DSWaylandSeatPrivate()
-{
-}
-
-void DSWaylandSeatPrivate::sendCapabilitiesToAllClients(uint32_t cap)
-{
- auto func = [&](std::pair<struct ::wl_client*, Resource*> res)
- { wl_seat::send_capabilities(res.second->handle, cap); };
- auto resMap = resourceMap();
- std::for_each(resMap.begin(), resMap.end(), func);
-}
-
-void DSWaylandSeatPrivate::seat_bind_resource(Resource *resource)
-{
- /* send capabilities */
- wl_seat::send_capabilities(resource->handle, (uint32_t)__cap);
-
- /* send seat name */
- if (!__seatName.empty())
- wl_seat::send_name(resource->handle, __seatName);
-}
-
-void DSWaylandSeatPrivate::seat_destroy_resource(Resource *resource)
-{
- //Nothing to do as wl_seat::destroy_func has removed the resource->handle from m_resource_map
-}
-
-void DSWaylandSeatPrivate::seat_get_pointer(Resource *resource, uint32_t id)
-{
- //TODO : add DSWaylandPointer here
- //TODO : send pointer_enter here if this client equals to top-visible window's client
- if (!__pointer)
- return;
-
- __pointer->addClient(DSWaylandClient::fromWlClient(resource->client()), id, resource->version());
-}
-
-void DSWaylandSeatPrivate::seat_get_keyboard(Resource *resource, uint32_t id)
-{
- //TODO : add DSWaylandKeyboard here
- //TODO : send repeat info to the client
- //TODO : send keyboard_enter here if this client equals to focus window's client
- if (!__keyboard)
- return;
-
- __keyboard->addClient(DSWaylandClient::fromWlClient(resource->client()), id, resource->version());
-}
-
-void DSWaylandSeatPrivate::seat_get_touch(Resource *resource, uint32_t id)
-{
- //TODO : add DSWaylandTouch here
- if (!__touch)
- return;
-
- __touch->addClient(DSWaylandClient::fromWlClient(resource->client()), id, resource->version());
-}
-
-void DSWaylandSeatPrivate::seat_release(Resource *resource)
-{
- //TODO : Check if we should destroy wl_resource here.
-}
-
-/* Begin Public Class Implementation */
-DSWaylandSeat::DSWaylandSeat(DSWaylandCompositor *compositor, DSWaylandSeat::seatCapability cap)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandSeatPrivate>(compositor, this))
-{
- setCapability(cap);
-}
-
-DSWaylandSeat::~DSWaylandSeat()
-{
-}
-
-void DSWaylandSeat::sendCapabilitiesToAllClients(uint32_t cap)
-{
- DS_GET_PRIV(DSWaylandSeat);
-
- priv->sendCapabilitiesToAllClients(cap);
-}
-
-void DSWaylandSeat::setCapability(DSWaylandSeat::seatCapability cap)
-{
- DS_GET_PRIV(DSWaylandSeat);
-
- DSLOG_INF("DSWaylandSeat","cap=%d, priv->__cap=%d", cap, priv->__cap);
-
- if (cap == priv->__cap)
- {
- return;
- }
-
- DSWaylandSeat::seatCapability diff = DSWaylandSeat::seatCapability((uint32_t)priv->__cap ^ cap);
-
- if (diff & DSWaylandSeat::capPointer)
- {
- if (!priv->__pointer)
- {
- priv->__pointer = new DSWaylandPointer(this);
- DS_ASSERT(priv->__pointer);
- DSLOG_INF("DSWaylandSeat", "DSWaylandPointer has been created.");
- }
- }
-
- if (diff & DSWaylandSeat::capKeyboard)
- {
- if (!priv->__keyboard)
- {
- priv->__keyboard = new DSWaylandKeyboard(this);
- DS_ASSERT(priv->__keyboard);
- DSLOG_INF("DSWaylandSeat", "DSWaylandKeyboard has been created.");
- }
- }
-
- if (diff & DSWaylandSeat::capTouch)
- {
- if (!priv->__touch)
- {
- priv->__touch = new DSWaylandTouch(this);
- DS_ASSERT(priv->__touch);
- DSLOG_INF("DSWaylandSeat", "DSWaylandTouch has been created.");
- }
- }
-
- /* send capabilities when it is updated */
- sendCapabilitiesToAllClients((uint32_t)cap);
-
- //TODO : check if we should set focus if the keyboard cap has been added newly.
-
- priv->__cap = cap;
-}
-
-DSWaylandSeat::seatCapability DSWaylandSeat::getCapability(void)
-{
- DS_GET_PRIV(DSWaylandSeat);
-
- return priv->__cap;
-}
-
-void DSWaylandSeat::setName(std::string name)
-{
- DS_GET_PRIV(DSWaylandSeat);
-
- //TODO : check if we should send name to client(s) when it has a name.
-
- priv->__seatName = name;
-}
-
-std::string DSWaylandSeat::getName()
-{
- DS_GET_PRIV(DSWaylandSeat);
-
- return priv->__seatName;
-}
-
-void DSWaylandSeat::setCurrentEventTime(uint32_t timestamp)
-{
- DS_GET_PRIV(DSWaylandSeat);
- priv->__currentEventTime = timestamp;
-}
-
-uint32_t DSWaylandSeat::getCurrentEventTime()
-{
- DS_GET_PRIV(DSWaylandSeat);
- return priv->__currentEventTime;
-}
-
-void DSWaylandSeat::setXkb(DSXkb *xkb)
-{
- DS_GET_PRIV(DSWaylandSeat);
- priv->__xkb = xkb;
-}
-
-DSXkb *DSWaylandSeat::getXkb()
-{
- DS_GET_PRIV(DSWaylandSeat);
- return priv->__xkb;
-}
-
-DSWaylandPointer *DSWaylandSeat::getPointer()
-{
- DS_GET_PRIV(DSWaylandSeat);
- return priv->__pointer;
-}
-
-DSWaylandKeyboard *DSWaylandSeat::getKeyboard()
-{
- DS_GET_PRIV(DSWaylandSeat);
- return priv->__keyboard;
-}
-
-DSWaylandTouch *DSWaylandSeat::getTouch()
-{
- DS_GET_PRIV(DSWaylandSeat);
- return priv->__touch;
-}
-
-DSWaylandCompositor *DSWaylandSeat::getCompositor()
-{
- DS_GET_PRIV(DSWaylandSeat);
- return priv->__compositor;
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_SEAT_H__
-#define __DS_WAYLAND_SEAT_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-class DSXkb;
-class DSWaylandSeatPrivate;
-class DSWaylandCompositor;
-class DSWaylandPointer;
-class DSWaylandKeyboard;
-class DSWaylandTouch;
-
-class DS_DECL_EXPORT DSWaylandSeat : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWaylandSeat);
-public:
- enum seatCapability {
- capNone = 0x0,
- capPointer = 0x1,
- capKeyboard = 0x2,
- capPointerKeyboard = capPointer | capKeyboard,
- capTouch = 0x4,
- capPointerTouch = capPointer | capTouch,
- capKeyboardTouch = capKeyboard | capTouch,
- capAll = capPointer | capKeyboard | capTouch,
- capDefault = capPointer | capKeyboard | capTouch,
- };
-
- DSWaylandSeat(DSWaylandCompositor *compositor, DSWaylandSeat::seatCapability cap);
- ~DSWaylandSeat() override;
-
- void sendCapabilitiesToAllClients(uint32_t cap);
- void setCapability(DSWaylandSeat::seatCapability cap);
- DSWaylandSeat::seatCapability getCapability(void);
- void setName(std::string name);
- std::string getName();
-
- void setCurrentEventTime(uint32_t timestamp);
- uint32_t getCurrentEventTime();
-
- void setXkb(DSXkb *xkb);
- DSXkb *getXkb();
-
- DSWaylandPointer *getPointer();
- DSWaylandKeyboard *getKeyboard();
- DSWaylandTouch *getTouch();
- DSWaylandCompositor *getCompositor();
-
-protected:
-
-private:
-
-};
-
-}
-
-#endif //__DS_WAYLAND_SEAT_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_SEAT_PRIVATE_H__
-#define __DS_WAYLAND_SEAT_PRIVATE_H__
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "dswayland-server-wayland.h"
-
-namespace display_server
-{
-
-class DSXkb;
-class DSWaylandPointer;
-class DSWaylandKeyboard;
-class DSWaylandTouch;
-
-class DS_DECL_EXPORT DSWaylandSeatPrivate : public DSObjectPrivate, public DSWaylandServer::wl_seat
-{
- DS_PIMPL_USE_PUBLIC(DSWaylandSeat);
-public:
- DSWaylandSeatPrivate(DSWaylandCompositor *compositor, DSWaylandSeat *seat);
- ~DSWaylandSeatPrivate() override;
-
- void sendCapabilitiesToAllClients(uint32_t cap);
-
-protected:
- void seat_bind_resource(Resource *resource) override;
- void seat_destroy_resource(Resource *resource) override;
- void seat_get_pointer(Resource *resource, uint32_t id) override;
- void seat_get_keyboard(Resource *resource, uint32_t id) override;
- void seat_get_touch(Resource *resource, uint32_t id) override;
- void seat_release(Resource *resource) override;
-
-private:
- DSWaylandSeat::seatCapability __cap;
- DSWaylandCompositor *__compositor;
- DSXkb *__xkb;
- std::string __seatName;
-
- DSWaylandPointer *__pointer;
- DSWaylandKeyboard *__keyboard;
- DSWaylandTouch *__touch;
-
- uint32_t __currentEventTime;
-};
-
-}
-
-#endif //__DS_WAYLAND_SEAT_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandSurface.h"
-#include "DSWaylandSurfacePrivate.h"
-#include "DSWaylandClient.h"
-
-namespace display_server
-{
-
-/* DSWaylandSurfaceCommitInfoPrivate */
-DSWaylandSurfaceCommitInfoPrivate::DSWaylandSurfaceCommitInfoPrivate(DSWaylandSurfaceCommitInfo *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- bufferRef(nullptr),
- attach({0, 0, nullptr}),
- bufferChanged(false),
- damageSurface({0, 0, 0, 0}),
- transform(0),
- scale(0),
- damageBuffer({0,0,0,0})
-{
-}
-
-DSWaylandSurfaceCommitInfoPrivate::~DSWaylandSurfaceCommitInfoPrivate()
-{}
-
-std::shared_ptr<IDSBuffer> DSWaylandSurfaceCommitInfoPrivate::getBuffer()
-{
- return bufferRef ? bufferRef->refDSBufferGet() : nullptr;
-}
-
-/* DSWaylandSurfaceCommitInfo */
-DSWaylandSurfaceCommitInfo::DSWaylandSurfaceCommitInfo()
- : DS_INIT_PRIVATE_PTR(DSWaylandSurfaceCommitInfo)
-{}
-
-DSWaylandSurfaceCommitInfo::~DSWaylandSurfaceCommitInfo()
-{}
-
-/*LCOV_EXCL_START*/
-std::shared_ptr<IDSBuffer> DSWaylandSurfaceCommitInfo::getBuffer()
-{
- DS_GET_PRIV(DSWaylandSurfaceCommitInfo);
-
- return priv->getBuffer();
-}
-
-bool DSWaylandSurfaceCommitInfo::bufferChanged()
-{
- DS_GET_PRIV(DSWaylandSurfaceCommitInfo);
-
- return priv->bufferChanged;
-}
-/*LCOV_EXCL_STOP*/
-
-/* DSWaylandSurfacePrivate */
-static uint32_t tizenResIdCnt = 0;
-
-DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __deleted(false),
- __commitInfoPending{std::make_unique<DSWaylandSurfaceCommitInfo>()},
- __commitInfo{std::make_shared<DSWaylandSurfaceCommitInfo>()},
- __waylandClient(nullptr),
- __bufferManager{DSBufferManager::getInstance()},
- __resId(0),
- __tizenResId(++tizenResIdCnt)
-{}
-
-DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr, DSWaylandClient *waylandClient, uint32_t id)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __deleted(false),
- __commitInfoPending{std::make_unique<DSWaylandSurfaceCommitInfo>()},
- __commitInfo{std::make_shared<DSWaylandSurfaceCommitInfo>()},
- __waylandClient(waylandClient),
- __bufferManager{DSBufferManager::getInstance()},
- __resId(0),
- __tizenResId(++tizenResIdCnt)
-{
- if (id > 0) {
- wl_surface::init(waylandClient->wlClient(), (int)id, 4);
- __resId = id;
- }
-}
-
-DSWaylandSurfacePrivate::~DSWaylandSurfacePrivate()
-{
- if (__bufferManager)
- DSBufferManager::releaseInstance();
-}
-
-/*LCOV_EXCL_START*/
-uint32_t DSWaylandSurfacePrivate::getResourceId()
-{
- return __resId;
-}
-
-uint32_t DSWaylandSurfacePrivate::getTizenResourceId()
-{
- return __tizenResId;
-}
-
-void DSWaylandSurfacePrivate::surface_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandSurfacePrivate::surface_destroy_resource(Resource *resource)
-{
- __sendSurfaceDestroy();
-}
-
-void DSWaylandSurfacePrivate::surface_destroy(Resource *resource)
-{
- __sendSurfaceDestroy();
-}
-/*LCOV_EXCL_STOP*/
-
-void DSWaylandSurfacePrivate::surface_attach(Resource *resource, struct ::wl_resource *buffer, int32_t x, int32_t y)
-{
- DSWaylandSurfaceCommitInfoPrivate *commitInfoPendingPriv = DSWaylandSurfaceCommitInfoPrivate::getPrivate(__commitInfoPending.get());
- std::shared_ptr<IDSBuffer> dsBuffer;
-
- commitInfoPendingPriv->attach.x = x;
- commitInfoPendingPriv->attach.y = y;
- commitInfoPendingPriv->attach.buffer = buffer;
- commitInfoPendingPriv->bufferRef.reset(nullptr);
-
- if (buffer) {
- dsBuffer = __bufferManager->getDSBuffer(buffer);
- commitInfoPendingPriv->bufferRef = std::make_unique<DSBufferRef>(dsBuffer);
- } else {
- commitInfoPendingPriv->bufferRef = nullptr;
- }
-
- commitInfoPendingPriv->bufferChanged = true;
-}
-
-void DSWaylandSurfacePrivate::surface_damage(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- DSWaylandSurfaceCommitInfoPrivate *commitInfoPendingPriv = DSWaylandSurfaceCommitInfoPrivate::getPrivate(__commitInfoPending.get());
-
- commitInfoPendingPriv->damageSurface.x = x;
- commitInfoPendingPriv->damageSurface.y = y;
- commitInfoPendingPriv->damageSurface.width = width;
- commitInfoPendingPriv->damageSurface.height = height;
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandSurfacePrivate::surface_frame(Resource *resource, uint32_t callback)
-{
- //TODO:
-}
-
-void DSWaylandSurfacePrivate::surface_set_opaque_region(Resource *resource, struct ::wl_resource *region)
-{
- //TODO:
-}
-
-void DSWaylandSurfacePrivate::surface_set_input_region(Resource *resource, struct ::wl_resource *region)
-{
- //TODO:
-}
-/*LCOV_EXCL_STOP*/
-
-void DSWaylandSurfacePrivate::surface_commit(Resource *resource)
-{
- DS_GET_PUB(DSWaylandSurface);
-
- DSWaylandSurfaceCommitInfoPrivate *commitInfoPendingPriv = DSWaylandSurfaceCommitInfoPrivate::getPrivate(__commitInfoPending.get());
- DSWaylandSurfaceCommitInfoPrivate *commitInfoPriv = DSWaylandSurfaceCommitInfoPrivate::getPrivate(__commitInfo.get());
-
- //copy commit information from commitInfoPendingPriv to commitInfoPriv
- commitInfoPriv->attach = commitInfoPendingPriv->attach;
- commitInfoPriv->damageSurface = commitInfoPendingPriv->damageSurface;
- commitInfoPriv->transform = commitInfoPendingPriv->transform;
- commitInfoPriv->scale = commitInfoPendingPriv->scale;
- commitInfoPriv->damageBuffer = commitInfoPendingPriv->damageBuffer;
- commitInfoPriv->bufferRef = std::move(commitInfoPendingPriv->bufferRef);
- commitInfoPriv->bufferChanged = commitInfoPendingPriv->bufferChanged;
- commitInfoPendingPriv->bufferChanged = false; // reset value
-
- // emit a signal of the surface committed
- pub->__surfaceCommittedSignal.emit(__commitInfo);
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandSurfacePrivate::surface_set_buffer_transform(Resource *resource, int32_t transform)
-{
- DSWaylandSurfaceCommitInfoPrivate *commitInfoPendingPriv = DSWaylandSurfaceCommitInfoPrivate::getPrivate(__commitInfoPending.get());
-
- commitInfoPendingPriv->transform = transform;
-}
-
-void DSWaylandSurfacePrivate::surface_set_buffer_scale(Resource *resource, int32_t scale)
-{
- DSWaylandSurfaceCommitInfoPrivate *commitInfoPendingPriv = DSWaylandSurfaceCommitInfoPrivate::getPrivate(__commitInfoPending.get());
-
- commitInfoPendingPriv->scale = scale;
-}
-
-void DSWaylandSurfacePrivate::surface_damage_buffer(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- DSWaylandSurfaceCommitInfoPrivate *commitInfoPendingPriv = DSWaylandSurfaceCommitInfoPrivate::getPrivate(__commitInfoPending.get());
-
- commitInfoPendingPriv->damageBuffer.x = x;
- commitInfoPendingPriv->damageBuffer.y = y;
- commitInfoPendingPriv->damageBuffer.width = width;
- commitInfoPendingPriv->damageBuffer.height = height;
-}
-/*LCOV_EXCL_STOP*/
-
-void DSWaylandSurfacePrivate::__sendSurfaceDestroy(void)
-{
- if (__deleted) return;
-
- DS_GET_PUB(DSWaylandSurface);
-
- DSWaylandCompositor *dswCompositor = DSWaylandCompositor::getInstance();
- if (dswCompositor)
- {
- dswCompositor->sendSurfaceDestroy(pub);
- }
- DSWaylandCompositor::releaseInstance();
-
- __deleted = true;
-}
-
-
-
-DS_WAYLAND_IMPL_FROM_RESOURCE(DSWaylandSurface);
-
-/* DSWaylandSurface */
-DSWaylandSurface::DSWaylandSurface()
- : DS_INIT_PRIVATE_PTR(DSWaylandSurface)
-{
-}
-
-DSWaylandSurface::DSWaylandSurface(DSWaylandClient *waylandClient, uint32_t id)
- : _d_ptr(std::make_unique<DSWaylandSurfacePrivate>(this, waylandClient, id))
-{
-}
-
-DSWaylandSurface::~DSWaylandSurface()
-{
-}
-
-void DSWaylandSurface::registerCallbackSurfaceCommitted(DSObject *slot, std::function<void(std::shared_ptr<DSWaylandSurfaceCommitInfo> commitInfo)> func)
-{
- this->__surfaceCommittedSignal.connect(slot, func);
-}
-
-struct ::wl_resource *DSWaylandSurface::getWlResource()
-{
- DS_GET_PRIV(DSWaylandSurface);
-
- return priv->resource()->handle;
-}
-
-DSWaylandClient *DSWaylandSurface::getClient()
-{
- DS_GET_PRIV(DSWaylandSurface);
-
- return priv->__waylandClient;
-}
-
-bool DSWaylandSurface::hasResource()
-{
- DS_GET_PRIV(DSWaylandSurface);
-
- if (priv->resource())
- return true;
- return false;
-}
-
-/*LCOV_EXCL_START*/
-uint32_t DSWaylandSurface::getResourceId()
-{
- DS_GET_PRIV(DSWaylandSurface);
-
- return priv->getResourceId();
-}
-
-uint32_t DSWaylandSurface::getTizenResourceId()
-{
- DS_GET_PRIV(DSWaylandSurface);
-
- return priv->getTizenResourceId();
-}
-/*LCOV_EXCL_STOP*/
-
-} /* namespace display_server */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_SURFACE_H__
-#define __DS_WAYLAND_SURFACE_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSSignal.h"
-#include "DSStruct.h"
-#include "DSWaylandClient.h"
-#include "IDSBuffer.h"
-
-struct wl_resource;
-
-namespace display_server
-{
-
-class DSWaylandSurfaceCommitInfoPrivate;
-class DSWaylandSurfacePrivate;
-
-class DSWaylandSurfaceCommitInfo : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandSurfaceCommitInfo);
-public:
- DSWaylandSurfaceCommitInfo();
- virtual ~DSWaylandSurfaceCommitInfo();
-
- //TODO: add getter functions.
- std::shared_ptr<IDSBuffer> getBuffer();
- bool bufferChanged();
-};
-
-class DSWaylandSurface : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWaylandSurface);
- DS_WAYLAND_DEFINE_FROM_RESOURCE(DSWaylandSurface);
-public:
- DSWaylandSurface();
- DSWaylandSurface(DSWaylandClient *waylandClient, uint32_t id);
- virtual ~DSWaylandSurface();
-
- // Callback methods
- void registerCallbackSurfaceCommitted(DSObject *slot, std::function<void(std::shared_ptr<DSWaylandSurfaceCommitInfo> commitInfo)> func);
-
- struct ::wl_resource *getWlResource();
- DSWaylandClient *getClient();
- bool hasResource();
-
- uint32_t getResourceId();
- uint32_t getTizenResourceId();
-
-private:
- // signals
- DSSignal<std::shared_ptr<DSWaylandSurfaceCommitInfo>> __surfaceCommittedSignal;
-};
-
-} /* namespace display_server */
-
-#endif /* _DS_WAYLAND_SURFACE_H_ */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_SURFACE_PRIVATE_H__
-#define __DS_WAYLAND_SURFACE_PRIVATE_H__
-
-#include "dswayland-server-wayland.h"
-#include "DSWaylandSurface.h"
-#include "DSBufferManager.h"
-#include "DSBufferRef.h"
-
-namespace display_server
-{
-
-class DSWaylandSurfaceCommitInfo;
-class DSWaylandSurface;
-
-class DSWaylandSurfaceCommitInfoPrivate : public DSObjectPrivate
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandSurfaceCommitInfo);
-public:
- DSWaylandSurfaceCommitInfoPrivate() = delete;
- DSWaylandSurfaceCommitInfoPrivate(DSWaylandSurfaceCommitInfo *p_ptr);
- ~DSWaylandSurfaceCommitInfoPrivate() override;
-
- static DSWaylandSurfaceCommitInfoPrivate *getPrivate(DSWaylandSurfaceCommitInfo *q) { return q->__d_func(); }
-
- //TODO: add getter functions.
- std::shared_ptr<IDSBuffer> getBuffer();
-
-public:
- struct _attach {
- int32_t x;
- int32_t y;
- struct ::wl_resource *buffer;
- };
- std::unique_ptr<DSBufferRef> bufferRef;
- struct _attach attach;
- bool bufferChanged;
-
- struct damageSurface {
- int32_t x;
- int32_t y;
- int32_t width;
- int32_t height;
- };
- struct damageSurface damageSurface;
-
- //TODO: opaque_region
- //TODO: input region
- int32_t transform;
- int32_t scale;
-
- struct damageBuffer {
- int32_t x;
- int32_t y;
- int32_t width;
- int32_t height;
- };
- struct damageBuffer damageBuffer;
-};
-
-struct wl_resource;
-
-class DSWaylandSurfacePrivate : public DSObjectPrivate, public DSWaylandServer::wl_surface
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandSurface);
-public:
- DSWaylandSurfacePrivate() = delete;
- DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr);
- DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr, DSWaylandClient *waylandClient, uint32_t id);
- ~DSWaylandSurfacePrivate() override;
-
- uint32_t getResourceId();
- uint32_t getTizenResourceId();
-
-protected:
- void surface_bind_resource(Resource *resource) override;
- void surface_destroy_resource(Resource *resource) override;
-
- void surface_destroy(Resource *resource) override;
- void surface_attach(Resource *resource, struct ::wl_resource *buffer, int32_t x, int32_t y) override;
- void surface_damage(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
- void surface_frame(Resource *resource, uint32_t callback) override;
- void surface_set_opaque_region(Resource *resource, struct ::wl_resource *region) override;
- void surface_set_input_region(Resource *resource, struct ::wl_resource *region) override;
- void surface_commit(Resource *resource) override;
- void surface_set_buffer_transform(Resource *resource, int32_t transform) override;
- void surface_set_buffer_scale(Resource *resource, int32_t scale) override;
- void surface_damage_buffer(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
-
-private:
- void __sendSurfaceDestroy(void);
-
-private:
- bool __deleted;
- std::unique_ptr<DSWaylandSurfaceCommitInfo> __commitInfoPending;
- std::shared_ptr<DSWaylandSurfaceCommitInfo> __commitInfo;
- DSWaylandClient *__waylandClient;
- DSBufferManager *__bufferManager;
- uint32_t __resId;
- uint32_t __tizenResId;
-};
-
-} /*namespace display_server */
-
-#endif /* _DS_WAYLAND_SURFACE_PRIVATE_H_ */
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTextInputManager.h"
-#include "DSWaylandTextInputManagerPrivate.h"
-#include "DSWaylandTextInput.h"
-#include "DSWaylandTextInputPrivate.h"
-#include "DSWaylandSurface.h"
-
-namespace display_server {
-
-/*LCOV_EXCL_START*/
-DSWaylandTextInputManagerPrivate::DSWaylandTextInputManagerPrivate(DSWaylandTextInputManager *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __compositor(compositor)
-{
- if (!compositor)
- return;
-
- wl_text_input_manager::init(__compositor->display(), 1);
-}
-
-DSWaylandTextInputManagerPrivate::~DSWaylandTextInputManagerPrivate()
-{
-}
-
-void DSWaylandTextInputManagerPrivate::text_input_manager_create_text_input(Resource *resource, uint32_t id)
-{
- DS_GET_PUB(DSWaylandTextInputManager);
-
- pub->createTextInput((void *)(resource->client()), id);
-}
-
-
-DSWaylandTextInputManager::DSWaylandTextInputManager(DSWaylandCompositor *compositor)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandTextInputManagerPrivate>(this, compositor)),
- __dsTextInputPrivate(nullptr),
- __compositor(compositor),
- __textInputId(0)
-{
- __textInput = new DSWaylandTextInput(compositor, this);
-}
-
-DSWaylandTextInputManager::DSWaylandTextInputManager(DSWaylandCompositor *compositor, DSTextInputPrivate *dsTextInputPrivate)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandTextInputManagerPrivate>(this, compositor)),
- __dsTextInputPrivate(dsTextInputPrivate),
- __compositor(compositor),
- __textInputId(0)
-{
- __textInput = new DSWaylandTextInput(compositor, this, __dsTextInputPrivate);
-}
-
-DSWaylandTextInputManager::~DSWaylandTextInputManager()
-{
-}
-
-void DSWaylandTextInputManager::createTextInput(void *client, unsigned int managerId)
-{
- __textInput->createGlobal(client, managerId, allocTextInputId());
-}
-
-int DSWaylandTextInputManager::allocTextInputId()
-{
- return __textInputId++;
-}
-
-void DSWaylandTextInputManager::contextCommitString(unsigned int serial, std::string text)
-{
- __textInput->sendCommitString(serial, text);
-}
-
-void DSWaylandTextInputManager::contextPreeditString(unsigned int serial, std::string text, std::string commit)
-{
- __textInput->sendPreeditString(serial, text, commit);
-}
-
-void DSWaylandTextInputManager::contextPreeditStyling(int index, unsigned int length, unsigned int style)
-{
- __textInput->sendPreeditStyling(index, length, style);
-}
-
-void DSWaylandTextInputManager::contextPreeditCursor(int index)
-{
- __textInput->sendPreeditCursor(index);
-}
-
-void DSWaylandTextInputManager::contextDeleteSurroundingText(int index, unsigned int length)
-{
- __textInput->sendDeleteSurroundingText(index, length);
-}
-
-void DSWaylandTextInputManager::contextCursorPosition(int index, int anchor)
-{
- __textInput->sendCursorPosition(index, anchor);
-}
-
-void DSWaylandTextInputManager::contextModifiersMap(std::string map)
-{
- __textInput->sendModifiersMap(map);
-}
-
-void DSWaylandTextInputManager::contextKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers)
-{
- __textInput->sendKeysym(serial, time, sym, state, modifiers);
-}
-
-void DSWaylandTextInputManager::contextLanguage(unsigned int serial, std::string language)
-{
- __textInput->sendLanguage(serial, language);
-}
-
-void DSWaylandTextInputManager::contextTextDirection(unsigned int serial, unsigned int direction)
-{
- __textInput->sendTextDirection(serial, direction);
-}
-
-void DSWaylandTextInputManager::contextSelectionRegion(unsigned int serial, int start, int end)
-{
- __textInput->sendSelectionRegion(serial, start, end);
-}
-
-void DSWaylandTextInputManager::contextPrivateCommand(unsigned int serial, std::string command)
-{
- __textInput->sendPrivateCommand(serial, command);
-}
-
-void DSWaylandTextInputManager::contextUpdateInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength)
-{
- __textInput->sendInputPanelData(serial, inputPanelData, inputPanelDataLength);
-}
-
-void DSWaylandTextInputManager::contextShowInputPanel()
-{
- __textInput->showInputPanel();
-}
-
-void DSWaylandTextInputManager::contextHideInputPanel()
-{
- __textInput->hideInputPanel();
-}
-
-void DSWaylandTextInputManager::contextGetSelectionText(int fd)
-{
- __textInput->sendGetSelectionText(fd);
-}
-
-void DSWaylandTextInputManager::contextGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd)
-{
- __textInput->sendGetSurroundingText(maxlenBefore, maxlenAfter, fd);
-}
-
-void DSWaylandTextInputManager::contextFilterKeyEventDone(unsigned int serial, unsigned int state)
-{
- __textInput->sendFilterKeyEventDone(serial, state);
-}
-
-void DSWaylandTextInputManager::contextUpdateIseGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int height)
-{
- __textInput->sendInputPanelGeometry(x, y, width, height);
-}
-
-void DSWaylandTextInputManager::contextRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit)
-{
- __textInput->sendRecaptureString(serial, index, length, preedit, preeditCommit, commit);
-}
-
-void DSWaylandTextInputManager::contextInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value)
-{
- __textInput->sendInputPanelEvent(serial, eventType, value);
-}
-
-void DSWaylandTextInputManager::contextCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes)
-{
- __textInput->sendCommitContent(serial, content, description, mimeTypes);
-}
-
-void DSWaylandTextInputManager::updateTextInputPanelState(bool state)
-{
- __textInput->updatePanelState(state);
-}
-
-void DSWaylandTextInputManager::setGeometryUpdated(bool updated)
-{
- __textInput->setGeometryUpdated(updated);
-}
-
-DSWaylandSurface* DSWaylandTextInputManager::getTextInputSurface()
-{
- return __textInput->getClientSurface();
-}
-
-
-DSWaylandTextInputPrivate::DSWaylandTextInputPrivate(DSWaylandTextInput *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __compositor(compositor),
- __showClient(nullptr),
- __activatedResource(nullptr),
- __clientSurface(nullptr)
-{
-}
-
-DSWaylandTextInputPrivate::~DSWaylandTextInputPrivate()
-{
-}
-
-void DSWaylandTextInputPrivate::createGlobal(void *client, unsigned int managerId, int id)
-{
- Resource *resource = add((struct ::wl_client *)client, managerId, 1);
- __resourceIdMap.insert(std::pair<Resource*, int>(resource, id));
-}
-
-int DSWaylandTextInputPrivate::getResourceId(Resource *resource)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- int id = -1;
-
- if (pub->__dsTextInputPrivate)
- {
- std::multimap<Resource*, int>::iterator it;
- for (it = __resourceIdMap.begin(); it != __resourceIdMap.end(); it++)
- {
- if (resource == (*it).first)
- {
- id = (*it).second;
- break;
- }
- }
- }
-
- return id;
-}
-
-void DSWaylandTextInputPrivate::showInputPanel(void *resource)
-{
- DS_GET_PUB(DSWaylandTextInput);
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- Resource *privateResource = Resource::fromResource((struct ::wl_resource *)resource);
-
- /* NOTE: bug, sometimes in this time, input_method_context is not exist */
- int id = getResourceId(privateResource);
-
- if (id >= 0)
- {
- pub->__dsTextInputPrivate->showInputPanel(pub, id);
- __showClient = privateResource->client();
- pub->__dsTextInputPrivate->updateInputPanelState(true);
- }
-
- if (pub->__dsTextInputPrivate->getInputPanelState() == DSTextInputPrivate::InputPanelStateWillHide)
- {
- send_private_command(privateResource->handle, 0, "CONFORMANT_RESTORE");
- }
-
- pub->__dsTextInputPrivate->setInputPanelState(DSTextInputPrivate::InputPanelStateWillShow);
- pub->__geometryUpdated = false;
- pub->__dsTextInputPrivate->setInputPanelTransientFor(__clientSurface);
-}
-
-void DSWaylandTextInputPrivate::text_input_destroy(Resource *resource)
-{
- __resourceIdMap.erase(resource);
-}
-
-void DSWaylandTextInputPrivate::text_input_activate(Resource *resource, struct ::wl_resource *seat, struct ::wl_resource *surface)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- int id = getResourceId(resource);
-
- if (__activatedResource)
- {
- pub->__dsTextInputPrivate->deactivateTextInput(pub);
- send_leave(__activatedResource->handle);
- }
-
- if (id >= 0)
- pub->__dsTextInputPrivate->activateTextInput(pub, id);
-
- __activatedResource = resource;
- __clientSurface = DSWaylandSurface::fromWlResource(surface);
-}
-
-void DSWaylandTextInputPrivate::text_input_deactivate(Resource *resource, struct ::wl_resource *seat)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- /* NOTE: need to check __activatedResource and current resource? */
-
- pub->__dsTextInputPrivate->deactivateTextInput(pub);
-
- send_leave(resource->handle);
-
- __activatedResource = nullptr;
-}
-
-void DSWaylandTextInputPrivate::text_input_show_input_panel(Resource *resource)
-{
- showInputPanel(resource->handle);
-}
-
-void DSWaylandTextInputPrivate::hideInputPanel(Resource *resource, bool forceHide)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- send_input_panel_geometry(resource->handle, 0, 0, 0, 0);
- send_input_panel_state(resource->handle, WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE);
-
- if (forceHide)
- {
- pub->__dsTextInputPrivate->changeInputPanelVisibility(false);
- pub->__dsTextInputPrivate->setInputPanelTransientFor(nullptr);
- pub->__dsTextInputPrivate->setInputPanelState(DSTextInputPrivate::InputPanelStateDidHide);
- }
- else
- {
- pub->__dsTextInputPrivate->setInputPanelState(DSTextInputPrivate::InputPanelStateWillHide);
- send_private_command(resource->handle, 0, "CONFORMANT_RESET");
-
- /* TODO: temporary ignore timer */
- }
- /* TODO: bug, sometimes in this time, input_method_context is not exist */
- int id = getResourceId(resource);
- if (id >= 0)
- pub->__dsTextInputPrivate->hideInputPanel(id);
- /* TODO: inputpanel wait update set */
-}
-
-void DSWaylandTextInputPrivate::text_input_hide_input_panel(Resource *resource)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- if (__showClient == resource->client())
- {
- hideInputPanel(resource, false);
- __showClient = nullptr;
- }
-}
-
-void DSWaylandTextInputPrivate::text_input_reset(Resource *resource)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->resetTextInput();
-}
-
-void DSWaylandTextInputPrivate::text_input_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->setContentType(hint, purpose);
-}
-
-void DSWaylandTextInputPrivate::text_input_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- /* NOTE: Nothing to do in this request */
-}
-
-void DSWaylandTextInputPrivate::text_input_set_preferred_language(Resource *resource, const std::string &language)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->setPreferredLanguage(language);
-}
-
-void DSWaylandTextInputPrivate::text_input_commit_state(Resource *resource, uint32_t serial)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->commitState(serial);
-}
-
-void DSWaylandTextInputPrivate::text_input_invoke_action(Resource *resource, uint32_t button, uint32_t index)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->invokeAction(button, index);
-}
-
-void DSWaylandTextInputPrivate::text_input_set_return_key_type(Resource *resource, uint32_t return_key_type)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->setReturnKeyType(return_key_type);
-}
-
-void DSWaylandTextInputPrivate::text_input_set_return_key_disabled(Resource *resource, uint32_t return_key_disabled)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->returnKeyDisabled(return_key_disabled);
-}
-
-void DSWaylandTextInputPrivate::text_input_set_input_panel_data(Resource *resource, const std::string &input_panel_data, uint32_t input_panel_length)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->setInputPanelData(input_panel_data, input_panel_length);
-
- if (!input_panel_data.compare("WILL_HIDE_ACK"))
- {
- /* TODO: will hide timer control */
- if (pub->__dsTextInputPrivate->getInputPanelState() == DSTextInputPrivate::InputPanelStateWillHide)
- {
- pub->__dsTextInputPrivate->changeInputPanelVisibility(false);
- pub->__dsTextInputPrivate->setInputPanelTransientFor(nullptr);
- pub->__dsTextInputPrivate->setInputPanelState(DSTextInputPrivate::InputPanelStateDidShow);
- }
- }
-}
-
-void DSWaylandTextInputPrivate::text_input_bidi_direction(Resource *resource, uint32_t direction)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->bidiDirection(direction);
-}
-
-void DSWaylandTextInputPrivate::text_input_set_cursor_position(Resource *resource, uint32_t cursor_position)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->setCursorPosition(cursor_position);
-}
-
-void DSWaylandTextInputPrivate::text_input_process_input_device_event(Resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->processInputDeviceEvent(event_type, event_data, event_length);
-}
-
-void DSWaylandTextInputPrivate::text_input_filter_key_event(Resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- pub->__dsTextInputPrivate->filterKeyEvent(serial, time, keyname, state, modifiers, dev_name, dev_class, dev_subclass, keycode);
- }
- else
- {
- send_filter_key_event_done(resource->handle, serial, false);
- }
-}
-
-void DSWaylandTextInputPrivate::text_input_get_hide_permission(Resource *resource)
-{
- unsigned int permission = 1;
-
- /* TODO: compare __clientSurface is focused */
-
- send_hide_permission(resource->handle, permission);
-}
-
-void DSWaylandTextInputPrivate::text_input_set_capital_mode(Resource *resource, uint32_t mode)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->setCapitalMode(mode);
-}
-
-void DSWaylandTextInputPrivate::text_input_prediction_hint(Resource *resource, const std::string &text)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->predictionHint(text);
-}
-
-void DSWaylandTextInputPrivate::text_input_set_mime_type(Resource *resource, const std::string &type)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->setMimeType(type);
-}
-
-void DSWaylandTextInputPrivate::text_input_set_input_panel_position(Resource *resource, uint32_t x, uint32_t y)
-{
- /* TODO: input panel position set */
-}
-
-void DSWaylandTextInputPrivate::text_input_finalize_content(Resource *resource, const std::string &text, uint32_t cursor_position)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->finalizeContent(text, cursor_position);
-}
-
-void DSWaylandTextInputPrivate::text_input_prediction_hint_data(Resource *resource, const std::string &key, const std::string &value)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- pub->__dsTextInputPrivate->predictionHintData(key, value);
-}
-
-void DSWaylandTextInputPrivate::text_input_input_panel_enabled(Resource *resource, uint32_t enabled)
-{
-}
-
-
-void DSWaylandTextInputPrivate::sendCommitString(unsigned int serial, std::string text)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_commit_string(__activatedResource->handle, serial, text);
-}
-
-void DSWaylandTextInputPrivate::sendPreeditString(unsigned int serial, std::string text, std::string commit)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_preedit_string(__activatedResource->handle, serial, text, commit);
-}
-
-void DSWaylandTextInputPrivate::sendPreeditStyling(int index, unsigned int length, unsigned int style)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_preedit_styling(__activatedResource->handle, index, length, style);
-}
-
-void DSWaylandTextInputPrivate::sendPreeditCursor(int index)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_preedit_cursor(__activatedResource->handle, index);
-}
-
-void DSWaylandTextInputPrivate::sendDeleteSurroundingText(int index, unsigned int length)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_delete_surrounding_text(__activatedResource->handle, index, length);
-}
-
-void DSWaylandTextInputPrivate::sendCursorPosition(int index, int anchor)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_cursor_position(__activatedResource->handle, index, anchor);
-}
-
-void DSWaylandTextInputPrivate::sendModifiersMap(std::string map)
-{
- struct ::wl_array map_data;
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- wl_array_init(&map_data);
- char *strptr = (char *)wl_array_add(&map_data, map.length());
- std::copy(map.c_str(), map.c_str() + map.length(), strptr);
-
- send_modifiers_map(__activatedResource->handle, &map_data);
-
- wl_array_release(&map_data);
-}
-
-void DSWaylandTextInputPrivate::sendKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_keysym(__activatedResource->handle, serial, time, sym, state, modifiers);
-}
-
-void DSWaylandTextInputPrivate::sendLanguage(unsigned int serial, std::string language)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_language(__activatedResource->handle, serial, language);
-}
-
-void DSWaylandTextInputPrivate::sendTextDirection(unsigned int serial, unsigned int direction)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_text_direction(__activatedResource->handle, serial, direction);
-}
-
-void DSWaylandTextInputPrivate::sendSelectionRegion(unsigned int serial, int start, int end)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_selection_region(__activatedResource->handle, serial, start, end);
-}
-
-void DSWaylandTextInputPrivate::sendPrivateCommand(unsigned int serial, std::string command)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_private_command(__activatedResource->handle, serial, command);
-}
-
-void DSWaylandTextInputPrivate::sendInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_input_panel_data(__activatedResource->handle, serial, inputPanelData, inputPanelDataLength);
-}
-
-void DSWaylandTextInputPrivate::sendGetSelectionText(int fd)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_get_selection_text(__activatedResource->handle, fd);
-}
-
-void DSWaylandTextInputPrivate::sendGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_get_surrounding_text(__activatedResource->handle, maxlenBefore, maxlenAfter, fd);
-}
-
-void DSWaylandTextInputPrivate::sendFilterKeyEventDone(unsigned int serial, unsigned int state)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_filter_key_event_done(__activatedResource->handle, serial, state);
-}
-
-void DSWaylandTextInputPrivate::sendInputPanelGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int height)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_input_panel_geometry(__activatedResource->handle, x, y, width, height);
-}
-
-void DSWaylandTextInputPrivate::sendRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_recapture_string(__activatedResource->handle, serial, index, length, preedit, preeditCommit, commit);
-}
-
-void DSWaylandTextInputPrivate::sendInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_input_panel_event(__activatedResource->handle, serial, eventType, value);
-}
-
-void DSWaylandTextInputPrivate::sendCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes)
-{
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- send_commit_content(__activatedResource->handle, serial, content, description, mimeTypes);
-}
-
-void DSWaylandTextInputPrivate::updatePanelState(bool state)
-{
- DS_GET_PUB(DSWaylandTextInput);
-
- if (!__activatedResource)
- {
- DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource");
- return;
- }
-
- if (!pub->__geometryUpdated)
- {
- stGeometry geo = pub->__dsTextInputPrivate->inputPanelGetGeometry(nullptr);
- if (!(geo.w <= 1 || geo.h <= 1))
- pub->sendInputPanelGeometry(geo.x, geo.y, geo.w, geo.h);
- pub->__geometryUpdated = true;
- }
-
- unsigned int inputPanelState = WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE;
- if (state) inputPanelState = WL_TEXT_INPUT_INPUT_PANEL_STATE_SHOW;
-
- send_input_panel_state(__activatedResource->handle, inputPanelState);
-}
-
-void DSWaylandTextInputPrivate::updatePanelGeometry(DSWaylandSurface *wlSurface)
-{
- DS_GET_PUB(DSWaylandTextInput);
- if ((pub->__dsTextInputPrivate->getInputPanelState() != DSTextInputPrivate::InputPanelStateWillHide) &&
- (pub->__dsTextInputPrivate->getInputPanelState() != DSTextInputPrivate::InputPanelStateDidHide) &&
- (pub->__geometryUpdated))
- {
- stGeometry geo = pub->__dsTextInputPrivate->inputPanelGetGeometry(nullptr);
- if (!(geo.w <= 1 || geo.h <= 1))
- pub->sendInputPanelGeometry(geo.x, geo.y, geo.w, geo.h);
- }
-}
-
-
-DSWaylandTextInput::DSWaylandTextInput(DSWaylandCompositor *compositor, DSWaylandTextInputManager *textInputManager)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandTextInputPrivate>(this, compositor)),
- __compositor(compositor),
- __textInputManager(textInputManager),
- __dsTextInputPrivate(nullptr),
- __geometryUpdated(false)
-{
-}
-
-DSWaylandTextInput::DSWaylandTextInput(DSWaylandCompositor *compositor, DSWaylandTextInputManager *textInputManager, DSTextInputPrivate *dsTextInputPrivate)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandTextInputPrivate>(this, compositor)),
- __compositor(compositor),
- __textInputManager(textInputManager),
- __dsTextInputPrivate(dsTextInputPrivate),
- __geometryUpdated(false)
-{
-}
-
-DSWaylandTextInput::~DSWaylandTextInput()
-{
-}
-
-void DSWaylandTextInput::createGlobal(void *client, unsigned int managerId, int id)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->createGlobal(client, managerId, id);
-}
-
-void DSWaylandTextInput::showInputPanel()
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- if (priv->__activatedResource)
- priv->showInputPanel(priv->__activatedResource);
-}
-
-void DSWaylandTextInput::hideInputPanel()
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- if (priv->__activatedResource)
- priv->hideInputPanel(priv->__activatedResource, false);
-}
-
-void DSWaylandTextInput::sendCommitString(unsigned int serial, std::string text)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendCommitString(serial, text);
-}
-
-void DSWaylandTextInput::sendPreeditString(unsigned int serial, std::string text, std::string commit)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendPreeditString(serial, text, commit);
-}
-
-void DSWaylandTextInput::sendPreeditStyling(int index, unsigned int length, unsigned int style)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendPreeditStyling(index, length, style);
-}
-
-void DSWaylandTextInput::sendPreeditCursor(int index)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendPreeditCursor(index);
-}
-
-void DSWaylandTextInput::sendDeleteSurroundingText(int index, unsigned int length)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendDeleteSurroundingText(index, length);
-}
-
-void DSWaylandTextInput::sendCursorPosition(int index, int anchor)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendCursorPosition(index, anchor);
-}
-
-void DSWaylandTextInput::sendModifiersMap(std::string map)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendModifiersMap(map);
-}
-
-void DSWaylandTextInput::sendKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendKeysym(serial, time, sym, state, modifiers);
-}
-
-void DSWaylandTextInput::sendLanguage(unsigned int serial, std::string language)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendLanguage(serial, language);
-}
-
-void DSWaylandTextInput::sendTextDirection(unsigned int serial, unsigned int direction)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendTextDirection(serial, direction);
-}
-
-void DSWaylandTextInput::sendSelectionRegion(unsigned int serial, int start, int end)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendSelectionRegion(serial, start, end);
-}
-
-void DSWaylandTextInput::sendPrivateCommand(unsigned int serial, std::string command)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendPrivateCommand(serial, command);
-}
-
-void DSWaylandTextInput::sendInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendInputPanelData(serial, inputPanelData, inputPanelDataLength);
-}
-
-void DSWaylandTextInput::sendGetSelectionText(int fd)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendGetSelectionText(fd);
-}
-
-void DSWaylandTextInput::sendGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendGetSurroundingText(maxlenBefore, maxlenAfter, fd);
-}
-
-void DSWaylandTextInput::sendFilterKeyEventDone(unsigned int serial, unsigned int state)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendFilterKeyEventDone(serial, state);
-}
-
-void DSWaylandTextInput::sendInputPanelGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int height)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- int angle = 0;
- char geometry[128] = {0, };
-
- if (priv->__clientSurface)
- {
- /* TODO: calculate angle and set this value to vconf */
- }
-
- snprintf(geometry, sizeof(geometry), "%d,%d,%d,%d", x, y, width, height);
-
- switch(angle)
- {
- case 90:
- case 270:
- //vconf_set_str(VCONFKEY_ISF_IME_RECENT_LAND_GEOMETRY, geometry);
- break;
- default:
- //vconf_set_str(VCONFKEY_ISF_IME_RECENT_PORT_GEOMETRY, geometry);
- break;
- }
-
- priv->sendInputPanelGeometry(x, y, width, height);
-}
-
-void DSWaylandTextInput::sendRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendRecaptureString(serial, index, length, preedit, preeditCommit, commit);
-}
-
-void DSWaylandTextInput::sendInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendInputPanelEvent(serial, eventType, value);
-}
-
-void DSWaylandTextInput::sendCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->sendCommitContent(serial, content, description, mimeTypes);
-}
-
-void DSWaylandTextInput::updatePanelState(bool state)
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- priv->updatePanelState(state);
-}
-
-void DSWaylandTextInput::setGeometryUpdated(bool updated)
-{
- __geometryUpdated = updated;
-}
-
-DSWaylandSurface* DSWaylandTextInput::getClientSurface()
-{
- DS_GET_PRIV(DSWaylandTextInput);
-
- return priv->__clientSurface;
-}
-/*LCOV_EXCL_STOP*/
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TEXT_INPUT_H__
-#define __DS_WAYLAND_TEXT_INPUT_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSWaylandTextInputManager.h"
-
-namespace display_server
-{
-
-class DSWaylandTextInputPrivate;
-class DSTextInputPrivate;
-class DSWaylandSurface;
-
-class DS_DECL_EXPORT DSWaylandTextInput : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTextInput);
-public:
- DSWaylandTextInput(DSWaylandCompositor *compositor, DSWaylandTextInputManager *textInputManager);
- DSWaylandTextInput(DSWaylandCompositor *compositor, DSWaylandTextInputManager *textInputManager, DSTextInputPrivate *dsTextInputPrivate);
- ~DSWaylandTextInput() override;
-
- void createGlobal(void *client, unsigned int managerId, int id);
- void showInputPanel();
- void hideInputPanel();
-
- void sendCommitString(unsigned int serial, std::string text);
- void sendPreeditString(unsigned int serial, std::string text, std::string commit);
- void sendPreeditStyling(int index, unsigned int length, unsigned int style);
- void sendPreeditCursor(int index);
- void sendDeleteSurroundingText(int index, unsigned int length);
- void sendCursorPosition(int index, int anchor);
- void sendModifiersMap(std::string map);
- void sendKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers);
- void sendLanguage(unsigned int serial, std::string language);
- void sendTextDirection(unsigned int serial, unsigned int direction);
- void sendSelectionRegion(unsigned int serial, int start, int end);
- void sendPrivateCommand(unsigned int serial, std::string command);
- void sendInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength);
- void sendGetSelectionText(int fd);
- void sendGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd);
- void sendFilterKeyEventDone(unsigned int serial, unsigned int state);
- void sendInputPanelGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int height);
- void sendRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit);
- void sendInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value);
- void sendCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes);
-
- void updatePanelState(bool state);
- void setGeometryUpdated(bool updated);
- DSWaylandSurface* getClientSurface();
-
-protected:
-
-private:
- DSWaylandCompositor *__compositor;
- DSWaylandTextInputManager *__textInputManager;
- DSTextInputPrivate *__dsTextInputPrivate;
- bool __geometryUpdated;
-};
-
-}
-
-#endif //__DS_WAYLAND_TEXT_INPUT_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TEXT_INPUT_MANAGER_H__
-#define __DS_WAYLAND_TEXT_INPUT_MANAGER_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSWaylandCompositor.h"
-#include "DSTextInputPrivate.h"
-
-namespace display_server
-{
-
-class DSWaylandTextInputManagerPrivate;
-class DSWaylandTextInput;
-class DSWaylansSurface;
-
-class DS_DECL_EXPORT DSWaylandTextInputManager : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTextInputManager);
-public:
- DSWaylandTextInputManager(DSWaylandCompositor *compositor);
- DSWaylandTextInputManager(DSWaylandCompositor *compositor, DSTextInputPrivate *dsTextInputPrivate);
- ~DSWaylandTextInputManager() override;
-
- void createTextInput(void *client, unsigned int managerId);
- int allocTextInputId();
-
- void contextCommitString(unsigned int serial, std::string text);
- void contextPreeditString(unsigned int serial, std::string text, std::string commit);
- void contextPreeditStyling(int index, unsigned int length, unsigned int style);
- void contextPreeditCursor(int index);
- void contextDeleteSurroundingText(int index, unsigned int length);
- void contextCursorPosition(int index, int anchor);
- void contextModifiersMap(std::string map);
- void contextKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers);
- void contextLanguage(unsigned int serial, std::string language);
- void contextTextDirection(unsigned int serial, unsigned int direction);
- void contextSelectionRegion(unsigned int serial, int start, int end);
- void contextPrivateCommand(unsigned int serial, std::string command);
- void contextUpdateInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength);
- void contextShowInputPanel();
- void contextHideInputPanel();
- void contextGetSelectionText(int fd);
- void contextGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd);
- void contextFilterKeyEventDone(unsigned int serial, unsigned int state);
- void contextUpdateIseGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int height);
- void contextRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit);
- void contextInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value);
- void contextCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes);
-
- void updateTextInputPanelState(bool state);
- void setGeometryUpdated(bool updated);
- DSWaylandSurface* getTextInputSurface();
-
-protected:
-
-private:
- DSTextInputPrivate *__dsTextInputPrivate;
- DSWaylandCompositor *__compositor;
- DSWaylandTextInput *__textInput;
- int __textInputId;
-};
-
-}
-
-#endif //__DS_WAYLAND_TEXT_INPUT_MANAGER_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TEXT_INPUT_MANAGER_PRIVATE_H__
-#define __DS_WAYLAND_TEXT_INPUT_MANAGER_PRIVATE_H__
-
-#include "dswayland-server-text.h"
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "DSWaylandTextInputManager.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DS_DECL_EXPORT DSWaylandTextInputManagerPrivate : public DSObjectPrivate, public DSWaylandServer::wl_text_input_manager
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTextInputManager);
-public:
- DSWaylandTextInputManagerPrivate(DSWaylandTextInputManager *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandTextInputManagerPrivate() override;
-
-protected:
- void text_input_manager_create_text_input(Resource *resource, uint32_t id);
-
-private:
- DSWaylandCompositor *__compositor;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_TEXT_INPUT_MANAGER_PRIVATE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TEXT_INPUT_PRIVATE_H__
-#define __DS_WAYLAND_TEXT_INPUT_PRIVATE_H__
-
-#include "dswayland-server-text.h"
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "DSWaylandTextInput.h"
-
-namespace display_server
-{
-
-class DSWaylandSurface;
-
-class DS_DECL_EXPORT DSWaylandTextInputPrivate : public DSObjectPrivate, public DSWaylandServer::wl_text_input
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTextInput);
-public:
- DSWaylandTextInputPrivate(DSWaylandTextInput *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandTextInputPrivate() override;
-
- void createGlobal(void *client, unsigned int managerId, int id);
- int getResourceId(Resource *resource);
- void showInputPanel(void *resource);
- void hideInputPanel(Resource *resource, bool forceHide);
-
- void sendCommitString(unsigned int serial, std::string text);
- void sendPreeditString(unsigned int serial, std::string text, std::string commit);
- void sendPreeditStyling(int index, unsigned int length, unsigned int style);
- void sendPreeditCursor(int index);
- void sendDeleteSurroundingText(int index, unsigned int length);
- void sendCursorPosition(int index, int anchor);
- void sendModifiersMap(std::string map);
- void sendKeysym(unsigned int serial, unsigned int time, unsigned int sym, unsigned int state, unsigned int modifiers);
- void sendLanguage(unsigned int serial, std::string language);
- void sendTextDirection(unsigned int serial, unsigned int direction);
- void sendSelectionRegion(unsigned int serial, int start, int end);
- void sendPrivateCommand(unsigned int serial, std::string command);
- void sendInputPanelData(unsigned int serial, std::string inputPanelData, unsigned int inputPanelDataLength);
- void sendGetSelectionText(int fd);
- void sendGetSurroundingText(unsigned int maxlenBefore, unsigned int maxlenAfter, int fd);
- void sendFilterKeyEventDone(unsigned int serial, unsigned int state);
- void sendInputPanelGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int height);
- void sendRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit);
- void sendInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value);
- void sendCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes);
- void updatePanelState(bool state);
- void updatePanelGeometry(DSWaylandSurface *wlSurface);
-
-protected:
- void text_input_destroy(Resource *resource);
- void text_input_activate(Resource *resource, struct ::wl_resource *seat, struct ::wl_resource *surface);
- void text_input_deactivate(Resource *resource, struct ::wl_resource *seat);
- void text_input_show_input_panel(Resource *resource);
- void text_input_hide_input_panel(Resource *resource);
- void text_input_reset(Resource *resource);
- void text_input_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose);
- void text_input_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- void text_input_set_preferred_language(Resource *resource, const std::string &language);
- void text_input_commit_state(Resource *resource, uint32_t serial);
- void text_input_invoke_action(Resource *resource, uint32_t button, uint32_t index);
- void text_input_set_return_key_type(Resource *resource, uint32_t return_key_type);
- void text_input_set_return_key_disabled(Resource *resource, uint32_t return_key_disabled);
- void text_input_set_input_panel_data(Resource *resource, const std::string &input_panel_data, uint32_t input_panel_length);
- void text_input_bidi_direction(Resource *resource, uint32_t direction);
- void text_input_set_cursor_position(Resource *resource, uint32_t cursor_position);
- void text_input_process_input_device_event(Resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length);
- void text_input_filter_key_event(Resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode);
- void text_input_get_hide_permission(Resource *resource);
- void text_input_set_capital_mode(Resource *resource, uint32_t mode);
- void text_input_prediction_hint(Resource *resource, const std::string &text);
- void text_input_set_mime_type(Resource *resource, const std::string &type);
- void text_input_set_input_panel_position(Resource *resource, uint32_t x, uint32_t y);
- void text_input_finalize_content(Resource *resource, const std::string &text, uint32_t cursor_position);
- void text_input_prediction_hint_data(Resource *resource, const std::string &key, const std::string &value);
- void text_input_input_panel_enabled(Resource *resource, uint32_t enabled);
-
-private:
- DSWaylandCompositor *__compositor;
- std::multimap<Resource*, int> __resourceIdMap;
- struct ::wl_client *__showClient;
- Resource *__activatedResource;
- DSWaylandSurface *__clientSurface;
-};
-
-}
-
-#endif //__DS_WAYLAND_TEXT_INPUT_PRIVATE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenAppinfo.h"
-#include "DSWaylandTizenAppinfoPrivate.h"
-#include "DSTizenAppinfoMgr.h"
-
-const int TIZEN_APPINFO_VERSION = 1;
-
-namespace display_server
-{
-
-DSWaylandTizenAppinfoPrivate::DSWaylandTizenAppinfoPrivate(DSWaylandTizenAppinfo *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{
-}
-
-DSWaylandTizenAppinfoPrivate::~DSWaylandTizenAppinfoPrivate()
-{
-}
-
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_initialize(DSWaylandCompositor *wlCompositor)
-{
- ::wl_display *display;
- display = wlCompositor->display();
-
- init(display, TIZEN_APPINFO_VERSION);
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_finalize(void)
-{
-}
-
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_bind_resource(Resource *resource)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_destroy_resource(Resource *resource)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
-}
-/*LCOV_EXCL_START*/
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_destroy(Resource *resource)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_register_pid(Resource *resource, uint32_t pid)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_deregister_pid(Resource *resource, uint32_t pid)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_set_appid(Resource *resource, uint32_t pid, const std::string &appid)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
-}
-
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_get_base_output_resolution(Resource *resource, uint32_t pid)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
- DS_GET_PUB(DSWaylandTizenAppinfo);
- bool result;
- int res_w, res_h;
- if (pub->__dsAppinfoMgr == nullptr)
- return;
-
- result = pub->__dsAppinfoMgr->getBaseOutputResolution(pid, &res_w, &res_h);
- if (!result) {
- /* TODO: Read configured resolution values */
- /* FIXME : get base resolution from the correct way */
- res_w = 720;
- res_h = 1280;
- }
- send_base_output_resolution_done(resource->handle, pid, res_w, res_h);
- DSLOG_DBG("TizenAppinfoPriv", "SEND base_output_resolution_done event with width(%d), height(%d)", res_w, res_h);
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_register_appid(Resource *resource, const std::string &appid)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
- DS_GET_PUB(DSWaylandTizenAppinfo);
- if (pub->__dsAppinfoMgr)
- pub->__dsAppinfoMgr->addTizenAppinfo(appid);
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_deregister_appid(Resource *resource, const std::string &appid)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
- DS_GET_PUB(DSWaylandTizenAppinfo);
- if (pub->__dsAppinfoMgr)
- pub->__dsAppinfoMgr->removeTizenAppinfo(appid);
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_set_pid(Resource *resource, const std::string &appid, uint32_t pid)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
- DS_GET_PUB(DSWaylandTizenAppinfo);
- if (pub->__dsAppinfoMgr)
- pub->__dsAppinfoMgr->updateTizenAppinfo(appid, pid);
-}
-void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_ready_metadata(Resource *resource, const std::string &appid, uint32_t pid)
-{
- DSLOG_DBG("TizenAppinfoPriv", "");
-}
-/*LCOV_EXCL_STOP*/
-
-DSWaylandTizenAppinfo::DSWaylandTizenAppinfo(DSWaylandCompositor *wlCompositor)
- : DS_INIT_PRIVATE_PTR(DSWaylandTizenAppinfo),
- __wlCompositor(wlCompositor),
- __isCreated(false),
- __isGetDSTizenAppinfoMgr(false)
-{
- this->initialize(__wlCompositor);
- __dsAppinfoMgr = DSTizenAppinfoMgr::getInstance();
- __isGetDSTizenAppinfoMgr = true;
-}
-
-DSWaylandTizenAppinfo::DSWaylandTizenAppinfo(DSWaylandCompositor *wlCompositor, DSTizenAppinfoMgr *dsAppinfoMgr)
- : DS_INIT_PRIVATE_PTR(DSWaylandTizenAppinfo),
- __wlCompositor(wlCompositor),
- __isCreated(false),
- __isGetDSTizenAppinfoMgr(false),
- __dsAppinfoMgr(dsAppinfoMgr)
-{
- this->initialize(__wlCompositor);
-}
-
-DSWaylandTizenAppinfo::~DSWaylandTizenAppinfo()
-{
- if (__isGetDSTizenAppinfoMgr)
- DSTizenAppinfoMgr::releaseInstance();
-
- if (isCreated())
- this->finalize();
-}
-
-bool DSWaylandTizenAppinfo::isCreated(void)
-{
- return __isCreated;
-}
-
-bool DSWaylandTizenAppinfo::initialize(DSWaylandCompositor *wlCompositor)
-{
- if (!wlCompositor) return false;
- if (isCreated())
- {
- DSLOG_ERR("TizenAppinfo", "Already initialized");
- return true;
- }
-
- DS_GET_PRIV(DSWaylandTizenAppinfo);
- if (!priv) return false;
-
- __wlCompositor = wlCompositor;
- __isCreated = true;
-
- priv->tizen_launch_appinfo_initialize(__wlCompositor);
-
- DSLOG_INF("TizenAppinfo", "TizenAppinfo initialized");
- return true;
-}
-
-void DSWaylandTizenAppinfo::finalize(void)
-{
- DS_GET_PRIV(DSWaylandTizenAppinfo);
- priv->tizen_launch_appinfo_finalize();
-
- DSLOG_INF("TizenAppinfo", "TizenAppinfo finalized");
- __isCreated = false;
-}
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_APPINFO_H__
-#define __DS_WAYLAND_TIZEN_APPINFO_H__
-
-#include <DSObject.h>
-#include <DSCore.h>
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-class DSWaylandTizenAppinfoPrivate;
-class DSTizenAppinfoMgr;
-
-class DSWaylandTizenAppinfo : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenAppinfo);
-
-public:
- DSWaylandTizenAppinfo(DSWaylandCompositor *wlCompositor);
- DSWaylandTizenAppinfo(DSWaylandCompositor *wlCompositor, DSTizenAppinfoMgr *dsAppinfoMgr);
- virtual ~DSWaylandTizenAppinfo();
-
- bool isCreated(void);
-
- bool initialize(DSWaylandCompositor *wlCompositor);
- void finalize(void);
-
-private:
- DSWaylandCompositor *__wlCompositor;
- bool __isCreated;
- bool __isGetDSTizenAppinfoMgr;
- DSTizenAppinfoMgr *__dsAppinfoMgr;
-
-};
-
-}
-
-#endif // __DS_WAYLAND_TIZEN_APPINFO_H__
-
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_APPINFO_PRIVATE_H__
-#define __DS_WAYLAND_TIZEN_APPINFO_PRIVATE_H__
-
-#include "dswayland-server-tizen-launch.h"
-
-#include "DSWaylandTizenAppinfo.h"
-
-namespace display_server
-{
-
-class DS_DECL_EXPORT DSWaylandTizenAppinfoPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_launch_appinfo
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenAppinfo);
-
-public:
- DSWaylandTizenAppinfoPrivate() = delete;
- DSWaylandTizenAppinfoPrivate(DSWaylandTizenAppinfo *p_ptr);
- ~DSWaylandTizenAppinfoPrivate() override;
-
- void tizen_launch_appinfo_initialize(DSWaylandCompositor *wlCompositor);
- void tizen_launch_appinfo_finalize(void);
-
-protected:
- void tizen_launch_appinfo_bind_resource(Resource *resource) override;
- void tizen_launch_appinfo_destroy_resource(Resource *resource) override;
-
- void tizen_launch_appinfo_destroy(Resource *resource) override;
- void tizen_launch_appinfo_register_pid(Resource *resource, uint32_t pid) override;
- void tizen_launch_appinfo_deregister_pid(Resource *resource, uint32_t pid) override;
- void tizen_launch_appinfo_set_appid(Resource *resource, uint32_t pid, const std::string &appid) override;
- void tizen_launch_appinfo_get_base_output_resolution(Resource *resource, uint32_t pid) override;
- void tizen_launch_appinfo_register_appid(Resource *resource, const std::string &appid) override;
- void tizen_launch_appinfo_deregister_appid(Resource *resource, const std::string &appid) override;
- void tizen_launch_appinfo_set_pid(Resource *resource, const std::string &appid, uint32_t pid) override;
- void tizen_launch_appinfo_ready_metadata(Resource *resource, const std::string &appid, uint32_t pid) override;
-
-private:
-
-};
-
-}
-
-#endif // __DS_WAYLAND_TIZEN_APPINFO_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenIndicator.h"
-#include "DSWaylandTizenIndicatorPrivate.h"
-
-namespace display_server
-{
-
-DSWaylandTizenIndicator::DSWaylandTizenIndicator()
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandTizenIndicator)
-{
-}
-
-DSWaylandTizenIndicator::~DSWaylandTizenIndicator()
-{
-}
-
-void DSWaylandTizenIndicator::setVisibleType(visible_type type)
-{
- DS_GET_PRIV(DSWaylandTizenIndicator);
-
- priv->setVisibleType(type);
-}
-DSWaylandTizenIndicator::visible_type DSWaylandTizenIndicator::getVisibleType()
-{
- DS_GET_PRIV(DSWaylandTizenIndicator);
-
- return priv->getVisibleType();
-}
-
-
-DSWaylandTizenIndicatorPrivate::DSWaylandTizenIndicatorPrivate(DSWaylandTizenIndicator *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __vis_type(DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_UNKNOWN)
-{
-}
-
-DSWaylandTizenIndicatorPrivate::~DSWaylandTizenIndicatorPrivate()
-{
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandTizenIndicatorPrivate::tizen_indicator_bind_resource(Resource *resource)
-{
-}
-void DSWaylandTizenIndicatorPrivate::tizen_indicator_destroy_resource(Resource *resource)
-{
-}
-void DSWaylandTizenIndicatorPrivate::tizen_indicator_destroy(Resource *resource)
-{
-}
-void DSWaylandTizenIndicatorPrivate::tizen_indicator_set_state(Resource *resource, struct ::wl_resource *surface, int32_t state)
-{
-}
-void DSWaylandTizenIndicatorPrivate::tizen_indicator_set_opacity_mode(Resource *resource, struct ::wl_resource *surface, int32_t mode)
-{
-}
-void DSWaylandTizenIndicatorPrivate::tizen_indicator_set_visible_type(Resource *resource, struct ::wl_resource *surface, int32_t type)
-{
- DSWaylandTizenIndicator::visible_type vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_UNKNOWN;
-
- if (type == DSWaylandServer::tizen_indicator::visible_type_hidden)
- vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_HIDDEN;
- else
- vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN;
-
- this->setVisibleType(vtype);
-}
-/*LCOV_EXCL_STOP*/
-
-void DSWaylandTizenIndicatorPrivate::setVisibleType(DSWaylandTizenIndicator::visible_type type)
-{
- this->__vis_type = type;
-}
-
-DSWaylandTizenIndicator::visible_type DSWaylandTizenIndicatorPrivate::getVisibleType()
-{
- return this->__vis_type;
-}
-
-
-} // namespace display_server
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_INDICATOR_H__
-#define __DS_WAYLAND_TIZEN_INDICATOR_H__
-
-#include <DSObject.h>
-#include <DSCore.h>
-
-namespace display_server
-{
-
-class DSWaylandTizenIndicatorPrivate;
-
-class DSWaylandTizenIndicator : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenIndicator);
-
-public:
-
- enum visible_type {
- DS_INDICATOR_VISIBLE_TYPE_UNKNOWN = -1,
- DS_INDICATOR_VISIBLE_TYPE_SHOWN,
- DS_INDICATOR_VISIBLE_TYPE_HIDDEN,
- };
-
- DSWaylandTizenIndicator();
- virtual ~DSWaylandTizenIndicator();
-
- void setVisibleType(visible_type type);
- visible_type getVisibleType();
-};
-
-}
-
-#endif // __DS_WAYLAND_TIZEN_INDICATOR_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_INDICATOR_PRIVATE_H__
-#define __DS_WAYLAND_TIZEN_INDICATOR_PRIVATE_H__
-
-#include "dswayland-server-tizen-extension.h"
-#include "DSWaylandTizenIndicator.h"
-
-namespace display_server
-{
-
-class DS_DECL_EXPORT DSWaylandTizenIndicatorPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_indicator
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenIndicator);
-
-public:
- DSWaylandTizenIndicatorPrivate() = delete;
- DSWaylandTizenIndicatorPrivate(DSWaylandTizenIndicator *p_ptr);
- ~DSWaylandTizenIndicatorPrivate() override;
-
-protected:
- void tizen_indicator_bind_resource(Resource *resource) override;
- void tizen_indicator_destroy_resource(Resource *resource) override;
-
- void tizen_indicator_destroy(Resource *resource) override;
- void tizen_indicator_set_state(Resource *resource, struct ::wl_resource *surface, int32_t state) override;
- void tizen_indicator_set_opacity_mode(Resource *resource, struct ::wl_resource *surface, int32_t mode) override;
- void tizen_indicator_set_visible_type(Resource *resource, struct ::wl_resource *surface, int32_t type) override;
-
- void setVisibleType(DSWaylandTizenIndicator::visible_type type);
- DSWaylandTizenIndicator::visible_type getVisibleType();
-
-private:
- DSWaylandTizenIndicator::visible_type __vis_type;
-};
-
-}
-
-#endif // __DS_WAYLAND_TIZEN_INDICATOR_PRIVATE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_INPUT_DEVICE_H_
-#define _DS_WAYLAND_TIZEN_INPUT_DEVICE_H_
-
-#include <DSObject.h>
-#include <DSCore.h>
-#include <DSWaylandTizenInputDeviceManager.h>
-#include <DSInput.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenInputDevicePrivate;
-
-class DSWaylandTizenInputDevice : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenInputDevice);
-public:
- DSWaylandTizenInputDevice(DSWaylandTizenInputDeviceManager *tzInputDeviceManager);
- virtual ~DSWaylandTizenInputDevice();
-
- void *addDevice(void *client, DSInputDevice *device);
- void sendDeviceInfo(void *resource, DSInputDevice *device);
-
-private:
- DSWaylandTizenInputDeviceManager *__tzInputDeviceManager;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenInputDeviceManager.h"
-#include "DSWaylandTizenInputDeviceManagerPrivate.h"
-#include "DSWaylandTizenInputDevice.h"
-#include "DSWaylandTizenInputDevicePrivate.h"
-
-namespace display_server
-{
-
-DSWaylandTizenInputDeviceManagerPrivate::DSWaylandTizenInputDeviceManagerPrivate(DSWaylandTizenInputDeviceManager *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __display(nullptr)
-{
-}
-
-DSWaylandTizenInputDeviceManagerPrivate::~DSWaylandTizenInputDeviceManagerPrivate()
-{
-}
-
-void DSWaylandTizenInputDeviceManagerPrivate::createGlobal(struct ::wl_display *display)
-{
- __display = display;
-
- tizen_input_device_manager::init(__display, 3);
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandTizenInputDeviceManagerPrivate::handleDeviceAdd(DSInputDevice *device)
-{
- DS_GET_PUB(DSWaylandTizenInputDeviceManager);
- std::multimap<struct ::wl_client*, Resource*>::iterator it;
- std::multimap<struct ::wl_client*, Resource*> _resourceMap = resourceMap();
- DSWaylandTizenInputDevice *tzInputDevice = pub->getTizenInputDevice();
- for (it = _resourceMap.begin() ; it != _resourceMap.end() ; it++)
- {
- Resource *managerResource = (*it).second;
- struct ::wl_resource *deviceResource = (struct ::wl_resource *)tzInputDevice->addDevice((void *)managerResource->client(), device);
- send_device_add(managerResource->handle, pub->getCompositor()->nextSerial(), device->getIdentifier(), deviceResource, NULL);
- tzInputDevice->sendDeviceInfo((void *)deviceResource, device);
- }
-}
-
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_bind_resource(tizen_input_device_manager::Resource *resource)
-{
-}
-
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_destroy_resource(tizen_input_device_manager::Resource *resource)
-{
-}
-
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_block_events(tizen_input_device_manager::Resource *resource, uint32_t serial, uint32_t clas, uint32_t duration)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_unblock_events(tizen_input_device_manager::Resource *resource, uint32_t serial)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_init_generator(tizen_input_device_manager::Resource *resource, uint32_t clas)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_deinit_generator(tizen_input_device_manager::Resource *resource, uint32_t clas)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_generate_key(tizen_input_device_manager::Resource *resource, const std::string &keyname, uint32_t pressed)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_generate_pointer(tizen_input_device_manager::Resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t button)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_generate_touch(tizen_input_device_manager::Resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t finger)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_pointer_warp(tizen_input_device_manager::Resource *resource, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_init_generator_with_name(tizen_input_device_manager::Resource *resource, uint32_t clas, const std::string &name)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_destroy(tizen_input_device_manager::Resource *resource)
-{
-}
-void DSWaylandTizenInputDeviceManagerPrivate::tizen_input_device_manager_generate_axis(tizen_input_device_manager::Resource *resource, uint32_t type, wl_fixed_t value)
-{
-}
-/*LCOV_EXCL_STOP*/
-
-
-DSWaylandTizenInputDeviceManager::DSWaylandTizenInputDeviceManager(DSWaylandCompositor *compositor)
- : DS_INIT_PRIVATE_PTR(DSWaylandTizenInputDeviceManager)
-{
- DS_GET_PRIV(DSWaylandTizenInputDeviceManager);
-
- __compositor = compositor;
- priv->createGlobal(compositor->display());
-
- __tzInputDevice = new DSWaylandTizenInputDevice(this);
-}
-
-DSWaylandTizenInputDeviceManager::~DSWaylandTizenInputDeviceManager()
-{
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandTizenInputDeviceManager::slotDeviceAdd(std::shared_ptr<DSInputDevice> device)
-{
- DS_GET_PRIV(DSWaylandTizenInputDeviceManager);
- std::cout << "DSWaylandTizenInputDeviceManager slotDeviceAdd!" << std::endl;
- device->print();
-
- priv->handleDeviceAdd(device.get());
-}
-
-void DSWaylandTizenInputDeviceManager::slotDeviceRemove(std::shared_ptr<DSInputDevice> device)
-{
- std::cout << "DSWaylandTizenInputDeviceManager slotDeviceRemove!" << std::endl;
- device->print();
-}
-/*LCOV_EXCL_STOP*/
-
-DSWaylandTizenInputDevicePrivate::DSWaylandTizenInputDevicePrivate(DSWaylandTizenInputDevice *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{
-}
-
-DSWaylandTizenInputDevicePrivate::~DSWaylandTizenInputDevicePrivate()
-{
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandTizenInputDevicePrivate::tizen_input_device_select_axes(Resource *resource, wl_array *axes)
-{
-}
-
-void DSWaylandTizenInputDevicePrivate::tizen_input_device_release(Resource *resource)
-{
-}
-
-void *DSWaylandTizenInputDevicePrivate::addDevice(void *client, DSInputDevice *device)
-{
- Resource *resource;
-
- resource = add((struct ::wl_client *)client, 1);
-
- return (void *)resource->handle;
-}
-
-void DSWaylandTizenInputDevicePrivate::sendDeviceInfo(void *resource, DSInputDevice *device)
-{
- struct ::wl_array axes;
- wl_array_init(&axes);
-
- send_device_info((struct ::wl_resource *)resource, device->getName(), (uint32_t)device->getClass(), (uint32_t)device->getSubclass(), &axes);
-
- wl_array_release(&axes);
-}
-/*LCOV_EXCL_STOP*/
-
-DSWaylandTizenInputDevice::DSWaylandTizenInputDevice(DSWaylandTizenInputDeviceManager *tzInputDeviceManager)
- : DS_INIT_PRIVATE_PTR(DSWaylandTizenInputDevice),
- __tzInputDeviceManager(tzInputDeviceManager)
-{
-}
-
-DSWaylandTizenInputDevice::~DSWaylandTizenInputDevice()
-{
-}
-
-/*LCOV_EXCL_START*/
-void *DSWaylandTizenInputDevice::addDevice(void *client, DSInputDevice *device)
-{
- DS_GET_PRIV(DSWaylandTizenInputDevice);
- void *resource;
-
- resource = priv->addDevice(client, device);
- return resource;
-}
-
-void DSWaylandTizenInputDevice::sendDeviceInfo(void *resource, DSInputDevice *device)
-{
- DS_GET_PRIV(DSWaylandTizenInputDevice);
-
- priv->sendDeviceInfo(resource, device);
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_INPUT_DEVICE_MANAGER_H_
-#define _DS_WAYLAND_TIZEN_INPUT_DEVICE_MANAGER_H_
-
-#include <DSObject.h>
-#include <DSCore.h>
-#include <DSWaylandCompositor.h>
-#include <DSInput.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenInputDeviceManagerPrivate;
-class DSWaylandTizenInputDevice;
-
-class DSWaylandTizenInputDeviceManager : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenInputDeviceManager);
-public:
- DSWaylandTizenInputDeviceManager(DSWaylandCompositor *compositor);
- virtual ~DSWaylandTizenInputDeviceManager();
-
- void slotDeviceAdd(std::shared_ptr<DSInputDevice> device);
- void slotDeviceRemove(std::shared_ptr<DSInputDevice> device);
-
- DSWaylandCompositor *getCompositor() { return __compositor; }
- DSWaylandTizenInputDevice *getTizenInputDevice() { return __tzInputDevice; }
-
-private:
- DSWaylandCompositor *__compositor;
- DSWaylandTizenInputDevice *__tzInputDevice;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_INPUT_DEVICE_MANAGER_PRIVATE_H_
-#define _DS_WAYLAND_TIZEN_INPUT_DEVICE_MANAGER_PRIVATE_H_
-
-#include "dswayland-server-tizen-extension.h"
-#include "DSWaylandTizenInputDeviceManager.h"
-#include <list>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenInputDeviceManagerPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_input_device_manager
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenInputDeviceManager);
-public:
- DSWaylandTizenInputDeviceManagerPrivate() = delete;
- DSWaylandTizenInputDeviceManagerPrivate(DSWaylandTizenInputDeviceManager *p_ptr);
- ~DSWaylandTizenInputDeviceManagerPrivate() override;
-
- void createGlobal(struct ::wl_display *display);
- void handleDeviceAdd(DSInputDevice *device);
-
-protected:
- void tizen_input_device_manager_bind_resource(Resource *resource) override;
- void tizen_input_device_manager_destroy_resource(Resource *resource) override;
-
- void tizen_input_device_manager_block_events(Resource *resource, uint32_t serial, uint32_t clas, uint32_t duration) override;
- void tizen_input_device_manager_unblock_events(Resource *resource, uint32_t serial) override;
- void tizen_input_device_manager_init_generator(Resource *resource, uint32_t clas) override;
- void tizen_input_device_manager_deinit_generator(Resource *resource, uint32_t clas) override;
- void tizen_input_device_manager_generate_key(Resource *resource, const std::string &keyname, uint32_t pressed) override;
- void tizen_input_device_manager_generate_pointer(Resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t button) override;
- void tizen_input_device_manager_generate_touch(Resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t finger) override;
- void tizen_input_device_manager_pointer_warp(Resource *resource, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y) override;
- void tizen_input_device_manager_init_generator_with_name(Resource *resource, uint32_t clas, const std::string &name) override;
- void tizen_input_device_manager_destroy(Resource *resource) override;
- void tizen_input_device_manager_generate_axis(Resource *resource, uint32_t type, wl_fixed_t value) override;
-
-private:
- struct ::wl_display *__display;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_INPUT_DEVICE_PRIVATE_H_
-#define _DS_WAYLAND_TIZEN_INPUT_DEVICE_PRIVATE_H_
-
-#include "dswayland-server-tizen-extension.h"
-#include "DSWaylandTizenInputDevice.h"
-
-namespace display_server
-{
-
-class DSWaylandTizenInputDevicePrivate : public DSObjectPrivate, public DSWaylandServer::tizen_input_device
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenInputDevice);
-public:
- DSWaylandTizenInputDevicePrivate() = delete;
- DSWaylandTizenInputDevicePrivate(DSWaylandTizenInputDevice *p_ptr);
- ~DSWaylandTizenInputDevicePrivate() override;
-
- void *addDevice(void *client, DSInputDevice *device);
- void sendDeviceInfo(void *resource, DSInputDevice *device);
-
-protected:
- void tizen_input_device_select_axes(Resource *resource, wl_array *axes) override;
- void tizen_input_device_release(Resource *resource) override;
-
-private:
- /* data */
-};
-
-}
-
-#endif
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenLaunchEffect.h"
-#include "DSWaylandTizenLaunchEffectPrivate.h"
-#include "DSWaylandTizenLaunchSplash.h"
-#include "DSWaylandClient.h"
-
-const int TIZEN_LAUNCH_EFFECT_VERSION = 1;
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-DSWaylandTizenLaunchEffectPrivate::DSWaylandTizenLaunchEffectPrivate(DSWaylandTizenLaunchEffect *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{
-}
-
-DSWaylandTizenLaunchEffectPrivate::~DSWaylandTizenLaunchEffectPrivate()
-{
-}
-
-void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_initialize(DSWaylandCompositor *wlCompositor)
-{
- ::wl_display *display;
- display = wlCompositor->display();
-
- init(display, TIZEN_LAUNCH_EFFECT_VERSION);
-}
-
-void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_finalize(void)
-{
-
-}
-
-void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_bind_resource(Resource *resource)
-{
- DSLOG_DBG("TizenLaunchEffectPriv", "");
-}
-void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_destroy_resource(Resource *resource)
-{
- DSLOG_DBG("TizenLaunchEffectPriv", "");
-}
-void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_create_splash_img(Resource *resource, uint32_t id)
-{
- DSLOG_DBG("TizenLaunchEffectPriv", "");
-
- DSWaylandClient *waylandClient = DSWaylandClient::fromWlClient(resource->client());
- std::shared_ptr<DSWaylandTizenLaunchSplash> tzSplash = std::make_shared<DSWaylandTizenLaunchSplash>(waylandClient, id, TIZEN_LAUNCH_EFFECT_VERSION);
- __tzSplashList.push_front(tzSplash);
-}
-void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, struct ::wl_array *options)
-{
- DSLOG_DBG("TizenLaunchEffectPriv", "");
-}
-void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_type_unset(Resource *resource, uint32_t pid)
-{
- DSLOG_DBG("TizenLaunchEffectPriv", "");
-}
-void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_destroy(Resource *resource)
-{
- DSLOG_DBG("TizenLaunchEffectPriv", "");
-}
-
-DSWaylandTizenLaunchEffect::DSWaylandTizenLaunchEffect(DSWaylandCompositor *wlCompositor)
- : DS_INIT_PRIVATE_PTR(DSWaylandTizenLaunchEffect),
- __wlCompositor(wlCompositor),
- __isCreated(false)
-{
- this->initialize(__wlCompositor);
-}
-
-DSWaylandTizenLaunchEffect::~DSWaylandTizenLaunchEffect()
-{
- if (isCreated())
- this->finalize();
-}
-
-bool DSWaylandTizenLaunchEffect::isCreated(void)
-{
- return __isCreated;
-}
-
-bool DSWaylandTizenLaunchEffect::initialize(DSWaylandCompositor *wlCompositor)
-{
- if (!wlCompositor) return false;
- if (isCreated())
- {
- DSLOG_ERR("TizenLaunchEffect", "Already initialized");
- return true;
- }
-
- DS_GET_PRIV(DSWaylandTizenLaunchEffect);
- if (!priv) return false;
-
- __wlCompositor = wlCompositor;
- __isCreated = true;
-
- priv->tizen_launch_effect_initialize(__wlCompositor);
-
- DSLOG_INF("TizenLaunchEffect", "TizenLaunchEffect initialized");
- return true;
-}
-
-void DSWaylandTizenLaunchEffect::finalize(void)
-{
- DS_GET_PRIV(DSWaylandTizenLaunchEffect);
- priv->tizen_launch_effect_finalize();
-
- DSLOG_INF("TizenLaunchEffect", "TizenLaunchEffect finalized");
- __isCreated = false;
-}
-/*LCOV_EXCL_STOP*/
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_LAUNCHEFFECT_H__
-#define __DS_WAYLAND_TIZEN_LAUNCHEFFECT_H__
-
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenLaunchEffectPrivate;
-
-class DSWaylandTizenLaunchEffect : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenLaunchEffect);
-
-public:
- DSWaylandTizenLaunchEffect(DSWaylandCompositor *wlCompositor);
- virtual ~DSWaylandTizenLaunchEffect();
-
- bool isCreated(void);
-
- bool initialize(DSWaylandCompositor *wlCompositor);
- void finalize(void);
-
-private:
- DSWaylandCompositor *__wlCompositor;
- bool __isCreated;
-
-};
-/*LCOV_EXCL_STOP*/
-
-}
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_LAUNCHEFFECT_PRIVATE_H__
-#define __DS_WAYLAND_TIZEN_LAUNCHEFFECT_PRIVATE_H__
-
-#include "dswayland-server-tizen-launch.h"
-
-#include "DSWaylandTizenLaunchEffect.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenLaunchSplash;
-
-class DS_DECL_EXPORT DSWaylandTizenLaunchEffectPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_launch_effect
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenLaunchEffect);
-
-public:
- DSWaylandTizenLaunchEffectPrivate() = delete;
- DSWaylandTizenLaunchEffectPrivate(DSWaylandTizenLaunchEffect *p_ptr);
- ~DSWaylandTizenLaunchEffectPrivate() override;
-
- void tizen_launch_effect_initialize(DSWaylandCompositor *wlCompositor);
- void tizen_launch_effect_finalize(void);
-
-protected:
- void tizen_launch_effect_bind_resource(Resource *resource);
- void tizen_launch_effect_destroy_resource(Resource *resource);
-
- void tizen_launch_effect_create_splash_img(Resource *resource, uint32_t id);
- void tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, struct ::wl_array *options);
- void tizen_launch_effect_type_unset(Resource *resource, uint32_t pid);
- void tizen_launch_effect_destroy(Resource *resource);
-
-private:
- std::list<std::shared_ptr<DSWaylandTizenLaunchSplash>> __tzSplashList;
-
-};
-/*LCOV_EXCL_STOP*/
-
-}
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenLaunchSplash.h"
-#include "DSWaylandTizenLaunchSplashPrivate.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-DSWaylandTizenLaunchSplashPrivate::DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{}
-
-DSWaylandTizenLaunchSplashPrivate::~DSWaylandTizenLaunchSplashPrivate()
-{}
-
-void DSWaylandTizenLaunchSplashPrivate::init(DSWaylandClient *waylandClient, uint32_t id, int version)
-{
- if (id > 0) {
- tizen_launch_splash::init(waylandClient->wlClient(), (int)id, version);
- }
-}
-
-void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_bind_resource(Resource *resource)
-{}
-void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_destroy_resource(Resource *resource)
-{}
-
-void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_destroy(Resource *resource)
-{}
-void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options)
-{}
-void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_owner(Resource *resource, uint32_t pid)
-{}
-void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_launch_v2(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options, struct ::wl_array *extra_config)
-{}
-
-DSWaylandTizenLaunchSplash::DSWaylandTizenLaunchSplash(DSWaylandClient *waylandClient, uint32_t id, int version)
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandTizenLaunchSplash)
-{
- DS_GET_PRIV(DSWaylandTizenLaunchSplash);
- priv->init(waylandClient, id, version);
-}
-
-DSWaylandTizenLaunchSplash::~DSWaylandTizenLaunchSplash()
-{}
-/*LCOV_EXCL_STOP*/
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_LAUNCHSPLASH_H__
-#define __DS_WAYLAND_TIZEN_LAUNCHSPLASH_H__
-
-#include "DSWaylandClient.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenLaunchSplashPrivate;
-
-class DSWaylandTizenLaunchSplash : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenLaunchSplash);
-
-public:
- DSWaylandTizenLaunchSplash(DSWaylandClient *waylandClient, uint32_t id, int version);
- ~DSWaylandTizenLaunchSplash() override;
-
-private:
-
-};
-/*LCOV_EXCL_STOP*/
-
-}
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_LAUNCHSPLASH_PRIVATE_H__
-#define __DS_WAYLAND_TIZEN_LAUNCHSPLASH_PRIVATE_H__
-
-#include "dswayland-server-tizen-launch.h"
-
-#include "DSWaylandTizenLaunchSplash.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenLaunchSplash;
-
-class DS_DECL_EXPORT DSWaylandTizenLaunchSplashPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_launch_splash
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenLaunchSplash);
-
-public:
- DSWaylandTizenLaunchSplashPrivate() = delete;
- DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr);
- ~DSWaylandTizenLaunchSplashPrivate() override;
-
- void init(DSWaylandClient *waylandClient, uint32_t id, int version);
-
-protected:
- void tizen_launch_splash_bind_resource(Resource *resource);
- void tizen_launch_splash_destroy_resource(Resource *resource);
-
- void tizen_launch_splash_destroy(Resource *resource);
- void tizen_launch_splash_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options);
- void tizen_launch_splash_owner(Resource *resource, uint32_t pid);
- void tizen_launch_splash_launch_v2(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options, struct ::wl_array *extra_config);
-
-private:
-
-};
-/*LCOV_EXCL_STOP*/
-
-}
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenPolicy.h"
-#include "DSWaylandTizenPolicyPrivate.h"
-
-#include "DSWaylandTizenVisibility.h"
-#include "DSWaylandTizenPosition.h"
-
-const int TIZEN_POLICY_VERSION = 7;
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-DSWaylandTizenPolicyPrivate::DSWaylandTizenPolicyPrivate(DSWaylandTizenPolicy *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
- __wm = DSWindowManager::getInstance();
-}
-
-DSWaylandTizenPolicyPrivate::~DSWaylandTizenPolicyPrivate()
-{
- DSLOG_DBG("TizenPolicyPriv", "");
- if (__wm)
- DSWindowManager::releaseInstance();
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_initialize(DSWaylandCompositor *wlCompositor)
-{
- ::wl_display *display;
- display = wlCompositor->display();
-
- init(display, TIZEN_POLICY_VERSION);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_finalize(void)
-{
-
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_bind_resource(Resource *resource)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_destroy_resource(Resource *resource)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_get_visibility(Resource *resource, uint32_t id, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "get_visibility... resource:%p, id:%d", resource, id);
-
- std::shared_ptr<DSWaylandTizenVisibility> tzVis = std::make_shared<DSWaylandTizenVisibility>(resource->client(), id, TIZEN_POLICY_VERSION, surface);
- __tzVisList.push_front(tzVis);
-
- // TODO: we have to remove tzVis when it's resource is destroyed
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_get_position(Resource *resource, uint32_t id, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "get_position... resource:%p, id:%d", resource, id);
-
- std::shared_ptr<DSWaylandTizenPosition> tzPos = std::make_shared<DSWaylandTizenPosition>(resource->client(), id, TIZEN_POLICY_VERSION, surface);
- __tzPosList.push_front(tzPos);
-
- // TODO: we have to remove tzPos when it's resource is destroyed
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_activate(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "Request to activate. resource:%p, wl_surface:%p", resource, surface);
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->activateWindow(dswlSurface);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_activate_below_by_res_id(Resource *resource, uint32_t res_id, uint32_t below_res_id)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_raise(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "Request to raise. resource:%p, wl_surface:%p", resource, surface);
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->raiseWindow(dswlSurface);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_lower(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "Request to lower. resource:%p, wl_surface:%p", resource, surface);
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->lowerWindow(dswlSurface);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_lower_by_res_id(Resource *resource, uint32_t res_id)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_focus_skip(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "Request to skip focus. resource:%p, wl_surface:%p", resource, surface);
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->setWindowSkipFocus(dswlSurface, true);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_unset_focus_skip(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "Request to unset skip_focus. resource:%p, wl_surface:%p", resource, surface);
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->setWindowSkipFocus(dswlSurface, false);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_role(Resource *resource, struct ::wl_resource *surface, const std::string &role)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_type(Resource *resource, struct ::wl_resource *surface, uint32_t win_type)
-{
- DSLOG_DBG("TizenPolicyPriv", "tizen_policy_set_type, wl_surface:%p, type:%d", surface, win_type);
-
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->setWindowType(dswlSurface, win_type);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_conformant(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_unset_conformant(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_get_conformant(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_notification_level(Resource *resource, struct ::wl_resource *surface, int32_t level)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_transient_for(Resource *resource, uint32_t child_id, uint32_t parent_id)
-{
- DSLOG_DBG("TizenPolicyPriv", "Set Transient_for (parent_id:%d, child_id:%d)", parent_id, child_id);
- DS_GET_PUB(DSWaylandTizenPolicy);
- DSWaylandCompositor *wlComp = pub->getWlCompositor();
- if (!wlComp) return;
- if (!__wm) return;
-
- DSWaylandSurface *childSurface = wlComp->getSurface(child_id);
- DSWaylandSurface *parentSurface = wlComp->getSurface(parent_id);
-
- __wm->setWindowParent(childSurface, parentSurface);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_unset_transient_for(Resource *resource, uint32_t child_id)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_window_screen_mode(Resource *resource, struct ::wl_resource *surface, uint32_t mode)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_place_subsurface_below_parent(Resource *resource, struct ::wl_resource *subsurface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_subsurface_stand_alone(Resource *resource, struct ::wl_resource *subsurface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_get_subsurface(Resource *resource, uint32_t id, struct ::wl_resource *surface, uint32_t parent_id)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_opaque_state(Resource *resource, struct ::wl_resource *surface, int32_t state)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_iconify(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_uniconify(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_add_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &name, const std::string &value)
-{
- DSLOG_DBG("TizenPolicyPriv", "Add aux hint (id:%d, key:%s, value:%s)", id, name.c_str(), value.c_str());
-
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->addWindowAuxHint(dswlSurface, id, name, value);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_change_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &value)
-{
- DSLOG_DBG("TizenPolicyPriv", "Change aux hint (id:%d, value:%s)", id, value.c_str());
-
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->changeWindowAuxHint(dswlSurface, id, value);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_del_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id)
-{
- DSLOG_DBG("TizenPolicyPriv", "Delete aux hint (id:%d)", id);
-
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- __wm->removeWindowAuxHint(dswlSurface, id);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_get_supported_aux_hints(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "resource:%p, surface:%p", resource, surface);
-
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (!dswlSurface) return;
- if (!__wm) return;
-
- struct wl_array hints;
- int len;
- int numOfHints = 0;
- char *p;
- std::list<std::string> hints_list;
-
- hints_list = __wm->getWindowSupportedAuxHints(dswlSurface);
- numOfHints = hints_list.size();
-
- wl_array_init(&hints);
- for (std::string hintName : hints_list)
- {
- len = hintName.length() + 1;
- p = (char*)wl_array_add(&hints, len);
-
- if (p == NULL)
- break;
- hintName.copy(p, len);
- }
-
- send_supported_aux_hints(resource->handle, surface, &hints, numOfHints);
- wl_array_release(&hints);
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_background_state(Resource *resource, uint32_t pid)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_unset_background_state(Resource *resource, uint32_t pid)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_floating_mode(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_unset_floating_mode(Resource *resource, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_stack_mode(Resource *resource, struct ::wl_resource *surface, uint32_t mode)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_activate_above_by_res_id(Resource *resource, uint32_t res_id, uint32_t above_res_id)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_get_subsurface_watcher(Resource *resource, uint32_t id, struct ::wl_resource *surface)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_parent(Resource *resource, struct ::wl_resource *child, struct ::wl_resource *parent)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_ack_conformant_region(Resource *resource, struct ::wl_resource *surface, uint32_t serial)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_destroy(Resource *resource)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_has_video(Resource *resource, struct ::wl_resource *surface, uint32_t has)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-void DSWaylandTizenPolicyPrivate::tizen_policy_set_appid(Resource *resource, int32_t pid, const std::string &appid)
-{
- DSLOG_DBG("TizenPolicyPriv", "");
-}
-
-
-DSWaylandTizenPolicy::DSWaylandTizenPolicy(DSWaylandCompositor *wlCompositor)
- : DS_INIT_PRIVATE_PTR(DSWaylandTizenPolicy),
- __wlCompositor(wlCompositor),
- __isCreated(false)
-{
- this->initialize(__wlCompositor);
-}
-
-DSWaylandTizenPolicy::~DSWaylandTizenPolicy()
-{
- if (isCreated())
- this->finalize();
-}
-
-bool DSWaylandTizenPolicy::isCreated(void)
-{
- return __isCreated;
-}
-
-bool DSWaylandTizenPolicy::initialize(DSWaylandCompositor *wlCompositor)
-{
- if (!wlCompositor) return false;
- if (isCreated())
- {
- DSLOG_ERR("TizenPolicy", "Already initialized");
- return true;
- }
-
- DS_GET_PRIV(DSWaylandTizenPolicy);
- if (!priv) return false;
-
- __wlCompositor = wlCompositor;
- __isCreated = true;
-
- priv->tizen_policy_initialize(__wlCompositor);
-
- DSLOG_INF("TizenPolicy", "TizenPolicy initialized");
- return true;
-}
-
-void DSWaylandTizenPolicy::finalize(void)
-{
- DS_GET_PRIV(DSWaylandTizenPolicy);
- priv->tizen_policy_finalize();
-
- DSLOG_INF("TizenPolicy", "TizenPolicy finalized");
- __isCreated = false;
-}
-
-DSWaylandCompositor *DSWaylandTizenPolicy::getWlCompositor()
-{
- return __wlCompositor;
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_POLICY_H_
-#define _DS_WAYLAND_TIZEN_POLICY_H_
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSWaylandCompositor.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenPolicyPrivate;
-
-class DSWaylandTizenPolicy : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenPolicy)
-
-public:
- DSWaylandTizenPolicy(DSWaylandCompositor *wlCompositor);
- virtual ~DSWaylandTizenPolicy();
-
- bool isCreated(void);
-
- bool initialize(DSWaylandCompositor *wlCompositor);
- void finalize(void);
-
- DSWaylandCompositor *getWlCompositor();
-
-private:
- DSWaylandCompositor *__wlCompositor;
- bool __isCreated;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenPolicyExt.h"
-#include "DSWaylandTizenPolicyExtPrivate.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-/* DSWaylandTizenPolicyExt */
-DSWaylandTizenPolicyExtPrivate::DSWaylandTizenPolicyExtPrivate(DSWaylandTizenPolicyExt *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __resource_id_cnt(0)
-{
- if (!compositor)
- return;
-
- init(compositor->display(), 3);
-}
-
-DSWaylandTizenPolicyExtPrivate::~DSWaylandTizenPolicyExtPrivate()
-{
-}
-
-void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_destroy_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface)
-{
- DSWaylandTizenRotation *tizenRotation = nullptr;
-
- for (DSWaylandTizenRotation *temp : __rotationList)
- if (temp->getRotationSurface() == surface) return;
-
- tizenRotation = new DSWaylandTizenRotation(resource->client(), id, surface);
- if (tizenRotation == nullptr)
- {
- DSLOG_ERR("DSWaylandTizenPolicyExt", "fail get tizen resource");
- return;
- }
-
- __rotationList.push_back(tizenRotation);
-}
-
-DSWaylandTizenRotation *DSWaylandTizenPolicyExtPrivate::getTizenRotation(struct ::wl_resource *surface)
-{
- DSWaylandTizenRotation *tizenRotation = nullptr;
-
- for (DSWaylandTizenRotation *temp : __rotationList)
- {
- if (temp->getRotationSurface() == surface)
- {
- tizenRotation = temp;
- break;
- }
- }
-
- return tizenRotation;
-}
-
-void DSWaylandTizenPolicyExtPrivate::delTizenRotation(DSWaylandTizenRotation *tizenRotation)
-{
- __rotationList.remove(tizenRotation);
-}
-
-DSWaylandTizenPolicyExt::DSWaylandTizenPolicyExt(DSWaylandCompositor *compositor)
- : _d_ptr(std::make_unique<DSWaylandTizenPolicyExtPrivate>(this, compositor))
-{
-}
-
-DSWaylandTizenPolicyExt::~DSWaylandTizenPolicyExt()
-{
-}
-
-DSWaylandTizenRotation *DSWaylandTizenPolicyExt::getTizenRotation(struct ::wl_resource *surface)
-{
- DS_GET_PRIV(DSWaylandTizenPolicyExt);
-
- return priv->getTizenRotation(surface);
-}
-
-void DSWaylandTizenPolicyExt::delTizenRotation(DSWaylandTizenRotation *tizenRotation)
-{
- DS_GET_PRIV(DSWaylandTizenPolicyExt);
-
- priv->delTizenRotation(tizenRotation);
-}
-
-/* DSWaylandTizenRotation */
-DSWaylandTizenRotationPrivate::DSWaylandTizenRotationPrivate(DSWaylandTizenRotation *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __surface(surface),
- __resource_id(0)
-{
- init(client, id, 3);
-}
-
-DSWaylandTizenRotationPrivate::~DSWaylandTizenRotationPrivate()
-{
-}
-
-void DSWaylandTizenRotationPrivate::tizen_rotation_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenRotationPrivate::tizen_rotation_destroy_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenRotationPrivate::tizen_rotation_destroy(Resource *resource)
-{
-}
-
-struct ::wl_resource *DSWaylandTizenRotationPrivate::getRotationSurface(void)
-{
- return __surface;
-}
-
-DSWaylandTizenRotation::DSWaylandTizenRotation(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
- : _d_ptr(std::make_unique<DSWaylandTizenRotationPrivate>(this, client, id, surface))
-{
-}
-
-DSWaylandTizenRotation::~DSWaylandTizenRotation()
-{
-}
-
-struct ::wl_resource *DSWaylandTizenRotation::getRotationSurface(void)
-{
- DS_GET_PRIV(DSWaylandTizenRotation);
-
- return priv->getRotationSurface();
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_POLICY_EXT_H_
-#define _DS_WAYLAND_TIZEN_POLICY_EXT_H_
-
-#include <DSObject.h>
-#include <DSCore.h>
-#include <DSWaylandCompositor.h>
-#include <wayland-server-core.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenPolicyExtPrivate;
-class DSWaylandTizenRotationPrivate;
-
-class DS_DECL_EXPORT DSWaylandTizenRotation : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenRotation);
-
-public:
- DSWaylandTizenRotation(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
- virtual ~DSWaylandTizenRotation();
-
- struct ::wl_resource *getRotationSurface(void);
- void sendResourceId(void);
- void setResourceId(uint32_t tizenResourceId);
- uint32_t getResourceId(void);
-};
-
-class DS_DECL_EXPORT DSWaylandTizenPolicyExt : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenPolicyExt);
-
-public:
- DSWaylandTizenPolicyExt(DSWaylandCompositor *compositor);
- virtual ~DSWaylandTizenPolicyExt();
-
- DSWaylandTizenRotation *getTizenRotation(struct ::wl_resource *surface);
- void delTizenRotation(DSWaylandTizenRotation *resource);
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_POLICY_EXT_PRIVATE_H_
-#define _DS_WAYLAND_TIZEN_POLICY_EXT_PRIVATE_H_
-
-#include "dswayland-server-tizen-policy-ext.h"
-#include "DSWaylandTizenPolicyExt.h"
-
-namespace display_server
-{
-
-class DS_DECL_EXPORT DSWaylandTizenRotationPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_rotation
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenRotation);
-
-public:
- DSWaylandTizenRotationPrivate() = delete;
- DSWaylandTizenRotationPrivate(DSWaylandTizenRotation *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
- ~DSWaylandTizenRotationPrivate() override;
-
- struct ::wl_resource *getRotationSurface(void);
-
-protected:
- void tizen_rotation_bind_resource(Resource *resource) override;
- void tizen_rotation_destroy_resource(Resource *resource) override;
- void tizen_rotation_destroy(Resource *resource) override;
-private:
- struct ::wl_resource *__surface;
- uint32_t __resource_id;
-};
-
-class DS_DECL_EXPORT DSWaylandTizenPolicyExtPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_policy_ext
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenPolicyExt);
-
-public:
- DSWaylandTizenPolicyExtPrivate() = delete;
- DSWaylandTizenPolicyExtPrivate(DSWaylandTizenPolicyExt *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandTizenPolicyExtPrivate() override;
-
- DSWaylandTizenRotation *getTizenRotation(struct ::wl_resource *surface);
- void delTizenRotation(DSWaylandTizenRotation *resource);
-
-protected:
- void tizen_policy_ext_bind_resource(Resource *resource) override;
- void tizen_policy_ext_destroy_resource(Resource *resource) override;
- void tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
-
-private:
- std::list<DSWaylandTizenRotation *> __rotationList;
- uint32_t __resource_id_cnt; //TO DO : have to manage more proper class
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_POLICY_PRIVATE_H_
-#define _DS_WAYLAND_TIZEN_POLICY_PRIVATE_H_
-
-#include "dswayland-server-tizen-extension.h"
-#include "DSWindowManager.h"
-#include "DSWaylandTizenPolicy.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenVisibility;
-class DSWaylandTizenPosition;
-
-class DSWaylandTizenPolicyPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_policy
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenPolicy)
-
-public:
- DSWaylandTizenPolicyPrivate() = delete;
- DSWaylandTizenPolicyPrivate(DSWaylandTizenPolicy *p_ptr);
- ~DSWaylandTizenPolicyPrivate() override;
-
- void tizen_policy_initialize(DSWaylandCompositor *wlCompositor);
- void tizen_policy_finalize(void);
-
-protected:
- void tizen_policy_bind_resource(Resource *resource) override;
- void tizen_policy_destroy_resource(Resource *resource) override;
-
- void tizen_policy_get_visibility(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
- void tizen_policy_get_position(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
- void tizen_policy_activate(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_activate_below_by_res_id(Resource *resource, uint32_t res_id, uint32_t below_res_id) override;
- void tizen_policy_raise(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_lower(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_lower_by_res_id(Resource *resource, uint32_t res_id) override;
- void tizen_policy_set_focus_skip(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_unset_focus_skip(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_set_role(Resource *resource, struct ::wl_resource *surface, const std::string &role) override;
- void tizen_policy_set_type(Resource *resource, struct ::wl_resource *surface, uint32_t win_type) override;
- void tizen_policy_set_conformant(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_unset_conformant(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_get_conformant(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_set_notification_level(Resource *resource, struct ::wl_resource *surface, int32_t level) override;
- void tizen_policy_set_transient_for(Resource *resource, uint32_t child_id, uint32_t parent_id) override;
- void tizen_policy_unset_transient_for(Resource *resource, uint32_t child_id) override;
- void tizen_policy_set_window_screen_mode(Resource *resource, struct ::wl_resource *surface, uint32_t mode) override;
- void tizen_policy_place_subsurface_below_parent(Resource *resource, struct ::wl_resource *subsurface) override;
- void tizen_policy_set_subsurface_stand_alone(Resource *resource, struct ::wl_resource *subsurface) override;
- void tizen_policy_get_subsurface(Resource *resource, uint32_t id, struct ::wl_resource *surface, uint32_t parent_id) override;
- void tizen_policy_set_opaque_state(Resource *resource, struct ::wl_resource *surface, int32_t state) override;
- void tizen_policy_iconify(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_uniconify(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_add_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &name, const std::string &value) override;
- void tizen_policy_change_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &value) override;
- void tizen_policy_del_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id) override;
- void tizen_policy_get_supported_aux_hints(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_set_background_state(Resource *resource, uint32_t pid) override;
- void tizen_policy_unset_background_state(Resource *resource, uint32_t pid) override;
- void tizen_policy_set_floating_mode(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_unset_floating_mode(Resource *resource, struct ::wl_resource *surface) override;
- void tizen_policy_set_stack_mode(Resource *resource, struct ::wl_resource *surface, uint32_t mode) override;
- void tizen_policy_activate_above_by_res_id(Resource *resource, uint32_t res_id, uint32_t above_res_id) override;
- void tizen_policy_get_subsurface_watcher(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
- void tizen_policy_set_parent(Resource *resource, struct ::wl_resource *child, struct ::wl_resource *parent) override;
- void tizen_policy_ack_conformant_region(Resource *resource, struct ::wl_resource *surface, uint32_t serial) override;
- void tizen_policy_destroy(Resource *resource) override;
- void tizen_policy_has_video(Resource *resource, struct ::wl_resource *surface, uint32_t has) override;
- void tizen_policy_set_appid(Resource *resource, int32_t pid, const std::string &appid) override;
-
-private:
- DSWindowManager *__wm;
- std::list<std::shared_ptr<DSWaylandTizenPosition>> __tzPosList;
- std::list<std::shared_ptr<DSWaylandTizenVisibility>> __tzVisList;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenPosition.h"
-#include "DSWaylandTizenPositionPrivate.h"
-#include "DSWindowManager.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-DSWaylandTizenPosition::DSWaylandTizenPosition(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface)
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandTizenPosition)
-{
- DSLOG_DBG("TIZEN_POSITION", "CREATOR... TizenPosition:%p", this);
- init(client, id, version, surface);
-}
-
-DSWaylandTizenPosition::~DSWaylandTizenPosition()
-{
- DSLOG_DBG("TIZEN_POSITION", "DESTORYER... TizenPosition:%p", this);
-}
-
-void DSWaylandTizenPosition::init(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface)
-{
- DS_GET_PRIV(DSWaylandTizenPosition);
- priv->init(client, id, version, surface);
-}
-
-DSWaylandTizenPositionPrivate::DSWaylandTizenPositionPrivate(DSWaylandTizenPosition *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __wlSurface(nullptr),
- __dswlSurface(nullptr)
-{
-}
-
-DSWaylandTizenPositionPrivate::~DSWaylandTizenPositionPrivate()
-{
-}
-
-void DSWaylandTizenPositionPrivate::init(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface)
-{
- tizen_position::init(client, id, version);
- __wlSurface = surface;
- __dswlSurface = DSWaylandSurface::fromWlResource(surface);
-}
-
-void DSWaylandTizenPositionPrivate::tizen_position_bind_resource(Resource *resource)
-{
-
-}
-
-void DSWaylandTizenPositionPrivate::tizen_position_destroy_resource(Resource *resource)
-{
-
-}
-
-void DSWaylandTizenPositionPrivate::tizen_position_destroy(Resource *resource)
-{
-
-}
-
-void DSWaylandTizenPositionPrivate::tizen_position_set(Resource *resource, int32_t x, int32_t y)
-{
- DSLOG_DBG("TIZEN_POSITION", "Requested pos(%d,%d)", x, y);
-
- DSWindowManager *wm = DSWindowManager::getInstance();
- wm->setWindowPosition(__dswlSurface, x, y);
- DSWindowManager::releaseInstance();
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_POSITION_H__
-#define __DS_WAYLAND_TIZEN_POSITION_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSWaylandSurface.h"
-#include <wayland-server-core.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenPositionPrivate;
-
-class DSWaylandTizenPosition : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenPosition);
-
-public:
- DSWaylandTizenPosition(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface);
- ~DSWaylandTizenPosition() override;
-
- void init(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface);
-
-protected:
-
-private:
-};
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
-
-#endif //__DS_WAYLAND_TIZEN_POSITION_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_POLICY_PRIVATE__
-#define __DS_WAYLAND_TIZEN_POLICY_PRIVATE__
-
-#include "dswayland-server-tizen-extension.h"
-#include "DSWaylandTizenPosition.h"
-
-namespace display_server
-{
-
-class DSWaylandTizenPositionPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_position
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenPosition);
-
-public:
- DSWaylandTizenPositionPrivate() = delete;
- //DSWaylandTizenPositionPrivate(DSWaylandTizenPosition *p_ptr, struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface);
- DSWaylandTizenPositionPrivate(DSWaylandTizenPosition *p_ptr);
- ~DSWaylandTizenPositionPrivate() override;
-
- void init(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface);
-
-protected:
- void tizen_position_bind_resource(Resource *resource) override;
- void tizen_position_destroy_resource(Resource *resource) override;
-
- void tizen_position_destroy(Resource *resource) override;
- void tizen_position_set(Resource *resource, int32_t x, int32_t y) override;
-
-private:
- struct ::wl_resource *__wlSurface;
- DSWaylandSurface *__dswlSurface;
-
-};
-
-}
-
-#endif //__DS_WAYLAND_TIZEN_POLICY_PRIVATE__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenSurface.h"
-#include "DSWaylandTizenSurfacePrivate.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-/* DSWaylandTizenSurface */
-DSWaylandTizenSurfacePrivate::DSWaylandTizenSurfacePrivate(DSWaylandTizenSurface *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __wlCompositor(compositor)
-{
- if (!compositor)
- return;
-
- init(compositor->display(), 1);
-}
-
-DSWaylandTizenSurfacePrivate::~DSWaylandTizenSurfacePrivate()
-{
-}
-
-void DSWaylandTizenSurfacePrivate::tizen_surface_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenSurfacePrivate::tizen_surface_destroy_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenSurfacePrivate::tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface)
-{
- DSWaylandTizenResource *tizenResource = nullptr;
- DSWaylandSurface *waylandSurface = nullptr;
- uint32_t tizenResourceId = 0;
-
- for (DSWaylandTizenResource *temp : __resourceList)
- if (temp->getResourceSurface() == surface) return;
-
- tizenResource = new DSWaylandTizenResource(resource->client(), id, surface);
- if (tizenResource == nullptr)
- {
- DSLOG_ERR("DSWaylandTizenSurface", "fail get tizen resource");
- return;
- }
-
- waylandSurface = __wlCompositor->getSurface(surface);
- if (waylandSurface)
- {
- tizenResourceId = waylandSurface->getTizenResourceId();
- tizenResource->setResourceId(tizenResourceId);
- }
- else
- {
- DSLOG_ERR("DSWaylandTizenSurface", "fail get tizen resource id");
- }
-
- __resourceList.push_back(tizenResource);
-
- tizenResource->sendResourceId();
-}
-
-void DSWaylandTizenSurfacePrivate::tizen_surface_destroy(Resource *resource)
-{
-}
-
-DSWaylandTizenResource *DSWaylandTizenSurfacePrivate::getTizenResource(struct ::wl_resource *surface)
-{
- DSWaylandTizenResource *tizenResource = nullptr;
-
- for (DSWaylandTizenResource *temp : __resourceList)
- {
- if (temp->getResourceSurface() == surface)
- {
- tizenResource = temp;
- break;
- }
- }
-
- return tizenResource;
-}
-
-void DSWaylandTizenSurfacePrivate::delTizenResource(DSWaylandTizenResource *tizenResource)
-{
- __resourceList.remove(tizenResource);
-}
-
-DSWaylandTizenSurface::DSWaylandTizenSurface(DSWaylandCompositor *compositor)
- : _d_ptr(std::make_unique<DSWaylandTizenSurfacePrivate>(this, compositor))
-{
-}
-
-DSWaylandTizenSurface::~DSWaylandTizenSurface()
-{
-}
-
-DSWaylandTizenResource *DSWaylandTizenSurface::getTizenResource(struct ::wl_resource *surface)
-{
- DS_GET_PRIV(DSWaylandTizenSurface);
-
- return priv->getTizenResource(surface);
-}
-
-void DSWaylandTizenSurface::delTizenResource(DSWaylandTizenResource *tizenResource)
-{
- DS_GET_PRIV(DSWaylandTizenSurface);
-
- priv->delTizenResource(tizenResource);
-}
-
-/* DSWaylandTizenResource */
-DSWaylandTizenResourcePrivate::DSWaylandTizenResourcePrivate(DSWaylandTizenResource *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __surface(surface),
- __resource_id(0)
-{
- init(client, id, 1);
-}
-
-DSWaylandTizenResourcePrivate::~DSWaylandTizenResourcePrivate()
-{
-}
-
-void DSWaylandTizenResourcePrivate::tizen_resource_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenResourcePrivate::tizen_resource_destroy_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenResourcePrivate::tizen_resource_destroy(Resource *resource)
-{
-}
-
-struct ::wl_resource *DSWaylandTizenResourcePrivate::getResourceSurface(void)
-{
- return __surface;
-}
-
-void DSWaylandTizenResourcePrivate::sendResourceId(void)
-{
- send_resource_id(__resource_id);
-}
-
-void DSWaylandTizenResourcePrivate::setResourceId(uint32_t tizenResourceId)
-{
- __resource_id = tizenResourceId;
-}
-
-uint32_t DSWaylandTizenResourcePrivate::getResourceId(void)
-{
- return __resource_id;
-}
-
-DSWaylandTizenResource::DSWaylandTizenResource(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
- : _d_ptr(std::make_unique<DSWaylandTizenResourcePrivate>(this, client, id, surface))
-{
-}
-
-DSWaylandTizenResource::~DSWaylandTizenResource()
-{
-}
-
-struct ::wl_resource *DSWaylandTizenResource::getResourceSurface(void)
-{
- DS_GET_PRIV(DSWaylandTizenResource);
-
- return priv->getResourceSurface();
-}
-
-void DSWaylandTizenResource::sendResourceId(void)
-{
- DS_GET_PRIV(DSWaylandTizenResource);
-
- DSLOG_INF("DSWaylandTizenResource", "send Resource Id");
-
- priv->sendResourceId();
-}
-
-void DSWaylandTizenResource::setResourceId(uint32_t tizenResourceId)
-{
- DS_GET_PRIV(DSWaylandTizenResource);
-
- DSLOG_INF("DSWaylandTizenResource", "send Resource Id");
-
- priv->setResourceId(tizenResourceId);
-}
-
-uint32_t DSWaylandTizenResource::getResourceId(void)
-{
- DS_GET_PRIV(DSWaylandTizenResource);
-
- DSLOG_INF("DSWaylandTizenResource", "send Resource Id");
-
- return priv->getResourceId();
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_SURFACE_H_
-#define _DS_WAYLAND_TIZEN_SURFACE_H_
-
-#include <DSObject.h>
-#include <DSCore.h>
-#include <DSWaylandCompositor.h>
-#include <wayland-server-core.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenSurfacePrivate;
-class DSWaylandTizenResourcePrivate;
-
-class DS_DECL_EXPORT DSWaylandTizenResource : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenResource);
-
-public:
- DSWaylandTizenResource(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
- virtual ~DSWaylandTizenResource();
-
- struct ::wl_resource *getResourceSurface(void);
- void sendResourceId(void);
- void setResourceId(uint32_t tizenResourceId);
- uint32_t getResourceId(void);
-};
-
-class DS_DECL_EXPORT DSWaylandTizenSurface : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurface);
-
-public:
- DSWaylandTizenSurface(DSWaylandCompositor *compositor);
- virtual ~DSWaylandTizenSurface();
-
- DSWaylandTizenResource *getTizenResource(struct ::wl_resource *surface);
- void delTizenResource(DSWaylandTizenResource *resource);
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_SURFACE_PRIVATE_H_
-#define _DS_WAYLAND_TIZEN_SURFACE_PRIVATE_H_
-
-#include "dswayland-server-tizen-extension.h"
-#include "DSWaylandTizenSurface.h"
-#include "DSWaylandSurface.h"
-
-namespace display_server
-{
-
-class DS_DECL_EXPORT DSWaylandTizenResourcePrivate : public DSObjectPrivate, public DSWaylandServer::tizen_resource
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenResource);
-
-public:
- DSWaylandTizenResourcePrivate() = delete;
- DSWaylandTizenResourcePrivate(DSWaylandTizenResource *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
- ~DSWaylandTizenResourcePrivate() override;
-
- struct ::wl_resource *getResourceSurface(void);
- void sendResourceId(void);
- void setResourceId(uint32_t tizenResourceId);
- uint32_t getResourceId(void);
-
-protected:
- void tizen_resource_bind_resource(Resource *resource) override;
- void tizen_resource_destroy_resource(Resource *resource) override;
- void tizen_resource_destroy(Resource *resource) override;
-private:
- struct ::wl_resource *__surface;
- uint32_t __resource_id;
-};
-
-class DS_DECL_EXPORT DSWaylandTizenSurfacePrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurface);
-
-public:
- DSWaylandTizenSurfacePrivate() = delete;
- DSWaylandTizenSurfacePrivate(DSWaylandTizenSurface *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandTizenSurfacePrivate() override;
-
- DSWaylandTizenResource *getTizenResource(struct ::wl_resource *surface);
- void delTizenResource(DSWaylandTizenResource *resource);
-
-protected:
- void tizen_surface_bind_resource(Resource *resource) override;
- void tizen_surface_destroy_resource(Resource *resource) override;
- void tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
- void tizen_surface_destroy(Resource *resource) override;
-
-private:
- std::list<DSWaylandTizenResource *> __resourceList;
- DSWaylandCompositor *__wlCompositor;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenSurfaceShm.h"
-#include "DSWaylandTizenSurfaceShmPrivate.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-/* DSWaylandTizenSurfaceShm */
-DSWaylandTizenSurfaceShmPrivate::DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr, DSWaylandCompositor *compositor)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __shmFlusher(nullptr)
-{
- if (!compositor)
- return;
-
- tizen_surface_shm::init(compositor->display(), 2);
-}
-
-DSWaylandTizenSurfaceShmPrivate::~DSWaylandTizenSurfaceShmPrivate()
-{
- if (__shmFlusher != nullptr)
- {
- delete __shmFlusher;
- __shmFlusher = nullptr;
- }
-}
-
-void DSWaylandTizenSurfaceShmPrivate::tizen_surface_shm_get_flusher(tizen_surface_shm::Resource *resource, uint32_t id, struct ::wl_resource *surface)
-{
- if (__shmFlusher != nullptr)
- {
- if (__shmFlusher->getShmFlusherSurface() == surface)
- {
- DSLOG_ERR("DSWaylandShm", "cannot get shmflusher with same surface.");
- return;
- }
- else
- {
- DSLOG_INF("DSWaylandShm", "delete previous shmflusher.");
- delete __shmFlusher;
- }
- }
-
- __shmFlusher = new DSWaylandTizenSurfaceShmFlusher(resource->client(), id, surface);
-}
-
-void DSWaylandTizenSurfaceShmPrivate::tizen_surface_shm_destroy(tizen_surface_shm::Resource *resource)
-{
- if (__shmFlusher != nullptr)
- {
- delete __shmFlusher;
- __shmFlusher = nullptr;
- }
-}
-
-DSWaylandTizenSurfaceShm::DSWaylandTizenSurfaceShm(DSWaylandCompositor *compositor)
- : _d_ptr(std::make_unique<DSWaylandTizenSurfaceShmPrivate>(this, compositor))
-{
-}
-
-DSWaylandTizenSurfaceShm::~DSWaylandTizenSurfaceShm()
-{
-}
-
-DSWaylandTizenSurfaceShmFlusher *DSWaylandTizenSurfaceShm::getShmFlusher(DSWaylandTizenSurfaceShm *TizenSurfaceShm)
-{
- DS_GET_PRIV(DSWaylandTizenSurfaceShm);
-
- return priv->__shmFlusher;
-}
-
-
-/* DSWaylandTizenSurfaceShmFlusher */
-DSWaylandTizenSurfaceShmFlusherPrivate::DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __surface(nullptr)
-{
- init(client, id, 2);
- __surface = surface;
-}
-
-DSWaylandTizenSurfaceShmFlusherPrivate::~DSWaylandTizenSurfaceShmFlusherPrivate()
-{
-}
-
-void DSWaylandTizenSurfaceShmFlusherPrivate::tizen_surface_shm_flusher_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenSurfaceShmFlusherPrivate::tizen_surface_shm_flusher_destroy(Resource *resource)
-{
-}
-
-void DSWaylandTizenSurfaceShmFlusherPrivate::sendShmFlusherFlush(void)
-{
- send_flush();
-}
-
-void DSWaylandTizenSurfaceShmFlusherPrivate::sendShmFlusherFreeFlush(void)
-{
- send_free_flush();
-}
-
-struct ::wl_resource *DSWaylandTizenSurfaceShmFlusherPrivate::getShmFlusherSurface(void)
-{
- return __surface;
-}
-
-DSWaylandTizenSurfaceShmFlusher::DSWaylandTizenSurfaceShmFlusher(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
- : _d_ptr(std::make_unique<DSWaylandTizenSurfaceShmFlusherPrivate>(this, client, id, surface))
-{
-}
-
-DSWaylandTizenSurfaceShmFlusher::~DSWaylandTizenSurfaceShmFlusher()
-{
-}
-
-void DSWaylandTizenSurfaceShmFlusher::sendShmFlusherFlush(void)
-{
- DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher);
-
- DSLOG_INF("DSWaylandShmFlusher", "sendShmFlusherFlush");
-
- priv->sendShmFlusherFlush();
-}
-
-void DSWaylandTizenSurfaceShmFlusher::sendShmFlusherFreeFlush(void)
-{
- DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher);
-
- DSLOG_INF("DSWaylandShmFlusher", "sendShmFlusherFreeFlush");
-
- priv->sendShmFlusherFreeFlush();
-}
-
-struct ::wl_resource *DSWaylandTizenSurfaceShmFlusher::getShmFlusherSurface(void)
-{
- DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher);
-
- return priv->getShmFlusherSurface();
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_SURFACE_SHM_H_
-#define _DS_WAYLAND_TIZEN_SURFACE_SHM_H_
-
-#include <DSObject.h>
-#include <DSCore.h>
-#include <DSWaylandCompositor.h>
-#include <wayland-server-core.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenSurfaceShmPrivate;
-class DSWaylandTizenSurfaceShmFlusherPrivate;
-
-class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusher : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShmFlusher);
-
-public:
- DSWaylandTizenSurfaceShmFlusher(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
- virtual ~DSWaylandTizenSurfaceShmFlusher();
-
- void sendShmFlusherFlush(void);
- void sendShmFlusherFreeFlush(void);
- struct ::wl_resource *getShmFlusherSurface(void);
-};
-
-class DS_DECL_EXPORT DSWaylandTizenSurfaceShm : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShm);
-
-public:
- DSWaylandTizenSurfaceShm(DSWaylandCompositor *compositor);
- virtual ~DSWaylandTizenSurfaceShm();
-
- DSWaylandTizenSurfaceShmFlusher *getShmFlusher(DSWaylandTizenSurfaceShm *TizenSurfaceShm);
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WAYLAND_TIZEN_SURFACE_SHM_PRIVATE_H_
-#define _DS_WAYLAND_TIZEN_SURFACE_SHM_PRIVATE_H_
-
-#include "dswayland-server-tizen-surface.h"
-#include "DSWaylandTizenSurfaceShm.h"
-
-namespace display_server
-{
-
-class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusherPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm_flusher
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShmFlusher);
-
-public:
- DSWaylandTizenSurfaceShmFlusherPrivate() = delete;
- DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
- ~DSWaylandTizenSurfaceShmFlusherPrivate() override;
-
- void sendShmFlusherFlush(void);
- void sendShmFlusherFreeFlush(void);
-
- struct ::wl_resource *getShmFlusherSurface(void);
-protected:
- void tizen_surface_shm_flusher_bind_resource(Resource *resource) override;
- void tizen_surface_shm_flusher_destroy(Resource *resource) override;
-private:
- struct ::wl_resource *__surface;
-};
-
-class DS_DECL_EXPORT DSWaylandTizenSurfaceShmPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShm);
-
-public:
- DSWaylandTizenSurfaceShmPrivate() = delete;
- DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr, DSWaylandCompositor *compositor);
- ~DSWaylandTizenSurfaceShmPrivate() override;
-
-protected:
- void tizen_surface_shm_get_flusher(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
- void tizen_surface_shm_destroy(Resource *resource) override;
-private:
- DSWaylandTizenSurfaceShmFlusher *__shmFlusher;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTizenVisibility.h"
-#include "DSWaylandTizenVisibilityPrivate.h"
-#include "DSWindowManager.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-DSWaylandTizenVisibilityPrivate::DSWaylandTizenVisibilityPrivate(DSWaylandTizenVisibility *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __wlSurface(nullptr),
- __dswlSurface(nullptr)
-{
-}
-
-DSWaylandTizenVisibilityPrivate::~DSWaylandTizenVisibilityPrivate()
-{
-}
-
-void DSWaylandTizenVisibilityPrivate::init(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface)
-{
- tizen_visibility::init(client, id, version);
- __wlSurface = surface;
- __dswlSurface = DSWaylandSurface::fromWlResource(surface);
-}
-
-void DSWaylandTizenVisibilityPrivate::tizen_visibility_bind_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenVisibilityPrivate::tizen_visibility_destroy_resource(Resource *resource)
-{
-}
-
-void DSWaylandTizenVisibilityPrivate::tizen_visibility_destroy(Resource *resource)
-{
-}
-
-
-
-DSWaylandTizenVisibility::DSWaylandTizenVisibility(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface)
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandTizenVisibility)
-{
- init(client, id, version, surface);
-}
-
-DSWaylandTizenVisibility::~DSWaylandTizenVisibility()
-{
-}
-
-void DSWaylandTizenVisibility::init(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface)
-{
- DS_GET_PRIV(DSWaylandTizenVisibility);
- priv->init(client, id, version, surface);
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_VISIBILITY_H__
-#define __DS_WAYLAND_TIZEN_VISIBILITY_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSWaylandSurface.h"
-#include <wayland-server-core.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandTizenVisibilityPrivate;
-
-class DSWaylandTizenVisibility : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandTizenVisibility);
-
-public:
- DSWaylandTizenVisibility(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface);
- ~DSWaylandTizenVisibility() override;
-
- void init(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface);
-};
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
-
-#endif //__DS_WAYLAND_TIZEN_VISIBILITY_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TIZEN_VISIBILITY_PRIVATE__
-#define __DS_WAYLAND_TIZEN_VISIBILITY_PRIVATE__
-
-#include "dswayland-server-tizen-extension.h"
-#include "DSWaylandTizenVisibility.h"
-
-namespace display_server
-{
-
-class DSWaylandTizenVisibilityPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_visibility
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandTizenVisibility);
-
-public:
- DSWaylandTizenVisibilityPrivate() = delete;
- DSWaylandTizenVisibilityPrivate(DSWaylandTizenVisibility *p_ptr);
- ~DSWaylandTizenVisibilityPrivate() override;
-
- void init(struct ::wl_client *client, uint32_t id, int version, struct ::wl_resource *surface);
-
-protected:
- void tizen_visibility_bind_resource(Resource *resource) override;
- void tizen_visibility_destroy_resource(Resource *resource) override;
-
- void tizen_visibility_destroy(Resource *resource) override;
-
-private:
- struct ::wl_resource *__wlSurface;
- DSWaylandSurface *__dswlSurface;
-
-};
-
-}
-
-#endif //__DS_WAYLAND_TIZEN_VISIBILITY_PRIVATE__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWaylandTouch.h"
-#include "DSWaylandTouchPrivate.h"
-#include "DSWaylandClient.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandSurface.h"
-#include "DSWaylandCompositor.h"
-
-namespace display_server {
-
-/* Begin Private Class Implementation */
-DSWaylandTouchPrivate::DSWaylandTouchPrivate(DSWaylandSeat *seat, DSWaylandTouch *touch)
- : DSObjectPrivate(touch),
- __p_ptr(touch),
- __seat(seat),
- __compositor(seat ? (seat->getCompositor()) : nullptr),
- __waylandSurface(nullptr),
- __wlTouchResource(nullptr)
-{
- wl_touch();
-}
-
-DSWaylandTouchPrivate::~DSWaylandTouchPrivate()
-{
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandTouchPrivate::setFocus(DSWaylandSurface *waylandSurface)
-{
- DSLOG_INF("DSWaylandTouchPrivate", "touch focus changed (%p -> %p)", __waylandSurface, waylandSurface);
-
- __waylandSurface = waylandSurface;
-
- if (!waylandSurface || !waylandSurface->hasResource())
- {
- __wlTouchResource = nullptr;
- DSLOG_INF("DSWaylandTouchPrivate", "wlTouchResource has been set to null.");
- return;
- }
-
- struct ::wl_resource *surface = waylandSurface->getWlResource();
- auto client = wl_resource_get_client(surface);
-
- std::multimap<struct ::wl_client*, Resource*>::iterator iter;
- std::multimap<struct ::wl_client*, Resource*> resMap = resourceMap();
-
- for (iter = resMap.begin(); iter != resMap.end(); iter++)
- {
- Resource *res = (*iter).second;
- if (res->client() == client)
- {
- __wlTouchResource = res->handle;
- break;
- }
-
- }
-}
-/*LCOV_EXCL_STOP*/
-
-DSWaylandSurface *DSWaylandTouchPrivate::getFocus()
-{
- return __waylandSurface;
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandTouchPrivate::touch_bind_resource(Resource *resource)
-{
- DSLOG_INF("DSWaylandTouchPrivate","");
-}
-
-void DSWaylandTouchPrivate::touch_destroy_resource(Resource *resource)
-{
- DSLOG_INF("DSWaylandTouchPrivate","");
-}
-
-void DSWaylandTouchPrivate::touch_release(Resource *resource)
-{
- DSLOG_INF("DSWaylandTouchPrivate","");
- wl_resource_destroy(resource->handle);
-}
-/*LCOV_EXCL_STOP*/
-
-/*LCOV_EXCL_START*/
-void DSWaylandTouchPrivate::sendDown(int32_t id, int x, int y)
-{
- if (!__waylandSurface)
- {
- DSLOG_INF("DSWaylandTouchPrivate", "no waylandSurface available !");
- return;
- }
-
- wl_fixed_t x_fixed = wl_fixed_from_int(x);
- wl_fixed_t y_fixed = wl_fixed_from_int(y);
-
- struct ::wl_resource *surface = __waylandSurface->getWlResource();
- DS_ASSERT(surface != nullptr);
-
- send_down(__wlTouchResource, __compositor->nextSerial(), __seat->getCurrentEventTime(), surface, id, x_fixed, y_fixed);
-}
-
-void DSWaylandTouchPrivate::sendUp(int32_t id)
-{
- send_up(__wlTouchResource, __compositor->nextSerial(), __seat->getCurrentEventTime(), id);
-}
-
-void DSWaylandTouchPrivate::sendMotion(int32_t id, int x, int y)
-{
- wl_fixed_t x_fixed = wl_fixed_from_int(x);
- wl_fixed_t y_fixed = wl_fixed_from_int(y);
-
- send_motion(__wlTouchResource, __seat->getCurrentEventTime(), id, x_fixed, y_fixed);
-}
-/*LCOV_EXCL_STOP*/
-
-/* Begin Public Class Implementation */
-DSWaylandTouch::DSWaylandTouch(DSWaylandSeat *seat)
- : DSObject(), _d_ptr(std::make_unique<DSWaylandTouchPrivate>(seat, this))
-{
- //TODO : emit signal
-}
-
-DSWaylandTouch::~DSWaylandTouch()
-{
- //TODO : emit signal
-}
-
-DSWaylandSeat *DSWaylandTouch::seat()
-{
- DS_GET_PRIV(DSWaylandTouch);
-
- return priv->__seat;
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandTouch::addClient(DSWaylandClient *client, uint32_t id, int version)
-{
- DS_GET_PRIV(DSWaylandTouch);
-
- DSLOG_INF("DSWaylandTouch", "addClient(dswlClient=%p, id=%u, version=%d", client, id, version);
-
- priv->add(client->wlClient(), id, version);
-}
-/*LCOV_EXCL_STOP*/
-
-void DSWaylandTouch::setFocus(DSWaylandSurface *waylandSurface)
-{
- DS_GET_PRIV(DSWaylandTouch);
- priv->setFocus(waylandSurface);
-}
-
-void DSWaylandTouch::resetFocus()
-{
- DS_GET_PRIV(DSWaylandTouch);
- priv->__waylandSurface = nullptr;
- priv->__wlTouchResource = nullptr;
-}
-
-DSWaylandSurface *DSWaylandTouch::getFocus()
-{
- DS_GET_PRIV(DSWaylandTouch);
- return priv->getFocus();
-}
-
-/*LCOV_EXCL_START*/
-void DSWaylandTouch::sendDown(int32_t id, int x, int y)
-{
- DS_GET_PRIV(DSWaylandTouch);
- priv->sendDown(id, x, y);
-}
-
-void DSWaylandTouch::sendUp(int32_t id)
-{
- DS_GET_PRIV(DSWaylandTouch);
- priv->sendUp(id);
-}
-
-void DSWaylandTouch::sendMotion(int32_t id, int x, int y)
-{
- DS_GET_PRIV(DSWaylandTouch);
- priv->sendMotion(id, x, y);
-}
-/*LCOV_EXCL_STOP*/
-
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TOUCH_H__
-#define __DS_WAYLAND_TOUCH_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandSeat;
-class DSWaylandTouchPrivate;
-class DSWaylandClient;
-class DSWaylandSurface;
-
-class DS_DECL_EXPORT DSWaylandTouch : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWaylandTouch);
-public:
- DSWaylandTouch(DSWaylandSeat *seat);
- ~DSWaylandTouch() override;
-
- DSWaylandSeat *seat();
-
- void addClient(DSWaylandClient *client, uint32_t id, int version);
- void setFocus(DSWaylandSurface *waylandSurface);
- void resetFocus();
- DSWaylandSurface *getFocus();
-
- void sendDown(int32_t id, int x, int y);
- void sendUp(int32_t id);
- void sendMotion(int32_t id, int x, int y);
-
-protected:
-
-private:
-
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif //__DS_WAYLAND_TOUCH_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_TOUCH_PRIVATE_H__
-#define __DS_WAYLAND_TOUCH_PRIVATE_H__
-
-#include "dswayland-server-wayland.h"
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-
-struct wl_resource;
-
-namespace display_server
-{
-
-class DSWaylandSeat;
-class DSWaylandCompositor;
-class DSWaylandSurface;
-
-class DS_DECL_EXPORT DSWaylandTouchPrivate : public DSObjectPrivate, public DSWaylandServer::wl_touch
-{
- DS_PIMPL_USE_PUBLIC(DSWaylandTouch);
-public:
- DSWaylandTouchPrivate(DSWaylandSeat *seat, DSWaylandTouch *touch);
- ~DSWaylandTouchPrivate() override;
-
- void setFocus(DSWaylandSurface *waylandSurface);
- DSWaylandSurface *getFocus();
-
-protected:
- //virtual Resource *touch_allocate();
- virtual void touch_bind_resource(Resource *resource);
- virtual void touch_destroy_resource(Resource *resource);
- virtual void touch_release(Resource *resource);
-
- /* APIs must be provided */
- void sendDown(int32_t id, int x, int y);
- void sendUp(int32_t id);
- void sendMotion(int32_t id, int x, int y);
- /*
- void sendFrame(struct ::wl_resource *surface);
- void sendCancel(struct ::wl_resource *surface);
- */
- /* APIs don't need to provide */
- /*
- void send_shape(struct ::wl_resource *resource, int32_t id, wl_fixed_t major, wl_fixed_t minor);
- void send_orientation(struct ::wl_resource *resource, int32_t id, wl_fixed_t orientation);
- */
-
-private:
- DSWaylandSeat *__seat;
- DSWaylandCompositor *__compositor;
- DSWaylandSurface *__waylandSurface;
- struct ::wl_resource *__wlTouchResource;
-};
-
-}
-
-#endif //__DS_WAYLAND_TOUCH_PRIVATE_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWindowManager.h"
-#include "DSWaylandZxdgShellV6.h"
-#include "DSWaylandZxdgShellV6Private.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandSurface.h"
-
-#define ZXDG_SHELL_V6_VERSION 1
-#define ZXDG_POSITIONER_V6_VERSION 1
-#define ZXDG_SURFACE_V6_VERSION 1
-#define ZXDG_TOPLEVEL_V6_VERSION 1
-#define ZXDG_POPUP_V6_VERSION 1
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-/******************************************
- DSWaylandZxdgShellV6
- *****************************************/
-
-DSWaylandZxdgShellV6::DSWaylandZxdgShellV6()
- : IDSWaylandShell(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgShellV6)
-{
-}
-
-DSWaylandZxdgShellV6::DSWaylandZxdgShellV6(DSWaylandCompositor *wlCompositor)
- : IDSWaylandShell(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgShellV6)
-{
- this->init(wlCompositor->display(), ZXDG_SHELL_V6_VERSION);
-}
-
-DSWaylandZxdgShellV6::~DSWaylandZxdgShellV6()
-{
-}
-
-void DSWaylandZxdgShellV6::init(struct ::wl_display *display, int version)
-{
- DS_GET_PRIV(DSWaylandZxdgShellV6);
-
- priv->init(display, version);
-}
-
-void DSWaylandZxdgShellV6::addSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf)
-{
- DS_GET_PRIV(DSWaylandZxdgShellV6);
-
- priv->addSurface(zxdgSurf);
-}
-
-void DSWaylandZxdgShellV6::delSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf)
-{
- DS_GET_PRIV(DSWaylandZxdgShellV6);
-
- priv->delSurface(zxdgSurf);
-}
-
-std::list<DSWaylandZxdgSurfaceV6 *> DSWaylandZxdgShellV6::getSurfaceList()
-{
- DS_GET_PRIV(DSWaylandZxdgShellV6);
-
- return priv->getSurfaceList();
-}
-
-void DSWaylandZxdgShellV6::registerCallbackShellSurfaceCreated(DSObject *slot, std::function<void(IDSWaylandShellSurface*)> func)
-{
- __zxdgSurfaceCreatedSignal.connect(slot, func);
-}
-
-void DSWaylandZxdgShellV6::registerCallbackShellSurfaceDestroyed(DSObject *slot, std::function<void(IDSWaylandShellSurface*)> func)
-{
- __zxdgSurfaceDestroyedSignal.connect(slot, func);
-}
-
-DSWaylandZxdgShellV6Private::DSWaylandZxdgShellV6Private(DSWaylandZxdgShellV6 *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr)
-{
-}
-
-DSWaylandZxdgShellV6Private::~DSWaylandZxdgShellV6Private()
-{
-}
-
-void DSWaylandZxdgShellV6Private::zxdg_shell_v6_bind_resource(zxdg_shell_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgShellV6Private::zxdg_shell_v6_destroy_resource(zxdg_shell_v6::Resource *resource)
-{
-}
-
-void DSWaylandZxdgShellV6Private::zxdg_shell_v6_destroy(zxdg_shell_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgShellV6Private::zxdg_shell_v6_create_positioner(zxdg_shell_v6::Resource *resource, uint32_t id)
-{
-}
-void DSWaylandZxdgShellV6Private::zxdg_shell_v6_get_xdg_surface(zxdg_shell_v6::Resource *resource, uint32_t id, struct ::wl_resource *surface)
-{
- DSLOG_DBG("DSWaylandZxdgShell", "");
- DS_GET_PUB(DSWaylandZxdgShellV6);
-
- DSWaylandZxdgSurfaceV6 *zxdgSurf = new DSWaylandZxdgSurfaceV6(resource->client(), id, ZXDG_SURFACE_V6_VERSION, pub);
- if (zxdgSurf)
- {
- zxdgSurf->setWlSurface(surface);
-
- DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
- if (dswlSurface)
- {
- zxdgSurf->setSurface(dswlSurface);
- }
-
- DSLOG_DBG("DSWaylandZxdgShell", "DSWaylandZxdgSurface:%p, DSWaylandSurface:%p, wl_surface:%p", zxdgSurf, dswlSurface, surface);
-
- pub->addSurface(zxdgSurf);
- }
-}
-void DSWaylandZxdgShellV6Private::zxdg_shell_v6_pong(zxdg_shell_v6::Resource *resource, uint32_t serial)
-{
-}
-
-void DSWaylandZxdgShellV6Private::addSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf)
-{
- for (DSWaylandZxdgSurfaceV6 *surf : __surfList)
- if (surf == zxdgSurf) return;
-
- DS_GET_PUB(DSWaylandZxdgShellV6);
- pub->__zxdgSurfaceCreatedSignal.emit(zxdgSurf);
-
- __surfList.push_back(zxdgSurf);
-}
-
-void DSWaylandZxdgShellV6Private::delSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf)
-{
- DS_GET_PUB(DSWaylandZxdgShellV6);
- pub->__zxdgSurfaceDestroyedSignal.emit(zxdgSurf);
-
- __surfList.remove(zxdgSurf);
-}
-
-std::list<DSWaylandZxdgSurfaceV6 *> DSWaylandZxdgShellV6Private::getSurfaceList()
-{
- return __surfList;
-}
-
-
-/******************************************
- DSWaylandZxdgPositionerV6
- *****************************************/
-
-DSWaylandZxdgPositionerV6::DSWaylandZxdgPositionerV6()
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgPositionerV6)
-{
-}
-
-DSWaylandZxdgPositionerV6::DSWaylandZxdgPositionerV6(struct ::wl_client *client, int id, int ver)
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgPositionerV6)
-{
- this->init(client, id, ver);
-}
-
-DSWaylandZxdgPositionerV6::~DSWaylandZxdgPositionerV6()
-{
-}
-
-void DSWaylandZxdgPositionerV6::init(struct ::wl_client *client, int id, int ver)
-{
- DS_GET_PRIV(DSWaylandZxdgPositionerV6);
-
- priv->init(client, id, ver);
-}
-
-
-DSWaylandZxdgPositionerV6Private::DSWaylandZxdgPositionerV6Private(DSWaylandZxdgPositionerV6 *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr)
-{
-}
-
-DSWaylandZxdgPositionerV6Private::~DSWaylandZxdgPositionerV6Private()
-{
-}
-
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_bind_resource(zxdg_positioner_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_destroy_resource(zxdg_positioner_v6::Resource *resource)
-{
-}
-
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_destroy(zxdg_positioner_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_set_size(zxdg_positioner_v6::Resource *resurce, int32_t width, int32_t height)
-{
-}
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_set_anchor_rect(zxdg_positioner_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
-}
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_set_anchor(zxdg_positioner_v6::Resource *resource, uint32_t anchor)
-{
-}
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_set_gravity(zxdg_positioner_v6::Resource *resource, uint32_t gravity)
-{
-}
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_set_constraint_adjustment(zxdg_positioner_v6::Resource *resource, uint32_t constraint_adjustment)
-{
-}
-void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_set_offset(zxdg_positioner_v6::Resource *resource, int32_t x, int32_t y)
-{
-}
-
-
-/******************************************
- DSWaylandZxdgSurfaceV6
- *****************************************/
-
-DSWaylandZxdgSurfaceV6::DSWaylandZxdgSurfaceV6(DSWaylandZxdgShellV6 *xdgShell)
- : IDSWaylandShellSurface(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgSurfaceV6),
- __xdgShell(xdgShell)
-{
-}
-
-DSWaylandZxdgSurfaceV6::DSWaylandZxdgSurfaceV6(struct ::wl_client *client, int id, int ver, DSWaylandZxdgShellV6 *xdgShell)
- : IDSWaylandShellSurface(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgSurfaceV6),
- __xdgShell(xdgShell)
-{
- this->init(client, id, ver);
-}
-
-DSWaylandZxdgSurfaceV6::~DSWaylandZxdgSurfaceV6()
-{
- if (__xdgShell)
- __xdgShell->delSurface(this);
-}
-
-void DSWaylandZxdgSurfaceV6::init(struct ::wl_client *client, int id, int ver)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
-
- priv->init(client, id, ver);
-}
-
-void DSWaylandZxdgSurfaceV6::setWlSurface(struct ::wl_resource *surface)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
-
- priv->setWlSurface(surface);
-}
-
-struct ::wl_resource *DSWaylandZxdgSurfaceV6::getWlSurface(void)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
-
- return priv->getWlSurface();
-}
-
-void DSWaylandZxdgSurfaceV6::setSurface(DSWaylandSurface *surface)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
- priv->setSurface(surface);
-}
-
-DSWaylandSurface *DSWaylandZxdgSurfaceV6::getSurface(void)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
- return priv->getSurface();
-}
-
-void DSWaylandZxdgSurfaceV6::sendConfigure(int x, int y, unsigned int w, unsigned int h)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
- priv->sendConfigure(x, y, w, h);
-}
-
-void DSWaylandZxdgSurfaceV6::setWindowTitle(const std::string &title)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
-
- priv->setWindowTitle(title);
-}
-
-void DSWaylandZxdgSurfaceV6::setAppID(const std::string &appId)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
-
- priv->setAppID(appId);
-}
-
-void DSWaylandZxdgSurfaceV6::getGeometry(int *x, int *y, int *w, int *h)
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
- int __x = 0, __y = 0, __w = 0, __h = 0;
-
- priv->getGeometry(&__x, &__y, &__w, &__h);
-
- if (x) *x = __x;
- if (y) *y = __y;
- if (w) *w = __w;
- if (h) *h = __h;
-}
-
-std::string DSWaylandZxdgSurfaceV6::getWindowTitle()
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
-
- return priv->getWindowTitle();
-}
-
-std::string DSWaylandZxdgSurfaceV6::getAppID()
-{
- DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
-
- return priv->getAppID();
-}
-
-
-DSWaylandZxdgSurfaceV6Private::DSWaylandZxdgSurfaceV6Private(DSWaylandZxdgSurfaceV6 *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr),
- __wlSurface(nullptr), __dsSurface(nullptr),
- __toplevel(nullptr), __popup(nullptr), __role(DSWaylandZxdgSurfaceV6::DS_XDG_SURFACE_ROLE_NONE),
- __x(0), __y(0), __w(0), __h(0),
- __title(""), __appId("")
-{
-}
-
-DSWaylandZxdgSurfaceV6Private::~DSWaylandZxdgSurfaceV6Private()
-{
-}
-
-void DSWaylandZxdgSurfaceV6Private::setWlSurface(struct ::wl_resource *surface)
-{
- __wlSurface = surface;
-}
-
-struct ::wl_resource *DSWaylandZxdgSurfaceV6Private::getWlSurface(void)
-{
- return __wlSurface;
-}
-
-void DSWaylandZxdgSurfaceV6Private::setSurface(DSWaylandSurface *surface)
-{
- __dsSurface = surface;
-}
-
-DSWaylandSurface *DSWaylandZxdgSurfaceV6Private::getSurface(void)
-{
- return __dsSurface;
-}
-
-void DSWaylandZxdgSurfaceV6Private::sendConfigure(int x, int y, unsigned int w, unsigned int h)
-{
- DSWaylandCompositor *wlCompositor = DSWaylandCompositor::getInstance();
- if (wlCompositor == nullptr) return;
-
- uint32_t serial = wlCompositor->nextSerial();
-
- DSLOG_DBG("ZXDG_SURFACE", "Role:%d, Toplevel:%p, Popup:%p", __role, __toplevel, __popup);
-
- // TODO: Do we check role (toplevel or popup)
- if (__toplevel)
- __toplevel->sendConfigure(w, h);
-
- if (__popup)
- __popup->sendConfigure(x, y, w, h);
-
- DSLOG_DBG("ZXDG_SURFACE", "Send configure... serial:%d", serial);
- send_configure(serial);
-
- DSWaylandCompositor::releaseInstance();
-}
-
-void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_bind_resource(zxdg_surface_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_destroy_resource(zxdg_surface_v6::Resource *resource)
-{
-}
-
-void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_destroy(zxdg_surface_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_get_toplevel(zxdg_surface_v6::Resource *resource, uint32_t id)
-{
- DS_GET_PUB(DSWaylandZxdgSurfaceV6);
- DSWaylandZxdgToplevelV6 *zxdgToplevel = new DSWaylandZxdgToplevelV6(pub, resource->client(), id, ZXDG_TOPLEVEL_V6_VERSION);
- __toplevel = zxdgToplevel;
- __role = DSWaylandZxdgSurfaceV6::DS_XDG_SURFACE_ROLE_TOPLEVEL;
-
- DSLOG_DBG("ZXDG_SURFACE", "Get Toplevel. DSWaylandZxdgToplevel:%p", __toplevel);
-}
-void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_get_popup(zxdg_surface_v6::Resource *resource, uint32_t id, struct ::wl_resource *parent, struct ::wl_resource *positioner)
-{
- DS_GET_PUB(DSWaylandZxdgSurfaceV6);
- DSWaylandZxdgPopupV6 *zxdgPopup = new DSWaylandZxdgPopupV6(pub, resource->client(), id, ZXDG_TOPLEVEL_V6_VERSION);
- __popup = zxdgPopup;
- __role = DSWaylandZxdgSurfaceV6::DS_XDG_SURFACE_ROLE_POPUP;
-
- DSLOG_DBG("ZXDG_SURFACE", "Get Popup. DSWaylandZxdgPopup:%p", __popup);
-}
-void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_set_window_geometry(zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- __x = x;
- __y = y;
- __w = width;
- __h = height;
- // TODO: needs codes for adjust geometry
-
- DSLOG_DBG("ZXDG_SURFACE", "Set Window geometry (%d,%d,%d,%d)", x, y, width, height);
-
- DSWindowManager *wm = DSWindowManager::getInstance();
- wm->setWindowGeometry(__dsSurface, __x, __y, __w, __h);
- DSWindowManager::releaseInstance();
-}
-void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_ack_configure(zxdg_surface_v6::Resource *resource, uint32_t serial)
-{
-}
-
-void DSWaylandZxdgSurfaceV6Private::setWindowTitle(const std::string &title)
-{
- // TODO: needs DSWindow title set method
- __title = title;
-
- DSWindowManager *wm = DSWindowManager::getInstance();
- wm->setWindowTitle(__dsSurface, __title);
- DSWindowManager::releaseInstance();
-}
-
-void DSWaylandZxdgSurfaceV6Private::setAppID(const std::string &appId)
-{
- // TODO: needs AppID set method
- __appId = appId;
-}
-
-void DSWaylandZxdgSurfaceV6Private::getGeometry(int *x, int *y, int *w, int *h)
-{
- if (x) *x = __x;
- if (y) *y = __y;
- if (w) *w = __w;
- if (h) *h = __h;
-}
-
-std::string DSWaylandZxdgSurfaceV6Private::getWindowTitle()
-{
- // TODO: needs DSWindow title set method
- //__window->setTitle(title);
- return __title;
-}
-
-std::string DSWaylandZxdgSurfaceV6Private::getAppID()
-{
- // TODO: needs AppID set method
- return __appId;
-}
-
-
-/******************************************
- DSWaylandZxdgToplevelV6
- *****************************************/
-
-DSWaylandZxdgToplevelV6::DSWaylandZxdgToplevelV6()
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgToplevelV6)
-{
-}
-
-DSWaylandZxdgToplevelV6::DSWaylandZxdgToplevelV6(DSWaylandZxdgSurfaceV6 *zxdgSurface, struct ::wl_client *client, int id, int ver)
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgToplevelV6)
-{
- this->init(zxdgSurface, client, id, ver);
-}
-
-DSWaylandZxdgToplevelV6::~DSWaylandZxdgToplevelV6()
-{
-}
-
-void DSWaylandZxdgToplevelV6::init(DSWaylandZxdgSurfaceV6 *zxdgSurface, struct ::wl_client *client, int id, int ver)
-{
- DS_GET_PRIV(DSWaylandZxdgToplevelV6);
-
- priv->init(client, id, ver);
- priv->__zxdgSurface = zxdgSurface;
-}
-
-void DSWaylandZxdgToplevelV6::sendConfigure(unsigned int w, unsigned int h)
-{
- DS_GET_PRIV(DSWaylandZxdgToplevelV6);
- priv->sendConfigure(w, h);
-}
-
-DSWaylandZxdgToplevelV6Private::DSWaylandZxdgToplevelV6Private(DSWaylandZxdgToplevelV6 *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __zxdgSurface(nullptr)
-{
-}
-
-DSWaylandZxdgToplevelV6Private::~DSWaylandZxdgToplevelV6Private()
-{
-}
-
-void DSWaylandZxdgToplevelV6Private::sendConfigure(unsigned int w, unsigned int h)
-{
- struct ::wl_array states;
- wl_array_init(&states);
-
-/*
- uint32_t *s;
-
- // if maximized
- s = wl_array_add(&states, sizeof(uint32_t));
- if (s)
- {
- *s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
- }
-
- // if fullscreen
- s = wl_array_add(&states, sizeof(uint32_t));
- if (s)
- {
- *s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
- }
-*/
-
- send_configure((int32_t)w, (int32_t)h, &states);
-
- wl_array_release(&states);
-}
-
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_bind_resource(zxdg_toplevel_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_destroy_resource(zxdg_toplevel_v6::Resource *resource)
-{
-}
-
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_destroy(zxdg_toplevel_v6::Resource *resource)
-{
-}
-
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_set_parent(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *parent)
-{
- DSLOG_DBG("XDG_TopLevel", "Set Parent (parent:%p)", parent);
-
- DSWaylandSurface *surface = __zxdgSurface->getSurface();
- if (!surface) return;
-
- DSWaylandSurface *parentSurface = DSWaylandSurface::fromWlResource(parent);
-
- DSWindowManager *wm = DSWindowManager::getInstance();
- if (wm)
- {
- wm->setWindowParent(surface, parentSurface);
- DSWindowManager::releaseInstance();
- }
-}
-
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_set_title(zxdg_toplevel_v6::Resource *resource, const std::string &title)
-{
- __zxdgSurface->setWindowTitle(title);
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_set_app_id(zxdg_toplevel_v6::Resource *resource, const std::string &app_id)
-{
- __zxdgSurface->setAppID(app_id);
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_show_window_menu(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_move(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *seat, uint32_t serial)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_resize(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_set_max_size(zxdg_toplevel_v6::Resource *resource, int32_t width, int32_t height)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_set_min_size(zxdg_toplevel_v6::Resource *resource, int32_t width, int32_t height)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_set_maximized(zxdg_toplevel_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_unset_maximized(zxdg_toplevel_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_set_fullscreen(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *output)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_unset_fullscreen(zxdg_toplevel_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_set_minimized(zxdg_toplevel_v6::Resource *resource)
-{
-}
-
-
-/******************************************
- DSWaylandZxdgPopupV6
- *****************************************/
-
-DSWaylandZxdgPopupV6::DSWaylandZxdgPopupV6()
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgPopupV6)
-{
-}
-
-DSWaylandZxdgPopupV6::DSWaylandZxdgPopupV6(DSWaylandZxdgSurfaceV6 *zxdgSurface, struct ::wl_client *client, int id, int ver)
- : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgPopupV6)
-{
- this->init(zxdgSurface, client, id, ver);
-}
-
-DSWaylandZxdgPopupV6::~DSWaylandZxdgPopupV6()
-{
-}
-
-void DSWaylandZxdgPopupV6::init(DSWaylandZxdgSurfaceV6 *zxdgSurface, struct ::wl_client *client, int id, int ver)
-{
- DS_GET_PRIV(DSWaylandZxdgPopupV6);
-
- priv->init(client, id, ver);
- priv->__zxdgSurface = zxdgSurface;
-}
-
-void DSWaylandZxdgPopupV6::sendConfigure(int x, int y, unsigned int w, unsigned int h)
-{
- DS_GET_PRIV(DSWaylandZxdgPopupV6);
- priv->send_configure(x, y, w, h);
-}
-
-DSWaylandZxdgPopupV6Private::DSWaylandZxdgPopupV6Private(DSWaylandZxdgPopupV6 *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __zxdgSurface(nullptr)
-{
-}
-
-DSWaylandZxdgPopupV6Private::~DSWaylandZxdgPopupV6Private()
-{
-}
-
-void DSWaylandZxdgPopupV6Private::sendConfigure(int x, int y, unsigned int w, unsigned int h)
-{
- send_configure(x, y, w, h);
-}
-
-void DSWaylandZxdgPopupV6Private::zxdg_popup_v6_bind_resource(zxdg_popup_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgPopupV6Private::zxdg_popup_v6_destroy_resource(zxdg_popup_v6::Resource *resource)
-{
-}
-
-void DSWaylandZxdgPopupV6Private::zxdg_popup_v6_destroy(zxdg_popup_v6::Resource *resource)
-{
-}
-void DSWaylandZxdgPopupV6Private::zxdg_popup_v6_grab(zxdg_popup_v6::Resource *resource, struct ::wl_resource *seat, uint32_t serial)
-{
-}
-/*LCOV_EXCL_STOP*/
-
-} // namespace display_server
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_ZXDG_SHELL_V6_H__
-#define __DS_WAYLAND_ZXDG_SHELL_V6_H__
-
-#include <DSCore.h>
-#include <DSSignal.h>
-#include <DSObject.h>
-#include "IDSWaylandShell.h"
-
-#include <wayland-server-core.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandCompositor;
-class DSWaylandZxdgShellV6;
-class DSWaylandZxdgPositionerV6;
-class DSWaylandZxdgSurfaceV6;
-class DSWaylandZxdgToplevelV6;
-class DSWaylandZxdgPopupV6;
-class DSWaylandZxdgShellV6Private;
-class DSWaylandZxdgPositionerV6Private;
-class DSWaylandZxdgSurfaceV6Private;
-class DSWaylandZxdgToplevelV6Private;
-class DSWaylandZxdgPopupV6Private;
-
-class DSWaylandZxdgShellV6 : public IDSWaylandShell
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandZxdgShellV6);
-
-public:
- DSWaylandZxdgShellV6();
- DSWaylandZxdgShellV6(DSWaylandCompositor *wlCompositor);
- virtual ~DSWaylandZxdgShellV6();
-
- void init(struct ::wl_display *display, int version);
- void addSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf);
- void delSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf);
- std::list<DSWaylandZxdgSurfaceV6 *> getSurfaceList();
-
- void registerCallbackShellSurfaceCreated(DSObject *slot, std::function<void(IDSWaylandShellSurface*)> func);
- void registerCallbackShellSurfaceDestroyed(DSObject *slot, std::function<void(IDSWaylandShellSurface*)> func);
-
-public:
- DSSignal<DSWaylandZxdgSurfaceV6*> __zxdgSurfaceCreatedSignal;
- DSSignal<DSWaylandZxdgSurfaceV6*> __zxdgSurfaceDestroyedSignal;
-};
-
-class DSWaylandZxdgPositionerV6 : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandZxdgPositionerV6);
-
-public:
- DSWaylandZxdgPositionerV6();
- DSWaylandZxdgPositionerV6(struct ::wl_client *client, int id, int ver);
- virtual ~DSWaylandZxdgPositionerV6();
-
- void init(struct ::wl_client *client, int id, int ver);
-
-};
-
-class DSWaylandZxdgSurfaceV6 : public IDSWaylandShellSurface
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandZxdgSurfaceV6);
-
-public:
- enum Xdg_Surface_Role
- {
- DS_XDG_SURFACE_ROLE_NONE,
- DS_XDG_SURFACE_ROLE_TOPLEVEL,
- DS_XDG_SURFACE_ROLE_POPUP,
- };
-
-public:
- DSWaylandZxdgSurfaceV6(DSWaylandZxdgShellV6 *xdgShell);
- DSWaylandZxdgSurfaceV6(struct ::wl_client *client, int id, int ver, DSWaylandZxdgShellV6 *xdgShell);
- virtual ~DSWaylandZxdgSurfaceV6();
-
- void init(struct ::wl_client *client, int id, int ver);
-
- // TODO: Do we use ::wl_resource or DSWaylandSurface?
- void setWlSurface(struct ::wl_resource *surface) override;
- struct ::wl_resource *getWlSurface(void) override;
-
- void setSurface(DSWaylandSurface *surface) override;
- DSWaylandSurface *getSurface(void) override;
-
- void sendConfigure(int x, int y, unsigned int w, unsigned int h) override;
-
- void setWindowTitle(const std::string &title);
- void setAppID(const std::string &appId);
-
- void getGeometry(int *x, int *y, int *w, int *h);
- std::string getWindowTitle();
- std::string getAppID();
-
-private:
- DSWaylandZxdgShellV6 *__xdgShell;
-};
-
-class DSWaylandZxdgToplevelV6 : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandZxdgToplevelV6);
-
-public:
- DSWaylandZxdgToplevelV6();
- DSWaylandZxdgToplevelV6(DSWaylandZxdgSurfaceV6 *zxdgSurface, struct ::wl_client *client, int id, int ver);
- virtual ~DSWaylandZxdgToplevelV6();
-
- void init(DSWaylandZxdgSurfaceV6 *zxdgSurface, struct ::wl_client *client, int id, int ver);
- void sendConfigure(unsigned int w, unsigned int h);
-};
-
-class DSWaylandZxdgPopupV6 : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWaylandZxdgPopupV6);
-
-public:
- DSWaylandZxdgPopupV6();
- DSWaylandZxdgPopupV6(DSWaylandZxdgSurfaceV6 *zxdgSurface, struct ::wl_client *client, int id, int ver);
- virtual ~DSWaylandZxdgPopupV6();
-
- void init(DSWaylandZxdgSurfaceV6 *zxdgSurface, struct ::wl_client *client, int id, int ver);
- void sendConfigure(int x, int y, unsigned int w, unsigned int h);
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif // __DS_WAYLAND_ZXDG_SHELL_V6_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WAYLAND_ZXDG_SHELL_V6_PRIVATE_H__
-#define __DS_WAYLAND_ZXDG_SHELL_V6_PRIVATE_H__
-
-#include <DSWindow.h>
-
-#include "dswayland-server-xdg-shell-unstable-v6.h"
-#include "DSWaylandZxdgShellV6.h"
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class DSWaylandZxdgShellV6Private : public DSObjectPrivate, public DSWaylandServer::zxdg_shell_v6
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandZxdgShellV6);
-
-public:
- DSWaylandZxdgShellV6Private() = delete;
- DSWaylandZxdgShellV6Private(DSWaylandZxdgShellV6 *p_ptr);
- ~DSWaylandZxdgShellV6Private() override;
-
-protected:
- void zxdg_shell_v6_bind_resource(Resource *resource) override;
- void zxdg_shell_v6_destroy_resource(Resource *resource) override;
-
- void zxdg_shell_v6_destroy(Resource *resource) override;
- void zxdg_shell_v6_create_positioner(Resource *resource, uint32_t id) override;
- void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
- void zxdg_shell_v6_pong(Resource *resource, uint32_t serial) override;
-
- void addSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf);
- void delSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf);
- std::list<DSWaylandZxdgSurfaceV6 *> getSurfaceList();
-
-private:
- std::list<DSWaylandZxdgSurfaceV6 *> __surfList;
-};
-
-class DSWaylandZxdgPositionerV6Private : public DSObjectPrivate, public DSWaylandServer::zxdg_positioner_v6
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandZxdgPositionerV6);
-
-public:
- DSWaylandZxdgPositionerV6Private() = delete;
- DSWaylandZxdgPositionerV6Private(DSWaylandZxdgPositionerV6 *p_ptr);
- ~DSWaylandZxdgPositionerV6Private() override;
-
-protected:
- void zxdg_positioner_v6_bind_resource(zxdg_positioner_v6::Resource *resource) override;
- void zxdg_positioner_v6_destroy_resource(zxdg_positioner_v6::Resource *resource) override;
-
- void zxdg_positioner_v6_destroy(zxdg_positioner_v6::Resource *resource) override;
- void zxdg_positioner_v6_set_size(zxdg_positioner_v6::Resource *resource, int32_t width, int32_t height) override;
- void zxdg_positioner_v6_set_anchor_rect(zxdg_positioner_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
- void zxdg_positioner_v6_set_anchor(zxdg_positioner_v6::Resource *resource, uint32_t anchor) override;
- void zxdg_positioner_v6_set_gravity(zxdg_positioner_v6::Resource *resource, uint32_t gravity) override;
- void zxdg_positioner_v6_set_constraint_adjustment(zxdg_positioner_v6::Resource *resource, uint32_t constraint_adjustment) override;
- void zxdg_positioner_v6_set_offset(zxdg_positioner_v6::Resource *resource, int32_t x, int32_t y) override;
-};
-
-class DSWaylandZxdgSurfaceV6Private : public DSObjectPrivate, public DSWaylandServer::zxdg_surface_v6
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandZxdgSurfaceV6);
-
-public:
- DSWaylandZxdgSurfaceV6Private() = delete;
- DSWaylandZxdgSurfaceV6Private(DSWaylandZxdgSurfaceV6 *p_ptr);
- ~DSWaylandZxdgSurfaceV6Private() override;
-
- void setWlSurface(struct ::wl_resource *surface);
- struct ::wl_resource *getWlSurface(void);
-
- void setSurface(DSWaylandSurface *surface);
- DSWaylandSurface *getSurface(void);
-
- void sendConfigure(int x, int y, unsigned int w, unsigned int h);
-
-protected:
- void zxdg_surface_v6_bind_resource(zxdg_surface_v6::Resource *resource) override;
- void zxdg_surface_v6_destroy_resource(zxdg_surface_v6::Resource *resource) override;
-
- void zxdg_surface_v6_destroy(zxdg_surface_v6::Resource *resource) override;
- void zxdg_surface_v6_get_toplevel(zxdg_surface_v6::Resource *resource, uint32_t id) override;
- void zxdg_surface_v6_get_popup(zxdg_surface_v6::Resource *resource, uint32_t id, struct ::wl_resource *parent, struct ::wl_resource *positioner) override;
- void zxdg_surface_v6_set_window_geometry(zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
- void zxdg_surface_v6_ack_configure(zxdg_surface_v6::Resource *resource, uint32_t serial) override;
-
- void setWindowTitle(const std::string &title);
- void setAppID(const std::string &appId);
-
- void getGeometry(int *x, int *y, int *w, int *h);
- std::string getWindowTitle();
- std::string getAppID();
-
-private:
- struct ::wl_resource *__wlSurface;
- DSWaylandSurface *__dsSurface;
- DSWaylandZxdgToplevelV6 *__toplevel;
- DSWaylandZxdgPopupV6 *__popup;
- DSWaylandZxdgSurfaceV6::Xdg_Surface_Role __role;
-
- int __x, __y;
- unsigned int __w, __h;
- std::string __title, __appId;
-};
-
-class DSWaylandZxdgToplevelV6Private : public DSObjectPrivate, public DSWaylandServer::zxdg_toplevel_v6
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandZxdgToplevelV6);
-
-public:
- DSWaylandZxdgToplevelV6Private() = delete;
- DSWaylandZxdgToplevelV6Private(DSWaylandZxdgToplevelV6 *p_ptr);
- ~DSWaylandZxdgToplevelV6Private() override;
-
- void sendConfigure(unsigned int w, unsigned int h);
-
-protected:
- void zxdg_toplevel_v6_bind_resource(zxdg_toplevel_v6::Resource *resource) override;
- void zxdg_toplevel_v6_destroy_resource(zxdg_toplevel_v6::Resource *resource) override;
-
- void zxdg_toplevel_v6_destroy(zxdg_toplevel_v6::Resource *resource) override;
- void zxdg_toplevel_v6_set_parent(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *parent) override;
- void zxdg_toplevel_v6_set_title(zxdg_toplevel_v6::Resource *resource, const std::string &title) override;
- void zxdg_toplevel_v6_set_app_id(zxdg_toplevel_v6::Resource *resource, const std::string &app_id) override;
- void zxdg_toplevel_v6_show_window_menu(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y) override;
- void zxdg_toplevel_v6_move(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *seat, uint32_t serial) override;
- void zxdg_toplevel_v6_resize(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges) override;
- void zxdg_toplevel_v6_set_max_size(zxdg_toplevel_v6::Resource *resource, int32_t width, int32_t height) override;
- void zxdg_toplevel_v6_set_min_size(zxdg_toplevel_v6::Resource *resource, int32_t width, int32_t height) override;
- void zxdg_toplevel_v6_set_maximized(zxdg_toplevel_v6::Resource *resource) override;
- void zxdg_toplevel_v6_unset_maximized(zxdg_toplevel_v6::Resource *resource) override;
- void zxdg_toplevel_v6_set_fullscreen(zxdg_toplevel_v6::Resource *resource, struct ::wl_resource *output) override;
- void zxdg_toplevel_v6_unset_fullscreen(zxdg_toplevel_v6::Resource *resource) override;
- void zxdg_toplevel_v6_set_minimized(zxdg_toplevel_v6::Resource *resource) override;
-
-private:
- DSWaylandZxdgSurfaceV6 *__zxdgSurface;
-};
-
-class DSWaylandZxdgPopupV6Private : public DSObjectPrivate, public DSWaylandServer::zxdg_popup_v6
-{
-DS_PIMPL_USE_PUBLIC(DSWaylandZxdgPopupV6);
-
-public:
- DSWaylandZxdgPopupV6Private() = delete;
- DSWaylandZxdgPopupV6Private(DSWaylandZxdgPopupV6 *p_ptr);
- ~DSWaylandZxdgPopupV6Private() override;
-
- void sendConfigure(int x, int y, unsigned int w, unsigned int h);
-
-protected:
- void zxdg_popup_v6_bind_resource(zxdg_popup_v6::Resource *resource) override;
- void zxdg_popup_v6_destroy_resource(zxdg_popup_v6::Resource *resource) override;
-
- void zxdg_popup_v6_destroy(zxdg_popup_v6::Resource *resource) override;
- void zxdg_popup_v6_grab(zxdg_popup_v6::Resource *resource, struct ::wl_resource *seat, uint32_t serial) override;
-
-private:
- DSWaylandZxdgSurfaceV6 *__zxdgSurface;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif // __DS_WAYLAND_ZXDG_SHELL_V6_PRIVATE_H__
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __I_DS_WAYLAND_SHELL_H__
-#define __I_DS_WAYLAND_SHELL_H__
-
-#include <DSCore.h>
-#include <DSSignal.h>
-#include <DSObject.h>
-#include "DSWaylandSurface.h"
-#include <wayland-server-core.h>
-
-namespace display_server
-{
-
-/*LCOV_EXCL_START*/
-class IDSWaylandShellSurface;
-
-class IDSWaylandShell : public DSObject
-{
-public:
- virtual ~IDSWaylandShell() = default;
-
- virtual void registerCallbackShellSurfaceCreated(DSObject *slot, std::function<void(IDSWaylandShellSurface*)> func) = 0;
- virtual void registerCallbackShellSurfaceDestroyed(DSObject *slot, std::function<void(IDSWaylandShellSurface*)> func) = 0;
-};
-
-
-class IDSWaylandShellSurface : public DSObject
-{
-public:
- virtual ~IDSWaylandShellSurface() = default;
-
- // TODO: we need change ::wl_resource to DSWaylandSurface
- virtual void setWlSurface(struct ::wl_resource *surface) = 0;
- virtual struct ::wl_resource *getWlSurface(void) = 0;
-
- virtual void setSurface(DSWaylandSurface *surface) = 0;
- virtual DSWaylandSurface *getSurface(void) = 0;
-
- virtual void sendConfigure(int x, int y, unsigned int w, unsigned int h) = 0;
-};
-/*LCOV_EXCL_STOP*/
-
-}
-
-#endif // __I_DS_WAYLAND_SHELL_H__
-
+++ /dev/null
-# DSWaylandServer
-A collection of classes and headers of wayland server side objects
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/eom.xml */
-
-#include "dswayland-server-wl-eom.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- wl_eom::wl_eom(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_eom::wl_eom(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_eom::wl_eom(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_eom::wl_eom()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_eom::~wl_eom()
- {
- std::multimap<struct ::wl_client*, wl_eom::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_eom::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_eom::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_eom::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_eom::Resource *wl_eom::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_eom::Resource *wl_eom::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_eom::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_eom_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_eom::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_eom::interface()
- {
- return &::wl_eom_interface;
- }
-
- wl_eom::Resource *wl_eom::eom_allocate()
- {
- return new Resource;
- }
-
- void wl_eom::eom_bind_resource(Resource *)
- {
- }
-
- void wl_eom::eom_destroy_resource(Resource *)
- {
- }
-
- void wl_eom::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_eom *that = static_cast<wl_eom *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_eom::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_eom *that = static_cast<wl_eom::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_eom::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_eom *that = resource->eom_object;
- that->m_resource_map.erase(resource->client());
- that->eom_destroy_resource(resource);
- delete resource;
- }
-
- wl_eom::Resource *wl_eom::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_eom_interface, version, id);
- return bind(handle);
- }
-
- wl_eom::Resource *wl_eom::bind(struct ::wl_resource *handle)
- {
- Resource *resource = eom_allocate();
- resource->eom_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_eom_interface, resource, destroy_func);
- resource->handle = handle;
- eom_bind_resource(resource);
- return resource;
- }
- wl_eom::Resource *wl_eom::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_eom_interface, &m_wl_eom_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_eom_interface wl_eom::m_wl_eom_interface = {
- wl_eom::handle_set_attribute,
- wl_eom::handle_set_shell_window,
- wl_eom::handle_get_output_info
- };
-
- void wl_eom::eom_set_attribute(Resource *, uint32_t , uint32_t )
- {
- }
-
- void wl_eom::eom_set_shell_window(Resource *, uint32_t , struct ::wl_resource *)
- {
- }
-
- void wl_eom::eom_get_output_info(Resource *, uint32_t )
- {
- }
-
-
- void wl_eom::handle_set_attribute(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t output_id,
- uint32_t attribute)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_eom *>(r->eom_object)->eom_set_attribute(
- r,
- output_id,
- attribute);
- }
-
- void wl_eom::handle_set_shell_window(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t output_id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_eom *>(r->eom_object)->eom_set_shell_window(
- r,
- output_id,
- surface);
- }
-
- void wl_eom::handle_get_output_info(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t output_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_eom *>(r->eom_object)->eom_get_output_info(
- r,
- output_id);
- }
-
- void wl_eom::send_output_count(uint32_t count)
- {
- DS_ASSERT_X(m_resource, "wl_eom::output_count", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_eom::output_count as it's not initialised");
- return;
- }
- send_output_count(
- m_resource->handle,
- count);
- }
-
- void wl_eom::send_output_count(struct ::wl_resource *resource, uint32_t count)
- {
- wl_eom_send_output_count(
- resource,
- count);
- }
-
-
- void wl_eom::send_output_info(uint32_t output_id, uint32_t type, uint32_t mode, uint32_t w, uint32_t h, uint32_t w_mm, uint32_t h_mm, uint32_t connection, uint32_t skip, uint32_t attribute, uint32_t attribute_state, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "wl_eom::output_info", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_eom::output_info as it's not initialised");
- return;
- }
- send_output_info(
- m_resource->handle,
- output_id,
- type,
- mode,
- w,
- h,
- w_mm,
- h_mm,
- connection,
- skip,
- attribute,
- attribute_state,
- error);
- }
-
- void wl_eom::send_output_info(struct ::wl_resource *resource, uint32_t output_id, uint32_t type, uint32_t mode, uint32_t w, uint32_t h, uint32_t w_mm, uint32_t h_mm, uint32_t connection, uint32_t skip, uint32_t attribute, uint32_t attribute_state, uint32_t error)
- {
- wl_eom_send_output_info(
- resource,
- output_id,
- type,
- mode,
- w,
- h,
- w_mm,
- h_mm,
- connection,
- skip,
- attribute,
- attribute_state,
- error);
- }
-
-
- void wl_eom::send_output_type(uint32_t output_id, uint32_t type, uint32_t status)
- {
- DS_ASSERT_X(m_resource, "wl_eom::output_type", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_eom::output_type as it's not initialised");
- return;
- }
- send_output_type(
- m_resource->handle,
- output_id,
- type,
- status);
- }
-
- void wl_eom::send_output_type(struct ::wl_resource *resource, uint32_t output_id, uint32_t type, uint32_t status)
- {
- wl_eom_send_output_type(
- resource,
- output_id,
- type,
- status);
- }
-
-
- void wl_eom::send_output_mode(uint32_t output_id, uint32_t mode)
- {
- DS_ASSERT_X(m_resource, "wl_eom::output_mode", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_eom::output_mode as it's not initialised");
- return;
- }
- send_output_mode(
- m_resource->handle,
- output_id,
- mode);
- }
-
- void wl_eom::send_output_mode(struct ::wl_resource *resource, uint32_t output_id, uint32_t mode)
- {
- wl_eom_send_output_mode(
- resource,
- output_id,
- mode);
- }
-
-
- void wl_eom::send_output_attribute(uint32_t output_id, uint32_t attribute, uint32_t attribute_state, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "wl_eom::output_attribute", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_eom::output_attribute as it's not initialised");
- return;
- }
- send_output_attribute(
- m_resource->handle,
- output_id,
- attribute,
- attribute_state,
- error);
- }
-
- void wl_eom::send_output_attribute(struct ::wl_resource *resource, uint32_t output_id, uint32_t attribute, uint32_t attribute_state, uint32_t error)
- {
- wl_eom_send_output_attribute(
- resource,
- output_id,
- attribute,
- attribute_state,
- error);
- }
-
-
- void wl_eom::send_output_set_window(uint32_t output_id, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "wl_eom::output_set_window", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_eom::output_set_window as it's not initialised");
- return;
- }
- send_output_set_window(
- m_resource->handle,
- output_id,
- error);
- }
-
- void wl_eom::send_output_set_window(struct ::wl_resource *resource, uint32_t output_id, uint32_t error)
- {
- wl_eom_send_output_set_window(
- resource,
- output_id,
- error);
- }
-
-
- void wl_eom::send_output_add(uint32_t output_id)
- {
- DS_ASSERT_X(m_resource, "wl_eom::output_add", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_eom::output_add as it's not initialised");
- return;
- }
- send_output_add(
- m_resource->handle,
- output_id);
- }
-
- void wl_eom::send_output_add(struct ::wl_resource *resource, uint32_t output_id)
- {
- wl_eom_send_output_add(
- resource,
- output_id);
- }
-
-
- void wl_eom::send_output_remove(uint32_t output_id)
- {
- DS_ASSERT_X(m_resource, "wl_eom::output_remove", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_eom::output_remove as it's not initialised");
- return;
- }
- send_output_remove(
- m_resource->handle,
- output_id);
- }
-
- void wl_eom::send_output_remove(struct ::wl_resource *resource, uint32_t output_id)
- {
- wl_eom_send_output_remove(
- resource,
- output_id);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/eom.xml */
-
-#ifndef __DS_WL_EOM_PROTOCOL_H__
-#define __DS_WL_EOM_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "wl-eom-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class wl_eom
- {
- public:
- wl_eom(struct ::wl_client *client, uint32_t id, int version);
- wl_eom(struct ::wl_display *display, int version);
- wl_eom(struct ::wl_resource *resource);
- wl_eom();
-
- virtual ~wl_eom();
-
- class Resource
- {
- public:
- Resource() : eom_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_eom *eom_object;
- wl_eom *object() { return eom_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_none = 0, // no error
- error_no_output = 1, // Given output is invalid.
- error_no_attribute = 2, // Given attribute is invalid.
- error_output_occupied = 3, // The key has been grabbed already.
- };
-
- enum type {
- type_none = 0, // none
- type_vga = 1, // VGA output connector type
- type_dvii = 2, // DVI-I output connector type
- type_dvid = 3, // DVI-D output connector type
- type_dvia = 4, // DVI-A output connector type
- type_composite = 5, // Composite output connector type
- type_svideo = 6, // S-Video output connector type
- type_lvds = 7, // LVDS output connector type
- type_component = 8, // Component output connector type
- type_9pindin = 9, // 9 pin DIN output connector type
- type_displayport = 10, // DisplayPort output connector type
- type_hdmia = 11, // HDMI type A output connector type
- type_hdmib = 12, // HDMI type B output connector type
- type_tv = 13, // TV output connector type
- type_edp = 14, // eDP output connector type
- type_virtual = 15, // Virtual output connector type
- type_dsi = 16, // DSI output connector type
- };
-
- enum status {
- status_none = 0, // none
- status_connection = 1, // output connected
- status_disconnection = 2, // output disconnected
- };
-
- enum mode {
- mode_none = 0, // none
- mode_mirror = 1, // mirror mode
- mode_presentation = 2, // presentation mode
- };
-
- enum attribute {
- attribute_none = 0, // none
- attribute_normal = 1, // nomal attribute
- attribute_exclusive_share = 2, // exclusive share attribute
- attribute_exclusive = 3, // exclusive attribute
- };
-
- enum attribute_state {
- attribute_state_none = 0, // none
- attribute_state_active = 1, // attribute is active on the output
- attribute_state_inactive = 2, // attribute is inactive on the output
- attribute_state_lost = 3, // the connection of output is lost
- };
-
- void send_output_count(uint32_t count);
- void send_output_count(struct ::wl_resource *resource, uint32_t count);
- void send_output_info(uint32_t output_id, uint32_t type, uint32_t mode, uint32_t w, uint32_t h, uint32_t w_mm, uint32_t h_mm, uint32_t connection, uint32_t skip, uint32_t attribute, uint32_t attribute_state, uint32_t error);
- void send_output_info(struct ::wl_resource *resource, uint32_t output_id, uint32_t type, uint32_t mode, uint32_t w, uint32_t h, uint32_t w_mm, uint32_t h_mm, uint32_t connection, uint32_t skip, uint32_t attribute, uint32_t attribute_state, uint32_t error);
- void send_output_type(uint32_t output_id, uint32_t type, uint32_t status);
- void send_output_type(struct ::wl_resource *resource, uint32_t output_id, uint32_t type, uint32_t status);
- void send_output_mode(uint32_t output_id, uint32_t mode);
- void send_output_mode(struct ::wl_resource *resource, uint32_t output_id, uint32_t mode);
- void send_output_attribute(uint32_t output_id, uint32_t attribute, uint32_t attribute_state, uint32_t error);
- void send_output_attribute(struct ::wl_resource *resource, uint32_t output_id, uint32_t attribute, uint32_t attribute_state, uint32_t error);
- void send_output_set_window(uint32_t output_id, uint32_t error);
- void send_output_set_window(struct ::wl_resource *resource, uint32_t output_id, uint32_t error);
- void send_output_add(uint32_t output_id);
- void send_output_add(struct ::wl_resource *resource, uint32_t output_id);
- void send_output_remove(uint32_t output_id);
- void send_output_remove(struct ::wl_resource *resource, uint32_t output_id);
-
- protected:
- virtual Resource *eom_allocate();
-
- virtual void eom_bind_resource(Resource *resource);
- virtual void eom_destroy_resource(Resource *resource);
-
- virtual void eom_set_attribute(Resource *resource, uint32_t output_id, uint32_t attribute);
- virtual void eom_set_shell_window(Resource *resource, uint32_t output_id, struct ::wl_resource *surface);
- virtual void eom_get_output_info(Resource *resource, uint32_t output_id);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_eom_interface m_wl_eom_interface;
-
- static void handle_set_attribute(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t output_id,
- uint32_t attribute);
- static void handle_set_shell_window(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t output_id,
- struct ::wl_resource *surface);
- static void handle_get_output_info(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t output_id);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_eom *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/fullscreen-shell.xml */
-
-#include "dswayland-server-fullscreen-shell.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- _wl_fullscreen_shell::_wl_fullscreen_shell(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- _wl_fullscreen_shell::_wl_fullscreen_shell(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- _wl_fullscreen_shell::_wl_fullscreen_shell(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- _wl_fullscreen_shell::_wl_fullscreen_shell()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- _wl_fullscreen_shell::~_wl_fullscreen_shell()
- {
- std::multimap<struct ::wl_client*, _wl_fullscreen_shell::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- _wl_fullscreen_shell::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void _wl_fullscreen_shell::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void _wl_fullscreen_shell::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void _wl_fullscreen_shell::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::_wl_fullscreen_shell_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = _wl_fullscreen_shell::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *_wl_fullscreen_shell::interface()
- {
- return &::_wl_fullscreen_shell_interface;
- }
-
- _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::_wl_fullscreen_shell_allocate()
- {
- return new Resource;
- }
-
- void _wl_fullscreen_shell::_wl_fullscreen_shell_bind_resource(Resource *)
- {
- }
-
- void _wl_fullscreen_shell::_wl_fullscreen_shell_destroy_resource(Resource *)
- {
- }
-
- void _wl_fullscreen_shell::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- _wl_fullscreen_shell *that = static_cast<_wl_fullscreen_shell *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void _wl_fullscreen_shell::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- _wl_fullscreen_shell *that = static_cast<_wl_fullscreen_shell::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void _wl_fullscreen_shell::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- _wl_fullscreen_shell *that = resource->_wl_fullscreen_shell_object;
- that->m_resource_map.erase(resource->client());
- that->_wl_fullscreen_shell_destroy_resource(resource);
- delete resource;
- }
-
- _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::_wl_fullscreen_shell_interface, version, id);
- return bind(handle);
- }
-
- _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::bind(struct ::wl_resource *handle)
- {
- Resource *resource = _wl_fullscreen_shell_allocate();
- resource->_wl_fullscreen_shell_object = this;
-
- wl_resource_set_implementation(handle, &m__wl_fullscreen_shell_interface, resource, destroy_func);
- resource->handle = handle;
- _wl_fullscreen_shell_bind_resource(resource);
- return resource;
- }
- _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::_wl_fullscreen_shell_interface, &m__wl_fullscreen_shell_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::_wl_fullscreen_shell_interface _wl_fullscreen_shell::m__wl_fullscreen_shell_interface = {
- _wl_fullscreen_shell::handle_release,
- _wl_fullscreen_shell::handle_present_surface,
- _wl_fullscreen_shell::handle_present_surface_for_mode
- };
-
- void _wl_fullscreen_shell::_wl_fullscreen_shell_release(Resource *)
- {
- }
-
- void _wl_fullscreen_shell::_wl_fullscreen_shell_present_surface(Resource *, struct ::wl_resource *, uint32_t , struct ::wl_resource *)
- {
- }
-
- void _wl_fullscreen_shell::_wl_fullscreen_shell_present_surface_for_mode(Resource *, struct ::wl_resource *, struct ::wl_resource *, int32_t , uint32_t)
- {
- }
-
-
- void _wl_fullscreen_shell::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<_wl_fullscreen_shell *>(r->_wl_fullscreen_shell_object)->_wl_fullscreen_shell_release(
- r);
- }
-
- void _wl_fullscreen_shell::handle_present_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t method,
- struct ::wl_resource *output)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<_wl_fullscreen_shell *>(r->_wl_fullscreen_shell_object)->_wl_fullscreen_shell_present_surface(
- r,
- surface,
- method,
- output);
- }
-
- void _wl_fullscreen_shell::handle_present_surface_for_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- struct ::wl_resource *output,
- int32_t framerate,
- uint32_t feedback)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<_wl_fullscreen_shell *>(r->_wl_fullscreen_shell_object)->_wl_fullscreen_shell_present_surface_for_mode(
- r,
- surface,
- output,
- framerate,
- feedback);
- }
-
- void _wl_fullscreen_shell::send_capability(uint32_t capability)
- {
- DS_ASSERT_X(m_resource, "_wl_fullscreen_shell::capability", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call _wl_fullscreen_shell::capability as it's not initialised");
- return;
- }
- send_capability(
- m_resource->handle,
- capability);
- }
-
- void _wl_fullscreen_shell::send_capability(struct ::wl_resource *resource, uint32_t capability)
- {
- _wl_fullscreen_shell_send_capability(
- resource,
- capability);
- }
-
-
- _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- _wl_fullscreen_shell_mode_feedback::~_wl_fullscreen_shell_mode_feedback()
- {
- std::multimap<struct ::wl_client*, _wl_fullscreen_shell_mode_feedback::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- _wl_fullscreen_shell_mode_feedback::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void _wl_fullscreen_shell_mode_feedback::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void _wl_fullscreen_shell_mode_feedback::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void _wl_fullscreen_shell_mode_feedback::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::_wl_fullscreen_shell_mode_feedback_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = _wl_fullscreen_shell_mode_feedback::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *_wl_fullscreen_shell_mode_feedback::interface()
- {
- return &::_wl_fullscreen_shell_mode_feedback_interface;
- }
-
- _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback_allocate()
- {
- return new Resource;
- }
-
- void _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback_bind_resource(Resource *)
- {
- }
-
- void _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback_destroy_resource(Resource *)
- {
- }
-
- void _wl_fullscreen_shell_mode_feedback::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- _wl_fullscreen_shell_mode_feedback *that = static_cast<_wl_fullscreen_shell_mode_feedback *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void _wl_fullscreen_shell_mode_feedback::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- _wl_fullscreen_shell_mode_feedback *that = static_cast<_wl_fullscreen_shell_mode_feedback::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void _wl_fullscreen_shell_mode_feedback::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- _wl_fullscreen_shell_mode_feedback *that = resource->_wl_fullscreen_shell_mode_feedback_object;
- that->m_resource_map.erase(resource->client());
- that->_wl_fullscreen_shell_mode_feedback_destroy_resource(resource);
- delete resource;
- }
-
- _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::_wl_fullscreen_shell_mode_feedback_interface, version, id);
- return bind(handle);
- }
-
- _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::bind(struct ::wl_resource *handle)
- {
- Resource *resource = _wl_fullscreen_shell_mode_feedback_allocate();
- resource->_wl_fullscreen_shell_mode_feedback_object = this;
-
- wl_resource_set_implementation(handle, NULL, resource, destroy_func);
- resource->handle = handle;
- _wl_fullscreen_shell_mode_feedback_bind_resource(resource);
- return resource;
- }
- _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::_wl_fullscreen_shell_mode_feedback_interface, NULL))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- void _wl_fullscreen_shell_mode_feedback::send_mode_successful()
- {
- DS_ASSERT_X(m_resource, "_wl_fullscreen_shell_mode_feedback::mode_successful", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call _wl_fullscreen_shell_mode_feedback::mode_successful as it's not initialised");
- return;
- }
- send_mode_successful(
- m_resource->handle);
- }
-
- void _wl_fullscreen_shell_mode_feedback::send_mode_successful(struct ::wl_resource *resource)
- {
- _wl_fullscreen_shell_mode_feedback_send_mode_successful(
- resource);
- }
-
-
- void _wl_fullscreen_shell_mode_feedback::send_mode_failed()
- {
- DS_ASSERT_X(m_resource, "_wl_fullscreen_shell_mode_feedback::mode_failed", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call _wl_fullscreen_shell_mode_feedback::mode_failed as it's not initialised");
- return;
- }
- send_mode_failed(
- m_resource->handle);
- }
-
- void _wl_fullscreen_shell_mode_feedback::send_mode_failed(struct ::wl_resource *resource)
- {
- _wl_fullscreen_shell_mode_feedback_send_mode_failed(
- resource);
- }
-
-
- void _wl_fullscreen_shell_mode_feedback::send_present_cancelled()
- {
- DS_ASSERT_X(m_resource, "_wl_fullscreen_shell_mode_feedback::present_cancelled", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call _wl_fullscreen_shell_mode_feedback::present_cancelled as it's not initialised");
- return;
- }
- send_present_cancelled(
- m_resource->handle);
- }
-
- void _wl_fullscreen_shell_mode_feedback::send_present_cancelled(struct ::wl_resource *resource)
- {
- _wl_fullscreen_shell_mode_feedback_send_present_cancelled(
- resource);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/fullscreen-shell.xml */
-
-#ifndef __DS_FULLSCREEN_SHELL_PROTOCOL_H__
-#define __DS_FULLSCREEN_SHELL_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "fullscreen-shell-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class _wl_fullscreen_shell
- {
- public:
- _wl_fullscreen_shell(struct ::wl_client *client, uint32_t id, int version);
- _wl_fullscreen_shell(struct ::wl_display *display, int version);
- _wl_fullscreen_shell(struct ::wl_resource *resource);
- _wl_fullscreen_shell();
-
- virtual ~_wl_fullscreen_shell();
-
- class Resource
- {
- public:
- Resource() : _wl_fullscreen_shell_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- _wl_fullscreen_shell *_wl_fullscreen_shell_object;
- _wl_fullscreen_shell *object() { return _wl_fullscreen_shell_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum capability {
- capability_arbitrary_modes = 1, // compositor is capable of almost any output mode
- capability_cursor_plane = 2, // compositor has a separate cursor plane
- };
-
- enum present_method {
- present_method_default = 0, // no preference, apply default policy
- present_method_center = 1, // center the surface on the output
- present_method_zoom = 2, // scale the surface, preserving aspect ratio, to the largest size that will fit on the output
- present_method_zoom_crop = 3, // scale the surface, preserving aspect ratio, to fully fill the output cropping if needed
- present_method_stretch = 4, // scale the surface to the size of the output ignoring aspect ratio
- };
-
- enum error {
- error_invalid_method = 0, // present_method is not known
- };
-
- void send_capability(uint32_t capability);
- void send_capability(struct ::wl_resource *resource, uint32_t capability);
-
- protected:
- virtual Resource *_wl_fullscreen_shell_allocate();
-
- virtual void _wl_fullscreen_shell_bind_resource(Resource *resource);
- virtual void _wl_fullscreen_shell_destroy_resource(Resource *resource);
-
- virtual void _wl_fullscreen_shell_release(Resource *resource);
- virtual void _wl_fullscreen_shell_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output);
- virtual void _wl_fullscreen_shell_present_surface_for_mode(Resource *resource, struct ::wl_resource *surface, struct ::wl_resource *output, int32_t framerate, uint32_t feedback);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::_wl_fullscreen_shell_interface m__wl_fullscreen_shell_interface;
-
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_present_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t method,
- struct ::wl_resource *output);
- static void handle_present_surface_for_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- struct ::wl_resource *output,
- int32_t framerate,
- uint32_t feedback);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- _wl_fullscreen_shell *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class _wl_fullscreen_shell_mode_feedback
- {
- public:
- _wl_fullscreen_shell_mode_feedback(struct ::wl_client *client, uint32_t id, int version);
- _wl_fullscreen_shell_mode_feedback(struct ::wl_display *display, int version);
- _wl_fullscreen_shell_mode_feedback(struct ::wl_resource *resource);
- _wl_fullscreen_shell_mode_feedback();
-
- virtual ~_wl_fullscreen_shell_mode_feedback();
-
- class Resource
- {
- public:
- Resource() : _wl_fullscreen_shell_mode_feedback_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- _wl_fullscreen_shell_mode_feedback *_wl_fullscreen_shell_mode_feedback_object;
- _wl_fullscreen_shell_mode_feedback *object() { return _wl_fullscreen_shell_mode_feedback_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_mode_successful();
- void send_mode_successful(struct ::wl_resource *resource);
- void send_mode_failed();
- void send_mode_failed(struct ::wl_resource *resource);
- void send_present_cancelled();
- void send_present_cancelled(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *_wl_fullscreen_shell_mode_feedback_allocate();
-
- virtual void _wl_fullscreen_shell_mode_feedback_bind_resource(Resource *resource);
- virtual void _wl_fullscreen_shell_mode_feedback_destroy_resource(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- _wl_fullscreen_shell_mode_feedback *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/input-method.xml */
-
-#include "dswayland-server-input-method-unstable-v1.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- zwp_input_method_context_v1::zwp_input_method_context_v1(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zwp_input_method_context_v1::zwp_input_method_context_v1(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zwp_input_method_context_v1::zwp_input_method_context_v1(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zwp_input_method_context_v1::zwp_input_method_context_v1()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zwp_input_method_context_v1::~zwp_input_method_context_v1()
- {
- std::multimap<struct ::wl_client*, zwp_input_method_context_v1::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zwp_input_method_context_v1::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zwp_input_method_context_v1::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zwp_input_method_context_v1::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zwp_input_method_context_v1::Resource *zwp_input_method_context_v1::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zwp_input_method_context_v1::Resource *zwp_input_method_context_v1::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zwp_input_method_context_v1::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zwp_input_method_context_v1_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zwp_input_method_context_v1::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zwp_input_method_context_v1::interface()
- {
- return &::zwp_input_method_context_v1_interface;
- }
-
- zwp_input_method_context_v1::Resource *zwp_input_method_context_v1::zwp_input_method_context_v1_allocate()
- {
- return new Resource;
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_bind_resource(Resource *)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_destroy_resource(Resource *)
- {
- }
-
- void zwp_input_method_context_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zwp_input_method_context_v1 *that = static_cast<zwp_input_method_context_v1 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zwp_input_method_context_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zwp_input_method_context_v1 *that = static_cast<zwp_input_method_context_v1::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zwp_input_method_context_v1::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zwp_input_method_context_v1 *that = resource->zwp_input_method_context_v1_object;
- that->m_resource_map.erase(resource->client());
- that->zwp_input_method_context_v1_destroy_resource(resource);
- delete resource;
- }
-
- zwp_input_method_context_v1::Resource *zwp_input_method_context_v1::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zwp_input_method_context_v1_interface, version, id);
- return bind(handle);
- }
-
- zwp_input_method_context_v1::Resource *zwp_input_method_context_v1::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zwp_input_method_context_v1_allocate();
- resource->zwp_input_method_context_v1_object = this;
-
- wl_resource_set_implementation(handle, &m_zwp_input_method_context_v1_interface, resource, destroy_func);
- resource->handle = handle;
- zwp_input_method_context_v1_bind_resource(resource);
- return resource;
- }
- zwp_input_method_context_v1::Resource *zwp_input_method_context_v1::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zwp_input_method_context_v1_interface, &m_zwp_input_method_context_v1_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zwp_input_method_context_v1_interface zwp_input_method_context_v1::m_zwp_input_method_context_v1_interface = {
- zwp_input_method_context_v1::handle_destroy,
- zwp_input_method_context_v1::handle_commit_string,
- zwp_input_method_context_v1::handle_preedit_string,
- zwp_input_method_context_v1::handle_preedit_styling,
- zwp_input_method_context_v1::handle_preedit_cursor,
- zwp_input_method_context_v1::handle_delete_surrounding_text,
- zwp_input_method_context_v1::handle_cursor_position,
- zwp_input_method_context_v1::handle_modifiers_map,
- zwp_input_method_context_v1::handle_keysym,
- zwp_input_method_context_v1::handle_grab_keyboard,
- zwp_input_method_context_v1::handle_key,
- zwp_input_method_context_v1::handle_modifiers,
- zwp_input_method_context_v1::handle_language,
- zwp_input_method_context_v1::handle_text_direction,
- zwp_input_method_context_v1::handle_selection_region,
- zwp_input_method_context_v1::handle_private_command,
- zwp_input_method_context_v1::handle_update_input_panel_data,
- zwp_input_method_context_v1::handle_hide_input_panel,
- zwp_input_method_context_v1::handle_get_selection_text,
- zwp_input_method_context_v1::handle_get_surrounding_text,
- zwp_input_method_context_v1::handle_filter_key_event_done,
- zwp_input_method_context_v1::handle_update_ise_geometry,
- zwp_input_method_context_v1::handle_recapture_string,
- zwp_input_method_context_v1::handle_input_panel_event,
- zwp_input_method_context_v1::handle_commit_content,
- zwp_input_method_context_v1::handle_update_candidate_state,
- zwp_input_method_context_v1::handle_reshow_input_panel,
- zwp_input_method_context_v1::handle_set_floating_panel,
- zwp_input_method_context_v1::handle_set_floating_drag_enabled
- };
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_destroy(Resource *)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_commit_string(Resource *, uint32_t , const std::string &)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_preedit_string(Resource *, uint32_t , const std::string &, const std::string &)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_preedit_styling(Resource *, uint32_t , uint32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_preedit_cursor(Resource *, int32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_delete_surrounding_text(Resource *, int32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_cursor_position(Resource *, int32_t , int32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_modifiers_map(Resource *, struct ::wl_array *)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_keysym(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_grab_keyboard(Resource *, uint32_t)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_key(Resource *, uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_modifiers(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_language(Resource *, uint32_t , const std::string &)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_text_direction(Resource *, uint32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_selection_region(Resource *, uint32_t , int32_t , int32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_private_command(Resource *, uint32_t , const std::string &)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_update_input_panel_data(Resource *, uint32_t , const std::string &, uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_hide_input_panel(Resource *, uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_get_selection_text(Resource *, int32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_get_surrounding_text(Resource *, uint32_t , uint32_t , int32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_filter_key_event_done(Resource *, uint32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_update_ise_geometry(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_recapture_string(Resource *, uint32_t , int32_t , uint32_t , const std::string &, const std::string &, const std::string &)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_input_panel_event(Resource *, uint32_t , uint32_t , uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_commit_content(Resource *, uint32_t , const std::string &, const std::string &, const std::string &)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_update_candidate_state(Resource *, uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_reshow_input_panel(Resource *)
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_set_floating_panel(Resource *, uint32_t )
- {
- }
-
- void zwp_input_method_context_v1::zwp_input_method_context_v1_set_floating_drag_enabled(Resource *, uint32_t )
- {
- }
-
-
- void zwp_input_method_context_v1::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_destroy(
- r);
- }
-
- void zwp_input_method_context_v1::handle_commit_string(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *text)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_commit_string(
- r,
- serial,
- std::string(text));
- }
-
- void zwp_input_method_context_v1::handle_preedit_string(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *text,
- const char *commit)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_preedit_string(
- r,
- serial,
- std::string(text),
- std::string(commit));
- }
-
- void zwp_input_method_context_v1::handle_preedit_styling(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t index,
- uint32_t length,
- uint32_t style)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_preedit_styling(
- r,
- index,
- length,
- style);
- }
-
- void zwp_input_method_context_v1::handle_preedit_cursor(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t index)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_preedit_cursor(
- r,
- index);
- }
-
- void zwp_input_method_context_v1::handle_delete_surrounding_text(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t index,
- uint32_t length)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_delete_surrounding_text(
- r,
- index,
- length);
- }
-
- void zwp_input_method_context_v1::handle_cursor_position(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t index,
- int32_t anchor)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_cursor_position(
- r,
- index,
- anchor);
- }
-
- void zwp_input_method_context_v1::handle_modifiers_map(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_array *map)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_modifiers_map(
- r,
- map);
- }
-
- void zwp_input_method_context_v1::handle_keysym(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t time,
- uint32_t sym,
- uint32_t state,
- uint32_t modifiers)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_keysym(
- r,
- serial,
- time,
- sym,
- state,
- modifiers);
- }
-
- void zwp_input_method_context_v1::handle_grab_keyboard(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t keyboard)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_grab_keyboard(
- r,
- keyboard);
- }
-
- void zwp_input_method_context_v1::handle_key(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t time,
- uint32_t key,
- uint32_t state)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_key(
- r,
- serial,
- time,
- key,
- state);
- }
-
- void zwp_input_method_context_v1::handle_modifiers(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t mods_depressed,
- uint32_t mods_latched,
- uint32_t mods_locked,
- uint32_t group)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_modifiers(
- r,
- serial,
- mods_depressed,
- mods_latched,
- mods_locked,
- group);
- }
-
- void zwp_input_method_context_v1::handle_language(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *language)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_language(
- r,
- serial,
- std::string(language));
- }
-
- void zwp_input_method_context_v1::handle_text_direction(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t direction)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_text_direction(
- r,
- serial,
- direction);
- }
-
- void zwp_input_method_context_v1::handle_selection_region(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- int32_t start,
- int32_t end)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_selection_region(
- r,
- serial,
- start,
- end);
- }
-
- void zwp_input_method_context_v1::handle_private_command(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *command)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_private_command(
- r,
- serial,
- std::string(command));
- }
-
- void zwp_input_method_context_v1::handle_update_input_panel_data(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *input_panel_data,
- uint32_t input_panel_data_length)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_update_input_panel_data(
- r,
- serial,
- std::string(input_panel_data),
- input_panel_data_length);
- }
-
- void zwp_input_method_context_v1::handle_hide_input_panel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_hide_input_panel(
- r,
- serial);
- }
-
- void zwp_input_method_context_v1::handle_get_selection_text(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t fd)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_get_selection_text(
- r,
- fd);
- }
-
- void zwp_input_method_context_v1::handle_get_surrounding_text(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t maxlen_before,
- uint32_t maxlen_after,
- int32_t fd)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_get_surrounding_text(
- r,
- maxlen_before,
- maxlen_after,
- fd);
- }
-
- void zwp_input_method_context_v1::handle_filter_key_event_done(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t state)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_filter_key_event_done(
- r,
- serial,
- state);
- }
-
- void zwp_input_method_context_v1::handle_update_ise_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t x,
- uint32_t y,
- uint32_t width,
- uint32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_update_ise_geometry(
- r,
- serial,
- x,
- y,
- width,
- height);
- }
-
- void zwp_input_method_context_v1::handle_recapture_string(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- int32_t index,
- uint32_t length,
- const char *preedit,
- const char *preedit_commit,
- const char *commit)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_recapture_string(
- r,
- serial,
- index,
- length,
- std::string(preedit),
- std::string(preedit_commit),
- std::string(commit));
- }
-
- void zwp_input_method_context_v1::handle_input_panel_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t event_type,
- uint32_t value)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_input_panel_event(
- r,
- serial,
- event_type,
- value);
- }
-
- void zwp_input_method_context_v1::handle_commit_content(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *content,
- const char *description,
- const char *mime_types)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_commit_content(
- r,
- serial,
- std::string(content),
- std::string(description),
- std::string(mime_types));
- }
-
- void zwp_input_method_context_v1::handle_update_candidate_state(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t state)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_update_candidate_state(
- r,
- state);
- }
-
- void zwp_input_method_context_v1::handle_reshow_input_panel(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_reshow_input_panel(
- r);
- }
-
- void zwp_input_method_context_v1::handle_set_floating_panel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t state)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_set_floating_panel(
- r,
- state);
- }
-
- void zwp_input_method_context_v1::handle_set_floating_drag_enabled(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t enabled)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_context_v1 *>(r->zwp_input_method_context_v1_object)->zwp_input_method_context_v1_set_floating_drag_enabled(
- r,
- enabled);
- }
-
- void zwp_input_method_context_v1::send_surrounding_text(const std::string &text, uint32_t cursor, uint32_t anchor)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::surrounding_text", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::surrounding_text as it's not initialised");
- return;
- }
- send_surrounding_text(
- m_resource->handle,
- text,
- cursor,
- anchor);
- }
-
- void zwp_input_method_context_v1::send_surrounding_text(struct ::wl_resource *resource, const std::string &text, uint32_t cursor, uint32_t anchor)
- {
- zwp_input_method_context_v1_send_surrounding_text(
- resource,
- text.c_str(),
- cursor,
- anchor);
- }
-
-
- void zwp_input_method_context_v1::send_reset()
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::reset", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::reset as it's not initialised");
- return;
- }
- send_reset(
- m_resource->handle);
- }
-
- void zwp_input_method_context_v1::send_reset(struct ::wl_resource *resource)
- {
- zwp_input_method_context_v1_send_reset(
- resource);
- }
-
-
- void zwp_input_method_context_v1::send_content_type(uint32_t hint, uint32_t purpose)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::content_type", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::content_type as it's not initialised");
- return;
- }
- send_content_type(
- m_resource->handle,
- hint,
- purpose);
- }
-
- void zwp_input_method_context_v1::send_content_type(struct ::wl_resource *resource, uint32_t hint, uint32_t purpose)
- {
- zwp_input_method_context_v1_send_content_type(
- resource,
- hint,
- purpose);
- }
-
-
- void zwp_input_method_context_v1::send_invoke_action(uint32_t button, uint32_t index)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::invoke_action", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::invoke_action as it's not initialised");
- return;
- }
- send_invoke_action(
- m_resource->handle,
- button,
- index);
- }
-
- void zwp_input_method_context_v1::send_invoke_action(struct ::wl_resource *resource, uint32_t button, uint32_t index)
- {
- zwp_input_method_context_v1_send_invoke_action(
- resource,
- button,
- index);
- }
-
-
- void zwp_input_method_context_v1::send_commit_state(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::commit_state", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::commit_state as it's not initialised");
- return;
- }
- send_commit_state(
- m_resource->handle,
- serial);
- }
-
- void zwp_input_method_context_v1::send_commit_state(struct ::wl_resource *resource, uint32_t serial)
- {
- zwp_input_method_context_v1_send_commit_state(
- resource,
- serial);
- }
-
-
- void zwp_input_method_context_v1::send_preferred_language(const std::string &language)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::preferred_language", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::preferred_language as it's not initialised");
- return;
- }
- send_preferred_language(
- m_resource->handle,
- language);
- }
-
- void zwp_input_method_context_v1::send_preferred_language(struct ::wl_resource *resource, const std::string &language)
- {
- zwp_input_method_context_v1_send_preferred_language(
- resource,
- language.c_str());
- }
-
-
- void zwp_input_method_context_v1::send_return_key_type(uint32_t return_key_type)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::return_key_type", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::return_key_type as it's not initialised");
- return;
- }
- send_return_key_type(
- m_resource->handle,
- return_key_type);
- }
-
- void zwp_input_method_context_v1::send_return_key_type(struct ::wl_resource *resource, uint32_t return_key_type)
- {
- zwp_input_method_context_v1_send_return_key_type(
- resource,
- return_key_type);
- }
-
-
- void zwp_input_method_context_v1::send_return_key_disabled(uint32_t return_key_disabled)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::return_key_disabled", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::return_key_disabled as it's not initialised");
- return;
- }
- send_return_key_disabled(
- m_resource->handle,
- return_key_disabled);
- }
-
- void zwp_input_method_context_v1::send_return_key_disabled(struct ::wl_resource *resource, uint32_t return_key_disabled)
- {
- zwp_input_method_context_v1_send_return_key_disabled(
- resource,
- return_key_disabled);
- }
-
-
- void zwp_input_method_context_v1::send_input_panel_data(const std::string &input_panel_data, uint32_t input_panel_data_length)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::input_panel_data", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::input_panel_data as it's not initialised");
- return;
- }
- send_input_panel_data(
- m_resource->handle,
- input_panel_data,
- input_panel_data_length);
- }
-
- void zwp_input_method_context_v1::send_input_panel_data(struct ::wl_resource *resource, const std::string &input_panel_data, uint32_t input_panel_data_length)
- {
- zwp_input_method_context_v1_send_input_panel_data(
- resource,
- input_panel_data.c_str(),
- input_panel_data_length);
- }
-
-
- void zwp_input_method_context_v1::send_bidi_direction(uint32_t direction)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::bidi_direction", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::bidi_direction as it's not initialised");
- return;
- }
- send_bidi_direction(
- m_resource->handle,
- direction);
- }
-
- void zwp_input_method_context_v1::send_bidi_direction(struct ::wl_resource *resource, uint32_t direction)
- {
- zwp_input_method_context_v1_send_bidi_direction(
- resource,
- direction);
- }
-
-
- void zwp_input_method_context_v1::send_cursor_position(uint32_t cursor_position)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::cursor_position", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::cursor_position as it's not initialised");
- return;
- }
- send_cursor_position(
- m_resource->handle,
- cursor_position);
- }
-
- void zwp_input_method_context_v1::send_cursor_position(struct ::wl_resource *resource, uint32_t cursor_position)
- {
- zwp_input_method_context_v1_send_cursor_position(
- resource,
- cursor_position);
- }
-
-
- void zwp_input_method_context_v1::send_process_input_device_event(uint32_t event_type, const std::string &event_data, uint32_t event_length)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::process_input_device_event", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::process_input_device_event as it's not initialised");
- return;
- }
- send_process_input_device_event(
- m_resource->handle,
- event_type,
- event_data,
- event_length);
- }
-
- void zwp_input_method_context_v1::send_process_input_device_event(struct ::wl_resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length)
- {
- zwp_input_method_context_v1_send_process_input_device_event(
- resource,
- event_type,
- event_data.c_str(),
- event_length);
- }
-
-
- void zwp_input_method_context_v1::send_filter_key_event(uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::filter_key_event", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::filter_key_event as it's not initialised");
- return;
- }
- send_filter_key_event(
- m_resource->handle,
- serial,
- time,
- keyname,
- state,
- modifiers,
- dev_name,
- dev_class,
- dev_subclass,
- keycode);
- }
-
- void zwp_input_method_context_v1::send_filter_key_event(struct ::wl_resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode)
- {
- zwp_input_method_context_v1_send_filter_key_event(
- resource,
- serial,
- time,
- keyname.c_str(),
- state,
- modifiers,
- dev_name.c_str(),
- dev_class,
- dev_subclass,
- keycode);
- }
-
-
- void zwp_input_method_context_v1::send_capital_mode(uint32_t mode)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::capital_mode", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::capital_mode as it's not initialised");
- return;
- }
- send_capital_mode(
- m_resource->handle,
- mode);
- }
-
- void zwp_input_method_context_v1::send_capital_mode(struct ::wl_resource *resource, uint32_t mode)
- {
- zwp_input_method_context_v1_send_capital_mode(
- resource,
- mode);
- }
-
-
- void zwp_input_method_context_v1::send_prediction_hint(const std::string &text)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::prediction_hint", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::prediction_hint as it's not initialised");
- return;
- }
- send_prediction_hint(
- m_resource->handle,
- text);
- }
-
- void zwp_input_method_context_v1::send_prediction_hint(struct ::wl_resource *resource, const std::string &text)
- {
- zwp_input_method_context_v1_send_prediction_hint(
- resource,
- text.c_str());
- }
-
-
- void zwp_input_method_context_v1::send_mime_type(const std::string &type)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::mime_type", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::mime_type as it's not initialised");
- return;
- }
- send_mime_type(
- m_resource->handle,
- type);
- }
-
- void zwp_input_method_context_v1::send_mime_type(struct ::wl_resource *resource, const std::string &type)
- {
- zwp_input_method_context_v1_send_mime_type(
- resource,
- type.c_str());
- }
-
-
- void zwp_input_method_context_v1::send_finalized_content(const std::string &text, uint32_t cursor_position)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::finalized_content", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::finalized_content as it's not initialised");
- return;
- }
- send_finalized_content(
- m_resource->handle,
- text,
- cursor_position);
- }
-
- void zwp_input_method_context_v1::send_finalized_content(struct ::wl_resource *resource, const std::string &text, uint32_t cursor_position)
- {
- zwp_input_method_context_v1_send_finalized_content(
- resource,
- text.c_str(),
- cursor_position);
- }
-
-
- void zwp_input_method_context_v1::send_prediction_hint_data(const std::string &key, const std::string &value)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::prediction_hint_data", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::prediction_hint_data as it's not initialised");
- return;
- }
- send_prediction_hint_data(
- m_resource->handle,
- key,
- value);
- }
-
- void zwp_input_method_context_v1::send_prediction_hint_data(struct ::wl_resource *resource, const std::string &key, const std::string &value)
- {
- zwp_input_method_context_v1_send_prediction_hint_data(
- resource,
- key.c_str(),
- value.c_str());
- }
-
-
- void zwp_input_method_context_v1::send_input_panel_enabled(uint32_t enabled)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_context_v1::input_panel_enabled", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_context_v1::input_panel_enabled as it's not initialised");
- return;
- }
- send_input_panel_enabled(
- m_resource->handle,
- enabled);
- }
-
- void zwp_input_method_context_v1::send_input_panel_enabled(struct ::wl_resource *resource, uint32_t enabled)
- {
- zwp_input_method_context_v1_send_input_panel_enabled(
- resource,
- enabled);
- }
-
-
- zwp_input_method_v1::zwp_input_method_v1(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zwp_input_method_v1::zwp_input_method_v1(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zwp_input_method_v1::zwp_input_method_v1(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zwp_input_method_v1::zwp_input_method_v1()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zwp_input_method_v1::~zwp_input_method_v1()
- {
- std::multimap<struct ::wl_client*, zwp_input_method_v1::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zwp_input_method_v1::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zwp_input_method_v1::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zwp_input_method_v1::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zwp_input_method_v1::Resource *zwp_input_method_v1::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zwp_input_method_v1::Resource *zwp_input_method_v1::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zwp_input_method_v1::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zwp_input_method_v1_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zwp_input_method_v1::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zwp_input_method_v1::interface()
- {
- return &::zwp_input_method_v1_interface;
- }
-
- zwp_input_method_v1::Resource *zwp_input_method_v1::zwp_input_method_v1_allocate()
- {
- return new Resource;
- }
-
- void zwp_input_method_v1::zwp_input_method_v1_bind_resource(Resource *)
- {
- }
-
- void zwp_input_method_v1::zwp_input_method_v1_destroy_resource(Resource *)
- {
- }
-
- void zwp_input_method_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zwp_input_method_v1 *that = static_cast<zwp_input_method_v1 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zwp_input_method_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zwp_input_method_v1 *that = static_cast<zwp_input_method_v1::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zwp_input_method_v1::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zwp_input_method_v1 *that = resource->zwp_input_method_v1_object;
- that->m_resource_map.erase(resource->client());
- that->zwp_input_method_v1_destroy_resource(resource);
- delete resource;
- }
-
- zwp_input_method_v1::Resource *zwp_input_method_v1::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zwp_input_method_v1_interface, version, id);
- return bind(handle);
- }
-
- zwp_input_method_v1::Resource *zwp_input_method_v1::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zwp_input_method_v1_allocate();
- resource->zwp_input_method_v1_object = this;
-
- wl_resource_set_implementation(handle, NULL, resource, destroy_func);
- resource->handle = handle;
- zwp_input_method_v1_bind_resource(resource);
- return resource;
- }
- zwp_input_method_v1::Resource *zwp_input_method_v1::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zwp_input_method_v1_interface, NULL))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- void zwp_input_method_v1::send_activate(struct ::wl_resource *id)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_v1::activate", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_v1::activate as it's not initialised");
- return;
- }
- send_activate(
- m_resource->handle,
- id);
- }
-
- void zwp_input_method_v1::send_activate(struct ::wl_resource *resource, struct ::wl_resource *id)
- {
- zwp_input_method_v1_send_activate(
- resource,
- id);
- }
-
-
- void zwp_input_method_v1::send_deactivate(struct ::wl_resource *context)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_v1::deactivate", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_v1::deactivate as it's not initialised");
- return;
- }
- send_deactivate(
- m_resource->handle,
- context);
- }
-
- void zwp_input_method_v1::send_deactivate(struct ::wl_resource *resource, struct ::wl_resource *context)
- {
- zwp_input_method_v1_send_deactivate(
- resource,
- context);
- }
-
-
- void zwp_input_method_v1::send_destroy(struct ::wl_resource *context)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_v1::destroy", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_v1::destroy as it's not initialised");
- return;
- }
- send_destroy(
- m_resource->handle,
- context);
- }
-
- void zwp_input_method_v1::send_destroy(struct ::wl_resource *resource, struct ::wl_resource *context)
- {
- zwp_input_method_v1_send_destroy(
- resource,
- context);
- }
-
-
- void zwp_input_method_v1::send_show_input_panel(struct ::wl_resource *context, uint32_t degree)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_v1::show_input_panel", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_v1::show_input_panel as it's not initialised");
- return;
- }
- send_show_input_panel(
- m_resource->handle,
- context,
- degree);
- }
-
- void zwp_input_method_v1::send_show_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context, uint32_t degree)
- {
- zwp_input_method_v1_send_show_input_panel(
- resource,
- context,
- degree);
- }
-
-
- void zwp_input_method_v1::send_hide_input_panel(struct ::wl_resource *context)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_v1::hide_input_panel", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_v1::hide_input_panel as it's not initialised");
- return;
- }
- send_hide_input_panel(
- m_resource->handle,
- context);
- }
-
- void zwp_input_method_v1::send_hide_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context)
- {
- zwp_input_method_v1_send_hide_input_panel(
- resource,
- context);
- }
-
-
- void zwp_input_method_v1::send_open_connection(struct ::wl_resource *context)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_v1::open_connection", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_v1::open_connection as it's not initialised");
- return;
- }
- send_open_connection(
- m_resource->handle,
- context);
- }
-
- void zwp_input_method_v1::send_open_connection(struct ::wl_resource *resource, struct ::wl_resource *context)
- {
- zwp_input_method_v1_send_open_connection(
- resource,
- context);
- }
-
-
- void zwp_input_method_v1::send_close_connection(struct ::wl_resource *context)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_v1::close_connection", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_v1::close_connection as it's not initialised");
- return;
- }
- send_close_connection(
- m_resource->handle,
- context);
- }
-
- void zwp_input_method_v1::send_close_connection(struct ::wl_resource *resource, struct ::wl_resource *context)
- {
- zwp_input_method_v1_send_close_connection(
- resource,
- context);
- }
-
-
- void zwp_input_method_v1::send_set_text_input_id(struct ::wl_resource *context, uint32_t text_input_id)
- {
- DS_ASSERT_X(m_resource, "zwp_input_method_v1::set_text_input_id", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zwp_input_method_v1::set_text_input_id as it's not initialised");
- return;
- }
- send_set_text_input_id(
- m_resource->handle,
- context,
- text_input_id);
- }
-
- void zwp_input_method_v1::send_set_text_input_id(struct ::wl_resource *resource, struct ::wl_resource *context, uint32_t text_input_id)
- {
- zwp_input_method_v1_send_set_text_input_id(
- resource,
- context,
- text_input_id);
- }
-
-
- zwp_input_panel_v1::zwp_input_panel_v1(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zwp_input_panel_v1::zwp_input_panel_v1(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zwp_input_panel_v1::zwp_input_panel_v1(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zwp_input_panel_v1::zwp_input_panel_v1()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zwp_input_panel_v1::~zwp_input_panel_v1()
- {
- std::multimap<struct ::wl_client*, zwp_input_panel_v1::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zwp_input_panel_v1::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zwp_input_panel_v1::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zwp_input_panel_v1::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zwp_input_panel_v1::Resource *zwp_input_panel_v1::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zwp_input_panel_v1::Resource *zwp_input_panel_v1::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zwp_input_panel_v1::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zwp_input_panel_v1_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zwp_input_panel_v1::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zwp_input_panel_v1::interface()
- {
- return &::zwp_input_panel_v1_interface;
- }
-
- zwp_input_panel_v1::Resource *zwp_input_panel_v1::zwp_input_panel_v1_allocate()
- {
- return new Resource;
- }
-
- void zwp_input_panel_v1::zwp_input_panel_v1_bind_resource(Resource *)
- {
- }
-
- void zwp_input_panel_v1::zwp_input_panel_v1_destroy_resource(Resource *)
- {
- }
-
- void zwp_input_panel_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zwp_input_panel_v1 *that = static_cast<zwp_input_panel_v1 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zwp_input_panel_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zwp_input_panel_v1 *that = static_cast<zwp_input_panel_v1::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zwp_input_panel_v1::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zwp_input_panel_v1 *that = resource->zwp_input_panel_v1_object;
- that->m_resource_map.erase(resource->client());
- that->zwp_input_panel_v1_destroy_resource(resource);
- delete resource;
- }
-
- zwp_input_panel_v1::Resource *zwp_input_panel_v1::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zwp_input_panel_v1_interface, version, id);
- return bind(handle);
- }
-
- zwp_input_panel_v1::Resource *zwp_input_panel_v1::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zwp_input_panel_v1_allocate();
- resource->zwp_input_panel_v1_object = this;
-
- wl_resource_set_implementation(handle, &m_zwp_input_panel_v1_interface, resource, destroy_func);
- resource->handle = handle;
- zwp_input_panel_v1_bind_resource(resource);
- return resource;
- }
- zwp_input_panel_v1::Resource *zwp_input_panel_v1::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zwp_input_panel_v1_interface, &m_zwp_input_panel_v1_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zwp_input_panel_v1_interface zwp_input_panel_v1::m_zwp_input_panel_v1_interface = {
- zwp_input_panel_v1::handle_get_input_panel_surface
- };
-
- void zwp_input_panel_v1::zwp_input_panel_v1_get_input_panel_surface(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
-
- void zwp_input_panel_v1::handle_get_input_panel_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_panel_v1 *>(r->zwp_input_panel_v1_object)->zwp_input_panel_v1_get_input_panel_surface(
- r,
- id,
- surface);
- }
-
- zwp_input_panel_surface_v1::zwp_input_panel_surface_v1(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zwp_input_panel_surface_v1::zwp_input_panel_surface_v1(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zwp_input_panel_surface_v1::zwp_input_panel_surface_v1(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zwp_input_panel_surface_v1::zwp_input_panel_surface_v1()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zwp_input_panel_surface_v1::~zwp_input_panel_surface_v1()
- {
- std::multimap<struct ::wl_client*, zwp_input_panel_surface_v1::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zwp_input_panel_surface_v1::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zwp_input_panel_surface_v1::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zwp_input_panel_surface_v1::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zwp_input_panel_surface_v1::Resource *zwp_input_panel_surface_v1::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zwp_input_panel_surface_v1::Resource *zwp_input_panel_surface_v1::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zwp_input_panel_surface_v1::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zwp_input_panel_surface_v1_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zwp_input_panel_surface_v1::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zwp_input_panel_surface_v1::interface()
- {
- return &::zwp_input_panel_surface_v1_interface;
- }
-
- zwp_input_panel_surface_v1::Resource *zwp_input_panel_surface_v1::zwp_input_panel_surface_v1_allocate()
- {
- return new Resource;
- }
-
- void zwp_input_panel_surface_v1::zwp_input_panel_surface_v1_bind_resource(Resource *)
- {
- }
-
- void zwp_input_panel_surface_v1::zwp_input_panel_surface_v1_destroy_resource(Resource *)
- {
- }
-
- void zwp_input_panel_surface_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zwp_input_panel_surface_v1 *that = static_cast<zwp_input_panel_surface_v1 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zwp_input_panel_surface_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zwp_input_panel_surface_v1 *that = static_cast<zwp_input_panel_surface_v1::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zwp_input_panel_surface_v1::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zwp_input_panel_surface_v1 *that = resource->zwp_input_panel_surface_v1_object;
- that->m_resource_map.erase(resource->client());
- that->zwp_input_panel_surface_v1_destroy_resource(resource);
- delete resource;
- }
-
- zwp_input_panel_surface_v1::Resource *zwp_input_panel_surface_v1::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zwp_input_panel_surface_v1_interface, version, id);
- return bind(handle);
- }
-
- zwp_input_panel_surface_v1::Resource *zwp_input_panel_surface_v1::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zwp_input_panel_surface_v1_allocate();
- resource->zwp_input_panel_surface_v1_object = this;
-
- wl_resource_set_implementation(handle, &m_zwp_input_panel_surface_v1_interface, resource, destroy_func);
- resource->handle = handle;
- zwp_input_panel_surface_v1_bind_resource(resource);
- return resource;
- }
- zwp_input_panel_surface_v1::Resource *zwp_input_panel_surface_v1::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zwp_input_panel_surface_v1_interface, &m_zwp_input_panel_surface_v1_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zwp_input_panel_surface_v1_interface zwp_input_panel_surface_v1::m_zwp_input_panel_surface_v1_interface = {
- zwp_input_panel_surface_v1::handle_set_toplevel,
- zwp_input_panel_surface_v1::handle_set_overlay_panel,
- zwp_input_panel_surface_v1::handle_set_ready
- };
-
- void zwp_input_panel_surface_v1::zwp_input_panel_surface_v1_set_toplevel(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void zwp_input_panel_surface_v1::zwp_input_panel_surface_v1_set_overlay_panel(Resource *)
- {
- }
-
- void zwp_input_panel_surface_v1::zwp_input_panel_surface_v1_set_ready(Resource *, uint32_t )
- {
- }
-
-
- void zwp_input_panel_surface_v1::handle_set_toplevel(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output,
- uint32_t position)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_panel_surface_v1 *>(r->zwp_input_panel_surface_v1_object)->zwp_input_panel_surface_v1_set_toplevel(
- r,
- output,
- position);
- }
-
- void zwp_input_panel_surface_v1::handle_set_overlay_panel(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_panel_surface_v1 *>(r->zwp_input_panel_surface_v1_object)->zwp_input_panel_surface_v1_set_overlay_panel(
- r);
- }
-
- void zwp_input_panel_surface_v1::handle_set_ready(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t state)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_panel_surface_v1 *>(r->zwp_input_panel_surface_v1_object)->zwp_input_panel_surface_v1_set_ready(
- r,
- state);
- }
-
- zwp_input_method_manager_v1::zwp_input_method_manager_v1(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zwp_input_method_manager_v1::zwp_input_method_manager_v1(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zwp_input_method_manager_v1::zwp_input_method_manager_v1(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zwp_input_method_manager_v1::zwp_input_method_manager_v1()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zwp_input_method_manager_v1::~zwp_input_method_manager_v1()
- {
- std::multimap<struct ::wl_client*, zwp_input_method_manager_v1::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zwp_input_method_manager_v1::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zwp_input_method_manager_v1::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zwp_input_method_manager_v1::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zwp_input_method_manager_v1::Resource *zwp_input_method_manager_v1::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zwp_input_method_manager_v1::Resource *zwp_input_method_manager_v1::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zwp_input_method_manager_v1::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zwp_input_method_manager_v1_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zwp_input_method_manager_v1::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zwp_input_method_manager_v1::interface()
- {
- return &::zwp_input_method_manager_v1_interface;
- }
-
- zwp_input_method_manager_v1::Resource *zwp_input_method_manager_v1::zwp_input_method_manager_v1_allocate()
- {
- return new Resource;
- }
-
- void zwp_input_method_manager_v1::zwp_input_method_manager_v1_bind_resource(Resource *)
- {
- }
-
- void zwp_input_method_manager_v1::zwp_input_method_manager_v1_destroy_resource(Resource *)
- {
- }
-
- void zwp_input_method_manager_v1::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zwp_input_method_manager_v1 *that = static_cast<zwp_input_method_manager_v1 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zwp_input_method_manager_v1::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zwp_input_method_manager_v1 *that = static_cast<zwp_input_method_manager_v1::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zwp_input_method_manager_v1::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zwp_input_method_manager_v1 *that = resource->zwp_input_method_manager_v1_object;
- that->m_resource_map.erase(resource->client());
- that->zwp_input_method_manager_v1_destroy_resource(resource);
- delete resource;
- }
-
- zwp_input_method_manager_v1::Resource *zwp_input_method_manager_v1::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zwp_input_method_manager_v1_interface, version, id);
- return bind(handle);
- }
-
- zwp_input_method_manager_v1::Resource *zwp_input_method_manager_v1::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zwp_input_method_manager_v1_allocate();
- resource->zwp_input_method_manager_v1_object = this;
-
- wl_resource_set_implementation(handle, &m_zwp_input_method_manager_v1_interface, resource, destroy_func);
- resource->handle = handle;
- zwp_input_method_manager_v1_bind_resource(resource);
- return resource;
- }
- zwp_input_method_manager_v1::Resource *zwp_input_method_manager_v1::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zwp_input_method_manager_v1_interface, &m_zwp_input_method_manager_v1_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zwp_input_method_manager_v1_interface zwp_input_method_manager_v1::m_zwp_input_method_manager_v1_interface = {
- zwp_input_method_manager_v1::handle_set_transient_for
- };
-
- void zwp_input_method_manager_v1::zwp_input_method_manager_v1_set_transient_for(Resource *, uint32_t , uint32_t )
- {
- }
-
-
- void zwp_input_method_manager_v1::handle_set_transient_for(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t parent_pid,
- uint32_t child_pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zwp_input_method_manager_v1 *>(r->zwp_input_method_manager_v1_object)->zwp_input_method_manager_v1_set_transient_for(
- r,
- parent_pid,
- child_pid);
- }
-}
-
-/*LCOV_EXCL_STOP*/
\ No newline at end of file
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/input-method.xml */
-
-#ifndef __DS_INPUT_METHOD_UNSTABLE_V1_PROTOCOL_H__
-#define __DS_INPUT_METHOD_UNSTABLE_V1_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "input-method-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class zwp_input_method_context_v1
- {
- public:
- zwp_input_method_context_v1(struct ::wl_client *client, uint32_t id, int version);
- zwp_input_method_context_v1(struct ::wl_display *display, int version);
- zwp_input_method_context_v1(struct ::wl_resource *resource);
- zwp_input_method_context_v1();
-
- virtual ~zwp_input_method_context_v1();
-
- class Resource
- {
- public:
- Resource() : zwp_input_method_context_v1_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zwp_input_method_context_v1 *zwp_input_method_context_v1_object;
- zwp_input_method_context_v1 *object() { return zwp_input_method_context_v1_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_surrounding_text(const std::string &text, uint32_t cursor, uint32_t anchor);
- void send_surrounding_text(struct ::wl_resource *resource, const std::string &text, uint32_t cursor, uint32_t anchor);
- void send_reset();
- void send_reset(struct ::wl_resource *resource);
- void send_content_type(uint32_t hint, uint32_t purpose);
- void send_content_type(struct ::wl_resource *resource, uint32_t hint, uint32_t purpose);
- void send_invoke_action(uint32_t button, uint32_t index);
- void send_invoke_action(struct ::wl_resource *resource, uint32_t button, uint32_t index);
- void send_commit_state(uint32_t serial);
- void send_commit_state(struct ::wl_resource *resource, uint32_t serial);
- void send_preferred_language(const std::string &language);
- void send_preferred_language(struct ::wl_resource *resource, const std::string &language);
- void send_return_key_type(uint32_t return_key_type);
- void send_return_key_type(struct ::wl_resource *resource, uint32_t return_key_type);
- void send_return_key_disabled(uint32_t return_key_disabled);
- void send_return_key_disabled(struct ::wl_resource *resource, uint32_t return_key_disabled);
- void send_input_panel_data(const std::string &input_panel_data, uint32_t input_panel_data_length);
- void send_input_panel_data(struct ::wl_resource *resource, const std::string &input_panel_data, uint32_t input_panel_data_length);
- void send_bidi_direction(uint32_t direction);
- void send_bidi_direction(struct ::wl_resource *resource, uint32_t direction);
- void send_cursor_position(uint32_t cursor_position);
- void send_cursor_position(struct ::wl_resource *resource, uint32_t cursor_position);
- void send_process_input_device_event(uint32_t event_type, const std::string &event_data, uint32_t event_length);
- void send_process_input_device_event(struct ::wl_resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length);
- void send_filter_key_event(uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode);
- void send_filter_key_event(struct ::wl_resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode);
- void send_capital_mode(uint32_t mode);
- void send_capital_mode(struct ::wl_resource *resource, uint32_t mode);
- void send_prediction_hint(const std::string &text);
- void send_prediction_hint(struct ::wl_resource *resource, const std::string &text);
- void send_mime_type(const std::string &type);
- void send_mime_type(struct ::wl_resource *resource, const std::string &type);
- void send_finalized_content(const std::string &text, uint32_t cursor_position);
- void send_finalized_content(struct ::wl_resource *resource, const std::string &text, uint32_t cursor_position);
- void send_prediction_hint_data(const std::string &key, const std::string &value);
- void send_prediction_hint_data(struct ::wl_resource *resource, const std::string &key, const std::string &value);
- void send_input_panel_enabled(uint32_t enabled);
- void send_input_panel_enabled(struct ::wl_resource *resource, uint32_t enabled);
-
- protected:
- virtual Resource *zwp_input_method_context_v1_allocate();
-
- virtual void zwp_input_method_context_v1_bind_resource(Resource *resource);
- virtual void zwp_input_method_context_v1_destroy_resource(Resource *resource);
-
- virtual void zwp_input_method_context_v1_destroy(Resource *resource);
- virtual void zwp_input_method_context_v1_commit_string(Resource *resource, uint32_t serial, const std::string &text);
- virtual void zwp_input_method_context_v1_preedit_string(Resource *resource, uint32_t serial, const std::string &text, const std::string &commit);
- virtual void zwp_input_method_context_v1_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style);
- virtual void zwp_input_method_context_v1_preedit_cursor(Resource *resource, int32_t index);
- virtual void zwp_input_method_context_v1_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length);
- virtual void zwp_input_method_context_v1_cursor_position(Resource *resource, int32_t index, int32_t anchor);
- virtual void zwp_input_method_context_v1_modifiers_map(Resource *resource, struct ::wl_array *map);
- virtual void zwp_input_method_context_v1_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers);
- virtual void zwp_input_method_context_v1_grab_keyboard(Resource *resource, uint32_t keyboard);
- virtual void zwp_input_method_context_v1_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state);
- virtual void zwp_input_method_context_v1_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
- virtual void zwp_input_method_context_v1_language(Resource *resource, uint32_t serial, const std::string &language);
- virtual void zwp_input_method_context_v1_text_direction(Resource *resource, uint32_t serial, uint32_t direction);
- virtual void zwp_input_method_context_v1_selection_region(Resource *resource, uint32_t serial, int32_t start, int32_t end);
- virtual void zwp_input_method_context_v1_private_command(Resource *resource, uint32_t serial, const std::string &command);
- virtual void zwp_input_method_context_v1_update_input_panel_data(Resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length);
- virtual void zwp_input_method_context_v1_hide_input_panel(Resource *resource, uint32_t serial);
- virtual void zwp_input_method_context_v1_get_selection_text(Resource *resource, int32_t fd);
- virtual void zwp_input_method_context_v1_get_surrounding_text(Resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd);
- virtual void zwp_input_method_context_v1_filter_key_event_done(Resource *resource, uint32_t serial, uint32_t state);
- virtual void zwp_input_method_context_v1_update_ise_geometry(Resource *resource, uint32_t serial, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
- virtual void zwp_input_method_context_v1_recapture_string(Resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit);
- virtual void zwp_input_method_context_v1_input_panel_event(Resource *resource, uint32_t serial, uint32_t event_type, uint32_t value);
- virtual void zwp_input_method_context_v1_commit_content(Resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types);
- virtual void zwp_input_method_context_v1_update_candidate_state(Resource *resource, uint32_t state);
- virtual void zwp_input_method_context_v1_reshow_input_panel(Resource *resource);
- virtual void zwp_input_method_context_v1_set_floating_panel(Resource *resource, uint32_t state);
- virtual void zwp_input_method_context_v1_set_floating_drag_enabled(Resource *resource, uint32_t enabled);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zwp_input_method_context_v1_interface m_zwp_input_method_context_v1_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_commit_string(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *text);
- static void handle_preedit_string(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *text,
- const char *commit);
- static void handle_preedit_styling(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t index,
- uint32_t length,
- uint32_t style);
- static void handle_preedit_cursor(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t index);
- static void handle_delete_surrounding_text(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t index,
- uint32_t length);
- static void handle_cursor_position(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t index,
- int32_t anchor);
- static void handle_modifiers_map(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_array *map);
- static void handle_keysym(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t time,
- uint32_t sym,
- uint32_t state,
- uint32_t modifiers);
- static void handle_grab_keyboard(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t keyboard);
- static void handle_key(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t time,
- uint32_t key,
- uint32_t state);
- static void handle_modifiers(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t mods_depressed,
- uint32_t mods_latched,
- uint32_t mods_locked,
- uint32_t group);
- static void handle_language(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *language);
- static void handle_text_direction(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t direction);
- static void handle_selection_region(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- int32_t start,
- int32_t end);
- static void handle_private_command(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *command);
- static void handle_update_input_panel_data(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *input_panel_data,
- uint32_t input_panel_data_length);
- static void handle_hide_input_panel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void handle_get_selection_text(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t fd);
- static void handle_get_surrounding_text(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t maxlen_before,
- uint32_t maxlen_after,
- int32_t fd);
- static void handle_filter_key_event_done(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t state);
- static void handle_update_ise_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t x,
- uint32_t y,
- uint32_t width,
- uint32_t height);
- static void handle_recapture_string(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- int32_t index,
- uint32_t length,
- const char *preedit,
- const char *preedit_commit,
- const char *commit);
- static void handle_input_panel_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t event_type,
- uint32_t value);
- static void handle_commit_content(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *content,
- const char *description,
- const char *mime_types);
- static void handle_update_candidate_state(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t state);
- static void handle_reshow_input_panel(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_floating_panel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t state);
- static void handle_set_floating_drag_enabled(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t enabled);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zwp_input_method_context_v1 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class zwp_input_method_v1
- {
- public:
- zwp_input_method_v1(struct ::wl_client *client, uint32_t id, int version);
- zwp_input_method_v1(struct ::wl_display *display, int version);
- zwp_input_method_v1(struct ::wl_resource *resource);
- zwp_input_method_v1();
-
- virtual ~zwp_input_method_v1();
-
- class Resource
- {
- public:
- Resource() : zwp_input_method_v1_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zwp_input_method_v1 *zwp_input_method_v1_object;
- zwp_input_method_v1 *object() { return zwp_input_method_v1_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_activate(struct ::wl_resource *id);
- void send_activate(struct ::wl_resource *resource, struct ::wl_resource *id);
- void send_deactivate(struct ::wl_resource *context);
- void send_deactivate(struct ::wl_resource *resource, struct ::wl_resource *context);
- void send_destroy(struct ::wl_resource *context);
- void send_destroy(struct ::wl_resource *resource, struct ::wl_resource *context);
- void send_show_input_panel(struct ::wl_resource *context, uint32_t degree);
- void send_show_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context, uint32_t degree);
- void send_hide_input_panel(struct ::wl_resource *context);
- void send_hide_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context);
- void send_open_connection(struct ::wl_resource *context);
- void send_open_connection(struct ::wl_resource *resource, struct ::wl_resource *context);
- void send_close_connection(struct ::wl_resource *context);
- void send_close_connection(struct ::wl_resource *resource, struct ::wl_resource *context);
- void send_set_text_input_id(struct ::wl_resource *context, uint32_t text_input_id);
- void send_set_text_input_id(struct ::wl_resource *resource, struct ::wl_resource *context, uint32_t text_input_id);
-
- protected:
- virtual Resource *zwp_input_method_v1_allocate();
-
- virtual void zwp_input_method_v1_bind_resource(Resource *resource);
- virtual void zwp_input_method_v1_destroy_resource(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zwp_input_method_v1 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class zwp_input_panel_v1
- {
- public:
- zwp_input_panel_v1(struct ::wl_client *client, uint32_t id, int version);
- zwp_input_panel_v1(struct ::wl_display *display, int version);
- zwp_input_panel_v1(struct ::wl_resource *resource);
- zwp_input_panel_v1();
-
- virtual ~zwp_input_panel_v1();
-
- class Resource
- {
- public:
- Resource() : zwp_input_panel_v1_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zwp_input_panel_v1 *zwp_input_panel_v1_object;
- zwp_input_panel_v1 *object() { return zwp_input_panel_v1_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *zwp_input_panel_v1_allocate();
-
- virtual void zwp_input_panel_v1_bind_resource(Resource *resource);
- virtual void zwp_input_panel_v1_destroy_resource(Resource *resource);
-
- virtual void zwp_input_panel_v1_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zwp_input_panel_v1_interface m_zwp_input_panel_v1_interface;
-
- static void handle_get_input_panel_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zwp_input_panel_v1 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class zwp_input_panel_surface_v1
- {
- public:
- zwp_input_panel_surface_v1(struct ::wl_client *client, uint32_t id, int version);
- zwp_input_panel_surface_v1(struct ::wl_display *display, int version);
- zwp_input_panel_surface_v1(struct ::wl_resource *resource);
- zwp_input_panel_surface_v1();
-
- virtual ~zwp_input_panel_surface_v1();
-
- class Resource
- {
- public:
- Resource() : zwp_input_panel_surface_v1_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zwp_input_panel_surface_v1 *zwp_input_panel_surface_v1_object;
- zwp_input_panel_surface_v1 *object() { return zwp_input_panel_surface_v1_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum position {
- position_center_bottom = 0,
- };
-
- protected:
- virtual Resource *zwp_input_panel_surface_v1_allocate();
-
- virtual void zwp_input_panel_surface_v1_bind_resource(Resource *resource);
- virtual void zwp_input_panel_surface_v1_destroy_resource(Resource *resource);
-
- virtual void zwp_input_panel_surface_v1_set_toplevel(Resource *resource, struct ::wl_resource *output, uint32_t position);
- virtual void zwp_input_panel_surface_v1_set_overlay_panel(Resource *resource);
- virtual void zwp_input_panel_surface_v1_set_ready(Resource *resource, uint32_t state);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zwp_input_panel_surface_v1_interface m_zwp_input_panel_surface_v1_interface;
-
- static void handle_set_toplevel(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output,
- uint32_t position);
- static void handle_set_overlay_panel(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_ready(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t state);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zwp_input_panel_surface_v1 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class zwp_input_method_manager_v1
- {
- public:
- zwp_input_method_manager_v1(struct ::wl_client *client, uint32_t id, int version);
- zwp_input_method_manager_v1(struct ::wl_display *display, int version);
- zwp_input_method_manager_v1(struct ::wl_resource *resource);
- zwp_input_method_manager_v1();
-
- virtual ~zwp_input_method_manager_v1();
-
- class Resource
- {
- public:
- Resource() : zwp_input_method_manager_v1_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zwp_input_method_manager_v1 *zwp_input_method_manager_v1_object;
- zwp_input_method_manager_v1 *object() { return zwp_input_method_manager_v1_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *zwp_input_method_manager_v1_allocate();
-
- virtual void zwp_input_method_manager_v1_bind_resource(Resource *resource);
- virtual void zwp_input_method_manager_v1_destroy_resource(Resource *resource);
-
- virtual void zwp_input_method_manager_v1_set_transient_for(Resource *resource, uint32_t parent_pid, uint32_t child_pid);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zwp_input_method_manager_v1_interface m_zwp_input_method_manager_v1_interface;
-
- static void handle_set_transient_for(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t parent_pid,
- uint32_t child_pid);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zwp_input_method_manager_v1 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
\ No newline at end of file
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/presentation-time.xml */
-
-#include "dswayland-server-presentation-time.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- wp_presentation::wp_presentation(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wp_presentation::wp_presentation(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wp_presentation::wp_presentation(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wp_presentation::wp_presentation()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wp_presentation::~wp_presentation()
- {
- std::multimap<struct ::wl_client*, wp_presentation::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wp_presentation::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wp_presentation::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wp_presentation::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wp_presentation::Resource *wp_presentation::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wp_presentation::Resource *wp_presentation::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wp_presentation::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wp_presentation_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wp_presentation::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wp_presentation::interface()
- {
- return &::wp_presentation_interface;
- }
-
- wp_presentation::Resource *wp_presentation::wp_presentation_allocate()
- {
- return new Resource;
- }
-
- void wp_presentation::wp_presentation_bind_resource(Resource *)
- {
- }
-
- void wp_presentation::wp_presentation_destroy_resource(Resource *)
- {
- }
-
- void wp_presentation::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wp_presentation *that = static_cast<wp_presentation *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wp_presentation::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wp_presentation *that = static_cast<wp_presentation::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wp_presentation::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wp_presentation *that = resource->wp_presentation_object;
- that->m_resource_map.erase(resource->client());
- that->wp_presentation_destroy_resource(resource);
- delete resource;
- }
-
- wp_presentation::Resource *wp_presentation::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wp_presentation_interface, version, id);
- return bind(handle);
- }
-
- wp_presentation::Resource *wp_presentation::bind(struct ::wl_resource *handle)
- {
- Resource *resource = wp_presentation_allocate();
- resource->wp_presentation_object = this;
-
- wl_resource_set_implementation(handle, &m_wp_presentation_interface, resource, destroy_func);
- resource->handle = handle;
- wp_presentation_bind_resource(resource);
- return resource;
- }
- wp_presentation::Resource *wp_presentation::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wp_presentation_interface, &m_wp_presentation_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wp_presentation_interface wp_presentation::m_wp_presentation_interface = {
- wp_presentation::handle_destroy,
- wp_presentation::handle_feedback
- };
-
- void wp_presentation::wp_presentation_destroy(Resource *)
- {
- }
-
- void wp_presentation::wp_presentation_feedback(Resource *, struct ::wl_resource *, uint32_t)
- {
- }
-
-
- void wp_presentation::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wp_presentation *>(r->wp_presentation_object)->wp_presentation_destroy(
- r);
- }
-
- void wp_presentation::handle_feedback(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t callback)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wp_presentation *>(r->wp_presentation_object)->wp_presentation_feedback(
- r,
- surface,
- callback);
- }
-
- void wp_presentation::send_clock_id(uint32_t clk_id)
- {
- DS_ASSERT_X(m_resource, "wp_presentation::clock_id", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wp_presentation::clock_id as it's not initialised");
- return;
- }
- send_clock_id(
- m_resource->handle,
- clk_id);
- }
-
- void wp_presentation::send_clock_id(struct ::wl_resource *resource, uint32_t clk_id)
- {
- wp_presentation_send_clock_id(
- resource,
- clk_id);
- }
-
-
- wp_presentation_feedback::wp_presentation_feedback(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wp_presentation_feedback::wp_presentation_feedback(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wp_presentation_feedback::wp_presentation_feedback(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wp_presentation_feedback::wp_presentation_feedback()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wp_presentation_feedback::~wp_presentation_feedback()
- {
- std::multimap<struct ::wl_client*, wp_presentation_feedback::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wp_presentation_feedback::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wp_presentation_feedback::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wp_presentation_feedback::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wp_presentation_feedback::Resource *wp_presentation_feedback::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wp_presentation_feedback::Resource *wp_presentation_feedback::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wp_presentation_feedback::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wp_presentation_feedback_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wp_presentation_feedback::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wp_presentation_feedback::interface()
- {
- return &::wp_presentation_feedback_interface;
- }
-
- wp_presentation_feedback::Resource *wp_presentation_feedback::wp_presentation_feedback_allocate()
- {
- return new Resource;
- }
-
- void wp_presentation_feedback::wp_presentation_feedback_bind_resource(Resource *)
- {
- }
-
- void wp_presentation_feedback::wp_presentation_feedback_destroy_resource(Resource *)
- {
- }
-
- void wp_presentation_feedback::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wp_presentation_feedback *that = static_cast<wp_presentation_feedback *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wp_presentation_feedback::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wp_presentation_feedback *that = static_cast<wp_presentation_feedback::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wp_presentation_feedback::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wp_presentation_feedback *that = resource->wp_presentation_feedback_object;
- that->m_resource_map.erase(resource->client());
- that->wp_presentation_feedback_destroy_resource(resource);
- delete resource;
- }
-
- wp_presentation_feedback::Resource *wp_presentation_feedback::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wp_presentation_feedback_interface, version, id);
- return bind(handle);
- }
-
- wp_presentation_feedback::Resource *wp_presentation_feedback::bind(struct ::wl_resource *handle)
- {
- Resource *resource = wp_presentation_feedback_allocate();
- resource->wp_presentation_feedback_object = this;
-
- wl_resource_set_implementation(handle, NULL, resource, destroy_func);
- resource->handle = handle;
- wp_presentation_feedback_bind_resource(resource);
- return resource;
- }
- wp_presentation_feedback::Resource *wp_presentation_feedback::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wp_presentation_feedback_interface, NULL))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- void wp_presentation_feedback::send_sync_output(struct ::wl_resource *output)
- {
- DS_ASSERT_X(m_resource, "wp_presentation_feedback::sync_output", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wp_presentation_feedback::sync_output as it's not initialised");
- return;
- }
- send_sync_output(
- m_resource->handle,
- output);
- }
-
- void wp_presentation_feedback::send_sync_output(struct ::wl_resource *resource, struct ::wl_resource *output)
- {
- wp_presentation_feedback_send_sync_output(
- resource,
- output);
- }
-
-
- void wp_presentation_feedback::send_presented(uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec, uint32_t refresh, uint32_t seq_hi, uint32_t seq_lo, uint32_t flags)
- {
- DS_ASSERT_X(m_resource, "wp_presentation_feedback::presented", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wp_presentation_feedback::presented as it's not initialised");
- return;
- }
- send_presented(
- m_resource->handle,
- tv_sec_hi,
- tv_sec_lo,
- tv_nsec,
- refresh,
- seq_hi,
- seq_lo,
- flags);
- }
-
- void wp_presentation_feedback::send_presented(struct ::wl_resource *resource, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec, uint32_t refresh, uint32_t seq_hi, uint32_t seq_lo, uint32_t flags)
- {
- wp_presentation_feedback_send_presented(
- resource,
- tv_sec_hi,
- tv_sec_lo,
- tv_nsec,
- refresh,
- seq_hi,
- seq_lo,
- flags);
- }
-
-
- void wp_presentation_feedback::send_discarded()
- {
- DS_ASSERT_X(m_resource, "wp_presentation_feedback::discarded", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wp_presentation_feedback::discarded as it's not initialised");
- return;
- }
- send_discarded(
- m_resource->handle);
- }
-
- void wp_presentation_feedback::send_discarded(struct ::wl_resource *resource)
- {
- wp_presentation_feedback_send_discarded(
- resource);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/presentation-time.xml */
-
-#ifndef __DS_PRESENTATION_TIME_PROTOCOL_H__
-#define __DS_PRESENTATION_TIME_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "presentation-time-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class wp_presentation
- {
- public:
- wp_presentation(struct ::wl_client *client, uint32_t id, int version);
- wp_presentation(struct ::wl_display *display, int version);
- wp_presentation(struct ::wl_resource *resource);
- wp_presentation();
-
- virtual ~wp_presentation();
-
- class Resource
- {
- public:
- Resource() : wp_presentation_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wp_presentation *wp_presentation_object;
- wp_presentation *object() { return wp_presentation_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_timestamp = 0, // invalid value in tv_nsec
- error_invalid_flag = 1, // invalid flag
- };
-
- void send_clock_id(uint32_t clk_id);
- void send_clock_id(struct ::wl_resource *resource, uint32_t clk_id);
-
- protected:
- virtual Resource *wp_presentation_allocate();
-
- virtual void wp_presentation_bind_resource(Resource *resource);
- virtual void wp_presentation_destroy_resource(Resource *resource);
-
- virtual void wp_presentation_destroy(Resource *resource);
- virtual void wp_presentation_feedback(Resource *resource, struct ::wl_resource *surface, uint32_t callback);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wp_presentation_interface m_wp_presentation_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_feedback(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t callback);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wp_presentation *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wp_presentation_feedback
- {
- public:
- wp_presentation_feedback(struct ::wl_client *client, uint32_t id, int version);
- wp_presentation_feedback(struct ::wl_display *display, int version);
- wp_presentation_feedback(struct ::wl_resource *resource);
- wp_presentation_feedback();
-
- virtual ~wp_presentation_feedback();
-
- class Resource
- {
- public:
- Resource() : wp_presentation_feedback_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wp_presentation_feedback *wp_presentation_feedback_object;
- wp_presentation_feedback *object() { return wp_presentation_feedback_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum kind {
- kind_vsync = 0x1, // presentation was vsync'd
- kind_hw_clock = 0x2, // hardware provided the presentation timestamp
- kind_hw_completion = 0x4, // hardware signalled the start of the presentation
- kind_zero_copy = 0x8, // presentation was done zero-copy
- };
-
- void send_sync_output(struct ::wl_resource *output);
- void send_sync_output(struct ::wl_resource *resource, struct ::wl_resource *output);
- void send_presented(uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec, uint32_t refresh, uint32_t seq_hi, uint32_t seq_lo, uint32_t flags);
- void send_presented(struct ::wl_resource *resource, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec, uint32_t refresh, uint32_t seq_hi, uint32_t seq_lo, uint32_t flags);
- void send_discarded();
- void send_discarded(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *wp_presentation_feedback_allocate();
-
- virtual void wp_presentation_feedback_bind_resource(Resource *resource);
- virtual void wp_presentation_feedback_destroy_resource(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wp_presentation_feedback *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/scaler.xml */
-
-#include "dswayland-server-scaler.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- wl_scaler::wl_scaler(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_scaler::wl_scaler(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_scaler::wl_scaler(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_scaler::wl_scaler()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_scaler::~wl_scaler()
- {
- std::multimap<struct ::wl_client*, wl_scaler::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_scaler::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_scaler::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_scaler::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_scaler::Resource *wl_scaler::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_scaler::Resource *wl_scaler::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_scaler::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_scaler_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_scaler::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_scaler::interface()
- {
- return &::wl_scaler_interface;
- }
-
- wl_scaler::Resource *wl_scaler::scaler_allocate()
- {
- return new Resource;
- }
-
- void wl_scaler::scaler_bind_resource(Resource *)
- {
- }
-
- void wl_scaler::scaler_destroy_resource(Resource *)
- {
- }
-
- void wl_scaler::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_scaler *that = static_cast<wl_scaler *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_scaler::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_scaler *that = static_cast<wl_scaler::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_scaler::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_scaler *that = resource->scaler_object;
- that->m_resource_map.erase(resource->client());
- that->scaler_destroy_resource(resource);
- delete resource;
- }
-
- wl_scaler::Resource *wl_scaler::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_scaler_interface, version, id);
- return bind(handle);
- }
-
- wl_scaler::Resource *wl_scaler::bind(struct ::wl_resource *handle)
- {
- Resource *resource = scaler_allocate();
- resource->scaler_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_scaler_interface, resource, destroy_func);
- resource->handle = handle;
- scaler_bind_resource(resource);
- return resource;
- }
- wl_scaler::Resource *wl_scaler::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_scaler_interface, &m_wl_scaler_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_scaler_interface wl_scaler::m_wl_scaler_interface = {
- wl_scaler::handle_destroy,
- wl_scaler::handle_get_viewport
- };
-
- void wl_scaler::scaler_destroy(Resource *)
- {
- }
-
- void wl_scaler::scaler_get_viewport(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
-
- void wl_scaler::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_scaler *>(r->scaler_object)->scaler_destroy(
- r);
- }
-
- void wl_scaler::handle_get_viewport(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_scaler *>(r->scaler_object)->scaler_get_viewport(
- r,
- id,
- surface);
- }
-
- wl_viewport::wl_viewport(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_viewport::wl_viewport(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_viewport::wl_viewport(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_viewport::wl_viewport()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_viewport::~wl_viewport()
- {
- std::multimap<struct ::wl_client*, wl_viewport::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_viewport::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_viewport::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_viewport::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_viewport::Resource *wl_viewport::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_viewport::Resource *wl_viewport::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_viewport::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_viewport_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_viewport::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_viewport::interface()
- {
- return &::wl_viewport_interface;
- }
-
- wl_viewport::Resource *wl_viewport::viewport_allocate()
- {
- return new Resource;
- }
-
- void wl_viewport::viewport_bind_resource(Resource *)
- {
- }
-
- void wl_viewport::viewport_destroy_resource(Resource *)
- {
- }
-
- void wl_viewport::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_viewport *that = static_cast<wl_viewport *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_viewport::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_viewport *that = static_cast<wl_viewport::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_viewport::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_viewport *that = resource->viewport_object;
- that->m_resource_map.erase(resource->client());
- that->viewport_destroy_resource(resource);
- delete resource;
- }
-
- wl_viewport::Resource *wl_viewport::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_viewport_interface, version, id);
- return bind(handle);
- }
-
- wl_viewport::Resource *wl_viewport::bind(struct ::wl_resource *handle)
- {
- Resource *resource = viewport_allocate();
- resource->viewport_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_viewport_interface, resource, destroy_func);
- resource->handle = handle;
- viewport_bind_resource(resource);
- return resource;
- }
- wl_viewport::Resource *wl_viewport::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_viewport_interface, &m_wl_viewport_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_viewport_interface wl_viewport::m_wl_viewport_interface = {
- wl_viewport::handle_destroy,
- wl_viewport::handle_set,
- wl_viewport::handle_set_source,
- wl_viewport::handle_set_destination
- };
-
- void wl_viewport::viewport_destroy(Resource *)
- {
- }
-
- void wl_viewport::viewport_set(Resource *, wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , int32_t , int32_t )
- {
- }
-
- void wl_viewport::viewport_set_source(Resource *, wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t )
- {
- }
-
- void wl_viewport::viewport_set_destination(Resource *, int32_t , int32_t )
- {
- }
-
-
- void wl_viewport::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_viewport *>(r->viewport_object)->viewport_destroy(
- r);
- }
-
- void wl_viewport::handle_set(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t src_x,
- wl_fixed_t src_y,
- wl_fixed_t src_width,
- wl_fixed_t src_height,
- int32_t dst_width,
- int32_t dst_height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_viewport *>(r->viewport_object)->viewport_set(
- r,
- src_x,
- src_y,
- src_width,
- src_height,
- dst_width,
- dst_height);
- }
-
- void wl_viewport::handle_set_source(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t x,
- wl_fixed_t y,
- wl_fixed_t width,
- wl_fixed_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_viewport *>(r->viewport_object)->viewport_set_source(
- r,
- x,
- y,
- width,
- height);
- }
-
- void wl_viewport::handle_set_destination(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_viewport *>(r->viewport_object)->viewport_set_destination(
- r,
- width,
- height);
- }
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/scaler.xml */
-
-#ifndef __DS_SCALER_PROTOCOL_H__
-#define __DS_SCALER_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "scaler-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class wl_scaler
- {
- public:
- wl_scaler(struct ::wl_client *client, uint32_t id, int version);
- wl_scaler(struct ::wl_display *display, int version);
- wl_scaler(struct ::wl_resource *resource);
- wl_scaler();
-
- virtual ~wl_scaler();
-
- class Resource
- {
- public:
- Resource() : scaler_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_scaler *scaler_object;
- wl_scaler *object() { return scaler_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_viewport_exists = 0, // the surface already has a viewport object associated
- };
-
- protected:
- virtual Resource *scaler_allocate();
-
- virtual void scaler_bind_resource(Resource *resource);
- virtual void scaler_destroy_resource(Resource *resource);
-
- virtual void scaler_destroy(Resource *resource);
- virtual void scaler_get_viewport(Resource *resource, uint32_t id, struct ::wl_resource *surface);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_scaler_interface m_wl_scaler_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_get_viewport(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_scaler *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_viewport
- {
- public:
- wl_viewport(struct ::wl_client *client, uint32_t id, int version);
- wl_viewport(struct ::wl_display *display, int version);
- wl_viewport(struct ::wl_resource *resource);
- wl_viewport();
-
- virtual ~wl_viewport();
-
- class Resource
- {
- public:
- Resource() : viewport_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_viewport *viewport_object;
- wl_viewport *object() { return viewport_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_bad_value = 0, // negative or zero values in width or height
- };
-
- protected:
- virtual Resource *viewport_allocate();
-
- virtual void viewport_bind_resource(Resource *resource);
- virtual void viewport_destroy_resource(Resource *resource);
-
- virtual void viewport_destroy(Resource *resource);
- virtual void viewport_set(Resource *resource, wl_fixed_t src_x, wl_fixed_t src_y, wl_fixed_t src_width, wl_fixed_t src_height, int32_t dst_width, int32_t dst_height);
- virtual void viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height);
- virtual void viewport_set_destination(Resource *resource, int32_t width, int32_t height);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_viewport_interface m_wl_viewport_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t src_x,
- wl_fixed_t src_y,
- wl_fixed_t src_width,
- wl_fixed_t src_height,
- int32_t dst_width,
- int32_t dst_height);
- static void handle_set_source(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t x,
- wl_fixed_t y,
- wl_fixed_t width,
- wl_fixed_t height);
- static void handle_set_destination(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_viewport *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/screenshooter.xml */
-
-#include "dswayland-server-screenshooter.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- screenshooter::screenshooter(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- screenshooter::screenshooter(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- screenshooter::screenshooter(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- screenshooter::screenshooter()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- screenshooter::~screenshooter()
- {
- std::multimap<struct ::wl_client*, screenshooter::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- screenshooter::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void screenshooter::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void screenshooter::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- screenshooter::Resource *screenshooter::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- screenshooter::Resource *screenshooter::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void screenshooter::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::screenshooter_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = screenshooter::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *screenshooter::interface()
- {
- return &::screenshooter_interface;
- }
-
- screenshooter::Resource *screenshooter::screenshooter_allocate()
- {
- return new Resource;
- }
-
- void screenshooter::screenshooter_bind_resource(Resource *)
- {
- }
-
- void screenshooter::screenshooter_destroy_resource(Resource *)
- {
- }
-
- void screenshooter::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- screenshooter *that = static_cast<screenshooter *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void screenshooter::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- screenshooter *that = static_cast<screenshooter::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void screenshooter::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- screenshooter *that = resource->screenshooter_object;
- that->m_resource_map.erase(resource->client());
- that->screenshooter_destroy_resource(resource);
- delete resource;
- }
-
- screenshooter::Resource *screenshooter::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::screenshooter_interface, version, id);
- return bind(handle);
- }
-
- screenshooter::Resource *screenshooter::bind(struct ::wl_resource *handle)
- {
- Resource *resource = screenshooter_allocate();
- resource->screenshooter_object = this;
-
- wl_resource_set_implementation(handle, &m_screenshooter_interface, resource, destroy_func);
- resource->handle = handle;
- screenshooter_bind_resource(resource);
- return resource;
- }
- screenshooter::Resource *screenshooter::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::screenshooter_interface, &m_screenshooter_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::screenshooter_interface screenshooter::m_screenshooter_interface = {
- screenshooter::handle_shoot
- };
-
- void screenshooter::screenshooter_shoot(Resource *, struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
-
- void screenshooter::handle_shoot(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output,
- struct ::wl_resource *buffer)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<screenshooter *>(r->screenshooter_object)->screenshooter_shoot(
- r,
- output,
- buffer);
- }
-
- void screenshooter::send_done()
- {
- DS_ASSERT_X(m_resource, "screenshooter::done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call screenshooter::done as it's not initialised");
- return;
- }
- send_done(
- m_resource->handle);
- }
-
- void screenshooter::send_done(struct ::wl_resource *resource)
- {
- screenshooter_send_done(
- resource);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/screenshooter.xml */
-
-#ifndef __DS_SCREENSHOOTER_PROTOCOL_H__
-#define __DS_SCREENSHOOTER_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "screenshooter-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class screenshooter
- {
- public:
- screenshooter(struct ::wl_client *client, uint32_t id, int version);
- screenshooter(struct ::wl_display *display, int version);
- screenshooter(struct ::wl_resource *resource);
- screenshooter();
-
- virtual ~screenshooter();
-
- class Resource
- {
- public:
- Resource() : screenshooter_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- screenshooter *screenshooter_object;
- screenshooter *object() { return screenshooter_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_done();
- void send_done(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *screenshooter_allocate();
-
- virtual void screenshooter_bind_resource(Resource *resource);
- virtual void screenshooter_destroy_resource(Resource *resource);
-
- virtual void screenshooter_shoot(Resource *resource, struct ::wl_resource *output, struct ::wl_resource *buffer);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::screenshooter_interface m_screenshooter_interface;
-
- static void handle_shoot(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output,
- struct ::wl_resource *buffer);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- screenshooter *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/text-cursor-position.xml */
-
-#include "dswayland-server-text-cursor-position.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- text_cursor_position::text_cursor_position(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- text_cursor_position::text_cursor_position(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- text_cursor_position::text_cursor_position(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- text_cursor_position::text_cursor_position()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- text_cursor_position::~text_cursor_position()
- {
- std::multimap<struct ::wl_client*, text_cursor_position::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- text_cursor_position::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void text_cursor_position::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void text_cursor_position::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- text_cursor_position::Resource *text_cursor_position::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- text_cursor_position::Resource *text_cursor_position::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void text_cursor_position::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::text_cursor_position_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = text_cursor_position::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *text_cursor_position::interface()
- {
- return &::text_cursor_position_interface;
- }
-
- text_cursor_position::Resource *text_cursor_position::text_cursor_position_allocate()
- {
- return new Resource;
- }
-
- void text_cursor_position::text_cursor_position_bind_resource(Resource *)
- {
- }
-
- void text_cursor_position::text_cursor_position_destroy_resource(Resource *)
- {
- }
-
- void text_cursor_position::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- text_cursor_position *that = static_cast<text_cursor_position *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void text_cursor_position::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- text_cursor_position *that = static_cast<text_cursor_position::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void text_cursor_position::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- text_cursor_position *that = resource->text_cursor_position_object;
- that->m_resource_map.erase(resource->client());
- that->text_cursor_position_destroy_resource(resource);
- delete resource;
- }
-
- text_cursor_position::Resource *text_cursor_position::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::text_cursor_position_interface, version, id);
- return bind(handle);
- }
-
- text_cursor_position::Resource *text_cursor_position::bind(struct ::wl_resource *handle)
- {
- Resource *resource = text_cursor_position_allocate();
- resource->text_cursor_position_object = this;
-
- wl_resource_set_implementation(handle, &m_text_cursor_position_interface, resource, destroy_func);
- resource->handle = handle;
- text_cursor_position_bind_resource(resource);
- return resource;
- }
- text_cursor_position::Resource *text_cursor_position::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::text_cursor_position_interface, &m_text_cursor_position_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::text_cursor_position_interface text_cursor_position::m_text_cursor_position_interface = {
- text_cursor_position::handle_notify
- };
-
- void text_cursor_position::text_cursor_position_notify(Resource *, struct ::wl_resource *, wl_fixed_t , wl_fixed_t )
- {
- }
-
-
- void text_cursor_position::handle_notify(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- wl_fixed_t x,
- wl_fixed_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<text_cursor_position *>(r->text_cursor_position_object)->text_cursor_position_notify(
- r,
- surface,
- x,
- y);
- }
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/text-cursor-position.xml */
-
-#ifndef __DS_TEXT_CURSOR_POSITION_PROTOCOL_H__
-#define __DS_TEXT_CURSOR_POSITION_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "text-cursor-position-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class text_cursor_position
- {
- public:
- text_cursor_position(struct ::wl_client *client, uint32_t id, int version);
- text_cursor_position(struct ::wl_display *display, int version);
- text_cursor_position(struct ::wl_resource *resource);
- text_cursor_position();
-
- virtual ~text_cursor_position();
-
- class Resource
- {
- public:
- Resource() : text_cursor_position_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- text_cursor_position *text_cursor_position_object;
- text_cursor_position *object() { return text_cursor_position_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *text_cursor_position_allocate();
-
- virtual void text_cursor_position_bind_resource(Resource *resource);
- virtual void text_cursor_position_destroy_resource(Resource *resource);
-
- virtual void text_cursor_position_notify(Resource *resource, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::text_cursor_position_interface m_text_cursor_position_interface;
-
- static void handle_notify(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- wl_fixed_t x,
- wl_fixed_t y);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- text_cursor_position *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/text.xml */
-
-#include "dswayland-server-text.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- wl_text_input::wl_text_input(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_text_input::wl_text_input(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_text_input::wl_text_input(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_text_input::wl_text_input()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_text_input::~wl_text_input()
- {
- std::multimap<struct ::wl_client*, wl_text_input::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_text_input::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_text_input::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_text_input::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_text_input::Resource *wl_text_input::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_text_input::Resource *wl_text_input::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_text_input::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_text_input_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_text_input::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_text_input::interface()
- {
- return &::wl_text_input_interface;
- }
-
- wl_text_input::Resource *wl_text_input::text_input_allocate()
- {
- return new Resource;
- }
-
- void wl_text_input::text_input_bind_resource(Resource *)
- {
- }
-
- void wl_text_input::text_input_destroy_resource(Resource *)
- {
- }
-
- void wl_text_input::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_text_input *that = static_cast<wl_text_input *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_text_input::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_text_input *that = static_cast<wl_text_input::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_text_input::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_text_input *that = resource->text_input_object;
- that->m_resource_map.erase(resource->client());
- that->text_input_destroy_resource(resource);
- delete resource;
- }
-
- wl_text_input::Resource *wl_text_input::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_text_input_interface, version, id);
- return bind(handle);
- }
-
- wl_text_input::Resource *wl_text_input::bind(struct ::wl_resource *handle)
- {
- Resource *resource = text_input_allocate();
- resource->text_input_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_text_input_interface, resource, destroy_func);
- resource->handle = handle;
- text_input_bind_resource(resource);
- return resource;
- }
- wl_text_input::Resource *wl_text_input::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_text_input_interface, &m_wl_text_input_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_text_input_interface wl_text_input::m_wl_text_input_interface = {
- wl_text_input::handle_destroy,
- wl_text_input::handle_activate,
- wl_text_input::handle_deactivate,
- wl_text_input::handle_show_input_panel,
- wl_text_input::handle_hide_input_panel,
- wl_text_input::handle_reset,
- wl_text_input::handle_set_content_type,
- wl_text_input::handle_set_cursor_rectangle,
- wl_text_input::handle_set_preferred_language,
- wl_text_input::handle_commit_state,
- wl_text_input::handle_invoke_action,
- wl_text_input::handle_set_return_key_type,
- wl_text_input::handle_set_return_key_disabled,
- wl_text_input::handle_set_input_panel_data,
- wl_text_input::handle_bidi_direction,
- wl_text_input::handle_set_cursor_position,
- wl_text_input::handle_process_input_device_event,
- wl_text_input::handle_filter_key_event,
- wl_text_input::handle_get_hide_permission,
- wl_text_input::handle_set_capital_mode,
- wl_text_input::handle_prediction_hint,
- wl_text_input::handle_set_mime_type,
- wl_text_input::handle_set_input_panel_position,
- wl_text_input::handle_finalize_content,
- wl_text_input::handle_prediction_hint_data,
- wl_text_input::handle_input_panel_enabled
- };
-
- void wl_text_input::text_input_destroy(Resource *)
- {
- }
-
- void wl_text_input::text_input_activate(Resource *, struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
- void wl_text_input::text_input_deactivate(Resource *, struct ::wl_resource *)
- {
- }
-
- void wl_text_input::text_input_show_input_panel(Resource *)
- {
- }
-
- void wl_text_input::text_input_hide_input_panel(Resource *)
- {
- }
-
- void wl_text_input::text_input_reset(Resource *)
- {
- }
-
- void wl_text_input::text_input_set_content_type(Resource *, uint32_t , uint32_t )
- {
- }
-
- void wl_text_input::text_input_set_cursor_rectangle(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void wl_text_input::text_input_set_preferred_language(Resource *, const std::string &)
- {
- }
-
- void wl_text_input::text_input_commit_state(Resource *, uint32_t )
- {
- }
-
- void wl_text_input::text_input_invoke_action(Resource *, uint32_t , uint32_t )
- {
- }
-
- void wl_text_input::text_input_set_return_key_type(Resource *, uint32_t )
- {
- }
-
- void wl_text_input::text_input_set_return_key_disabled(Resource *, uint32_t )
- {
- }
-
- void wl_text_input::text_input_set_input_panel_data(Resource *, const std::string &, uint32_t )
- {
- }
-
- void wl_text_input::text_input_bidi_direction(Resource *, uint32_t )
- {
- }
-
- void wl_text_input::text_input_set_cursor_position(Resource *, uint32_t )
- {
- }
-
- void wl_text_input::text_input_process_input_device_event(Resource *, uint32_t , const std::string &, uint32_t )
- {
- }
-
- void wl_text_input::text_input_filter_key_event(Resource *, uint32_t , uint32_t , const std::string &, uint32_t , uint32_t , const std::string &, uint32_t , uint32_t , uint32_t )
- {
- }
-
- void wl_text_input::text_input_get_hide_permission(Resource *)
- {
- }
-
- void wl_text_input::text_input_set_capital_mode(Resource *, uint32_t )
- {
- }
-
- void wl_text_input::text_input_prediction_hint(Resource *, const std::string &)
- {
- }
-
- void wl_text_input::text_input_set_mime_type(Resource *, const std::string &)
- {
- }
-
- void wl_text_input::text_input_set_input_panel_position(Resource *, uint32_t , uint32_t )
- {
- }
-
- void wl_text_input::text_input_finalize_content(Resource *, const std::string &, uint32_t )
- {
- }
-
- void wl_text_input::text_input_prediction_hint_data(Resource *, const std::string &, const std::string &)
- {
- }
-
- void wl_text_input::text_input_input_panel_enabled(Resource *, uint32_t )
- {
- }
-
-
- void wl_text_input::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_destroy(
- r);
- }
-
- void wl_text_input::handle_activate(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_activate(
- r,
- seat,
- surface);
- }
-
- void wl_text_input::handle_deactivate(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_deactivate(
- r,
- seat);
- }
-
- void wl_text_input::handle_show_input_panel(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_show_input_panel(
- r);
- }
-
- void wl_text_input::handle_hide_input_panel(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_hide_input_panel(
- r);
- }
-
- void wl_text_input::handle_reset(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_reset(
- r);
- }
-
- void wl_text_input::handle_set_content_type(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t hint,
- uint32_t purpose)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_content_type(
- r,
- hint,
- purpose);
- }
-
- void wl_text_input::handle_set_cursor_rectangle(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_cursor_rectangle(
- r,
- x,
- y,
- width,
- height);
- }
-
- void wl_text_input::handle_set_preferred_language(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *language)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_preferred_language(
- r,
- std::string(language));
- }
-
- void wl_text_input::handle_commit_state(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_commit_state(
- r,
- serial);
- }
-
- void wl_text_input::handle_invoke_action(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t button,
- uint32_t index)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_invoke_action(
- r,
- button,
- index);
- }
-
- void wl_text_input::handle_set_return_key_type(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t return_key_type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_return_key_type(
- r,
- return_key_type);
- }
-
- void wl_text_input::handle_set_return_key_disabled(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t return_key_disabled)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_return_key_disabled(
- r,
- return_key_disabled);
- }
-
- void wl_text_input::handle_set_input_panel_data(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *input_panel_data,
- uint32_t input_panel_length)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_input_panel_data(
- r,
- std::string(input_panel_data),
- input_panel_length);
- }
-
- void wl_text_input::handle_bidi_direction(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t direction)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_bidi_direction(
- r,
- direction);
- }
-
- void wl_text_input::handle_set_cursor_position(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t cursor_position)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_cursor_position(
- r,
- cursor_position);
- }
-
- void wl_text_input::handle_process_input_device_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_type,
- const char *event_data,
- uint32_t event_length)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_process_input_device_event(
- r,
- event_type,
- std::string(event_data),
- event_length);
- }
-
- void wl_text_input::handle_filter_key_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t time,
- const char *keyname,
- uint32_t state,
- uint32_t modifiers,
- const char *dev_name,
- uint32_t dev_class,
- uint32_t dev_subclass,
- uint32_t keycode)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_filter_key_event(
- r,
- serial,
- time,
- std::string(keyname),
- state,
- modifiers,
- std::string(dev_name),
- dev_class,
- dev_subclass,
- keycode);
- }
-
- void wl_text_input::handle_get_hide_permission(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_get_hide_permission(
- r);
- }
-
- void wl_text_input::handle_set_capital_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t mode)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_capital_mode(
- r,
- mode);
- }
-
- void wl_text_input::handle_prediction_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *text)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_prediction_hint(
- r,
- std::string(text));
- }
-
- void wl_text_input::handle_set_mime_type(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_mime_type(
- r,
- std::string(type));
- }
-
- void wl_text_input::handle_set_input_panel_position(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t x,
- uint32_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_set_input_panel_position(
- r,
- x,
- y);
- }
-
- void wl_text_input::handle_finalize_content(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *text,
- uint32_t cursor_position)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_finalize_content(
- r,
- std::string(text),
- cursor_position);
- }
-
- void wl_text_input::handle_prediction_hint_data(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *key,
- const char *value)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_prediction_hint_data(
- r,
- std::string(key),
- std::string(value));
- }
-
- void wl_text_input::handle_input_panel_enabled(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t enabled)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input *>(r->text_input_object)->text_input_input_panel_enabled(
- r,
- enabled);
- }
-
- void wl_text_input::send_enter(struct ::wl_resource *surface)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::enter", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::enter as it's not initialised");
- return;
- }
- send_enter(
- m_resource->handle,
- surface);
- }
-
- void wl_text_input::send_enter(struct ::wl_resource *resource, struct ::wl_resource *surface)
- {
- wl_text_input_send_enter(
- resource,
- surface);
- }
-
-
- void wl_text_input::send_leave()
- {
- DS_ASSERT_X(m_resource, "wl_text_input::leave", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::leave as it's not initialised");
- return;
- }
- send_leave(
- m_resource->handle);
- }
-
- void wl_text_input::send_leave(struct ::wl_resource *resource)
- {
- wl_text_input_send_leave(
- resource);
- }
-
-
- void wl_text_input::send_modifiers_map(struct ::wl_array *map)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::modifiers_map", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::modifiers_map as it's not initialised");
- return;
- }
- send_modifiers_map(
- m_resource->handle,
- map);
- }
-
- void wl_text_input::send_modifiers_map(struct ::wl_resource *resource, struct ::wl_array *map)
- {
- wl_text_input_send_modifiers_map(
- resource,
- map);
- }
-
-
- void wl_text_input::send_input_panel_state(uint32_t state)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::input_panel_state", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::input_panel_state as it's not initialised");
- return;
- }
- send_input_panel_state(
- m_resource->handle,
- state);
- }
-
- void wl_text_input::send_input_panel_state(struct ::wl_resource *resource, uint32_t state)
- {
- wl_text_input_send_input_panel_state(
- resource,
- state);
- }
-
-
- void wl_text_input::send_preedit_string(uint32_t serial, const std::string &text, const std::string &commit)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::preedit_string", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::preedit_string as it's not initialised");
- return;
- }
- send_preedit_string(
- m_resource->handle,
- serial,
- text,
- commit);
- }
-
- void wl_text_input::send_preedit_string(struct ::wl_resource *resource, uint32_t serial, const std::string &text, const std::string &commit)
- {
- wl_text_input_send_preedit_string(
- resource,
- serial,
- text.c_str(),
- commit.c_str());
- }
-
-
- void wl_text_input::send_preedit_styling(uint32_t index, uint32_t length, uint32_t style)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::preedit_styling", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::preedit_styling as it's not initialised");
- return;
- }
- send_preedit_styling(
- m_resource->handle,
- index,
- length,
- style);
- }
-
- void wl_text_input::send_preedit_styling(struct ::wl_resource *resource, uint32_t index, uint32_t length, uint32_t style)
- {
- wl_text_input_send_preedit_styling(
- resource,
- index,
- length,
- style);
- }
-
-
- void wl_text_input::send_preedit_cursor(int32_t index)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::preedit_cursor", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::preedit_cursor as it's not initialised");
- return;
- }
- send_preedit_cursor(
- m_resource->handle,
- index);
- }
-
- void wl_text_input::send_preedit_cursor(struct ::wl_resource *resource, int32_t index)
- {
- wl_text_input_send_preedit_cursor(
- resource,
- index);
- }
-
-
- void wl_text_input::send_commit_string(uint32_t serial, const std::string &text)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::commit_string", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::commit_string as it's not initialised");
- return;
- }
- send_commit_string(
- m_resource->handle,
- serial,
- text);
- }
-
- void wl_text_input::send_commit_string(struct ::wl_resource *resource, uint32_t serial, const std::string &text)
- {
- wl_text_input_send_commit_string(
- resource,
- serial,
- text.c_str());
- }
-
-
- void wl_text_input::send_cursor_position(int32_t index, int32_t anchor)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::cursor_position", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::cursor_position as it's not initialised");
- return;
- }
- send_cursor_position(
- m_resource->handle,
- index,
- anchor);
- }
-
- void wl_text_input::send_cursor_position(struct ::wl_resource *resource, int32_t index, int32_t anchor)
- {
- wl_text_input_send_cursor_position(
- resource,
- index,
- anchor);
- }
-
-
- void wl_text_input::send_delete_surrounding_text(int32_t index, uint32_t length)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::delete_surrounding_text", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::delete_surrounding_text as it's not initialised");
- return;
- }
- send_delete_surrounding_text(
- m_resource->handle,
- index,
- length);
- }
-
- void wl_text_input::send_delete_surrounding_text(struct ::wl_resource *resource, int32_t index, uint32_t length)
- {
- wl_text_input_send_delete_surrounding_text(
- resource,
- index,
- length);
- }
-
-
- void wl_text_input::send_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::keysym", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::keysym as it's not initialised");
- return;
- }
- send_keysym(
- m_resource->handle,
- serial,
- time,
- sym,
- state,
- modifiers);
- }
-
- void wl_text_input::send_keysym(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
- {
- wl_text_input_send_keysym(
- resource,
- serial,
- time,
- sym,
- state,
- modifiers);
- }
-
-
- void wl_text_input::send_language(uint32_t serial, const std::string &language)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::language", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::language as it's not initialised");
- return;
- }
- send_language(
- m_resource->handle,
- serial,
- language);
- }
-
- void wl_text_input::send_language(struct ::wl_resource *resource, uint32_t serial, const std::string &language)
- {
- wl_text_input_send_language(
- resource,
- serial,
- language.c_str());
- }
-
-
- void wl_text_input::send_text_direction(uint32_t serial, uint32_t direction)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::text_direction", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::text_direction as it's not initialised");
- return;
- }
- send_text_direction(
- m_resource->handle,
- serial,
- direction);
- }
-
- void wl_text_input::send_text_direction(struct ::wl_resource *resource, uint32_t serial, uint32_t direction)
- {
- wl_text_input_send_text_direction(
- resource,
- serial,
- direction);
- }
-
-
- void wl_text_input::send_selection_region(uint32_t serial, int32_t start, int32_t end)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::selection_region", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::selection_region as it's not initialised");
- return;
- }
- send_selection_region(
- m_resource->handle,
- serial,
- start,
- end);
- }
-
- void wl_text_input::send_selection_region(struct ::wl_resource *resource, uint32_t serial, int32_t start, int32_t end)
- {
- wl_text_input_send_selection_region(
- resource,
- serial,
- start,
- end);
- }
-
-
- void wl_text_input::send_private_command(uint32_t serial, const std::string &command)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::private_command", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::private_command as it's not initialised");
- return;
- }
- send_private_command(
- m_resource->handle,
- serial,
- command);
- }
-
- void wl_text_input::send_private_command(struct ::wl_resource *resource, uint32_t serial, const std::string &command)
- {
- wl_text_input_send_private_command(
- resource,
- serial,
- command.c_str());
- }
-
-
- void wl_text_input::send_input_panel_geometry(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::input_panel_geometry", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::input_panel_geometry as it's not initialised");
- return;
- }
- send_input_panel_geometry(
- m_resource->handle,
- x,
- y,
- width,
- height);
- }
-
- void wl_text_input::send_input_panel_geometry(struct ::wl_resource *resource, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
- {
- wl_text_input_send_input_panel_geometry(
- resource,
- x,
- y,
- width,
- height);
- }
-
-
- void wl_text_input::send_input_panel_data(uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::input_panel_data", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::input_panel_data as it's not initialised");
- return;
- }
- send_input_panel_data(
- m_resource->handle,
- serial,
- input_panel_data,
- input_panel_data_length);
- }
-
- void wl_text_input::send_input_panel_data(struct ::wl_resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length)
- {
- wl_text_input_send_input_panel_data(
- resource,
- serial,
- input_panel_data.c_str(),
- input_panel_data_length);
- }
-
-
- void wl_text_input::send_get_selection_text(int32_t fd)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::get_selection_text", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::get_selection_text as it's not initialised");
- return;
- }
- send_get_selection_text(
- m_resource->handle,
- fd);
- }
-
- void wl_text_input::send_get_selection_text(struct ::wl_resource *resource, int32_t fd)
- {
- wl_text_input_send_get_selection_text(
- resource,
- fd);
- }
-
-
- void wl_text_input::send_get_surrounding_text(uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::get_surrounding_text", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::get_surrounding_text as it's not initialised");
- return;
- }
- send_get_surrounding_text(
- m_resource->handle,
- maxlen_before,
- maxlen_after,
- fd);
- }
-
- void wl_text_input::send_get_surrounding_text(struct ::wl_resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd)
- {
- wl_text_input_send_get_surrounding_text(
- resource,
- maxlen_before,
- maxlen_after,
- fd);
- }
-
-
- void wl_text_input::send_filter_key_event_done(uint32_t serial, uint32_t state)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::filter_key_event_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::filter_key_event_done as it's not initialised");
- return;
- }
- send_filter_key_event_done(
- m_resource->handle,
- serial,
- state);
- }
-
- void wl_text_input::send_filter_key_event_done(struct ::wl_resource *resource, uint32_t serial, uint32_t state)
- {
- wl_text_input_send_filter_key_event_done(
- resource,
- serial,
- state);
- }
-
-
- void wl_text_input::send_hide_permission(uint32_t response)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::hide_permission", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::hide_permission as it's not initialised");
- return;
- }
- send_hide_permission(
- m_resource->handle,
- response);
- }
-
- void wl_text_input::send_hide_permission(struct ::wl_resource *resource, uint32_t response)
- {
- wl_text_input_send_hide_permission(
- resource,
- response);
- }
-
-
- void wl_text_input::send_recapture_string(uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::recapture_string", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::recapture_string as it's not initialised");
- return;
- }
- send_recapture_string(
- m_resource->handle,
- serial,
- index,
- length,
- preedit,
- preedit_commit,
- commit);
- }
-
- void wl_text_input::send_recapture_string(struct ::wl_resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit)
- {
- wl_text_input_send_recapture_string(
- resource,
- serial,
- index,
- length,
- preedit.c_str(),
- preedit_commit.c_str(),
- commit.c_str());
- }
-
-
- void wl_text_input::send_input_panel_event(uint32_t serial, uint32_t event_type, uint32_t value)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::input_panel_event", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::input_panel_event as it's not initialised");
- return;
- }
- send_input_panel_event(
- m_resource->handle,
- serial,
- event_type,
- value);
- }
-
- void wl_text_input::send_input_panel_event(struct ::wl_resource *resource, uint32_t serial, uint32_t event_type, uint32_t value)
- {
- wl_text_input_send_input_panel_event(
- resource,
- serial,
- event_type,
- value);
- }
-
-
- void wl_text_input::send_commit_content(uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types)
- {
- DS_ASSERT_X(m_resource, "wl_text_input::commit_content", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_text_input::commit_content as it's not initialised");
- return;
- }
- send_commit_content(
- m_resource->handle,
- serial,
- content,
- description,
- mime_types);
- }
-
- void wl_text_input::send_commit_content(struct ::wl_resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types)
- {
- wl_text_input_send_commit_content(
- resource,
- serial,
- content.c_str(),
- description.c_str(),
- mime_types.c_str());
- }
-
-
- wl_text_input_manager::wl_text_input_manager(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_text_input_manager::wl_text_input_manager(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_text_input_manager::wl_text_input_manager(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_text_input_manager::wl_text_input_manager()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_text_input_manager::~wl_text_input_manager()
- {
- std::multimap<struct ::wl_client*, wl_text_input_manager::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_text_input_manager::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_text_input_manager::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_text_input_manager::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_text_input_manager::Resource *wl_text_input_manager::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_text_input_manager::Resource *wl_text_input_manager::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_text_input_manager::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_text_input_manager_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_text_input_manager::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_text_input_manager::interface()
- {
- return &::wl_text_input_manager_interface;
- }
-
- wl_text_input_manager::Resource *wl_text_input_manager::text_input_manager_allocate()
- {
- return new Resource;
- }
-
- void wl_text_input_manager::text_input_manager_bind_resource(Resource *)
- {
- }
-
- void wl_text_input_manager::text_input_manager_destroy_resource(Resource *)
- {
- }
-
- void wl_text_input_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_text_input_manager *that = static_cast<wl_text_input_manager *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_text_input_manager::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_text_input_manager *that = static_cast<wl_text_input_manager::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_text_input_manager::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_text_input_manager *that = resource->text_input_manager_object;
- that->m_resource_map.erase(resource->client());
- that->text_input_manager_destroy_resource(resource);
- delete resource;
- }
-
- wl_text_input_manager::Resource *wl_text_input_manager::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_text_input_manager_interface, version, id);
- return bind(handle);
- }
-
- wl_text_input_manager::Resource *wl_text_input_manager::bind(struct ::wl_resource *handle)
- {
- Resource *resource = text_input_manager_allocate();
- resource->text_input_manager_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_text_input_manager_interface, resource, destroy_func);
- resource->handle = handle;
- text_input_manager_bind_resource(resource);
- return resource;
- }
- wl_text_input_manager::Resource *wl_text_input_manager::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_text_input_manager_interface, &m_wl_text_input_manager_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_text_input_manager_interface wl_text_input_manager::m_wl_text_input_manager_interface = {
- wl_text_input_manager::handle_create_text_input
- };
-
- void wl_text_input_manager::text_input_manager_create_text_input(Resource *, uint32_t)
- {
- }
-
-
- void wl_text_input_manager::handle_create_text_input(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_text_input_manager *>(r->text_input_manager_object)->text_input_manager_create_text_input(
- r,
- id);
- }
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/text.xml */
-
-#ifndef __DS_TEXT_PROTOCOL_H__
-#define __DS_TEXT_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "text-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class wl_text_input
- {
- public:
- wl_text_input(struct ::wl_client *client, uint32_t id, int version);
- wl_text_input(struct ::wl_display *display, int version);
- wl_text_input(struct ::wl_resource *resource);
- wl_text_input();
-
- virtual ~wl_text_input();
-
- class Resource
- {
- public:
- Resource() : text_input_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_text_input *text_input_object;
- wl_text_input *object() { return text_input_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum content_hint {
- content_hint_none = 0x0, // no special behaviour
- content_hint_default = 0x7, // auto completion, correction and capitalization
- content_hint_password = 0xc0, // hidden and sensitive text
- content_hint_auto_completion = 0x1, // suggest word completions
- content_hint_auto_correction = 0x2, // suggest word corrections
- content_hint_auto_capitalization = 0x4, // switch to uppercase letters at the start of a sentence
- content_hint_lowercase = 0x8, // prefer lowercase letters
- content_hint_uppercase = 0x10, // prefer uppercase letters
- content_hint_titlecase = 0x20, // prefer casing for titles and headings (can be language dependent)
- content_hint_hidden_text = 0x40, // characters should be hidden
- content_hint_sensitive_data = 0x80, // typed text should not be stored
- content_hint_latin = 0x100, // just latin characters should be entered
- content_hint_multiline = 0x200, // the text input is multiline
- content_hint_word_capitalization = 0x400, // switch to uppercase letters at the start of a word
- content_hint_autofill_credit_card_expiration_date = 0x10000, // autofilled with credit card expiration date
- content_hint_autofill_credit_card_expiration_day = 0x20000, // autofilled with credit card expiration day
- content_hint_autofill_credit_card_expiration_month = 0x30000, // autofilled with credit card expiration month
- content_hint_autofill_credit_card_expiration_year = 0x40000, // autofilled with credit card expiration year
- content_hint_autofill_credit_card_number = 0x50000, // autofilled with credit card number
- content_hint_autofill_email_address = 0x60000, // autofilled with email address
- content_hint_autofill_phone = 0x70000, // autofilled with phone number
- content_hint_autofill_postal_address = 0x80000, // autofilled with postal address
- content_hint_autofill_postal_code = 0x90000, // autofilled with postal code
- content_hint_autofill_id = 0xA0000, // autofilled with id
- content_hint_autofill_name = 0xB0000, // autofilled with name
- };
-
- enum content_purpose {
- content_purpose_normal = 0, // default input, allowing all characters
- content_purpose_alpha = 1, // allow only alphabetic characters
- content_purpose_digits = 2, // allow only digits
- content_purpose_number = 3, // input a number (including decimal separator and sign)
- content_purpose_phone = 4, // input a phone number
- content_purpose_url = 5, // input an URL
- content_purpose_email = 6, // input an email address
- content_purpose_name = 7, // input a name of a person
- content_purpose_password = 8, // input a password (combine with password or sensitive_data hint)
- content_purpose_date = 9, // input a date
- content_purpose_time = 10, // input a time
- content_purpose_datetime = 11, // input a date and time
- content_purpose_terminal = 12, // input for a terminal
- content_purpose_ip = 13, // input for a IP (number and a-f for Ipv6)
- content_purpose_emoticon = 14, // input for an emoticon
- content_purpose_digits_signed = 15, // allow digits and negative sign
- content_purpose_digits_decimal = 16, // allow digits and decimal point
- content_purpose_digits_signeddecimal = 17, // allow digits, negative sign and decimal point
- content_purpose_password_digits = 18, // input a password with only digits
- content_purpose_filename = 19, // default input for the name of a file (symbols such as '/' should be disabled)
- content_purpose_hex = 20, // input for a hexadecimal
- content_purpose_voice = 21, // input for a voice
- };
-
- enum return_key_type {
- return_key_type_default = 0, // default
- return_key_type_done = 1, // done
- return_key_type_go = 2, // go
- return_key_type_join = 3, // join
- return_key_type_login = 4, // login
- return_key_type_next = 5, // next
- return_key_type_search = 6, // search
- return_key_type_send = 7, // send
- };
-
- enum capital_mode {
- capital_mode_uppercase = 0, // uppercase
- capital_mode_lowercase = 1, // lowercase
- };
-
- enum input_panel_state {
- input_panel_state_hide = 0, // Notification prior to the dismissal of the input panel
- input_panel_state_show = 1, // Notification after the display of the input panel
- };
-
- enum preedit_style {
- preedit_style_default = 0, // default style for composing text
- preedit_style_none = 1, // style should be the same as in non-composing text
- preedit_style_active = 2,
- preedit_style_inactive = 3,
- preedit_style_highlight = 4,
- preedit_style_underline = 5,
- preedit_style_selection = 6,
- preedit_style_incorrect = 7,
- preedit_style_reverse = 8, // Draw the text in reverse color mode
- preedit_style_bgcolor1 = 9, // Draw the text in underline background 1 mode
- preedit_style_bgcolor2 = 10, // Draw the text in underline background 2 mode
- preedit_style_bgcolor3 = 11, // Draw the text in underline background 3 mode
- preedit_style_bgcolor4 = 12, // Draw the text in underline background 4 mode
- };
-
- enum text_direction {
- text_direction_auto = 0, // automatic text direction based on text and language
- text_direction_ltr = 1, // left-to-right
- text_direction_rtl = 2, // right-to-left
- };
-
- void send_enter(struct ::wl_resource *surface);
- void send_enter(struct ::wl_resource *resource, struct ::wl_resource *surface);
- void send_leave();
- void send_leave(struct ::wl_resource *resource);
- void send_modifiers_map(struct ::wl_array *map);
- void send_modifiers_map(struct ::wl_resource *resource, struct ::wl_array *map);
- void send_input_panel_state(uint32_t state);
- void send_input_panel_state(struct ::wl_resource *resource, uint32_t state);
- void send_preedit_string(uint32_t serial, const std::string &text, const std::string &commit);
- void send_preedit_string(struct ::wl_resource *resource, uint32_t serial, const std::string &text, const std::string &commit);
- void send_preedit_styling(uint32_t index, uint32_t length, uint32_t style);
- void send_preedit_styling(struct ::wl_resource *resource, uint32_t index, uint32_t length, uint32_t style);
- void send_preedit_cursor(int32_t index);
- void send_preedit_cursor(struct ::wl_resource *resource, int32_t index);
- void send_commit_string(uint32_t serial, const std::string &text);
- void send_commit_string(struct ::wl_resource *resource, uint32_t serial, const std::string &text);
- void send_cursor_position(int32_t index, int32_t anchor);
- void send_cursor_position(struct ::wl_resource *resource, int32_t index, int32_t anchor);
- void send_delete_surrounding_text(int32_t index, uint32_t length);
- void send_delete_surrounding_text(struct ::wl_resource *resource, int32_t index, uint32_t length);
- void send_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers);
- void send_keysym(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers);
- void send_language(uint32_t serial, const std::string &language);
- void send_language(struct ::wl_resource *resource, uint32_t serial, const std::string &language);
- void send_text_direction(uint32_t serial, uint32_t direction);
- void send_text_direction(struct ::wl_resource *resource, uint32_t serial, uint32_t direction);
- void send_selection_region(uint32_t serial, int32_t start, int32_t end);
- void send_selection_region(struct ::wl_resource *resource, uint32_t serial, int32_t start, int32_t end);
- void send_private_command(uint32_t serial, const std::string &command);
- void send_private_command(struct ::wl_resource *resource, uint32_t serial, const std::string &command);
- void send_input_panel_geometry(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
- void send_input_panel_geometry(struct ::wl_resource *resource, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
- void send_input_panel_data(uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length);
- void send_input_panel_data(struct ::wl_resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length);
- void send_get_selection_text(int32_t fd);
- void send_get_selection_text(struct ::wl_resource *resource, int32_t fd);
- void send_get_surrounding_text(uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd);
- void send_get_surrounding_text(struct ::wl_resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd);
- void send_filter_key_event_done(uint32_t serial, uint32_t state);
- void send_filter_key_event_done(struct ::wl_resource *resource, uint32_t serial, uint32_t state);
- void send_hide_permission(uint32_t response);
- void send_hide_permission(struct ::wl_resource *resource, uint32_t response);
- void send_recapture_string(uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit);
- void send_recapture_string(struct ::wl_resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit);
- void send_input_panel_event(uint32_t serial, uint32_t event_type, uint32_t value);
- void send_input_panel_event(struct ::wl_resource *resource, uint32_t serial, uint32_t event_type, uint32_t value);
- void send_commit_content(uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types);
- void send_commit_content(struct ::wl_resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types);
-
- protected:
- virtual Resource *text_input_allocate();
-
- virtual void text_input_bind_resource(Resource *resource);
- virtual void text_input_destroy_resource(Resource *resource);
-
- virtual void text_input_destroy(Resource *resource);
- virtual void text_input_activate(Resource *resource, struct ::wl_resource *seat, struct ::wl_resource *surface);
- virtual void text_input_deactivate(Resource *resource, struct ::wl_resource *seat);
- virtual void text_input_show_input_panel(Resource *resource);
- virtual void text_input_hide_input_panel(Resource *resource);
- virtual void text_input_reset(Resource *resource);
- virtual void text_input_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose);
- virtual void text_input_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- virtual void text_input_set_preferred_language(Resource *resource, const std::string &language);
- virtual void text_input_commit_state(Resource *resource, uint32_t serial);
- virtual void text_input_invoke_action(Resource *resource, uint32_t button, uint32_t index);
- virtual void text_input_set_return_key_type(Resource *resource, uint32_t return_key_type);
- virtual void text_input_set_return_key_disabled(Resource *resource, uint32_t return_key_disabled);
- virtual void text_input_set_input_panel_data(Resource *resource, const std::string &input_panel_data, uint32_t input_panel_length);
- virtual void text_input_bidi_direction(Resource *resource, uint32_t direction);
- virtual void text_input_set_cursor_position(Resource *resource, uint32_t cursor_position);
- virtual void text_input_process_input_device_event(Resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length);
- virtual void text_input_filter_key_event(Resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode);
- virtual void text_input_get_hide_permission(Resource *resource);
- virtual void text_input_set_capital_mode(Resource *resource, uint32_t mode);
- virtual void text_input_prediction_hint(Resource *resource, const std::string &text);
- virtual void text_input_set_mime_type(Resource *resource, const std::string &type);
- virtual void text_input_set_input_panel_position(Resource *resource, uint32_t x, uint32_t y);
- virtual void text_input_finalize_content(Resource *resource, const std::string &text, uint32_t cursor_position);
- virtual void text_input_prediction_hint_data(Resource *resource, const std::string &key, const std::string &value);
- virtual void text_input_input_panel_enabled(Resource *resource, uint32_t enabled);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_text_input_interface m_wl_text_input_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_activate(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- struct ::wl_resource *surface);
- static void handle_deactivate(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat);
- static void handle_show_input_panel(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_hide_input_panel(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_reset(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_content_type(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t hint,
- uint32_t purpose);
- static void handle_set_cursor_rectangle(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- static void handle_set_preferred_language(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *language);
- static void handle_commit_state(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void handle_invoke_action(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t button,
- uint32_t index);
- static void handle_set_return_key_type(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t return_key_type);
- static void handle_set_return_key_disabled(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t return_key_disabled);
- static void handle_set_input_panel_data(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *input_panel_data,
- uint32_t input_panel_length);
- static void handle_bidi_direction(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t direction);
- static void handle_set_cursor_position(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t cursor_position);
- static void handle_process_input_device_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_type,
- const char *event_data,
- uint32_t event_length);
- static void handle_filter_key_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t time,
- const char *keyname,
- uint32_t state,
- uint32_t modifiers,
- const char *dev_name,
- uint32_t dev_class,
- uint32_t dev_subclass,
- uint32_t keycode);
- static void handle_get_hide_permission(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_capital_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t mode);
- static void handle_prediction_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *text);
- static void handle_set_mime_type(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *type);
- static void handle_set_input_panel_position(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t x,
- uint32_t y);
- static void handle_finalize_content(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *text,
- uint32_t cursor_position);
- static void handle_prediction_hint_data(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *key,
- const char *value);
- static void handle_input_panel_enabled(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t enabled);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_text_input *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_text_input_manager
- {
- public:
- wl_text_input_manager(struct ::wl_client *client, uint32_t id, int version);
- wl_text_input_manager(struct ::wl_display *display, int version);
- wl_text_input_manager(struct ::wl_resource *resource);
- wl_text_input_manager();
-
- virtual ~wl_text_input_manager();
-
- class Resource
- {
- public:
- Resource() : text_input_manager_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_text_input_manager *text_input_manager_object;
- wl_text_input_manager *object() { return text_input_manager_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *text_input_manager_allocate();
-
- virtual void text_input_manager_bind_resource(Resource *resource);
- virtual void text_input_manager_destroy_resource(Resource *resource);
-
- virtual void text_input_manager_create_text_input(Resource *resource, uint32_t id);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_text_input_manager_interface m_wl_text_input_manager_interface;
-
- static void handle_create_text_input(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_text_input_manager *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-dpms.xml */
-
-#include "dswayland-server-tizen-dpms.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- tizen_dpms_manager::tizen_dpms_manager(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_dpms_manager::tizen_dpms_manager(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_dpms_manager::tizen_dpms_manager(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_dpms_manager::tizen_dpms_manager()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_dpms_manager::~tizen_dpms_manager()
- {
- std::multimap<struct ::wl_client*, tizen_dpms_manager::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_dpms_manager::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_dpms_manager::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_dpms_manager::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_dpms_manager::Resource *tizen_dpms_manager::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_dpms_manager::Resource *tizen_dpms_manager::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_dpms_manager::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_dpms_manager_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_dpms_manager::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_dpms_manager::interface()
- {
- return &::tizen_dpms_manager_interface;
- }
-
- tizen_dpms_manager::Resource *tizen_dpms_manager::tizen_dpms_manager_allocate()
- {
- return new Resource;
- }
-
- void tizen_dpms_manager::tizen_dpms_manager_bind_resource(Resource *)
- {
- }
-
- void tizen_dpms_manager::tizen_dpms_manager_destroy_resource(Resource *)
- {
- }
-
- void tizen_dpms_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_dpms_manager *that = static_cast<tizen_dpms_manager *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_dpms_manager::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_dpms_manager *that = static_cast<tizen_dpms_manager::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_dpms_manager::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_dpms_manager *that = resource->tizen_dpms_manager_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_dpms_manager_destroy_resource(resource);
- delete resource;
- }
-
- tizen_dpms_manager::Resource *tizen_dpms_manager::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_dpms_manager_interface, version, id);
- return bind(handle);
- }
-
- tizen_dpms_manager::Resource *tizen_dpms_manager::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_dpms_manager_allocate();
- resource->tizen_dpms_manager_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_dpms_manager_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_dpms_manager_bind_resource(resource);
- return resource;
- }
- tizen_dpms_manager::Resource *tizen_dpms_manager::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_dpms_manager_interface, &m_tizen_dpms_manager_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_dpms_manager_interface tizen_dpms_manager::m_tizen_dpms_manager_interface = {
- tizen_dpms_manager::handle_destroy,
- tizen_dpms_manager::handle_set_dpms,
- tizen_dpms_manager::handle_get_dpms
- };
-
- void tizen_dpms_manager::tizen_dpms_manager_destroy(Resource *)
- {
- }
-
- void tizen_dpms_manager::tizen_dpms_manager_set_dpms(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_dpms_manager::tizen_dpms_manager_get_dpms(Resource *, struct ::wl_resource *)
- {
- }
-
-
- void tizen_dpms_manager::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_dpms_manager *>(r->tizen_dpms_manager_object)->tizen_dpms_manager_destroy(
- r);
- }
-
- void tizen_dpms_manager::handle_set_dpms(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output,
- uint32_t mode)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_dpms_manager *>(r->tizen_dpms_manager_object)->tizen_dpms_manager_set_dpms(
- r,
- output,
- mode);
- }
-
- void tizen_dpms_manager::handle_get_dpms(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_dpms_manager *>(r->tizen_dpms_manager_object)->tizen_dpms_manager_get_dpms(
- r,
- output);
- }
-
- void tizen_dpms_manager::send_set_state(uint32_t mode, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "tizen_dpms_manager::set_state", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_dpms_manager::set_state as it's not initialised");
- return;
- }
- send_set_state(
- m_resource->handle,
- mode,
- error);
- }
-
- void tizen_dpms_manager::send_set_state(struct ::wl_resource *resource, uint32_t mode, uint32_t error)
- {
- tizen_dpms_manager_send_set_state(
- resource,
- mode,
- error);
- }
-
-
- void tizen_dpms_manager::send_get_state(uint32_t mode, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "tizen_dpms_manager::get_state", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_dpms_manager::get_state as it's not initialised");
- return;
- }
- send_get_state(
- m_resource->handle,
- mode,
- error);
- }
-
- void tizen_dpms_manager::send_get_state(struct ::wl_resource *resource, uint32_t mode, uint32_t error)
- {
- tizen_dpms_manager_send_get_state(
- resource,
- mode,
- error);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-dpms.xml */
-
-#ifndef __DS_TIZEN_DPMS_PROTOCOL_H__
-#define __DS_TIZEN_DPMS_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "tizen-dpms-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class tizen_dpms_manager
- {
- public:
- tizen_dpms_manager(struct ::wl_client *client, uint32_t id, int version);
- tizen_dpms_manager(struct ::wl_display *display, int version);
- tizen_dpms_manager(struct ::wl_resource *resource);
- tizen_dpms_manager();
-
- virtual ~tizen_dpms_manager();
-
- class Resource
- {
- public:
- Resource() : tizen_dpms_manager_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_dpms_manager *tizen_dpms_manager_object;
- tizen_dpms_manager *object() { return tizen_dpms_manager_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_none = 0, // no error
- error_invalid_permission = 1, // Permission deny
- error_invalid_parameter = 2, // Given parameter is invalid
- error_not_supported = 3, // Given service is not supported.
- error_already_done = 4, // Given request is already done.
- };
-
- enum mode {
- mode_on = 0, // DPMS ON
- mode_standby = 1, // DPMS STANDBY
- mode_suspend = 2, // DPMS SUSPEND
- mode_off = 3, // DPMS OFF
- };
-
- void send_set_state(uint32_t mode, uint32_t error);
- void send_set_state(struct ::wl_resource *resource, uint32_t mode, uint32_t error);
- void send_get_state(uint32_t mode, uint32_t error);
- void send_get_state(struct ::wl_resource *resource, uint32_t mode, uint32_t error);
-
- protected:
- virtual Resource *tizen_dpms_manager_allocate();
-
- virtual void tizen_dpms_manager_bind_resource(Resource *resource);
- virtual void tizen_dpms_manager_destroy_resource(Resource *resource);
-
- virtual void tizen_dpms_manager_destroy(Resource *resource);
- virtual void tizen_dpms_manager_set_dpms(Resource *resource, struct ::wl_resource *output, uint32_t mode);
- virtual void tizen_dpms_manager_get_dpms(Resource *resource, struct ::wl_resource *output);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_dpms_manager_interface m_tizen_dpms_manager_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_dpms(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output,
- uint32_t mode);
- static void handle_get_dpms(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_dpms_manager *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-extension.xml */
-
-#include "dswayland-server-tizen-extension.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- tizen_surface::tizen_surface(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_surface::tizen_surface(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_surface::tizen_surface(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_surface::tizen_surface()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_surface::~tizen_surface()
- {
- std::multimap<struct ::wl_client*, tizen_surface::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_surface::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_surface::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_surface::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_surface::Resource *tizen_surface::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_surface::Resource *tizen_surface::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_surface::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_surface_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_surface::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_surface::interface()
- {
- return &::tizen_surface_interface;
- }
-
- tizen_surface::Resource *tizen_surface::tizen_surface_allocate()
- {
- return new Resource;
- }
-
- void tizen_surface::tizen_surface_bind_resource(Resource *)
- {
- }
-
- void tizen_surface::tizen_surface_destroy_resource(Resource *)
- {
- }
-
- void tizen_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_surface *that = static_cast<tizen_surface *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_surface::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_surface *that = static_cast<tizen_surface::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_surface::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_surface *that = resource->tizen_surface_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_surface_destroy_resource(resource);
- delete resource;
- }
-
- tizen_surface::Resource *tizen_surface::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_surface_interface, version, id);
- return bind(handle);
- }
-
- tizen_surface::Resource *tizen_surface::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_surface_allocate();
- resource->tizen_surface_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_surface_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_surface_bind_resource(resource);
- return resource;
- }
- tizen_surface::Resource *tizen_surface::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_surface_interface, &m_tizen_surface_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_surface_interface tizen_surface::m_tizen_surface_interface = {
- tizen_surface::handle_get_tizen_resource,
- tizen_surface::handle_destroy
- };
-
- void tizen_surface::tizen_surface_get_tizen_resource(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_surface::tizen_surface_destroy(Resource *)
- {
- }
-
-
- void tizen_surface::handle_get_tizen_resource(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_surface *>(r->tizen_surface_object)->tizen_surface_get_tizen_resource(
- r,
- id,
- surface);
- }
-
- void tizen_surface::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_surface *>(r->tizen_surface_object)->tizen_surface_destroy(
- r);
- }
-
- tizen_resource::tizen_resource(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_resource::tizen_resource(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_resource::tizen_resource(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_resource::tizen_resource()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_resource::~tizen_resource()
- {
- std::multimap<struct ::wl_client*, tizen_resource::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_resource::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_resource::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_resource::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_resource::Resource *tizen_resource::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_resource::Resource *tizen_resource::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_resource::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_resource_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_resource::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_resource::interface()
- {
- return &::tizen_resource_interface;
- }
-
- tizen_resource::Resource *tizen_resource::tizen_resource_allocate()
- {
- return new Resource;
- }
-
- void tizen_resource::tizen_resource_bind_resource(Resource *)
- {
- }
-
- void tizen_resource::tizen_resource_destroy_resource(Resource *)
- {
- }
-
- void tizen_resource::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_resource *that = static_cast<tizen_resource *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_resource::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_resource *that = static_cast<tizen_resource::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_resource::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_resource *that = resource->tizen_resource_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_resource_destroy_resource(resource);
- delete resource;
- }
-
- tizen_resource::Resource *tizen_resource::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_resource_interface, version, id);
- return bind(handle);
- }
-
- tizen_resource::Resource *tizen_resource::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_resource_allocate();
- resource->tizen_resource_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_resource_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_resource_bind_resource(resource);
- return resource;
- }
- tizen_resource::Resource *tizen_resource::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_resource_interface, &m_tizen_resource_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_resource_interface tizen_resource::m_tizen_resource_interface = {
- tizen_resource::handle_destroy
- };
-
- void tizen_resource::tizen_resource_destroy(Resource *)
- {
- }
-
-
- void tizen_resource::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_resource *>(r->tizen_resource_object)->tizen_resource_destroy(
- r);
- }
-
- void tizen_resource::send_resource_id(uint32_t id)
- {
- DS_ASSERT_X(m_resource, "tizen_resource::resource_id", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_resource::resource_id as it's not initialised");
- return;
- }
- send_resource_id(
- m_resource->handle,
- id);
- }
-
- void tizen_resource::send_resource_id(struct ::wl_resource *resource, uint32_t id)
- {
- tizen_resource_send_resource_id(
- resource,
- id);
- }
-
-
- tizen_policy::tizen_policy(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_policy::tizen_policy(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_policy::tizen_policy(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_policy::tizen_policy()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_policy::~tizen_policy()
- {
- std::multimap<struct ::wl_client*, tizen_policy::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_policy::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_policy::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_policy::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_policy::Resource *tizen_policy::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_policy::Resource *tizen_policy::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_policy::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_policy_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_policy::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_policy::interface()
- {
- return &::tizen_policy_interface;
- }
-
- tizen_policy::Resource *tizen_policy::tizen_policy_allocate()
- {
- return new Resource;
- }
-
- void tizen_policy::tizen_policy_bind_resource(Resource *)
- {
- }
-
- void tizen_policy::tizen_policy_destroy_resource(Resource *)
- {
- }
-
- void tizen_policy::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_policy *that = static_cast<tizen_policy *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_policy::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_policy *that = static_cast<tizen_policy::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_policy::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_policy *that = resource->tizen_policy_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_policy_destroy_resource(resource);
- delete resource;
- }
-
- tizen_policy::Resource *tizen_policy::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_policy_interface, version, id);
- return bind(handle);
- }
-
- tizen_policy::Resource *tizen_policy::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_policy_allocate();
- resource->tizen_policy_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_policy_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_policy_bind_resource(resource);
- return resource;
- }
- tizen_policy::Resource *tizen_policy::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_policy_interface, &m_tizen_policy_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_policy_interface tizen_policy::m_tizen_policy_interface = {
- tizen_policy::handle_get_visibility,
- tizen_policy::handle_get_position,
- tizen_policy::handle_activate,
- tizen_policy::handle_activate_below_by_res_id,
- tizen_policy::handle_raise,
- tizen_policy::handle_lower,
- tizen_policy::handle_lower_by_res_id,
- tizen_policy::handle_set_focus_skip,
- tizen_policy::handle_unset_focus_skip,
- tizen_policy::handle_set_role,
- tizen_policy::handle_set_type,
- tizen_policy::handle_set_conformant,
- tizen_policy::handle_unset_conformant,
- tizen_policy::handle_get_conformant,
- tizen_policy::handle_set_notification_level,
- tizen_policy::handle_set_transient_for,
- tizen_policy::handle_unset_transient_for,
- tizen_policy::handle_set_window_screen_mode,
- tizen_policy::handle_place_subsurface_below_parent,
- tizen_policy::handle_set_subsurface_stand_alone,
- tizen_policy::handle_get_subsurface,
- tizen_policy::handle_set_opaque_state,
- tizen_policy::handle_iconify,
- tizen_policy::handle_uniconify,
- tizen_policy::handle_add_aux_hint,
- tizen_policy::handle_change_aux_hint,
- tizen_policy::handle_del_aux_hint,
- tizen_policy::handle_get_supported_aux_hints,
- tizen_policy::handle_set_background_state,
- tizen_policy::handle_unset_background_state,
- tizen_policy::handle_set_floating_mode,
- tizen_policy::handle_unset_floating_mode,
- tizen_policy::handle_set_stack_mode,
- tizen_policy::handle_activate_above_by_res_id,
- tizen_policy::handle_get_subsurface_watcher,
- tizen_policy::handle_set_parent,
- tizen_policy::handle_ack_conformant_region,
- tizen_policy::handle_destroy,
- tizen_policy::handle_has_video,
- tizen_policy::handle_set_appid,
- tizen_policy::handle_show,
- tizen_policy::handle_hide,
- tizen_policy::handle_set_transient_for_below,
- tizen_policy::handle_set_parent_with_below
- };
-
- void tizen_policy::tizen_policy_get_visibility(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_get_position(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_activate(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_activate_below_by_res_id(Resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_raise(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_lower(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_lower_by_res_id(Resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_set_focus_skip(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_unset_focus_skip(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_set_role(Resource *, struct ::wl_resource *, const std::string &)
- {
- }
-
- void tizen_policy::tizen_policy_set_type(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_set_conformant(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_unset_conformant(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_get_conformant(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_set_notification_level(Resource *, struct ::wl_resource *, int32_t )
- {
- }
-
- void tizen_policy::tizen_policy_set_transient_for(Resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_unset_transient_for(Resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_set_window_screen_mode(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_place_subsurface_below_parent(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_set_subsurface_stand_alone(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_get_subsurface(Resource *, uint32_t, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_set_opaque_state(Resource *, struct ::wl_resource *, int32_t )
- {
- }
-
- void tizen_policy::tizen_policy_iconify(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_uniconify(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_add_aux_hint(Resource *, struct ::wl_resource *, int32_t , const std::string &, const std::string &)
- {
- }
-
- void tizen_policy::tizen_policy_change_aux_hint(Resource *, struct ::wl_resource *, int32_t , const std::string &)
- {
- }
-
- void tizen_policy::tizen_policy_del_aux_hint(Resource *, struct ::wl_resource *, int32_t )
- {
- }
-
- void tizen_policy::tizen_policy_get_supported_aux_hints(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_set_background_state(Resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_unset_background_state(Resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_set_floating_mode(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_unset_floating_mode(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_set_stack_mode(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_activate_above_by_res_id(Resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_get_subsurface_watcher(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_set_parent(Resource *, struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_ack_conformant_region(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_destroy(Resource *)
- {
- }
-
- void tizen_policy::tizen_policy_has_video(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_set_appid(Resource *, int32_t , const std::string &)
- {
- }
-
- void tizen_policy::tizen_policy_show(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_hide(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_policy::tizen_policy_set_transient_for_below(Resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_policy::tizen_policy_set_parent_with_below(Resource *, struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
-
- void tizen_policy::handle_get_visibility(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_get_visibility(
- r,
- id,
- surface);
- }
-
- void tizen_policy::handle_get_position(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_get_position(
- r,
- id,
- surface);
- }
-
- void tizen_policy::handle_activate(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_activate(
- r,
- surface);
- }
-
- void tizen_policy::handle_activate_below_by_res_id(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t res_id,
- uint32_t below_res_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_activate_below_by_res_id(
- r,
- res_id,
- below_res_id);
- }
-
- void tizen_policy::handle_raise(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_raise(
- r,
- surface);
- }
-
- void tizen_policy::handle_lower(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_lower(
- r,
- surface);
- }
-
- void tizen_policy::handle_lower_by_res_id(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t res_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_lower_by_res_id(
- r,
- res_id);
- }
-
- void tizen_policy::handle_set_focus_skip(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_focus_skip(
- r,
- surface);
- }
-
- void tizen_policy::handle_unset_focus_skip(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_unset_focus_skip(
- r,
- surface);
- }
-
- void tizen_policy::handle_set_role(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- const char *role)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_role(
- r,
- surface,
- std::string(role));
- }
-
- void tizen_policy::handle_set_type(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t win_type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_type(
- r,
- surface,
- win_type);
- }
-
- void tizen_policy::handle_set_conformant(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_conformant(
- r,
- surface);
- }
-
- void tizen_policy::handle_unset_conformant(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_unset_conformant(
- r,
- surface);
- }
-
- void tizen_policy::handle_get_conformant(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_get_conformant(
- r,
- surface);
- }
-
- void tizen_policy::handle_set_notification_level(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t level)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_notification_level(
- r,
- surface,
- level);
- }
-
- void tizen_policy::handle_set_transient_for(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t child_id,
- uint32_t parent_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_transient_for(
- r,
- child_id,
- parent_id);
- }
-
- void tizen_policy::handle_unset_transient_for(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t child_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_unset_transient_for(
- r,
- child_id);
- }
-
- void tizen_policy::handle_set_window_screen_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t mode)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_window_screen_mode(
- r,
- surface,
- mode);
- }
-
- void tizen_policy::handle_place_subsurface_below_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *subsurface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_place_subsurface_below_parent(
- r,
- subsurface);
- }
-
- void tizen_policy::handle_set_subsurface_stand_alone(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *subsurface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_subsurface_stand_alone(
- r,
- subsurface);
- }
-
- void tizen_policy::handle_get_subsurface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface,
- uint32_t parent_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_get_subsurface(
- r,
- id,
- surface,
- parent_id);
- }
-
- void tizen_policy::handle_set_opaque_state(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t state)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_opaque_state(
- r,
- surface,
- state);
- }
-
- void tizen_policy::handle_iconify(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_iconify(
- r,
- surface);
- }
-
- void tizen_policy::handle_uniconify(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_uniconify(
- r,
- surface);
- }
-
- void tizen_policy::handle_add_aux_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t id,
- const char *name,
- const char *value)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_add_aux_hint(
- r,
- surface,
- id,
- std::string(name),
- std::string(value));
- }
-
- void tizen_policy::handle_change_aux_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t id,
- const char *value)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_change_aux_hint(
- r,
- surface,
- id,
- std::string(value));
- }
-
- void tizen_policy::handle_del_aux_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_del_aux_hint(
- r,
- surface,
- id);
- }
-
- void tizen_policy::handle_get_supported_aux_hints(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_get_supported_aux_hints(
- r,
- surface);
- }
-
- void tizen_policy::handle_set_background_state(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_background_state(
- r,
- pid);
- }
-
- void tizen_policy::handle_unset_background_state(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_unset_background_state(
- r,
- pid);
- }
-
- void tizen_policy::handle_set_floating_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_floating_mode(
- r,
- surface);
- }
-
- void tizen_policy::handle_unset_floating_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_unset_floating_mode(
- r,
- surface);
- }
-
- void tizen_policy::handle_set_stack_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t mode)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_stack_mode(
- r,
- surface,
- mode);
- }
-
- void tizen_policy::handle_activate_above_by_res_id(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t res_id,
- uint32_t above_res_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_activate_above_by_res_id(
- r,
- res_id,
- above_res_id);
- }
-
- void tizen_policy::handle_get_subsurface_watcher(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_get_subsurface_watcher(
- r,
- id,
- surface);
- }
-
- void tizen_policy::handle_set_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *child,
- struct ::wl_resource *parent)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_parent(
- r,
- child,
- parent);
- }
-
- void tizen_policy::handle_ack_conformant_region(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_ack_conformant_region(
- r,
- surface,
- serial);
- }
-
- void tizen_policy::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_destroy(
- r);
- }
-
- void tizen_policy::handle_has_video(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t has)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_has_video(
- r,
- surface,
- has);
- }
-
- void tizen_policy::handle_set_appid(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t pid,
- const char *appid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_appid(
- r,
- pid,
- std::string(appid));
- }
-
- void tizen_policy::handle_show(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_show(
- r,
- surface);
- }
-
- void tizen_policy::handle_hide(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_hide(
- r,
- surface);
- }
-
- void tizen_policy::handle_set_transient_for_below(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t child_id,
- uint32_t parent_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_transient_for_below(
- r,
- child_id,
- parent_id);
- }
-
- void tizen_policy::handle_set_parent_with_below(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *child,
- struct ::wl_resource *parent)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy *>(r->tizen_policy_object)->tizen_policy_set_parent_with_below(
- r,
- child,
- parent);
- }
-
- void tizen_policy::send_conformant(struct ::wl_resource *surface, uint32_t is_conformant)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::conformant", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::conformant as it's not initialised");
- return;
- }
- send_conformant(
- m_resource->handle,
- surface,
- is_conformant);
- }
-
- void tizen_policy::send_conformant(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t is_conformant)
- {
- tizen_policy_send_conformant(
- resource,
- surface,
- is_conformant);
- }
-
-
- void tizen_policy::send_conformant_area(struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::conformant_area", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::conformant_area as it's not initialised");
- return;
- }
- send_conformant_area(
- m_resource->handle,
- surface,
- conformant_part,
- state,
- x,
- y,
- w,
- h);
- }
-
- void tizen_policy::send_conformant_area(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
- {
- tizen_policy_send_conformant_area(
- resource,
- surface,
- conformant_part,
- state,
- x,
- y,
- w,
- h);
- }
-
-
- void tizen_policy::send_notification_done(struct ::wl_resource *surface, int32_t level, uint32_t error_state)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::notification_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::notification_done as it's not initialised");
- return;
- }
- send_notification_done(
- m_resource->handle,
- surface,
- level,
- error_state);
- }
-
- void tizen_policy::send_notification_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t level, uint32_t error_state)
- {
- tizen_policy_send_notification_done(
- resource,
- surface,
- level,
- error_state);
- }
-
-
- void tizen_policy::send_transient_for_done(uint32_t child_id)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::transient_for_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::transient_for_done as it's not initialised");
- return;
- }
- send_transient_for_done(
- m_resource->handle,
- child_id);
- }
-
- void tizen_policy::send_transient_for_done(struct ::wl_resource *resource, uint32_t child_id)
- {
- tizen_policy_send_transient_for_done(
- resource,
- child_id);
- }
-
-
- void tizen_policy::send_window_screen_mode_done(struct ::wl_resource *surface, uint32_t mode, uint32_t error_state)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::window_screen_mode_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::window_screen_mode_done as it's not initialised");
- return;
- }
- send_window_screen_mode_done(
- m_resource->handle,
- surface,
- mode,
- error_state);
- }
-
- void tizen_policy::send_window_screen_mode_done(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode, uint32_t error_state)
- {
- tizen_policy_send_window_screen_mode_done(
- resource,
- surface,
- mode,
- error_state);
- }
-
-
- void tizen_policy::send_iconify_state_changed(struct ::wl_resource *surface, uint32_t iconified, uint32_t force)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::iconify_state_changed", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::iconify_state_changed as it's not initialised");
- return;
- }
- send_iconify_state_changed(
- m_resource->handle,
- surface,
- iconified,
- force);
- }
-
- void tizen_policy::send_iconify_state_changed(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t iconified, uint32_t force)
- {
- tizen_policy_send_iconify_state_changed(
- resource,
- surface,
- iconified,
- force);
- }
-
-
- void tizen_policy::send_supported_aux_hints(struct ::wl_resource *surface, struct ::wl_array *hints, uint32_t num_hints)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::supported_aux_hints", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::supported_aux_hints as it's not initialised");
- return;
- }
- send_supported_aux_hints(
- m_resource->handle,
- surface,
- hints,
- num_hints);
- }
-
- void tizen_policy::send_supported_aux_hints(struct ::wl_resource *resource, struct ::wl_resource *surface, struct ::wl_array *hints, uint32_t num_hints)
- {
- tizen_policy_send_supported_aux_hints(
- resource,
- surface,
- hints,
- num_hints);
- }
-
-
- void tizen_policy::send_allowed_aux_hint(struct ::wl_resource *surface, int32_t id)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::allowed_aux_hint", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::allowed_aux_hint as it's not initialised");
- return;
- }
- send_allowed_aux_hint(
- m_resource->handle,
- surface,
- id);
- }
-
- void tizen_policy::send_allowed_aux_hint(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t id)
- {
- tizen_policy_send_allowed_aux_hint(
- resource,
- surface,
- id);
- }
-
-
- void tizen_policy::send_aux_message(struct ::wl_resource *surface, const std::string &key, const std::string &value, struct ::wl_array *options)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::aux_message", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::aux_message as it's not initialised");
- return;
- }
- send_aux_message(
- m_resource->handle,
- surface,
- key,
- value,
- options);
- }
-
- void tizen_policy::send_aux_message(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &key, const std::string &value, struct ::wl_array *options)
- {
- tizen_policy_send_aux_message(
- resource,
- surface,
- key.c_str(),
- value.c_str(),
- options);
- }
-
-
- void tizen_policy::send_conformant_region(struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::conformant_region", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::conformant_region as it's not initialised");
- return;
- }
- send_conformant_region(
- m_resource->handle,
- surface,
- conformant_part,
- state,
- x,
- y,
- w,
- h,
- serial);
- }
-
- void tizen_policy::send_conformant_region(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial)
- {
- tizen_policy_send_conformant_region(
- resource,
- surface,
- conformant_part,
- state,
- x,
- y,
- w,
- h,
- serial);
- }
-
-
- void tizen_policy::send_interactive_move_done(struct ::wl_resource *surface, int32_t x, int32_t y, uint32_t w, uint32_t h)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::interactive_move_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::interactive_move_done as it's not initialised");
- return;
- }
- send_interactive_move_done(
- m_resource->handle,
- surface,
- x,
- y,
- w,
- h);
- }
-
- void tizen_policy::send_interactive_move_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t x, int32_t y, uint32_t w, uint32_t h)
- {
- tizen_policy_send_interactive_move_done(
- resource,
- surface,
- x,
- y,
- w,
- h);
- }
-
-
- void tizen_policy::send_interactive_resize_done(struct ::wl_resource *surface, int32_t x, int32_t y, uint32_t w, uint32_t h)
- {
- DS_ASSERT_X(m_resource, "tizen_policy::interactive_resize_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy::interactive_resize_done as it's not initialised");
- return;
- }
- send_interactive_resize_done(
- m_resource->handle,
- surface,
- x,
- y,
- w,
- h);
- }
-
- void tizen_policy::send_interactive_resize_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t x, int32_t y, uint32_t w, uint32_t h)
- {
- tizen_policy_send_interactive_resize_done(
- resource,
- surface,
- x,
- y,
- w,
- h);
- }
-
-
- tizen_visibility::tizen_visibility(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_visibility::tizen_visibility(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_visibility::tizen_visibility(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_visibility::tizen_visibility()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_visibility::~tizen_visibility()
- {
- std::multimap<struct ::wl_client*, tizen_visibility::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_visibility::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_visibility::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_visibility::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_visibility::Resource *tizen_visibility::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_visibility::Resource *tizen_visibility::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_visibility::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_visibility_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_visibility::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_visibility::interface()
- {
- return &::tizen_visibility_interface;
- }
-
- tizen_visibility::Resource *tizen_visibility::tizen_visibility_allocate()
- {
- return new Resource;
- }
-
- void tizen_visibility::tizen_visibility_bind_resource(Resource *)
- {
- }
-
- void tizen_visibility::tizen_visibility_destroy_resource(Resource *)
- {
- }
-
- void tizen_visibility::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_visibility *that = static_cast<tizen_visibility *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_visibility::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_visibility *that = static_cast<tizen_visibility::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_visibility::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_visibility *that = resource->tizen_visibility_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_visibility_destroy_resource(resource);
- delete resource;
- }
-
- tizen_visibility::Resource *tizen_visibility::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_visibility_interface, version, id);
- return bind(handle);
- }
-
- tizen_visibility::Resource *tizen_visibility::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_visibility_allocate();
- resource->tizen_visibility_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_visibility_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_visibility_bind_resource(resource);
- return resource;
- }
- tizen_visibility::Resource *tizen_visibility::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_visibility_interface, &m_tizen_visibility_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_visibility_interface tizen_visibility::m_tizen_visibility_interface = {
- tizen_visibility::handle_destroy
- };
-
- void tizen_visibility::tizen_visibility_destroy(Resource *)
- {
- }
-
-
- void tizen_visibility::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_visibility *>(r->tizen_visibility_object)->tizen_visibility_destroy(
- r);
- }
-
- void tizen_visibility::send_notify(uint32_t visibility)
- {
- DS_ASSERT_X(m_resource, "tizen_visibility::notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_visibility::notify as it's not initialised");
- return;
- }
- send_notify(
- m_resource->handle,
- visibility);
- }
-
- void tizen_visibility::send_notify(struct ::wl_resource *resource, uint32_t visibility)
- {
- tizen_visibility_send_notify(
- resource,
- visibility);
- }
-
-
- void tizen_visibility::send_changed(uint32_t type, uint32_t option)
- {
- DS_ASSERT_X(m_resource, "tizen_visibility::changed", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_visibility::changed as it's not initialised");
- return;
- }
- send_changed(
- m_resource->handle,
- type,
- option);
- }
-
- void tizen_visibility::send_changed(struct ::wl_resource *resource, uint32_t type, uint32_t option)
- {
- tizen_visibility_send_changed(
- resource,
- type,
- option);
- }
-
-
- tizen_position::tizen_position(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_position::tizen_position(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_position::tizen_position(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_position::tizen_position()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_position::~tizen_position()
- {
- std::multimap<struct ::wl_client*, tizen_position::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_position::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_position::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_position::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_position::Resource *tizen_position::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_position::Resource *tizen_position::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_position::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_position_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_position::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_position::interface()
- {
- return &::tizen_position_interface;
- }
-
- tizen_position::Resource *tizen_position::tizen_position_allocate()
- {
- return new Resource;
- }
-
- void tizen_position::tizen_position_bind_resource(Resource *)
- {
- }
-
- void tizen_position::tizen_position_destroy_resource(Resource *)
- {
- }
-
- void tizen_position::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_position *that = static_cast<tizen_position *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_position::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_position *that = static_cast<tizen_position::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_position::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_position *that = resource->tizen_position_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_position_destroy_resource(resource);
- delete resource;
- }
-
- tizen_position::Resource *tizen_position::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_position_interface, version, id);
- return bind(handle);
- }
-
- tizen_position::Resource *tizen_position::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_position_allocate();
- resource->tizen_position_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_position_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_position_bind_resource(resource);
- return resource;
- }
- tizen_position::Resource *tizen_position::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_position_interface, &m_tizen_position_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_position_interface tizen_position::m_tizen_position_interface = {
- tizen_position::handle_destroy,
- tizen_position::handle_set
- };
-
- void tizen_position::tizen_position_destroy(Resource *)
- {
- }
-
- void tizen_position::tizen_position_set(Resource *, int32_t , int32_t )
- {
- }
-
-
- void tizen_position::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_position *>(r->tizen_position_object)->tizen_position_destroy(
- r);
- }
-
- void tizen_position::handle_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_position *>(r->tizen_position_object)->tizen_position_set(
- r,
- x,
- y);
- }
-
- void tizen_position::send_changed(int32_t x, int32_t y)
- {
- DS_ASSERT_X(m_resource, "tizen_position::changed", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_position::changed as it's not initialised");
- return;
- }
- send_changed(
- m_resource->handle,
- x,
- y);
- }
-
- void tizen_position::send_changed(struct ::wl_resource *resource, int32_t x, int32_t y)
- {
- tizen_position_send_changed(
- resource,
- x,
- y);
- }
-
-
- tizen_move_resize::tizen_move_resize(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_move_resize::tizen_move_resize(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_move_resize::tizen_move_resize(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_move_resize::tizen_move_resize()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_move_resize::~tizen_move_resize()
- {
- std::multimap<struct ::wl_client*, tizen_move_resize::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_move_resize::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_move_resize::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_move_resize::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_move_resize::Resource *tizen_move_resize::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_move_resize::Resource *tizen_move_resize::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_move_resize::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_move_resize_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_move_resize::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_move_resize::interface()
- {
- return &::tizen_move_resize_interface;
- }
-
- tizen_move_resize::Resource *tizen_move_resize::tizen_move_resize_allocate()
- {
- return new Resource;
- }
-
- void tizen_move_resize::tizen_move_resize_bind_resource(Resource *)
- {
- }
-
- void tizen_move_resize::tizen_move_resize_destroy_resource(Resource *)
- {
- }
-
- void tizen_move_resize::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_move_resize *that = static_cast<tizen_move_resize *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_move_resize::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_move_resize *that = static_cast<tizen_move_resize::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_move_resize::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_move_resize *that = resource->tizen_move_resize_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_move_resize_destroy_resource(resource);
- delete resource;
- }
-
- tizen_move_resize::Resource *tizen_move_resize::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_move_resize_interface, version, id);
- return bind(handle);
- }
-
- tizen_move_resize::Resource *tizen_move_resize::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_move_resize_allocate();
- resource->tizen_move_resize_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_move_resize_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_move_resize_bind_resource(resource);
- return resource;
- }
- tizen_move_resize::Resource *tizen_move_resize::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_move_resize_interface, &m_tizen_move_resize_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_move_resize_interface tizen_move_resize::m_tizen_move_resize_interface = {
- tizen_move_resize::handle_destroy,
- tizen_move_resize::handle_set_geometry
- };
-
- void tizen_move_resize::tizen_move_resize_destroy(Resource *)
- {
- }
-
- void tizen_move_resize::tizen_move_resize_set_geometry(Resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t , int32_t , int32_t )
- {
- }
-
-
- void tizen_move_resize::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_move_resize *>(r->tizen_move_resize_object)->tizen_move_resize_destroy(
- r);
- }
-
- void tizen_move_resize::handle_set_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t serial,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_move_resize *>(r->tizen_move_resize_object)->tizen_move_resize_set_geometry(
- r,
- surface,
- serial,
- x,
- y,
- w,
- h);
- }
-
- void tizen_move_resize::send_geometry_done(struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t error_state)
- {
- DS_ASSERT_X(m_resource, "tizen_move_resize::geometry_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_move_resize::geometry_done as it's not initialised");
- return;
- }
- send_geometry_done(
- m_resource->handle,
- surface,
- serial,
- x,
- y,
- w,
- h,
- error_state);
- }
-
- void tizen_move_resize::send_geometry_done(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t error_state)
- {
- tizen_move_resize_send_geometry_done(
- resource,
- surface,
- serial,
- x,
- y,
- w,
- h,
- error_state);
- }
-
-
- tizen_gesture::tizen_gesture(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_gesture::tizen_gesture(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_gesture::tizen_gesture(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_gesture::tizen_gesture()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_gesture::~tizen_gesture()
- {
- std::multimap<struct ::wl_client*, tizen_gesture::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_gesture::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_gesture::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_gesture::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_gesture::Resource *tizen_gesture::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_gesture::Resource *tizen_gesture::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_gesture::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_gesture_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_gesture::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_gesture::interface()
- {
- return &::tizen_gesture_interface;
- }
-
- tizen_gesture::Resource *tizen_gesture::tizen_gesture_allocate()
- {
- return new Resource;
- }
-
- void tizen_gesture::tizen_gesture_bind_resource(Resource *)
- {
- }
-
- void tizen_gesture::tizen_gesture_destroy_resource(Resource *)
- {
- }
-
- void tizen_gesture::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_gesture *that = static_cast<tizen_gesture *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_gesture::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_gesture *that = static_cast<tizen_gesture::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_gesture::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_gesture *that = resource->tizen_gesture_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_gesture_destroy_resource(resource);
- delete resource;
- }
-
- tizen_gesture::Resource *tizen_gesture::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_gesture_interface, version, id);
- return bind(handle);
- }
-
- tizen_gesture::Resource *tizen_gesture::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_gesture_allocate();
- resource->tizen_gesture_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_gesture_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_gesture_bind_resource(resource);
- return resource;
- }
- tizen_gesture::Resource *tizen_gesture::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_gesture_interface, &m_tizen_gesture_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_gesture_interface tizen_gesture::m_tizen_gesture_interface = {
- tizen_gesture::handle_grab_edge_swipe,
- tizen_gesture::handle_ungrab_edge_swipe,
- tizen_gesture::handle_grab_edge_drag,
- tizen_gesture::handle_ungrab_edge_drag,
- tizen_gesture::handle_grab_tap,
- tizen_gesture::handle_ungrab_tap,
- tizen_gesture::handle_grab_palm_cover,
- tizen_gesture::handle_ungrab_palm_cover,
- tizen_gesture::handle_select_palm_cover,
- tizen_gesture::handle_deselect_palm_cover,
- tizen_gesture::handle_activate_set,
- tizen_gesture::handle_destroy
- };
-
- void tizen_gesture::tizen_gesture_grab_edge_swipe(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_gesture::tizen_gesture_ungrab_edge_swipe(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_gesture::tizen_gesture_grab_edge_drag(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_gesture::tizen_gesture_ungrab_edge_drag(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_gesture::tizen_gesture_grab_tap(Resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_gesture::tizen_gesture_ungrab_tap(Resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_gesture::tizen_gesture_grab_palm_cover(Resource *)
- {
- }
-
- void tizen_gesture::tizen_gesture_ungrab_palm_cover(Resource *)
- {
- }
-
- void tizen_gesture::tizen_gesture_select_palm_cover(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_gesture::tizen_gesture_deselect_palm_cover(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_gesture::tizen_gesture_activate_set(Resource *, struct ::wl_resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_gesture::tizen_gesture_destroy(Resource *)
- {
- }
-
-
- void tizen_gesture::handle_grab_edge_swipe(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t edge,
- uint32_t edge_size,
- uint32_t start_point,
- uint32_t end_point)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_grab_edge_swipe(
- r,
- fingers,
- edge,
- edge_size,
- start_point,
- end_point);
- }
-
- void tizen_gesture::handle_ungrab_edge_swipe(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t edge,
- uint32_t edge_size,
- uint32_t start_point,
- uint32_t end_point)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_ungrab_edge_swipe(
- r,
- fingers,
- edge,
- edge_size,
- start_point,
- end_point);
- }
-
- void tizen_gesture::handle_grab_edge_drag(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t edge,
- uint32_t edge_size,
- uint32_t start_point,
- uint32_t end_point)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_grab_edge_drag(
- r,
- fingers,
- edge,
- edge_size,
- start_point,
- end_point);
- }
-
- void tizen_gesture::handle_ungrab_edge_drag(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t edge,
- uint32_t edge_size,
- uint32_t start_point,
- uint32_t end_point)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_ungrab_edge_drag(
- r,
- fingers,
- edge,
- edge_size,
- start_point,
- end_point);
- }
-
- void tizen_gesture::handle_grab_tap(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t repeats)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_grab_tap(
- r,
- fingers,
- repeats);
- }
-
- void tizen_gesture::handle_ungrab_tap(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t repeats)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_ungrab_tap(
- r,
- fingers,
- repeats);
- }
-
- void tizen_gesture::handle_grab_palm_cover(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_grab_palm_cover(
- r);
- }
-
- void tizen_gesture::handle_ungrab_palm_cover(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_ungrab_palm_cover(
- r);
- }
-
- void tizen_gesture::handle_select_palm_cover(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_select_palm_cover(
- r,
- surface);
- }
-
- void tizen_gesture::handle_deselect_palm_cover(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_deselect_palm_cover(
- r,
- surface);
- }
-
- void tizen_gesture::handle_activate_set(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t type,
- uint32_t active)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_activate_set(
- r,
- surface,
- type,
- active);
- }
-
- void tizen_gesture::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_gesture *>(r->tizen_gesture_object)->tizen_gesture_destroy(
- r);
- }
-
- void tizen_gesture::send_grab_edge_swipe_notify(uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::grab_edge_swipe_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::grab_edge_swipe_notify as it's not initialised");
- return;
- }
- send_grab_edge_swipe_notify(
- m_resource->handle,
- fingers,
- edge,
- edge_size,
- start_point,
- end_point,
- error);
- }
-
- void tizen_gesture::send_grab_edge_swipe_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error)
- {
- tizen_gesture_send_grab_edge_swipe_notify(
- resource,
- fingers,
- edge,
- edge_size,
- start_point,
- end_point,
- error);
- }
-
-
- void tizen_gesture::send_edge_swipe(uint32_t mode, uint32_t fingers, int32_t sx, int32_t sy, uint32_t edge)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::edge_swipe", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::edge_swipe as it's not initialised");
- return;
- }
- send_edge_swipe(
- m_resource->handle,
- mode,
- fingers,
- sx,
- sy,
- edge);
- }
-
- void tizen_gesture::send_edge_swipe(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, int32_t sx, int32_t sy, uint32_t edge)
- {
- tizen_gesture_send_edge_swipe(
- resource,
- mode,
- fingers,
- sx,
- sy,
- edge);
- }
-
-
- void tizen_gesture::send_edge_drag_notify(uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::edge_drag_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::edge_drag_notify as it's not initialised");
- return;
- }
- send_edge_drag_notify(
- m_resource->handle,
- fingers,
- edge,
- edge_size,
- start_point,
- end_point,
- error);
- }
-
- void tizen_gesture::send_edge_drag_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error)
- {
- tizen_gesture_send_edge_drag_notify(
- resource,
- fingers,
- edge,
- edge_size,
- start_point,
- end_point,
- error);
- }
-
-
- void tizen_gesture::send_edge_drag(uint32_t mode, uint32_t fingers, int32_t cx, int32_t cy, uint32_t edge)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::edge_drag", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::edge_drag as it's not initialised");
- return;
- }
- send_edge_drag(
- m_resource->handle,
- mode,
- fingers,
- cx,
- cy,
- edge);
- }
-
- void tizen_gesture::send_edge_drag(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, int32_t cx, int32_t cy, uint32_t edge)
- {
- tizen_gesture_send_edge_drag(
- resource,
- mode,
- fingers,
- cx,
- cy,
- edge);
- }
-
-
- void tizen_gesture::send_tap_notify(uint32_t fingers, uint32_t repeats, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::tap_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::tap_notify as it's not initialised");
- return;
- }
- send_tap_notify(
- m_resource->handle,
- fingers,
- repeats,
- error);
- }
-
- void tizen_gesture::send_tap_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t repeats, uint32_t error)
- {
- tizen_gesture_send_tap_notify(
- resource,
- fingers,
- repeats,
- error);
- }
-
-
- void tizen_gesture::send_tap(uint32_t mode, uint32_t fingers, uint32_t repeats)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::tap", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::tap as it's not initialised");
- return;
- }
- send_tap(
- m_resource->handle,
- mode,
- fingers,
- repeats);
- }
-
- void tizen_gesture::send_tap(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, uint32_t repeats)
- {
- tizen_gesture_send_tap(
- resource,
- mode,
- fingers,
- repeats);
- }
-
-
- void tizen_gesture::send_palm_cover_notify(struct ::wl_resource *surface, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::palm_cover_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::palm_cover_notify as it's not initialised");
- return;
- }
- send_palm_cover_notify(
- m_resource->handle,
- surface,
- error);
- }
-
- void tizen_gesture::send_palm_cover_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t error)
- {
- tizen_gesture_send_palm_cover_notify(
- resource,
- surface,
- error);
- }
-
-
- void tizen_gesture::send_palm_cover(struct ::wl_resource *surface, uint32_t mode, uint32_t duration, int32_t cx, int32_t cy, uint32_t size, wl_fixed_t pressure)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::palm_cover", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::palm_cover as it's not initialised");
- return;
- }
- send_palm_cover(
- m_resource->handle,
- surface,
- mode,
- duration,
- cx,
- cy,
- size,
- pressure);
- }
-
- void tizen_gesture::send_palm_cover(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode, uint32_t duration, int32_t cx, int32_t cy, uint32_t size, wl_fixed_t pressure)
- {
- tizen_gesture_send_palm_cover(
- resource,
- surface,
- mode,
- duration,
- cx,
- cy,
- size,
- pressure);
- }
-
-
- void tizen_gesture::send_activate_notify(struct ::wl_resource *surface, uint32_t type, uint32_t active, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "tizen_gesture::activate_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_gesture::activate_notify as it's not initialised");
- return;
- }
- send_activate_notify(
- m_resource->handle,
- surface,
- type,
- active,
- error);
- }
-
- void tizen_gesture::send_activate_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type, uint32_t active, uint32_t error)
- {
- tizen_gesture_send_activate_notify(
- resource,
- surface,
- type,
- active,
- error);
- }
-
-
- tizen_keyrouter::tizen_keyrouter(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_keyrouter::tizen_keyrouter(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_keyrouter::tizen_keyrouter(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_keyrouter::tizen_keyrouter()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_keyrouter::~tizen_keyrouter()
- {
- std::multimap<struct ::wl_client*, tizen_keyrouter::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_keyrouter::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_keyrouter::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_keyrouter::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_keyrouter::Resource *tizen_keyrouter::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_keyrouter::Resource *tizen_keyrouter::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_keyrouter::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_keyrouter_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_keyrouter::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_keyrouter::interface()
- {
- return &::tizen_keyrouter_interface;
- }
-
- tizen_keyrouter::Resource *tizen_keyrouter::tizen_keyrouter_allocate()
- {
- return new Resource;
- }
-
- void tizen_keyrouter::tizen_keyrouter_bind_resource(Resource *)
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_destroy_resource(Resource *)
- {
- }
-
- void tizen_keyrouter::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_keyrouter *that = static_cast<tizen_keyrouter *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_keyrouter::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_keyrouter *that = static_cast<tizen_keyrouter::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_keyrouter::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_keyrouter *that = resource->tizen_keyrouter_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_keyrouter_destroy_resource(resource);
- delete resource;
- }
-
- tizen_keyrouter::Resource *tizen_keyrouter::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_keyrouter_interface, version, id);
- return bind(handle);
- }
-
- tizen_keyrouter::Resource *tizen_keyrouter::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_keyrouter_allocate();
- resource->tizen_keyrouter_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_keyrouter_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_keyrouter_bind_resource(resource);
- return resource;
- }
- tizen_keyrouter::Resource *tizen_keyrouter::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_keyrouter_interface, &m_tizen_keyrouter_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_keyrouter_interface tizen_keyrouter::m_tizen_keyrouter_interface = {
- tizen_keyrouter::handle_set_keygrab,
- tizen_keyrouter::handle_unset_keygrab,
- tizen_keyrouter::handle_get_keygrab_status,
- tizen_keyrouter::handle_set_keygrab_list,
- tizen_keyrouter::handle_unset_keygrab_list,
- tizen_keyrouter::handle_get_keygrab_list,
- tizen_keyrouter::handle_set_register_none_key,
- tizen_keyrouter::handle_get_keyregister_status,
- tizen_keyrouter::handle_set_input_config,
- tizen_keyrouter::handle_destroy
- };
-
- void tizen_keyrouter::tizen_keyrouter_set_keygrab(Resource *, struct ::wl_resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_unset_keygrab(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_get_keygrab_status(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_set_keygrab_list(Resource *, struct ::wl_resource *, struct ::wl_array *)
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_unset_keygrab_list(Resource *, struct ::wl_resource *, struct ::wl_array *)
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_get_keygrab_list(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_set_register_none_key(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_get_keyregister_status(Resource *, uint32_t )
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_set_input_config(Resource *, struct ::wl_resource *, uint32_t , uint32_t )
- {
- }
-
- void tizen_keyrouter::tizen_keyrouter_destroy(Resource *)
- {
- }
-
-
- void tizen_keyrouter::handle_set_keygrab(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t key,
- uint32_t mode)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_set_keygrab(
- r,
- surface,
- key,
- mode);
- }
-
- void tizen_keyrouter::handle_unset_keygrab(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t key)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_unset_keygrab(
- r,
- surface,
- key);
- }
-
- void tizen_keyrouter::handle_get_keygrab_status(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t key)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_get_keygrab_status(
- r,
- surface,
- key);
- }
-
- void tizen_keyrouter::handle_set_keygrab_list(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- struct ::wl_array *grab_list)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_set_keygrab_list(
- r,
- surface,
- grab_list);
- }
-
- void tizen_keyrouter::handle_unset_keygrab_list(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- struct ::wl_array *ungrab_list)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_unset_keygrab_list(
- r,
- surface,
- ungrab_list);
- }
-
- void tizen_keyrouter::handle_get_keygrab_list(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_get_keygrab_list(
- r,
- surface);
- }
-
- void tizen_keyrouter::handle_set_register_none_key(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t data)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_set_register_none_key(
- r,
- surface,
- data);
- }
-
- void tizen_keyrouter::handle_get_keyregister_status(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t data)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_get_keyregister_status(
- r,
- data);
- }
-
- void tizen_keyrouter::handle_set_input_config(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t config_mode,
- uint32_t value)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_set_input_config(
- r,
- surface,
- config_mode,
- value);
- }
-
- void tizen_keyrouter::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_keyrouter *>(r->tizen_keyrouter_object)->tizen_keyrouter_destroy(
- r);
- }
-
- void tizen_keyrouter::send_keygrab_notify(struct ::wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error)
- {
- DS_ASSERT_X(m_resource, "tizen_keyrouter::keygrab_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_keyrouter::keygrab_notify as it's not initialised");
- return;
- }
- send_keygrab_notify(
- m_resource->handle,
- surface,
- key,
- mode,
- error);
- }
-
- void tizen_keyrouter::send_keygrab_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error)
- {
- tizen_keyrouter_send_keygrab_notify(
- resource,
- surface,
- key,
- mode,
- error);
- }
-
-
- void tizen_keyrouter::send_keygrab_notify_list(struct ::wl_resource *surface, struct ::wl_array *grab_result)
- {
- DS_ASSERT_X(m_resource, "tizen_keyrouter::keygrab_notify_list", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_keyrouter::keygrab_notify_list as it's not initialised");
- return;
- }
- send_keygrab_notify_list(
- m_resource->handle,
- surface,
- grab_result);
- }
-
- void tizen_keyrouter::send_keygrab_notify_list(struct ::wl_resource *resource, struct ::wl_resource *surface, struct ::wl_array *grab_result)
- {
- tizen_keyrouter_send_keygrab_notify_list(
- resource,
- surface,
- grab_result);
- }
-
-
- void tizen_keyrouter::send_getgrab_notify_list(struct ::wl_resource *surface, struct ::wl_array *grab_result)
- {
- DS_ASSERT_X(m_resource, "tizen_keyrouter::getgrab_notify_list", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_keyrouter::getgrab_notify_list as it's not initialised");
- return;
- }
- send_getgrab_notify_list(
- m_resource->handle,
- surface,
- grab_result);
- }
-
- void tizen_keyrouter::send_getgrab_notify_list(struct ::wl_resource *resource, struct ::wl_resource *surface, struct ::wl_array *grab_result)
- {
- tizen_keyrouter_send_getgrab_notify_list(
- resource,
- surface,
- grab_result);
- }
-
-
- void tizen_keyrouter::send_set_register_none_key_notify(struct ::wl_resource *surface, uint32_t mode)
- {
- DS_ASSERT_X(m_resource, "tizen_keyrouter::set_register_none_key_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_keyrouter::set_register_none_key_notify as it's not initialised");
- return;
- }
- send_set_register_none_key_notify(
- m_resource->handle,
- surface,
- mode);
- }
-
- void tizen_keyrouter::send_set_register_none_key_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode)
- {
- tizen_keyrouter_send_set_register_none_key_notify(
- resource,
- surface,
- mode);
- }
-
-
- void tizen_keyrouter::send_keyregister_notify(uint32_t status)
- {
- DS_ASSERT_X(m_resource, "tizen_keyrouter::keyregister_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_keyrouter::keyregister_notify as it's not initialised");
- return;
- }
- send_keyregister_notify(
- m_resource->handle,
- status);
- }
-
- void tizen_keyrouter::send_keyregister_notify(struct ::wl_resource *resource, uint32_t status)
- {
- tizen_keyrouter_send_keyregister_notify(
- resource,
- status);
- }
-
-
- void tizen_keyrouter::send_set_input_config_notify(uint32_t status)
- {
- DS_ASSERT_X(m_resource, "tizen_keyrouter::set_input_config_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_keyrouter::set_input_config_notify as it's not initialised");
- return;
- }
- send_set_input_config_notify(
- m_resource->handle,
- status);
- }
-
- void tizen_keyrouter::send_set_input_config_notify(struct ::wl_resource *resource, uint32_t status)
- {
- tizen_keyrouter_send_set_input_config_notify(
- resource,
- status);
- }
-
-
- void tizen_keyrouter::send_key_cancel(uint32_t key)
- {
- DS_ASSERT_X(m_resource, "tizen_keyrouter::key_cancel", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_keyrouter::key_cancel as it's not initialised");
- return;
- }
- send_key_cancel(
- m_resource->handle,
- key);
- }
-
- void tizen_keyrouter::send_key_cancel(struct ::wl_resource *resource, uint32_t key)
- {
- tizen_keyrouter_send_key_cancel(
- resource,
- key);
- }
-
-
- void tizen_keyrouter::send_event_surface(struct ::wl_resource *surface, uint32_t key, uint32_t mode)
- {
- DS_ASSERT_X(m_resource, "tizen_keyrouter::event_surface", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_keyrouter::event_surface as it's not initialised");
- return;
- }
- send_event_surface(
- m_resource->handle,
- surface,
- key,
- mode);
- }
-
- void tizen_keyrouter::send_event_surface(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode)
- {
- tizen_keyrouter_send_event_surface(
- resource,
- surface,
- key,
- mode);
- }
-
-
- tizen_screenshooter::tizen_screenshooter(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_screenshooter::tizen_screenshooter(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_screenshooter::tizen_screenshooter(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_screenshooter::tizen_screenshooter()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_screenshooter::~tizen_screenshooter()
- {
- std::multimap<struct ::wl_client*, tizen_screenshooter::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_screenshooter::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_screenshooter::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_screenshooter::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_screenshooter::Resource *tizen_screenshooter::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_screenshooter::Resource *tizen_screenshooter::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_screenshooter::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_screenshooter_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_screenshooter::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_screenshooter::interface()
- {
- return &::tizen_screenshooter_interface;
- }
-
- tizen_screenshooter::Resource *tizen_screenshooter::tizen_screenshooter_allocate()
- {
- return new Resource;
- }
-
- void tizen_screenshooter::tizen_screenshooter_bind_resource(Resource *)
- {
- }
-
- void tizen_screenshooter::tizen_screenshooter_destroy_resource(Resource *)
- {
- }
-
- void tizen_screenshooter::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_screenshooter *that = static_cast<tizen_screenshooter *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_screenshooter::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_screenshooter *that = static_cast<tizen_screenshooter::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_screenshooter::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_screenshooter *that = resource->tizen_screenshooter_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_screenshooter_destroy_resource(resource);
- delete resource;
- }
-
- tizen_screenshooter::Resource *tizen_screenshooter::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_screenshooter_interface, version, id);
- return bind(handle);
- }
-
- tizen_screenshooter::Resource *tizen_screenshooter::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_screenshooter_allocate();
- resource->tizen_screenshooter_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_screenshooter_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_screenshooter_bind_resource(resource);
- return resource;
- }
- tizen_screenshooter::Resource *tizen_screenshooter::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_screenshooter_interface, &m_tizen_screenshooter_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_screenshooter_interface tizen_screenshooter::m_tizen_screenshooter_interface = {
- tizen_screenshooter::handle_get_screenmirror,
- tizen_screenshooter::handle_set_oneshot_auto_rotation,
- tizen_screenshooter::handle_destroy
- };
-
- void tizen_screenshooter::tizen_screenshooter_get_screenmirror(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_screenshooter::tizen_screenshooter_set_oneshot_auto_rotation(Resource *, uint32_t )
- {
- }
-
- void tizen_screenshooter::tizen_screenshooter_destroy(Resource *)
- {
- }
-
-
- void tizen_screenshooter::handle_get_screenmirror(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *output)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenshooter *>(r->tizen_screenshooter_object)->tizen_screenshooter_get_screenmirror(
- r,
- id,
- output);
- }
-
- void tizen_screenshooter::handle_set_oneshot_auto_rotation(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenshooter *>(r->tizen_screenshooter_object)->tizen_screenshooter_set_oneshot_auto_rotation(
- r,
- set);
- }
-
- void tizen_screenshooter::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenshooter *>(r->tizen_screenshooter_object)->tizen_screenshooter_destroy(
- r);
- }
-
- void tizen_screenshooter::send_format(uint32_t format)
- {
- DS_ASSERT_X(m_resource, "tizen_screenshooter::format", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_screenshooter::format as it's not initialised");
- return;
- }
- send_format(
- m_resource->handle,
- format);
- }
-
- void tizen_screenshooter::send_format(struct ::wl_resource *resource, uint32_t format)
- {
- tizen_screenshooter_send_format(
- resource,
- format);
- }
-
-
- void tizen_screenshooter::send_screenshooter_notify(uint32_t noti)
- {
- DS_ASSERT_X(m_resource, "tizen_screenshooter::screenshooter_notify", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_screenshooter::screenshooter_notify as it's not initialised");
- return;
- }
- send_screenshooter_notify(
- m_resource->handle,
- noti);
- }
-
- void tizen_screenshooter::send_screenshooter_notify(struct ::wl_resource *resource, uint32_t noti)
- {
- tizen_screenshooter_send_screenshooter_notify(
- resource,
- noti);
- }
-
-
- tizen_screenmirror::tizen_screenmirror(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_screenmirror::tizen_screenmirror(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_screenmirror::tizen_screenmirror(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_screenmirror::tizen_screenmirror()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_screenmirror::~tizen_screenmirror()
- {
- std::multimap<struct ::wl_client*, tizen_screenmirror::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_screenmirror::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_screenmirror::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_screenmirror::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_screenmirror::Resource *tizen_screenmirror::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_screenmirror::Resource *tizen_screenmirror::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_screenmirror::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_screenmirror_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_screenmirror::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_screenmirror::interface()
- {
- return &::tizen_screenmirror_interface;
- }
-
- tizen_screenmirror::Resource *tizen_screenmirror::tizen_screenmirror_allocate()
- {
- return new Resource;
- }
-
- void tizen_screenmirror::tizen_screenmirror_bind_resource(Resource *)
- {
- }
-
- void tizen_screenmirror::tizen_screenmirror_destroy_resource(Resource *)
- {
- }
-
- void tizen_screenmirror::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_screenmirror *that = static_cast<tizen_screenmirror *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_screenmirror::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_screenmirror *that = static_cast<tizen_screenmirror::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_screenmirror::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_screenmirror *that = resource->tizen_screenmirror_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_screenmirror_destroy_resource(resource);
- delete resource;
- }
-
- tizen_screenmirror::Resource *tizen_screenmirror::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_screenmirror_interface, version, id);
- return bind(handle);
- }
-
- tizen_screenmirror::Resource *tizen_screenmirror::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_screenmirror_allocate();
- resource->tizen_screenmirror_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_screenmirror_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_screenmirror_bind_resource(resource);
- return resource;
- }
- tizen_screenmirror::Resource *tizen_screenmirror::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_screenmirror_interface, &m_tizen_screenmirror_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_screenmirror_interface tizen_screenmirror::m_tizen_screenmirror_interface = {
- tizen_screenmirror::handle_destroy,
- tizen_screenmirror::handle_set_stretch,
- tizen_screenmirror::handle_queue,
- tizen_screenmirror::handle_dequeue,
- tizen_screenmirror::handle_start,
- tizen_screenmirror::handle_stop,
- tizen_screenmirror::handle_set_auto_rotation
- };
-
- void tizen_screenmirror::tizen_screenmirror_destroy(Resource *)
- {
- }
-
- void tizen_screenmirror::tizen_screenmirror_set_stretch(Resource *, uint32_t )
- {
- }
-
- void tizen_screenmirror::tizen_screenmirror_queue(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_screenmirror::tizen_screenmirror_dequeue(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_screenmirror::tizen_screenmirror_start(Resource *)
- {
- }
-
- void tizen_screenmirror::tizen_screenmirror_stop(Resource *)
- {
- }
-
- void tizen_screenmirror::tizen_screenmirror_set_auto_rotation(Resource *, uint32_t )
- {
- }
-
-
- void tizen_screenmirror::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenmirror *>(r->tizen_screenmirror_object)->tizen_screenmirror_destroy(
- r);
- }
-
- void tizen_screenmirror::handle_set_stretch(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t stretch)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenmirror *>(r->tizen_screenmirror_object)->tizen_screenmirror_set_stretch(
- r,
- stretch);
- }
-
- void tizen_screenmirror::handle_queue(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *buffer)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenmirror *>(r->tizen_screenmirror_object)->tizen_screenmirror_queue(
- r,
- buffer);
- }
-
- void tizen_screenmirror::handle_dequeue(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *buffer)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenmirror *>(r->tizen_screenmirror_object)->tizen_screenmirror_dequeue(
- r,
- buffer);
- }
-
- void tizen_screenmirror::handle_start(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenmirror *>(r->tizen_screenmirror_object)->tizen_screenmirror_start(
- r);
- }
-
- void tizen_screenmirror::handle_stop(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenmirror *>(r->tizen_screenmirror_object)->tizen_screenmirror_stop(
- r);
- }
-
- void tizen_screenmirror::handle_set_auto_rotation(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screenmirror *>(r->tizen_screenmirror_object)->tizen_screenmirror_set_auto_rotation(
- r,
- set);
- }
-
- void tizen_screenmirror::send_dequeued(struct ::wl_resource *buffer)
- {
- DS_ASSERT_X(m_resource, "tizen_screenmirror::dequeued", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_screenmirror::dequeued as it's not initialised");
- return;
- }
- send_dequeued(
- m_resource->handle,
- buffer);
- }
-
- void tizen_screenmirror::send_dequeued(struct ::wl_resource *resource, struct ::wl_resource *buffer)
- {
- tizen_screenmirror_send_dequeued(
- resource,
- buffer);
- }
-
-
- void tizen_screenmirror::send_content(uint32_t content)
- {
- DS_ASSERT_X(m_resource, "tizen_screenmirror::content", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_screenmirror::content as it's not initialised");
- return;
- }
- send_content(
- m_resource->handle,
- content);
- }
-
- void tizen_screenmirror::send_content(struct ::wl_resource *resource, uint32_t content)
- {
- tizen_screenmirror_send_content(
- resource,
- content);
- }
-
-
- void tizen_screenmirror::send_stop()
- {
- DS_ASSERT_X(m_resource, "tizen_screenmirror::stop", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_screenmirror::stop as it's not initialised");
- return;
- }
- send_stop(
- m_resource->handle);
- }
-
- void tizen_screenmirror::send_stop(struct ::wl_resource *resource)
- {
- tizen_screenmirror_send_stop(
- resource);
- }
-
-
- tizen_video::tizen_video(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_video::tizen_video(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_video::tizen_video(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_video::tizen_video()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_video::~tizen_video()
- {
- std::multimap<struct ::wl_client*, tizen_video::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_video::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_video::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_video::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_video::Resource *tizen_video::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_video::Resource *tizen_video::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_video::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_video_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_video::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_video::interface()
- {
- return &::tizen_video_interface;
- }
-
- tizen_video::Resource *tizen_video::tizen_video_allocate()
- {
- return new Resource;
- }
-
- void tizen_video::tizen_video_bind_resource(Resource *)
- {
- }
-
- void tizen_video::tizen_video_destroy_resource(Resource *)
- {
- }
-
- void tizen_video::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_video *that = static_cast<tizen_video *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_video::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_video *that = static_cast<tizen_video::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_video::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_video *that = resource->tizen_video_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_video_destroy_resource(resource);
- delete resource;
- }
-
- tizen_video::Resource *tizen_video::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_video_interface, version, id);
- return bind(handle);
- }
-
- tizen_video::Resource *tizen_video::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_video_allocate();
- resource->tizen_video_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_video_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_video_bind_resource(resource);
- return resource;
- }
- tizen_video::Resource *tizen_video::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_video_interface, &m_tizen_video_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_video_interface tizen_video::m_tizen_video_interface = {
- tizen_video::handle_get_object,
- tizen_video::handle_get_viewport,
- tizen_video::handle_destroy
- };
-
- void tizen_video::tizen_video_get_object(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_video::tizen_video_get_viewport(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_video::tizen_video_destroy(Resource *)
- {
- }
-
-
- void tizen_video::handle_get_object(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video *>(r->tizen_video_object)->tizen_video_get_object(
- r,
- id,
- surface);
- }
-
- void tizen_video::handle_get_viewport(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video *>(r->tizen_video_object)->tizen_video_get_viewport(
- r,
- id,
- surface);
- }
-
- void tizen_video::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video *>(r->tizen_video_object)->tizen_video_destroy(
- r);
- }
-
- void tizen_video::send_format(uint32_t format)
- {
- DS_ASSERT_X(m_resource, "tizen_video::format", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_video::format as it's not initialised");
- return;
- }
- send_format(
- m_resource->handle,
- format);
- }
-
- void tizen_video::send_format(struct ::wl_resource *resource, uint32_t format)
- {
- tizen_video_send_format(
- resource,
- format);
- }
-
-
- tizen_video_object::tizen_video_object(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_video_object::tizen_video_object(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_video_object::tizen_video_object(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_video_object::tizen_video_object()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_video_object::~tizen_video_object()
- {
- std::multimap<struct ::wl_client*, tizen_video_object::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_video_object::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_video_object::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_video_object::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_video_object::Resource *tizen_video_object::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_video_object::Resource *tizen_video_object::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_video_object::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_video_object_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_video_object::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_video_object::interface()
- {
- return &::tizen_video_object_interface;
- }
-
- tizen_video_object::Resource *tizen_video_object::tizen_video_object_allocate()
- {
- return new Resource;
- }
-
- void tizen_video_object::tizen_video_object_bind_resource(Resource *)
- {
- }
-
- void tizen_video_object::tizen_video_object_destroy_resource(Resource *)
- {
- }
-
- void tizen_video_object::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_video_object *that = static_cast<tizen_video_object *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_video_object::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_video_object *that = static_cast<tizen_video_object::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_video_object::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_video_object *that = resource->tizen_video_object_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_video_object_destroy_resource(resource);
- delete resource;
- }
-
- tizen_video_object::Resource *tizen_video_object::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_video_object_interface, version, id);
- return bind(handle);
- }
-
- tizen_video_object::Resource *tizen_video_object::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_video_object_allocate();
- resource->tizen_video_object_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_video_object_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_video_object_bind_resource(resource);
- return resource;
- }
- tizen_video_object::Resource *tizen_video_object::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_video_object_interface, &m_tizen_video_object_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_video_object_interface tizen_video_object::m_tizen_video_object_interface = {
- tizen_video_object::handle_destroy,
- tizen_video_object::handle_set_attribute,
- tizen_video_object::handle_follow_topmost_visibility,
- tizen_video_object::handle_unfollow_topmost_visibility,
- tizen_video_object::handle_allowed_attribute,
- tizen_video_object::handle_disallowed_attribute
- };
-
- void tizen_video_object::tizen_video_object_destroy(Resource *)
- {
- }
-
- void tizen_video_object::tizen_video_object_set_attribute(Resource *, const std::string &, int32_t )
- {
- }
-
- void tizen_video_object::tizen_video_object_follow_topmost_visibility(Resource *)
- {
- }
-
- void tizen_video_object::tizen_video_object_unfollow_topmost_visibility(Resource *)
- {
- }
-
- void tizen_video_object::tizen_video_object_allowed_attribute(Resource *)
- {
- }
-
- void tizen_video_object::tizen_video_object_disallowed_attribute(Resource *)
- {
- }
-
-
- void tizen_video_object::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_object *>(r->tizen_video_object_object)->tizen_video_object_destroy(
- r);
- }
-
- void tizen_video_object::handle_set_attribute(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *name,
- int32_t value)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_object *>(r->tizen_video_object_object)->tizen_video_object_set_attribute(
- r,
- std::string(name),
- value);
- }
-
- void tizen_video_object::handle_follow_topmost_visibility(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_object *>(r->tizen_video_object_object)->tizen_video_object_follow_topmost_visibility(
- r);
- }
-
- void tizen_video_object::handle_unfollow_topmost_visibility(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_object *>(r->tizen_video_object_object)->tizen_video_object_unfollow_topmost_visibility(
- r);
- }
-
- void tizen_video_object::handle_allowed_attribute(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_object *>(r->tizen_video_object_object)->tizen_video_object_allowed_attribute(
- r);
- }
-
- void tizen_video_object::handle_disallowed_attribute(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_object *>(r->tizen_video_object_object)->tizen_video_object_disallowed_attribute(
- r);
- }
-
- void tizen_video_object::send_attribute(const std::string &name, uint32_t value)
- {
- DS_ASSERT_X(m_resource, "tizen_video_object::attribute", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_video_object::attribute as it's not initialised");
- return;
- }
- send_attribute(
- m_resource->handle,
- name,
- value);
- }
-
- void tizen_video_object::send_attribute(struct ::wl_resource *resource, const std::string &name, uint32_t value)
- {
- tizen_video_object_send_attribute(
- resource,
- name.c_str(),
- value);
- }
-
-
- void tizen_video_object::send_size(int32_t min_w, int32_t min_h, int32_t max_w, int32_t max_h, int32_t prefer_align)
- {
- DS_ASSERT_X(m_resource, "tizen_video_object::size", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_video_object::size as it's not initialised");
- return;
- }
- send_size(
- m_resource->handle,
- min_w,
- min_h,
- max_w,
- max_h,
- prefer_align);
- }
-
- void tizen_video_object::send_size(struct ::wl_resource *resource, int32_t min_w, int32_t min_h, int32_t max_w, int32_t max_h, int32_t prefer_align)
- {
- tizen_video_object_send_size(
- resource,
- min_w,
- min_h,
- max_w,
- max_h,
- prefer_align);
- }
-
-
- tizen_subsurface_watcher::tizen_subsurface_watcher(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_subsurface_watcher::tizen_subsurface_watcher(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_subsurface_watcher::tizen_subsurface_watcher(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_subsurface_watcher::tizen_subsurface_watcher()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_subsurface_watcher::~tizen_subsurface_watcher()
- {
- std::multimap<struct ::wl_client*, tizen_subsurface_watcher::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_subsurface_watcher::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_subsurface_watcher::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_subsurface_watcher::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_subsurface_watcher::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_subsurface_watcher_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_subsurface_watcher::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_subsurface_watcher::interface()
- {
- return &::tizen_subsurface_watcher_interface;
- }
-
- tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::tizen_subsurface_watcher_allocate()
- {
- return new Resource;
- }
-
- void tizen_subsurface_watcher::tizen_subsurface_watcher_bind_resource(Resource *)
- {
- }
-
- void tizen_subsurface_watcher::tizen_subsurface_watcher_destroy_resource(Resource *)
- {
- }
-
- void tizen_subsurface_watcher::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_subsurface_watcher *that = static_cast<tizen_subsurface_watcher *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_subsurface_watcher::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_subsurface_watcher *that = static_cast<tizen_subsurface_watcher::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_subsurface_watcher::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_subsurface_watcher *that = resource->tizen_subsurface_watcher_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_subsurface_watcher_destroy_resource(resource);
- delete resource;
- }
-
- tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_subsurface_watcher_interface, version, id);
- return bind(handle);
- }
-
- tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_subsurface_watcher_allocate();
- resource->tizen_subsurface_watcher_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_subsurface_watcher_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_subsurface_watcher_bind_resource(resource);
- return resource;
- }
- tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_subsurface_watcher_interface, &m_tizen_subsurface_watcher_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_subsurface_watcher_interface tizen_subsurface_watcher::m_tizen_subsurface_watcher_interface = {
- tizen_subsurface_watcher::handle_destroy
- };
-
- void tizen_subsurface_watcher::tizen_subsurface_watcher_destroy(Resource *)
- {
- }
-
-
- void tizen_subsurface_watcher::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_subsurface_watcher *>(r->tizen_subsurface_watcher_object)->tizen_subsurface_watcher_destroy(
- r);
- }
-
- void tizen_subsurface_watcher::send_message(uint32_t value)
- {
- DS_ASSERT_X(m_resource, "tizen_subsurface_watcher::message", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_subsurface_watcher::message as it's not initialised");
- return;
- }
- send_message(
- m_resource->handle,
- value);
- }
-
- void tizen_subsurface_watcher::send_message(struct ::wl_resource *resource, uint32_t value)
- {
- tizen_subsurface_watcher_send_message(
- resource,
- value);
- }
-
-
- tizen_viewport::tizen_viewport(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_viewport::tizen_viewport(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_viewport::tizen_viewport(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_viewport::tizen_viewport()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_viewport::~tizen_viewport()
- {
- std::multimap<struct ::wl_client*, tizen_viewport::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_viewport::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_viewport::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_viewport::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_viewport::Resource *tizen_viewport::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_viewport::Resource *tizen_viewport::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_viewport::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_viewport_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_viewport::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_viewport::interface()
- {
- return &::tizen_viewport_interface;
- }
-
- tizen_viewport::Resource *tizen_viewport::tizen_viewport_allocate()
- {
- return new Resource;
- }
-
- void tizen_viewport::tizen_viewport_bind_resource(Resource *)
- {
- }
-
- void tizen_viewport::tizen_viewport_destroy_resource(Resource *)
- {
- }
-
- void tizen_viewport::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_viewport *that = static_cast<tizen_viewport *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_viewport::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_viewport *that = static_cast<tizen_viewport::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_viewport::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_viewport *that = resource->tizen_viewport_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_viewport_destroy_resource(resource);
- delete resource;
- }
-
- tizen_viewport::Resource *tizen_viewport::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_viewport_interface, version, id);
- return bind(handle);
- }
-
- tizen_viewport::Resource *tizen_viewport::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_viewport_allocate();
- resource->tizen_viewport_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_viewport_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_viewport_bind_resource(resource);
- return resource;
- }
- tizen_viewport::Resource *tizen_viewport::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_viewport_interface, &m_tizen_viewport_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_viewport_interface tizen_viewport::m_tizen_viewport_interface = {
- tizen_viewport::handle_destroy,
- tizen_viewport::handle_set_transform,
- tizen_viewport::handle_set_source,
- tizen_viewport::handle_set_destination,
- tizen_viewport::handle_set_destination_ratio,
- tizen_viewport::handle_get_destination_mode,
- tizen_viewport::handle_query_parent_size,
- tizen_viewport::handle_follow_parent_transform,
- tizen_viewport::handle_unfollow_parent_transform
- };
-
- void tizen_viewport::tizen_viewport_destroy(Resource *)
- {
- }
-
- void tizen_viewport::tizen_viewport_set_transform(Resource *, uint32_t )
- {
- }
-
- void tizen_viewport::tizen_viewport_set_source(Resource *, uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_viewport::tizen_viewport_set_destination(Resource *, int32_t , int32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_viewport::tizen_viewport_set_destination_ratio(Resource *, wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t )
- {
- }
-
- void tizen_viewport::tizen_viewport_get_destination_mode(Resource *, uint32_t)
- {
- }
-
- void tizen_viewport::tizen_viewport_query_parent_size(Resource *)
- {
- }
-
- void tizen_viewport::tizen_viewport_follow_parent_transform(Resource *)
- {
- }
-
- void tizen_viewport::tizen_viewport_unfollow_parent_transform(Resource *)
- {
- }
-
-
- void tizen_viewport::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_destroy(
- r);
- }
-
- void tizen_viewport::handle_set_transform(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t transform)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_set_transform(
- r,
- transform);
- }
-
- void tizen_viewport::handle_set_source(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t x,
- uint32_t y,
- uint32_t width,
- uint32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_set_source(
- r,
- x,
- y,
- width,
- height);
- }
-
- void tizen_viewport::handle_set_destination(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- uint32_t width,
- uint32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_set_destination(
- r,
- x,
- y,
- width,
- height);
- }
-
- void tizen_viewport::handle_set_destination_ratio(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t x,
- wl_fixed_t y,
- wl_fixed_t width,
- wl_fixed_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_set_destination_ratio(
- r,
- x,
- y,
- width,
- height);
- }
-
- void tizen_viewport::handle_get_destination_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_get_destination_mode(
- r,
- id);
- }
-
- void tizen_viewport::handle_query_parent_size(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_query_parent_size(
- r);
- }
-
- void tizen_viewport::handle_follow_parent_transform(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_follow_parent_transform(
- r);
- }
-
- void tizen_viewport::handle_unfollow_parent_transform(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_viewport *>(r->tizen_viewport_object)->tizen_viewport_unfollow_parent_transform(
- r);
- }
-
- void tizen_viewport::send_destination_changed(uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height)
- {
- DS_ASSERT_X(m_resource, "tizen_viewport::destination_changed", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_viewport::destination_changed as it's not initialised");
- return;
- }
- send_destination_changed(
- m_resource->handle,
- transform,
- x,
- y,
- width,
- height);
- }
-
- void tizen_viewport::send_destination_changed(struct ::wl_resource *resource, uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height)
- {
- tizen_viewport_send_destination_changed(
- resource,
- transform,
- x,
- y,
- width,
- height);
- }
-
-
- void tizen_viewport::send_parent_size(uint32_t width, uint32_t height)
- {
- DS_ASSERT_X(m_resource, "tizen_viewport::parent_size", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_viewport::parent_size as it's not initialised");
- return;
- }
- send_parent_size(
- m_resource->handle,
- width,
- height);
- }
-
- void tizen_viewport::send_parent_size(struct ::wl_resource *resource, uint32_t width, uint32_t height)
- {
- tizen_viewport_send_parent_size(
- resource,
- width,
- height);
- }
-
-
- tizen_destination_mode::tizen_destination_mode(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_destination_mode::tizen_destination_mode(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_destination_mode::tizen_destination_mode(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_destination_mode::tizen_destination_mode()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_destination_mode::~tizen_destination_mode()
- {
- std::multimap<struct ::wl_client*, tizen_destination_mode::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_destination_mode::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_destination_mode::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_destination_mode::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_destination_mode::Resource *tizen_destination_mode::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_destination_mode::Resource *tizen_destination_mode::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_destination_mode::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_destination_mode_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_destination_mode::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_destination_mode::interface()
- {
- return &::tizen_destination_mode_interface;
- }
-
- tizen_destination_mode::Resource *tizen_destination_mode::tizen_destination_mode_allocate()
- {
- return new Resource;
- }
-
- void tizen_destination_mode::tizen_destination_mode_bind_resource(Resource *)
- {
- }
-
- void tizen_destination_mode::tizen_destination_mode_destroy_resource(Resource *)
- {
- }
-
- void tizen_destination_mode::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_destination_mode *that = static_cast<tizen_destination_mode *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_destination_mode::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_destination_mode *that = static_cast<tizen_destination_mode::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_destination_mode::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_destination_mode *that = resource->tizen_destination_mode_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_destination_mode_destroy_resource(resource);
- delete resource;
- }
-
- tizen_destination_mode::Resource *tizen_destination_mode::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_destination_mode_interface, version, id);
- return bind(handle);
- }
-
- tizen_destination_mode::Resource *tizen_destination_mode::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_destination_mode_allocate();
- resource->tizen_destination_mode_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_destination_mode_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_destination_mode_bind_resource(resource);
- return resource;
- }
- tizen_destination_mode::Resource *tizen_destination_mode::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_destination_mode_interface, &m_tizen_destination_mode_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_destination_mode_interface tizen_destination_mode::m_tizen_destination_mode_interface = {
- tizen_destination_mode::handle_destroy,
- tizen_destination_mode::handle_follow_parent_transform,
- tizen_destination_mode::handle_unfollow_parent_transform,
- tizen_destination_mode::handle_set,
- tizen_destination_mode::handle_set_ratio,
- tizen_destination_mode::handle_set_scale,
- tizen_destination_mode::handle_set_align,
- tizen_destination_mode::handle_set_offset
- };
-
- void tizen_destination_mode::tizen_destination_mode_destroy(Resource *)
- {
- }
-
- void tizen_destination_mode::tizen_destination_mode_follow_parent_transform(Resource *)
- {
- }
-
- void tizen_destination_mode::tizen_destination_mode_unfollow_parent_transform(Resource *)
- {
- }
-
- void tizen_destination_mode::tizen_destination_mode_set(Resource *, uint32_t )
- {
- }
-
- void tizen_destination_mode::tizen_destination_mode_set_ratio(Resource *, wl_fixed_t , wl_fixed_t )
- {
- }
-
- void tizen_destination_mode::tizen_destination_mode_set_scale(Resource *, wl_fixed_t , wl_fixed_t )
- {
- }
-
- void tizen_destination_mode::tizen_destination_mode_set_align(Resource *, wl_fixed_t , wl_fixed_t )
- {
- }
-
- void tizen_destination_mode::tizen_destination_mode_set_offset(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
-
- void tizen_destination_mode::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_destination_mode *>(r->tizen_destination_mode_object)->tizen_destination_mode_destroy(
- r);
- }
-
- void tizen_destination_mode::handle_follow_parent_transform(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_destination_mode *>(r->tizen_destination_mode_object)->tizen_destination_mode_follow_parent_transform(
- r);
- }
-
- void tizen_destination_mode::handle_unfollow_parent_transform(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_destination_mode *>(r->tizen_destination_mode_object)->tizen_destination_mode_unfollow_parent_transform(
- r);
- }
-
- void tizen_destination_mode::handle_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t mode)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_destination_mode *>(r->tizen_destination_mode_object)->tizen_destination_mode_set(
- r,
- mode);
- }
-
- void tizen_destination_mode::handle_set_ratio(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t horizontal,
- wl_fixed_t vertical)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_destination_mode *>(r->tizen_destination_mode_object)->tizen_destination_mode_set_ratio(
- r,
- horizontal,
- vertical);
- }
-
- void tizen_destination_mode::handle_set_scale(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t horizontal,
- wl_fixed_t vertical)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_destination_mode *>(r->tizen_destination_mode_object)->tizen_destination_mode_set_scale(
- r,
- horizontal,
- vertical);
- }
-
- void tizen_destination_mode::handle_set_align(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t horizontal,
- wl_fixed_t vertical)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_destination_mode *>(r->tizen_destination_mode_object)->tizen_destination_mode_set_align(
- r,
- horizontal,
- vertical);
- }
-
- void tizen_destination_mode::handle_set_offset(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_destination_mode *>(r->tizen_destination_mode_object)->tizen_destination_mode_set_offset(
- r,
- x,
- y,
- w,
- h);
- }
-
- tizen_embedded_compositor::tizen_embedded_compositor(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_embedded_compositor::tizen_embedded_compositor(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_embedded_compositor::tizen_embedded_compositor(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_embedded_compositor::tizen_embedded_compositor()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_embedded_compositor::~tizen_embedded_compositor()
- {
- std::multimap<struct ::wl_client*, tizen_embedded_compositor::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_embedded_compositor::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_embedded_compositor::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_embedded_compositor::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_embedded_compositor::Resource *tizen_embedded_compositor::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_embedded_compositor::Resource *tizen_embedded_compositor::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_embedded_compositor::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_embedded_compositor_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_embedded_compositor::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_embedded_compositor::interface()
- {
- return &::tizen_embedded_compositor_interface;
- }
-
- tizen_embedded_compositor::Resource *tizen_embedded_compositor::tizen_embedded_compositor_allocate()
- {
- return new Resource;
- }
-
- void tizen_embedded_compositor::tizen_embedded_compositor_bind_resource(Resource *)
- {
- }
-
- void tizen_embedded_compositor::tizen_embedded_compositor_destroy_resource(Resource *)
- {
- }
-
- void tizen_embedded_compositor::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_embedded_compositor *that = static_cast<tizen_embedded_compositor *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_embedded_compositor::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_embedded_compositor *that = static_cast<tizen_embedded_compositor::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_embedded_compositor::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_embedded_compositor *that = resource->tizen_embedded_compositor_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_embedded_compositor_destroy_resource(resource);
- delete resource;
- }
-
- tizen_embedded_compositor::Resource *tizen_embedded_compositor::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_embedded_compositor_interface, version, id);
- return bind(handle);
- }
-
- tizen_embedded_compositor::Resource *tizen_embedded_compositor::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_embedded_compositor_allocate();
- resource->tizen_embedded_compositor_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_embedded_compositor_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_embedded_compositor_bind_resource(resource);
- return resource;
- }
- tizen_embedded_compositor::Resource *tizen_embedded_compositor::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_embedded_compositor_interface, &m_tizen_embedded_compositor_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_embedded_compositor_interface tizen_embedded_compositor::m_tizen_embedded_compositor_interface = {
- tizen_embedded_compositor::handle_get_socket,
- tizen_embedded_compositor::handle_destroy
- };
-
- void tizen_embedded_compositor::tizen_embedded_compositor_get_socket(Resource *)
- {
- }
-
- void tizen_embedded_compositor::tizen_embedded_compositor_destroy(Resource *)
- {
- }
-
-
- void tizen_embedded_compositor::handle_get_socket(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_embedded_compositor *>(r->tizen_embedded_compositor_object)->tizen_embedded_compositor_get_socket(
- r);
- }
-
- void tizen_embedded_compositor::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_embedded_compositor *>(r->tizen_embedded_compositor_object)->tizen_embedded_compositor_destroy(
- r);
- }
-
- void tizen_embedded_compositor::send_socket(int32_t sock_fd)
- {
- DS_ASSERT_X(m_resource, "tizen_embedded_compositor::socket", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_embedded_compositor::socket as it's not initialised");
- return;
- }
- send_socket(
- m_resource->handle,
- sock_fd);
- }
-
- void tizen_embedded_compositor::send_socket(struct ::wl_resource *resource, int32_t sock_fd)
- {
- tizen_embedded_compositor_send_socket(
- resource,
- sock_fd);
- }
-
-
- tizen_input_device_manager::tizen_input_device_manager(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_input_device_manager::tizen_input_device_manager(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_input_device_manager::tizen_input_device_manager(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_input_device_manager::tizen_input_device_manager()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_input_device_manager::~tizen_input_device_manager()
- {
- std::multimap<struct ::wl_client*, tizen_input_device_manager::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_input_device_manager::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_input_device_manager::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_input_device_manager::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_input_device_manager::Resource *tizen_input_device_manager::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_input_device_manager::Resource *tizen_input_device_manager::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_input_device_manager::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_input_device_manager_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_input_device_manager::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_input_device_manager::interface()
- {
- return &::tizen_input_device_manager_interface;
- }
-
- tizen_input_device_manager::Resource *tizen_input_device_manager::tizen_input_device_manager_allocate()
- {
- return new Resource;
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_bind_resource(Resource *)
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_destroy_resource(Resource *)
- {
- }
-
- void tizen_input_device_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_input_device_manager *that = static_cast<tizen_input_device_manager *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_input_device_manager::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_input_device_manager *that = static_cast<tizen_input_device_manager::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_input_device_manager::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_input_device_manager *that = resource->tizen_input_device_manager_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_input_device_manager_destroy_resource(resource);
- delete resource;
- }
-
- tizen_input_device_manager::Resource *tizen_input_device_manager::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_input_device_manager_interface, version, id);
- return bind(handle);
- }
-
- tizen_input_device_manager::Resource *tizen_input_device_manager::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_input_device_manager_allocate();
- resource->tizen_input_device_manager_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_input_device_manager_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_input_device_manager_bind_resource(resource);
- return resource;
- }
- tizen_input_device_manager::Resource *tizen_input_device_manager::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_input_device_manager_interface, &m_tizen_input_device_manager_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_input_device_manager_interface tizen_input_device_manager::m_tizen_input_device_manager_interface = {
- tizen_input_device_manager::handle_block_events,
- tizen_input_device_manager::handle_unblock_events,
- tizen_input_device_manager::handle_init_generator,
- tizen_input_device_manager::handle_deinit_generator,
- tizen_input_device_manager::handle_generate_key,
- tizen_input_device_manager::handle_generate_pointer,
- tizen_input_device_manager::handle_generate_touch,
- tizen_input_device_manager::handle_pointer_warp,
- tizen_input_device_manager::handle_init_generator_with_name,
- tizen_input_device_manager::handle_destroy,
- tizen_input_device_manager::handle_generate_axis,
- tizen_input_device_manager::handle_set_touch_count
- };
-
- void tizen_input_device_manager::tizen_input_device_manager_block_events(Resource *, uint32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_unblock_events(Resource *, uint32_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_init_generator(Resource *, uint32_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_deinit_generator(Resource *, uint32_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_generate_key(Resource *, const std::string &, uint32_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_generate_pointer(Resource *, uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_generate_touch(Resource *, uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_pointer_warp(Resource *, struct ::wl_resource *, wl_fixed_t , wl_fixed_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_init_generator_with_name(Resource *, uint32_t , const std::string &)
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_destroy(Resource *)
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_generate_axis(Resource *, uint32_t , wl_fixed_t )
- {
- }
-
- void tizen_input_device_manager::tizen_input_device_manager_set_touch_count(Resource *, int32_t )
- {
- }
-
-
- void tizen_input_device_manager::handle_block_events(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t clas,
- uint32_t duration)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_block_events(
- r,
- serial,
- clas,
- duration);
- }
-
- void tizen_input_device_manager::handle_unblock_events(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_unblock_events(
- r,
- serial);
- }
-
- void tizen_input_device_manager::handle_init_generator(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t clas)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_init_generator(
- r,
- clas);
- }
-
- void tizen_input_device_manager::handle_deinit_generator(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t clas)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_deinit_generator(
- r,
- clas);
- }
-
- void tizen_input_device_manager::handle_generate_key(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *keyname,
- uint32_t pressed)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_generate_key(
- r,
- std::string(keyname),
- pressed);
- }
-
- void tizen_input_device_manager::handle_generate_pointer(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type,
- uint32_t x,
- uint32_t y,
- uint32_t button)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_generate_pointer(
- r,
- type,
- x,
- y,
- button);
- }
-
- void tizen_input_device_manager::handle_generate_touch(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type,
- uint32_t x,
- uint32_t y,
- uint32_t finger)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_generate_touch(
- r,
- type,
- x,
- y,
- finger);
- }
-
- void tizen_input_device_manager::handle_pointer_warp(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- wl_fixed_t x,
- wl_fixed_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_pointer_warp(
- r,
- surface,
- x,
- y);
- }
-
- void tizen_input_device_manager::handle_init_generator_with_name(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t clas,
- const char *name)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_init_generator_with_name(
- r,
- clas,
- std::string(name));
- }
-
- void tizen_input_device_manager::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_destroy(
- r);
- }
-
- void tizen_input_device_manager::handle_generate_axis(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type,
- wl_fixed_t value)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_generate_axis(
- r,
- type,
- value);
- }
-
- void tizen_input_device_manager::handle_set_touch_count(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t max_count)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device_manager *>(r->tizen_input_device_manager_object)->tizen_input_device_manager_set_touch_count(
- r,
- max_count);
- }
-
- void tizen_input_device_manager::send_device_add(uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat)
- {
- DS_ASSERT_X(m_resource, "tizen_input_device_manager::device_add", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_input_device_manager::device_add as it's not initialised");
- return;
- }
- send_device_add(
- m_resource->handle,
- serial,
- identifier,
- device,
- seat);
- }
-
- void tizen_input_device_manager::send_device_add(struct ::wl_resource *resource, uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat)
- {
- tizen_input_device_manager_send_device_add(
- resource,
- serial,
- identifier.c_str(),
- device,
- seat);
- }
-
-
- void tizen_input_device_manager::send_device_remove(uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat)
- {
- DS_ASSERT_X(m_resource, "tizen_input_device_manager::device_remove", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_input_device_manager::device_remove as it's not initialised");
- return;
- }
- send_device_remove(
- m_resource->handle,
- serial,
- identifier,
- device,
- seat);
- }
-
- void tizen_input_device_manager::send_device_remove(struct ::wl_resource *resource, uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat)
- {
- tizen_input_device_manager_send_device_remove(
- resource,
- serial,
- identifier.c_str(),
- device,
- seat);
- }
-
-
- void tizen_input_device_manager::send_error(uint32_t errorcode)
- {
- DS_ASSERT_X(m_resource, "tizen_input_device_manager::error", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_input_device_manager::error as it's not initialised");
- return;
- }
- send_error(
- m_resource->handle,
- errorcode);
- }
-
- void tizen_input_device_manager::send_error(struct ::wl_resource *resource, uint32_t errorcode)
- {
- tizen_input_device_manager_send_error(
- resource,
- errorcode);
- }
-
-
- void tizen_input_device_manager::send_block_expired()
- {
- DS_ASSERT_X(m_resource, "tizen_input_device_manager::block_expired", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_input_device_manager::block_expired as it's not initialised");
- return;
- }
- send_block_expired(
- m_resource->handle);
- }
-
- void tizen_input_device_manager::send_block_expired(struct ::wl_resource *resource)
- {
- tizen_input_device_manager_send_block_expired(
- resource);
- }
-
-
- void tizen_input_device_manager::send_max_touch_count(uint32_t serial, int32_t max_count, struct ::wl_resource *seat)
- {
- DS_ASSERT_X(m_resource, "tizen_input_device_manager::max_touch_count", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_input_device_manager::max_touch_count as it's not initialised");
- return;
- }
- send_max_touch_count(
- m_resource->handle,
- serial,
- max_count,
- seat);
- }
-
- void tizen_input_device_manager::send_max_touch_count(struct ::wl_resource *resource, uint32_t serial, int32_t max_count, struct ::wl_resource *seat)
- {
- tizen_input_device_manager_send_max_touch_count(
- resource,
- serial,
- max_count,
- seat);
- }
-
-
- tizen_input_device::tizen_input_device(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_input_device::tizen_input_device(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_input_device::tizen_input_device(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_input_device::tizen_input_device()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_input_device::~tizen_input_device()
- {
- std::multimap<struct ::wl_client*, tizen_input_device::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_input_device::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_input_device::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_input_device::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_input_device::Resource *tizen_input_device::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_input_device::Resource *tizen_input_device::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_input_device::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_input_device_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_input_device::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_input_device::interface()
- {
- return &::tizen_input_device_interface;
- }
-
- tizen_input_device::Resource *tizen_input_device::tizen_input_device_allocate()
- {
- return new Resource;
- }
-
- void tizen_input_device::tizen_input_device_bind_resource(Resource *)
- {
- }
-
- void tizen_input_device::tizen_input_device_destroy_resource(Resource *)
- {
- }
-
- void tizen_input_device::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_input_device *that = static_cast<tizen_input_device *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_input_device::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_input_device *that = static_cast<tizen_input_device::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_input_device::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_input_device *that = resource->tizen_input_device_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_input_device_destroy_resource(resource);
- delete resource;
- }
-
- tizen_input_device::Resource *tizen_input_device::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_input_device_interface, version, id);
- return bind(handle);
- }
-
- tizen_input_device::Resource *tizen_input_device::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_input_device_allocate();
- resource->tizen_input_device_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_input_device_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_input_device_bind_resource(resource);
- return resource;
- }
- tizen_input_device::Resource *tizen_input_device::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_input_device_interface, &m_tizen_input_device_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_input_device_interface tizen_input_device::m_tizen_input_device_interface = {
- tizen_input_device::handle_select_axes,
- tizen_input_device::handle_release
- };
-
- void tizen_input_device::tizen_input_device_select_axes(Resource *, struct ::wl_array *)
- {
- }
-
- void tizen_input_device::tizen_input_device_release(Resource *)
- {
- }
-
-
- void tizen_input_device::handle_select_axes(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_array *axes)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device *>(r->tizen_input_device_object)->tizen_input_device_select_axes(
- r,
- axes);
- }
-
- void tizen_input_device::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_input_device *>(r->tizen_input_device_object)->tizen_input_device_release(
- r);
- }
-
- void tizen_input_device::send_device_info(const std::string &name, uint32_t clas, uint32_t subclas, struct ::wl_array *axes)
- {
- DS_ASSERT_X(m_resource, "tizen_input_device::device_info", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_input_device::device_info as it's not initialised");
- return;
- }
- send_device_info(
- m_resource->handle,
- name,
- clas,
- subclas,
- axes);
- }
-
- void tizen_input_device::send_device_info(struct ::wl_resource *resource, const std::string &name, uint32_t clas, uint32_t subclas, struct ::wl_array *axes)
- {
- tizen_input_device_send_device_info(
- resource,
- name.c_str(),
- clas,
- subclas,
- axes);
- }
-
-
- void tizen_input_device::send_event_device(uint32_t serial, const std::string &name, uint32_t time)
- {
- DS_ASSERT_X(m_resource, "tizen_input_device::event_device", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_input_device::event_device as it's not initialised");
- return;
- }
- send_event_device(
- m_resource->handle,
- serial,
- name,
- time);
- }
-
- void tizen_input_device::send_event_device(struct ::wl_resource *resource, uint32_t serial, const std::string &name, uint32_t time)
- {
- tizen_input_device_send_event_device(
- resource,
- serial,
- name.c_str(),
- time);
- }
-
-
- void tizen_input_device::send_axis(uint32_t axis_type, wl_fixed_t value)
- {
- DS_ASSERT_X(m_resource, "tizen_input_device::axis", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_input_device::axis as it's not initialised");
- return;
- }
- send_axis(
- m_resource->handle,
- axis_type,
- value);
- }
-
- void tizen_input_device::send_axis(struct ::wl_resource *resource, uint32_t axis_type, wl_fixed_t value)
- {
- tizen_input_device_send_axis(
- resource,
- axis_type,
- value);
- }
-
-
- tizen_launchscreen::tizen_launchscreen(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_launchscreen::tizen_launchscreen(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_launchscreen::tizen_launchscreen(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_launchscreen::tizen_launchscreen()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_launchscreen::~tizen_launchscreen()
- {
- std::multimap<struct ::wl_client*, tizen_launchscreen::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_launchscreen::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_launchscreen::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_launchscreen::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_launchscreen::Resource *tizen_launchscreen::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_launchscreen::Resource *tizen_launchscreen::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_launchscreen::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_launchscreen_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_launchscreen::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_launchscreen::interface()
- {
- return &::tizen_launchscreen_interface;
- }
-
- tizen_launchscreen::Resource *tizen_launchscreen::tizen_launchscreen_allocate()
- {
- return new Resource;
- }
-
- void tizen_launchscreen::tizen_launchscreen_bind_resource(Resource *)
- {
- }
-
- void tizen_launchscreen::tizen_launchscreen_destroy_resource(Resource *)
- {
- }
-
- void tizen_launchscreen::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_launchscreen *that = static_cast<tizen_launchscreen *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_launchscreen::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_launchscreen *that = static_cast<tizen_launchscreen::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_launchscreen::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_launchscreen *that = resource->tizen_launchscreen_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_launchscreen_destroy_resource(resource);
- delete resource;
- }
-
- tizen_launchscreen::Resource *tizen_launchscreen::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launchscreen_interface, version, id);
- return bind(handle);
- }
-
- tizen_launchscreen::Resource *tizen_launchscreen::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_launchscreen_allocate();
- resource->tizen_launchscreen_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_launchscreen_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_launchscreen_bind_resource(resource);
- return resource;
- }
- tizen_launchscreen::Resource *tizen_launchscreen::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_launchscreen_interface, &m_tizen_launchscreen_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_launchscreen_interface tizen_launchscreen::m_tizen_launchscreen_interface = {
- tizen_launchscreen::handle_create_img,
- tizen_launchscreen::handle_destroy
- };
-
- void tizen_launchscreen::tizen_launchscreen_create_img(Resource *, uint32_t)
- {
- }
-
- void tizen_launchscreen::tizen_launchscreen_destroy(Resource *)
- {
- }
-
-
- void tizen_launchscreen::handle_create_img(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launchscreen *>(r->tizen_launchscreen_object)->tizen_launchscreen_create_img(
- r,
- id);
- }
-
- void tizen_launchscreen::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launchscreen *>(r->tizen_launchscreen_object)->tizen_launchscreen_destroy(
- r);
- }
-
- tizen_launch_image::tizen_launch_image(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_launch_image::tizen_launch_image(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_launch_image::tizen_launch_image(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_launch_image::tizen_launch_image()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_launch_image::~tizen_launch_image()
- {
- std::multimap<struct ::wl_client*, tizen_launch_image::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_launch_image::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_launch_image::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_launch_image::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_launch_image::Resource *tizen_launch_image::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_launch_image::Resource *tizen_launch_image::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_launch_image::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_launch_image_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_launch_image::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_launch_image::interface()
- {
- return &::tizen_launch_image_interface;
- }
-
- tizen_launch_image::Resource *tizen_launch_image::tizen_launch_image_allocate()
- {
- return new Resource;
- }
-
- void tizen_launch_image::tizen_launch_image_bind_resource(Resource *)
- {
- }
-
- void tizen_launch_image::tizen_launch_image_destroy_resource(Resource *)
- {
- }
-
- void tizen_launch_image::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_launch_image *that = static_cast<tizen_launch_image *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_launch_image::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_launch_image *that = static_cast<tizen_launch_image::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_launch_image::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_launch_image *that = resource->tizen_launch_image_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_launch_image_destroy_resource(resource);
- delete resource;
- }
-
- tizen_launch_image::Resource *tizen_launch_image::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launch_image_interface, version, id);
- return bind(handle);
- }
-
- tizen_launch_image::Resource *tizen_launch_image::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_launch_image_allocate();
- resource->tizen_launch_image_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_launch_image_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_launch_image_bind_resource(resource);
- return resource;
- }
- tizen_launch_image::Resource *tizen_launch_image::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_launch_image_interface, &m_tizen_launch_image_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_launch_image_interface tizen_launch_image::m_tizen_launch_image_interface = {
- tizen_launch_image::handle_destroy,
- tizen_launch_image::handle_launch,
- tizen_launch_image::handle_owner,
- tizen_launch_image::handle_show,
- tizen_launch_image::handle_hide
- };
-
- void tizen_launch_image::tizen_launch_image_destroy(Resource *)
- {
- }
-
- void tizen_launch_image::tizen_launch_image_launch(Resource *, const std::string &, uint32_t , uint32_t , uint32_t , uint32_t , struct ::wl_array *)
- {
- }
-
- void tizen_launch_image::tizen_launch_image_owner(Resource *, uint32_t )
- {
- }
-
- void tizen_launch_image::tizen_launch_image_show(Resource *)
- {
- }
-
- void tizen_launch_image::tizen_launch_image_hide(Resource *)
- {
- }
-
-
- void tizen_launch_image::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_image *>(r->tizen_launch_image_object)->tizen_launch_image_destroy(
- r);
- }
-
- void tizen_launch_image::handle_launch(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *file,
- uint32_t file_type,
- uint32_t color_depth,
- uint32_t rotation,
- uint32_t indicator,
- struct ::wl_array *options)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_image *>(r->tizen_launch_image_object)->tizen_launch_image_launch(
- r,
- std::string(file),
- file_type,
- color_depth,
- rotation,
- indicator,
- options);
- }
-
- void tizen_launch_image::handle_owner(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_image *>(r->tizen_launch_image_object)->tizen_launch_image_owner(
- r,
- pid);
- }
-
- void tizen_launch_image::handle_show(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_image *>(r->tizen_launch_image_object)->tizen_launch_image_show(
- r);
- }
-
- void tizen_launch_image::handle_hide(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_image *>(r->tizen_launch_image_object)->tizen_launch_image_hide(
- r);
- }
-
- tizen_effect::tizen_effect(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_effect::tizen_effect(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_effect::tizen_effect(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_effect::tizen_effect()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_effect::~tizen_effect()
- {
- std::multimap<struct ::wl_client*, tizen_effect::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_effect::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_effect::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_effect::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_effect::Resource *tizen_effect::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_effect::Resource *tizen_effect::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_effect::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_effect_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_effect::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_effect::interface()
- {
- return &::tizen_effect_interface;
- }
-
- tizen_effect::Resource *tizen_effect::tizen_effect_allocate()
- {
- return new Resource;
- }
-
- void tizen_effect::tizen_effect_bind_resource(Resource *)
- {
- }
-
- void tizen_effect::tizen_effect_destroy_resource(Resource *)
- {
- }
-
- void tizen_effect::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_effect *that = static_cast<tizen_effect *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_effect::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_effect *that = static_cast<tizen_effect::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_effect::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_effect *that = resource->tizen_effect_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_effect_destroy_resource(resource);
- delete resource;
- }
-
- tizen_effect::Resource *tizen_effect::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_effect_interface, version, id);
- return bind(handle);
- }
-
- tizen_effect::Resource *tizen_effect::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_effect_allocate();
- resource->tizen_effect_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_effect_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_effect_bind_resource(resource);
- return resource;
- }
- tizen_effect::Resource *tizen_effect::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_effect_interface, &m_tizen_effect_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_effect_interface tizen_effect::m_tizen_effect_interface = {
- tizen_effect::handle_destroy
- };
-
- void tizen_effect::tizen_effect_destroy(Resource *)
- {
- }
-
-
- void tizen_effect::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_effect *>(r->tizen_effect_object)->tizen_effect_destroy(
- r);
- }
-
- void tizen_effect::send_start(struct ::wl_resource *surface, uint32_t type)
- {
- DS_ASSERT_X(m_resource, "tizen_effect::start", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_effect::start as it's not initialised");
- return;
- }
- send_start(
- m_resource->handle,
- surface,
- type);
- }
-
- void tizen_effect::send_start(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type)
- {
- tizen_effect_send_start(
- resource,
- surface,
- type);
- }
-
-
- void tizen_effect::send_end(struct ::wl_resource *surface, uint32_t type)
- {
- DS_ASSERT_X(m_resource, "tizen_effect::end", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_effect::end as it's not initialised");
- return;
- }
- send_end(
- m_resource->handle,
- surface,
- type);
- }
-
- void tizen_effect::send_end(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type)
- {
- tizen_effect_send_end(
- resource,
- surface,
- type);
- }
-
-
- tizen_display_policy::tizen_display_policy(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_display_policy::tizen_display_policy(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_display_policy::tizen_display_policy(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_display_policy::tizen_display_policy()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_display_policy::~tizen_display_policy()
- {
- std::multimap<struct ::wl_client*, tizen_display_policy::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_display_policy::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_display_policy::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_display_policy::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_display_policy::Resource *tizen_display_policy::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_display_policy::Resource *tizen_display_policy::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_display_policy::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_display_policy_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_display_policy::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_display_policy::interface()
- {
- return &::tizen_display_policy_interface;
- }
-
- tizen_display_policy::Resource *tizen_display_policy::tizen_display_policy_allocate()
- {
- return new Resource;
- }
-
- void tizen_display_policy::tizen_display_policy_bind_resource(Resource *)
- {
- }
-
- void tizen_display_policy::tizen_display_policy_destroy_resource(Resource *)
- {
- }
-
- void tizen_display_policy::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_display_policy *that = static_cast<tizen_display_policy *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_display_policy::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_display_policy *that = static_cast<tizen_display_policy::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_display_policy::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_display_policy *that = resource->tizen_display_policy_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_display_policy_destroy_resource(resource);
- delete resource;
- }
-
- tizen_display_policy::Resource *tizen_display_policy::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_display_policy_interface, version, id);
- return bind(handle);
- }
-
- tizen_display_policy::Resource *tizen_display_policy::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_display_policy_allocate();
- resource->tizen_display_policy_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_display_policy_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_display_policy_bind_resource(resource);
- return resource;
- }
- tizen_display_policy::Resource *tizen_display_policy::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_display_policy_interface, &m_tizen_display_policy_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_display_policy_interface tizen_display_policy::m_tizen_display_policy_interface = {
- tizen_display_policy::handle_set_window_brightness,
- tizen_display_policy::handle_destroy
- };
-
- void tizen_display_policy::tizen_display_policy_set_window_brightness(Resource *, struct ::wl_resource *, int32_t )
- {
- }
-
- void tizen_display_policy::tizen_display_policy_destroy(Resource *)
- {
- }
-
-
- void tizen_display_policy::handle_set_window_brightness(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t brightness)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_display_policy *>(r->tizen_display_policy_object)->tizen_display_policy_set_window_brightness(
- r,
- surface,
- brightness);
- }
-
- void tizen_display_policy::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_display_policy *>(r->tizen_display_policy_object)->tizen_display_policy_destroy(
- r);
- }
-
- void tizen_display_policy::send_window_brightness_done(struct ::wl_resource *surface, int32_t brightness, uint32_t error_state)
- {
- DS_ASSERT_X(m_resource, "tizen_display_policy::window_brightness_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_display_policy::window_brightness_done as it's not initialised");
- return;
- }
- send_window_brightness_done(
- m_resource->handle,
- surface,
- brightness,
- error_state);
- }
-
- void tizen_display_policy::send_window_brightness_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t brightness, uint32_t error_state)
- {
- tizen_display_policy_send_window_brightness_done(
- resource,
- surface,
- brightness,
- error_state);
- }
-
-
- tizen_indicator::tizen_indicator(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_indicator::tizen_indicator(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_indicator::tizen_indicator(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_indicator::tizen_indicator()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_indicator::~tizen_indicator()
- {
- std::multimap<struct ::wl_client*, tizen_indicator::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_indicator::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_indicator::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_indicator::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_indicator::Resource *tizen_indicator::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_indicator::Resource *tizen_indicator::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_indicator::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_indicator_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_indicator::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_indicator::interface()
- {
- return &::tizen_indicator_interface;
- }
-
- tizen_indicator::Resource *tizen_indicator::tizen_indicator_allocate()
- {
- return new Resource;
- }
-
- void tizen_indicator::tizen_indicator_bind_resource(Resource *)
- {
- }
-
- void tizen_indicator::tizen_indicator_destroy_resource(Resource *)
- {
- }
-
- void tizen_indicator::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_indicator *that = static_cast<tizen_indicator *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_indicator::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_indicator *that = static_cast<tizen_indicator::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_indicator::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_indicator *that = resource->tizen_indicator_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_indicator_destroy_resource(resource);
- delete resource;
- }
-
- tizen_indicator::Resource *tizen_indicator::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_indicator_interface, version, id);
- return bind(handle);
- }
-
- tizen_indicator::Resource *tizen_indicator::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_indicator_allocate();
- resource->tizen_indicator_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_indicator_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_indicator_bind_resource(resource);
- return resource;
- }
- tizen_indicator::Resource *tizen_indicator::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_indicator_interface, &m_tizen_indicator_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_indicator_interface tizen_indicator::m_tizen_indicator_interface = {
- tizen_indicator::handle_destroy,
- tizen_indicator::handle_set_state,
- tizen_indicator::handle_set_opacity_mode,
- tizen_indicator::handle_set_visible_type
- };
-
- void tizen_indicator::tizen_indicator_destroy(Resource *)
- {
- }
-
- void tizen_indicator::tizen_indicator_set_state(Resource *, struct ::wl_resource *, int32_t )
- {
- }
-
- void tizen_indicator::tizen_indicator_set_opacity_mode(Resource *, struct ::wl_resource *, int32_t )
- {
- }
-
- void tizen_indicator::tizen_indicator_set_visible_type(Resource *, struct ::wl_resource *, int32_t )
- {
- }
-
-
- void tizen_indicator::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_indicator *>(r->tizen_indicator_object)->tizen_indicator_destroy(
- r);
- }
-
- void tizen_indicator::handle_set_state(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t state)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_indicator *>(r->tizen_indicator_object)->tizen_indicator_set_state(
- r,
- surface,
- state);
- }
-
- void tizen_indicator::handle_set_opacity_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t mode)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_indicator *>(r->tizen_indicator_object)->tizen_indicator_set_opacity_mode(
- r,
- surface,
- mode);
- }
-
- void tizen_indicator::handle_set_visible_type(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_indicator *>(r->tizen_indicator_object)->tizen_indicator_set_visible_type(
- r,
- surface,
- type);
- }
-
- void tizen_indicator::send_flick(struct ::wl_resource *surface, int32_t type)
- {
- DS_ASSERT_X(m_resource, "tizen_indicator::flick", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_indicator::flick as it's not initialised");
- return;
- }
- send_flick(
- m_resource->handle,
- surface,
- type);
- }
-
- void tizen_indicator::send_flick(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t type)
- {
- tizen_indicator_send_flick(
- resource,
- surface,
- type);
- }
-
-
- tizen_clipboard::tizen_clipboard(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_clipboard::tizen_clipboard(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_clipboard::tizen_clipboard(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_clipboard::tizen_clipboard()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_clipboard::~tizen_clipboard()
- {
- std::multimap<struct ::wl_client*, tizen_clipboard::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_clipboard::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_clipboard::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_clipboard::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_clipboard::Resource *tizen_clipboard::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_clipboard::Resource *tizen_clipboard::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_clipboard::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_clipboard_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_clipboard::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_clipboard::interface()
- {
- return &::tizen_clipboard_interface;
- }
-
- tizen_clipboard::Resource *tizen_clipboard::tizen_clipboard_allocate()
- {
- return new Resource;
- }
-
- void tizen_clipboard::tizen_clipboard_bind_resource(Resource *)
- {
- }
-
- void tizen_clipboard::tizen_clipboard_destroy_resource(Resource *)
- {
- }
-
- void tizen_clipboard::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_clipboard *that = static_cast<tizen_clipboard *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_clipboard::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_clipboard *that = static_cast<tizen_clipboard::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_clipboard::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_clipboard *that = resource->tizen_clipboard_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_clipboard_destroy_resource(resource);
- delete resource;
- }
-
- tizen_clipboard::Resource *tizen_clipboard::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_clipboard_interface, version, id);
- return bind(handle);
- }
-
- tizen_clipboard::Resource *tizen_clipboard::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_clipboard_allocate();
- resource->tizen_clipboard_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_clipboard_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_clipboard_bind_resource(resource);
- return resource;
- }
- tizen_clipboard::Resource *tizen_clipboard::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_clipboard_interface, &m_tizen_clipboard_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_clipboard_interface tizen_clipboard::m_tizen_clipboard_interface = {
- tizen_clipboard::handle_destroy,
- tizen_clipboard::handle_show,
- tizen_clipboard::handle_hide,
- tizen_clipboard::handle_set_data_only
- };
-
- void tizen_clipboard::tizen_clipboard_destroy(Resource *)
- {
- }
-
- void tizen_clipboard::tizen_clipboard_show(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_clipboard::tizen_clipboard_hide(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_clipboard::tizen_clipboard_set_data_only(Resource *, uint32_t )
- {
- }
-
-
- void tizen_clipboard::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_clipboard *>(r->tizen_clipboard_object)->tizen_clipboard_destroy(
- r);
- }
-
- void tizen_clipboard::handle_show(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_clipboard *>(r->tizen_clipboard_object)->tizen_clipboard_show(
- r,
- surface);
- }
-
- void tizen_clipboard::handle_hide(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_clipboard *>(r->tizen_clipboard_object)->tizen_clipboard_hide(
- r,
- surface);
- }
-
- void tizen_clipboard::handle_set_data_only(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_clipboard *>(r->tizen_clipboard_object)->tizen_clipboard_set_data_only(
- r,
- set);
- }
-
- void tizen_clipboard::send_data_selected(struct ::wl_resource *surface)
- {
- DS_ASSERT_X(m_resource, "tizen_clipboard::data_selected", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_clipboard::data_selected as it's not initialised");
- return;
- }
- send_data_selected(
- m_resource->handle,
- surface);
- }
-
- void tizen_clipboard::send_data_selected(struct ::wl_resource *resource, struct ::wl_resource *surface)
- {
- tizen_clipboard_send_data_selected(
- resource,
- surface);
- }
-
-
- void tizen_clipboard::send_allowed_data_only(uint32_t allowed)
- {
- DS_ASSERT_X(m_resource, "tizen_clipboard::allowed_data_only", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_clipboard::allowed_data_only as it's not initialised");
- return;
- }
- send_allowed_data_only(
- m_resource->handle,
- allowed);
- }
-
- void tizen_clipboard::send_allowed_data_only(struct ::wl_resource *resource, uint32_t allowed)
- {
- tizen_clipboard_send_allowed_data_only(
- resource,
- allowed);
- }
-
-
- tizen_screen_rotation::tizen_screen_rotation(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_screen_rotation::tizen_screen_rotation(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_screen_rotation::tizen_screen_rotation(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_screen_rotation::tizen_screen_rotation()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_screen_rotation::~tizen_screen_rotation()
- {
- std::multimap<struct ::wl_client*, tizen_screen_rotation::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_screen_rotation::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_screen_rotation::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_screen_rotation::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_screen_rotation::Resource *tizen_screen_rotation::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_screen_rotation::Resource *tizen_screen_rotation::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_screen_rotation::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_screen_rotation_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_screen_rotation::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_screen_rotation::interface()
- {
- return &::tizen_screen_rotation_interface;
- }
-
- tizen_screen_rotation::Resource *tizen_screen_rotation::tizen_screen_rotation_allocate()
- {
- return new Resource;
- }
-
- void tizen_screen_rotation::tizen_screen_rotation_bind_resource(Resource *)
- {
- }
-
- void tizen_screen_rotation::tizen_screen_rotation_destroy_resource(Resource *)
- {
- }
-
- void tizen_screen_rotation::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_screen_rotation *that = static_cast<tizen_screen_rotation *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_screen_rotation::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_screen_rotation *that = static_cast<tizen_screen_rotation::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_screen_rotation::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_screen_rotation *that = resource->tizen_screen_rotation_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_screen_rotation_destroy_resource(resource);
- delete resource;
- }
-
- tizen_screen_rotation::Resource *tizen_screen_rotation::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_screen_rotation_interface, version, id);
- return bind(handle);
- }
-
- tizen_screen_rotation::Resource *tizen_screen_rotation::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_screen_rotation_allocate();
- resource->tizen_screen_rotation_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_screen_rotation_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_screen_rotation_bind_resource(resource);
- return resource;
- }
- tizen_screen_rotation::Resource *tizen_screen_rotation::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_screen_rotation_interface, &m_tizen_screen_rotation_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_screen_rotation_interface tizen_screen_rotation::m_tizen_screen_rotation_interface = {
- tizen_screen_rotation::handle_get_ignore_output_transform,
- tizen_screen_rotation::handle_destroy
- };
-
- void tizen_screen_rotation::tizen_screen_rotation_get_ignore_output_transform(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_screen_rotation::tizen_screen_rotation_destroy(Resource *)
- {
- }
-
-
- void tizen_screen_rotation::handle_get_ignore_output_transform(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screen_rotation *>(r->tizen_screen_rotation_object)->tizen_screen_rotation_get_ignore_output_transform(
- r,
- surface);
- }
-
- void tizen_screen_rotation::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_screen_rotation *>(r->tizen_screen_rotation_object)->tizen_screen_rotation_destroy(
- r);
- }
-
- void tizen_screen_rotation::send_ignore_output_transform(struct ::wl_resource *surface, uint32_t ignore)
- {
- DS_ASSERT_X(m_resource, "tizen_screen_rotation::ignore_output_transform", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_screen_rotation::ignore_output_transform as it's not initialised");
- return;
- }
- send_ignore_output_transform(
- m_resource->handle,
- surface,
- ignore);
- }
-
- void tizen_screen_rotation::send_ignore_output_transform(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t ignore)
- {
- tizen_screen_rotation_send_ignore_output_transform(
- resource,
- surface,
- ignore);
- }
-
-
- tizen_renderer::tizen_renderer(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_renderer::tizen_renderer(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_renderer::tizen_renderer(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_renderer::tizen_renderer()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_renderer::~tizen_renderer()
- {
- std::multimap<struct ::wl_client*, tizen_renderer::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_renderer::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_renderer::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_renderer::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_renderer::Resource *tizen_renderer::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_renderer::Resource *tizen_renderer::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_renderer::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_renderer_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_renderer::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_renderer::interface()
- {
- return &::tizen_renderer_interface;
- }
-
- tizen_renderer::Resource *tizen_renderer::tizen_renderer_allocate()
- {
- return new Resource;
- }
-
- void tizen_renderer::tizen_renderer_bind_resource(Resource *)
- {
- }
-
- void tizen_renderer::tizen_renderer_destroy_resource(Resource *)
- {
- }
-
- void tizen_renderer::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_renderer *that = static_cast<tizen_renderer *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_renderer::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_renderer *that = static_cast<tizen_renderer::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_renderer::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_renderer *that = resource->tizen_renderer_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_renderer_destroy_resource(resource);
- delete resource;
- }
-
- tizen_renderer::Resource *tizen_renderer::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_renderer_interface, version, id);
- return bind(handle);
- }
-
- tizen_renderer::Resource *tizen_renderer::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_renderer_allocate();
- resource->tizen_renderer_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_renderer_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_renderer_bind_resource(resource);
- return resource;
- }
- tizen_renderer::Resource *tizen_renderer::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_renderer_interface, &m_tizen_renderer_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_renderer_interface tizen_renderer::m_tizen_renderer_interface = {
- tizen_renderer::handle_get_renderer_surface,
- tizen_renderer::handle_destroy
- };
-
- void tizen_renderer::tizen_renderer_get_renderer_surface(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_renderer::tizen_renderer_destroy(Resource *)
- {
- }
-
-
- void tizen_renderer::handle_get_renderer_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_renderer *>(r->tizen_renderer_object)->tizen_renderer_get_renderer_surface(
- r,
- id,
- surface);
- }
-
- void tizen_renderer::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_renderer *>(r->tizen_renderer_object)->tizen_renderer_destroy(
- r);
- }
-
- tizen_renderer_surface::tizen_renderer_surface(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_renderer_surface::tizen_renderer_surface(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_renderer_surface::tizen_renderer_surface(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_renderer_surface::tizen_renderer_surface()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_renderer_surface::~tizen_renderer_surface()
- {
- std::multimap<struct ::wl_client*, tizen_renderer_surface::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_renderer_surface::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_renderer_surface::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_renderer_surface::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_renderer_surface::Resource *tizen_renderer_surface::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_renderer_surface::Resource *tizen_renderer_surface::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_renderer_surface::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_renderer_surface_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_renderer_surface::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_renderer_surface::interface()
- {
- return &::tizen_renderer_surface_interface;
- }
-
- tizen_renderer_surface::Resource *tizen_renderer_surface::tizen_renderer_surface_allocate()
- {
- return new Resource;
- }
-
- void tizen_renderer_surface::tizen_renderer_surface_bind_resource(Resource *)
- {
- }
-
- void tizen_renderer_surface::tizen_renderer_surface_destroy_resource(Resource *)
- {
- }
-
- void tizen_renderer_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_renderer_surface *that = static_cast<tizen_renderer_surface *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_renderer_surface::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_renderer_surface *that = static_cast<tizen_renderer_surface::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_renderer_surface::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_renderer_surface *that = resource->tizen_renderer_surface_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_renderer_surface_destroy_resource(resource);
- delete resource;
- }
-
- tizen_renderer_surface::Resource *tizen_renderer_surface::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_renderer_surface_interface, version, id);
- return bind(handle);
- }
-
- tizen_renderer_surface::Resource *tizen_renderer_surface::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_renderer_surface_allocate();
- resource->tizen_renderer_surface_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_renderer_surface_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_renderer_surface_bind_resource(resource);
- return resource;
- }
- tizen_renderer_surface::Resource *tizen_renderer_surface::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_renderer_surface_interface, &m_tizen_renderer_surface_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_renderer_surface_interface tizen_renderer_surface::m_tizen_renderer_surface_interface = {
- tizen_renderer_surface::handle_destroy
- };
-
- void tizen_renderer_surface::tizen_renderer_surface_destroy(Resource *)
- {
- }
-
-
- void tizen_renderer_surface::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_renderer_surface *>(r->tizen_renderer_surface_object)->tizen_renderer_surface_destroy(
- r);
- }
-
- void tizen_renderer_surface::send_redraw_request()
- {
- DS_ASSERT_X(m_resource, "tizen_renderer_surface::redraw_request", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_renderer_surface::redraw_request as it's not initialised");
- return;
- }
- send_redraw_request(
- m_resource->handle);
- }
-
- void tizen_renderer_surface::send_redraw_request(struct ::wl_resource *resource)
- {
- tizen_renderer_surface_send_redraw_request(
- resource);
- }
-
-}
-/*LCOV_EXCL_STOP*/
\ No newline at end of file
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-extension.xml */
-
-#ifndef __DS_TIZEN_EXTENSION_PROTOCOL_H__
-#define __DS_TIZEN_EXTENSION_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "tizen-extension-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class tizen_surface
- {
- public:
- tizen_surface(struct ::wl_client *client, uint32_t id, int version);
- tizen_surface(struct ::wl_display *display, int version);
- tizen_surface(struct ::wl_resource *resource);
- tizen_surface();
-
- virtual ~tizen_surface();
-
- class Resource
- {
- public:
- Resource() : tizen_surface_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_surface *tizen_surface_object;
- tizen_surface *object() { return tizen_surface_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tizen_surface_allocate();
-
- virtual void tizen_surface_bind_resource(Resource *resource);
- virtual void tizen_surface_destroy_resource(Resource *resource);
-
- virtual void tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_surface_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_surface_interface m_tizen_surface_interface;
-
- static void handle_get_tizen_resource(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_surface *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_resource
- {
- public:
- tizen_resource(struct ::wl_client *client, uint32_t id, int version);
- tizen_resource(struct ::wl_display *display, int version);
- tizen_resource(struct ::wl_resource *resource);
- tizen_resource();
-
- virtual ~tizen_resource();
-
- class Resource
- {
- public:
- Resource() : tizen_resource_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_resource *tizen_resource_object;
- tizen_resource *object() { return tizen_resource_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_resource_id(uint32_t id);
- void send_resource_id(struct ::wl_resource *resource, uint32_t id);
-
- protected:
- virtual Resource *tizen_resource_allocate();
-
- virtual void tizen_resource_bind_resource(Resource *resource);
- virtual void tizen_resource_destroy_resource(Resource *resource);
-
- virtual void tizen_resource_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_resource_interface m_tizen_resource_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_resource *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_policy
- {
- public:
- tizen_policy(struct ::wl_client *client, uint32_t id, int version);
- tizen_policy(struct ::wl_display *display, int version);
- tizen_policy(struct ::wl_resource *resource);
- tizen_policy();
-
- virtual ~tizen_policy();
-
- class Resource
- {
- public:
- Resource() : tizen_policy_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_policy *tizen_policy_object;
- tizen_policy *object() { return tizen_policy_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum win_type {
- win_type_none = 0,
- win_type_toplevel = 1,
- win_type_fullscreen = 2,
- win_type_maximized = 3,
- win_type_transient = 4,
- win_type_menu = 5,
- win_type_dnd = 6,
- win_type_custom = 7,
- win_type_notification = 8,
- win_type_utility = 9,
- win_type_dialog = 10,
- win_type_dock = 11,
- win_type_splash = 12,
- };
-
- enum conformant_part {
- conformant_part_indicator = 0,
- conformant_part_keyboard = 1,
- conformant_part_clipboard = 2,
- };
-
- enum error_state {
- error_state_none = 0,
- error_state_permission_denied = 1,
- };
-
- enum level {
- level_1 = 0,
- level_2 = 1,
- level_3 = 2,
- level_none = -1,
- level_default = 10,
- level_medium = 20,
- level_high = 30,
- level_top = 40,
- };
-
- enum mode {
- mode_default = 0,
- mode_always_on = 1,
- };
-
- enum stack_mode {
- stack_mode_none = 0,
- stack_mode_above = 1,
- stack_mode_below = 2,
- };
-
- void send_conformant(struct ::wl_resource *surface, uint32_t is_conformant);
- void send_conformant(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t is_conformant);
- void send_conformant_area(struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h);
- void send_conformant_area(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h);
- void send_notification_done(struct ::wl_resource *surface, int32_t level, uint32_t error_state);
- void send_notification_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t level, uint32_t error_state);
- void send_transient_for_done(uint32_t child_id);
- void send_transient_for_done(struct ::wl_resource *resource, uint32_t child_id);
- void send_window_screen_mode_done(struct ::wl_resource *surface, uint32_t mode, uint32_t error_state);
- void send_window_screen_mode_done(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode, uint32_t error_state);
- void send_iconify_state_changed(struct ::wl_resource *surface, uint32_t iconified, uint32_t force);
- void send_iconify_state_changed(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t iconified, uint32_t force);
- void send_supported_aux_hints(struct ::wl_resource *surface, struct ::wl_array *hints, uint32_t num_hints);
- void send_supported_aux_hints(struct ::wl_resource *resource, struct ::wl_resource *surface, struct ::wl_array *hints, uint32_t num_hints);
- void send_allowed_aux_hint(struct ::wl_resource *surface, int32_t id);
- void send_allowed_aux_hint(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t id);
- void send_aux_message(struct ::wl_resource *surface, const std::string &key, const std::string &value, struct ::wl_array *options);
- void send_aux_message(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &key, const std::string &value, struct ::wl_array *options);
- void send_conformant_region(struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial);
- void send_conformant_region(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial);
- void send_interactive_move_done(struct ::wl_resource *surface, int32_t x, int32_t y, uint32_t w, uint32_t h);
- void send_interactive_move_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t x, int32_t y, uint32_t w, uint32_t h);
- void send_interactive_resize_done(struct ::wl_resource *surface, int32_t x, int32_t y, uint32_t w, uint32_t h);
- void send_interactive_resize_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t x, int32_t y, uint32_t w, uint32_t h);
-
- protected:
- virtual Resource *tizen_policy_allocate();
-
- virtual void tizen_policy_bind_resource(Resource *resource);
- virtual void tizen_policy_destroy_resource(Resource *resource);
-
- virtual void tizen_policy_get_visibility(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_policy_get_position(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_policy_activate(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_activate_below_by_res_id(Resource *resource, uint32_t res_id, uint32_t below_res_id);
- virtual void tizen_policy_raise(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_lower(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_lower_by_res_id(Resource *resource, uint32_t res_id);
- virtual void tizen_policy_set_focus_skip(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_unset_focus_skip(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_set_role(Resource *resource, struct ::wl_resource *surface, const std::string &role);
- virtual void tizen_policy_set_type(Resource *resource, struct ::wl_resource *surface, uint32_t win_type);
- virtual void tizen_policy_set_conformant(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_unset_conformant(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_get_conformant(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_set_notification_level(Resource *resource, struct ::wl_resource *surface, int32_t level);
- virtual void tizen_policy_set_transient_for(Resource *resource, uint32_t child_id, uint32_t parent_id);
- virtual void tizen_policy_unset_transient_for(Resource *resource, uint32_t child_id);
- virtual void tizen_policy_set_window_screen_mode(Resource *resource, struct ::wl_resource *surface, uint32_t mode);
- virtual void tizen_policy_place_subsurface_below_parent(Resource *resource, struct ::wl_resource *subsurface);
- virtual void tizen_policy_set_subsurface_stand_alone(Resource *resource, struct ::wl_resource *subsurface);
- virtual void tizen_policy_get_subsurface(Resource *resource, uint32_t id, struct ::wl_resource *surface, uint32_t parent_id);
- virtual void tizen_policy_set_opaque_state(Resource *resource, struct ::wl_resource *surface, int32_t state);
- virtual void tizen_policy_iconify(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_uniconify(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_add_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &name, const std::string &value);
- virtual void tizen_policy_change_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &value);
- virtual void tizen_policy_del_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id);
- virtual void tizen_policy_get_supported_aux_hints(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_set_background_state(Resource *resource, uint32_t pid);
- virtual void tizen_policy_unset_background_state(Resource *resource, uint32_t pid);
- virtual void tizen_policy_set_floating_mode(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_unset_floating_mode(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_set_stack_mode(Resource *resource, struct ::wl_resource *surface, uint32_t mode);
- virtual void tizen_policy_activate_above_by_res_id(Resource *resource, uint32_t res_id, uint32_t above_res_id);
- virtual void tizen_policy_get_subsurface_watcher(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_policy_set_parent(Resource *resource, struct ::wl_resource *child, struct ::wl_resource *parent);
- virtual void tizen_policy_ack_conformant_region(Resource *resource, struct ::wl_resource *surface, uint32_t serial);
- virtual void tizen_policy_destroy(Resource *resource);
- virtual void tizen_policy_has_video(Resource *resource, struct ::wl_resource *surface, uint32_t has);
- virtual void tizen_policy_set_appid(Resource *resource, int32_t pid, const std::string &appid);
- virtual void tizen_policy_show(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_hide(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_policy_set_transient_for_below(Resource *resource, uint32_t child_id, uint32_t parent_id);
- virtual void tizen_policy_set_parent_with_below(Resource *resource, struct ::wl_resource *child, struct ::wl_resource *parent);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_policy_interface m_tizen_policy_interface;
-
- static void handle_get_visibility(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_get_position(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_activate(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_activate_below_by_res_id(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t res_id,
- uint32_t below_res_id);
- static void handle_raise(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_lower(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_lower_by_res_id(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t res_id);
- static void handle_set_focus_skip(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_unset_focus_skip(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_set_role(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- const char *role);
- static void handle_set_type(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t win_type);
- static void handle_set_conformant(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_unset_conformant(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_get_conformant(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_set_notification_level(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t level);
- static void handle_set_transient_for(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t child_id,
- uint32_t parent_id);
- static void handle_unset_transient_for(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t child_id);
- static void handle_set_window_screen_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t mode);
- static void handle_place_subsurface_below_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *subsurface);
- static void handle_set_subsurface_stand_alone(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *subsurface);
- static void handle_get_subsurface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface,
- uint32_t parent_id);
- static void handle_set_opaque_state(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t state);
- static void handle_iconify(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_uniconify(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_add_aux_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t id,
- const char *name,
- const char *value);
- static void handle_change_aux_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t id,
- const char *value);
- static void handle_del_aux_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t id);
- static void handle_get_supported_aux_hints(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_set_background_state(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid);
- static void handle_unset_background_state(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid);
- static void handle_set_floating_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_unset_floating_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_set_stack_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t mode);
- static void handle_activate_above_by_res_id(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t res_id,
- uint32_t above_res_id);
- static void handle_get_subsurface_watcher(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_set_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *child,
- struct ::wl_resource *parent);
- static void handle_ack_conformant_region(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t serial);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_has_video(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t has);
- static void handle_set_appid(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t pid,
- const char *appid);
- static void handle_show(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_hide(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_set_transient_for_below(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t child_id,
- uint32_t parent_id);
- static void handle_set_parent_with_below(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *child,
- struct ::wl_resource *parent);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_policy *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_visibility
- {
- public:
- tizen_visibility(struct ::wl_client *client, uint32_t id, int version);
- tizen_visibility(struct ::wl_display *display, int version);
- tizen_visibility(struct ::wl_resource *resource);
- tizen_visibility();
-
- virtual ~tizen_visibility();
-
- class Resource
- {
- public:
- Resource() : tizen_visibility_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_visibility *tizen_visibility_object;
- tizen_visibility *object() { return tizen_visibility_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum visibility {
- visibility_unobscured = 0,
- visibility_partially_obscured = 1,
- visibility_fully_obscured = 2,
- visibility_pre_unobscured = 3,
- };
-
- void send_notify(uint32_t visibility);
- void send_notify(struct ::wl_resource *resource, uint32_t visibility);
- void send_changed(uint32_t type, uint32_t option);
- void send_changed(struct ::wl_resource *resource, uint32_t type, uint32_t option);
-
- protected:
- virtual Resource *tizen_visibility_allocate();
-
- virtual void tizen_visibility_bind_resource(Resource *resource);
- virtual void tizen_visibility_destroy_resource(Resource *resource);
-
- virtual void tizen_visibility_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_visibility_interface m_tizen_visibility_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_visibility *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_position
- {
- public:
- tizen_position(struct ::wl_client *client, uint32_t id, int version);
- tizen_position(struct ::wl_display *display, int version);
- tizen_position(struct ::wl_resource *resource);
- tizen_position();
-
- virtual ~tizen_position();
-
- class Resource
- {
- public:
- Resource() : tizen_position_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_position *tizen_position_object;
- tizen_position *object() { return tizen_position_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_changed(int32_t x, int32_t y);
- void send_changed(struct ::wl_resource *resource, int32_t x, int32_t y);
-
- protected:
- virtual Resource *tizen_position_allocate();
-
- virtual void tizen_position_bind_resource(Resource *resource);
- virtual void tizen_position_destroy_resource(Resource *resource);
-
- virtual void tizen_position_destroy(Resource *resource);
- virtual void tizen_position_set(Resource *resource, int32_t x, int32_t y);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_position_interface m_tizen_position_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_position *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_move_resize
- {
- public:
- tizen_move_resize(struct ::wl_client *client, uint32_t id, int version);
- tizen_move_resize(struct ::wl_display *display, int version);
- tizen_move_resize(struct ::wl_resource *resource);
- tizen_move_resize();
-
- virtual ~tizen_move_resize();
-
- class Resource
- {
- public:
- Resource() : tizen_move_resize_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_move_resize *tizen_move_resize_object;
- tizen_move_resize *object() { return tizen_move_resize_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error_state {
- error_state_none = 0,
- error_state_invalid_buffer = 1,
- error_state_not_supported = 2,
- };
-
- void send_geometry_done(struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t error_state);
- void send_geometry_done(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t error_state);
-
- protected:
- virtual Resource *tizen_move_resize_allocate();
-
- virtual void tizen_move_resize_bind_resource(Resource *resource);
- virtual void tizen_move_resize_destroy_resource(Resource *resource);
-
- virtual void tizen_move_resize_destroy(Resource *resource);
- virtual void tizen_move_resize_set_geometry(Resource *resource, struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_move_resize_interface m_tizen_move_resize_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t serial,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_move_resize *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_gesture
- {
- public:
- tizen_gesture(struct ::wl_client *client, uint32_t id, int version);
- tizen_gesture(struct ::wl_display *display, int version);
- tizen_gesture(struct ::wl_resource *resource);
- tizen_gesture();
-
- virtual ~tizen_gesture();
-
- class Resource
- {
- public:
- Resource() : tizen_gesture_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_gesture *tizen_gesture_object;
- tizen_gesture *object() { return tizen_gesture_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_none = 0,
- error_invalid_data = 1,
- error_no_permission = 2,
- error_no_system_resources = 3,
- error_grabbed_already = 4,
- error_not_supported = 5,
- };
-
- enum type {
- type_edge_swipe = 1,
- type_edge_drag = 2,
- type_tap = 4,
- type_palm_cover = 8,
- type_pan = 16,
- type_pinch = 32,
- type_palm_swipe = 64,
- };
-
- enum mode {
- mode_begin = 1,
- mode_update = 2,
- mode_end = 3,
- mode_done = 4,
- };
-
- enum edge {
- edge_top = 1,
- edge_right = 2,
- edge_bottom = 3,
- edge_left = 4,
- };
-
- enum edge_size {
- edge_size_none = 0,
- edge_size_full = 1,
- edge_size_partial = 2,
- };
-
- void send_grab_edge_swipe_notify(uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error);
- void send_grab_edge_swipe_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error);
- void send_edge_swipe(uint32_t mode, uint32_t fingers, int32_t sx, int32_t sy, uint32_t edge);
- void send_edge_swipe(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, int32_t sx, int32_t sy, uint32_t edge);
- void send_edge_drag_notify(uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error);
- void send_edge_drag_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error);
- void send_edge_drag(uint32_t mode, uint32_t fingers, int32_t cx, int32_t cy, uint32_t edge);
- void send_edge_drag(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, int32_t cx, int32_t cy, uint32_t edge);
- void send_tap_notify(uint32_t fingers, uint32_t repeats, uint32_t error);
- void send_tap_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t repeats, uint32_t error);
- void send_tap(uint32_t mode, uint32_t fingers, uint32_t repeats);
- void send_tap(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, uint32_t repeats);
- void send_palm_cover_notify(struct ::wl_resource *surface, uint32_t error);
- void send_palm_cover_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t error);
- void send_palm_cover(struct ::wl_resource *surface, uint32_t mode, uint32_t duration, int32_t cx, int32_t cy, uint32_t size, wl_fixed_t pressure);
- void send_palm_cover(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode, uint32_t duration, int32_t cx, int32_t cy, uint32_t size, wl_fixed_t pressure);
- void send_activate_notify(struct ::wl_resource *surface, uint32_t type, uint32_t active, uint32_t error);
- void send_activate_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type, uint32_t active, uint32_t error);
-
- protected:
- virtual Resource *tizen_gesture_allocate();
-
- virtual void tizen_gesture_bind_resource(Resource *resource);
- virtual void tizen_gesture_destroy_resource(Resource *resource);
-
- virtual void tizen_gesture_grab_edge_swipe(Resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point);
- virtual void tizen_gesture_ungrab_edge_swipe(Resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point);
- virtual void tizen_gesture_grab_edge_drag(Resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point);
- virtual void tizen_gesture_ungrab_edge_drag(Resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point);
- virtual void tizen_gesture_grab_tap(Resource *resource, uint32_t fingers, uint32_t repeats);
- virtual void tizen_gesture_ungrab_tap(Resource *resource, uint32_t fingers, uint32_t repeats);
- virtual void tizen_gesture_grab_palm_cover(Resource *resource);
- virtual void tizen_gesture_ungrab_palm_cover(Resource *resource);
- virtual void tizen_gesture_select_palm_cover(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_gesture_deselect_palm_cover(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_gesture_activate_set(Resource *resource, struct ::wl_resource *surface, uint32_t type, uint32_t active);
- virtual void tizen_gesture_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_gesture_interface m_tizen_gesture_interface;
-
- static void handle_grab_edge_swipe(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t edge,
- uint32_t edge_size,
- uint32_t start_point,
- uint32_t end_point);
- static void handle_ungrab_edge_swipe(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t edge,
- uint32_t edge_size,
- uint32_t start_point,
- uint32_t end_point);
- static void handle_grab_edge_drag(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t edge,
- uint32_t edge_size,
- uint32_t start_point,
- uint32_t end_point);
- static void handle_ungrab_edge_drag(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t edge,
- uint32_t edge_size,
- uint32_t start_point,
- uint32_t end_point);
- static void handle_grab_tap(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t repeats);
- static void handle_ungrab_tap(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t fingers,
- uint32_t repeats);
- static void handle_grab_palm_cover(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_ungrab_palm_cover(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_select_palm_cover(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_deselect_palm_cover(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_activate_set(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t type,
- uint32_t active);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_gesture *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_keyrouter
- {
- public:
- tizen_keyrouter(struct ::wl_client *client, uint32_t id, int version);
- tizen_keyrouter(struct ::wl_display *display, int version);
- tizen_keyrouter(struct ::wl_resource *resource);
- tizen_keyrouter();
-
- virtual ~tizen_keyrouter();
-
- class Resource
- {
- public:
- Resource() : tizen_keyrouter_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_keyrouter *tizen_keyrouter_object;
- tizen_keyrouter *object() { return tizen_keyrouter_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_none = 0, // no error
- error_invalid_surface = 1, // Given surface is invalid.
- error_invalid_key = 2, // Given key is invalid.
- error_invalid_mode = 3, // Given mode is invalid.
- error_grabbed_already = 4, // The key has been grabbed already.
- error_no_permission = 5, // The wl client has no permission to grab the key.
- error_no_system_resources = 6, // System resources are insufficient.
- error_invalid_array = 7, // Given array has invalid pairs or data type.
- };
-
- enum mode {
- mode_none = 0, // none
- mode_shared = 1, // mode to get a key grab with the other client surfaces when the focused client surface gets the key
- mode_topmost = 2, // mode to get a key grab when the client surface is the top most surface
- mode_overridable_exclusive = 3, // mode to get a key grab exclusively, overridably regardless of the order in the surface stack
- mode_exclusive = 4, // mode to get a key grab exclusively regardless of the order in surface stack
- mode_registered = 5, // mode to get a key grab only when a requesting surface is on top among the registering surfaces for the key
- };
-
- enum config_mode {
- config_mode_none = 0, // none
- config_mode_invisible_set = 1, // mode to set window to enable send event to invisible window below in stack
- config_mode_invisible_get = 2, // mode to set window to get event to invisible state if any top window has set register_set
- config_mode_num_key_focus = 3, // mode to register for num keys for focus window
- config_mode_picture_off = 4, // mode to set picture off for particular key
- };
-
- void send_keygrab_notify(struct ::wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error);
- void send_keygrab_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error);
- void send_keygrab_notify_list(struct ::wl_resource *surface, struct ::wl_array *grab_result);
- void send_keygrab_notify_list(struct ::wl_resource *resource, struct ::wl_resource *surface, struct ::wl_array *grab_result);
- void send_getgrab_notify_list(struct ::wl_resource *surface, struct ::wl_array *grab_result);
- void send_getgrab_notify_list(struct ::wl_resource *resource, struct ::wl_resource *surface, struct ::wl_array *grab_result);
- void send_set_register_none_key_notify(struct ::wl_resource *surface, uint32_t mode);
- void send_set_register_none_key_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode);
- void send_keyregister_notify(uint32_t status);
- void send_keyregister_notify(struct ::wl_resource *resource, uint32_t status);
- void send_set_input_config_notify(uint32_t status);
- void send_set_input_config_notify(struct ::wl_resource *resource, uint32_t status);
- void send_key_cancel(uint32_t key);
- void send_key_cancel(struct ::wl_resource *resource, uint32_t key);
- void send_event_surface(struct ::wl_resource *surface, uint32_t key, uint32_t mode);
- void send_event_surface(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode);
-
- protected:
- virtual Resource *tizen_keyrouter_allocate();
-
- virtual void tizen_keyrouter_bind_resource(Resource *resource);
- virtual void tizen_keyrouter_destroy_resource(Resource *resource);
-
- virtual void tizen_keyrouter_set_keygrab(Resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode);
- virtual void tizen_keyrouter_unset_keygrab(Resource *resource, struct ::wl_resource *surface, uint32_t key);
- virtual void tizen_keyrouter_get_keygrab_status(Resource *resource, struct ::wl_resource *surface, uint32_t key);
- virtual void tizen_keyrouter_set_keygrab_list(Resource *resource, struct ::wl_resource *surface, struct ::wl_array *grab_list);
- virtual void tizen_keyrouter_unset_keygrab_list(Resource *resource, struct ::wl_resource *surface, struct ::wl_array *ungrab_list);
- virtual void tizen_keyrouter_get_keygrab_list(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_keyrouter_set_register_none_key(Resource *resource, struct ::wl_resource *surface, uint32_t data);
- virtual void tizen_keyrouter_get_keyregister_status(Resource *resource, uint32_t data);
- virtual void tizen_keyrouter_set_input_config(Resource *resource, struct ::wl_resource *surface, uint32_t config_mode, uint32_t value);
- virtual void tizen_keyrouter_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_keyrouter_interface m_tizen_keyrouter_interface;
-
- static void handle_set_keygrab(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t key,
- uint32_t mode);
- static void handle_unset_keygrab(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t key);
- static void handle_get_keygrab_status(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t key);
- static void handle_set_keygrab_list(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- struct ::wl_array *grab_list);
- static void handle_unset_keygrab_list(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- struct ::wl_array *ungrab_list);
- static void handle_get_keygrab_list(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_set_register_none_key(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t data);
- static void handle_get_keyregister_status(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t data);
- static void handle_set_input_config(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t config_mode,
- uint32_t value);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_keyrouter *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_screenshooter
- {
- public:
- tizen_screenshooter(struct ::wl_client *client, uint32_t id, int version);
- tizen_screenshooter(struct ::wl_display *display, int version);
- tizen_screenshooter(struct ::wl_resource *resource);
- tizen_screenshooter();
-
- virtual ~tizen_screenshooter();
-
- class Resource
- {
- public:
- Resource() : tizen_screenshooter_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_screenshooter *tizen_screenshooter_object;
- tizen_screenshooter *object() { return tizen_screenshooter_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_format(uint32_t format);
- void send_format(struct ::wl_resource *resource, uint32_t format);
- void send_screenshooter_notify(uint32_t noti);
- void send_screenshooter_notify(struct ::wl_resource *resource, uint32_t noti);
-
- protected:
- virtual Resource *tizen_screenshooter_allocate();
-
- virtual void tizen_screenshooter_bind_resource(Resource *resource);
- virtual void tizen_screenshooter_destroy_resource(Resource *resource);
-
- virtual void tizen_screenshooter_get_screenmirror(Resource *resource, uint32_t id, struct ::wl_resource *output);
- virtual void tizen_screenshooter_set_oneshot_auto_rotation(Resource *resource, uint32_t set);
- virtual void tizen_screenshooter_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_screenshooter_interface m_tizen_screenshooter_interface;
-
- static void handle_get_screenmirror(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *output);
- static void handle_set_oneshot_auto_rotation(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_screenshooter *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_screenmirror
- {
- public:
- tizen_screenmirror(struct ::wl_client *client, uint32_t id, int version);
- tizen_screenmirror(struct ::wl_display *display, int version);
- tizen_screenmirror(struct ::wl_resource *resource);
- tizen_screenmirror();
-
- virtual ~tizen_screenmirror();
-
- class Resource
- {
- public:
- Resource() : tizen_screenmirror_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_screenmirror *tizen_screenmirror_object;
- tizen_screenmirror *object() { return tizen_screenmirror_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum content {
- content_normal = 0,
- content_video = 1,
- };
-
- enum stretch {
- stretch_keep_ratio = 0,
- stretch_fully = 1,
- };
-
- void send_dequeued(struct ::wl_resource *buffer);
- void send_dequeued(struct ::wl_resource *resource, struct ::wl_resource *buffer);
- void send_content(uint32_t content);
- void send_content(struct ::wl_resource *resource, uint32_t content);
- void send_stop();
- void send_stop(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *tizen_screenmirror_allocate();
-
- virtual void tizen_screenmirror_bind_resource(Resource *resource);
- virtual void tizen_screenmirror_destroy_resource(Resource *resource);
-
- virtual void tizen_screenmirror_destroy(Resource *resource);
- virtual void tizen_screenmirror_set_stretch(Resource *resource, uint32_t stretch);
- virtual void tizen_screenmirror_queue(Resource *resource, struct ::wl_resource *buffer);
- virtual void tizen_screenmirror_dequeue(Resource *resource, struct ::wl_resource *buffer);
- virtual void tizen_screenmirror_start(Resource *resource);
- virtual void tizen_screenmirror_stop(Resource *resource);
- virtual void tizen_screenmirror_set_auto_rotation(Resource *resource, uint32_t set);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_screenmirror_interface m_tizen_screenmirror_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_stretch(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t stretch);
- static void handle_queue(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *buffer);
- static void handle_dequeue(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *buffer);
- static void handle_start(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_stop(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_auto_rotation(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_screenmirror *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_video
- {
- public:
- tizen_video(struct ::wl_client *client, uint32_t id, int version);
- tizen_video(struct ::wl_display *display, int version);
- tizen_video(struct ::wl_resource *resource);
- tizen_video();
-
- virtual ~tizen_video();
-
- class Resource
- {
- public:
- Resource() : tizen_video_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_video *tizen_video_object;
- tizen_video *object() { return tizen_video_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_none = 0,
- error_object_exists = 1,
- error_viewport_exists = 2,
- };
-
- void send_format(uint32_t format);
- void send_format(struct ::wl_resource *resource, uint32_t format);
-
- protected:
- virtual Resource *tizen_video_allocate();
-
- virtual void tizen_video_bind_resource(Resource *resource);
- virtual void tizen_video_destroy_resource(Resource *resource);
-
- virtual void tizen_video_get_object(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_video_get_viewport(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_video_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_video_interface m_tizen_video_interface;
-
- static void handle_get_object(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_get_viewport(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_video *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_video_object
- {
- public:
- tizen_video_object(struct ::wl_client *client, uint32_t id, int version);
- tizen_video_object(struct ::wl_display *display, int version);
- tizen_video_object(struct ::wl_resource *resource);
- tizen_video_object();
-
- virtual ~tizen_video_object();
-
- class Resource
- {
- public:
- Resource() : tizen_video_object_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_video_object *tizen_video_object_object;
- tizen_video_object *object() { return tizen_video_object_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_attribute(const std::string &name, uint32_t value);
- void send_attribute(struct ::wl_resource *resource, const std::string &name, uint32_t value);
- void send_size(int32_t min_w, int32_t min_h, int32_t max_w, int32_t max_h, int32_t prefer_align);
- void send_size(struct ::wl_resource *resource, int32_t min_w, int32_t min_h, int32_t max_w, int32_t max_h, int32_t prefer_align);
-
- protected:
- virtual Resource *tizen_video_object_allocate();
-
- virtual void tizen_video_object_bind_resource(Resource *resource);
- virtual void tizen_video_object_destroy_resource(Resource *resource);
-
- virtual void tizen_video_object_destroy(Resource *resource);
- virtual void tizen_video_object_set_attribute(Resource *resource, const std::string &name, int32_t value);
- virtual void tizen_video_object_follow_topmost_visibility(Resource *resource);
- virtual void tizen_video_object_unfollow_topmost_visibility(Resource *resource);
- virtual void tizen_video_object_allowed_attribute(Resource *resource);
- virtual void tizen_video_object_disallowed_attribute(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_video_object_interface m_tizen_video_object_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_attribute(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *name,
- int32_t value);
- static void handle_follow_topmost_visibility(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_unfollow_topmost_visibility(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_allowed_attribute(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_disallowed_attribute(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_video_object *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_subsurface_watcher
- {
- public:
- tizen_subsurface_watcher(struct ::wl_client *client, uint32_t id, int version);
- tizen_subsurface_watcher(struct ::wl_display *display, int version);
- tizen_subsurface_watcher(struct ::wl_resource *resource);
- tizen_subsurface_watcher();
-
- virtual ~tizen_subsurface_watcher();
-
- class Resource
- {
- public:
- Resource() : tizen_subsurface_watcher_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_subsurface_watcher *tizen_subsurface_watcher_object;
- tizen_subsurface_watcher *object() { return tizen_subsurface_watcher_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum msg {
- msg_success = 0,
- msg_parent_id_invalid = 1,
- msg_parent_id_destroyed = 2,
- };
-
- void send_message(uint32_t value);
- void send_message(struct ::wl_resource *resource, uint32_t value);
-
- protected:
- virtual Resource *tizen_subsurface_watcher_allocate();
-
- virtual void tizen_subsurface_watcher_bind_resource(Resource *resource);
- virtual void tizen_subsurface_watcher_destroy_resource(Resource *resource);
-
- virtual void tizen_subsurface_watcher_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_subsurface_watcher_interface m_tizen_subsurface_watcher_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_subsurface_watcher *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_viewport
- {
- public:
- tizen_viewport(struct ::wl_client *client, uint32_t id, int version);
- tizen_viewport(struct ::wl_display *display, int version);
- tizen_viewport(struct ::wl_resource *resource);
- tizen_viewport();
-
- virtual ~tizen_viewport();
-
- class Resource
- {
- public:
- Resource() : tizen_viewport_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_viewport *tizen_viewport_object;
- tizen_viewport *object() { return tizen_viewport_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_destination_changed(uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height);
- void send_destination_changed(struct ::wl_resource *resource, uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height);
- void send_parent_size(uint32_t width, uint32_t height);
- void send_parent_size(struct ::wl_resource *resource, uint32_t width, uint32_t height);
-
- protected:
- virtual Resource *tizen_viewport_allocate();
-
- virtual void tizen_viewport_bind_resource(Resource *resource);
- virtual void tizen_viewport_destroy_resource(Resource *resource);
-
- virtual void tizen_viewport_destroy(Resource *resource);
- virtual void tizen_viewport_set_transform(Resource *resource, uint32_t transform);
- virtual void tizen_viewport_set_source(Resource *resource, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
- virtual void tizen_viewport_set_destination(Resource *resource, int32_t x, int32_t y, uint32_t width, uint32_t height);
- virtual void tizen_viewport_set_destination_ratio(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height);
- virtual void tizen_viewport_get_destination_mode(Resource *resource, uint32_t id);
- virtual void tizen_viewport_query_parent_size(Resource *resource);
- virtual void tizen_viewport_follow_parent_transform(Resource *resource);
- virtual void tizen_viewport_unfollow_parent_transform(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_viewport_interface m_tizen_viewport_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_transform(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t transform);
- static void handle_set_source(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t x,
- uint32_t y,
- uint32_t width,
- uint32_t height);
- static void handle_set_destination(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- uint32_t width,
- uint32_t height);
- static void handle_set_destination_ratio(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t x,
- wl_fixed_t y,
- wl_fixed_t width,
- wl_fixed_t height);
- static void handle_get_destination_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_query_parent_size(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_follow_parent_transform(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_unfollow_parent_transform(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_viewport *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_destination_mode
- {
- public:
- tizen_destination_mode(struct ::wl_client *client, uint32_t id, int version);
- tizen_destination_mode(struct ::wl_display *display, int version);
- tizen_destination_mode(struct ::wl_resource *resource);
- tizen_destination_mode();
-
- virtual ~tizen_destination_mode();
-
- class Resource
- {
- public:
- Resource() : tizen_destination_mode_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_destination_mode *tizen_destination_mode_object;
- tizen_destination_mode *object() { return tizen_destination_mode_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_type = 0,
- };
-
- enum type {
- type_none = 0,
- type_letter_box = 1,
- type_origin = 2,
- type_full = 3,
- type_cropped_full = 4,
- type_origin_or_letter = 5,
- };
-
- protected:
- virtual Resource *tizen_destination_mode_allocate();
-
- virtual void tizen_destination_mode_bind_resource(Resource *resource);
- virtual void tizen_destination_mode_destroy_resource(Resource *resource);
-
- virtual void tizen_destination_mode_destroy(Resource *resource);
- virtual void tizen_destination_mode_follow_parent_transform(Resource *resource);
- virtual void tizen_destination_mode_unfollow_parent_transform(Resource *resource);
- virtual void tizen_destination_mode_set(Resource *resource, uint32_t mode);
- virtual void tizen_destination_mode_set_ratio(Resource *resource, wl_fixed_t horizontal, wl_fixed_t vertical);
- virtual void tizen_destination_mode_set_scale(Resource *resource, wl_fixed_t horizontal, wl_fixed_t vertical);
- virtual void tizen_destination_mode_set_align(Resource *resource, wl_fixed_t horizontal, wl_fixed_t vertical);
- virtual void tizen_destination_mode_set_offset(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_destination_mode_interface m_tizen_destination_mode_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_follow_parent_transform(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_unfollow_parent_transform(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t mode);
- static void handle_set_ratio(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t horizontal,
- wl_fixed_t vertical);
- static void handle_set_scale(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t horizontal,
- wl_fixed_t vertical);
- static void handle_set_align(
- ::wl_client *client,
- struct wl_resource *resource,
- wl_fixed_t horizontal,
- wl_fixed_t vertical);
- static void handle_set_offset(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_destination_mode *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_embedded_compositor
- {
- public:
- tizen_embedded_compositor(struct ::wl_client *client, uint32_t id, int version);
- tizen_embedded_compositor(struct ::wl_display *display, int version);
- tizen_embedded_compositor(struct ::wl_resource *resource);
- tizen_embedded_compositor();
-
- virtual ~tizen_embedded_compositor();
-
- class Resource
- {
- public:
- Resource() : tizen_embedded_compositor_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_embedded_compositor *tizen_embedded_compositor_object;
- tizen_embedded_compositor *object() { return tizen_embedded_compositor_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_socket(int32_t sock_fd);
- void send_socket(struct ::wl_resource *resource, int32_t sock_fd);
-
- protected:
- virtual Resource *tizen_embedded_compositor_allocate();
-
- virtual void tizen_embedded_compositor_bind_resource(Resource *resource);
- virtual void tizen_embedded_compositor_destroy_resource(Resource *resource);
-
- virtual void tizen_embedded_compositor_get_socket(Resource *resource);
- virtual void tizen_embedded_compositor_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_embedded_compositor_interface m_tizen_embedded_compositor_interface;
-
- static void handle_get_socket(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_embedded_compositor *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_input_device_manager
- {
- public:
- tizen_input_device_manager(struct ::wl_client *client, uint32_t id, int version);
- tizen_input_device_manager(struct ::wl_display *display, int version);
- tizen_input_device_manager(struct ::wl_resource *resource);
- tizen_input_device_manager();
-
- virtual ~tizen_input_device_manager();
-
- class Resource
- {
- public:
- Resource() : tizen_input_device_manager_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_input_device_manager *tizen_input_device_manager_object;
- tizen_input_device_manager *object() { return tizen_input_device_manager_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum clas {
- clas_none = 0, // none of class
- clas_mouse = 1, // mouse class
- clas_keyboard = 2, // keyboard class
- clas_touchscreen = 4, // touchscreen class
- };
-
- enum error {
- error_none = 0, // no error
- error_no_permission = 1, // no permission
- error_invalid_class = 2, // invalid class
- error_blocked_already = 3, // blocked already by the other client
- error_no_system_resources = 4, // no system resources such as memory lack
- error_invalid_parameter = 5, // argument is invalid
- error_invalid_surface = 6, // the given surface is not visible or pointer is not on the given surface
- error_no_pointer_available = 7, // there is no pointer available to warp
- error_not_allowed = 8, // this request is not allowed in this system
- };
-
- enum pointer_event_type {
- pointer_event_type_begin = 0,
- pointer_event_type_update = 1,
- pointer_event_type_end = 2,
- };
-
- enum axis_type {
- axis_type_none = 0, // no axis type
- axis_type_wheel = 1, // pointer vertical wheel axis
- axis_type_hwheel = 2, // pointer horizental wheel axis
- axis_type_radius_x = 3, // touch radius of x axis of an event area e.g. touching area with a finger or a pen
- axis_type_radius_y = 4, // touch radius of y axis of an event area e.g. touching area with a finger or a pen
- axis_type_pressure = 5, // touch pressure in an event area e.g. touching area with a finger or a pen
- axis_type_angle = 6, // touch angle in an event area e.g. touching area with a finger or a pen
- axis_type_palm = 7, // touch palm in an event area e.g. touching area with a finger or a pen
- };
-
- void send_device_add(uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat);
- void send_device_add(struct ::wl_resource *resource, uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat);
- void send_device_remove(uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat);
- void send_device_remove(struct ::wl_resource *resource, uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat);
- void send_error(uint32_t errorcode);
- void send_error(struct ::wl_resource *resource, uint32_t errorcode);
- void send_block_expired();
- void send_block_expired(struct ::wl_resource *resource);
- void send_max_touch_count(uint32_t serial, int32_t max_count, struct ::wl_resource *seat);
- void send_max_touch_count(struct ::wl_resource *resource, uint32_t serial, int32_t max_count, struct ::wl_resource *seat);
-
- protected:
- virtual Resource *tizen_input_device_manager_allocate();
-
- virtual void tizen_input_device_manager_bind_resource(Resource *resource);
- virtual void tizen_input_device_manager_destroy_resource(Resource *resource);
-
- virtual void tizen_input_device_manager_block_events(Resource *resource, uint32_t serial, uint32_t clas, uint32_t duration);
- virtual void tizen_input_device_manager_unblock_events(Resource *resource, uint32_t serial);
- virtual void tizen_input_device_manager_init_generator(Resource *resource, uint32_t clas);
- virtual void tizen_input_device_manager_deinit_generator(Resource *resource, uint32_t clas);
- virtual void tizen_input_device_manager_generate_key(Resource *resource, const std::string &keyname, uint32_t pressed);
- virtual void tizen_input_device_manager_generate_pointer(Resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t button);
- virtual void tizen_input_device_manager_generate_touch(Resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t finger);
- virtual void tizen_input_device_manager_pointer_warp(Resource *resource, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y);
- virtual void tizen_input_device_manager_init_generator_with_name(Resource *resource, uint32_t clas, const std::string &name);
- virtual void tizen_input_device_manager_destroy(Resource *resource);
- virtual void tizen_input_device_manager_generate_axis(Resource *resource, uint32_t type, wl_fixed_t value);
- virtual void tizen_input_device_manager_set_touch_count(Resource *resource, int32_t max_count);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_input_device_manager_interface m_tizen_input_device_manager_interface;
-
- static void handle_block_events(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- uint32_t clas,
- uint32_t duration);
- static void handle_unblock_events(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void handle_init_generator(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t clas);
- static void handle_deinit_generator(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t clas);
- static void handle_generate_key(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *keyname,
- uint32_t pressed);
- static void handle_generate_pointer(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type,
- uint32_t x,
- uint32_t y,
- uint32_t button);
- static void handle_generate_touch(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type,
- uint32_t x,
- uint32_t y,
- uint32_t finger);
- static void handle_pointer_warp(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- wl_fixed_t x,
- wl_fixed_t y);
- static void handle_init_generator_with_name(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t clas,
- const char *name);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_generate_axis(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type,
- wl_fixed_t value);
- static void handle_set_touch_count(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t max_count);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_input_device_manager *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_input_device
- {
- public:
- tizen_input_device(struct ::wl_client *client, uint32_t id, int version);
- tizen_input_device(struct ::wl_display *display, int version);
- tizen_input_device(struct ::wl_resource *resource);
- tizen_input_device();
-
- virtual ~tizen_input_device();
-
- class Resource
- {
- public:
- Resource() : tizen_input_device_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_input_device *tizen_input_device_object;
- tizen_input_device *object() { return tizen_input_device_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum clas {
- clas_none = 0, // none of class
- clas_keyboard = 2, // keyboard class
- clas_mouse = 3, // mouse class
- clas_touchscreen = 4, // touchscreen class
- };
-
- enum subclas {
- subclas_none = 0, // none of subclass
- };
-
- enum axis_type {
- axis_type_none = 0, // radius of x axis of an event area e.g. touching area with a finger or a pen
- axis_type_radius_x = 1, // radius of x axis of an event area e.g. touching area with a finger or a pen
- axis_type_radius_y = 2, // radius of y axis of an event area e.g. touching area with a finger or a pen
- axis_type_pressure = 3, // pressure in an event area e.g. touching area with a finger or a pen
- axis_type_angle = 4, // angle in an event area e.g. touching area with a finger or a pen
- axis_type_detent = 5, // detent value e.g. moved distance with a rotary device
- };
-
- void send_device_info(const std::string &name, uint32_t clas, uint32_t subclas, struct ::wl_array *axes);
- void send_device_info(struct ::wl_resource *resource, const std::string &name, uint32_t clas, uint32_t subclas, struct ::wl_array *axes);
- void send_event_device(uint32_t serial, const std::string &name, uint32_t time);
- void send_event_device(struct ::wl_resource *resource, uint32_t serial, const std::string &name, uint32_t time);
- void send_axis(uint32_t axis_type, wl_fixed_t value);
- void send_axis(struct ::wl_resource *resource, uint32_t axis_type, wl_fixed_t value);
-
- protected:
- virtual Resource *tizen_input_device_allocate();
-
- virtual void tizen_input_device_bind_resource(Resource *resource);
- virtual void tizen_input_device_destroy_resource(Resource *resource);
-
- virtual void tizen_input_device_select_axes(Resource *resource, struct ::wl_array *axes);
- virtual void tizen_input_device_release(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_input_device_interface m_tizen_input_device_interface;
-
- static void handle_select_axes(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_array *axes);
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_input_device *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_launchscreen
- {
- public:
- tizen_launchscreen(struct ::wl_client *client, uint32_t id, int version);
- tizen_launchscreen(struct ::wl_display *display, int version);
- tizen_launchscreen(struct ::wl_resource *resource);
- tizen_launchscreen();
-
- virtual ~tizen_launchscreen();
-
- class Resource
- {
- public:
- Resource() : tizen_launchscreen_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_launchscreen *tizen_launchscreen_object;
- tizen_launchscreen *object() { return tizen_launchscreen_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tizen_launchscreen_allocate();
-
- virtual void tizen_launchscreen_bind_resource(Resource *resource);
- virtual void tizen_launchscreen_destroy_resource(Resource *resource);
-
- virtual void tizen_launchscreen_create_img(Resource *resource, uint32_t id);
- virtual void tizen_launchscreen_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_launchscreen_interface m_tizen_launchscreen_interface;
-
- static void handle_create_img(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_launchscreen *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_launch_image
- {
- public:
- tizen_launch_image(struct ::wl_client *client, uint32_t id, int version);
- tizen_launch_image(struct ::wl_display *display, int version);
- tizen_launch_image(struct ::wl_resource *resource);
- tizen_launch_image();
-
- virtual ~tizen_launch_image();
-
- class Resource
- {
- public:
- Resource() : tizen_launch_image_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_launch_image *tizen_launch_image_object;
- tizen_launch_image *object() { return tizen_launch_image_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum file_type {
- file_type_img = 0, // splash image file path
- file_type_edj = 1, // splash edj file path
- };
-
- enum indicator {
- indicator_off = 0, // splash hide indicator
- indicator_on = 1, // splash show indicator
- };
-
- enum rotation {
- rotation_0 = 0, // rotation angle 0 degree
- rotation_90 = 90, // rotation angle 90 degree
- rotation_180 = 180, // rotation angle 180 degree
- rotation_270 = 270, // rotation angle 270 degree
- };
-
- protected:
- virtual Resource *tizen_launch_image_allocate();
-
- virtual void tizen_launch_image_bind_resource(Resource *resource);
- virtual void tizen_launch_image_destroy_resource(Resource *resource);
-
- virtual void tizen_launch_image_destroy(Resource *resource);
- virtual void tizen_launch_image_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, struct ::wl_array *options);
- virtual void tizen_launch_image_owner(Resource *resource, uint32_t pid);
- virtual void tizen_launch_image_show(Resource *resource);
- virtual void tizen_launch_image_hide(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_launch_image_interface m_tizen_launch_image_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_launch(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *file,
- uint32_t file_type,
- uint32_t color_depth,
- uint32_t rotation,
- uint32_t indicator,
- struct ::wl_array *options);
- static void handle_owner(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid);
- static void handle_show(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_hide(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_launch_image *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_effect
- {
- public:
- tizen_effect(struct ::wl_client *client, uint32_t id, int version);
- tizen_effect(struct ::wl_display *display, int version);
- tizen_effect(struct ::wl_resource *resource);
- tizen_effect();
-
- virtual ~tizen_effect();
-
- class Resource
- {
- public:
- Resource() : tizen_effect_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_effect *tizen_effect_object;
- tizen_effect *object() { return tizen_effect_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum type {
- type_none = 0, // none
- type_show = 1, // show effect of window
- type_hide = 2, // hide effect of window
- type_restack = 3, // restack effect of window
- };
-
- void send_start(struct ::wl_resource *surface, uint32_t type);
- void send_start(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type);
- void send_end(struct ::wl_resource *surface, uint32_t type);
- void send_end(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type);
-
- protected:
- virtual Resource *tizen_effect_allocate();
-
- virtual void tizen_effect_bind_resource(Resource *resource);
- virtual void tizen_effect_destroy_resource(Resource *resource);
-
- virtual void tizen_effect_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_effect_interface m_tizen_effect_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_effect *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_display_policy
- {
- public:
- tizen_display_policy(struct ::wl_client *client, uint32_t id, int version);
- tizen_display_policy(struct ::wl_display *display, int version);
- tizen_display_policy(struct ::wl_resource *resource);
- tizen_display_policy();
-
- virtual ~tizen_display_policy();
-
- class Resource
- {
- public:
- Resource() : tizen_display_policy_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_display_policy *tizen_display_policy_object;
- tizen_display_policy *object() { return tizen_display_policy_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error_state {
- error_state_none = 0,
- error_state_permission_denied = 1,
- };
-
- void send_window_brightness_done(struct ::wl_resource *surface, int32_t brightness, uint32_t error_state);
- void send_window_brightness_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t brightness, uint32_t error_state);
-
- protected:
- virtual Resource *tizen_display_policy_allocate();
-
- virtual void tizen_display_policy_bind_resource(Resource *resource);
- virtual void tizen_display_policy_destroy_resource(Resource *resource);
-
- virtual void tizen_display_policy_set_window_brightness(Resource *resource, struct ::wl_resource *surface, int32_t brightness);
- virtual void tizen_display_policy_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_display_policy_interface m_tizen_display_policy_interface;
-
- static void handle_set_window_brightness(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t brightness);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_display_policy *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_indicator
- {
- public:
- tizen_indicator(struct ::wl_client *client, uint32_t id, int version);
- tizen_indicator(struct ::wl_display *display, int version);
- tizen_indicator(struct ::wl_resource *resource);
- tizen_indicator();
-
- virtual ~tizen_indicator();
-
- class Resource
- {
- public:
- Resource() : tizen_indicator_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_indicator *tizen_indicator_object;
- tizen_indicator *object() { return tizen_indicator_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum state {
- state_unknown = 0, // unknown
- state_off = 1, // can not show indicator
- state_on = 2, // can show indicator
- };
-
- enum opacity_mode {
- opacity_mode_unknown = 0, // unknown
- opacity_mode_opaque = 1, // opaque mode
- opacity_mode_translucent = 2, // translucent mode
- opacity_mode_transparent = 3, // transparent all mode
- opacity_mode_bg_transparent = 4, // transparent only background mode
- };
-
- enum visible_type {
- visible_type_hidden = 0, // hidden type indicator
- visible_type_shown = 1, // shown type indicator
- };
-
- void send_flick(struct ::wl_resource *surface, int32_t type);
- void send_flick(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t type);
-
- protected:
- virtual Resource *tizen_indicator_allocate();
-
- virtual void tizen_indicator_bind_resource(Resource *resource);
- virtual void tizen_indicator_destroy_resource(Resource *resource);
-
- virtual void tizen_indicator_destroy(Resource *resource);
- virtual void tizen_indicator_set_state(Resource *resource, struct ::wl_resource *surface, int32_t state);
- virtual void tizen_indicator_set_opacity_mode(Resource *resource, struct ::wl_resource *surface, int32_t mode);
- virtual void tizen_indicator_set_visible_type(Resource *resource, struct ::wl_resource *surface, int32_t type);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_indicator_interface m_tizen_indicator_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_state(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t state);
- static void handle_set_opacity_mode(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t mode);
- static void handle_set_visible_type(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- int32_t type);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_indicator *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_clipboard
- {
- public:
- tizen_clipboard(struct ::wl_client *client, uint32_t id, int version);
- tizen_clipboard(struct ::wl_display *display, int version);
- tizen_clipboard(struct ::wl_resource *resource);
- tizen_clipboard();
-
- virtual ~tizen_clipboard();
-
- class Resource
- {
- public:
- Resource() : tizen_clipboard_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_clipboard *tizen_clipboard_object;
- tizen_clipboard *object() { return tizen_clipboard_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_data_selected(struct ::wl_resource *surface);
- void send_data_selected(struct ::wl_resource *resource, struct ::wl_resource *surface);
- void send_allowed_data_only(uint32_t allowed);
- void send_allowed_data_only(struct ::wl_resource *resource, uint32_t allowed);
-
- protected:
- virtual Resource *tizen_clipboard_allocate();
-
- virtual void tizen_clipboard_bind_resource(Resource *resource);
- virtual void tizen_clipboard_destroy_resource(Resource *resource);
-
- virtual void tizen_clipboard_destroy(Resource *resource);
- virtual void tizen_clipboard_show(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_clipboard_hide(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_clipboard_set_data_only(Resource *resource, uint32_t set);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_clipboard_interface m_tizen_clipboard_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_show(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_hide(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_set_data_only(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_clipboard *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_screen_rotation
- {
- public:
- tizen_screen_rotation(struct ::wl_client *client, uint32_t id, int version);
- tizen_screen_rotation(struct ::wl_display *display, int version);
- tizen_screen_rotation(struct ::wl_resource *resource);
- tizen_screen_rotation();
-
- virtual ~tizen_screen_rotation();
-
- class Resource
- {
- public:
- Resource() : tizen_screen_rotation_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_screen_rotation *tizen_screen_rotation_object;
- tizen_screen_rotation *object() { return tizen_screen_rotation_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_ignore_output_transform(struct ::wl_resource *surface, uint32_t ignore);
- void send_ignore_output_transform(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t ignore);
-
- protected:
- virtual Resource *tizen_screen_rotation_allocate();
-
- virtual void tizen_screen_rotation_bind_resource(Resource *resource);
- virtual void tizen_screen_rotation_destroy_resource(Resource *resource);
-
- virtual void tizen_screen_rotation_get_ignore_output_transform(Resource *resource, struct ::wl_resource *surface);
- virtual void tizen_screen_rotation_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_screen_rotation_interface m_tizen_screen_rotation_interface;
-
- static void handle_get_ignore_output_transform(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_screen_rotation *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_renderer
- {
- public:
- tizen_renderer(struct ::wl_client *client, uint32_t id, int version);
- tizen_renderer(struct ::wl_display *display, int version);
- tizen_renderer(struct ::wl_resource *resource);
- tizen_renderer();
-
- virtual ~tizen_renderer();
-
- class Resource
- {
- public:
- Resource() : tizen_renderer_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_renderer *tizen_renderer_object;
- tizen_renderer *object() { return tizen_renderer_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tizen_renderer_allocate();
-
- virtual void tizen_renderer_bind_resource(Resource *resource);
- virtual void tizen_renderer_destroy_resource(Resource *resource);
-
- virtual void tizen_renderer_get_renderer_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_renderer_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_renderer_interface m_tizen_renderer_interface;
-
- static void handle_get_renderer_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_renderer *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_renderer_surface
- {
- public:
- tizen_renderer_surface(struct ::wl_client *client, uint32_t id, int version);
- tizen_renderer_surface(struct ::wl_display *display, int version);
- tizen_renderer_surface(struct ::wl_resource *resource);
- tizen_renderer_surface();
-
- virtual ~tizen_renderer_surface();
-
- class Resource
- {
- public:
- Resource() : tizen_renderer_surface_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_renderer_surface *tizen_renderer_surface_object;
- tizen_renderer_surface *object() { return tizen_renderer_surface_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_redraw_request();
- void send_redraw_request(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *tizen_renderer_surface_allocate();
-
- virtual void tizen_renderer_surface_bind_resource(Resource *resource);
- virtual void tizen_renderer_surface_destroy_resource(Resource *resource);
-
- virtual void tizen_renderer_surface_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_renderer_surface_interface m_tizen_renderer_surface_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_renderer_surface *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-/*LCOV_EXCL_STOP*/
-
-#endif
\ No newline at end of file
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-hwc.xml */
-
-#include "dswayland-server-tizen-hwc.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- tizen_hwc::tizen_hwc(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_hwc::tizen_hwc(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_hwc::tizen_hwc(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_hwc::tizen_hwc()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_hwc::~tizen_hwc()
- {
- std::multimap<struct ::wl_client*, tizen_hwc::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_hwc::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_hwc::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_hwc::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_hwc::Resource *tizen_hwc::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_hwc::Resource *tizen_hwc::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_hwc::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_hwc_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_hwc::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_hwc::interface()
- {
- return &::tizen_hwc_interface;
- }
-
- tizen_hwc::Resource *tizen_hwc::tizen_hwc_allocate()
- {
- return new Resource;
- }
-
- void tizen_hwc::tizen_hwc_bind_resource(Resource *)
- {
- }
-
- void tizen_hwc::tizen_hwc_destroy_resource(Resource *)
- {
- }
-
- void tizen_hwc::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_hwc *that = static_cast<tizen_hwc *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_hwc::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_hwc *that = static_cast<tizen_hwc::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_hwc::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_hwc *that = resource->tizen_hwc_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_hwc_destroy_resource(resource);
- delete resource;
- }
-
- tizen_hwc::Resource *tizen_hwc::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_hwc_interface, version, id);
- return bind(handle);
- }
-
- tizen_hwc::Resource *tizen_hwc::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_hwc_allocate();
- resource->tizen_hwc_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_hwc_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_hwc_bind_resource(resource);
- return resource;
- }
- tizen_hwc::Resource *tizen_hwc::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_hwc_interface, &m_tizen_hwc_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_hwc_interface tizen_hwc::m_tizen_hwc_interface = {
- tizen_hwc::handle_destroy,
- tizen_hwc::handle_create_commit_feedback
- };
-
- void tizen_hwc::tizen_hwc_destroy(Resource *)
- {
- }
-
- void tizen_hwc::tizen_hwc_create_commit_feedback(Resource *, struct ::wl_resource *, uint32_t, uint32_t )
- {
- }
-
-
- void tizen_hwc::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_hwc *>(r->tizen_hwc_object)->tizen_hwc_destroy(
- r);
- }
-
- void tizen_hwc::handle_create_commit_feedback(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t id,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_hwc *>(r->tizen_hwc_object)->tizen_hwc_create_commit_feedback(
- r,
- surface,
- id,
- serial);
- }
-
- tizen_hwc_commit_feedback::tizen_hwc_commit_feedback(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_hwc_commit_feedback::tizen_hwc_commit_feedback(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_hwc_commit_feedback::tizen_hwc_commit_feedback(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_hwc_commit_feedback::tizen_hwc_commit_feedback()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_hwc_commit_feedback::~tizen_hwc_commit_feedback()
- {
- std::multimap<struct ::wl_client*, tizen_hwc_commit_feedback::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_hwc_commit_feedback::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_hwc_commit_feedback::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_hwc_commit_feedback::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_hwc_commit_feedback::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_hwc_commit_feedback_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_hwc_commit_feedback::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_hwc_commit_feedback::interface()
- {
- return &::tizen_hwc_commit_feedback_interface;
- }
-
- tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::tizen_hwc_commit_feedback_allocate()
- {
- return new Resource;
- }
-
- void tizen_hwc_commit_feedback::tizen_hwc_commit_feedback_bind_resource(Resource *)
- {
- }
-
- void tizen_hwc_commit_feedback::tizen_hwc_commit_feedback_destroy_resource(Resource *)
- {
- }
-
- void tizen_hwc_commit_feedback::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_hwc_commit_feedback *that = static_cast<tizen_hwc_commit_feedback *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_hwc_commit_feedback::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_hwc_commit_feedback *that = static_cast<tizen_hwc_commit_feedback::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_hwc_commit_feedback::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_hwc_commit_feedback *that = resource->tizen_hwc_commit_feedback_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_hwc_commit_feedback_destroy_resource(resource);
- delete resource;
- }
-
- tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_hwc_commit_feedback_interface, version, id);
- return bind(handle);
- }
-
- tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_hwc_commit_feedback_allocate();
- resource->tizen_hwc_commit_feedback_object = this;
-
- wl_resource_set_implementation(handle, NULL, resource, destroy_func);
- resource->handle = handle;
- tizen_hwc_commit_feedback_bind_resource(resource);
- return resource;
- }
- tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_hwc_commit_feedback_interface, NULL))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- void tizen_hwc_commit_feedback::send_committed(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tizen_hwc_commit_feedback::committed", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_hwc_commit_feedback::committed as it's not initialised");
- return;
- }
- send_committed(
- m_resource->handle,
- serial);
- }
-
- void tizen_hwc_commit_feedback::send_committed(struct ::wl_resource *resource, uint32_t serial)
- {
- tizen_hwc_commit_feedback_send_committed(
- resource,
- serial);
- }
-
-
- void tizen_hwc_commit_feedback::send_discarded(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tizen_hwc_commit_feedback::discarded", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_hwc_commit_feedback::discarded as it's not initialised");
- return;
- }
- send_discarded(
- m_resource->handle,
- serial);
- }
-
- void tizen_hwc_commit_feedback::send_discarded(struct ::wl_resource *resource, uint32_t serial)
- {
- tizen_hwc_commit_feedback_send_discarded(
- resource,
- serial);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
\ No newline at end of file
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-hwc.xml */
-
-#ifndef __DS_TIZEN_HWC_PROTOCOL_H__
-#define __DS_TIZEN_HWC_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "tizen-hwc-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class tizen_hwc
- {
- public:
- tizen_hwc(struct ::wl_client *client, uint32_t id, int version);
- tizen_hwc(struct ::wl_display *display, int version);
- tizen_hwc(struct ::wl_resource *resource);
- tizen_hwc();
-
- virtual ~tizen_hwc();
-
- class Resource
- {
- public:
- Resource() : tizen_hwc_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_hwc *tizen_hwc_object;
- tizen_hwc *object() { return tizen_hwc_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tizen_hwc_allocate();
-
- virtual void tizen_hwc_bind_resource(Resource *resource);
- virtual void tizen_hwc_destroy_resource(Resource *resource);
-
- virtual void tizen_hwc_destroy(Resource *resource);
- virtual void tizen_hwc_create_commit_feedback(Resource *resource, struct ::wl_resource *surface, uint32_t id, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_hwc_interface m_tizen_hwc_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_create_commit_feedback(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- uint32_t id,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_hwc *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_hwc_commit_feedback
- {
- public:
- tizen_hwc_commit_feedback(struct ::wl_client *client, uint32_t id, int version);
- tizen_hwc_commit_feedback(struct ::wl_display *display, int version);
- tizen_hwc_commit_feedback(struct ::wl_resource *resource);
- tizen_hwc_commit_feedback();
-
- virtual ~tizen_hwc_commit_feedback();
-
- class Resource
- {
- public:
- Resource() : tizen_hwc_commit_feedback_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_hwc_commit_feedback *tizen_hwc_commit_feedback_object;
- tizen_hwc_commit_feedback *object() { return tizen_hwc_commit_feedback_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_committed(uint32_t serial);
- void send_committed(struct ::wl_resource *resource, uint32_t serial);
- void send_discarded(uint32_t serial);
- void send_discarded(struct ::wl_resource *resource, uint32_t serial);
-
- protected:
- virtual Resource *tizen_hwc_commit_feedback_allocate();
-
- virtual void tizen_hwc_commit_feedback_bind_resource(Resource *resource);
- virtual void tizen_hwc_commit_feedback_destroy_resource(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_hwc_commit_feedback *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
\ No newline at end of file
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-launch.xml */
-
-#include "dswayland-server-tizen-launch.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- tizen_launch_effect::tizen_launch_effect(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_launch_effect::tizen_launch_effect(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_launch_effect::tizen_launch_effect(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_launch_effect::tizen_launch_effect()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_launch_effect::~tizen_launch_effect()
- {
- std::multimap<struct ::wl_client*, tizen_launch_effect::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_launch_effect::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_launch_effect::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_launch_effect::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_launch_effect::Resource *tizen_launch_effect::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_launch_effect::Resource *tizen_launch_effect::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_launch_effect::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_launch_effect_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_launch_effect::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_launch_effect::interface()
- {
- return &::tizen_launch_effect_interface;
- }
-
- tizen_launch_effect::Resource *tizen_launch_effect::tizen_launch_effect_allocate()
- {
- return new Resource;
- }
-
- void tizen_launch_effect::tizen_launch_effect_bind_resource(Resource *)
- {
- }
-
- void tizen_launch_effect::tizen_launch_effect_destroy_resource(Resource *)
- {
- }
-
- void tizen_launch_effect::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_launch_effect *that = static_cast<tizen_launch_effect *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_launch_effect::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_launch_effect *that = static_cast<tizen_launch_effect::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_launch_effect::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_launch_effect *that = resource->tizen_launch_effect_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_launch_effect_destroy_resource(resource);
- delete resource;
- }
-
- tizen_launch_effect::Resource *tizen_launch_effect::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launch_effect_interface, version, id);
- return bind(handle);
- }
-
- tizen_launch_effect::Resource *tizen_launch_effect::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_launch_effect_allocate();
- resource->tizen_launch_effect_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_launch_effect_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_launch_effect_bind_resource(resource);
- return resource;
- }
- tizen_launch_effect::Resource *tizen_launch_effect::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_launch_effect_interface, &m_tizen_launch_effect_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_launch_effect_interface tizen_launch_effect::m_tizen_launch_effect_interface = {
- tizen_launch_effect::handle_create_splash_img,
- tizen_launch_effect::handle_type_set,
- tizen_launch_effect::handle_type_unset,
- tizen_launch_effect::handle_destroy
- };
-
- void tizen_launch_effect::tizen_launch_effect_create_splash_img(Resource *, uint32_t)
- {
- }
-
- void tizen_launch_effect::tizen_launch_effect_type_set(Resource *, const std::string &, uint32_t , struct ::wl_array *)
- {
- }
-
- void tizen_launch_effect::tizen_launch_effect_type_unset(Resource *, uint32_t )
- {
- }
-
- void tizen_launch_effect::tizen_launch_effect_destroy(Resource *)
- {
- }
-
-
- void tizen_launch_effect::handle_create_splash_img(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_effect *>(r->tizen_launch_effect_object)->tizen_launch_effect_create_splash_img(
- r,
- id);
- }
-
- void tizen_launch_effect::handle_type_set(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *effect_type,
- uint32_t pid,
- struct ::wl_array *options)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_effect *>(r->tizen_launch_effect_object)->tizen_launch_effect_type_set(
- r,
- std::string(effect_type),
- pid,
- options);
- }
-
- void tizen_launch_effect::handle_type_unset(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_effect *>(r->tizen_launch_effect_object)->tizen_launch_effect_type_unset(
- r,
- pid);
- }
-
- void tizen_launch_effect::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_effect *>(r->tizen_launch_effect_object)->tizen_launch_effect_destroy(
- r);
- }
-
- tizen_launch_splash::tizen_launch_splash(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_launch_splash::tizen_launch_splash(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_launch_splash::tizen_launch_splash(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_launch_splash::tizen_launch_splash()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_launch_splash::~tizen_launch_splash()
- {
- std::multimap<struct ::wl_client*, tizen_launch_splash::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_launch_splash::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_launch_splash::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_launch_splash::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_launch_splash::Resource *tizen_launch_splash::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_launch_splash::Resource *tizen_launch_splash::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_launch_splash::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_launch_splash_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_launch_splash::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_launch_splash::interface()
- {
- return &::tizen_launch_splash_interface;
- }
-
- tizen_launch_splash::Resource *tizen_launch_splash::tizen_launch_splash_allocate()
- {
- return new Resource;
- }
-
- void tizen_launch_splash::tizen_launch_splash_bind_resource(Resource *)
- {
- }
-
- void tizen_launch_splash::tizen_launch_splash_destroy_resource(Resource *)
- {
- }
-
- void tizen_launch_splash::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_launch_splash *that = static_cast<tizen_launch_splash *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_launch_splash::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_launch_splash *that = static_cast<tizen_launch_splash::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_launch_splash::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_launch_splash *that = resource->tizen_launch_splash_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_launch_splash_destroy_resource(resource);
- delete resource;
- }
-
- tizen_launch_splash::Resource *tizen_launch_splash::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launch_splash_interface, version, id);
- return bind(handle);
- }
-
- tizen_launch_splash::Resource *tizen_launch_splash::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_launch_splash_allocate();
- resource->tizen_launch_splash_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_launch_splash_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_launch_splash_bind_resource(resource);
- return resource;
- }
- tizen_launch_splash::Resource *tizen_launch_splash::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_launch_splash_interface, &m_tizen_launch_splash_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_launch_splash_interface tizen_launch_splash::m_tizen_launch_splash_interface = {
- tizen_launch_splash::handle_destroy,
- tizen_launch_splash::handle_launch,
- tizen_launch_splash::handle_owner,
- tizen_launch_splash::handle_launch_v2
- };
-
- void tizen_launch_splash::tizen_launch_splash_destroy(Resource *)
- {
- }
-
- void tizen_launch_splash::tizen_launch_splash_launch(Resource *, const std::string &, uint32_t , uint32_t , uint32_t , uint32_t , const std::string &, const std::string &, struct ::wl_array *)
- {
- }
-
- void tizen_launch_splash::tizen_launch_splash_owner(Resource *, uint32_t )
- {
- }
-
- void tizen_launch_splash::tizen_launch_splash_launch_v2(Resource *, const std::string &, uint32_t , uint32_t , uint32_t , uint32_t , const std::string &, const std::string &, struct ::wl_array *, struct ::wl_array *)
- {
- }
-
-
- void tizen_launch_splash::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_splash *>(r->tizen_launch_splash_object)->tizen_launch_splash_destroy(
- r);
- }
-
- void tizen_launch_splash::handle_launch(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *file,
- uint32_t file_type,
- uint32_t color_depth,
- uint32_t rotation,
- uint32_t indicator,
- const char *effect_type,
- const char *theme_type,
- struct ::wl_array *options)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_splash *>(r->tizen_launch_splash_object)->tizen_launch_splash_launch(
- r,
- std::string(file),
- file_type,
- color_depth,
- rotation,
- indicator,
- std::string(effect_type),
- std::string(theme_type),
- options);
- }
-
- void tizen_launch_splash::handle_owner(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_splash *>(r->tizen_launch_splash_object)->tizen_launch_splash_owner(
- r,
- pid);
- }
-
- void tizen_launch_splash::handle_launch_v2(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *file,
- uint32_t file_type,
- uint32_t color_depth,
- uint32_t rotation,
- uint32_t indicator,
- const char *effect_type,
- const char *theme_type,
- struct ::wl_array *options,
- struct ::wl_array *extra_config)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_splash *>(r->tizen_launch_splash_object)->tizen_launch_splash_launch_v2(
- r,
- std::string(file),
- file_type,
- color_depth,
- rotation,
- indicator,
- std::string(effect_type),
- std::string(theme_type),
- options,
- extra_config);
- }
-
- tizen_launch_appinfo::tizen_launch_appinfo(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_launch_appinfo::tizen_launch_appinfo(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_launch_appinfo::tizen_launch_appinfo(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_launch_appinfo::tizen_launch_appinfo()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_launch_appinfo::~tizen_launch_appinfo()
- {
- std::multimap<struct ::wl_client*, tizen_launch_appinfo::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_launch_appinfo::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_launch_appinfo::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_launch_appinfo::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_launch_appinfo::Resource *tizen_launch_appinfo::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_launch_appinfo::Resource *tizen_launch_appinfo::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_launch_appinfo::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_launch_appinfo_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_launch_appinfo::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_launch_appinfo::interface()
- {
- return &::tizen_launch_appinfo_interface;
- }
-
- tizen_launch_appinfo::Resource *tizen_launch_appinfo::tizen_launch_appinfo_allocate()
- {
- return new Resource;
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_bind_resource(Resource *)
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_destroy_resource(Resource *)
- {
- }
-
- void tizen_launch_appinfo::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_launch_appinfo *that = static_cast<tizen_launch_appinfo *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_launch_appinfo::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_launch_appinfo *that = static_cast<tizen_launch_appinfo::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_launch_appinfo::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_launch_appinfo *that = resource->tizen_launch_appinfo_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_launch_appinfo_destroy_resource(resource);
- delete resource;
- }
-
- tizen_launch_appinfo::Resource *tizen_launch_appinfo::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launch_appinfo_interface, version, id);
- return bind(handle);
- }
-
- tizen_launch_appinfo::Resource *tizen_launch_appinfo::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_launch_appinfo_allocate();
- resource->tizen_launch_appinfo_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_launch_appinfo_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_launch_appinfo_bind_resource(resource);
- return resource;
- }
- tizen_launch_appinfo::Resource *tizen_launch_appinfo::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_launch_appinfo_interface, &m_tizen_launch_appinfo_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_launch_appinfo_interface tizen_launch_appinfo::m_tizen_launch_appinfo_interface = {
- tizen_launch_appinfo::handle_destroy,
- tizen_launch_appinfo::handle_register_pid,
- tizen_launch_appinfo::handle_deregister_pid,
- tizen_launch_appinfo::handle_set_appid,
- tizen_launch_appinfo::handle_get_base_output_resolution,
- tizen_launch_appinfo::handle_register_appid,
- tizen_launch_appinfo::handle_deregister_appid,
- tizen_launch_appinfo::handle_set_pid,
- tizen_launch_appinfo::handle_ready_metadata
- };
-
- void tizen_launch_appinfo::tizen_launch_appinfo_destroy(Resource *)
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_register_pid(Resource *, uint32_t )
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_deregister_pid(Resource *, uint32_t )
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_set_appid(Resource *, uint32_t , const std::string &)
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_get_base_output_resolution(Resource *, uint32_t )
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_register_appid(Resource *, const std::string &)
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_deregister_appid(Resource *, const std::string &)
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_set_pid(Resource *, const std::string &, uint32_t )
- {
- }
-
- void tizen_launch_appinfo::tizen_launch_appinfo_ready_metadata(Resource *, const std::string &, uint32_t )
- {
- }
-
-
- void tizen_launch_appinfo::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_destroy(
- r);
- }
-
- void tizen_launch_appinfo::handle_register_pid(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_register_pid(
- r,
- pid);
- }
-
- void tizen_launch_appinfo::handle_deregister_pid(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_deregister_pid(
- r,
- pid);
- }
-
- void tizen_launch_appinfo::handle_set_appid(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid,
- const char *appid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_set_appid(
- r,
- pid,
- std::string(appid));
- }
-
- void tizen_launch_appinfo::handle_get_base_output_resolution(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_get_base_output_resolution(
- r,
- pid);
- }
-
- void tizen_launch_appinfo::handle_register_appid(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *appid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_register_appid(
- r,
- std::string(appid));
- }
-
- void tizen_launch_appinfo::handle_deregister_appid(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *appid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_deregister_appid(
- r,
- std::string(appid));
- }
-
- void tizen_launch_appinfo::handle_set_pid(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *appid,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_set_pid(
- r,
- std::string(appid),
- pid);
- }
-
- void tizen_launch_appinfo::handle_ready_metadata(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *appid,
- uint32_t pid)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_launch_appinfo *>(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_ready_metadata(
- r,
- std::string(appid),
- pid);
- }
-
- void tizen_launch_appinfo::send_base_output_resolution_done(uint32_t pid, uint32_t width, uint32_t height)
- {
- DS_ASSERT_X(m_resource, "tizen_launch_appinfo::base_output_resolution_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_launch_appinfo::base_output_resolution_done as it's not initialised");
- return;
- }
- send_base_output_resolution_done(
- m_resource->handle,
- pid,
- width,
- height);
- }
-
- void tizen_launch_appinfo::send_base_output_resolution_done(struct ::wl_resource *resource, uint32_t pid, uint32_t width, uint32_t height)
- {
- tizen_launch_appinfo_send_base_output_resolution_done(
- resource,
- pid,
- width,
- height);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-launch.xml */
-
-#ifndef __DS_TIZEN_LAUNCH_PROTOCOL_H__
-#define __DS_TIZEN_LAUNCH_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "tizen-launch-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class tizen_launch_effect
- {
- public:
- tizen_launch_effect(struct ::wl_client *client, uint32_t id, int version);
- tizen_launch_effect(struct ::wl_display *display, int version);
- tizen_launch_effect(struct ::wl_resource *resource);
- tizen_launch_effect();
-
- virtual ~tizen_launch_effect();
-
- class Resource
- {
- public:
- Resource() : tizen_launch_effect_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_launch_effect *tizen_launch_effect_object;
- tizen_launch_effect *object() { return tizen_launch_effect_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tizen_launch_effect_allocate();
-
- virtual void tizen_launch_effect_bind_resource(Resource *resource);
- virtual void tizen_launch_effect_destroy_resource(Resource *resource);
-
- virtual void tizen_launch_effect_create_splash_img(Resource *resource, uint32_t id);
- virtual void tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, struct ::wl_array *options);
- virtual void tizen_launch_effect_type_unset(Resource *resource, uint32_t pid);
- virtual void tizen_launch_effect_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_launch_effect_interface m_tizen_launch_effect_interface;
-
- static void handle_create_splash_img(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_type_set(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *effect_type,
- uint32_t pid,
- struct ::wl_array *options);
- static void handle_type_unset(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_launch_effect *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_launch_splash
- {
- public:
- tizen_launch_splash(struct ::wl_client *client, uint32_t id, int version);
- tizen_launch_splash(struct ::wl_display *display, int version);
- tizen_launch_splash(struct ::wl_resource *resource);
- tizen_launch_splash();
-
- virtual ~tizen_launch_splash();
-
- class Resource
- {
- public:
- Resource() : tizen_launch_splash_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_launch_splash *tizen_launch_splash_object;
- tizen_launch_splash *object() { return tizen_launch_splash_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum file_type {
- file_type_img = 0, // splash image file path
- file_type_edj = 1, // splash edj file path
- };
-
- enum indicator {
- indicator_off = 0, // splash hide indicator
- indicator_on = 1, // splash show indicator
- };
-
- enum rotation {
- rotation_0 = 0, // rotation angle 0 degree
- rotation_90 = 90, // rotation angle 90 degree
- rotation_180 = 180, // rotation angle 180 degree
- rotation_270 = 270, // rotation angle 270 degree
- };
-
- protected:
- virtual Resource *tizen_launch_splash_allocate();
-
- virtual void tizen_launch_splash_bind_resource(Resource *resource);
- virtual void tizen_launch_splash_destroy_resource(Resource *resource);
-
- virtual void tizen_launch_splash_destroy(Resource *resource);
- virtual void tizen_launch_splash_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options);
- virtual void tizen_launch_splash_owner(Resource *resource, uint32_t pid);
- virtual void tizen_launch_splash_launch_v2(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options, struct ::wl_array *extra_config);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_launch_splash_interface m_tizen_launch_splash_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_launch(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *file,
- uint32_t file_type,
- uint32_t color_depth,
- uint32_t rotation,
- uint32_t indicator,
- const char *effect_type,
- const char *theme_type,
- struct ::wl_array *options);
- static void handle_owner(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid);
- static void handle_launch_v2(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *file,
- uint32_t file_type,
- uint32_t color_depth,
- uint32_t rotation,
- uint32_t indicator,
- const char *effect_type,
- const char *theme_type,
- struct ::wl_array *options,
- struct ::wl_array *extra_config);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_launch_splash *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_launch_appinfo
- {
- public:
- tizen_launch_appinfo(struct ::wl_client *client, uint32_t id, int version);
- tizen_launch_appinfo(struct ::wl_display *display, int version);
- tizen_launch_appinfo(struct ::wl_resource *resource);
- tizen_launch_appinfo();
-
- virtual ~tizen_launch_appinfo();
-
- class Resource
- {
- public:
- Resource() : tizen_launch_appinfo_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_launch_appinfo *tizen_launch_appinfo_object;
- tizen_launch_appinfo *object() { return tizen_launch_appinfo_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_base_output_resolution_done(uint32_t pid, uint32_t width, uint32_t height);
- void send_base_output_resolution_done(struct ::wl_resource *resource, uint32_t pid, uint32_t width, uint32_t height);
-
- protected:
- virtual Resource *tizen_launch_appinfo_allocate();
-
- virtual void tizen_launch_appinfo_bind_resource(Resource *resource);
- virtual void tizen_launch_appinfo_destroy_resource(Resource *resource);
-
- virtual void tizen_launch_appinfo_destroy(Resource *resource);
- virtual void tizen_launch_appinfo_register_pid(Resource *resource, uint32_t pid);
- virtual void tizen_launch_appinfo_deregister_pid(Resource *resource, uint32_t pid);
- virtual void tizen_launch_appinfo_set_appid(Resource *resource, uint32_t pid, const std::string &appid);
- virtual void tizen_launch_appinfo_get_base_output_resolution(Resource *resource, uint32_t pid);
- virtual void tizen_launch_appinfo_register_appid(Resource *resource, const std::string &appid);
- virtual void tizen_launch_appinfo_deregister_appid(Resource *resource, const std::string &appid);
- virtual void tizen_launch_appinfo_set_pid(Resource *resource, const std::string &appid, uint32_t pid);
- virtual void tizen_launch_appinfo_ready_metadata(Resource *resource, const std::string &appid, uint32_t pid);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_launch_appinfo_interface m_tizen_launch_appinfo_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_register_pid(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid);
- static void handle_deregister_pid(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid);
- static void handle_set_appid(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid,
- const char *appid);
- static void handle_get_base_output_resolution(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t pid);
- static void handle_register_appid(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *appid);
- static void handle_deregister_appid(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *appid);
- static void handle_set_pid(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *appid,
- uint32_t pid);
- static void handle_ready_metadata(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *appid,
- uint32_t pid);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_launch_appinfo *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-policy-ext.xml */
-
-#include "dswayland-server-tizen-policy-ext.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- tizen_policy_ext::tizen_policy_ext(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_policy_ext::tizen_policy_ext(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_policy_ext::tizen_policy_ext(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_policy_ext::tizen_policy_ext()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_policy_ext::~tizen_policy_ext()
- {
- std::multimap<struct ::wl_client*, tizen_policy_ext::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_policy_ext::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_policy_ext::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_policy_ext::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_policy_ext::Resource *tizen_policy_ext::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_policy_ext::Resource *tizen_policy_ext::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_policy_ext::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_policy_ext_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_policy_ext::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_policy_ext::interface()
- {
- return &::tizen_policy_ext_interface;
- }
-
- tizen_policy_ext::Resource *tizen_policy_ext::tizen_policy_ext_allocate()
- {
- return new Resource;
- }
-
- void tizen_policy_ext::tizen_policy_ext_bind_resource(Resource *)
- {
- }
-
- void tizen_policy_ext::tizen_policy_ext_destroy_resource(Resource *)
- {
- }
-
- void tizen_policy_ext::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_policy_ext *that = static_cast<tizen_policy_ext *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_policy_ext::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_policy_ext *that = static_cast<tizen_policy_ext::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_policy_ext::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_policy_ext *that = resource->tizen_policy_ext_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_policy_ext_destroy_resource(resource);
- delete resource;
- }
-
- tizen_policy_ext::Resource *tizen_policy_ext::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_policy_ext_interface, version, id);
- return bind(handle);
- }
-
- tizen_policy_ext::Resource *tizen_policy_ext::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_policy_ext_allocate();
- resource->tizen_policy_ext_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_policy_ext_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_policy_ext_bind_resource(resource);
- return resource;
- }
- tizen_policy_ext::Resource *tizen_policy_ext::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_policy_ext_interface, &m_tizen_policy_ext_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_policy_ext_interface tizen_policy_ext::m_tizen_policy_ext_interface = {
- tizen_policy_ext::handle_get_rotation,
- tizen_policy_ext::handle_get_active_angle
- };
-
- void tizen_policy_ext::tizen_policy_ext_get_rotation(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_policy_ext::tizen_policy_ext_get_active_angle(Resource *, struct ::wl_resource *)
- {
- }
-
-
- void tizen_policy_ext::handle_get_rotation(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy_ext *>(r->tizen_policy_ext_object)->tizen_policy_ext_get_rotation(
- r,
- id,
- surface);
- }
-
- void tizen_policy_ext::handle_get_active_angle(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_policy_ext *>(r->tizen_policy_ext_object)->tizen_policy_ext_get_active_angle(
- r,
- surface);
- }
-
- void tizen_policy_ext::send_active_angle(uint32_t angle)
- {
- DS_ASSERT_X(m_resource, "tizen_policy_ext::active_angle", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_policy_ext::active_angle as it's not initialised");
- return;
- }
- send_active_angle(
- m_resource->handle,
- angle);
- }
-
- void tizen_policy_ext::send_active_angle(struct ::wl_resource *resource, uint32_t angle)
- {
- tizen_policy_ext_send_active_angle(
- resource,
- angle);
- }
-
-
- tizen_rotation::tizen_rotation(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_rotation::tizen_rotation(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_rotation::tizen_rotation(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_rotation::tizen_rotation()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_rotation::~tizen_rotation()
- {
- std::multimap<struct ::wl_client*, tizen_rotation::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_rotation::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_rotation::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_rotation::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_rotation::Resource *tizen_rotation::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_rotation::Resource *tizen_rotation::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_rotation::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_rotation_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_rotation::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_rotation::interface()
- {
- return &::tizen_rotation_interface;
- }
-
- tizen_rotation::Resource *tizen_rotation::tizen_rotation_allocate()
- {
- return new Resource;
- }
-
- void tizen_rotation::tizen_rotation_bind_resource(Resource *)
- {
- }
-
- void tizen_rotation::tizen_rotation_destroy_resource(Resource *)
- {
- }
-
- void tizen_rotation::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_rotation *that = static_cast<tizen_rotation *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_rotation::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_rotation *that = static_cast<tizen_rotation::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_rotation::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_rotation *that = resource->tizen_rotation_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_rotation_destroy_resource(resource);
- delete resource;
- }
-
- tizen_rotation::Resource *tizen_rotation::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_rotation_interface, version, id);
- return bind(handle);
- }
-
- tizen_rotation::Resource *tizen_rotation::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_rotation_allocate();
- resource->tizen_rotation_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_rotation_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_rotation_bind_resource(resource);
- return resource;
- }
- tizen_rotation::Resource *tizen_rotation::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_rotation_interface, &m_tizen_rotation_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_rotation_interface tizen_rotation::m_tizen_rotation_interface = {
- tizen_rotation::handle_destroy,
- tizen_rotation::handle_set_available_angles,
- tizen_rotation::handle_set_preferred_angle,
- tizen_rotation::handle_ack_angle_change,
- tizen_rotation::handle_set_geometry_hint
- };
-
- void tizen_rotation::tizen_rotation_destroy(Resource *)
- {
- }
-
- void tizen_rotation::tizen_rotation_set_available_angles(Resource *, uint32_t )
- {
- }
-
- void tizen_rotation::tizen_rotation_set_preferred_angle(Resource *, uint32_t )
- {
- }
-
- void tizen_rotation::tizen_rotation_ack_angle_change(Resource *, uint32_t )
- {
- }
-
- void tizen_rotation::tizen_rotation_set_geometry_hint(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t )
- {
- }
-
-
- void tizen_rotation::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_rotation *>(r->tizen_rotation_object)->tizen_rotation_destroy(
- r);
- }
-
- void tizen_rotation::handle_set_available_angles(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t angles)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_rotation *>(r->tizen_rotation_object)->tizen_rotation_set_available_angles(
- r,
- angles);
- }
-
- void tizen_rotation::handle_set_preferred_angle(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t angle)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_rotation *>(r->tizen_rotation_object)->tizen_rotation_set_preferred_angle(
- r,
- angle);
- }
-
- void tizen_rotation::handle_ack_angle_change(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_rotation *>(r->tizen_rotation_object)->tizen_rotation_ack_angle_change(
- r,
- serial);
- }
-
- void tizen_rotation::handle_set_geometry_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t angle,
- uint32_t x,
- uint32_t y,
- uint32_t w,
- uint32_t h)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_rotation *>(r->tizen_rotation_object)->tizen_rotation_set_geometry_hint(
- r,
- angle,
- x,
- y,
- w,
- h);
- }
-
- void tizen_rotation::send_available_angles_done(uint32_t angles)
- {
- DS_ASSERT_X(m_resource, "tizen_rotation::available_angles_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_rotation::available_angles_done as it's not initialised");
- return;
- }
- send_available_angles_done(
- m_resource->handle,
- angles);
- }
-
- void tizen_rotation::send_available_angles_done(struct ::wl_resource *resource, uint32_t angles)
- {
- tizen_rotation_send_available_angles_done(
- resource,
- angles);
- }
-
-
- void tizen_rotation::send_preferred_angle_done(uint32_t angle)
- {
- DS_ASSERT_X(m_resource, "tizen_rotation::preferred_angle_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_rotation::preferred_angle_done as it's not initialised");
- return;
- }
- send_preferred_angle_done(
- m_resource->handle,
- angle);
- }
-
- void tizen_rotation::send_preferred_angle_done(struct ::wl_resource *resource, uint32_t angle)
- {
- tizen_rotation_send_preferred_angle_done(
- resource,
- angle);
- }
-
-
- void tizen_rotation::send_angle_change(uint32_t angle, uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tizen_rotation::angle_change", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_rotation::angle_change as it's not initialised");
- return;
- }
- send_angle_change(
- m_resource->handle,
- angle,
- serial);
- }
-
- void tizen_rotation::send_angle_change(struct ::wl_resource *resource, uint32_t angle, uint32_t serial)
- {
- tizen_rotation_send_angle_change(
- resource,
- angle,
- serial);
- }
-
-
- void tizen_rotation::send_angle_change_with_resize(uint32_t angle, uint32_t serial, uint32_t width, uint32_t height)
- {
- DS_ASSERT_X(m_resource, "tizen_rotation::angle_change_with_resize", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_rotation::angle_change_with_resize as it's not initialised");
- return;
- }
- send_angle_change_with_resize(
- m_resource->handle,
- angle,
- serial,
- width,
- height);
- }
-
- void tizen_rotation::send_angle_change_with_resize(struct ::wl_resource *resource, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height)
- {
- tizen_rotation_send_angle_change_with_resize(
- resource,
- angle,
- serial,
- width,
- height);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-policy-ext.xml */
-
-#ifndef __DS_TIZEN_POLICY_EXT_PROTOCOL_H__
-#define __DS_TIZEN_POLICY_EXT_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "tizen-policy-ext-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class tizen_policy_ext
- {
- public:
- tizen_policy_ext(struct ::wl_client *client, uint32_t id, int version);
- tizen_policy_ext(struct ::wl_display *display, int version);
- tizen_policy_ext(struct ::wl_resource *resource);
- tizen_policy_ext();
-
- virtual ~tizen_policy_ext();
-
- class Resource
- {
- public:
- Resource() : tizen_policy_ext_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_policy_ext *tizen_policy_ext_object;
- tizen_policy_ext *object() { return tizen_policy_ext_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_active_angle(uint32_t angle);
- void send_active_angle(struct ::wl_resource *resource, uint32_t angle);
-
- protected:
- virtual Resource *tizen_policy_ext_allocate();
-
- virtual void tizen_policy_ext_bind_resource(Resource *resource);
- virtual void tizen_policy_ext_destroy_resource(Resource *resource);
-
- virtual void tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_policy_ext_get_active_angle(Resource *resource, struct ::wl_resource *surface);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_policy_ext_interface m_tizen_policy_ext_interface;
-
- static void handle_get_rotation(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_get_active_angle(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_policy_ext *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_rotation
- {
- public:
- tizen_rotation(struct ::wl_client *client, uint32_t id, int version);
- tizen_rotation(struct ::wl_display *display, int version);
- tizen_rotation(struct ::wl_resource *resource);
- tizen_rotation();
-
- virtual ~tizen_rotation();
-
- class Resource
- {
- public:
- Resource() : tizen_rotation_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_rotation *tizen_rotation_object;
- tizen_rotation *object() { return tizen_rotation_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum angle {
- angle_none = 0,
- angle_0 = 1,
- angle_90 = 2,
- angle_180 = 4,
- angle_270 = 8,
- };
-
- void send_available_angles_done(uint32_t angles);
- void send_available_angles_done(struct ::wl_resource *resource, uint32_t angles);
- void send_preferred_angle_done(uint32_t angle);
- void send_preferred_angle_done(struct ::wl_resource *resource, uint32_t angle);
- void send_angle_change(uint32_t angle, uint32_t serial);
- void send_angle_change(struct ::wl_resource *resource, uint32_t angle, uint32_t serial);
- void send_angle_change_with_resize(uint32_t angle, uint32_t serial, uint32_t width, uint32_t height);
- void send_angle_change_with_resize(struct ::wl_resource *resource, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height);
-
- protected:
- virtual Resource *tizen_rotation_allocate();
-
- virtual void tizen_rotation_bind_resource(Resource *resource);
- virtual void tizen_rotation_destroy_resource(Resource *resource);
-
- virtual void tizen_rotation_destroy(Resource *resource);
- virtual void tizen_rotation_set_available_angles(Resource *resource, uint32_t angles);
- virtual void tizen_rotation_set_preferred_angle(Resource *resource, uint32_t angle);
- virtual void tizen_rotation_ack_angle_change(Resource *resource, uint32_t serial);
- virtual void tizen_rotation_set_geometry_hint(Resource *resource, uint32_t angle, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_rotation_interface m_tizen_rotation_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_available_angles(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t angles);
- static void handle_set_preferred_angle(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t angle);
- static void handle_ack_angle_change(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void handle_set_geometry_hint(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t angle,
- uint32_t x,
- uint32_t y,
- uint32_t w,
- uint32_t h);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_rotation *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-remote-surface.xml */
-
-#include "dswayland-server-tizen-remote-surface.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- tizen_remote_surface_manager::tizen_remote_surface_manager(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_remote_surface_manager::tizen_remote_surface_manager(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_remote_surface_manager::tizen_remote_surface_manager(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_remote_surface_manager::tizen_remote_surface_manager()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_remote_surface_manager::~tizen_remote_surface_manager()
- {
- std::multimap<struct ::wl_client*, tizen_remote_surface_manager::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_remote_surface_manager::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_remote_surface_manager::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_remote_surface_manager::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_remote_surface_manager::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_remote_surface_manager_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_remote_surface_manager::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_remote_surface_manager::interface()
- {
- return &::tizen_remote_surface_manager_interface;
- }
-
- tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::tizen_remote_surface_manager_allocate()
- {
- return new Resource;
- }
-
- void tizen_remote_surface_manager::tizen_remote_surface_manager_bind_resource(Resource *)
- {
- }
-
- void tizen_remote_surface_manager::tizen_remote_surface_manager_destroy_resource(Resource *)
- {
- }
-
- void tizen_remote_surface_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_remote_surface_manager *that = static_cast<tizen_remote_surface_manager *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_remote_surface_manager::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_remote_surface_manager *that = static_cast<tizen_remote_surface_manager::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_remote_surface_manager::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_remote_surface_manager *that = resource->tizen_remote_surface_manager_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_remote_surface_manager_destroy_resource(resource);
- delete resource;
- }
-
- tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_remote_surface_manager_interface, version, id);
- return bind(handle);
- }
-
- tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_remote_surface_manager_allocate();
- resource->tizen_remote_surface_manager_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_remote_surface_manager_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_remote_surface_manager_bind_resource(resource);
- return resource;
- }
- tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_remote_surface_manager_interface, &m_tizen_remote_surface_manager_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_remote_surface_manager_interface tizen_remote_surface_manager::m_tizen_remote_surface_manager_interface = {
- tizen_remote_surface_manager::handle_create_provider,
- tizen_remote_surface_manager::handle_create_surface,
- tizen_remote_surface_manager::handle_bind_surface,
- tizen_remote_surface_manager::handle_destroy,
- tizen_remote_surface_manager::handle_create_surface_with_wl_surface
- };
-
- void tizen_remote_surface_manager::tizen_remote_surface_manager_create_provider(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_remote_surface_manager::tizen_remote_surface_manager_create_surface(Resource *, uint32_t, uint32_t , struct ::wl_resource *)
- {
- }
-
- void tizen_remote_surface_manager::tizen_remote_surface_manager_bind_surface(Resource *, struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_remote_surface_manager::tizen_remote_surface_manager_destroy(Resource *)
- {
- }
-
- void tizen_remote_surface_manager::tizen_remote_surface_manager_create_surface_with_wl_surface(Resource *, uint32_t, uint32_t , struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
-
- void tizen_remote_surface_manager::handle_create_provider(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_manager *>(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_create_provider(
- r,
- id,
- surface);
- }
-
- void tizen_remote_surface_manager::handle_create_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t resource_id,
- struct ::wl_resource *tbm)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_manager *>(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_create_surface(
- r,
- id,
- resource_id,
- tbm);
- }
-
- void tizen_remote_surface_manager::handle_bind_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- struct ::wl_resource *remote_surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_manager *>(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_bind_surface(
- r,
- surface,
- remote_surface);
- }
-
- void tizen_remote_surface_manager::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_manager *>(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_destroy(
- r);
- }
-
- void tizen_remote_surface_manager::handle_create_surface_with_wl_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t resource_id,
- struct ::wl_resource *tbm,
- struct ::wl_resource *wayland_surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_manager *>(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_create_surface_with_wl_surface(
- r,
- id,
- resource_id,
- tbm,
- wayland_surface);
- }
-
- tizen_remote_surface_provider::tizen_remote_surface_provider(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_remote_surface_provider::tizen_remote_surface_provider(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_remote_surface_provider::tizen_remote_surface_provider(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_remote_surface_provider::tizen_remote_surface_provider()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_remote_surface_provider::~tizen_remote_surface_provider()
- {
- std::multimap<struct ::wl_client*, tizen_remote_surface_provider::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_remote_surface_provider::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_remote_surface_provider::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_remote_surface_provider::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_remote_surface_provider::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_remote_surface_provider_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_remote_surface_provider::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_remote_surface_provider::interface()
- {
- return &::tizen_remote_surface_provider_interface;
- }
-
- tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::tizen_remote_surface_provider_allocate()
- {
- return new Resource;
- }
-
- void tizen_remote_surface_provider::tizen_remote_surface_provider_bind_resource(Resource *)
- {
- }
-
- void tizen_remote_surface_provider::tizen_remote_surface_provider_destroy_resource(Resource *)
- {
- }
-
- void tizen_remote_surface_provider::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_remote_surface_provider *that = static_cast<tizen_remote_surface_provider *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_remote_surface_provider::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_remote_surface_provider *that = static_cast<tizen_remote_surface_provider::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_remote_surface_provider::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_remote_surface_provider *that = resource->tizen_remote_surface_provider_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_remote_surface_provider_destroy_resource(resource);
- delete resource;
- }
-
- tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_remote_surface_provider_interface, version, id);
- return bind(handle);
- }
-
- tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_remote_surface_provider_allocate();
- resource->tizen_remote_surface_provider_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_remote_surface_provider_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_remote_surface_provider_bind_resource(resource);
- return resource;
- }
- tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_remote_surface_provider_interface, &m_tizen_remote_surface_provider_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_remote_surface_provider_interface tizen_remote_surface_provider::m_tizen_remote_surface_provider_interface = {
- tizen_remote_surface_provider::handle_destroy,
- tizen_remote_surface_provider::handle_offscreen_set,
- tizen_remote_surface_provider::handle_set_input_event_filter
- };
-
- void tizen_remote_surface_provider::tizen_remote_surface_provider_destroy(Resource *)
- {
- }
-
- void tizen_remote_surface_provider::tizen_remote_surface_provider_offscreen_set(Resource *, uint32_t )
- {
- }
-
- void tizen_remote_surface_provider::tizen_remote_surface_provider_set_input_event_filter(Resource *, uint32_t )
- {
- }
-
-
- void tizen_remote_surface_provider::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_provider *>(r->tizen_remote_surface_provider_object)->tizen_remote_surface_provider_destroy(
- r);
- }
-
- void tizen_remote_surface_provider::handle_offscreen_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_provider *>(r->tizen_remote_surface_provider_object)->tizen_remote_surface_provider_offscreen_set(
- r,
- set);
- }
-
- void tizen_remote_surface_provider::handle_set_input_event_filter(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_filter)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_provider *>(r->tizen_remote_surface_provider_object)->tizen_remote_surface_provider_set_input_event_filter(
- r,
- event_filter);
- }
-
- void tizen_remote_surface_provider::send_resource_id(uint32_t resource_id)
- {
- DS_ASSERT_X(m_resource, "tizen_remote_surface_provider::resource_id", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_remote_surface_provider::resource_id as it's not initialised");
- return;
- }
- send_resource_id(
- m_resource->handle,
- resource_id);
- }
-
- void tizen_remote_surface_provider::send_resource_id(struct ::wl_resource *resource, uint32_t resource_id)
- {
- tizen_remote_surface_provider_send_resource_id(
- resource,
- resource_id);
- }
-
-
- void tizen_remote_surface_provider::send_visibility(uint32_t visibility)
- {
- DS_ASSERT_X(m_resource, "tizen_remote_surface_provider::visibility", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_remote_surface_provider::visibility as it's not initialised");
- return;
- }
- send_visibility(
- m_resource->handle,
- visibility);
- }
-
- void tizen_remote_surface_provider::send_visibility(struct ::wl_resource *resource, uint32_t visibility)
- {
- tizen_remote_surface_provider_send_visibility(
- resource,
- visibility);
- }
-
-
- tizen_remote_surface::tizen_remote_surface(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_remote_surface::tizen_remote_surface(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_remote_surface::tizen_remote_surface(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_remote_surface::tizen_remote_surface()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_remote_surface::~tizen_remote_surface()
- {
- std::multimap<struct ::wl_client*, tizen_remote_surface::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_remote_surface::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_remote_surface::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_remote_surface::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_remote_surface::Resource *tizen_remote_surface::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_remote_surface::Resource *tizen_remote_surface::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_remote_surface::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_remote_surface_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_remote_surface::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_remote_surface::interface()
- {
- return &::tizen_remote_surface_interface;
- }
-
- tizen_remote_surface::Resource *tizen_remote_surface::tizen_remote_surface_allocate()
- {
- return new Resource;
- }
-
- void tizen_remote_surface::tizen_remote_surface_bind_resource(Resource *)
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_destroy_resource(Resource *)
- {
- }
-
- void tizen_remote_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_remote_surface *that = static_cast<tizen_remote_surface *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_remote_surface::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_remote_surface *that = static_cast<tizen_remote_surface::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_remote_surface::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_remote_surface *that = resource->tizen_remote_surface_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_remote_surface_destroy_resource(resource);
- delete resource;
- }
-
- tizen_remote_surface::Resource *tizen_remote_surface::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_remote_surface_interface, version, id);
- return bind(handle);
- }
-
- tizen_remote_surface::Resource *tizen_remote_surface::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_remote_surface_allocate();
- resource->tizen_remote_surface_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_remote_surface_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_remote_surface_bind_resource(resource);
- return resource;
- }
- tizen_remote_surface::Resource *tizen_remote_surface::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_remote_surface_interface, &m_tizen_remote_surface_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_remote_surface_interface tizen_remote_surface::m_tizen_remote_surface_interface = {
- tizen_remote_surface::handle_destroy,
- tizen_remote_surface::handle_redirect,
- tizen_remote_surface::handle_unredirect,
- tizen_remote_surface::handle_transfer_mouse_event,
- tizen_remote_surface::handle_transfer_mouse_wheel,
- tizen_remote_surface::handle_transfer_touch_event,
- tizen_remote_surface::handle_transfer_touch_cancel,
- tizen_remote_surface::handle_transfer_key_event,
- tizen_remote_surface::handle_transfer_visibility,
- tizen_remote_surface::handle_set_owner,
- tizen_remote_surface::handle_create_region,
- tizen_remote_surface::handle_release,
- tizen_remote_surface::handle_set_remote_render,
- tizen_remote_surface::handle_set_changed_buffer_event_filter,
- tizen_remote_surface::handle_get_current_buffer
- };
-
- void tizen_remote_surface::tizen_remote_surface_destroy(Resource *)
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_redirect(Resource *)
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_unredirect(Resource *)
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_transfer_mouse_event(Resource *, uint32_t , int32_t , int32_t , int32_t , int32_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , uint32_t , uint32_t , const std::string &, uint32_t )
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_transfer_mouse_wheel(Resource *, uint32_t , int32_t , uint32_t , uint32_t , const std::string &, uint32_t )
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_transfer_touch_event(Resource *, uint32_t , int32_t , int32_t , int32_t , int32_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , uint32_t , uint32_t , const std::string &, uint32_t )
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_transfer_touch_cancel(Resource *)
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_transfer_key_event(Resource *, uint32_t , int32_t , uint32_t , uint32_t , const std::string &, uint32_t )
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_transfer_visibility(Resource *, uint32_t )
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_set_owner(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_create_region(Resource *, uint32_t)
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_release(Resource *, struct ::wl_resource *)
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_set_remote_render(Resource *, uint32_t )
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_set_changed_buffer_event_filter(Resource *, uint32_t )
- {
- }
-
- void tizen_remote_surface::tizen_remote_surface_get_current_buffer(Resource *, uint32_t , uint32_t )
- {
- }
-
-
- void tizen_remote_surface::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_destroy(
- r);
- }
-
- void tizen_remote_surface::handle_redirect(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_redirect(
- r);
- }
-
- void tizen_remote_surface::handle_unredirect(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_unredirect(
- r);
- }
-
- void tizen_remote_surface::handle_transfer_mouse_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_type,
- int32_t device,
- int32_t button,
- int32_t x,
- int32_t y,
- wl_fixed_t radius_x,
- wl_fixed_t radius_y,
- wl_fixed_t pressure,
- wl_fixed_t angle,
- uint32_t clas,
- uint32_t subclas,
- const char *identifier,
- uint32_t time)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_mouse_event(
- r,
- event_type,
- device,
- button,
- x,
- y,
- radius_x,
- radius_y,
- pressure,
- angle,
- clas,
- subclas,
- std::string(identifier),
- time);
- }
-
- void tizen_remote_surface::handle_transfer_mouse_wheel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t direction,
- int32_t z,
- uint32_t clas,
- uint32_t subclas,
- const char *identifier,
- uint32_t time)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_mouse_wheel(
- r,
- direction,
- z,
- clas,
- subclas,
- std::string(identifier),
- time);
- }
-
- void tizen_remote_surface::handle_transfer_touch_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_type,
- int32_t device,
- int32_t button,
- int32_t x,
- int32_t y,
- wl_fixed_t radius_x,
- wl_fixed_t radius_y,
- wl_fixed_t pressure,
- wl_fixed_t angle,
- uint32_t clas,
- uint32_t subclas,
- const char *identifier,
- uint32_t time)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_touch_event(
- r,
- event_type,
- device,
- button,
- x,
- y,
- radius_x,
- radius_y,
- pressure,
- angle,
- clas,
- subclas,
- std::string(identifier),
- time);
- }
-
- void tizen_remote_surface::handle_transfer_touch_cancel(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_touch_cancel(
- r);
- }
-
- void tizen_remote_surface::handle_transfer_key_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_type,
- int32_t keycode,
- uint32_t clas,
- uint32_t subclas,
- const char *identifier,
- uint32_t time)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_key_event(
- r,
- event_type,
- keycode,
- clas,
- subclas,
- std::string(identifier),
- time);
- }
-
- void tizen_remote_surface::handle_transfer_visibility(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t visibility)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_visibility(
- r,
- visibility);
- }
-
- void tizen_remote_surface::handle_set_owner(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *owner)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_set_owner(
- r,
- owner);
- }
-
- void tizen_remote_surface::handle_create_region(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_create_region(
- r,
- id);
- }
-
- void tizen_remote_surface::handle_release(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *buffer)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_release(
- r,
- buffer);
- }
-
- void tizen_remote_surface::handle_set_remote_render(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_set_remote_render(
- r,
- set);
- }
-
- void tizen_remote_surface::handle_set_changed_buffer_event_filter(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_set_changed_buffer_event_filter(
- r,
- type);
- }
-
- void tizen_remote_surface::handle_get_current_buffer(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface *>(r->tizen_remote_surface_object)->tizen_remote_surface_get_current_buffer(
- r,
- type,
- serial);
- }
-
- void tizen_remote_surface::send_update_buffer(struct ::wl_resource *buffer, uint32_t time)
- {
- DS_ASSERT_X(m_resource, "tizen_remote_surface::update_buffer", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_remote_surface::update_buffer as it's not initialised");
- return;
- }
- send_update_buffer(
- m_resource->handle,
- buffer,
- time);
- }
-
- void tizen_remote_surface::send_update_buffer(struct ::wl_resource *resource, struct ::wl_resource *buffer, uint32_t time)
- {
- tizen_remote_surface_send_update_buffer(
- resource,
- buffer,
- time);
- }
-
-
- void tizen_remote_surface::send_missing()
- {
- DS_ASSERT_X(m_resource, "tizen_remote_surface::missing", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_remote_surface::missing as it's not initialised");
- return;
- }
- send_missing(
- m_resource->handle);
- }
-
- void tizen_remote_surface::send_missing(struct ::wl_resource *resource)
- {
- tizen_remote_surface_send_missing(
- resource);
- }
-
-
- void tizen_remote_surface::send_changed_buffer(uint32_t type, struct ::wl_resource *tbm, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct ::wl_array *options)
- {
- DS_ASSERT_X(m_resource, "tizen_remote_surface::changed_buffer", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_remote_surface::changed_buffer as it's not initialised");
- return;
- }
- send_changed_buffer(
- m_resource->handle,
- type,
- tbm,
- img_file_fd,
- img_file_size,
- time,
- options);
- }
-
- void tizen_remote_surface::send_changed_buffer(struct ::wl_resource *resource, uint32_t type, struct ::wl_resource *tbm, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct ::wl_array *options)
- {
- tizen_remote_surface_send_changed_buffer(
- resource,
- type,
- tbm,
- img_file_fd,
- img_file_size,
- time,
- options);
- }
-
-
- void tizen_remote_surface::send_input_event_filter(uint32_t event_filter)
- {
- DS_ASSERT_X(m_resource, "tizen_remote_surface::input_event_filter", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_remote_surface::input_event_filter as it's not initialised");
- return;
- }
- send_input_event_filter(
- m_resource->handle,
- event_filter);
- }
-
- void tizen_remote_surface::send_input_event_filter(struct ::wl_resource *resource, uint32_t event_filter)
- {
- tizen_remote_surface_send_input_event_filter(
- resource,
- event_filter);
- }
-
-
- tizen_remote_surface_region::tizen_remote_surface_region(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_remote_surface_region::tizen_remote_surface_region(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_remote_surface_region::tizen_remote_surface_region(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_remote_surface_region::tizen_remote_surface_region()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_remote_surface_region::~tizen_remote_surface_region()
- {
- std::multimap<struct ::wl_client*, tizen_remote_surface_region::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_remote_surface_region::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_remote_surface_region::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_remote_surface_region::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_remote_surface_region::Resource *tizen_remote_surface_region::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_remote_surface_region::Resource *tizen_remote_surface_region::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_remote_surface_region::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_remote_surface_region_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_remote_surface_region::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_remote_surface_region::interface()
- {
- return &::tizen_remote_surface_region_interface;
- }
-
- tizen_remote_surface_region::Resource *tizen_remote_surface_region::tizen_remote_surface_region_allocate()
- {
- return new Resource;
- }
-
- void tizen_remote_surface_region::tizen_remote_surface_region_bind_resource(Resource *)
- {
- }
-
- void tizen_remote_surface_region::tizen_remote_surface_region_destroy_resource(Resource *)
- {
- }
-
- void tizen_remote_surface_region::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_remote_surface_region *that = static_cast<tizen_remote_surface_region *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_remote_surface_region::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_remote_surface_region *that = static_cast<tizen_remote_surface_region::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_remote_surface_region::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_remote_surface_region *that = resource->tizen_remote_surface_region_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_remote_surface_region_destroy_resource(resource);
- delete resource;
- }
-
- tizen_remote_surface_region::Resource *tizen_remote_surface_region::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_remote_surface_region_interface, version, id);
- return bind(handle);
- }
-
- tizen_remote_surface_region::Resource *tizen_remote_surface_region::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_remote_surface_region_allocate();
- resource->tizen_remote_surface_region_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_remote_surface_region_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_remote_surface_region_bind_resource(resource);
- return resource;
- }
- tizen_remote_surface_region::Resource *tizen_remote_surface_region::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_remote_surface_region_interface, &m_tizen_remote_surface_region_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_remote_surface_region_interface tizen_remote_surface_region::m_tizen_remote_surface_region_interface = {
- tizen_remote_surface_region::handle_destroy,
- tizen_remote_surface_region::handle_set_geometry
- };
-
- void tizen_remote_surface_region::tizen_remote_surface_region_destroy(Resource *)
- {
- }
-
- void tizen_remote_surface_region::tizen_remote_surface_region_set_geometry(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
-
- void tizen_remote_surface_region::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_region *>(r->tizen_remote_surface_region_object)->tizen_remote_surface_region_destroy(
- r);
- }
-
- void tizen_remote_surface_region::handle_set_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_remote_surface_region *>(r->tizen_remote_surface_region_object)->tizen_remote_surface_region_set_geometry(
- r,
- x,
- y,
- w,
- h);
- }
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-remote-surface.xml */
-
-#ifndef __DS_TIZEN_REMOTE_SURFACE_PROTOCOL_H__
-#define __DS_TIZEN_REMOTE_SURFACE_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "tizen-remote-surface-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class tizen_remote_surface_manager
- {
- public:
- tizen_remote_surface_manager(struct ::wl_client *client, uint32_t id, int version);
- tizen_remote_surface_manager(struct ::wl_display *display, int version);
- tizen_remote_surface_manager(struct ::wl_resource *resource);
- tizen_remote_surface_manager();
-
- virtual ~tizen_remote_surface_manager();
-
- class Resource
- {
- public:
- Resource() : tizen_remote_surface_manager_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_remote_surface_manager *tizen_remote_surface_manager_object;
- tizen_remote_surface_manager *object() { return tizen_remote_surface_manager_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tizen_remote_surface_manager_allocate();
-
- virtual void tizen_remote_surface_manager_bind_resource(Resource *resource);
- virtual void tizen_remote_surface_manager_destroy_resource(Resource *resource);
-
- virtual void tizen_remote_surface_manager_create_provider(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_remote_surface_manager_create_surface(Resource *resource, uint32_t id, uint32_t resource_id, struct ::wl_resource *tbm);
- virtual void tizen_remote_surface_manager_bind_surface(Resource *resource, struct ::wl_resource *surface, struct ::wl_resource *remote_surface);
- virtual void tizen_remote_surface_manager_destroy(Resource *resource);
- virtual void tizen_remote_surface_manager_create_surface_with_wl_surface(Resource *resource, uint32_t id, uint32_t resource_id, struct ::wl_resource *tbm, struct ::wl_resource *wayland_surface);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_remote_surface_manager_interface m_tizen_remote_surface_manager_interface;
-
- static void handle_create_provider(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_create_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t resource_id,
- struct ::wl_resource *tbm);
- static void handle_bind_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *surface,
- struct ::wl_resource *remote_surface);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_create_surface_with_wl_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t resource_id,
- struct ::wl_resource *tbm,
- struct ::wl_resource *wayland_surface);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_remote_surface_manager *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_remote_surface_provider
- {
- public:
- tizen_remote_surface_provider(struct ::wl_client *client, uint32_t id, int version);
- tizen_remote_surface_provider(struct ::wl_display *display, int version);
- tizen_remote_surface_provider(struct ::wl_resource *resource);
- tizen_remote_surface_provider();
-
- virtual ~tizen_remote_surface_provider();
-
- class Resource
- {
- public:
- Resource() : tizen_remote_surface_provider_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_remote_surface_provider *tizen_remote_surface_provider_object;
- tizen_remote_surface_provider *object() { return tizen_remote_surface_provider_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum visibility_type {
- visibility_type_visible = 0,
- visibility_type_invisible = 1,
- };
-
- void send_resource_id(uint32_t resource_id);
- void send_resource_id(struct ::wl_resource *resource, uint32_t resource_id);
- void send_visibility(uint32_t visibility);
- void send_visibility(struct ::wl_resource *resource, uint32_t visibility);
-
- protected:
- virtual Resource *tizen_remote_surface_provider_allocate();
-
- virtual void tizen_remote_surface_provider_bind_resource(Resource *resource);
- virtual void tizen_remote_surface_provider_destroy_resource(Resource *resource);
-
- virtual void tizen_remote_surface_provider_destroy(Resource *resource);
- virtual void tizen_remote_surface_provider_offscreen_set(Resource *resource, uint32_t set);
- virtual void tizen_remote_surface_provider_set_input_event_filter(Resource *resource, uint32_t event_filter);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_remote_surface_provider_interface m_tizen_remote_surface_provider_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_offscreen_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set);
- static void handle_set_input_event_filter(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_filter);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_remote_surface_provider *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_remote_surface
- {
- public:
- tizen_remote_surface(struct ::wl_client *client, uint32_t id, int version);
- tizen_remote_surface(struct ::wl_display *display, int version);
- tizen_remote_surface(struct ::wl_resource *resource);
- tizen_remote_surface();
-
- virtual ~tizen_remote_surface();
-
- class Resource
- {
- public:
- Resource() : tizen_remote_surface_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_remote_surface *tizen_remote_surface_object;
- tizen_remote_surface *object() { return tizen_remote_surface_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum event_type {
- event_type_none = 0,
- event_type_mouse_down = 1,
- event_type_mouse_up = 2,
- event_type_mouse_move = 3,
- event_type_touch_down = 4,
- event_type_touch_up = 5,
- event_type_touch_move = 6,
- event_type_key_down = 7,
- event_type_key_up = 8,
- event_type_mouse_in = 9,
- event_type_mouse_out = 10,
- event_type_key_cancel = 11,
- };
-
- enum visibility_type {
- visibility_type_visible = 0,
- visibility_type_invisible = 1,
- };
-
- enum buffer_type {
- buffer_type_tbm = 0, // tbm type
- buffer_type_image_file = 1, // image file type
- };
-
- enum input_event_filter {
- input_event_filter_mouse_none = 0x00000001,
- input_event_filter_mouse_up_down = 0x00000002,
- input_event_filter_mouse_move_x = 0x00000003,
- input_event_filter_mouse_move_y = 0x00000004,
- input_event_filter_mouse_move_x_y = 0x00000005,
- input_event_filter_mouse_up_down_move_x = 0x00000006,
- input_event_filter_mouse_up_down_move_y = 0x00000007,
- input_event_filter_mouse_up_down_move_x_y = 0x00000008,
- input_event_filter_mouse_all = 0x0000000e,
- input_event_filter_mouse_flag = 0x0000000f,
- input_event_filter_mouse_wheel_none = 0x00000010,
- input_event_filter_mouse_wheel_all = 0x000000e0,
- input_event_filter_mouse_wheel_flag = 0x000000f0,
- input_event_filter_touch_none = 0x00000100,
- input_event_filter_touch_up_down = 0x00000200,
- input_event_filter_touch_move_x = 0x00000300,
- input_event_filter_touch_move_y = 0x00000400,
- input_event_filter_touch_move_x_y = 0x00000500,
- input_event_filter_touch_up_down_move_x = 0x00000600,
- input_event_filter_touch_up_down_move_y = 0x00000700,
- input_event_filter_touch_up_down_move_x_y = 0x00000800,
- input_event_filter_touch_all = 0x00000e00,
- input_event_filter_touch_flag = 0x00000f00,
- input_event_filter_touch_cancel_none = 0x00001000,
- input_event_filter_touch_cancel_all = 0x0000e000,
- input_event_filter_touch_cancel_flag = 0x0000f000,
- input_event_filter_key_none = 0x00010000,
- input_event_filter_key_all = 0x000e0000,
- input_event_filter_key_flag = 0x000f0000,
- };
-
- enum changed_buffer_event_filter {
- changed_buffer_event_filter_none = 0x00000000, // none
- changed_buffer_event_filter_tbm = 0x00000001, // tbm type filter
- changed_buffer_event_filter_image_file = 0x00000002, // image file type filter
- };
-
- void send_update_buffer(struct ::wl_resource *buffer, uint32_t time);
- void send_update_buffer(struct ::wl_resource *resource, struct ::wl_resource *buffer, uint32_t time);
- void send_missing();
- void send_missing(struct ::wl_resource *resource);
- void send_changed_buffer(uint32_t type, struct ::wl_resource *tbm, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct ::wl_array *options);
- void send_changed_buffer(struct ::wl_resource *resource, uint32_t type, struct ::wl_resource *tbm, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, struct ::wl_array *options);
- void send_input_event_filter(uint32_t event_filter);
- void send_input_event_filter(struct ::wl_resource *resource, uint32_t event_filter);
-
- protected:
- virtual Resource *tizen_remote_surface_allocate();
-
- virtual void tizen_remote_surface_bind_resource(Resource *resource);
- virtual void tizen_remote_surface_destroy_resource(Resource *resource);
-
- virtual void tizen_remote_surface_destroy(Resource *resource);
- virtual void tizen_remote_surface_redirect(Resource *resource);
- virtual void tizen_remote_surface_unredirect(Resource *resource);
- virtual void tizen_remote_surface_transfer_mouse_event(Resource *resource, uint32_t event_type, int32_t device, int32_t button, int32_t x, int32_t y, wl_fixed_t radius_x, wl_fixed_t radius_y, wl_fixed_t pressure, wl_fixed_t angle, uint32_t clas, uint32_t subclas, const std::string &identifier, uint32_t time);
- virtual void tizen_remote_surface_transfer_mouse_wheel(Resource *resource, uint32_t direction, int32_t z, uint32_t clas, uint32_t subclas, const std::string &identifier, uint32_t time);
- virtual void tizen_remote_surface_transfer_touch_event(Resource *resource, uint32_t event_type, int32_t device, int32_t button, int32_t x, int32_t y, wl_fixed_t radius_x, wl_fixed_t radius_y, wl_fixed_t pressure, wl_fixed_t angle, uint32_t clas, uint32_t subclas, const std::string &identifier, uint32_t time);
- virtual void tizen_remote_surface_transfer_touch_cancel(Resource *resource);
- virtual void tizen_remote_surface_transfer_key_event(Resource *resource, uint32_t event_type, int32_t keycode, uint32_t clas, uint32_t subclas, const std::string &identifier, uint32_t time);
- virtual void tizen_remote_surface_transfer_visibility(Resource *resource, uint32_t visibility);
- virtual void tizen_remote_surface_set_owner(Resource *resource, struct ::wl_resource *owner);
- virtual void tizen_remote_surface_create_region(Resource *resource, uint32_t id);
- virtual void tizen_remote_surface_release(Resource *resource, struct ::wl_resource *buffer);
- virtual void tizen_remote_surface_set_remote_render(Resource *resource, uint32_t set);
- virtual void tizen_remote_surface_set_changed_buffer_event_filter(Resource *resource, uint32_t type);
- virtual void tizen_remote_surface_get_current_buffer(Resource *resource, uint32_t type, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_remote_surface_interface m_tizen_remote_surface_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_redirect(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_unredirect(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_transfer_mouse_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_type,
- int32_t device,
- int32_t button,
- int32_t x,
- int32_t y,
- wl_fixed_t radius_x,
- wl_fixed_t radius_y,
- wl_fixed_t pressure,
- wl_fixed_t angle,
- uint32_t clas,
- uint32_t subclas,
- const char *identifier,
- uint32_t time);
- static void handle_transfer_mouse_wheel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t direction,
- int32_t z,
- uint32_t clas,
- uint32_t subclas,
- const char *identifier,
- uint32_t time);
- static void handle_transfer_touch_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_type,
- int32_t device,
- int32_t button,
- int32_t x,
- int32_t y,
- wl_fixed_t radius_x,
- wl_fixed_t radius_y,
- wl_fixed_t pressure,
- wl_fixed_t angle,
- uint32_t clas,
- uint32_t subclas,
- const char *identifier,
- uint32_t time);
- static void handle_transfer_touch_cancel(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_transfer_key_event(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t event_type,
- int32_t keycode,
- uint32_t clas,
- uint32_t subclas,
- const char *identifier,
- uint32_t time);
- static void handle_transfer_visibility(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t visibility);
- static void handle_set_owner(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *owner);
- static void handle_create_region(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *buffer);
- static void handle_set_remote_render(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t set);
- static void handle_set_changed_buffer_event_filter(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type);
- static void handle_get_current_buffer(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_remote_surface *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_remote_surface_region
- {
- public:
- tizen_remote_surface_region(struct ::wl_client *client, uint32_t id, int version);
- tizen_remote_surface_region(struct ::wl_display *display, int version);
- tizen_remote_surface_region(struct ::wl_resource *resource);
- tizen_remote_surface_region();
-
- virtual ~tizen_remote_surface_region();
-
- class Resource
- {
- public:
- Resource() : tizen_remote_surface_region_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_remote_surface_region *tizen_remote_surface_region_object;
- tizen_remote_surface_region *object() { return tizen_remote_surface_region_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tizen_remote_surface_region_allocate();
-
- virtual void tizen_remote_surface_region_bind_resource(Resource *resource);
- virtual void tizen_remote_surface_region_destroy_resource(Resource *resource);
-
- virtual void tizen_remote_surface_region_destroy(Resource *resource);
- virtual void tizen_remote_surface_region_set_geometry(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_remote_surface_region_interface m_tizen_remote_surface_region_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_remote_surface_region *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-surface.xml */
-
-#include "dswayland-server-tizen-surface.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- tizen_surface_shm::tizen_surface_shm(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_surface_shm::tizen_surface_shm(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_surface_shm::tizen_surface_shm(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_surface_shm::tizen_surface_shm()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_surface_shm::~tizen_surface_shm()
- {
- std::multimap<struct ::wl_client*, tizen_surface_shm::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_surface_shm::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_surface_shm::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_surface_shm::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_surface_shm::Resource *tizen_surface_shm::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_surface_shm::Resource *tizen_surface_shm::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_surface_shm::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_surface_shm_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_surface_shm::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_surface_shm::interface()
- {
- return &::tizen_surface_shm_interface;
- }
-
- tizen_surface_shm::Resource *tizen_surface_shm::tizen_surface_shm_allocate()
- {
- return new Resource;
- }
-
- void tizen_surface_shm::tizen_surface_shm_bind_resource(Resource *)
- {
- }
-
- void tizen_surface_shm::tizen_surface_shm_destroy_resource(Resource *)
- {
- }
-
- void tizen_surface_shm::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_surface_shm *that = static_cast<tizen_surface_shm *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_surface_shm::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_surface_shm *that = static_cast<tizen_surface_shm::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_surface_shm::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_surface_shm *that = resource->tizen_surface_shm_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_surface_shm_destroy_resource(resource);
- delete resource;
- }
-
- tizen_surface_shm::Resource *tizen_surface_shm::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_surface_shm_interface, version, id);
- return bind(handle);
- }
-
- tizen_surface_shm::Resource *tizen_surface_shm::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_surface_shm_allocate();
- resource->tizen_surface_shm_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_surface_shm_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_surface_shm_bind_resource(resource);
- return resource;
- }
- tizen_surface_shm::Resource *tizen_surface_shm::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_surface_shm_interface, &m_tizen_surface_shm_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_surface_shm_interface tizen_surface_shm::m_tizen_surface_shm_interface = {
- tizen_surface_shm::handle_get_flusher,
- tizen_surface_shm::handle_destroy
- };
-
- void tizen_surface_shm::tizen_surface_shm_get_flusher(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void tizen_surface_shm::tizen_surface_shm_destroy(Resource *)
- {
- }
-
-
- void tizen_surface_shm::handle_get_flusher(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_surface_shm *>(r->tizen_surface_shm_object)->tizen_surface_shm_get_flusher(
- r,
- id,
- surface);
- }
-
- void tizen_surface_shm::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_surface_shm *>(r->tizen_surface_shm_object)->tizen_surface_shm_destroy(
- r);
- }
-
- tizen_surface_shm_flusher::tizen_surface_shm_flusher(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_surface_shm_flusher::tizen_surface_shm_flusher(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_surface_shm_flusher::tizen_surface_shm_flusher(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_surface_shm_flusher::tizen_surface_shm_flusher()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_surface_shm_flusher::~tizen_surface_shm_flusher()
- {
- std::multimap<struct ::wl_client*, tizen_surface_shm_flusher::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_surface_shm_flusher::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_surface_shm_flusher::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_surface_shm_flusher::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_surface_shm_flusher::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_surface_shm_flusher_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_surface_shm_flusher::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_surface_shm_flusher::interface()
- {
- return &::tizen_surface_shm_flusher_interface;
- }
-
- tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::tizen_surface_shm_flusher_allocate()
- {
- return new Resource;
- }
-
- void tizen_surface_shm_flusher::tizen_surface_shm_flusher_bind_resource(Resource *)
- {
- }
-
- void tizen_surface_shm_flusher::tizen_surface_shm_flusher_destroy_resource(Resource *)
- {
- }
-
- void tizen_surface_shm_flusher::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_surface_shm_flusher *that = static_cast<tizen_surface_shm_flusher *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_surface_shm_flusher::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_surface_shm_flusher *that = static_cast<tizen_surface_shm_flusher::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_surface_shm_flusher::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_surface_shm_flusher *that = resource->tizen_surface_shm_flusher_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_surface_shm_flusher_destroy_resource(resource);
- delete resource;
- }
-
- tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_surface_shm_flusher_interface, version, id);
- return bind(handle);
- }
-
- tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_surface_shm_flusher_allocate();
- resource->tizen_surface_shm_flusher_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_surface_shm_flusher_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_surface_shm_flusher_bind_resource(resource);
- return resource;
- }
- tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_surface_shm_flusher_interface, &m_tizen_surface_shm_flusher_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_surface_shm_flusher_interface tizen_surface_shm_flusher::m_tizen_surface_shm_flusher_interface = {
- tizen_surface_shm_flusher::handle_destroy
- };
-
- void tizen_surface_shm_flusher::tizen_surface_shm_flusher_destroy(Resource *)
- {
- }
-
-
- void tizen_surface_shm_flusher::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_surface_shm_flusher *>(r->tizen_surface_shm_flusher_object)->tizen_surface_shm_flusher_destroy(
- r);
- }
-
- void tizen_surface_shm_flusher::send_flush()
- {
- DS_ASSERT_X(m_resource, "tizen_surface_shm_flusher::flush", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_surface_shm_flusher::flush as it's not initialised");
- return;
- }
- send_flush(
- m_resource->handle);
- }
-
- void tizen_surface_shm_flusher::send_flush(struct ::wl_resource *resource)
- {
- tizen_surface_shm_flusher_send_flush(
- resource);
- }
-
-
- void tizen_surface_shm_flusher::send_free_flush()
- {
- DS_ASSERT_X(m_resource, "tizen_surface_shm_flusher::free_flush", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_surface_shm_flusher::free_flush as it's not initialised");
- return;
- }
- send_free_flush(
- m_resource->handle);
- }
-
- void tizen_surface_shm_flusher::send_free_flush(struct ::wl_resource *resource)
- {
- tizen_surface_shm_flusher_send_free_flush(
- resource);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tizen-surface.xml */
-
-#ifndef __DS_TIZEN_SURFACE_PROTOCOL_H__
-#define __DS_TIZEN_SURFACE_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "tizen-surface-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class tizen_surface_shm
- {
- public:
- tizen_surface_shm(struct ::wl_client *client, uint32_t id, int version);
- tizen_surface_shm(struct ::wl_display *display, int version);
- tizen_surface_shm(struct ::wl_resource *resource);
- tizen_surface_shm();
-
- virtual ~tizen_surface_shm();
-
- class Resource
- {
- public:
- Resource() : tizen_surface_shm_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_surface_shm *tizen_surface_shm_object;
- tizen_surface_shm *object() { return tizen_surface_shm_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tizen_surface_shm_allocate();
-
- virtual void tizen_surface_shm_bind_resource(Resource *resource);
- virtual void tizen_surface_shm_destroy_resource(Resource *resource);
-
- virtual void tizen_surface_shm_get_flusher(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void tizen_surface_shm_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_surface_shm_interface m_tizen_surface_shm_interface;
-
- static void handle_get_flusher(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_surface_shm *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tizen_surface_shm_flusher
- {
- public:
- tizen_surface_shm_flusher(struct ::wl_client *client, uint32_t id, int version);
- tizen_surface_shm_flusher(struct ::wl_display *display, int version);
- tizen_surface_shm_flusher(struct ::wl_resource *resource);
- tizen_surface_shm_flusher();
-
- virtual ~tizen_surface_shm_flusher();
-
- class Resource
- {
- public:
- Resource() : tizen_surface_shm_flusher_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_surface_shm_flusher *tizen_surface_shm_flusher_object;
- tizen_surface_shm_flusher *object() { return tizen_surface_shm_flusher_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_flush();
- void send_flush(struct ::wl_resource *resource);
- void send_free_flush();
- void send_free_flush(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *tizen_surface_shm_flusher_allocate();
-
- virtual void tizen_surface_shm_flusher_bind_resource(Resource *resource);
- virtual void tizen_surface_shm_flusher_destroy_resource(Resource *resource);
-
- virtual void tizen_surface_shm_flusher_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_surface_shm_flusher_interface m_tizen_surface_shm_flusher_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_surface_shm_flusher *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/transform.xml */
-
-#include "dswayland-server-transform.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- wl_transform::wl_transform(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_transform::wl_transform(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_transform::wl_transform(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_transform::wl_transform()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_transform::~wl_transform()
- {
- std::multimap<struct ::wl_client*, wl_transform::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_transform::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_transform::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_transform::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_transform::Resource *wl_transform::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_transform::Resource *wl_transform::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_transform::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_transform_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_transform::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_transform::interface()
- {
- return &::wl_transform_interface;
- }
-
- wl_transform::Resource *wl_transform::transform_allocate()
- {
- return new Resource;
- }
-
- void wl_transform::transform_bind_resource(Resource *)
- {
- }
-
- void wl_transform::transform_destroy_resource(Resource *)
- {
- }
-
- void wl_transform::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_transform *that = static_cast<wl_transform *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_transform::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_transform *that = static_cast<wl_transform::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_transform::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_transform *that = resource->transform_object;
- that->m_resource_map.erase(resource->client());
- that->transform_destroy_resource(resource);
- delete resource;
- }
-
- wl_transform::Resource *wl_transform::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_transform_interface, version, id);
- return bind(handle);
- }
-
- wl_transform::Resource *wl_transform::bind(struct ::wl_resource *handle)
- {
- Resource *resource = transform_allocate();
- resource->transform_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_transform_interface, resource, destroy_func);
- resource->handle = handle;
- transform_bind_resource(resource);
- return resource;
- }
- wl_transform::Resource *wl_transform::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_transform_interface, &m_wl_transform_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_transform_interface wl_transform::m_wl_transform_interface = {
- wl_transform::handle_destroy,
- wl_transform::handle_get_rotator
- };
-
- void wl_transform::transform_destroy(Resource *)
- {
- }
-
- void wl_transform::transform_get_rotator(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
-
- void wl_transform::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_transform *>(r->transform_object)->transform_destroy(
- r);
- }
-
- void wl_transform::handle_get_rotator(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_transform *>(r->transform_object)->transform_get_rotator(
- r,
- id,
- surface);
- }
-
- wl_rotator::wl_rotator(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_rotator::wl_rotator(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_rotator::wl_rotator(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_rotator::wl_rotator()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_rotator::~wl_rotator()
- {
- std::multimap<struct ::wl_client*, wl_rotator::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_rotator::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_rotator::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_rotator::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_rotator::Resource *wl_rotator::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_rotator::Resource *wl_rotator::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_rotator::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_rotator_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_rotator::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_rotator::interface()
- {
- return &::wl_rotator_interface;
- }
-
- wl_rotator::Resource *wl_rotator::rotator_allocate()
- {
- return new Resource;
- }
-
- void wl_rotator::rotator_bind_resource(Resource *)
- {
- }
-
- void wl_rotator::rotator_destroy_resource(Resource *)
- {
- }
-
- void wl_rotator::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_rotator *that = static_cast<wl_rotator *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_rotator::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_rotator *that = static_cast<wl_rotator::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_rotator::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_rotator *that = resource->rotator_object;
- that->m_resource_map.erase(resource->client());
- that->rotator_destroy_resource(resource);
- delete resource;
- }
-
- wl_rotator::Resource *wl_rotator::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_rotator_interface, version, id);
- return bind(handle);
- }
-
- wl_rotator::Resource *wl_rotator::bind(struct ::wl_resource *handle)
- {
- Resource *resource = rotator_allocate();
- resource->rotator_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_rotator_interface, resource, destroy_func);
- resource->handle = handle;
- rotator_bind_resource(resource);
- return resource;
- }
- wl_rotator::Resource *wl_rotator::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_rotator_interface, &m_wl_rotator_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_rotator_interface wl_rotator::m_wl_rotator_interface = {
- wl_rotator::handle_destroy,
- wl_rotator::handle_set,
- wl_rotator::handle_unset
- };
-
- void wl_rotator::rotator_destroy(Resource *)
- {
- }
-
- void wl_rotator::rotator_set(Resource *)
- {
- }
-
- void wl_rotator::rotator_unset(Resource *)
- {
- }
-
-
- void wl_rotator::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_rotator *>(r->rotator_object)->rotator_destroy(
- r);
- }
-
- void wl_rotator::handle_set(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_rotator *>(r->rotator_object)->rotator_set(
- r);
- }
-
- void wl_rotator::handle_unset(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_rotator *>(r->rotator_object)->rotator_unset(
- r);
- }
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/transform.xml */
-
-#ifndef __DS_TRANSFORM_PROTOCOL_H__
-#define __DS_TRANSFORM_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "transform-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class wl_transform
- {
- public:
- wl_transform(struct ::wl_client *client, uint32_t id, int version);
- wl_transform(struct ::wl_display *display, int version);
- wl_transform(struct ::wl_resource *resource);
- wl_transform();
-
- virtual ~wl_transform();
-
- class Resource
- {
- public:
- Resource() : transform_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_transform *transform_object;
- wl_transform *object() { return transform_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *transform_allocate();
-
- virtual void transform_bind_resource(Resource *resource);
- virtual void transform_destroy_resource(Resource *resource);
-
- virtual void transform_destroy(Resource *resource);
- virtual void transform_get_rotator(Resource *resource, uint32_t id, struct ::wl_resource *surface);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_transform_interface m_wl_transform_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_get_rotator(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_transform *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_rotator
- {
- public:
- wl_rotator(struct ::wl_client *client, uint32_t id, int version);
- wl_rotator(struct ::wl_display *display, int version);
- wl_rotator(struct ::wl_resource *resource);
- wl_rotator();
-
- virtual ~wl_rotator();
-
- class Resource
- {
- public:
- Resource() : rotator_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_rotator *rotator_object;
- wl_rotator *object() { return rotator_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_bad_value = 0, // negative or zero values in width or height
- };
-
- protected:
- virtual Resource *rotator_allocate();
-
- virtual void rotator_bind_resource(Resource *resource);
- virtual void rotator_destroy_resource(Resource *resource);
-
- virtual void rotator_destroy(Resource *resource);
- virtual void rotator_set(Resource *resource);
- virtual void rotator_unset(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_rotator_interface m_wl_rotator_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_unset(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_rotator *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tzsh.xml */
-
-#include "dswayland-server-tizen-ws-shell.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- tizen_ws_shell::tizen_ws_shell(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tizen_ws_shell::tizen_ws_shell(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tizen_ws_shell::tizen_ws_shell(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tizen_ws_shell::tizen_ws_shell()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tizen_ws_shell::~tizen_ws_shell()
- {
- std::multimap<struct ::wl_client*, tizen_ws_shell::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_ws_shell::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_ws_shell::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_ws_shell::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_ws_shell::Resource *tizen_ws_shell::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_ws_shell::Resource *tizen_ws_shell::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_ws_shell::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_ws_shell_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_ws_shell::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_ws_shell::interface()
- {
- return &::tizen_ws_shell_interface;
- }
-
- tizen_ws_shell::Resource *tizen_ws_shell::tizen_ws_shell_allocate()
- {
- return new Resource;
- }
-
- void tizen_ws_shell::tizen_ws_shell_bind_resource(Resource *)
- {
- }
-
- void tizen_ws_shell::tizen_ws_shell_destroy_resource(Resource *)
- {
- }
-
- void tizen_ws_shell::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_ws_shell *that = static_cast<tizen_ws_shell *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_ws_shell::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_ws_shell *that = static_cast<tizen_ws_shell::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_ws_shell::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_ws_shell *that = resource->tizen_ws_shell_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_ws_shell_destroy_resource(resource);
- delete resource;
- }
-
- tizen_ws_shell::Resource *tizen_ws_shell::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_ws_shell_interface, version, id);
- return bind(handle);
- }
-
- tizen_ws_shell::Resource *tizen_ws_shell::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_ws_shell_allocate();
- resource->tizen_ws_shell_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_ws_shell_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_ws_shell_bind_resource(resource);
- return resource;
- }
- tizen_ws_shell::Resource *tizen_ws_shell::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_ws_shell_interface, &m_tizen_ws_shell_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_ws_shell_interface tizen_ws_shell::m_tizen_ws_shell_interface = {
- tizen_ws_shell::handle_destroy,
- tizen_ws_shell::handle_service_create,
- tizen_ws_shell::handle_region_create,
- tizen_ws_shell::handle_quickpanel_get,
- tizen_ws_shell::handle_extension_get,
- tizen_ws_shell::handle_softkey_get,
- tizen_ws_shell::handle_shared_widget_launch_get
- };
-
- void tizen_ws_shell::tizen_ws_shell_destroy(Resource *)
- {
- }
-
- void tizen_ws_shell::tizen_ws_shell_service_create(Resource *, uint32_t, uint32_t , const std::string &)
- {
- }
-
- void tizen_ws_shell::tizen_ws_shell_region_create(Resource *, uint32_t)
- {
- }
-
- void tizen_ws_shell::tizen_ws_shell_quickpanel_get(Resource *, uint32_t, uint32_t )
- {
- }
-
- void tizen_ws_shell::tizen_ws_shell_extension_get(Resource *, uint32_t, const std::string &)
- {
- }
-
- void tizen_ws_shell::tizen_ws_shell_softkey_get(Resource *, uint32_t, uint32_t )
- {
- }
-
- void tizen_ws_shell::tizen_ws_shell_shared_widget_launch_get(Resource *, uint32_t, uint32_t )
- {
- }
-
-
- void tizen_ws_shell::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_ws_shell *>(r->tizen_ws_shell_object)->tizen_ws_shell_destroy(
- r);
- }
-
- void tizen_ws_shell::handle_service_create(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t win,
- const char *name)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_ws_shell *>(r->tizen_ws_shell_object)->tizen_ws_shell_service_create(
- r,
- id,
- win,
- std::string(name));
- }
-
- void tizen_ws_shell::handle_region_create(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_ws_shell *>(r->tizen_ws_shell_object)->tizen_ws_shell_region_create(
- r,
- id);
- }
-
- void tizen_ws_shell::handle_quickpanel_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t win)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_ws_shell *>(r->tizen_ws_shell_object)->tizen_ws_shell_quickpanel_get(
- r,
- id,
- win);
- }
-
- void tizen_ws_shell::handle_extension_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- const char *name)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_ws_shell *>(r->tizen_ws_shell_object)->tizen_ws_shell_extension_get(
- r,
- id,
- std::string(name));
- }
-
- void tizen_ws_shell::handle_softkey_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t win)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_ws_shell *>(r->tizen_ws_shell_object)->tizen_ws_shell_softkey_get(
- r,
- id,
- win);
- }
-
- void tizen_ws_shell::handle_shared_widget_launch_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t win)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_ws_shell *>(r->tizen_ws_shell_object)->tizen_ws_shell_shared_widget_launch_get(
- r,
- id,
- win);
- }
-
- void tizen_ws_shell::send_service_register(const std::string &name)
- {
- DS_ASSERT_X(m_resource, "tizen_ws_shell::service_register", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_ws_shell::service_register as it's not initialised");
- return;
- }
- send_service_register(
- m_resource->handle,
- name);
- }
-
- void tizen_ws_shell::send_service_register(struct ::wl_resource *resource, const std::string &name)
- {
- tizen_ws_shell_send_service_register(
- resource,
- name.c_str());
- }
-
-
- void tizen_ws_shell::send_service_unregister(const std::string &name)
- {
- DS_ASSERT_X(m_resource, "tizen_ws_shell::service_unregister", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_ws_shell::service_unregister as it's not initialised");
- return;
- }
- send_service_unregister(
- m_resource->handle,
- name);
- }
-
- void tizen_ws_shell::send_service_unregister(struct ::wl_resource *resource, const std::string &name)
- {
- tizen_ws_shell_send_service_unregister(
- resource,
- name.c_str());
- }
-
-
- void tizen_ws_shell::send_error(uint32_t error_state)
- {
- DS_ASSERT_X(m_resource, "tizen_ws_shell::error", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_ws_shell::error as it's not initialised");
- return;
- }
- send_error(
- m_resource->handle,
- error_state);
- }
-
- void tizen_ws_shell::send_error(struct ::wl_resource *resource, uint32_t error_state)
- {
- tizen_ws_shell_send_error(
- resource,
- error_state);
- }
-
-
- tws_quickpanel::tws_quickpanel(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_quickpanel::tws_quickpanel(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_quickpanel::tws_quickpanel(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_quickpanel::tws_quickpanel()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_quickpanel::~tws_quickpanel()
- {
- std::multimap<struct ::wl_client*, tws_quickpanel::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_quickpanel::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_quickpanel::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_quickpanel::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_quickpanel::Resource *tws_quickpanel::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_quickpanel::Resource *tws_quickpanel::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_quickpanel::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_quickpanel_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_quickpanel::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_quickpanel::interface()
- {
- return &::tws_quickpanel_interface;
- }
-
- tws_quickpanel::Resource *tws_quickpanel::tws_quickpanel_allocate()
- {
- return new Resource;
- }
-
- void tws_quickpanel::tws_quickpanel_bind_resource(Resource *)
- {
- }
-
- void tws_quickpanel::tws_quickpanel_destroy_resource(Resource *)
- {
- }
-
- void tws_quickpanel::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_quickpanel *that = static_cast<tws_quickpanel *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_quickpanel::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_quickpanel *that = static_cast<tws_quickpanel::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_quickpanel::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_quickpanel *that = resource->tws_quickpanel_object;
- that->m_resource_map.erase(resource->client());
- that->tws_quickpanel_destroy_resource(resource);
- delete resource;
- }
-
- tws_quickpanel::Resource *tws_quickpanel::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_quickpanel_interface, version, id);
- return bind(handle);
- }
-
- tws_quickpanel::Resource *tws_quickpanel::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_quickpanel_allocate();
- resource->tws_quickpanel_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_quickpanel_interface, resource, destroy_func);
- resource->handle = handle;
- tws_quickpanel_bind_resource(resource);
- return resource;
- }
- tws_quickpanel::Resource *tws_quickpanel::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_quickpanel_interface, &m_tws_quickpanel_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_quickpanel_interface tws_quickpanel::m_tws_quickpanel_interface = {
- tws_quickpanel::handle_release,
- tws_quickpanel::handle_show,
- tws_quickpanel::handle_hide,
- tws_quickpanel::handle_enable,
- tws_quickpanel::handle_disable,
- tws_quickpanel::handle_state_get,
- tws_quickpanel::handle_type_set,
- tws_quickpanel::handle_scrollable_state_set
- };
-
- void tws_quickpanel::tws_quickpanel_release(Resource *)
- {
- }
-
- void tws_quickpanel::tws_quickpanel_show(Resource *)
- {
- }
-
- void tws_quickpanel::tws_quickpanel_hide(Resource *)
- {
- }
-
- void tws_quickpanel::tws_quickpanel_enable(Resource *)
- {
- }
-
- void tws_quickpanel::tws_quickpanel_disable(Resource *)
- {
- }
-
- void tws_quickpanel::tws_quickpanel_state_get(Resource *, int32_t )
- {
- }
-
- void tws_quickpanel::tws_quickpanel_type_set(Resource *, uint32_t )
- {
- }
-
- void tws_quickpanel::tws_quickpanel_scrollable_state_set(Resource *, int32_t )
- {
- }
-
-
- void tws_quickpanel::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_quickpanel *>(r->tws_quickpanel_object)->tws_quickpanel_release(
- r);
- }
-
- void tws_quickpanel::handle_show(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_quickpanel *>(r->tws_quickpanel_object)->tws_quickpanel_show(
- r);
- }
-
- void tws_quickpanel::handle_hide(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_quickpanel *>(r->tws_quickpanel_object)->tws_quickpanel_hide(
- r);
- }
-
- void tws_quickpanel::handle_enable(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_quickpanel *>(r->tws_quickpanel_object)->tws_quickpanel_enable(
- r);
- }
-
- void tws_quickpanel::handle_disable(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_quickpanel *>(r->tws_quickpanel_object)->tws_quickpanel_disable(
- r);
- }
-
- void tws_quickpanel::handle_state_get(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_quickpanel *>(r->tws_quickpanel_object)->tws_quickpanel_state_get(
- r,
- type);
- }
-
- void tws_quickpanel::handle_type_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_quickpanel *>(r->tws_quickpanel_object)->tws_quickpanel_type_set(
- r,
- type);
- }
-
- void tws_quickpanel::handle_scrollable_state_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_quickpanel *>(r->tws_quickpanel_object)->tws_quickpanel_scrollable_state_set(
- r,
- type);
- }
-
- void tws_quickpanel::send_state_get_done(int32_t type, int32_t value, uint32_t error_state)
- {
- DS_ASSERT_X(m_resource, "tws_quickpanel::state_get_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_quickpanel::state_get_done as it's not initialised");
- return;
- }
- send_state_get_done(
- m_resource->handle,
- type,
- value,
- error_state);
- }
-
- void tws_quickpanel::send_state_get_done(struct ::wl_resource *resource, int32_t type, int32_t value, uint32_t error_state)
- {
- tws_quickpanel_send_state_get_done(
- resource,
- type,
- value,
- error_state);
- }
-
-
- void tws_quickpanel::send_state_changed(struct ::wl_array *states)
- {
- DS_ASSERT_X(m_resource, "tws_quickpanel::state_changed", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_quickpanel::state_changed as it's not initialised");
- return;
- }
- send_state_changed(
- m_resource->handle,
- states);
- }
-
- void tws_quickpanel::send_state_changed(struct ::wl_resource *resource, struct ::wl_array *states)
- {
- tws_quickpanel_send_state_changed(
- resource,
- states);
- }
-
-
- tws_region::tws_region(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_region::tws_region(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_region::tws_region(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_region::tws_region()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_region::~tws_region()
- {
- std::multimap<struct ::wl_client*, tws_region::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_region::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_region::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_region::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_region::Resource *tws_region::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_region::Resource *tws_region::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_region::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_region_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_region::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_region::interface()
- {
- return &::tws_region_interface;
- }
-
- tws_region::Resource *tws_region::tws_region_allocate()
- {
- return new Resource;
- }
-
- void tws_region::tws_region_bind_resource(Resource *)
- {
- }
-
- void tws_region::tws_region_destroy_resource(Resource *)
- {
- }
-
- void tws_region::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_region *that = static_cast<tws_region *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_region::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_region *that = static_cast<tws_region::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_region::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_region *that = resource->tws_region_object;
- that->m_resource_map.erase(resource->client());
- that->tws_region_destroy_resource(resource);
- delete resource;
- }
-
- tws_region::Resource *tws_region::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_region_interface, version, id);
- return bind(handle);
- }
-
- tws_region::Resource *tws_region::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_region_allocate();
- resource->tws_region_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_region_interface, resource, destroy_func);
- resource->handle = handle;
- tws_region_bind_resource(resource);
- return resource;
- }
- tws_region::Resource *tws_region::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_region_interface, &m_tws_region_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_region_interface tws_region::m_tws_region_interface = {
- tws_region::handle_destroy,
- tws_region::handle_add,
- tws_region::handle_subtract
- };
-
- void tws_region::tws_region_destroy(Resource *)
- {
- }
-
- void tws_region::tws_region_add(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void tws_region::tws_region_subtract(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
-
- void tws_region::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_region *>(r->tws_region_object)->tws_region_destroy(
- r);
- }
-
- void tws_region::handle_add(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_region *>(r->tws_region_object)->tws_region_add(
- r,
- x,
- y,
- w,
- h);
- }
-
- void tws_region::handle_subtract(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_region *>(r->tws_region_object)->tws_region_subtract(
- r,
- x,
- y,
- w,
- h);
- }
-
- tws_service::tws_service(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service::tws_service(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service::tws_service(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service::tws_service()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service::~tws_service()
- {
- std::multimap<struct ::wl_client*, tws_service::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service::Resource *tws_service::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service::Resource *tws_service::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service::interface()
- {
- return &::tws_service_interface;
- }
-
- tws_service::Resource *tws_service::tws_service_allocate()
- {
- return new Resource;
- }
-
- void tws_service::tws_service_bind_resource(Resource *)
- {
- }
-
- void tws_service::tws_service_destroy_resource(Resource *)
- {
- }
-
- void tws_service::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service *that = static_cast<tws_service *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service *that = static_cast<tws_service::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service *that = resource->tws_service_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_destroy_resource(resource);
- delete resource;
- }
-
- tws_service::Resource *tws_service::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_interface, version, id);
- return bind(handle);
- }
-
- tws_service::Resource *tws_service::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_allocate();
- resource->tws_service_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_bind_resource(resource);
- return resource;
- }
- tws_service::Resource *tws_service::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_interface, &m_tws_service_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_interface tws_service::m_tws_service_interface = {
- tws_service::handle_destroy,
- tws_service::handle_region_set,
- tws_service::handle_indicator_get,
- tws_service::handle_quickpanel_get,
- tws_service::handle_screensaver_manager_get,
- tws_service::handle_screensaver_get,
- tws_service::handle_cbhm_get,
- tws_service::handle_softkey_get,
- tws_service::handle_magnifier_get,
- tws_service::handle_launcher_get
- };
-
- void tws_service::tws_service_destroy(Resource *)
- {
- }
-
- void tws_service::tws_service_region_set(Resource *, int32_t , int32_t , struct ::wl_resource *)
- {
- }
-
- void tws_service::tws_service_indicator_get(Resource *, uint32_t)
- {
- }
-
- void tws_service::tws_service_quickpanel_get(Resource *, uint32_t)
- {
- }
-
- void tws_service::tws_service_screensaver_manager_get(Resource *, uint32_t)
- {
- }
-
- void tws_service::tws_service_screensaver_get(Resource *, uint32_t)
- {
- }
-
- void tws_service::tws_service_cbhm_get(Resource *, uint32_t)
- {
- }
-
- void tws_service::tws_service_softkey_get(Resource *, uint32_t)
- {
- }
-
- void tws_service::tws_service_magnifier_get(Resource *, uint32_t)
- {
- }
-
- void tws_service::tws_service_launcher_get(Resource *, uint32_t)
- {
- }
-
-
- void tws_service::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_destroy(
- r);
- }
-
- void tws_service::handle_region_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type,
- int32_t angle,
- struct ::wl_resource *region)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_region_set(
- r,
- type,
- angle,
- region);
- }
-
- void tws_service::handle_indicator_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_indicator_get(
- r,
- id);
- }
-
- void tws_service::handle_quickpanel_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_quickpanel_get(
- r,
- id);
- }
-
- void tws_service::handle_screensaver_manager_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_screensaver_manager_get(
- r,
- id);
- }
-
- void tws_service::handle_screensaver_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_screensaver_get(
- r,
- id);
- }
-
- void tws_service::handle_cbhm_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_cbhm_get(
- r,
- id);
- }
-
- void tws_service::handle_softkey_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_softkey_get(
- r,
- id);
- }
-
- void tws_service::handle_magnifier_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_magnifier_get(
- r,
- id);
- }
-
- void tws_service::handle_launcher_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service *>(r->tws_service_object)->tws_service_launcher_get(
- r,
- id);
- }
-
- tws_service_indicator::tws_service_indicator(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service_indicator::tws_service_indicator(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service_indicator::tws_service_indicator(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service_indicator::tws_service_indicator()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service_indicator::~tws_service_indicator()
- {
- std::multimap<struct ::wl_client*, tws_service_indicator::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service_indicator::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service_indicator::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service_indicator::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service_indicator::Resource *tws_service_indicator::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service_indicator::Resource *tws_service_indicator::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service_indicator::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_indicator_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service_indicator::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service_indicator::interface()
- {
- return &::tws_service_indicator_interface;
- }
-
- tws_service_indicator::Resource *tws_service_indicator::tws_service_indicator_allocate()
- {
- return new Resource;
- }
-
- void tws_service_indicator::tws_service_indicator_bind_resource(Resource *)
- {
- }
-
- void tws_service_indicator::tws_service_indicator_destroy_resource(Resource *)
- {
- }
-
- void tws_service_indicator::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service_indicator *that = static_cast<tws_service_indicator *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service_indicator::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service_indicator *that = static_cast<tws_service_indicator::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service_indicator::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service_indicator *that = resource->tws_service_indicator_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_indicator_destroy_resource(resource);
- delete resource;
- }
-
- tws_service_indicator::Resource *tws_service_indicator::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_indicator_interface, version, id);
- return bind(handle);
- }
-
- tws_service_indicator::Resource *tws_service_indicator::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_indicator_allocate();
- resource->tws_service_indicator_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_indicator_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_indicator_bind_resource(resource);
- return resource;
- }
- tws_service_indicator::Resource *tws_service_indicator::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_indicator_interface, &m_tws_service_indicator_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_indicator_interface tws_service_indicator::m_tws_service_indicator_interface = {
- tws_service_indicator::handle_destroy
- };
-
- void tws_service_indicator::tws_service_indicator_destroy(Resource *)
- {
- }
-
-
- void tws_service_indicator::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_indicator *>(r->tws_service_indicator_object)->tws_service_indicator_destroy(
- r);
- }
-
- void tws_service_indicator::send_property_change(int32_t angle, int32_t opacity)
- {
- DS_ASSERT_X(m_resource, "tws_service_indicator::property_change", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_indicator::property_change as it's not initialised");
- return;
- }
- send_property_change(
- m_resource->handle,
- angle,
- opacity);
- }
-
- void tws_service_indicator::send_property_change(struct ::wl_resource *resource, int32_t angle, int32_t opacity)
- {
- tws_service_indicator_send_property_change(
- resource,
- angle,
- opacity);
- }
-
-
- tws_service_quickpanel::tws_service_quickpanel(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service_quickpanel::tws_service_quickpanel(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service_quickpanel::tws_service_quickpanel(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service_quickpanel::tws_service_quickpanel()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service_quickpanel::~tws_service_quickpanel()
- {
- std::multimap<struct ::wl_client*, tws_service_quickpanel::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service_quickpanel::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service_quickpanel::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service_quickpanel::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service_quickpanel::Resource *tws_service_quickpanel::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service_quickpanel::Resource *tws_service_quickpanel::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service_quickpanel::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_quickpanel_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service_quickpanel::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service_quickpanel::interface()
- {
- return &::tws_service_quickpanel_interface;
- }
-
- tws_service_quickpanel::Resource *tws_service_quickpanel::tws_service_quickpanel_allocate()
- {
- return new Resource;
- }
-
- void tws_service_quickpanel::tws_service_quickpanel_bind_resource(Resource *)
- {
- }
-
- void tws_service_quickpanel::tws_service_quickpanel_destroy_resource(Resource *)
- {
- }
-
- void tws_service_quickpanel::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service_quickpanel *that = static_cast<tws_service_quickpanel *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service_quickpanel::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service_quickpanel *that = static_cast<tws_service_quickpanel::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service_quickpanel::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service_quickpanel *that = resource->tws_service_quickpanel_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_quickpanel_destroy_resource(resource);
- delete resource;
- }
-
- tws_service_quickpanel::Resource *tws_service_quickpanel::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_quickpanel_interface, version, id);
- return bind(handle);
- }
-
- tws_service_quickpanel::Resource *tws_service_quickpanel::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_quickpanel_allocate();
- resource->tws_service_quickpanel_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_quickpanel_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_quickpanel_bind_resource(resource);
- return resource;
- }
- tws_service_quickpanel::Resource *tws_service_quickpanel::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_quickpanel_interface, &m_tws_service_quickpanel_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_quickpanel_interface tws_service_quickpanel::m_tws_service_quickpanel_interface = {
- tws_service_quickpanel::handle_destroy,
- tws_service_quickpanel::handle_msg_send,
- tws_service_quickpanel::handle_effect_type_set,
- tws_service_quickpanel::handle_scroll_lock_set
- };
-
- void tws_service_quickpanel::tws_service_quickpanel_destroy(Resource *)
- {
- }
-
- void tws_service_quickpanel::tws_service_quickpanel_msg_send(Resource *, uint32_t )
- {
- }
-
- void tws_service_quickpanel::tws_service_quickpanel_effect_type_set(Resource *, uint32_t )
- {
- }
-
- void tws_service_quickpanel::tws_service_quickpanel_scroll_lock_set(Resource *, uint32_t )
- {
- }
-
-
- void tws_service_quickpanel::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_quickpanel *>(r->tws_service_quickpanel_object)->tws_service_quickpanel_destroy(
- r);
- }
-
- void tws_service_quickpanel::handle_msg_send(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t msg)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_quickpanel *>(r->tws_service_quickpanel_object)->tws_service_quickpanel_msg_send(
- r,
- msg);
- }
-
- void tws_service_quickpanel::handle_effect_type_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_quickpanel *>(r->tws_service_quickpanel_object)->tws_service_quickpanel_effect_type_set(
- r,
- type);
- }
-
- void tws_service_quickpanel::handle_scroll_lock_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t lock)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_quickpanel *>(r->tws_service_quickpanel_object)->tws_service_quickpanel_scroll_lock_set(
- r,
- lock);
- }
-
- tws_service_screensaver_manager::tws_service_screensaver_manager(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service_screensaver_manager::tws_service_screensaver_manager(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service_screensaver_manager::tws_service_screensaver_manager(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service_screensaver_manager::tws_service_screensaver_manager()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service_screensaver_manager::~tws_service_screensaver_manager()
- {
- std::multimap<struct ::wl_client*, tws_service_screensaver_manager::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service_screensaver_manager::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service_screensaver_manager::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service_screensaver_manager::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service_screensaver_manager::Resource *tws_service_screensaver_manager::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service_screensaver_manager::Resource *tws_service_screensaver_manager::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service_screensaver_manager::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_screensaver_manager_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service_screensaver_manager::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service_screensaver_manager::interface()
- {
- return &::tws_service_screensaver_manager_interface;
- }
-
- tws_service_screensaver_manager::Resource *tws_service_screensaver_manager::tws_service_screensaver_manager_allocate()
- {
- return new Resource;
- }
-
- void tws_service_screensaver_manager::tws_service_screensaver_manager_bind_resource(Resource *)
- {
- }
-
- void tws_service_screensaver_manager::tws_service_screensaver_manager_destroy_resource(Resource *)
- {
- }
-
- void tws_service_screensaver_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service_screensaver_manager *that = static_cast<tws_service_screensaver_manager *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service_screensaver_manager::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service_screensaver_manager *that = static_cast<tws_service_screensaver_manager::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service_screensaver_manager::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service_screensaver_manager *that = resource->tws_service_screensaver_manager_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_screensaver_manager_destroy_resource(resource);
- delete resource;
- }
-
- tws_service_screensaver_manager::Resource *tws_service_screensaver_manager::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_screensaver_manager_interface, version, id);
- return bind(handle);
- }
-
- tws_service_screensaver_manager::Resource *tws_service_screensaver_manager::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_screensaver_manager_allocate();
- resource->tws_service_screensaver_manager_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_screensaver_manager_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_screensaver_manager_bind_resource(resource);
- return resource;
- }
- tws_service_screensaver_manager::Resource *tws_service_screensaver_manager::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_screensaver_manager_interface, &m_tws_service_screensaver_manager_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_screensaver_manager_interface tws_service_screensaver_manager::m_tws_service_screensaver_manager_interface = {
- tws_service_screensaver_manager::handle_destroy,
- tws_service_screensaver_manager::handle_enable,
- tws_service_screensaver_manager::handle_disable,
- tws_service_screensaver_manager::handle_idle_time_set,
- tws_service_screensaver_manager::handle_state_get
- };
-
- void tws_service_screensaver_manager::tws_service_screensaver_manager_destroy(Resource *)
- {
- }
-
- void tws_service_screensaver_manager::tws_service_screensaver_manager_enable(Resource *)
- {
- }
-
- void tws_service_screensaver_manager::tws_service_screensaver_manager_disable(Resource *)
- {
- }
-
- void tws_service_screensaver_manager::tws_service_screensaver_manager_idle_time_set(Resource *, uint32_t )
- {
- }
-
- void tws_service_screensaver_manager::tws_service_screensaver_manager_state_get(Resource *, uint32_t )
- {
- }
-
-
- void tws_service_screensaver_manager::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_screensaver_manager *>(r->tws_service_screensaver_manager_object)->tws_service_screensaver_manager_destroy(
- r);
- }
-
- void tws_service_screensaver_manager::handle_enable(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_screensaver_manager *>(r->tws_service_screensaver_manager_object)->tws_service_screensaver_manager_enable(
- r);
- }
-
- void tws_service_screensaver_manager::handle_disable(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_screensaver_manager *>(r->tws_service_screensaver_manager_object)->tws_service_screensaver_manager_disable(
- r);
- }
-
- void tws_service_screensaver_manager::handle_idle_time_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_screensaver_manager *>(r->tws_service_screensaver_manager_object)->tws_service_screensaver_manager_idle_time_set(
- r,
- id);
- }
-
- void tws_service_screensaver_manager::handle_state_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t state_type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_screensaver_manager *>(r->tws_service_screensaver_manager_object)->tws_service_screensaver_manager_state_get(
- r,
- state_type);
- }
-
- void tws_service_screensaver_manager::send_idle()
- {
- DS_ASSERT_X(m_resource, "tws_service_screensaver_manager::idle", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_screensaver_manager::idle as it's not initialised");
- return;
- }
- send_idle(
- m_resource->handle);
- }
-
- void tws_service_screensaver_manager::send_idle(struct ::wl_resource *resource)
- {
- tws_service_screensaver_manager_send_idle(
- resource);
- }
-
-
- void tws_service_screensaver_manager::send_active()
- {
- DS_ASSERT_X(m_resource, "tws_service_screensaver_manager::active", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_screensaver_manager::active as it's not initialised");
- return;
- }
- send_active(
- m_resource->handle);
- }
-
- void tws_service_screensaver_manager::send_active(struct ::wl_resource *resource)
- {
- tws_service_screensaver_manager_send_active(
- resource);
- }
-
-
- void tws_service_screensaver_manager::send_state_get_done(uint32_t state_type, uint32_t value, uint32_t error_state)
- {
- DS_ASSERT_X(m_resource, "tws_service_screensaver_manager::state_get_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_screensaver_manager::state_get_done as it's not initialised");
- return;
- }
- send_state_get_done(
- m_resource->handle,
- state_type,
- value,
- error_state);
- }
-
- void tws_service_screensaver_manager::send_state_get_done(struct ::wl_resource *resource, uint32_t state_type, uint32_t value, uint32_t error_state)
- {
- tws_service_screensaver_manager_send_state_get_done(
- resource,
- state_type,
- value,
- error_state);
- }
-
-
- tws_service_screensaver::tws_service_screensaver(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service_screensaver::tws_service_screensaver(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service_screensaver::tws_service_screensaver(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service_screensaver::tws_service_screensaver()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service_screensaver::~tws_service_screensaver()
- {
- std::multimap<struct ::wl_client*, tws_service_screensaver::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service_screensaver::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service_screensaver::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service_screensaver::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service_screensaver::Resource *tws_service_screensaver::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service_screensaver::Resource *tws_service_screensaver::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service_screensaver::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_screensaver_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service_screensaver::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service_screensaver::interface()
- {
- return &::tws_service_screensaver_interface;
- }
-
- tws_service_screensaver::Resource *tws_service_screensaver::tws_service_screensaver_allocate()
- {
- return new Resource;
- }
-
- void tws_service_screensaver::tws_service_screensaver_bind_resource(Resource *)
- {
- }
-
- void tws_service_screensaver::tws_service_screensaver_destroy_resource(Resource *)
- {
- }
-
- void tws_service_screensaver::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service_screensaver *that = static_cast<tws_service_screensaver *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service_screensaver::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service_screensaver *that = static_cast<tws_service_screensaver::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service_screensaver::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service_screensaver *that = resource->tws_service_screensaver_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_screensaver_destroy_resource(resource);
- delete resource;
- }
-
- tws_service_screensaver::Resource *tws_service_screensaver::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_screensaver_interface, version, id);
- return bind(handle);
- }
-
- tws_service_screensaver::Resource *tws_service_screensaver::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_screensaver_allocate();
- resource->tws_service_screensaver_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_screensaver_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_screensaver_bind_resource(resource);
- return resource;
- }
- tws_service_screensaver::Resource *tws_service_screensaver::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_screensaver_interface, &m_tws_service_screensaver_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_screensaver_interface tws_service_screensaver::m_tws_service_screensaver_interface = {
- tws_service_screensaver::handle_release
- };
-
- void tws_service_screensaver::tws_service_screensaver_release(Resource *)
- {
- }
-
-
- void tws_service_screensaver::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_screensaver *>(r->tws_service_screensaver_object)->tws_service_screensaver_release(
- r);
- }
-
- tws_service_cbhm::tws_service_cbhm(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service_cbhm::tws_service_cbhm(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service_cbhm::tws_service_cbhm(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service_cbhm::tws_service_cbhm()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service_cbhm::~tws_service_cbhm()
- {
- std::multimap<struct ::wl_client*, tws_service_cbhm::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service_cbhm::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service_cbhm::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service_cbhm::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service_cbhm::Resource *tws_service_cbhm::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service_cbhm::Resource *tws_service_cbhm::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service_cbhm::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_cbhm_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service_cbhm::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service_cbhm::interface()
- {
- return &::tws_service_cbhm_interface;
- }
-
- tws_service_cbhm::Resource *tws_service_cbhm::tws_service_cbhm_allocate()
- {
- return new Resource;
- }
-
- void tws_service_cbhm::tws_service_cbhm_bind_resource(Resource *)
- {
- }
-
- void tws_service_cbhm::tws_service_cbhm_destroy_resource(Resource *)
- {
- }
-
- void tws_service_cbhm::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service_cbhm *that = static_cast<tws_service_cbhm *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service_cbhm::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service_cbhm *that = static_cast<tws_service_cbhm::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service_cbhm::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service_cbhm *that = resource->tws_service_cbhm_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_cbhm_destroy_resource(resource);
- delete resource;
- }
-
- tws_service_cbhm::Resource *tws_service_cbhm::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_cbhm_interface, version, id);
- return bind(handle);
- }
-
- tws_service_cbhm::Resource *tws_service_cbhm::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_cbhm_allocate();
- resource->tws_service_cbhm_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_cbhm_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_cbhm_bind_resource(resource);
- return resource;
- }
- tws_service_cbhm::Resource *tws_service_cbhm::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_cbhm_interface, &m_tws_service_cbhm_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_cbhm_interface tws_service_cbhm::m_tws_service_cbhm_interface = {
- tws_service_cbhm::handle_destroy,
- tws_service_cbhm::handle_msg_send
- };
-
- void tws_service_cbhm::tws_service_cbhm_destroy(Resource *)
- {
- }
-
- void tws_service_cbhm::tws_service_cbhm_msg_send(Resource *, uint32_t )
- {
- }
-
-
- void tws_service_cbhm::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_cbhm *>(r->tws_service_cbhm_object)->tws_service_cbhm_destroy(
- r);
- }
-
- void tws_service_cbhm::handle_msg_send(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t msg)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_cbhm *>(r->tws_service_cbhm_object)->tws_service_cbhm_msg_send(
- r,
- msg);
- }
-
- tws_dummy_extension::tws_dummy_extension(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_dummy_extension::tws_dummy_extension(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_dummy_extension::tws_dummy_extension(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_dummy_extension::tws_dummy_extension()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_dummy_extension::~tws_dummy_extension()
- {
- std::multimap<struct ::wl_client*, tws_dummy_extension::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_dummy_extension::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_dummy_extension::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_dummy_extension::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_dummy_extension::Resource *tws_dummy_extension::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_dummy_extension::Resource *tws_dummy_extension::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_dummy_extension::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_dummy_extension_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_dummy_extension::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_dummy_extension::interface()
- {
- return &::tws_dummy_extension_interface;
- }
-
- tws_dummy_extension::Resource *tws_dummy_extension::tws_dummy_extension_allocate()
- {
- return new Resource;
- }
-
- void tws_dummy_extension::tws_dummy_extension_bind_resource(Resource *)
- {
- }
-
- void tws_dummy_extension::tws_dummy_extension_destroy_resource(Resource *)
- {
- }
-
- void tws_dummy_extension::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_dummy_extension *that = static_cast<tws_dummy_extension *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_dummy_extension::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_dummy_extension *that = static_cast<tws_dummy_extension::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_dummy_extension::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_dummy_extension *that = resource->tws_dummy_extension_object;
- that->m_resource_map.erase(resource->client());
- that->tws_dummy_extension_destroy_resource(resource);
- delete resource;
- }
-
- tws_dummy_extension::Resource *tws_dummy_extension::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_dummy_extension_interface, version, id);
- return bind(handle);
- }
-
- tws_dummy_extension::Resource *tws_dummy_extension::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_dummy_extension_allocate();
- resource->tws_dummy_extension_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_dummy_extension_interface, resource, destroy_func);
- resource->handle = handle;
- tws_dummy_extension_bind_resource(resource);
- return resource;
- }
- tws_dummy_extension::Resource *tws_dummy_extension::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_dummy_extension_interface, &m_tws_dummy_extension_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_dummy_extension_interface tws_dummy_extension::m_tws_dummy_extension_interface = {
- tws_dummy_extension::handle_destroy
- };
-
- void tws_dummy_extension::tws_dummy_extension_destroy(Resource *)
- {
- }
-
-
- void tws_dummy_extension::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_dummy_extension *>(r->tws_dummy_extension_object)->tws_dummy_extension_destroy(
- r);
- }
-
- tws_service_softkey::tws_service_softkey(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service_softkey::tws_service_softkey(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service_softkey::tws_service_softkey(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service_softkey::tws_service_softkey()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service_softkey::~tws_service_softkey()
- {
- std::multimap<struct ::wl_client*, tws_service_softkey::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service_softkey::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service_softkey::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service_softkey::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service_softkey::Resource *tws_service_softkey::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service_softkey::Resource *tws_service_softkey::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service_softkey::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_softkey_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service_softkey::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service_softkey::interface()
- {
- return &::tws_service_softkey_interface;
- }
-
- tws_service_softkey::Resource *tws_service_softkey::tws_service_softkey_allocate()
- {
- return new Resource;
- }
-
- void tws_service_softkey::tws_service_softkey_bind_resource(Resource *)
- {
- }
-
- void tws_service_softkey::tws_service_softkey_destroy_resource(Resource *)
- {
- }
-
- void tws_service_softkey::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service_softkey *that = static_cast<tws_service_softkey *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service_softkey::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service_softkey *that = static_cast<tws_service_softkey::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service_softkey::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service_softkey *that = resource->tws_service_softkey_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_softkey_destroy_resource(resource);
- delete resource;
- }
-
- tws_service_softkey::Resource *tws_service_softkey::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_softkey_interface, version, id);
- return bind(handle);
- }
-
- tws_service_softkey::Resource *tws_service_softkey::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_softkey_allocate();
- resource->tws_service_softkey_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_softkey_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_softkey_bind_resource(resource);
- return resource;
- }
- tws_service_softkey::Resource *tws_service_softkey::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_softkey_interface, &m_tws_service_softkey_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_softkey_interface tws_service_softkey::m_tws_service_softkey_interface = {
- tws_service_softkey::handle_destroy,
- tws_service_softkey::handle_msg_send
- };
-
- void tws_service_softkey::tws_service_softkey_destroy(Resource *)
- {
- }
-
- void tws_service_softkey::tws_service_softkey_msg_send(Resource *, uint32_t )
- {
- }
-
-
- void tws_service_softkey::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_softkey *>(r->tws_service_softkey_object)->tws_service_softkey_destroy(
- r);
- }
-
- void tws_service_softkey::handle_msg_send(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t msg)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_softkey *>(r->tws_service_softkey_object)->tws_service_softkey_msg_send(
- r,
- msg);
- }
-
- void tws_service_softkey::send_visible_change_request(int32_t show)
- {
- DS_ASSERT_X(m_resource, "tws_service_softkey::visible_change_request", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_softkey::visible_change_request as it's not initialised");
- return;
- }
- send_visible_change_request(
- m_resource->handle,
- show);
- }
-
- void tws_service_softkey::send_visible_change_request(struct ::wl_resource *resource, int32_t show)
- {
- tws_service_softkey_send_visible_change_request(
- resource,
- show);
- }
-
-
- void tws_service_softkey::send_expand_change_request(int32_t expand)
- {
- DS_ASSERT_X(m_resource, "tws_service_softkey::expand_change_request", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_softkey::expand_change_request as it's not initialised");
- return;
- }
- send_expand_change_request(
- m_resource->handle,
- expand);
- }
-
- void tws_service_softkey::send_expand_change_request(struct ::wl_resource *resource, int32_t expand)
- {
- tws_service_softkey_send_expand_change_request(
- resource,
- expand);
- }
-
-
- void tws_service_softkey::send_opacity_change_request(int32_t opacity)
- {
- DS_ASSERT_X(m_resource, "tws_service_softkey::opacity_change_request", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_softkey::opacity_change_request as it's not initialised");
- return;
- }
- send_opacity_change_request(
- m_resource->handle,
- opacity);
- }
-
- void tws_service_softkey::send_opacity_change_request(struct ::wl_resource *resource, int32_t opacity)
- {
- tws_service_softkey_send_opacity_change_request(
- resource,
- opacity);
- }
-
-
- tws_softkey::tws_softkey(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_softkey::tws_softkey(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_softkey::tws_softkey(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_softkey::tws_softkey()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_softkey::~tws_softkey()
- {
- std::multimap<struct ::wl_client*, tws_softkey::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_softkey::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_softkey::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_softkey::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_softkey::Resource *tws_softkey::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_softkey::Resource *tws_softkey::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_softkey::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_softkey_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_softkey::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_softkey::interface()
- {
- return &::tws_softkey_interface;
- }
-
- tws_softkey::Resource *tws_softkey::tws_softkey_allocate()
- {
- return new Resource;
- }
-
- void tws_softkey::tws_softkey_bind_resource(Resource *)
- {
- }
-
- void tws_softkey::tws_softkey_destroy_resource(Resource *)
- {
- }
-
- void tws_softkey::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_softkey *that = static_cast<tws_softkey *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_softkey::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_softkey *that = static_cast<tws_softkey::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_softkey::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_softkey *that = resource->tws_softkey_object;
- that->m_resource_map.erase(resource->client());
- that->tws_softkey_destroy_resource(resource);
- delete resource;
- }
-
- tws_softkey::Resource *tws_softkey::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_softkey_interface, version, id);
- return bind(handle);
- }
-
- tws_softkey::Resource *tws_softkey::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_softkey_allocate();
- resource->tws_softkey_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_softkey_interface, resource, destroy_func);
- resource->handle = handle;
- tws_softkey_bind_resource(resource);
- return resource;
- }
- tws_softkey::Resource *tws_softkey::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_softkey_interface, &m_tws_softkey_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_softkey_interface tws_softkey::m_tws_softkey_interface = {
- tws_softkey::handle_release,
- tws_softkey::handle_support_check,
- tws_softkey::handle_show,
- tws_softkey::handle_hide,
- tws_softkey::handle_state_set,
- tws_softkey::handle_state_get
- };
-
- void tws_softkey::tws_softkey_release(Resource *)
- {
- }
-
- void tws_softkey::tws_softkey_support_check(Resource *)
- {
- }
-
- void tws_softkey::tws_softkey_show(Resource *)
- {
- }
-
- void tws_softkey::tws_softkey_hide(Resource *)
- {
- }
-
- void tws_softkey::tws_softkey_state_set(Resource *, int32_t , int32_t )
- {
- }
-
- void tws_softkey::tws_softkey_state_get(Resource *, int32_t )
- {
- }
-
-
- void tws_softkey::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_softkey *>(r->tws_softkey_object)->tws_softkey_release(
- r);
- }
-
- void tws_softkey::handle_support_check(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_softkey *>(r->tws_softkey_object)->tws_softkey_support_check(
- r);
- }
-
- void tws_softkey::handle_show(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_softkey *>(r->tws_softkey_object)->tws_softkey_show(
- r);
- }
-
- void tws_softkey::handle_hide(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_softkey *>(r->tws_softkey_object)->tws_softkey_hide(
- r);
- }
-
- void tws_softkey::handle_state_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type,
- int32_t val)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_softkey *>(r->tws_softkey_object)->tws_softkey_state_set(
- r,
- type,
- val);
- }
-
- void tws_softkey::handle_state_get(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_softkey *>(r->tws_softkey_object)->tws_softkey_state_get(
- r,
- type);
- }
-
- void tws_softkey::send_support_check_done(int32_t support)
- {
- DS_ASSERT_X(m_resource, "tws_softkey::support_check_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_softkey::support_check_done as it's not initialised");
- return;
- }
- send_support_check_done(
- m_resource->handle,
- support);
- }
-
- void tws_softkey::send_support_check_done(struct ::wl_resource *resource, int32_t support)
- {
- tws_softkey_send_support_check_done(
- resource,
- support);
- }
-
-
- void tws_softkey::send_state_get_done(int32_t type, int32_t value, uint32_t error_state)
- {
- DS_ASSERT_X(m_resource, "tws_softkey::state_get_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_softkey::state_get_done as it's not initialised");
- return;
- }
- send_state_get_done(
- m_resource->handle,
- type,
- value,
- error_state);
- }
-
- void tws_softkey::send_state_get_done(struct ::wl_resource *resource, int32_t type, int32_t value, uint32_t error_state)
- {
- tws_softkey_send_state_get_done(
- resource,
- type,
- value,
- error_state);
- }
-
-
- tws_service_magnifier::tws_service_magnifier(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service_magnifier::tws_service_magnifier(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service_magnifier::tws_service_magnifier(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service_magnifier::tws_service_magnifier()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service_magnifier::~tws_service_magnifier()
- {
- std::multimap<struct ::wl_client*, tws_service_magnifier::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service_magnifier::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service_magnifier::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service_magnifier::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service_magnifier::Resource *tws_service_magnifier::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service_magnifier::Resource *tws_service_magnifier::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service_magnifier::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_magnifier_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service_magnifier::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service_magnifier::interface()
- {
- return &::tws_service_magnifier_interface;
- }
-
- tws_service_magnifier::Resource *tws_service_magnifier::tws_service_magnifier_allocate()
- {
- return new Resource;
- }
-
- void tws_service_magnifier::tws_service_magnifier_bind_resource(Resource *)
- {
- }
-
- void tws_service_magnifier::tws_service_magnifier_destroy_resource(Resource *)
- {
- }
-
- void tws_service_magnifier::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service_magnifier *that = static_cast<tws_service_magnifier *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service_magnifier::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service_magnifier *that = static_cast<tws_service_magnifier::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service_magnifier::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service_magnifier *that = resource->tws_service_magnifier_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_magnifier_destroy_resource(resource);
- delete resource;
- }
-
- tws_service_magnifier::Resource *tws_service_magnifier::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_magnifier_interface, version, id);
- return bind(handle);
- }
-
- tws_service_magnifier::Resource *tws_service_magnifier::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_magnifier_allocate();
- resource->tws_service_magnifier_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_magnifier_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_magnifier_bind_resource(resource);
- return resource;
- }
- tws_service_magnifier::Resource *tws_service_magnifier::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_magnifier_interface, &m_tws_service_magnifier_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_magnifier_interface tws_service_magnifier::m_tws_service_magnifier_interface = {
- tws_service_magnifier::handle_destroy,
- tws_service_magnifier::handle_zoom_geometry_set,
- tws_service_magnifier::handle_zoom_ratio_set,
- tws_service_magnifier::handle_zoom_enable_set
- };
-
- void tws_service_magnifier::tws_service_magnifier_destroy(Resource *)
- {
- }
-
- void tws_service_magnifier::tws_service_magnifier_zoom_geometry_set(Resource *, uint32_t , int32_t , int32_t , uint32_t , uint32_t )
- {
- }
-
- void tws_service_magnifier::tws_service_magnifier_zoom_ratio_set(Resource *, int32_t )
- {
- }
-
- void tws_service_magnifier::tws_service_magnifier_zoom_enable_set(Resource *, int32_t )
- {
- }
-
-
- void tws_service_magnifier::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_magnifier *>(r->tws_service_magnifier_object)->tws_service_magnifier_destroy(
- r);
- }
-
- void tws_service_magnifier::handle_zoom_geometry_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t angle,
- int32_t x,
- int32_t y,
- uint32_t w,
- uint32_t h)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_magnifier *>(r->tws_service_magnifier_object)->tws_service_magnifier_zoom_geometry_set(
- r,
- angle,
- x,
- y,
- w,
- h);
- }
-
- void tws_service_magnifier::handle_zoom_ratio_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t ratio)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_magnifier *>(r->tws_service_magnifier_object)->tws_service_magnifier_zoom_ratio_set(
- r,
- ratio);
- }
-
- void tws_service_magnifier::handle_zoom_enable_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t enable)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_magnifier *>(r->tws_service_magnifier_object)->tws_service_magnifier_zoom_enable_set(
- r,
- enable);
- }
-
- tws_service_launcher::tws_service_launcher(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_service_launcher::tws_service_launcher(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_service_launcher::tws_service_launcher(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_service_launcher::tws_service_launcher()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_service_launcher::~tws_service_launcher()
- {
- std::multimap<struct ::wl_client*, tws_service_launcher::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_service_launcher::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_service_launcher::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_service_launcher::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_service_launcher::Resource *tws_service_launcher::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_service_launcher::Resource *tws_service_launcher::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_service_launcher::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_service_launcher_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_service_launcher::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_service_launcher::interface()
- {
- return &::tws_service_launcher_interface;
- }
-
- tws_service_launcher::Resource *tws_service_launcher::tws_service_launcher_allocate()
- {
- return new Resource;
- }
-
- void tws_service_launcher::tws_service_launcher_bind_resource(Resource *)
- {
- }
-
- void tws_service_launcher::tws_service_launcher_destroy_resource(Resource *)
- {
- }
-
- void tws_service_launcher::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_service_launcher *that = static_cast<tws_service_launcher *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_service_launcher::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_service_launcher *that = static_cast<tws_service_launcher::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_service_launcher::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_service_launcher *that = resource->tws_service_launcher_object;
- that->m_resource_map.erase(resource->client());
- that->tws_service_launcher_destroy_resource(resource);
- delete resource;
- }
-
- tws_service_launcher::Resource *tws_service_launcher::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_service_launcher_interface, version, id);
- return bind(handle);
- }
-
- tws_service_launcher::Resource *tws_service_launcher::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_service_launcher_allocate();
- resource->tws_service_launcher_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_service_launcher_interface, resource, destroy_func);
- resource->handle = handle;
- tws_service_launcher_bind_resource(resource);
- return resource;
- }
- tws_service_launcher::Resource *tws_service_launcher::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_service_launcher_interface, &m_tws_service_launcher_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_service_launcher_interface tws_service_launcher::m_tws_service_launcher_interface = {
- tws_service_launcher::handle_destroy,
- tws_service_launcher::handle_launch,
- tws_service_launcher::handle_launch_with_shared_widget,
- tws_service_launcher::handle_launching,
- tws_service_launcher::handle_launch_done,
- tws_service_launcher::handle_launch_cancel
- };
-
- void tws_service_launcher::tws_service_launcher_destroy(Resource *)
- {
- }
-
- void tws_service_launcher::tws_service_launcher_launch(Resource *, const std::string &, const std::string &, int32_t , uint32_t )
- {
- }
-
- void tws_service_launcher::tws_service_launcher_launch_with_shared_widget(Resource *, const std::string &, const std::string &, int32_t , uint32_t )
- {
- }
-
- void tws_service_launcher::tws_service_launcher_launching(Resource *, uint32_t )
- {
- }
-
- void tws_service_launcher::tws_service_launcher_launch_done(Resource *, uint32_t )
- {
- }
-
- void tws_service_launcher::tws_service_launcher_launch_cancel(Resource *, uint32_t )
- {
- }
-
-
- void tws_service_launcher::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_launcher *>(r->tws_service_launcher_object)->tws_service_launcher_destroy(
- r);
- }
-
- void tws_service_launcher::handle_launch(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id,
- const char *instance_id,
- int32_t pid,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_launcher *>(r->tws_service_launcher_object)->tws_service_launcher_launch(
- r,
- std::string(app_id),
- std::string(instance_id),
- pid,
- serial);
- }
-
- void tws_service_launcher::handle_launch_with_shared_widget(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id,
- const char *instance_id,
- int32_t pid,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_launcher *>(r->tws_service_launcher_object)->tws_service_launcher_launch_with_shared_widget(
- r,
- std::string(app_id),
- std::string(instance_id),
- pid,
- serial);
- }
-
- void tws_service_launcher::handle_launching(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_launcher *>(r->tws_service_launcher_object)->tws_service_launcher_launching(
- r,
- serial);
- }
-
- void tws_service_launcher::handle_launch_done(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_launcher *>(r->tws_service_launcher_object)->tws_service_launcher_launch_done(
- r,
- serial);
- }
-
- void tws_service_launcher::handle_launch_cancel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_service_launcher *>(r->tws_service_launcher_object)->tws_service_launcher_launch_cancel(
- r,
- serial);
- }
-
- void tws_service_launcher::send_prepare(uint32_t target_type, struct ::wl_array *target_info, uint32_t direction, int32_t x, int32_t y, const std::string &shared_widget_info, uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tws_service_launcher::prepare", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_launcher::prepare as it's not initialised");
- return;
- }
- send_prepare(
- m_resource->handle,
- target_type,
- target_info,
- direction,
- x,
- y,
- shared_widget_info,
- serial);
- }
-
- void tws_service_launcher::send_prepare(struct ::wl_resource *resource, uint32_t target_type, struct ::wl_array *target_info, uint32_t direction, int32_t x, int32_t y, const std::string &shared_widget_info, uint32_t serial)
- {
- tws_service_launcher_send_prepare(
- resource,
- target_type,
- target_info,
- direction,
- x,
- y,
- shared_widget_info.c_str(),
- serial);
- }
-
-
- void tws_service_launcher::send_stop(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tws_service_launcher::stop", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_launcher::stop as it's not initialised");
- return;
- }
- send_stop(
- m_resource->handle,
- serial);
- }
-
- void tws_service_launcher::send_stop(struct ::wl_resource *resource, uint32_t serial)
- {
- tws_service_launcher_send_stop(
- resource,
- serial);
- }
-
-
- void tws_service_launcher::send_error(uint32_t code, uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tws_service_launcher::error", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_launcher::error as it's not initialised");
- return;
- }
- send_error(
- m_resource->handle,
- code,
- serial);
- }
-
- void tws_service_launcher::send_error(struct ::wl_resource *resource, uint32_t code, uint32_t serial)
- {
- tws_service_launcher_send_error(
- resource,
- code,
- serial);
- }
-
-
- void tws_service_launcher::send_cleanup(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tws_service_launcher::cleanup", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_service_launcher::cleanup as it's not initialised");
- return;
- }
- send_cleanup(
- m_resource->handle,
- serial);
- }
-
- void tws_service_launcher::send_cleanup(struct ::wl_resource *resource, uint32_t serial)
- {
- tws_service_launcher_send_cleanup(
- resource,
- serial);
- }
-
-
- tws_shared_widget_launch::tws_shared_widget_launch(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- tws_shared_widget_launch::tws_shared_widget_launch(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- tws_shared_widget_launch::tws_shared_widget_launch(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- tws_shared_widget_launch::tws_shared_widget_launch()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- tws_shared_widget_launch::~tws_shared_widget_launch()
- {
- std::multimap<struct ::wl_client*, tws_shared_widget_launch::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tws_shared_widget_launch::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tws_shared_widget_launch::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tws_shared_widget_launch::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tws_shared_widget_launch::Resource *tws_shared_widget_launch::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tws_shared_widget_launch::Resource *tws_shared_widget_launch::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tws_shared_widget_launch::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tws_shared_widget_launch_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tws_shared_widget_launch::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tws_shared_widget_launch::interface()
- {
- return &::tws_shared_widget_launch_interface;
- }
-
- tws_shared_widget_launch::Resource *tws_shared_widget_launch::tws_shared_widget_launch_allocate()
- {
- return new Resource;
- }
-
- void tws_shared_widget_launch::tws_shared_widget_launch_bind_resource(Resource *)
- {
- }
-
- void tws_shared_widget_launch::tws_shared_widget_launch_destroy_resource(Resource *)
- {
- }
-
- void tws_shared_widget_launch::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tws_shared_widget_launch *that = static_cast<tws_shared_widget_launch *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tws_shared_widget_launch::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tws_shared_widget_launch *that = static_cast<tws_shared_widget_launch::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tws_shared_widget_launch::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tws_shared_widget_launch *that = resource->tws_shared_widget_launch_object;
- that->m_resource_map.erase(resource->client());
- that->tws_shared_widget_launch_destroy_resource(resource);
- delete resource;
- }
-
- tws_shared_widget_launch::Resource *tws_shared_widget_launch::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tws_shared_widget_launch_interface, version, id);
- return bind(handle);
- }
-
- tws_shared_widget_launch::Resource *tws_shared_widget_launch::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tws_shared_widget_launch_allocate();
- resource->tws_shared_widget_launch_object = this;
-
- wl_resource_set_implementation(handle, &m_tws_shared_widget_launch_interface, resource, destroy_func);
- resource->handle = handle;
- tws_shared_widget_launch_bind_resource(resource);
- return resource;
- }
- tws_shared_widget_launch::Resource *tws_shared_widget_launch::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tws_shared_widget_launch_interface, &m_tws_shared_widget_launch_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tws_shared_widget_launch_interface tws_shared_widget_launch::m_tws_shared_widget_launch_interface = {
- tws_shared_widget_launch::handle_release,
- tws_shared_widget_launch::handle_prepare_shared_widget_done
- };
-
- void tws_shared_widget_launch::tws_shared_widget_launch_release(Resource *)
- {
- }
-
- void tws_shared_widget_launch::tws_shared_widget_launch_prepare_shared_widget_done(Resource *, const std::string &, uint32_t , uint32_t )
- {
- }
-
-
- void tws_shared_widget_launch::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_shared_widget_launch *>(r->tws_shared_widget_launch_object)->tws_shared_widget_launch_release(
- r);
- }
-
- void tws_shared_widget_launch::handle_prepare_shared_widget_done(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *shared_widget_info,
- uint32_t state,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tws_shared_widget_launch *>(r->tws_shared_widget_launch_object)->tws_shared_widget_launch_prepare_shared_widget_done(
- r,
- std::string(shared_widget_info),
- state,
- serial);
- }
-
- void tws_shared_widget_launch::send_prepare_shared_widget(uint32_t state, uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tws_shared_widget_launch::prepare_shared_widget", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tws_shared_widget_launch::prepare_shared_widget as it's not initialised");
- return;
- }
- send_prepare_shared_widget(
- m_resource->handle,
- state,
- serial);
- }
-
- void tws_shared_widget_launch::send_prepare_shared_widget(struct ::wl_resource *resource, uint32_t state, uint32_t serial)
- {
- tws_shared_widget_launch_send_prepare_shared_widget(
- resource,
- state,
- serial);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/tzsh.xml */
-
-#ifndef __DS_TIZEN_WS_SHELL_PROTOCOL_H__
-#define __DS_TIZEN_WS_SHELL_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "tizen-ws-shell-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class tizen_ws_shell
- {
- public:
- tizen_ws_shell(struct ::wl_client *client, uint32_t id, int version);
- tizen_ws_shell(struct ::wl_display *display, int version);
- tizen_ws_shell(struct ::wl_resource *resource);
- tizen_ws_shell();
-
- virtual ~tizen_ws_shell();
-
- class Resource
- {
- public:
- Resource() : tizen_ws_shell_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_ws_shell *tizen_ws_shell_object;
- tizen_ws_shell *object() { return tizen_ws_shell_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_none = 0, // no error. succeed.
- error_out_of_memory = 1, // server is not have enought memory.
- error_invalid_parameter = 2, // given request have invalid parameter.
- error_permission_denied = 3, // client is not have right permission.
- error_no_service = 4, // there is no service to support request
- error_not_supported = 5, // given request is not supported
- };
-
- void send_service_register(const std::string &name);
- void send_service_register(struct ::wl_resource *resource, const std::string &name);
- void send_service_unregister(const std::string &name);
- void send_service_unregister(struct ::wl_resource *resource, const std::string &name);
- void send_error(uint32_t error_state);
- void send_error(struct ::wl_resource *resource, uint32_t error_state);
-
- protected:
- virtual Resource *tizen_ws_shell_allocate();
-
- virtual void tizen_ws_shell_bind_resource(Resource *resource);
- virtual void tizen_ws_shell_destroy_resource(Resource *resource);
-
- virtual void tizen_ws_shell_destroy(Resource *resource);
- virtual void tizen_ws_shell_service_create(Resource *resource, uint32_t id, uint32_t win, const std::string &name);
- virtual void tizen_ws_shell_region_create(Resource *resource, uint32_t id);
- virtual void tizen_ws_shell_quickpanel_get(Resource *resource, uint32_t id, uint32_t win);
- virtual void tizen_ws_shell_extension_get(Resource *resource, uint32_t id, const std::string &name);
- virtual void tizen_ws_shell_softkey_get(Resource *resource, uint32_t id, uint32_t win);
- virtual void tizen_ws_shell_shared_widget_launch_get(Resource *resource, uint32_t id, uint32_t win);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_ws_shell_interface m_tizen_ws_shell_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_service_create(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t win,
- const char *name);
- static void handle_region_create(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_quickpanel_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t win);
- static void handle_extension_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- const char *name);
- static void handle_softkey_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t win);
- static void handle_shared_widget_launch_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- uint32_t win);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_ws_shell *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_quickpanel
- {
- public:
- tws_quickpanel(struct ::wl_client *client, uint32_t id, int version);
- tws_quickpanel(struct ::wl_display *display, int version);
- tws_quickpanel(struct ::wl_resource *resource);
- tws_quickpanel();
-
- virtual ~tws_quickpanel();
-
- class Resource
- {
- public:
- Resource() : tws_quickpanel_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_quickpanel *tws_quickpanel_object;
- tws_quickpanel *object() { return tws_quickpanel_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_request_rejected = 0, // given request is denied
- };
-
- enum state_type {
- state_type_unknown = 0,
- state_type_visibility = 1,
- state_type_scrollable = 2,
- state_type_orientation = 3,
- };
-
- enum state_value {
- state_value_unknown = 0,
- state_value_visible_show = 1,
- state_value_visible_hide = 2,
- state_value_scrollable_set = 3,
- state_value_scrollable_unset = 4,
- state_value_orientation_0 = 5,
- state_value_orientation_90 = 6,
- state_value_orientation_180 = 7,
- state_value_orientation_270 = 8,
- state_value_scrollable_retain = 9,
- };
-
- enum type_value {
- type_value_unknown = 0,
- type_value_system_default = 1,
- type_value_context_menu = 2,
- type_value_apps_menu = 3,
- };
-
- void send_state_get_done(int32_t type, int32_t value, uint32_t error_state);
- void send_state_get_done(struct ::wl_resource *resource, int32_t type, int32_t value, uint32_t error_state);
- void send_state_changed(struct ::wl_array *states);
- void send_state_changed(struct ::wl_resource *resource, struct ::wl_array *states);
-
- protected:
- virtual Resource *tws_quickpanel_allocate();
-
- virtual void tws_quickpanel_bind_resource(Resource *resource);
- virtual void tws_quickpanel_destroy_resource(Resource *resource);
-
- virtual void tws_quickpanel_release(Resource *resource);
- virtual void tws_quickpanel_show(Resource *resource);
- virtual void tws_quickpanel_hide(Resource *resource);
- virtual void tws_quickpanel_enable(Resource *resource);
- virtual void tws_quickpanel_disable(Resource *resource);
- virtual void tws_quickpanel_state_get(Resource *resource, int32_t type);
- virtual void tws_quickpanel_type_set(Resource *resource, uint32_t type);
- virtual void tws_quickpanel_scrollable_state_set(Resource *resource, int32_t type);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_quickpanel_interface m_tws_quickpanel_interface;
-
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_show(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_hide(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_enable(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_disable(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_state_get(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type);
- static void handle_type_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type);
- static void handle_scrollable_state_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_quickpanel *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_region
- {
- public:
- tws_region(struct ::wl_client *client, uint32_t id, int version);
- tws_region(struct ::wl_display *display, int version);
- tws_region(struct ::wl_resource *resource);
- tws_region();
-
- virtual ~tws_region();
-
- class Resource
- {
- public:
- Resource() : tws_region_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_region *tws_region_object;
- tws_region *object() { return tws_region_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tws_region_allocate();
-
- virtual void tws_region_bind_resource(Resource *resource);
- virtual void tws_region_destroy_resource(Resource *resource);
-
- virtual void tws_region_destroy(Resource *resource);
- virtual void tws_region_add(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h);
- virtual void tws_region_subtract(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_region_interface m_tws_region_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_add(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h);
- static void handle_subtract(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t w,
- int32_t h);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_region *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service
- {
- public:
- tws_service(struct ::wl_client *client, uint32_t id, int version);
- tws_service(struct ::wl_display *display, int version);
- tws_service(struct ::wl_resource *resource);
- tws_service();
-
- virtual ~tws_service();
-
- class Resource
- {
- public:
- Resource() : tws_service_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service *tws_service_object;
- tws_service *object() { return tws_service_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum region_type {
- region_type_handler = 0,
- region_type_content = 1,
- };
-
- protected:
- virtual Resource *tws_service_allocate();
-
- virtual void tws_service_bind_resource(Resource *resource);
- virtual void tws_service_destroy_resource(Resource *resource);
-
- virtual void tws_service_destroy(Resource *resource);
- virtual void tws_service_region_set(Resource *resource, int32_t type, int32_t angle, struct ::wl_resource *region);
- virtual void tws_service_indicator_get(Resource *resource, uint32_t id);
- virtual void tws_service_quickpanel_get(Resource *resource, uint32_t id);
- virtual void tws_service_screensaver_manager_get(Resource *resource, uint32_t id);
- virtual void tws_service_screensaver_get(Resource *resource, uint32_t id);
- virtual void tws_service_cbhm_get(Resource *resource, uint32_t id);
- virtual void tws_service_softkey_get(Resource *resource, uint32_t id);
- virtual void tws_service_magnifier_get(Resource *resource, uint32_t id);
- virtual void tws_service_launcher_get(Resource *resource, uint32_t id);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_interface m_tws_service_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_region_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type,
- int32_t angle,
- struct ::wl_resource *region);
- static void handle_indicator_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_quickpanel_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_screensaver_manager_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_screensaver_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_cbhm_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_softkey_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_magnifier_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_launcher_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service_indicator
- {
- public:
- tws_service_indicator(struct ::wl_client *client, uint32_t id, int version);
- tws_service_indicator(struct ::wl_display *display, int version);
- tws_service_indicator(struct ::wl_resource *resource);
- tws_service_indicator();
-
- virtual ~tws_service_indicator();
-
- class Resource
- {
- public:
- Resource() : tws_service_indicator_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service_indicator *tws_service_indicator_object;
- tws_service_indicator *object() { return tws_service_indicator_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_property_change(int32_t angle, int32_t opacity);
- void send_property_change(struct ::wl_resource *resource, int32_t angle, int32_t opacity);
-
- protected:
- virtual Resource *tws_service_indicator_allocate();
-
- virtual void tws_service_indicator_bind_resource(Resource *resource);
- virtual void tws_service_indicator_destroy_resource(Resource *resource);
-
- virtual void tws_service_indicator_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_indicator_interface m_tws_service_indicator_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service_indicator *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service_quickpanel
- {
- public:
- tws_service_quickpanel(struct ::wl_client *client, uint32_t id, int version);
- tws_service_quickpanel(struct ::wl_display *display, int version);
- tws_service_quickpanel(struct ::wl_resource *resource);
- tws_service_quickpanel();
-
- virtual ~tws_service_quickpanel();
-
- class Resource
- {
- public:
- Resource() : tws_service_quickpanel_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service_quickpanel *tws_service_quickpanel_object;
- tws_service_quickpanel *object() { return tws_service_quickpanel_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum effect_type {
- effect_type_swipe = 0,
- effect_type_move = 1,
- effect_type_app_custom = 2,
- };
-
- enum msg {
- msg_show = 0,
- msg_hide = 1,
- };
-
- protected:
- virtual Resource *tws_service_quickpanel_allocate();
-
- virtual void tws_service_quickpanel_bind_resource(Resource *resource);
- virtual void tws_service_quickpanel_destroy_resource(Resource *resource);
-
- virtual void tws_service_quickpanel_destroy(Resource *resource);
- virtual void tws_service_quickpanel_msg_send(Resource *resource, uint32_t msg);
- virtual void tws_service_quickpanel_effect_type_set(Resource *resource, uint32_t type);
- virtual void tws_service_quickpanel_scroll_lock_set(Resource *resource, uint32_t lock);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_quickpanel_interface m_tws_service_quickpanel_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_msg_send(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t msg);
- static void handle_effect_type_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t type);
- static void handle_scroll_lock_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t lock);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service_quickpanel *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service_screensaver_manager
- {
- public:
- tws_service_screensaver_manager(struct ::wl_client *client, uint32_t id, int version);
- tws_service_screensaver_manager(struct ::wl_display *display, int version);
- tws_service_screensaver_manager(struct ::wl_resource *resource);
- tws_service_screensaver_manager();
-
- virtual ~tws_service_screensaver_manager();
-
- class Resource
- {
- public:
- Resource() : tws_service_screensaver_manager_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service_screensaver_manager *tws_service_screensaver_manager_object;
- tws_service_screensaver_manager *object() { return tws_service_screensaver_manager_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum state_type {
- state_type_unknown = 0,
- state_type_enable = 1,
- state_type_active = 2,
- state_type_idle_timeout = 3,
- };
-
- void send_idle();
- void send_idle(struct ::wl_resource *resource);
- void send_active();
- void send_active(struct ::wl_resource *resource);
- void send_state_get_done(uint32_t state_type, uint32_t value, uint32_t error_state);
- void send_state_get_done(struct ::wl_resource *resource, uint32_t state_type, uint32_t value, uint32_t error_state);
-
- protected:
- virtual Resource *tws_service_screensaver_manager_allocate();
-
- virtual void tws_service_screensaver_manager_bind_resource(Resource *resource);
- virtual void tws_service_screensaver_manager_destroy_resource(Resource *resource);
-
- virtual void tws_service_screensaver_manager_destroy(Resource *resource);
- virtual void tws_service_screensaver_manager_enable(Resource *resource);
- virtual void tws_service_screensaver_manager_disable(Resource *resource);
- virtual void tws_service_screensaver_manager_idle_time_set(Resource *resource, uint32_t id);
- virtual void tws_service_screensaver_manager_state_get(Resource *resource, uint32_t state_type);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_screensaver_manager_interface m_tws_service_screensaver_manager_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_enable(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_disable(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_idle_time_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_state_get(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t state_type);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service_screensaver_manager *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service_screensaver
- {
- public:
- tws_service_screensaver(struct ::wl_client *client, uint32_t id, int version);
- tws_service_screensaver(struct ::wl_display *display, int version);
- tws_service_screensaver(struct ::wl_resource *resource);
- tws_service_screensaver();
-
- virtual ~tws_service_screensaver();
-
- class Resource
- {
- public:
- Resource() : tws_service_screensaver_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service_screensaver *tws_service_screensaver_object;
- tws_service_screensaver *object() { return tws_service_screensaver_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_request_rejected = 0, // given request is denied
- };
-
- protected:
- virtual Resource *tws_service_screensaver_allocate();
-
- virtual void tws_service_screensaver_bind_resource(Resource *resource);
- virtual void tws_service_screensaver_destroy_resource(Resource *resource);
-
- virtual void tws_service_screensaver_release(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_screensaver_interface m_tws_service_screensaver_interface;
-
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service_screensaver *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service_cbhm
- {
- public:
- tws_service_cbhm(struct ::wl_client *client, uint32_t id, int version);
- tws_service_cbhm(struct ::wl_display *display, int version);
- tws_service_cbhm(struct ::wl_resource *resource);
- tws_service_cbhm();
-
- virtual ~tws_service_cbhm();
-
- class Resource
- {
- public:
- Resource() : tws_service_cbhm_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service_cbhm *tws_service_cbhm_object;
- tws_service_cbhm *object() { return tws_service_cbhm_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum msg {
- msg_show = 0,
- msg_hide = 1,
- msg_data_selected = 2,
- };
-
- protected:
- virtual Resource *tws_service_cbhm_allocate();
-
- virtual void tws_service_cbhm_bind_resource(Resource *resource);
- virtual void tws_service_cbhm_destroy_resource(Resource *resource);
-
- virtual void tws_service_cbhm_destroy(Resource *resource);
- virtual void tws_service_cbhm_msg_send(Resource *resource, uint32_t msg);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_cbhm_interface m_tws_service_cbhm_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_msg_send(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t msg);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service_cbhm *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_dummy_extension
- {
- public:
- tws_dummy_extension(struct ::wl_client *client, uint32_t id, int version);
- tws_dummy_extension(struct ::wl_display *display, int version);
- tws_dummy_extension(struct ::wl_resource *resource);
- tws_dummy_extension();
-
- virtual ~tws_dummy_extension();
-
- class Resource
- {
- public:
- Resource() : tws_dummy_extension_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_dummy_extension *tws_dummy_extension_object;
- tws_dummy_extension *object() { return tws_dummy_extension_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *tws_dummy_extension_allocate();
-
- virtual void tws_dummy_extension_bind_resource(Resource *resource);
- virtual void tws_dummy_extension_destroy_resource(Resource *resource);
-
- virtual void tws_dummy_extension_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_dummy_extension_interface m_tws_dummy_extension_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_dummy_extension *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service_softkey
- {
- public:
- tws_service_softkey(struct ::wl_client *client, uint32_t id, int version);
- tws_service_softkey(struct ::wl_display *display, int version);
- tws_service_softkey(struct ::wl_resource *resource);
- tws_service_softkey();
-
- virtual ~tws_service_softkey();
-
- class Resource
- {
- public:
- Resource() : tws_service_softkey_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service_softkey *tws_service_softkey_object;
- tws_service_softkey *object() { return tws_service_softkey_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum msg {
- msg_show = 0,
- msg_hide = 1,
- };
-
- void send_visible_change_request(int32_t show);
- void send_visible_change_request(struct ::wl_resource *resource, int32_t show);
- void send_expand_change_request(int32_t expand);
- void send_expand_change_request(struct ::wl_resource *resource, int32_t expand);
- void send_opacity_change_request(int32_t opacity);
- void send_opacity_change_request(struct ::wl_resource *resource, int32_t opacity);
-
- protected:
- virtual Resource *tws_service_softkey_allocate();
-
- virtual void tws_service_softkey_bind_resource(Resource *resource);
- virtual void tws_service_softkey_destroy_resource(Resource *resource);
-
- virtual void tws_service_softkey_destroy(Resource *resource);
- virtual void tws_service_softkey_msg_send(Resource *resource, uint32_t msg);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_softkey_interface m_tws_service_softkey_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_msg_send(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t msg);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service_softkey *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_softkey
- {
- public:
- tws_softkey(struct ::wl_client *client, uint32_t id, int version);
- tws_softkey(struct ::wl_display *display, int version);
- tws_softkey(struct ::wl_resource *resource);
- tws_softkey();
-
- virtual ~tws_softkey();
-
- class Resource
- {
- public:
- Resource() : tws_softkey_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_softkey *tws_softkey_object;
- tws_softkey *object() { return tws_softkey_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_none = 0, // no error. succeed.
- error_request_rejected = 1, // given request is denied
- error_no_service = 2, // there is no softkey
- };
-
- enum state {
- state_visible = 0,
- state_expand = 1,
- state_opacity = 2,
- };
-
- enum state_visible {
- state_visible_unknown = 0,
- state_visible_show = 1,
- state_visible_hide = 2,
- };
-
- enum state_expand {
- state_expand_unknown = 10,
- state_expand_on = 11,
- state_expand_off = 12,
- };
-
- enum state_opacity {
- state_opacity_unknown = 20,
- state_opacity_opaque = 21,
- state_opacity_transparent = 22,
- };
-
- void send_support_check_done(int32_t support);
- void send_support_check_done(struct ::wl_resource *resource, int32_t support);
- void send_state_get_done(int32_t type, int32_t value, uint32_t error_state);
- void send_state_get_done(struct ::wl_resource *resource, int32_t type, int32_t value, uint32_t error_state);
-
- protected:
- virtual Resource *tws_softkey_allocate();
-
- virtual void tws_softkey_bind_resource(Resource *resource);
- virtual void tws_softkey_destroy_resource(Resource *resource);
-
- virtual void tws_softkey_release(Resource *resource);
- virtual void tws_softkey_support_check(Resource *resource);
- virtual void tws_softkey_show(Resource *resource);
- virtual void tws_softkey_hide(Resource *resource);
- virtual void tws_softkey_state_set(Resource *resource, int32_t type, int32_t val);
- virtual void tws_softkey_state_get(Resource *resource, int32_t type);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_softkey_interface m_tws_softkey_interface;
-
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_support_check(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_show(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_hide(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_state_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type,
- int32_t val);
- static void handle_state_get(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t type);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_softkey *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service_magnifier
- {
- public:
- tws_service_magnifier(struct ::wl_client *client, uint32_t id, int version);
- tws_service_magnifier(struct ::wl_display *display, int version);
- tws_service_magnifier(struct ::wl_resource *resource);
- tws_service_magnifier();
-
- virtual ~tws_service_magnifier();
-
- class Resource
- {
- public:
- Resource() : tws_service_magnifier_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service_magnifier *tws_service_magnifier_object;
- tws_service_magnifier *object() { return tws_service_magnifier_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum zoom_ratio {
- zoom_ratio_100 = 100,
- zoom_ratio_110 = 110,
- zoom_ratio_120 = 120,
- zoom_ratio_130 = 130,
- zoom_ratio_140 = 140,
- zoom_ratio_150 = 150,
- zoom_ratio_160 = 160,
- zoom_ratio_170 = 170,
- zoom_ratio_180 = 180,
- zoom_ratio_190 = 190,
- zoom_ratio_200 = 200,
- };
-
- protected:
- virtual Resource *tws_service_magnifier_allocate();
-
- virtual void tws_service_magnifier_bind_resource(Resource *resource);
- virtual void tws_service_magnifier_destroy_resource(Resource *resource);
-
- virtual void tws_service_magnifier_destroy(Resource *resource);
- virtual void tws_service_magnifier_zoom_geometry_set(Resource *resource, uint32_t angle, int32_t x, int32_t y, uint32_t w, uint32_t h);
- virtual void tws_service_magnifier_zoom_ratio_set(Resource *resource, int32_t ratio);
- virtual void tws_service_magnifier_zoom_enable_set(Resource *resource, int32_t enable);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_magnifier_interface m_tws_service_magnifier_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_zoom_geometry_set(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t angle,
- int32_t x,
- int32_t y,
- uint32_t w,
- uint32_t h);
- static void handle_zoom_ratio_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t ratio);
- static void handle_zoom_enable_set(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t enable);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service_magnifier *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_service_launcher
- {
- public:
- tws_service_launcher(struct ::wl_client *client, uint32_t id, int version);
- tws_service_launcher(struct ::wl_display *display, int version);
- tws_service_launcher(struct ::wl_resource *resource);
- tws_service_launcher();
-
- virtual ~tws_service_launcher();
-
- class Resource
- {
- public:
- Resource() : tws_service_launcher_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_service_launcher *tws_service_launcher_object;
- tws_service_launcher *object() { return tws_service_launcher_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum direction {
- direction_forward = 0, // direction of transition to a launched app from a launcher
- direction_backward = 1, // direction of transition to a launcher from a launched app
- };
-
- enum target_type {
- target_type_remote_surface = 0, // can get target via remote surface
- target_type_edje = 1, // can get target via edj file
- target_type_image = 2, // can get target via image file
- };
-
- enum error {
- error_none = 0, // no error.
- error_disqualified = 1, // client is disqualified and any requests will be ignored from now.
- error_wrong_request = 2,
- };
-
- void send_prepare(uint32_t target_type, struct ::wl_array *target_info, uint32_t direction, int32_t x, int32_t y, const std::string &shared_widget_info, uint32_t serial);
- void send_prepare(struct ::wl_resource *resource, uint32_t target_type, struct ::wl_array *target_info, uint32_t direction, int32_t x, int32_t y, const std::string &shared_widget_info, uint32_t serial);
- void send_stop(uint32_t serial);
- void send_stop(struct ::wl_resource *resource, uint32_t serial);
- void send_error(uint32_t code, uint32_t serial);
- void send_error(struct ::wl_resource *resource, uint32_t code, uint32_t serial);
- void send_cleanup(uint32_t serial);
- void send_cleanup(struct ::wl_resource *resource, uint32_t serial);
-
- protected:
- virtual Resource *tws_service_launcher_allocate();
-
- virtual void tws_service_launcher_bind_resource(Resource *resource);
- virtual void tws_service_launcher_destroy_resource(Resource *resource);
-
- virtual void tws_service_launcher_destroy(Resource *resource);
- virtual void tws_service_launcher_launch(Resource *resource, const std::string &app_id, const std::string &instance_id, int32_t pid, uint32_t serial);
- virtual void tws_service_launcher_launch_with_shared_widget(Resource *resource, const std::string &app_id, const std::string &instance_id, int32_t pid, uint32_t serial);
- virtual void tws_service_launcher_launching(Resource *resource, uint32_t serial);
- virtual void tws_service_launcher_launch_done(Resource *resource, uint32_t serial);
- virtual void tws_service_launcher_launch_cancel(Resource *resource, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_service_launcher_interface m_tws_service_launcher_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_launch(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id,
- const char *instance_id,
- int32_t pid,
- uint32_t serial);
- static void handle_launch_with_shared_widget(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id,
- const char *instance_id,
- int32_t pid,
- uint32_t serial);
- static void handle_launching(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void handle_launch_done(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void handle_launch_cancel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_service_launcher *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class tws_shared_widget_launch
- {
- public:
- tws_shared_widget_launch(struct ::wl_client *client, uint32_t id, int version);
- tws_shared_widget_launch(struct ::wl_display *display, int version);
- tws_shared_widget_launch(struct ::wl_resource *resource);
- tws_shared_widget_launch();
-
- virtual ~tws_shared_widget_launch();
-
- class Resource
- {
- public:
- Resource() : tws_shared_widget_launch_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tws_shared_widget_launch *tws_shared_widget_launch_object;
- tws_shared_widget_launch *object() { return tws_shared_widget_launch_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum prepare_state {
- prepare_state_widget_show = 0,
- prepare_state_widget_hide = 1,
- };
-
- void send_prepare_shared_widget(uint32_t state, uint32_t serial);
- void send_prepare_shared_widget(struct ::wl_resource *resource, uint32_t state, uint32_t serial);
-
- protected:
- virtual Resource *tws_shared_widget_launch_allocate();
-
- virtual void tws_shared_widget_launch_bind_resource(Resource *resource);
- virtual void tws_shared_widget_launch_destroy_resource(Resource *resource);
-
- virtual void tws_shared_widget_launch_release(Resource *resource);
- virtual void tws_shared_widget_launch_prepare_shared_widget_done(Resource *resource, const std::string &shared_widget_info, uint32_t state, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tws_shared_widget_launch_interface m_tws_shared_widget_launch_interface;
-
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_prepare_shared_widget_done(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *shared_widget_info,
- uint32_t state,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tws_shared_widget_launch *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland/wayland.xml */
-
-#include "dswayland-server-wayland.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- wl_callback::wl_callback(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_callback::wl_callback(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_callback::wl_callback(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_callback::wl_callback()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_callback::~wl_callback()
- {
- std::multimap<struct ::wl_client*, wl_callback::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_callback::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_callback::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_callback::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_callback::Resource *wl_callback::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_callback::Resource *wl_callback::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_callback::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_callback_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_callback::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_callback::interface()
- {
- return &::wl_callback_interface;
- }
-
- wl_callback::Resource *wl_callback::callback_allocate()
- {
- return new Resource;
- }
-
- void wl_callback::callback_bind_resource(Resource *)
- {
- }
-
- void wl_callback::callback_destroy_resource(Resource *)
- {
- }
-
- void wl_callback::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_callback *that = static_cast<wl_callback *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_callback::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_callback *that = static_cast<wl_callback::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_callback::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_callback *that = resource->callback_object;
- that->m_resource_map.erase(resource->client());
- that->callback_destroy_resource(resource);
- delete resource;
- }
-
- wl_callback::Resource *wl_callback::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_callback_interface, version, id);
- return bind(handle);
- }
-
- wl_callback::Resource *wl_callback::bind(struct ::wl_resource *handle)
- {
- Resource *resource = callback_allocate();
- resource->callback_object = this;
-
- wl_resource_set_implementation(handle, NULL, resource, destroy_func);
- resource->handle = handle;
- callback_bind_resource(resource);
- return resource;
- }
- wl_callback::Resource *wl_callback::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_callback_interface, NULL))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- void wl_callback::send_done(uint32_t callback_data)
- {
- DS_ASSERT_X(m_resource, "wl_callback::done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_callback::done as it's not initialised");
- return;
- }
- send_done(
- m_resource->handle,
- callback_data);
- }
-
- void wl_callback::send_done(struct ::wl_resource *resource, uint32_t callback_data)
- {
- wl_callback_send_done(
- resource,
- callback_data);
- }
-
-
- wl_compositor::wl_compositor(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_compositor::wl_compositor(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_compositor::wl_compositor(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_compositor::wl_compositor()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_compositor::~wl_compositor()
- {
- std::multimap<struct ::wl_client*, wl_compositor::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_compositor::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_compositor::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_compositor::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_compositor::Resource *wl_compositor::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_compositor::Resource *wl_compositor::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_compositor::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_compositor_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_compositor::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_compositor::interface()
- {
- return &::wl_compositor_interface;
- }
-
- wl_compositor::Resource *wl_compositor::compositor_allocate()
- {
- return new Resource;
- }
-
- void wl_compositor::compositor_bind_resource(Resource *)
- {
- }
-
- void wl_compositor::compositor_destroy_resource(Resource *)
- {
- }
-
- void wl_compositor::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_compositor *that = static_cast<wl_compositor *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_compositor::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_compositor *that = static_cast<wl_compositor::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_compositor::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_compositor *that = resource->compositor_object;
- that->m_resource_map.erase(resource->client());
- that->compositor_destroy_resource(resource);
- delete resource;
- }
-
- wl_compositor::Resource *wl_compositor::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_compositor_interface, version, id);
- return bind(handle);
- }
-
- wl_compositor::Resource *wl_compositor::bind(struct ::wl_resource *handle)
- {
- Resource *resource = compositor_allocate();
- resource->compositor_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_compositor_interface, resource, destroy_func);
- resource->handle = handle;
- compositor_bind_resource(resource);
- return resource;
- }
- wl_compositor::Resource *wl_compositor::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_compositor_interface, &m_wl_compositor_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_compositor_interface wl_compositor::m_wl_compositor_interface = {
- wl_compositor::handle_create_surface,
- wl_compositor::handle_create_region
- };
-
- void wl_compositor::compositor_create_surface(Resource *, uint32_t)
- {
- }
-
- void wl_compositor::compositor_create_region(Resource *, uint32_t)
- {
- }
-
-
- void wl_compositor::handle_create_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_compositor *>(r->compositor_object)->compositor_create_surface(
- r,
- id);
- }
-
- void wl_compositor::handle_create_region(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_compositor *>(r->compositor_object)->compositor_create_region(
- r,
- id);
- }
-
- wl_shm_pool::wl_shm_pool(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_shm_pool::wl_shm_pool(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_shm_pool::wl_shm_pool(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_shm_pool::wl_shm_pool()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_shm_pool::~wl_shm_pool()
- {
- std::multimap<struct ::wl_client*, wl_shm_pool::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_shm_pool::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_shm_pool::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_shm_pool::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_shm_pool::Resource *wl_shm_pool::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_shm_pool::Resource *wl_shm_pool::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_shm_pool::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_shm_pool_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_shm_pool::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_shm_pool::interface()
- {
- return &::wl_shm_pool_interface;
- }
-
- wl_shm_pool::Resource *wl_shm_pool::shm_pool_allocate()
- {
- return new Resource;
- }
-
- void wl_shm_pool::shm_pool_bind_resource(Resource *)
- {
- }
-
- void wl_shm_pool::shm_pool_destroy_resource(Resource *)
- {
- }
-
- void wl_shm_pool::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_shm_pool *that = static_cast<wl_shm_pool *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_shm_pool::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_shm_pool *that = static_cast<wl_shm_pool::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_shm_pool::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_shm_pool *that = resource->shm_pool_object;
- that->m_resource_map.erase(resource->client());
- that->shm_pool_destroy_resource(resource);
- delete resource;
- }
-
- wl_shm_pool::Resource *wl_shm_pool::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_shm_pool_interface, version, id);
- return bind(handle);
- }
-
- wl_shm_pool::Resource *wl_shm_pool::bind(struct ::wl_resource *handle)
- {
- Resource *resource = shm_pool_allocate();
- resource->shm_pool_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_shm_pool_interface, resource, destroy_func);
- resource->handle = handle;
- shm_pool_bind_resource(resource);
- return resource;
- }
- wl_shm_pool::Resource *wl_shm_pool::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_shm_pool_interface, &m_wl_shm_pool_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_shm_pool_interface wl_shm_pool::m_wl_shm_pool_interface = {
- wl_shm_pool::handle_create_buffer,
- wl_shm_pool::handle_destroy,
- wl_shm_pool::handle_resize
- };
-
- void wl_shm_pool::shm_pool_create_buffer(Resource *, uint32_t, int32_t , int32_t , int32_t , int32_t , uint32_t )
- {
- }
-
- void wl_shm_pool::shm_pool_destroy(Resource *)
- {
- }
-
- void wl_shm_pool::shm_pool_resize(Resource *, int32_t )
- {
- }
-
-
- void wl_shm_pool::handle_create_buffer(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- int32_t offset,
- int32_t width,
- int32_t height,
- int32_t stride,
- uint32_t format)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shm_pool *>(r->shm_pool_object)->shm_pool_create_buffer(
- r,
- id,
- offset,
- width,
- height,
- stride,
- format);
- }
-
- void wl_shm_pool::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shm_pool *>(r->shm_pool_object)->shm_pool_destroy(
- r);
- }
-
- void wl_shm_pool::handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t size)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shm_pool *>(r->shm_pool_object)->shm_pool_resize(
- r,
- size);
- }
-
- wl_shm::wl_shm(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_shm::wl_shm(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_shm::wl_shm(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_shm::wl_shm()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_shm::~wl_shm()
- {
- std::multimap<struct ::wl_client*, wl_shm::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_shm::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_shm::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_shm::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_shm::Resource *wl_shm::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_shm::Resource *wl_shm::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_shm::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_shm_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_shm::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_shm::interface()
- {
- return &::wl_shm_interface;
- }
-
- wl_shm::Resource *wl_shm::shm_allocate()
- {
- return new Resource;
- }
-
- void wl_shm::shm_bind_resource(Resource *)
- {
- }
-
- void wl_shm::shm_destroy_resource(Resource *)
- {
- }
-
- void wl_shm::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_shm *that = static_cast<wl_shm *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_shm::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_shm *that = static_cast<wl_shm::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_shm::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_shm *that = resource->shm_object;
- that->m_resource_map.erase(resource->client());
- that->shm_destroy_resource(resource);
- delete resource;
- }
-
- wl_shm::Resource *wl_shm::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_shm_interface, version, id);
- return bind(handle);
- }
-
- wl_shm::Resource *wl_shm::bind(struct ::wl_resource *handle)
- {
- Resource *resource = shm_allocate();
- resource->shm_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_shm_interface, resource, destroy_func);
- resource->handle = handle;
- shm_bind_resource(resource);
- return resource;
- }
- wl_shm::Resource *wl_shm::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_shm_interface, &m_wl_shm_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_shm_interface wl_shm::m_wl_shm_interface = {
- wl_shm::handle_create_pool
- };
-
- void wl_shm::shm_create_pool(Resource *, uint32_t, int32_t , int32_t )
- {
- }
-
-
- void wl_shm::handle_create_pool(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- int32_t fd,
- int32_t size)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shm *>(r->shm_object)->shm_create_pool(
- r,
- id,
- fd,
- size);
- }
-
- void wl_shm::send_format(uint32_t format)
- {
- DS_ASSERT_X(m_resource, "wl_shm::format", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_shm::format as it's not initialised");
- return;
- }
- send_format(
- m_resource->handle,
- format);
- }
-
- void wl_shm::send_format(struct ::wl_resource *resource, uint32_t format)
- {
- wl_shm_send_format(
- resource,
- format);
- }
-
-
- wl_buffer::wl_buffer(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_buffer::wl_buffer(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_buffer::wl_buffer(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_buffer::wl_buffer()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_buffer::~wl_buffer()
- {
- std::multimap<struct ::wl_client*, wl_buffer::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_buffer::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_buffer::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_buffer::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_buffer::Resource *wl_buffer::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_buffer::Resource *wl_buffer::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_buffer::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_buffer_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_buffer::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_buffer::interface()
- {
- return &::wl_buffer_interface;
- }
-
- wl_buffer::Resource *wl_buffer::buffer_allocate()
- {
- return new Resource;
- }
-
- void wl_buffer::buffer_bind_resource(Resource *)
- {
- }
-
- void wl_buffer::buffer_destroy_resource(Resource *)
- {
- }
-
- void wl_buffer::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_buffer *that = static_cast<wl_buffer *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_buffer::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_buffer *that = static_cast<wl_buffer::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_buffer::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_buffer *that = resource->buffer_object;
- that->m_resource_map.erase(resource->client());
- that->buffer_destroy_resource(resource);
- delete resource;
- }
-
- wl_buffer::Resource *wl_buffer::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_buffer_interface, version, id);
- return bind(handle);
- }
-
- wl_buffer::Resource *wl_buffer::bind(struct ::wl_resource *handle)
- {
- Resource *resource = buffer_allocate();
- resource->buffer_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_buffer_interface, resource, destroy_func);
- resource->handle = handle;
- buffer_bind_resource(resource);
- return resource;
- }
- wl_buffer::Resource *wl_buffer::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_buffer_interface, &m_wl_buffer_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_buffer_interface wl_buffer::m_wl_buffer_interface = {
- wl_buffer::handle_destroy
- };
-
- void wl_buffer::buffer_destroy(Resource *)
- {
- }
-
-
- void wl_buffer::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_buffer *>(r->buffer_object)->buffer_destroy(
- r);
- }
-
- void wl_buffer::send_release()
- {
- DS_ASSERT_X(m_resource, "wl_buffer::release", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_buffer::release as it's not initialised");
- return;
- }
- send_release(
- m_resource->handle);
- }
-
- void wl_buffer::send_release(struct ::wl_resource *resource)
- {
- wl_buffer_send_release(
- resource);
- }
-
-
- wl_data_offer::wl_data_offer(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_data_offer::wl_data_offer(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_data_offer::wl_data_offer(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_data_offer::wl_data_offer()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_data_offer::~wl_data_offer()
- {
- std::multimap<struct ::wl_client*, wl_data_offer::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_data_offer::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_data_offer::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_data_offer::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_data_offer::Resource *wl_data_offer::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_data_offer::Resource *wl_data_offer::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_data_offer::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_data_offer_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_data_offer::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_data_offer::interface()
- {
- return &::wl_data_offer_interface;
- }
-
- wl_data_offer::Resource *wl_data_offer::data_offer_allocate()
- {
- return new Resource;
- }
-
- void wl_data_offer::data_offer_bind_resource(Resource *)
- {
- }
-
- void wl_data_offer::data_offer_destroy_resource(Resource *)
- {
- }
-
- void wl_data_offer::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_data_offer *that = static_cast<wl_data_offer *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_data_offer::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_data_offer *that = static_cast<wl_data_offer::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_data_offer::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_data_offer *that = resource->data_offer_object;
- that->m_resource_map.erase(resource->client());
- that->data_offer_destroy_resource(resource);
- delete resource;
- }
-
- wl_data_offer::Resource *wl_data_offer::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_data_offer_interface, version, id);
- return bind(handle);
- }
-
- wl_data_offer::Resource *wl_data_offer::bind(struct ::wl_resource *handle)
- {
- Resource *resource = data_offer_allocate();
- resource->data_offer_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_data_offer_interface, resource, destroy_func);
- resource->handle = handle;
- data_offer_bind_resource(resource);
- return resource;
- }
- wl_data_offer::Resource *wl_data_offer::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_data_offer_interface, &m_wl_data_offer_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_data_offer_interface wl_data_offer::m_wl_data_offer_interface = {
- wl_data_offer::handle_accept,
- wl_data_offer::handle_receive,
- wl_data_offer::handle_destroy,
- wl_data_offer::handle_finish,
- wl_data_offer::handle_set_actions
- };
-
- void wl_data_offer::data_offer_accept(Resource *, uint32_t , const std::string &)
- {
- }
-
- void wl_data_offer::data_offer_receive(Resource *, const std::string &, int32_t )
- {
- }
-
- void wl_data_offer::data_offer_destroy(Resource *)
- {
- }
-
- void wl_data_offer::data_offer_finish(Resource *)
- {
- }
-
- void wl_data_offer::data_offer_set_actions(Resource *, uint32_t , uint32_t )
- {
- }
-
-
- void wl_data_offer::handle_accept(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *mime_type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_offer *>(r->data_offer_object)->data_offer_accept(
- r,
- serial,
- std::string(mime_type));
- }
-
- void wl_data_offer::handle_receive(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *mime_type,
- int32_t fd)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_offer *>(r->data_offer_object)->data_offer_receive(
- r,
- std::string(mime_type),
- fd);
- }
-
- void wl_data_offer::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_offer *>(r->data_offer_object)->data_offer_destroy(
- r);
- }
-
- void wl_data_offer::handle_finish(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_offer *>(r->data_offer_object)->data_offer_finish(
- r);
- }
-
- void wl_data_offer::handle_set_actions(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t dnd_actions,
- uint32_t preferred_action)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_offer *>(r->data_offer_object)->data_offer_set_actions(
- r,
- dnd_actions,
- preferred_action);
- }
-
- void wl_data_offer::send_offer(const std::string &mime_type)
- {
- DS_ASSERT_X(m_resource, "wl_data_offer::offer", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_offer::offer as it's not initialised");
- return;
- }
- send_offer(
- m_resource->handle,
- mime_type);
- }
-
- void wl_data_offer::send_offer(struct ::wl_resource *resource, const std::string &mime_type)
- {
- wl_data_offer_send_offer(
- resource,
- mime_type.c_str());
- }
-
-
- void wl_data_offer::send_source_actions(uint32_t source_actions)
- {
- DS_ASSERT_X(m_resource, "wl_data_offer::source_actions", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_offer::source_actions as it's not initialised");
- return;
- }
- send_source_actions(
- m_resource->handle,
- source_actions);
- }
-
- void wl_data_offer::send_source_actions(struct ::wl_resource *resource, uint32_t source_actions)
- {
- wl_data_offer_send_source_actions(
- resource,
- source_actions);
- }
-
-
- void wl_data_offer::send_action(uint32_t dnd_action)
- {
- DS_ASSERT_X(m_resource, "wl_data_offer::action", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_offer::action as it's not initialised");
- return;
- }
- send_action(
- m_resource->handle,
- dnd_action);
- }
-
- void wl_data_offer::send_action(struct ::wl_resource *resource, uint32_t dnd_action)
- {
- wl_data_offer_send_action(
- resource,
- dnd_action);
- }
-
-
- wl_data_source::wl_data_source(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_data_source::wl_data_source(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_data_source::wl_data_source(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_data_source::wl_data_source()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_data_source::~wl_data_source()
- {
- std::multimap<struct ::wl_client*, wl_data_source::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_data_source::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_data_source::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_data_source::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_data_source::Resource *wl_data_source::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_data_source::Resource *wl_data_source::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_data_source::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_data_source_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_data_source::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_data_source::interface()
- {
- return &::wl_data_source_interface;
- }
-
- wl_data_source::Resource *wl_data_source::data_source_allocate()
- {
- return new Resource;
- }
-
- void wl_data_source::data_source_bind_resource(Resource *)
- {
- }
-
- void wl_data_source::data_source_destroy_resource(Resource *)
- {
- }
-
- void wl_data_source::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_data_source *that = static_cast<wl_data_source *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_data_source::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_data_source *that = static_cast<wl_data_source::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_data_source::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_data_source *that = resource->data_source_object;
- that->m_resource_map.erase(resource->client());
- that->data_source_destroy_resource(resource);
- delete resource;
- }
-
- wl_data_source::Resource *wl_data_source::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_data_source_interface, version, id);
- return bind(handle);
- }
-
- wl_data_source::Resource *wl_data_source::bind(struct ::wl_resource *handle)
- {
- Resource *resource = data_source_allocate();
- resource->data_source_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_data_source_interface, resource, destroy_func);
- resource->handle = handle;
- data_source_bind_resource(resource);
- return resource;
- }
- wl_data_source::Resource *wl_data_source::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_data_source_interface, &m_wl_data_source_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_data_source_interface wl_data_source::m_wl_data_source_interface = {
- wl_data_source::handle_offer,
- wl_data_source::handle_destroy,
- wl_data_source::handle_set_actions
- };
-
- void wl_data_source::data_source_offer(Resource *, const std::string &)
- {
- }
-
- void wl_data_source::data_source_destroy(Resource *)
- {
- }
-
- void wl_data_source::data_source_set_actions(Resource *, uint32_t )
- {
- }
-
-
- void wl_data_source::handle_offer(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *mime_type)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_source *>(r->data_source_object)->data_source_offer(
- r,
- std::string(mime_type));
- }
-
- void wl_data_source::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_source *>(r->data_source_object)->data_source_destroy(
- r);
- }
-
- void wl_data_source::handle_set_actions(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t dnd_actions)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_source *>(r->data_source_object)->data_source_set_actions(
- r,
- dnd_actions);
- }
-
- void wl_data_source::send_target(const std::string &mime_type)
- {
- DS_ASSERT_X(m_resource, "wl_data_source::target", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_source::target as it's not initialised");
- return;
- }
- send_target(
- m_resource->handle,
- mime_type);
- }
-
- void wl_data_source::send_target(struct ::wl_resource *resource, const std::string &mime_type)
- {
- wl_data_source_send_target(
- resource,
- mime_type.c_str());
- }
-
-
- void wl_data_source::send_send(const std::string &mime_type, int32_t fd)
- {
- DS_ASSERT_X(m_resource, "wl_data_source::send", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_source::send as it's not initialised");
- return;
- }
- send_send(
- m_resource->handle,
- mime_type,
- fd);
- }
-
- void wl_data_source::send_send(struct ::wl_resource *resource, const std::string &mime_type, int32_t fd)
- {
- wl_data_source_send_send(
- resource,
- mime_type.c_str(),
- fd);
- }
-
-
- void wl_data_source::send_cancelled()
- {
- DS_ASSERT_X(m_resource, "wl_data_source::cancelled", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_source::cancelled as it's not initialised");
- return;
- }
- send_cancelled(
- m_resource->handle);
- }
-
- void wl_data_source::send_cancelled(struct ::wl_resource *resource)
- {
- wl_data_source_send_cancelled(
- resource);
- }
-
-
- void wl_data_source::send_dnd_drop_performed()
- {
- DS_ASSERT_X(m_resource, "wl_data_source::dnd_drop_performed", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_source::dnd_drop_performed as it's not initialised");
- return;
- }
- send_dnd_drop_performed(
- m_resource->handle);
- }
-
- void wl_data_source::send_dnd_drop_performed(struct ::wl_resource *resource)
- {
- wl_data_source_send_dnd_drop_performed(
- resource);
- }
-
-
- void wl_data_source::send_dnd_finished()
- {
- DS_ASSERT_X(m_resource, "wl_data_source::dnd_finished", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_source::dnd_finished as it's not initialised");
- return;
- }
- send_dnd_finished(
- m_resource->handle);
- }
-
- void wl_data_source::send_dnd_finished(struct ::wl_resource *resource)
- {
- wl_data_source_send_dnd_finished(
- resource);
- }
-
-
- void wl_data_source::send_action(uint32_t dnd_action)
- {
- DS_ASSERT_X(m_resource, "wl_data_source::action", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_source::action as it's not initialised");
- return;
- }
- send_action(
- m_resource->handle,
- dnd_action);
- }
-
- void wl_data_source::send_action(struct ::wl_resource *resource, uint32_t dnd_action)
- {
- wl_data_source_send_action(
- resource,
- dnd_action);
- }
-
-
- wl_data_device::wl_data_device(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_data_device::wl_data_device(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_data_device::wl_data_device(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_data_device::wl_data_device()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_data_device::~wl_data_device()
- {
- std::multimap<struct ::wl_client*, wl_data_device::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_data_device::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_data_device::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_data_device::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_data_device::Resource *wl_data_device::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_data_device::Resource *wl_data_device::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_data_device::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_data_device_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_data_device::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_data_device::interface()
- {
- return &::wl_data_device_interface;
- }
-
- wl_data_device::Resource *wl_data_device::data_device_allocate()
- {
- return new Resource;
- }
-
- void wl_data_device::data_device_bind_resource(Resource *)
- {
- }
-
- void wl_data_device::data_device_destroy_resource(Resource *)
- {
- }
-
- void wl_data_device::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_data_device *that = static_cast<wl_data_device *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_data_device::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_data_device *that = static_cast<wl_data_device::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_data_device::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_data_device *that = resource->data_device_object;
- that->m_resource_map.erase(resource->client());
- that->data_device_destroy_resource(resource);
- delete resource;
- }
-
- wl_data_device::Resource *wl_data_device::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_data_device_interface, version, id);
- return bind(handle);
- }
-
- wl_data_device::Resource *wl_data_device::bind(struct ::wl_resource *handle)
- {
- Resource *resource = data_device_allocate();
- resource->data_device_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_data_device_interface, resource, destroy_func);
- resource->handle = handle;
- data_device_bind_resource(resource);
- return resource;
- }
- wl_data_device::Resource *wl_data_device::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_data_device_interface, &m_wl_data_device_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_data_device_interface wl_data_device::m_wl_data_device_interface = {
- wl_data_device::handle_start_drag,
- wl_data_device::handle_set_selection,
- wl_data_device::handle_release
- };
-
- void wl_data_device::data_device_start_drag(Resource *, struct ::wl_resource *, struct ::wl_resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void wl_data_device::data_device_set_selection(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void wl_data_device::data_device_release(Resource *)
- {
- }
-
-
- void wl_data_device::handle_start_drag(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *source,
- struct ::wl_resource *origin,
- struct ::wl_resource *icon,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_device *>(r->data_device_object)->data_device_start_drag(
- r,
- source,
- origin,
- icon,
- serial);
- }
-
- void wl_data_device::handle_set_selection(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *source,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_device *>(r->data_device_object)->data_device_set_selection(
- r,
- source,
- serial);
- }
-
- void wl_data_device::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_device *>(r->data_device_object)->data_device_release(
- r);
- }
-
- void wl_data_device::send_data_offer(struct ::wl_resource *id)
- {
- DS_ASSERT_X(m_resource, "wl_data_device::data_offer", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_device::data_offer as it's not initialised");
- return;
- }
- send_data_offer(
- m_resource->handle,
- id);
- }
-
- void wl_data_device::send_data_offer(struct ::wl_resource *resource, struct ::wl_resource *id)
- {
- wl_data_device_send_data_offer(
- resource,
- id);
- }
-
-
- void wl_data_device::send_enter(uint32_t serial, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_resource *id)
- {
- DS_ASSERT_X(m_resource, "wl_data_device::enter", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_device::enter as it's not initialised");
- return;
- }
- send_enter(
- m_resource->handle,
- serial,
- surface,
- x,
- y,
- id);
- }
-
- void wl_data_device::send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_resource *id)
- {
- wl_data_device_send_enter(
- resource,
- serial,
- surface,
- x,
- y,
- id);
- }
-
-
- void wl_data_device::send_leave()
- {
- DS_ASSERT_X(m_resource, "wl_data_device::leave", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_device::leave as it's not initialised");
- return;
- }
- send_leave(
- m_resource->handle);
- }
-
- void wl_data_device::send_leave(struct ::wl_resource *resource)
- {
- wl_data_device_send_leave(
- resource);
- }
-
-
- void wl_data_device::send_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y)
- {
- DS_ASSERT_X(m_resource, "wl_data_device::motion", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_device::motion as it's not initialised");
- return;
- }
- send_motion(
- m_resource->handle,
- time,
- x,
- y);
- }
-
- void wl_data_device::send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t x, wl_fixed_t y)
- {
- wl_data_device_send_motion(
- resource,
- time,
- x,
- y);
- }
-
-
- void wl_data_device::send_drop()
- {
- DS_ASSERT_X(m_resource, "wl_data_device::drop", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_device::drop as it's not initialised");
- return;
- }
- send_drop(
- m_resource->handle);
- }
-
- void wl_data_device::send_drop(struct ::wl_resource *resource)
- {
- wl_data_device_send_drop(
- resource);
- }
-
-
- void wl_data_device::send_selection(struct ::wl_resource *id)
- {
- DS_ASSERT_X(m_resource, "wl_data_device::selection", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_data_device::selection as it's not initialised");
- return;
- }
- send_selection(
- m_resource->handle,
- id);
- }
-
- void wl_data_device::send_selection(struct ::wl_resource *resource, struct ::wl_resource *id)
- {
- wl_data_device_send_selection(
- resource,
- id);
- }
-
-
- wl_data_device_manager::wl_data_device_manager(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_data_device_manager::wl_data_device_manager(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_data_device_manager::wl_data_device_manager(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_data_device_manager::wl_data_device_manager()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_data_device_manager::~wl_data_device_manager()
- {
- std::multimap<struct ::wl_client*, wl_data_device_manager::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_data_device_manager::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_data_device_manager::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_data_device_manager::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_data_device_manager::Resource *wl_data_device_manager::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_data_device_manager::Resource *wl_data_device_manager::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_data_device_manager::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_data_device_manager_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_data_device_manager::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_data_device_manager::interface()
- {
- return &::wl_data_device_manager_interface;
- }
-
- wl_data_device_manager::Resource *wl_data_device_manager::data_device_manager_allocate()
- {
- return new Resource;
- }
-
- void wl_data_device_manager::data_device_manager_bind_resource(Resource *)
- {
- }
-
- void wl_data_device_manager::data_device_manager_destroy_resource(Resource *)
- {
- }
-
- void wl_data_device_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_data_device_manager *that = static_cast<wl_data_device_manager *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_data_device_manager::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_data_device_manager *that = static_cast<wl_data_device_manager::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_data_device_manager::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_data_device_manager *that = resource->data_device_manager_object;
- that->m_resource_map.erase(resource->client());
- that->data_device_manager_destroy_resource(resource);
- delete resource;
- }
-
- wl_data_device_manager::Resource *wl_data_device_manager::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_data_device_manager_interface, version, id);
- return bind(handle);
- }
-
- wl_data_device_manager::Resource *wl_data_device_manager::bind(struct ::wl_resource *handle)
- {
- Resource *resource = data_device_manager_allocate();
- resource->data_device_manager_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_data_device_manager_interface, resource, destroy_func);
- resource->handle = handle;
- data_device_manager_bind_resource(resource);
- return resource;
- }
- wl_data_device_manager::Resource *wl_data_device_manager::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_data_device_manager_interface, &m_wl_data_device_manager_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_data_device_manager_interface wl_data_device_manager::m_wl_data_device_manager_interface = {
- wl_data_device_manager::handle_create_data_source,
- wl_data_device_manager::handle_get_data_device
- };
-
- void wl_data_device_manager::data_device_manager_create_data_source(Resource *, uint32_t)
- {
- }
-
- void wl_data_device_manager::data_device_manager_get_data_device(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
-
- void wl_data_device_manager::handle_create_data_source(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_device_manager *>(r->data_device_manager_object)->data_device_manager_create_data_source(
- r,
- id);
- }
-
- void wl_data_device_manager::handle_get_data_device(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *seat)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_data_device_manager *>(r->data_device_manager_object)->data_device_manager_get_data_device(
- r,
- id,
- seat);
- }
-
- wl_shell::wl_shell(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_shell::wl_shell(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_shell::wl_shell(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_shell::wl_shell()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_shell::~wl_shell()
- {
- std::multimap<struct ::wl_client*, wl_shell::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_shell::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_shell::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_shell::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_shell::Resource *wl_shell::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_shell::Resource *wl_shell::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_shell::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_shell_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_shell::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_shell::interface()
- {
- return &::wl_shell_interface;
- }
-
- wl_shell::Resource *wl_shell::shell_allocate()
- {
- return new Resource;
- }
-
- void wl_shell::shell_bind_resource(Resource *)
- {
- }
-
- void wl_shell::shell_destroy_resource(Resource *)
- {
- }
-
- void wl_shell::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_shell *that = static_cast<wl_shell *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_shell::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_shell *that = static_cast<wl_shell::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_shell::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_shell *that = resource->shell_object;
- that->m_resource_map.erase(resource->client());
- that->shell_destroy_resource(resource);
- delete resource;
- }
-
- wl_shell::Resource *wl_shell::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_shell_interface, version, id);
- return bind(handle);
- }
-
- wl_shell::Resource *wl_shell::bind(struct ::wl_resource *handle)
- {
- Resource *resource = shell_allocate();
- resource->shell_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_shell_interface, resource, destroy_func);
- resource->handle = handle;
- shell_bind_resource(resource);
- return resource;
- }
- wl_shell::Resource *wl_shell::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_shell_interface, &m_wl_shell_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_shell_interface wl_shell::m_wl_shell_interface = {
- wl_shell::handle_get_shell_surface
- };
-
- void wl_shell::shell_get_shell_surface(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
-
- void wl_shell::handle_get_shell_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell *>(r->shell_object)->shell_get_shell_surface(
- r,
- id,
- surface);
- }
-
- wl_shell_surface::wl_shell_surface(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_shell_surface::wl_shell_surface(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_shell_surface::wl_shell_surface(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_shell_surface::wl_shell_surface()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_shell_surface::~wl_shell_surface()
- {
- std::multimap<struct ::wl_client*, wl_shell_surface::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_shell_surface::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_shell_surface::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_shell_surface::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_shell_surface::Resource *wl_shell_surface::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_shell_surface::Resource *wl_shell_surface::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_shell_surface::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_shell_surface_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_shell_surface::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_shell_surface::interface()
- {
- return &::wl_shell_surface_interface;
- }
-
- wl_shell_surface::Resource *wl_shell_surface::shell_surface_allocate()
- {
- return new Resource;
- }
-
- void wl_shell_surface::shell_surface_bind_resource(Resource *)
- {
- }
-
- void wl_shell_surface::shell_surface_destroy_resource(Resource *)
- {
- }
-
- void wl_shell_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_shell_surface *that = static_cast<wl_shell_surface *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_shell_surface::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_shell_surface *that = static_cast<wl_shell_surface::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_shell_surface::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_shell_surface *that = resource->shell_surface_object;
- that->m_resource_map.erase(resource->client());
- that->shell_surface_destroy_resource(resource);
- delete resource;
- }
-
- wl_shell_surface::Resource *wl_shell_surface::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_shell_surface_interface, version, id);
- return bind(handle);
- }
-
- wl_shell_surface::Resource *wl_shell_surface::bind(struct ::wl_resource *handle)
- {
- Resource *resource = shell_surface_allocate();
- resource->shell_surface_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_shell_surface_interface, resource, destroy_func);
- resource->handle = handle;
- shell_surface_bind_resource(resource);
- return resource;
- }
- wl_shell_surface::Resource *wl_shell_surface::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_shell_surface_interface, &m_wl_shell_surface_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_shell_surface_interface wl_shell_surface::m_wl_shell_surface_interface = {
- wl_shell_surface::handle_pong,
- wl_shell_surface::handle_move,
- wl_shell_surface::handle_resize,
- wl_shell_surface::handle_set_toplevel,
- wl_shell_surface::handle_set_transient,
- wl_shell_surface::handle_set_fullscreen,
- wl_shell_surface::handle_set_popup,
- wl_shell_surface::handle_set_maximized,
- wl_shell_surface::handle_set_title,
- wl_shell_surface::handle_set_class
- };
-
- void wl_shell_surface::shell_surface_pong(Resource *, uint32_t )
- {
- }
-
- void wl_shell_surface::shell_surface_move(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void wl_shell_surface::shell_surface_resize(Resource *, struct ::wl_resource *, uint32_t , uint32_t )
- {
- }
-
- void wl_shell_surface::shell_surface_set_toplevel(Resource *)
- {
- }
-
- void wl_shell_surface::shell_surface_set_transient(Resource *, struct ::wl_resource *, int32_t , int32_t , uint32_t )
- {
- }
-
- void wl_shell_surface::shell_surface_set_fullscreen(Resource *, uint32_t , uint32_t , struct ::wl_resource *)
- {
- }
-
- void wl_shell_surface::shell_surface_set_popup(Resource *, struct ::wl_resource *, uint32_t , struct ::wl_resource *, int32_t , int32_t , uint32_t )
- {
- }
-
- void wl_shell_surface::shell_surface_set_maximized(Resource *, struct ::wl_resource *)
- {
- }
-
- void wl_shell_surface::shell_surface_set_title(Resource *, const std::string &)
- {
- }
-
- void wl_shell_surface::shell_surface_set_class(Resource *, const std::string &)
- {
- }
-
-
- void wl_shell_surface::handle_pong(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_pong(
- r,
- serial);
- }
-
- void wl_shell_surface::handle_move(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_move(
- r,
- seat,
- serial);
- }
-
- void wl_shell_surface::handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- uint32_t edges)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_resize(
- r,
- seat,
- serial,
- edges);
- }
-
- void wl_shell_surface::handle_set_toplevel(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_set_toplevel(
- r);
- }
-
- void wl_shell_surface::handle_set_transient(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *parent,
- int32_t x,
- int32_t y,
- uint32_t flags)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_set_transient(
- r,
- parent,
- x,
- y,
- flags);
- }
-
- void wl_shell_surface::handle_set_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t method,
- uint32_t framerate,
- struct ::wl_resource *output)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_set_fullscreen(
- r,
- method,
- framerate,
- output);
- }
-
- void wl_shell_surface::handle_set_popup(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- struct ::wl_resource *parent,
- int32_t x,
- int32_t y,
- uint32_t flags)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_set_popup(
- r,
- seat,
- serial,
- parent,
- x,
- y,
- flags);
- }
-
- void wl_shell_surface::handle_set_maximized(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_set_maximized(
- r,
- output);
- }
-
- void wl_shell_surface::handle_set_title(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *title)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_set_title(
- r,
- std::string(title));
- }
-
- void wl_shell_surface::handle_set_class(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *class_)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_shell_surface *>(r->shell_surface_object)->shell_surface_set_class(
- r,
- std::string(class_));
- }
-
- void wl_shell_surface::send_ping(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "wl_shell_surface::ping", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_shell_surface::ping as it's not initialised");
- return;
- }
- send_ping(
- m_resource->handle,
- serial);
- }
-
- void wl_shell_surface::send_ping(struct ::wl_resource *resource, uint32_t serial)
- {
- wl_shell_surface_send_ping(
- resource,
- serial);
- }
-
-
- void wl_shell_surface::send_configure(uint32_t edges, int32_t width, int32_t height)
- {
- DS_ASSERT_X(m_resource, "wl_shell_surface::configure", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_shell_surface::configure as it's not initialised");
- return;
- }
- send_configure(
- m_resource->handle,
- edges,
- width,
- height);
- }
-
- void wl_shell_surface::send_configure(struct ::wl_resource *resource, uint32_t edges, int32_t width, int32_t height)
- {
- wl_shell_surface_send_configure(
- resource,
- edges,
- width,
- height);
- }
-
-
- void wl_shell_surface::send_popup_done()
- {
- DS_ASSERT_X(m_resource, "wl_shell_surface::popup_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_shell_surface::popup_done as it's not initialised");
- return;
- }
- send_popup_done(
- m_resource->handle);
- }
-
- void wl_shell_surface::send_popup_done(struct ::wl_resource *resource)
- {
- wl_shell_surface_send_popup_done(
- resource);
- }
-
-
- wl_surface::wl_surface(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_surface::wl_surface(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_surface::wl_surface(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_surface::wl_surface()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_surface::~wl_surface()
- {
- std::multimap<struct ::wl_client*, wl_surface::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_surface::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_surface::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_surface::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_surface::Resource *wl_surface::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_surface::Resource *wl_surface::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_surface::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_surface_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_surface::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_surface::interface()
- {
- return &::wl_surface_interface;
- }
-
- wl_surface::Resource *wl_surface::surface_allocate()
- {
- return new Resource;
- }
-
- void wl_surface::surface_bind_resource(Resource *)
- {
- }
-
- void wl_surface::surface_destroy_resource(Resource *)
- {
- }
-
- void wl_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_surface *that = static_cast<wl_surface *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_surface::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_surface *that = static_cast<wl_surface::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_surface::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_surface *that = resource->surface_object;
- that->m_resource_map.erase(resource->client());
- that->surface_destroy_resource(resource);
- delete resource;
- }
-
- wl_surface::Resource *wl_surface::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_surface_interface, version, id);
- return bind(handle);
- }
-
- wl_surface::Resource *wl_surface::bind(struct ::wl_resource *handle)
- {
- Resource *resource = surface_allocate();
- resource->surface_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_surface_interface, resource, destroy_func);
- resource->handle = handle;
- surface_bind_resource(resource);
- return resource;
- }
- wl_surface::Resource *wl_surface::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_surface_interface, &m_wl_surface_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_surface_interface wl_surface::m_wl_surface_interface = {
- wl_surface::handle_destroy,
- wl_surface::handle_attach,
- wl_surface::handle_damage,
- wl_surface::handle_frame,
- wl_surface::handle_set_opaque_region,
- wl_surface::handle_set_input_region,
- wl_surface::handle_commit,
- wl_surface::handle_set_buffer_transform,
- wl_surface::handle_set_buffer_scale,
- wl_surface::handle_damage_buffer
- };
-
- void wl_surface::surface_destroy(Resource *)
- {
- }
-
- void wl_surface::surface_attach(Resource *, struct ::wl_resource *, int32_t , int32_t )
- {
- }
-
- void wl_surface::surface_damage(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void wl_surface::surface_frame(Resource *, uint32_t)
- {
- }
-
- void wl_surface::surface_set_opaque_region(Resource *, struct ::wl_resource *)
- {
- }
-
- void wl_surface::surface_set_input_region(Resource *, struct ::wl_resource *)
- {
- }
-
- void wl_surface::surface_commit(Resource *)
- {
- }
-
- void wl_surface::surface_set_buffer_transform(Resource *, int32_t )
- {
- }
-
- void wl_surface::surface_set_buffer_scale(Resource *, int32_t )
- {
- }
-
- void wl_surface::surface_damage_buffer(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
-
- void wl_surface::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_destroy(
- r);
- }
-
- void wl_surface::handle_attach(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *buffer,
- int32_t x,
- int32_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_attach(
- r,
- buffer,
- x,
- y);
- }
-
- void wl_surface::handle_damage(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_damage(
- r,
- x,
- y,
- width,
- height);
- }
-
- void wl_surface::handle_frame(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t callback)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_frame(
- r,
- callback);
- }
-
- void wl_surface::handle_set_opaque_region(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *region)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_set_opaque_region(
- r,
- region);
- }
-
- void wl_surface::handle_set_input_region(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *region)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_set_input_region(
- r,
- region);
- }
-
- void wl_surface::handle_commit(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_commit(
- r);
- }
-
- void wl_surface::handle_set_buffer_transform(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t transform)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_set_buffer_transform(
- r,
- transform);
- }
-
- void wl_surface::handle_set_buffer_scale(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t scale)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_set_buffer_scale(
- r,
- scale);
- }
-
- void wl_surface::handle_damage_buffer(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_surface *>(r->surface_object)->surface_damage_buffer(
- r,
- x,
- y,
- width,
- height);
- }
-
- void wl_surface::send_enter(struct ::wl_resource *output)
- {
- DS_ASSERT_X(m_resource, "wl_surface::enter", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_surface::enter as it's not initialised");
- return;
- }
- send_enter(
- m_resource->handle,
- output);
- }
-
- void wl_surface::send_enter(struct ::wl_resource *resource, struct ::wl_resource *output)
- {
- wl_surface_send_enter(
- resource,
- output);
- }
-
-
- void wl_surface::send_leave(struct ::wl_resource *output)
- {
- DS_ASSERT_X(m_resource, "wl_surface::leave", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_surface::leave as it's not initialised");
- return;
- }
- send_leave(
- m_resource->handle,
- output);
- }
-
- void wl_surface::send_leave(struct ::wl_resource *resource, struct ::wl_resource *output)
- {
- wl_surface_send_leave(
- resource,
- output);
- }
-
-
- wl_seat::wl_seat(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_seat::wl_seat(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_seat::wl_seat(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_seat::wl_seat()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_seat::~wl_seat()
- {
- std::multimap<struct ::wl_client*, wl_seat::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_seat::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_seat::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_seat::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_seat::Resource *wl_seat::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_seat::Resource *wl_seat::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_seat::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_seat_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_seat::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_seat::interface()
- {
- return &::wl_seat_interface;
- }
-
- wl_seat::Resource *wl_seat::seat_allocate()
- {
- return new Resource;
- }
-
- void wl_seat::seat_bind_resource(Resource *)
- {
- }
-
- void wl_seat::seat_destroy_resource(Resource *)
- {
- }
-
- void wl_seat::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_seat *that = static_cast<wl_seat *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_seat::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_seat *that = static_cast<wl_seat::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_seat::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_seat *that = resource->seat_object;
- that->m_resource_map.erase(resource->client());
- that->seat_destroy_resource(resource);
- delete resource;
- }
-
- wl_seat::Resource *wl_seat::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_seat_interface, version, id);
- return bind(handle);
- }
-
- wl_seat::Resource *wl_seat::bind(struct ::wl_resource *handle)
- {
- Resource *resource = seat_allocate();
- resource->seat_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_seat_interface, resource, destroy_func);
- resource->handle = handle;
- seat_bind_resource(resource);
- return resource;
- }
- wl_seat::Resource *wl_seat::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_seat_interface, &m_wl_seat_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_seat_interface wl_seat::m_wl_seat_interface = {
- wl_seat::handle_get_pointer,
- wl_seat::handle_get_keyboard,
- wl_seat::handle_get_touch,
- wl_seat::handle_release
- };
-
- void wl_seat::seat_get_pointer(Resource *, uint32_t)
- {
- }
-
- void wl_seat::seat_get_keyboard(Resource *, uint32_t)
- {
- }
-
- void wl_seat::seat_get_touch(Resource *, uint32_t)
- {
- }
-
- void wl_seat::seat_release(Resource *)
- {
- }
-
-
- void wl_seat::handle_get_pointer(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_seat *>(r->seat_object)->seat_get_pointer(
- r,
- id);
- }
-
- void wl_seat::handle_get_keyboard(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_seat *>(r->seat_object)->seat_get_keyboard(
- r,
- id);
- }
-
- void wl_seat::handle_get_touch(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_seat *>(r->seat_object)->seat_get_touch(
- r,
- id);
- }
-
- void wl_seat::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_seat *>(r->seat_object)->seat_release(
- r);
- }
-
- void wl_seat::send_capabilities(uint32_t capabilities)
- {
- DS_ASSERT_X(m_resource, "wl_seat::capabilities", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_seat::capabilities as it's not initialised");
- return;
- }
- send_capabilities(
- m_resource->handle,
- capabilities);
- }
-
- void wl_seat::send_capabilities(struct ::wl_resource *resource, uint32_t capabilities)
- {
- wl_seat_send_capabilities(
- resource,
- capabilities);
- }
-
-
- void wl_seat::send_name(const std::string &name)
- {
- DS_ASSERT_X(m_resource, "wl_seat::name", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_seat::name as it's not initialised");
- return;
- }
- send_name(
- m_resource->handle,
- name);
- }
-
- void wl_seat::send_name(struct ::wl_resource *resource, const std::string &name)
- {
- wl_seat_send_name(
- resource,
- name.c_str());
- }
-
-
- wl_pointer::wl_pointer(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_pointer::wl_pointer(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_pointer::wl_pointer(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_pointer::wl_pointer()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_pointer::~wl_pointer()
- {
- std::multimap<struct ::wl_client*, wl_pointer::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_pointer::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_pointer::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_pointer::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_pointer::Resource *wl_pointer::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_pointer::Resource *wl_pointer::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_pointer::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_pointer_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_pointer::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_pointer::interface()
- {
- return &::wl_pointer_interface;
- }
-
- wl_pointer::Resource *wl_pointer::pointer_allocate()
- {
- return new Resource;
- }
-
- void wl_pointer::pointer_bind_resource(Resource *)
- {
- }
-
- void wl_pointer::pointer_destroy_resource(Resource *)
- {
- }
-
- void wl_pointer::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_pointer *that = static_cast<wl_pointer *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_pointer::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_pointer *that = static_cast<wl_pointer::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_pointer::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_pointer *that = resource->pointer_object;
- that->m_resource_map.erase(resource->client());
- that->pointer_destroy_resource(resource);
- delete resource;
- }
-
- wl_pointer::Resource *wl_pointer::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_pointer_interface, version, id);
- return bind(handle);
- }
-
- wl_pointer::Resource *wl_pointer::bind(struct ::wl_resource *handle)
- {
- Resource *resource = pointer_allocate();
- resource->pointer_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_pointer_interface, resource, destroy_func);
- resource->handle = handle;
- pointer_bind_resource(resource);
- return resource;
- }
- wl_pointer::Resource *wl_pointer::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_pointer_interface, &m_wl_pointer_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_pointer_interface wl_pointer::m_wl_pointer_interface = {
- wl_pointer::handle_set_cursor,
- wl_pointer::handle_release
- };
-
- void wl_pointer::pointer_set_cursor(Resource *, uint32_t , struct ::wl_resource *, int32_t , int32_t )
- {
- }
-
- void wl_pointer::pointer_release(Resource *)
- {
- }
-
-
- void wl_pointer::handle_set_cursor(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- struct ::wl_resource *surface,
- int32_t hotspot_x,
- int32_t hotspot_y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_pointer *>(r->pointer_object)->pointer_set_cursor(
- r,
- serial,
- surface,
- hotspot_x,
- hotspot_y);
- }
-
- void wl_pointer::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_pointer *>(r->pointer_object)->pointer_release(
- r);
- }
-
- void wl_pointer::send_enter(uint32_t serial, struct ::wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y)
- {
- DS_ASSERT_X(m_resource, "wl_pointer::enter", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::enter as it's not initialised");
- return;
- }
- send_enter(
- m_resource->handle,
- serial,
- surface,
- surface_x,
- surface_y);
- }
-
- void wl_pointer::send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y)
- {
- wl_pointer_send_enter(
- resource,
- serial,
- surface,
- surface_x,
- surface_y);
- }
-
-
- void wl_pointer::send_leave(uint32_t serial, struct ::wl_resource *surface)
- {
- DS_ASSERT_X(m_resource, "wl_pointer::leave", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::leave as it's not initialised");
- return;
- }
- send_leave(
- m_resource->handle,
- serial,
- surface);
- }
-
- void wl_pointer::send_leave(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface)
- {
- wl_pointer_send_leave(
- resource,
- serial,
- surface);
- }
-
-
- void wl_pointer::send_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)
- {
- DS_ASSERT_X(m_resource, "wl_pointer::motion", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::motion as it's not initialised");
- return;
- }
- send_motion(
- m_resource->handle,
- time,
- surface_x,
- surface_y);
- }
-
- void wl_pointer::send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)
- {
- wl_pointer_send_motion(
- resource,
- time,
- surface_x,
- surface_y);
- }
-
-
- void wl_pointer::send_button(uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
- {
- DS_ASSERT_X(m_resource, "wl_pointer::button", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::button as it's not initialised");
- return;
- }
- send_button(
- m_resource->handle,
- serial,
- time,
- button,
- state);
- }
-
- void wl_pointer::send_button(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
- {
- wl_pointer_send_button(
- resource,
- serial,
- time,
- button,
- state);
- }
-
-
- void wl_pointer::send_axis(uint32_t time, uint32_t axis, wl_fixed_t value)
- {
- DS_ASSERT_X(m_resource, "wl_pointer::axis", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::axis as it's not initialised");
- return;
- }
- send_axis(
- m_resource->handle,
- time,
- axis,
- value);
- }
-
- void wl_pointer::send_axis(struct ::wl_resource *resource, uint32_t time, uint32_t axis, wl_fixed_t value)
- {
- wl_pointer_send_axis(
- resource,
- time,
- axis,
- value);
- }
-
-
- void wl_pointer::send_frame()
- {
- DS_ASSERT_X(m_resource, "wl_pointer::frame", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::frame as it's not initialised");
- return;
- }
- send_frame(
- m_resource->handle);
- }
-
- void wl_pointer::send_frame(struct ::wl_resource *resource)
- {
- wl_pointer_send_frame(
- resource);
- }
-
-
- void wl_pointer::send_axis_source(uint32_t axis_source)
- {
- DS_ASSERT_X(m_resource, "wl_pointer::axis_source", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::axis_source as it's not initialised");
- return;
- }
- send_axis_source(
- m_resource->handle,
- axis_source);
- }
-
- void wl_pointer::send_axis_source(struct ::wl_resource *resource, uint32_t axis_source)
- {
- wl_pointer_send_axis_source(
- resource,
- axis_source);
- }
-
-
- void wl_pointer::send_axis_stop(uint32_t time, uint32_t axis)
- {
- DS_ASSERT_X(m_resource, "wl_pointer::axis_stop", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::axis_stop as it's not initialised");
- return;
- }
- send_axis_stop(
- m_resource->handle,
- time,
- axis);
- }
-
- void wl_pointer::send_axis_stop(struct ::wl_resource *resource, uint32_t time, uint32_t axis)
- {
- wl_pointer_send_axis_stop(
- resource,
- time,
- axis);
- }
-
-
- void wl_pointer::send_axis_discrete(uint32_t axis, int32_t discrete)
- {
- DS_ASSERT_X(m_resource, "wl_pointer::axis_discrete", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_pointer::axis_discrete as it's not initialised");
- return;
- }
- send_axis_discrete(
- m_resource->handle,
- axis,
- discrete);
- }
-
- void wl_pointer::send_axis_discrete(struct ::wl_resource *resource, uint32_t axis, int32_t discrete)
- {
- wl_pointer_send_axis_discrete(
- resource,
- axis,
- discrete);
- }
-
-
- wl_keyboard::wl_keyboard(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_keyboard::wl_keyboard(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_keyboard::wl_keyboard(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_keyboard::wl_keyboard()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_keyboard::~wl_keyboard()
- {
- std::multimap<struct ::wl_client*, wl_keyboard::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_keyboard::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_keyboard::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_keyboard::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_keyboard::Resource *wl_keyboard::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_keyboard::Resource *wl_keyboard::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_keyboard::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_keyboard_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_keyboard::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_keyboard::interface()
- {
- return &::wl_keyboard_interface;
- }
-
- wl_keyboard::Resource *wl_keyboard::keyboard_allocate()
- {
- return new Resource;
- }
-
- void wl_keyboard::keyboard_bind_resource(Resource *)
- {
- }
-
- void wl_keyboard::keyboard_destroy_resource(Resource *)
- {
- }
-
- void wl_keyboard::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_keyboard *that = static_cast<wl_keyboard *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_keyboard::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_keyboard *that = static_cast<wl_keyboard::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_keyboard::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_keyboard *that = resource->keyboard_object;
- that->m_resource_map.erase(resource->client());
- that->keyboard_destroy_resource(resource);
- delete resource;
- }
-
- wl_keyboard::Resource *wl_keyboard::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_keyboard_interface, version, id);
- return bind(handle);
- }
-
- wl_keyboard::Resource *wl_keyboard::bind(struct ::wl_resource *handle)
- {
- Resource *resource = keyboard_allocate();
- resource->keyboard_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_keyboard_interface, resource, destroy_func);
- resource->handle = handle;
- keyboard_bind_resource(resource);
- return resource;
- }
- wl_keyboard::Resource *wl_keyboard::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_keyboard_interface, &m_wl_keyboard_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_keyboard_interface wl_keyboard::m_wl_keyboard_interface = {
- wl_keyboard::handle_release
- };
-
- void wl_keyboard::keyboard_release(Resource *)
- {
- }
-
-
- void wl_keyboard::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_keyboard *>(r->keyboard_object)->keyboard_release(
- r);
- }
-
- void wl_keyboard::send_keymap(uint32_t format, int32_t fd, uint32_t size)
- {
- DS_ASSERT_X(m_resource, "wl_keyboard::keymap", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_keyboard::keymap as it's not initialised");
- return;
- }
- send_keymap(
- m_resource->handle,
- format,
- fd,
- size);
- }
-
- void wl_keyboard::send_keymap(struct ::wl_resource *resource, uint32_t format, int32_t fd, uint32_t size)
- {
- wl_keyboard_send_keymap(
- resource,
- format,
- fd,
- size);
- }
-
-
- void wl_keyboard::send_enter(uint32_t serial, struct ::wl_resource *surface, struct ::wl_array *keys)
- {
- DS_ASSERT_X(m_resource, "wl_keyboard::enter", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_keyboard::enter as it's not initialised");
- return;
- }
- send_enter(
- m_resource->handle,
- serial,
- surface,
- keys);
- }
-
- void wl_keyboard::send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, struct ::wl_array *keys)
- {
- wl_keyboard_send_enter(
- resource,
- serial,
- surface,
- keys);
- }
-
-
- void wl_keyboard::send_leave(uint32_t serial, struct ::wl_resource *surface)
- {
- DS_ASSERT_X(m_resource, "wl_keyboard::leave", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_keyboard::leave as it's not initialised");
- return;
- }
- send_leave(
- m_resource->handle,
- serial,
- surface);
- }
-
- void wl_keyboard::send_leave(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface)
- {
- wl_keyboard_send_leave(
- resource,
- serial,
- surface);
- }
-
-
- void wl_keyboard::send_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
- {
- DS_ASSERT_X(m_resource, "wl_keyboard::key", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_keyboard::key as it's not initialised");
- return;
- }
- send_key(
- m_resource->handle,
- serial,
- time,
- key,
- state);
- }
-
- void wl_keyboard::send_key(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
- {
- wl_keyboard_send_key(
- resource,
- serial,
- time,
- key,
- state);
- }
-
-
- void wl_keyboard::send_modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
- {
- DS_ASSERT_X(m_resource, "wl_keyboard::modifiers", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_keyboard::modifiers as it's not initialised");
- return;
- }
- send_modifiers(
- m_resource->handle,
- serial,
- mods_depressed,
- mods_latched,
- mods_locked,
- group);
- }
-
- void wl_keyboard::send_modifiers(struct ::wl_resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
- {
- wl_keyboard_send_modifiers(
- resource,
- serial,
- mods_depressed,
- mods_latched,
- mods_locked,
- group);
- }
-
-
- void wl_keyboard::send_repeat_info(int32_t rate, int32_t delay)
- {
- DS_ASSERT_X(m_resource, "wl_keyboard::repeat_info", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_keyboard::repeat_info as it's not initialised");
- return;
- }
- send_repeat_info(
- m_resource->handle,
- rate,
- delay);
- }
-
- void wl_keyboard::send_repeat_info(struct ::wl_resource *resource, int32_t rate, int32_t delay)
- {
- wl_keyboard_send_repeat_info(
- resource,
- rate,
- delay);
- }
-
-
- wl_touch::wl_touch(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_touch::wl_touch(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_touch::wl_touch(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_touch::wl_touch()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_touch::~wl_touch()
- {
- std::multimap<struct ::wl_client*, wl_touch::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_touch::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_touch::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_touch::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_touch::Resource *wl_touch::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_touch::Resource *wl_touch::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_touch::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_touch_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_touch::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_touch::interface()
- {
- return &::wl_touch_interface;
- }
-
- wl_touch::Resource *wl_touch::touch_allocate()
- {
- return new Resource;
- }
-
- void wl_touch::touch_bind_resource(Resource *)
- {
- }
-
- void wl_touch::touch_destroy_resource(Resource *)
- {
- }
-
- void wl_touch::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_touch *that = static_cast<wl_touch *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_touch::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_touch *that = static_cast<wl_touch::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_touch::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_touch *that = resource->touch_object;
- that->m_resource_map.erase(resource->client());
- that->touch_destroy_resource(resource);
- delete resource;
- }
-
- wl_touch::Resource *wl_touch::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_touch_interface, version, id);
- return bind(handle);
- }
-
- wl_touch::Resource *wl_touch::bind(struct ::wl_resource *handle)
- {
- Resource *resource = touch_allocate();
- resource->touch_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_touch_interface, resource, destroy_func);
- resource->handle = handle;
- touch_bind_resource(resource);
- return resource;
- }
- wl_touch::Resource *wl_touch::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_touch_interface, &m_wl_touch_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_touch_interface wl_touch::m_wl_touch_interface = {
- wl_touch::handle_release
- };
-
- void wl_touch::touch_release(Resource *)
- {
- }
-
-
- void wl_touch::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_touch *>(r->touch_object)->touch_release(
- r);
- }
-
- void wl_touch::send_down(uint32_t serial, uint32_t time, struct ::wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y)
- {
- DS_ASSERT_X(m_resource, "wl_touch::down", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_touch::down as it's not initialised");
- return;
- }
- send_down(
- m_resource->handle,
- serial,
- time,
- surface,
- id,
- x,
- y);
- }
-
- void wl_touch::send_down(struct ::wl_resource *resource, uint32_t serial, uint32_t time, struct ::wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y)
- {
- wl_touch_send_down(
- resource,
- serial,
- time,
- surface,
- id,
- x,
- y);
- }
-
-
- void wl_touch::send_up(uint32_t serial, uint32_t time, int32_t id)
- {
- DS_ASSERT_X(m_resource, "wl_touch::up", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_touch::up as it's not initialised");
- return;
- }
- send_up(
- m_resource->handle,
- serial,
- time,
- id);
- }
-
- void wl_touch::send_up(struct ::wl_resource *resource, uint32_t serial, uint32_t time, int32_t id)
- {
- wl_touch_send_up(
- resource,
- serial,
- time,
- id);
- }
-
-
- void wl_touch::send_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y)
- {
- DS_ASSERT_X(m_resource, "wl_touch::motion", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_touch::motion as it's not initialised");
- return;
- }
- send_motion(
- m_resource->handle,
- time,
- id,
- x,
- y);
- }
-
- void wl_touch::send_motion(struct ::wl_resource *resource, uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y)
- {
- wl_touch_send_motion(
- resource,
- time,
- id,
- x,
- y);
- }
-
-
- void wl_touch::send_frame()
- {
- DS_ASSERT_X(m_resource, "wl_touch::frame", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_touch::frame as it's not initialised");
- return;
- }
- send_frame(
- m_resource->handle);
- }
-
- void wl_touch::send_frame(struct ::wl_resource *resource)
- {
- wl_touch_send_frame(
- resource);
- }
-
-
- void wl_touch::send_cancel()
- {
- DS_ASSERT_X(m_resource, "wl_touch::cancel", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_touch::cancel as it's not initialised");
- return;
- }
- send_cancel(
- m_resource->handle);
- }
-
- void wl_touch::send_cancel(struct ::wl_resource *resource)
- {
- wl_touch_send_cancel(
- resource);
- }
-
-
- void wl_touch::send_shape(int32_t id, wl_fixed_t major, wl_fixed_t minor)
- {
- DS_ASSERT_X(m_resource, "wl_touch::shape", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_touch::shape as it's not initialised");
- return;
- }
- send_shape(
- m_resource->handle,
- id,
- major,
- minor);
- }
-
- void wl_touch::send_shape(struct ::wl_resource *resource, int32_t id, wl_fixed_t major, wl_fixed_t minor)
- {
- wl_touch_send_shape(
- resource,
- id,
- major,
- minor);
- }
-
-
- void wl_touch::send_orientation(int32_t id, wl_fixed_t orientation)
- {
- DS_ASSERT_X(m_resource, "wl_touch::orientation", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_touch::orientation as it's not initialised");
- return;
- }
- send_orientation(
- m_resource->handle,
- id,
- orientation);
- }
-
- void wl_touch::send_orientation(struct ::wl_resource *resource, int32_t id, wl_fixed_t orientation)
- {
- wl_touch_send_orientation(
- resource,
- id,
- orientation);
- }
-
-
- wl_output::wl_output(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_output::wl_output(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_output::wl_output(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_output::wl_output()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_output::~wl_output()
- {
- std::multimap<struct ::wl_client*, wl_output::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_output::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_output::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_output::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_output::Resource *wl_output::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_output::Resource *wl_output::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_output::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_output_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_output::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_output::interface()
- {
- return &::wl_output_interface;
- }
-
- wl_output::Resource *wl_output::output_allocate()
- {
- return new Resource;
- }
-
- void wl_output::output_bind_resource(Resource *)
- {
- }
-
- void wl_output::output_destroy_resource(Resource *)
- {
- }
-
- void wl_output::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_output *that = static_cast<wl_output *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_output::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_output *that = static_cast<wl_output::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_output::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_output *that = resource->output_object;
- that->m_resource_map.erase(resource->client());
- that->output_destroy_resource(resource);
- delete resource;
- }
-
- wl_output::Resource *wl_output::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_output_interface, version, id);
- return bind(handle);
- }
-
- wl_output::Resource *wl_output::bind(struct ::wl_resource *handle)
- {
- Resource *resource = output_allocate();
- resource->output_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_output_interface, resource, destroy_func);
- resource->handle = handle;
- output_bind_resource(resource);
- return resource;
- }
- wl_output::Resource *wl_output::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_output_interface, &m_wl_output_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_output_interface wl_output::m_wl_output_interface = {
- wl_output::handle_release
- };
-
- void wl_output::output_release(Resource *)
- {
- }
-
-
- void wl_output::handle_release(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_output *>(r->output_object)->output_release(
- r);
- }
-
- void wl_output::send_geometry(int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const std::string &make, const std::string &model, int32_t transform)
- {
- DS_ASSERT_X(m_resource, "wl_output::geometry", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_output::geometry as it's not initialised");
- return;
- }
- send_geometry(
- m_resource->handle,
- x,
- y,
- physical_width,
- physical_height,
- subpixel,
- make,
- model,
- transform);
- }
-
- void wl_output::send_geometry(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const std::string &make, const std::string &model, int32_t transform)
- {
- wl_output_send_geometry(
- resource,
- x,
- y,
- physical_width,
- physical_height,
- subpixel,
- make.c_str(),
- model.c_str(),
- transform);
- }
-
-
- void wl_output::send_mode(uint32_t flags, int32_t width, int32_t height, int32_t refresh)
- {
- DS_ASSERT_X(m_resource, "wl_output::mode", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_output::mode as it's not initialised");
- return;
- }
- send_mode(
- m_resource->handle,
- flags,
- width,
- height,
- refresh);
- }
-
- void wl_output::send_mode(struct ::wl_resource *resource, uint32_t flags, int32_t width, int32_t height, int32_t refresh)
- {
- wl_output_send_mode(
- resource,
- flags,
- width,
- height,
- refresh);
- }
-
-
- void wl_output::send_done()
- {
- DS_ASSERT_X(m_resource, "wl_output::done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_output::done as it's not initialised");
- return;
- }
- send_done(
- m_resource->handle);
- }
-
- void wl_output::send_done(struct ::wl_resource *resource)
- {
- wl_output_send_done(
- resource);
- }
-
-
- void wl_output::send_scale(int32_t factor)
- {
- DS_ASSERT_X(m_resource, "wl_output::scale", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call wl_output::scale as it's not initialised");
- return;
- }
- send_scale(
- m_resource->handle,
- factor);
- }
-
- void wl_output::send_scale(struct ::wl_resource *resource, int32_t factor)
- {
- wl_output_send_scale(
- resource,
- factor);
- }
-
-
- wl_region::wl_region(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_region::wl_region(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_region::wl_region(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_region::wl_region()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_region::~wl_region()
- {
- std::multimap<struct ::wl_client*, wl_region::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_region::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_region::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_region::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_region::Resource *wl_region::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_region::Resource *wl_region::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_region::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_region_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_region::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_region::interface()
- {
- return &::wl_region_interface;
- }
-
- wl_region::Resource *wl_region::region_allocate()
- {
- return new Resource;
- }
-
- void wl_region::region_bind_resource(Resource *)
- {
- }
-
- void wl_region::region_destroy_resource(Resource *)
- {
- }
-
- void wl_region::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_region *that = static_cast<wl_region *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_region::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_region *that = static_cast<wl_region::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_region::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_region *that = resource->region_object;
- that->m_resource_map.erase(resource->client());
- that->region_destroy_resource(resource);
- delete resource;
- }
-
- wl_region::Resource *wl_region::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_region_interface, version, id);
- return bind(handle);
- }
-
- wl_region::Resource *wl_region::bind(struct ::wl_resource *handle)
- {
- Resource *resource = region_allocate();
- resource->region_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_region_interface, resource, destroy_func);
- resource->handle = handle;
- region_bind_resource(resource);
- return resource;
- }
- wl_region::Resource *wl_region::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_region_interface, &m_wl_region_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_region_interface wl_region::m_wl_region_interface = {
- wl_region::handle_destroy,
- wl_region::handle_add,
- wl_region::handle_subtract
- };
-
- void wl_region::region_destroy(Resource *)
- {
- }
-
- void wl_region::region_add(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void wl_region::region_subtract(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
-
- void wl_region::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_region *>(r->region_object)->region_destroy(
- r);
- }
-
- void wl_region::handle_add(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_region *>(r->region_object)->region_add(
- r,
- x,
- y,
- width,
- height);
- }
-
- void wl_region::handle_subtract(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_region *>(r->region_object)->region_subtract(
- r,
- x,
- y,
- width,
- height);
- }
-
- wl_subcompositor::wl_subcompositor(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_subcompositor::wl_subcompositor(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_subcompositor::wl_subcompositor(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_subcompositor::wl_subcompositor()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_subcompositor::~wl_subcompositor()
- {
- std::multimap<struct ::wl_client*, wl_subcompositor::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_subcompositor::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_subcompositor::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_subcompositor::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_subcompositor::Resource *wl_subcompositor::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_subcompositor::Resource *wl_subcompositor::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_subcompositor::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_subcompositor_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_subcompositor::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_subcompositor::interface()
- {
- return &::wl_subcompositor_interface;
- }
-
- wl_subcompositor::Resource *wl_subcompositor::subcompositor_allocate()
- {
- return new Resource;
- }
-
- void wl_subcompositor::subcompositor_bind_resource(Resource *)
- {
- }
-
- void wl_subcompositor::subcompositor_destroy_resource(Resource *)
- {
- }
-
- void wl_subcompositor::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_subcompositor *that = static_cast<wl_subcompositor *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_subcompositor::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_subcompositor *that = static_cast<wl_subcompositor::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_subcompositor::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_subcompositor *that = resource->subcompositor_object;
- that->m_resource_map.erase(resource->client());
- that->subcompositor_destroy_resource(resource);
- delete resource;
- }
-
- wl_subcompositor::Resource *wl_subcompositor::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_subcompositor_interface, version, id);
- return bind(handle);
- }
-
- wl_subcompositor::Resource *wl_subcompositor::bind(struct ::wl_resource *handle)
- {
- Resource *resource = subcompositor_allocate();
- resource->subcompositor_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_subcompositor_interface, resource, destroy_func);
- resource->handle = handle;
- subcompositor_bind_resource(resource);
- return resource;
- }
- wl_subcompositor::Resource *wl_subcompositor::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_subcompositor_interface, &m_wl_subcompositor_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_subcompositor_interface wl_subcompositor::m_wl_subcompositor_interface = {
- wl_subcompositor::handle_destroy,
- wl_subcompositor::handle_get_subsurface
- };
-
- void wl_subcompositor::subcompositor_destroy(Resource *)
- {
- }
-
- void wl_subcompositor::subcompositor_get_subsurface(Resource *, uint32_t, struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
-
- void wl_subcompositor::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_subcompositor *>(r->subcompositor_object)->subcompositor_destroy(
- r);
- }
-
- void wl_subcompositor::handle_get_subsurface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface,
- struct ::wl_resource *parent)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_subcompositor *>(r->subcompositor_object)->subcompositor_get_subsurface(
- r,
- id,
- surface,
- parent);
- }
-
- wl_subsurface::wl_subsurface(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- wl_subsurface::wl_subsurface(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- wl_subsurface::wl_subsurface(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- wl_subsurface::wl_subsurface()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- wl_subsurface::~wl_subsurface()
- {
- std::multimap<struct ::wl_client*, wl_subsurface::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- wl_subsurface::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void wl_subsurface::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void wl_subsurface::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- wl_subsurface::Resource *wl_subsurface::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- wl_subsurface::Resource *wl_subsurface::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void wl_subsurface::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::wl_subsurface_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = wl_subsurface::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *wl_subsurface::interface()
- {
- return &::wl_subsurface_interface;
- }
-
- wl_subsurface::Resource *wl_subsurface::subsurface_allocate()
- {
- return new Resource;
- }
-
- void wl_subsurface::subsurface_bind_resource(Resource *)
- {
- }
-
- void wl_subsurface::subsurface_destroy_resource(Resource *)
- {
- }
-
- void wl_subsurface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- wl_subsurface *that = static_cast<wl_subsurface *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void wl_subsurface::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- wl_subsurface *that = static_cast<wl_subsurface::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void wl_subsurface::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- wl_subsurface *that = resource->subsurface_object;
- that->m_resource_map.erase(resource->client());
- that->subsurface_destroy_resource(resource);
- delete resource;
- }
-
- wl_subsurface::Resource *wl_subsurface::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::wl_subsurface_interface, version, id);
- return bind(handle);
- }
-
- wl_subsurface::Resource *wl_subsurface::bind(struct ::wl_resource *handle)
- {
- Resource *resource = subsurface_allocate();
- resource->subsurface_object = this;
-
- wl_resource_set_implementation(handle, &m_wl_subsurface_interface, resource, destroy_func);
- resource->handle = handle;
- subsurface_bind_resource(resource);
- return resource;
- }
- wl_subsurface::Resource *wl_subsurface::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::wl_subsurface_interface, &m_wl_subsurface_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::wl_subsurface_interface wl_subsurface::m_wl_subsurface_interface = {
- wl_subsurface::handle_destroy,
- wl_subsurface::handle_set_position,
- wl_subsurface::handle_place_above,
- wl_subsurface::handle_place_below,
- wl_subsurface::handle_set_sync,
- wl_subsurface::handle_set_desync
- };
-
- void wl_subsurface::subsurface_destroy(Resource *)
- {
- }
-
- void wl_subsurface::subsurface_set_position(Resource *, int32_t , int32_t )
- {
- }
-
- void wl_subsurface::subsurface_place_above(Resource *, struct ::wl_resource *)
- {
- }
-
- void wl_subsurface::subsurface_place_below(Resource *, struct ::wl_resource *)
- {
- }
-
- void wl_subsurface::subsurface_set_sync(Resource *)
- {
- }
-
- void wl_subsurface::subsurface_set_desync(Resource *)
- {
- }
-
-
- void wl_subsurface::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_subsurface *>(r->subsurface_object)->subsurface_destroy(
- r);
- }
-
- void wl_subsurface::handle_set_position(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_subsurface *>(r->subsurface_object)->subsurface_set_position(
- r,
- x,
- y);
- }
-
- void wl_subsurface::handle_place_above(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *sibling)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_subsurface *>(r->subsurface_object)->subsurface_place_above(
- r,
- sibling);
- }
-
- void wl_subsurface::handle_place_below(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *sibling)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_subsurface *>(r->subsurface_object)->subsurface_place_below(
- r,
- sibling);
- }
-
- void wl_subsurface::handle_set_sync(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_subsurface *>(r->subsurface_object)->subsurface_set_sync(
- r);
- }
-
- void wl_subsurface::handle_set_desync(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<wl_subsurface *>(r->subsurface_object)->subsurface_set_desync(
- r);
- }
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland/wayland.xml */
-
-#ifndef __DS_WAYLAND_PROTOCOL_H__
-#define __DS_WAYLAND_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "wayland-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class wl_callback
- {
- public:
- wl_callback(struct ::wl_client *client, uint32_t id, int version);
- wl_callback(struct ::wl_display *display, int version);
- wl_callback(struct ::wl_resource *resource);
- wl_callback();
-
- virtual ~wl_callback();
-
- class Resource
- {
- public:
- Resource() : callback_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_callback *callback_object;
- wl_callback *object() { return callback_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_done(uint32_t callback_data);
- void send_done(struct ::wl_resource *resource, uint32_t callback_data);
-
- protected:
- virtual Resource *callback_allocate();
-
- virtual void callback_bind_resource(Resource *resource);
- virtual void callback_destroy_resource(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_callback *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_compositor
- {
- public:
- wl_compositor(struct ::wl_client *client, uint32_t id, int version);
- wl_compositor(struct ::wl_display *display, int version);
- wl_compositor(struct ::wl_resource *resource);
- wl_compositor();
-
- virtual ~wl_compositor();
-
- class Resource
- {
- public:
- Resource() : compositor_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_compositor *compositor_object;
- wl_compositor *object() { return compositor_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *compositor_allocate();
-
- virtual void compositor_bind_resource(Resource *resource);
- virtual void compositor_destroy_resource(Resource *resource);
-
- virtual void compositor_create_surface(Resource *resource, uint32_t id);
- virtual void compositor_create_region(Resource *resource, uint32_t id);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_compositor_interface m_wl_compositor_interface;
-
- static void handle_create_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_create_region(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_compositor *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_shm_pool
- {
- public:
- wl_shm_pool(struct ::wl_client *client, uint32_t id, int version);
- wl_shm_pool(struct ::wl_display *display, int version);
- wl_shm_pool(struct ::wl_resource *resource);
- wl_shm_pool();
-
- virtual ~wl_shm_pool();
-
- class Resource
- {
- public:
- Resource() : shm_pool_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_shm_pool *shm_pool_object;
- wl_shm_pool *object() { return shm_pool_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *shm_pool_allocate();
-
- virtual void shm_pool_bind_resource(Resource *resource);
- virtual void shm_pool_destroy_resource(Resource *resource);
-
- virtual void shm_pool_create_buffer(Resource *resource, uint32_t id, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format);
- virtual void shm_pool_destroy(Resource *resource);
- virtual void shm_pool_resize(Resource *resource, int32_t size);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_shm_pool_interface m_wl_shm_pool_interface;
-
- static void handle_create_buffer(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- int32_t offset,
- int32_t width,
- int32_t height,
- int32_t stride,
- uint32_t format);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t size);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_shm_pool *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_shm
- {
- public:
- wl_shm(struct ::wl_client *client, uint32_t id, int version);
- wl_shm(struct ::wl_display *display, int version);
- wl_shm(struct ::wl_resource *resource);
- wl_shm();
-
- virtual ~wl_shm();
-
- class Resource
- {
- public:
- Resource() : shm_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_shm *shm_object;
- wl_shm *object() { return shm_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_format = 0, // buffer format is not known
- error_invalid_stride = 1, // invalid size or stride during pool or buffer creation
- error_invalid_fd = 2, // mmapping the file descriptor failed
- };
-
- enum format {
- format_argb8888 = 0, // 32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian
- format_xrgb8888 = 1, // 32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian
- format_c8 = 0x20203843, // 8-bit color index format, [7:0] C
- format_rgb332 = 0x38424752, // 8-bit RGB format, [7:0] R:G:B 3:3:2
- format_bgr233 = 0x38524742, // 8-bit BGR format, [7:0] B:G:R 2:3:3
- format_xrgb4444 = 0x32315258, // 16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian
- format_xbgr4444 = 0x32314258, // 16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian
- format_rgbx4444 = 0x32315852, // 16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian
- format_bgrx4444 = 0x32315842, // 16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian
- format_argb4444 = 0x32315241, // 16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian
- format_abgr4444 = 0x32314241, // 16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian
- format_rgba4444 = 0x32314152, // 16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian
- format_bgra4444 = 0x32314142, // 16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian
- format_xrgb1555 = 0x35315258, // 16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian
- format_xbgr1555 = 0x35314258, // 16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian
- format_rgbx5551 = 0x35315852, // 16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian
- format_bgrx5551 = 0x35315842, // 16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian
- format_argb1555 = 0x35315241, // 16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian
- format_abgr1555 = 0x35314241, // 16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian
- format_rgba5551 = 0x35314152, // 16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian
- format_bgra5551 = 0x35314142, // 16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian
- format_rgb565 = 0x36314752, // 16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian
- format_bgr565 = 0x36314742, // 16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian
- format_rgb888 = 0x34324752, // 24-bit RGB format, [23:0] R:G:B little endian
- format_bgr888 = 0x34324742, // 24-bit BGR format, [23:0] B:G:R little endian
- format_xbgr8888 = 0x34324258, // 32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian
- format_rgbx8888 = 0x34325852, // 32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian
- format_bgrx8888 = 0x34325842, // 32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian
- format_abgr8888 = 0x34324241, // 32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian
- format_rgba8888 = 0x34324152, // 32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian
- format_bgra8888 = 0x34324142, // 32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian
- format_xrgb2101010 = 0x30335258, // 32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian
- format_xbgr2101010 = 0x30334258, // 32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian
- format_rgbx1010102 = 0x30335852, // 32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian
- format_bgrx1010102 = 0x30335842, // 32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian
- format_argb2101010 = 0x30335241, // 32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian
- format_abgr2101010 = 0x30334241, // 32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian
- format_rgba1010102 = 0x30334152, // 32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian
- format_bgra1010102 = 0x30334142, // 32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian
- format_yuyv = 0x56595559, // packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian
- format_yvyu = 0x55595659, // packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian
- format_uyvy = 0x59565955, // packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian
- format_vyuy = 0x59555956, // packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian
- format_ayuv = 0x56555941, // packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian
- format_nv12 = 0x3231564e, // 2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane
- format_nv21 = 0x3132564e, // 2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane
- format_nv16 = 0x3631564e, // 2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane
- format_nv61 = 0x3136564e, // 2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane
- format_yuv410 = 0x39565559, // 3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes
- format_yvu410 = 0x39555659, // 3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes
- format_yuv411 = 0x31315559, // 3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes
- format_yvu411 = 0x31315659, // 3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes
- format_yuv420 = 0x32315559, // 3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes
- format_yvu420 = 0x32315659, // 3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes
- format_yuv422 = 0x36315559, // 3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes
- format_yvu422 = 0x36315659, // 3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes
- format_yuv444 = 0x34325559, // 3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes
- format_yvu444 = 0x34325659, // 3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes
- format_r8 = 0x20203852, // [7:0] R
- format_r16 = 0x20363152, // [15:0] R little endian
- format_rg88 = 0x38384752, // [15:0] R:G 8:8 little endian
- format_gr88 = 0x38385247, // [15:0] G:R 8:8 little endian
- format_rg1616 = 0x32334752, // [31:0] R:G 16:16 little endian
- format_gr1616 = 0x32335247, // [31:0] G:R 16:16 little endian
- format_xrgb16161616f = 0x48345258, // [63:0] x:R:G:B 16:16:16:16 little endian
- format_xbgr16161616f = 0x48344258, // [63:0] x:B:G:R 16:16:16:16 little endian
- format_argb16161616f = 0x48345241, // [63:0] A:R:G:B 16:16:16:16 little endian
- format_abgr16161616f = 0x48344241, // [63:0] A:B:G:R 16:16:16:16 little endian
- format_xyuv8888 = 0x56555958, // [31:0] X:Y:Cb:Cr 8:8:8:8 little endian
- format_vuy888 = 0x34325556, // [23:0] Cr:Cb:Y 8:8:8 little endian
- format_vuy101010 = 0x30335556, // Y followed by U then V, 10:10:10. Non-linear modifier only
- format_y210 = 0x30313259, // [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels
- format_y212 = 0x32313259, // [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels
- format_y216 = 0x36313259, // [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels
- format_y410 = 0x30313459, // [31:0] A:Cr:Y:Cb 2:10:10:10 little endian
- format_y412 = 0x32313459, // [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
- format_y416 = 0x36313459, // [63:0] A:Cr:Y:Cb 16:16:16:16 little endian
- format_xvyu2101010 = 0x30335658, // [31:0] X:Cr:Y:Cb 2:10:10:10 little endian
- format_xvyu12_16161616 = 0x36335658, // [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
- format_xvyu16161616 = 0x38345658, // [63:0] X:Cr:Y:Cb 16:16:16:16 little endian
- format_y0l0 = 0x304c3059, // [63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian
- format_x0l0 = 0x304c3058, // [63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian
- format_y0l2 = 0x324c3059, // [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian
- format_x0l2 = 0x324c3058, // [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian
- format_yuv420_8bit = 0x38305559,
- format_yuv420_10bit = 0x30315559,
- format_xrgb8888_a8 = 0x38415258,
- format_xbgr8888_a8 = 0x38414258,
- format_rgbx8888_a8 = 0x38415852,
- format_bgrx8888_a8 = 0x38415842,
- format_rgb888_a8 = 0x38413852,
- format_bgr888_a8 = 0x38413842,
- format_rgb565_a8 = 0x38413552,
- format_bgr565_a8 = 0x38413542,
- format_nv24 = 0x3432564e, // non-subsampled Cr:Cb plane
- format_nv42 = 0x3234564e, // non-subsampled Cb:Cr plane
- format_p210 = 0x30313250, // 2x1 subsampled Cr:Cb plane, 10 bit per channel
- format_p010 = 0x30313050, // 2x2 subsampled Cr:Cb plane 10 bits per channel
- format_p012 = 0x32313050, // 2x2 subsampled Cr:Cb plane 12 bits per channel
- format_p016 = 0x36313050, // 2x2 subsampled Cr:Cb plane 16 bits per channel
- };
-
- void send_format(uint32_t format);
- void send_format(struct ::wl_resource *resource, uint32_t format);
-
- protected:
- virtual Resource *shm_allocate();
-
- virtual void shm_bind_resource(Resource *resource);
- virtual void shm_destroy_resource(Resource *resource);
-
- virtual void shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_shm_interface m_wl_shm_interface;
-
- static void handle_create_pool(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- int32_t fd,
- int32_t size);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_shm *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_buffer
- {
- public:
- wl_buffer(struct ::wl_client *client, uint32_t id, int version);
- wl_buffer(struct ::wl_display *display, int version);
- wl_buffer(struct ::wl_resource *resource);
- wl_buffer();
-
- virtual ~wl_buffer();
-
- class Resource
- {
- public:
- Resource() : buffer_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_buffer *buffer_object;
- wl_buffer *object() { return buffer_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_release();
- void send_release(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *buffer_allocate();
-
- virtual void buffer_bind_resource(Resource *resource);
- virtual void buffer_destroy_resource(Resource *resource);
-
- virtual void buffer_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_buffer_interface m_wl_buffer_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_buffer *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_data_offer
- {
- public:
- wl_data_offer(struct ::wl_client *client, uint32_t id, int version);
- wl_data_offer(struct ::wl_display *display, int version);
- wl_data_offer(struct ::wl_resource *resource);
- wl_data_offer();
-
- virtual ~wl_data_offer();
-
- class Resource
- {
- public:
- Resource() : data_offer_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_data_offer *data_offer_object;
- wl_data_offer *object() { return data_offer_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_finish = 0, // finish request was called untimely
- error_invalid_action_mask = 1, // action mask contains invalid values
- error_invalid_action = 2, // action argument has an invalid value
- error_invalid_offer = 3, // offer doesn't accept this request
- };
-
- void send_offer(const std::string &mime_type);
- void send_offer(struct ::wl_resource *resource, const std::string &mime_type);
- void send_source_actions(uint32_t source_actions);
- void send_source_actions(struct ::wl_resource *resource, uint32_t source_actions);
- void send_action(uint32_t dnd_action);
- void send_action(struct ::wl_resource *resource, uint32_t dnd_action);
-
- protected:
- virtual Resource *data_offer_allocate();
-
- virtual void data_offer_bind_resource(Resource *resource);
- virtual void data_offer_destroy_resource(Resource *resource);
-
- virtual void data_offer_accept(Resource *resource, uint32_t serial, const std::string &mime_type);
- virtual void data_offer_receive(Resource *resource, const std::string &mime_type, int32_t fd);
- virtual void data_offer_destroy(Resource *resource);
- virtual void data_offer_finish(Resource *resource);
- virtual void data_offer_set_actions(Resource *resource, uint32_t dnd_actions, uint32_t preferred_action);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_data_offer_interface m_wl_data_offer_interface;
-
- static void handle_accept(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- const char *mime_type);
- static void handle_receive(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *mime_type,
- int32_t fd);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_finish(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_actions(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t dnd_actions,
- uint32_t preferred_action);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_data_offer *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_data_source
- {
- public:
- wl_data_source(struct ::wl_client *client, uint32_t id, int version);
- wl_data_source(struct ::wl_display *display, int version);
- wl_data_source(struct ::wl_resource *resource);
- wl_data_source();
-
- virtual ~wl_data_source();
-
- class Resource
- {
- public:
- Resource() : data_source_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_data_source *data_source_object;
- wl_data_source *object() { return data_source_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_action_mask = 0, // action mask contains invalid values
- error_invalid_source = 1, // source doesn't accept this request
- };
-
- void send_target(const std::string &mime_type);
- void send_target(struct ::wl_resource *resource, const std::string &mime_type);
- void send_send(const std::string &mime_type, int32_t fd);
- void send_send(struct ::wl_resource *resource, const std::string &mime_type, int32_t fd);
- void send_cancelled();
- void send_cancelled(struct ::wl_resource *resource);
- void send_dnd_drop_performed();
- void send_dnd_drop_performed(struct ::wl_resource *resource);
- void send_dnd_finished();
- void send_dnd_finished(struct ::wl_resource *resource);
- void send_action(uint32_t dnd_action);
- void send_action(struct ::wl_resource *resource, uint32_t dnd_action);
-
- protected:
- virtual Resource *data_source_allocate();
-
- virtual void data_source_bind_resource(Resource *resource);
- virtual void data_source_destroy_resource(Resource *resource);
-
- virtual void data_source_offer(Resource *resource, const std::string &mime_type);
- virtual void data_source_destroy(Resource *resource);
- virtual void data_source_set_actions(Resource *resource, uint32_t dnd_actions);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_data_source_interface m_wl_data_source_interface;
-
- static void handle_offer(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *mime_type);
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_actions(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t dnd_actions);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_data_source *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_data_device
- {
- public:
- wl_data_device(struct ::wl_client *client, uint32_t id, int version);
- wl_data_device(struct ::wl_display *display, int version);
- wl_data_device(struct ::wl_resource *resource);
- wl_data_device();
-
- virtual ~wl_data_device();
-
- class Resource
- {
- public:
- Resource() : data_device_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_data_device *data_device_object;
- wl_data_device *object() { return data_device_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_role = 0, // given wl_surface has another role
- };
-
- void send_data_offer(struct ::wl_resource *id);
- void send_data_offer(struct ::wl_resource *resource, struct ::wl_resource *id);
- void send_enter(uint32_t serial, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_resource *id);
- void send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_resource *id);
- void send_leave();
- void send_leave(struct ::wl_resource *resource);
- void send_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y);
- void send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t x, wl_fixed_t y);
- void send_drop();
- void send_drop(struct ::wl_resource *resource);
- void send_selection(struct ::wl_resource *id);
- void send_selection(struct ::wl_resource *resource, struct ::wl_resource *id);
-
- protected:
- virtual Resource *data_device_allocate();
-
- virtual void data_device_bind_resource(Resource *resource);
- virtual void data_device_destroy_resource(Resource *resource);
-
- virtual void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial);
- virtual void data_device_set_selection(Resource *resource, struct ::wl_resource *source, uint32_t serial);
- virtual void data_device_release(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_data_device_interface m_wl_data_device_interface;
-
- static void handle_start_drag(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *source,
- struct ::wl_resource *origin,
- struct ::wl_resource *icon,
- uint32_t serial);
- static void handle_set_selection(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *source,
- uint32_t serial);
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_data_device *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_data_device_manager
- {
- public:
- wl_data_device_manager(struct ::wl_client *client, uint32_t id, int version);
- wl_data_device_manager(struct ::wl_display *display, int version);
- wl_data_device_manager(struct ::wl_resource *resource);
- wl_data_device_manager();
-
- virtual ~wl_data_device_manager();
-
- class Resource
- {
- public:
- Resource() : data_device_manager_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_data_device_manager *data_device_manager_object;
- wl_data_device_manager *object() { return data_device_manager_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum dnd_action {
- dnd_action_none = 0, // no action
- dnd_action_copy = 1, // copy action
- dnd_action_move = 2, // move action
- dnd_action_ask = 4, // ask action
- };
-
- protected:
- virtual Resource *data_device_manager_allocate();
-
- virtual void data_device_manager_bind_resource(Resource *resource);
- virtual void data_device_manager_destroy_resource(Resource *resource);
-
- virtual void data_device_manager_create_data_source(Resource *resource, uint32_t id);
- virtual void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_data_device_manager_interface m_wl_data_device_manager_interface;
-
- static void handle_create_data_source(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_get_data_device(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *seat);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_data_device_manager *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_shell
- {
- public:
- wl_shell(struct ::wl_client *client, uint32_t id, int version);
- wl_shell(struct ::wl_display *display, int version);
- wl_shell(struct ::wl_resource *resource);
- wl_shell();
-
- virtual ~wl_shell();
-
- class Resource
- {
- public:
- Resource() : shell_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_shell *shell_object;
- wl_shell *object() { return shell_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_role = 0, // given wl_surface has another role
- };
-
- protected:
- virtual Resource *shell_allocate();
-
- virtual void shell_bind_resource(Resource *resource);
- virtual void shell_destroy_resource(Resource *resource);
-
- virtual void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_shell_interface m_wl_shell_interface;
-
- static void handle_get_shell_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_shell *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_shell_surface
- {
- public:
- wl_shell_surface(struct ::wl_client *client, uint32_t id, int version);
- wl_shell_surface(struct ::wl_display *display, int version);
- wl_shell_surface(struct ::wl_resource *resource);
- wl_shell_surface();
-
- virtual ~wl_shell_surface();
-
- class Resource
- {
- public:
- Resource() : shell_surface_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_shell_surface *shell_surface_object;
- wl_shell_surface *object() { return shell_surface_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum resize {
- resize_none = 0, // no edge
- resize_top = 1, // top edge
- resize_bottom = 2, // bottom edge
- resize_left = 4, // left edge
- resize_top_left = 5, // top and left edges
- resize_bottom_left = 6, // bottom and left edges
- resize_right = 8, // right edge
- resize_top_right = 9, // top and right edges
- resize_bottom_right = 10, // bottom and right edges
- };
-
- enum transient {
- transient_inactive = 0x1, // do not set keyboard focus
- };
-
- enum fullscreen_method {
- fullscreen_method_default = 0, // no preference, apply default policy
- fullscreen_method_scale = 1, // scale, preserve the surface's aspect ratio and center on output
- fullscreen_method_driver = 2, // switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch
- fullscreen_method_fill = 3, // no upscaling, center on output and add black borders to compensate size mismatch
- };
-
- void send_ping(uint32_t serial);
- void send_ping(struct ::wl_resource *resource, uint32_t serial);
- void send_configure(uint32_t edges, int32_t width, int32_t height);
- void send_configure(struct ::wl_resource *resource, uint32_t edges, int32_t width, int32_t height);
- void send_popup_done();
- void send_popup_done(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *shell_surface_allocate();
-
- virtual void shell_surface_bind_resource(Resource *resource);
- virtual void shell_surface_destroy_resource(Resource *resource);
-
- virtual void shell_surface_pong(Resource *resource, uint32_t serial);
- virtual void shell_surface_move(Resource *resource, struct ::wl_resource *seat, uint32_t serial);
- virtual void shell_surface_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges);
- virtual void shell_surface_set_toplevel(Resource *resource);
- virtual void shell_surface_set_transient(Resource *resource, struct ::wl_resource *parent, int32_t x, int32_t y, uint32_t flags);
- virtual void shell_surface_set_fullscreen(Resource *resource, uint32_t method, uint32_t framerate, struct ::wl_resource *output);
- virtual void shell_surface_set_popup(Resource *resource, struct ::wl_resource *seat, uint32_t serial, struct ::wl_resource *parent, int32_t x, int32_t y, uint32_t flags);
- virtual void shell_surface_set_maximized(Resource *resource, struct ::wl_resource *output);
- virtual void shell_surface_set_title(Resource *resource, const std::string &title);
- virtual void shell_surface_set_class(Resource *resource, const std::string &class_);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_shell_surface_interface m_wl_shell_surface_interface;
-
- static void handle_pong(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void handle_move(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial);
- static void handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- uint32_t edges);
- static void handle_set_toplevel(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_transient(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *parent,
- int32_t x,
- int32_t y,
- uint32_t flags);
- static void handle_set_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t method,
- uint32_t framerate,
- struct ::wl_resource *output);
- static void handle_set_popup(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- struct ::wl_resource *parent,
- int32_t x,
- int32_t y,
- uint32_t flags);
- static void handle_set_maximized(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output);
- static void handle_set_title(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *title);
- static void handle_set_class(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *class_);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_shell_surface *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_surface
- {
- public:
- wl_surface(struct ::wl_client *client, uint32_t id, int version);
- wl_surface(struct ::wl_display *display, int version);
- wl_surface(struct ::wl_resource *resource);
- wl_surface();
-
- virtual ~wl_surface();
-
- class Resource
- {
- public:
- Resource() : surface_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_surface *surface_object;
- wl_surface *object() { return surface_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_scale = 0, // buffer scale value is invalid
- error_invalid_transform = 1, // buffer transform value is invalid
- error_invalid_size = 2, // buffer size is invalid
- };
-
- void send_enter(struct ::wl_resource *output);
- void send_enter(struct ::wl_resource *resource, struct ::wl_resource *output);
- void send_leave(struct ::wl_resource *output);
- void send_leave(struct ::wl_resource *resource, struct ::wl_resource *output);
-
- protected:
- virtual Resource *surface_allocate();
-
- virtual void surface_bind_resource(Resource *resource);
- virtual void surface_destroy_resource(Resource *resource);
-
- virtual void surface_destroy(Resource *resource);
- virtual void surface_attach(Resource *resource, struct ::wl_resource *buffer, int32_t x, int32_t y);
- virtual void surface_damage(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- virtual void surface_frame(Resource *resource, uint32_t callback);
- virtual void surface_set_opaque_region(Resource *resource, struct ::wl_resource *region);
- virtual void surface_set_input_region(Resource *resource, struct ::wl_resource *region);
- virtual void surface_commit(Resource *resource);
- virtual void surface_set_buffer_transform(Resource *resource, int32_t transform);
- virtual void surface_set_buffer_scale(Resource *resource, int32_t scale);
- virtual void surface_damage_buffer(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_surface_interface m_wl_surface_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_attach(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *buffer,
- int32_t x,
- int32_t y);
- static void handle_damage(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- static void handle_frame(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t callback);
- static void handle_set_opaque_region(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *region);
- static void handle_set_input_region(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *region);
- static void handle_commit(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_buffer_transform(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t transform);
- static void handle_set_buffer_scale(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t scale);
- static void handle_damage_buffer(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_surface *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_seat
- {
- public:
- wl_seat(struct ::wl_client *client, uint32_t id, int version);
- wl_seat(struct ::wl_display *display, int version);
- wl_seat(struct ::wl_resource *resource);
- wl_seat();
-
- virtual ~wl_seat();
-
- class Resource
- {
- public:
- Resource() : seat_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_seat *seat_object;
- wl_seat *object() { return seat_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum capability {
- capability_pointer = 1, // the seat has pointer devices
- capability_keyboard = 2, // the seat has one or more keyboards
- capability_touch = 4, // the seat has touch devices
- };
-
- enum error {
- error_missing_capability = 0, // get_pointer, get_keyboard or get_touch called on seat without the matching capability
- };
-
- void send_capabilities(uint32_t capabilities);
- void send_capabilities(struct ::wl_resource *resource, uint32_t capabilities);
- void send_name(const std::string &name);
- void send_name(struct ::wl_resource *resource, const std::string &name);
-
- protected:
- virtual Resource *seat_allocate();
-
- virtual void seat_bind_resource(Resource *resource);
- virtual void seat_destroy_resource(Resource *resource);
-
- virtual void seat_get_pointer(Resource *resource, uint32_t id);
- virtual void seat_get_keyboard(Resource *resource, uint32_t id);
- virtual void seat_get_touch(Resource *resource, uint32_t id);
- virtual void seat_release(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_seat_interface m_wl_seat_interface;
-
- static void handle_get_pointer(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_get_keyboard(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_get_touch(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_seat *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_pointer
- {
- public:
- wl_pointer(struct ::wl_client *client, uint32_t id, int version);
- wl_pointer(struct ::wl_display *display, int version);
- wl_pointer(struct ::wl_resource *resource);
- wl_pointer();
-
- virtual ~wl_pointer();
-
- class Resource
- {
- public:
- Resource() : pointer_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_pointer *pointer_object;
- wl_pointer *object() { return pointer_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_role = 0, // given wl_surface has another role
- };
-
- enum button_state {
- button_state_released = 0, // the button is not pressed
- button_state_pressed = 1, // the button is pressed
- };
-
- enum axis {
- axis_vertical_scroll = 0, // vertical axis
- axis_horizontal_scroll = 1, // horizontal axis
- };
-
- enum axis_source {
- axis_source_wheel = 0, // a physical wheel rotation
- axis_source_finger = 1, // finger on a touch surface
- axis_source_continuous = 2, // continuous coordinate space
- axis_source_wheel_tilt = 3, // a physical wheel tilt
- };
-
- void send_enter(uint32_t serial, struct ::wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y);
- void send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y);
- void send_leave(uint32_t serial, struct ::wl_resource *surface);
- void send_leave(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface);
- void send_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y);
- void send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y);
- void send_button(uint32_t serial, uint32_t time, uint32_t button, uint32_t state);
- void send_button(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t button, uint32_t state);
- void send_axis(uint32_t time, uint32_t axis, wl_fixed_t value);
- void send_axis(struct ::wl_resource *resource, uint32_t time, uint32_t axis, wl_fixed_t value);
- void send_frame();
- void send_frame(struct ::wl_resource *resource);
- void send_axis_source(uint32_t axis_source);
- void send_axis_source(struct ::wl_resource *resource, uint32_t axis_source);
- void send_axis_stop(uint32_t time, uint32_t axis);
- void send_axis_stop(struct ::wl_resource *resource, uint32_t time, uint32_t axis);
- void send_axis_discrete(uint32_t axis, int32_t discrete);
- void send_axis_discrete(struct ::wl_resource *resource, uint32_t axis, int32_t discrete);
-
- protected:
- virtual Resource *pointer_allocate();
-
- virtual void pointer_bind_resource(Resource *resource);
- virtual void pointer_destroy_resource(Resource *resource);
-
- virtual void pointer_set_cursor(Resource *resource, uint32_t serial, struct ::wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y);
- virtual void pointer_release(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_pointer_interface m_wl_pointer_interface;
-
- static void handle_set_cursor(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial,
- struct ::wl_resource *surface,
- int32_t hotspot_x,
- int32_t hotspot_y);
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_pointer *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_keyboard
- {
- public:
- wl_keyboard(struct ::wl_client *client, uint32_t id, int version);
- wl_keyboard(struct ::wl_display *display, int version);
- wl_keyboard(struct ::wl_resource *resource);
- wl_keyboard();
-
- virtual ~wl_keyboard();
-
- class Resource
- {
- public:
- Resource() : keyboard_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_keyboard *keyboard_object;
- wl_keyboard *object() { return keyboard_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum keymap_format {
- keymap_format_no_keymap = 0, // no keymap; client must understand how to interpret the raw keycode
- keymap_format_xkb_v1 = 1, // libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode
- };
-
- enum key_state {
- key_state_released = 0, // key is not pressed
- key_state_pressed = 1, // key is pressed
- };
-
- void send_keymap(uint32_t format, int32_t fd, uint32_t size);
- void send_keymap(struct ::wl_resource *resource, uint32_t format, int32_t fd, uint32_t size);
- void send_enter(uint32_t serial, struct ::wl_resource *surface, struct ::wl_array *keys);
- void send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, struct ::wl_array *keys);
- void send_leave(uint32_t serial, struct ::wl_resource *surface);
- void send_leave(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface);
- void send_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state);
- void send_key(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state);
- void send_modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
- void send_modifiers(struct ::wl_resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
- void send_repeat_info(int32_t rate, int32_t delay);
- void send_repeat_info(struct ::wl_resource *resource, int32_t rate, int32_t delay);
-
- protected:
- virtual Resource *keyboard_allocate();
-
- virtual void keyboard_bind_resource(Resource *resource);
- virtual void keyboard_destroy_resource(Resource *resource);
-
- virtual void keyboard_release(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_keyboard_interface m_wl_keyboard_interface;
-
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_keyboard *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_touch
- {
- public:
- wl_touch(struct ::wl_client *client, uint32_t id, int version);
- wl_touch(struct ::wl_display *display, int version);
- wl_touch(struct ::wl_resource *resource);
- wl_touch();
-
- virtual ~wl_touch();
-
- class Resource
- {
- public:
- Resource() : touch_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_touch *touch_object;
- wl_touch *object() { return touch_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_down(uint32_t serial, uint32_t time, struct ::wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y);
- void send_down(struct ::wl_resource *resource, uint32_t serial, uint32_t time, struct ::wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y);
- void send_up(uint32_t serial, uint32_t time, int32_t id);
- void send_up(struct ::wl_resource *resource, uint32_t serial, uint32_t time, int32_t id);
- void send_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y);
- void send_motion(struct ::wl_resource *resource, uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y);
- void send_frame();
- void send_frame(struct ::wl_resource *resource);
- void send_cancel();
- void send_cancel(struct ::wl_resource *resource);
- void send_shape(int32_t id, wl_fixed_t major, wl_fixed_t minor);
- void send_shape(struct ::wl_resource *resource, int32_t id, wl_fixed_t major, wl_fixed_t minor);
- void send_orientation(int32_t id, wl_fixed_t orientation);
- void send_orientation(struct ::wl_resource *resource, int32_t id, wl_fixed_t orientation);
-
- protected:
- virtual Resource *touch_allocate();
-
- virtual void touch_bind_resource(Resource *resource);
- virtual void touch_destroy_resource(Resource *resource);
-
- virtual void touch_release(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_touch_interface m_wl_touch_interface;
-
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_touch *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_output
- {
- public:
- wl_output(struct ::wl_client *client, uint32_t id, int version);
- wl_output(struct ::wl_display *display, int version);
- wl_output(struct ::wl_resource *resource);
- wl_output();
-
- virtual ~wl_output();
-
- class Resource
- {
- public:
- Resource() : output_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_output *output_object;
- wl_output *object() { return output_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum subpixel {
- subpixel_unknown = 0, // unknown geometry
- subpixel_none = 1, // no geometry
- subpixel_horizontal_rgb = 2, // horizontal RGB
- subpixel_horizontal_bgr = 3, // horizontal BGR
- subpixel_vertical_rgb = 4, // vertical RGB
- subpixel_vertical_bgr = 5, // vertical BGR
- };
-
- enum transform {
- transform_normal = 0, // no transform
- transform_90 = 1, // 90 degrees counter-clockwise
- transform_180 = 2, // 180 degrees counter-clockwise
- transform_270 = 3, // 270 degrees counter-clockwise
- transform_flipped = 4, // 180 degree flip around a vertical axis
- transform_flipped_90 = 5, // flip and rotate 90 degrees counter-clockwise
- transform_flipped_180 = 6, // flip and rotate 180 degrees counter-clockwise
- transform_flipped_270 = 7, // flip and rotate 270 degrees counter-clockwise
- };
-
- enum mode {
- mode_current = 0x1, // indicates this is the current mode
- mode_preferred = 0x2, // indicates this is the preferred mode
- };
-
- void send_geometry(int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const std::string &make, const std::string &model, int32_t transform);
- void send_geometry(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const std::string &make, const std::string &model, int32_t transform);
- void send_mode(uint32_t flags, int32_t width, int32_t height, int32_t refresh);
- void send_mode(struct ::wl_resource *resource, uint32_t flags, int32_t width, int32_t height, int32_t refresh);
- void send_done();
- void send_done(struct ::wl_resource *resource);
- void send_scale(int32_t factor);
- void send_scale(struct ::wl_resource *resource, int32_t factor);
-
- protected:
- virtual Resource *output_allocate();
-
- virtual void output_bind_resource(Resource *resource);
- virtual void output_destroy_resource(Resource *resource);
-
- virtual void output_release(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_output_interface m_wl_output_interface;
-
- static void handle_release(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_output *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_region
- {
- public:
- wl_region(struct ::wl_client *client, uint32_t id, int version);
- wl_region(struct ::wl_display *display, int version);
- wl_region(struct ::wl_resource *resource);
- wl_region();
-
- virtual ~wl_region();
-
- class Resource
- {
- public:
- Resource() : region_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_region *region_object;
- wl_region *object() { return region_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- protected:
- virtual Resource *region_allocate();
-
- virtual void region_bind_resource(Resource *resource);
- virtual void region_destroy_resource(Resource *resource);
-
- virtual void region_destroy(Resource *resource);
- virtual void region_add(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- virtual void region_subtract(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_region_interface m_wl_region_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_add(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- static void handle_subtract(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_region *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_subcompositor
- {
- public:
- wl_subcompositor(struct ::wl_client *client, uint32_t id, int version);
- wl_subcompositor(struct ::wl_display *display, int version);
- wl_subcompositor(struct ::wl_resource *resource);
- wl_subcompositor();
-
- virtual ~wl_subcompositor();
-
- class Resource
- {
- public:
- Resource() : subcompositor_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_subcompositor *subcompositor_object;
- wl_subcompositor *object() { return subcompositor_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_bad_surface = 0, // the to-be sub-surface is invalid
- };
-
- protected:
- virtual Resource *subcompositor_allocate();
-
- virtual void subcompositor_bind_resource(Resource *resource);
- virtual void subcompositor_destroy_resource(Resource *resource);
-
- virtual void subcompositor_destroy(Resource *resource);
- virtual void subcompositor_get_subsurface(Resource *resource, uint32_t id, struct ::wl_resource *surface, struct ::wl_resource *parent);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_subcompositor_interface m_wl_subcompositor_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_get_subsurface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface,
- struct ::wl_resource *parent);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_subcompositor *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class wl_subsurface
- {
- public:
- wl_subsurface(struct ::wl_client *client, uint32_t id, int version);
- wl_subsurface(struct ::wl_display *display, int version);
- wl_subsurface(struct ::wl_resource *resource);
- wl_subsurface();
-
- virtual ~wl_subsurface();
-
- class Resource
- {
- public:
- Resource() : subsurface_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- wl_subsurface *subsurface_object;
- wl_subsurface *object() { return subsurface_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_bad_surface = 0, // wl_surface is not a sibling or the parent
- };
-
- protected:
- virtual Resource *subsurface_allocate();
-
- virtual void subsurface_bind_resource(Resource *resource);
- virtual void subsurface_destroy_resource(Resource *resource);
-
- virtual void subsurface_destroy(Resource *resource);
- virtual void subsurface_set_position(Resource *resource, int32_t x, int32_t y);
- virtual void subsurface_place_above(Resource *resource, struct ::wl_resource *sibling);
- virtual void subsurface_place_below(Resource *resource, struct ::wl_resource *sibling);
- virtual void subsurface_set_sync(Resource *resource);
- virtual void subsurface_set_desync(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::wl_subsurface_interface m_wl_subsurface_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_position(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y);
- static void handle_place_above(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *sibling);
- static void handle_place_below(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *sibling);
- static void handle_set_sync(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_desync(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- wl_subsurface *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/xdg-shell-unstable-v6.xml */
-
-#include "dswayland-server-xdg-shell-unstable-v6.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- zxdg_shell_v6::zxdg_shell_v6(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zxdg_shell_v6::zxdg_shell_v6(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zxdg_shell_v6::zxdg_shell_v6(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zxdg_shell_v6::zxdg_shell_v6()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zxdg_shell_v6::~zxdg_shell_v6()
- {
- std::multimap<struct ::wl_client*, zxdg_shell_v6::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zxdg_shell_v6::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zxdg_shell_v6::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zxdg_shell_v6::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zxdg_shell_v6::Resource *zxdg_shell_v6::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zxdg_shell_v6::Resource *zxdg_shell_v6::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zxdg_shell_v6::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zxdg_shell_v6_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zxdg_shell_v6::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zxdg_shell_v6::interface()
- {
- return &::zxdg_shell_v6_interface;
- }
-
- zxdg_shell_v6::Resource *zxdg_shell_v6::zxdg_shell_v6_allocate()
- {
- return new Resource;
- }
-
- void zxdg_shell_v6::zxdg_shell_v6_bind_resource(Resource *)
- {
- }
-
- void zxdg_shell_v6::zxdg_shell_v6_destroy_resource(Resource *)
- {
- }
-
- void zxdg_shell_v6::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zxdg_shell_v6 *that = static_cast<zxdg_shell_v6 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zxdg_shell_v6::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zxdg_shell_v6 *that = static_cast<zxdg_shell_v6::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zxdg_shell_v6::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zxdg_shell_v6 *that = resource->zxdg_shell_v6_object;
- that->m_resource_map.erase(resource->client());
- that->zxdg_shell_v6_destroy_resource(resource);
- delete resource;
- }
-
- zxdg_shell_v6::Resource *zxdg_shell_v6::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zxdg_shell_v6_interface, version, id);
- return bind(handle);
- }
-
- zxdg_shell_v6::Resource *zxdg_shell_v6::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zxdg_shell_v6_allocate();
- resource->zxdg_shell_v6_object = this;
-
- wl_resource_set_implementation(handle, &m_zxdg_shell_v6_interface, resource, destroy_func);
- resource->handle = handle;
- zxdg_shell_v6_bind_resource(resource);
- return resource;
- }
- zxdg_shell_v6::Resource *zxdg_shell_v6::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zxdg_shell_v6_interface, &m_zxdg_shell_v6_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zxdg_shell_v6_interface zxdg_shell_v6::m_zxdg_shell_v6_interface = {
- zxdg_shell_v6::handle_destroy,
- zxdg_shell_v6::handle_create_positioner,
- zxdg_shell_v6::handle_get_xdg_surface,
- zxdg_shell_v6::handle_pong
- };
-
- void zxdg_shell_v6::zxdg_shell_v6_destroy(Resource *)
- {
- }
-
- void zxdg_shell_v6::zxdg_shell_v6_create_positioner(Resource *, uint32_t)
- {
- }
-
- void zxdg_shell_v6::zxdg_shell_v6_get_xdg_surface(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void zxdg_shell_v6::zxdg_shell_v6_pong(Resource *, uint32_t )
- {
- }
-
-
- void zxdg_shell_v6::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_shell_v6 *>(r->zxdg_shell_v6_object)->zxdg_shell_v6_destroy(
- r);
- }
-
- void zxdg_shell_v6::handle_create_positioner(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_shell_v6 *>(r->zxdg_shell_v6_object)->zxdg_shell_v6_create_positioner(
- r,
- id);
- }
-
- void zxdg_shell_v6::handle_get_xdg_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_shell_v6 *>(r->zxdg_shell_v6_object)->zxdg_shell_v6_get_xdg_surface(
- r,
- id,
- surface);
- }
-
- void zxdg_shell_v6::handle_pong(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_shell_v6 *>(r->zxdg_shell_v6_object)->zxdg_shell_v6_pong(
- r,
- serial);
- }
-
- void zxdg_shell_v6::send_ping(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "zxdg_shell_v6::ping", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zxdg_shell_v6::ping as it's not initialised");
- return;
- }
- send_ping(
- m_resource->handle,
- serial);
- }
-
- void zxdg_shell_v6::send_ping(struct ::wl_resource *resource, uint32_t serial)
- {
- zxdg_shell_v6_send_ping(
- resource,
- serial);
- }
-
-
- zxdg_positioner_v6::zxdg_positioner_v6(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zxdg_positioner_v6::zxdg_positioner_v6(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zxdg_positioner_v6::zxdg_positioner_v6(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zxdg_positioner_v6::zxdg_positioner_v6()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zxdg_positioner_v6::~zxdg_positioner_v6()
- {
- std::multimap<struct ::wl_client*, zxdg_positioner_v6::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zxdg_positioner_v6::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zxdg_positioner_v6::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zxdg_positioner_v6::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zxdg_positioner_v6::Resource *zxdg_positioner_v6::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zxdg_positioner_v6::Resource *zxdg_positioner_v6::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zxdg_positioner_v6::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zxdg_positioner_v6_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zxdg_positioner_v6::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zxdg_positioner_v6::interface()
- {
- return &::zxdg_positioner_v6_interface;
- }
-
- zxdg_positioner_v6::Resource *zxdg_positioner_v6::zxdg_positioner_v6_allocate()
- {
- return new Resource;
- }
-
- void zxdg_positioner_v6::zxdg_positioner_v6_bind_resource(Resource *)
- {
- }
-
- void zxdg_positioner_v6::zxdg_positioner_v6_destroy_resource(Resource *)
- {
- }
-
- void zxdg_positioner_v6::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zxdg_positioner_v6 *that = static_cast<zxdg_positioner_v6 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zxdg_positioner_v6::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zxdg_positioner_v6 *that = static_cast<zxdg_positioner_v6::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zxdg_positioner_v6::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zxdg_positioner_v6 *that = resource->zxdg_positioner_v6_object;
- that->m_resource_map.erase(resource->client());
- that->zxdg_positioner_v6_destroy_resource(resource);
- delete resource;
- }
-
- zxdg_positioner_v6::Resource *zxdg_positioner_v6::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zxdg_positioner_v6_interface, version, id);
- return bind(handle);
- }
-
- zxdg_positioner_v6::Resource *zxdg_positioner_v6::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zxdg_positioner_v6_allocate();
- resource->zxdg_positioner_v6_object = this;
-
- wl_resource_set_implementation(handle, &m_zxdg_positioner_v6_interface, resource, destroy_func);
- resource->handle = handle;
- zxdg_positioner_v6_bind_resource(resource);
- return resource;
- }
- zxdg_positioner_v6::Resource *zxdg_positioner_v6::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zxdg_positioner_v6_interface, &m_zxdg_positioner_v6_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zxdg_positioner_v6_interface zxdg_positioner_v6::m_zxdg_positioner_v6_interface = {
- zxdg_positioner_v6::handle_destroy,
- zxdg_positioner_v6::handle_set_size,
- zxdg_positioner_v6::handle_set_anchor_rect,
- zxdg_positioner_v6::handle_set_anchor,
- zxdg_positioner_v6::handle_set_gravity,
- zxdg_positioner_v6::handle_set_constraint_adjustment,
- zxdg_positioner_v6::handle_set_offset
- };
-
- void zxdg_positioner_v6::zxdg_positioner_v6_destroy(Resource *)
- {
- }
-
- void zxdg_positioner_v6::zxdg_positioner_v6_set_size(Resource *, int32_t , int32_t )
- {
- }
-
- void zxdg_positioner_v6::zxdg_positioner_v6_set_anchor_rect(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void zxdg_positioner_v6::zxdg_positioner_v6_set_anchor(Resource *, uint32_t )
- {
- }
-
- void zxdg_positioner_v6::zxdg_positioner_v6_set_gravity(Resource *, uint32_t )
- {
- }
-
- void zxdg_positioner_v6::zxdg_positioner_v6_set_constraint_adjustment(Resource *, uint32_t )
- {
- }
-
- void zxdg_positioner_v6::zxdg_positioner_v6_set_offset(Resource *, int32_t , int32_t )
- {
- }
-
-
- void zxdg_positioner_v6::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_positioner_v6 *>(r->zxdg_positioner_v6_object)->zxdg_positioner_v6_destroy(
- r);
- }
-
- void zxdg_positioner_v6::handle_set_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_positioner_v6 *>(r->zxdg_positioner_v6_object)->zxdg_positioner_v6_set_size(
- r,
- width,
- height);
- }
-
- void zxdg_positioner_v6::handle_set_anchor_rect(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_positioner_v6 *>(r->zxdg_positioner_v6_object)->zxdg_positioner_v6_set_anchor_rect(
- r,
- x,
- y,
- width,
- height);
- }
-
- void zxdg_positioner_v6::handle_set_anchor(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t anchor)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_positioner_v6 *>(r->zxdg_positioner_v6_object)->zxdg_positioner_v6_set_anchor(
- r,
- anchor);
- }
-
- void zxdg_positioner_v6::handle_set_gravity(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t gravity)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_positioner_v6 *>(r->zxdg_positioner_v6_object)->zxdg_positioner_v6_set_gravity(
- r,
- gravity);
- }
-
- void zxdg_positioner_v6::handle_set_constraint_adjustment(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t constraint_adjustment)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_positioner_v6 *>(r->zxdg_positioner_v6_object)->zxdg_positioner_v6_set_constraint_adjustment(
- r,
- constraint_adjustment);
- }
-
- void zxdg_positioner_v6::handle_set_offset(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_positioner_v6 *>(r->zxdg_positioner_v6_object)->zxdg_positioner_v6_set_offset(
- r,
- x,
- y);
- }
-
- zxdg_surface_v6::zxdg_surface_v6(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zxdg_surface_v6::zxdg_surface_v6(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zxdg_surface_v6::zxdg_surface_v6(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zxdg_surface_v6::zxdg_surface_v6()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zxdg_surface_v6::~zxdg_surface_v6()
- {
- std::multimap<struct ::wl_client*, zxdg_surface_v6::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zxdg_surface_v6::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zxdg_surface_v6::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zxdg_surface_v6::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zxdg_surface_v6::Resource *zxdg_surface_v6::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zxdg_surface_v6::Resource *zxdg_surface_v6::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zxdg_surface_v6::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zxdg_surface_v6_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zxdg_surface_v6::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zxdg_surface_v6::interface()
- {
- return &::zxdg_surface_v6_interface;
- }
-
- zxdg_surface_v6::Resource *zxdg_surface_v6::zxdg_surface_v6_allocate()
- {
- return new Resource;
- }
-
- void zxdg_surface_v6::zxdg_surface_v6_bind_resource(Resource *)
- {
- }
-
- void zxdg_surface_v6::zxdg_surface_v6_destroy_resource(Resource *)
- {
- }
-
- void zxdg_surface_v6::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zxdg_surface_v6 *that = static_cast<zxdg_surface_v6 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zxdg_surface_v6::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zxdg_surface_v6 *that = static_cast<zxdg_surface_v6::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zxdg_surface_v6::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zxdg_surface_v6 *that = resource->zxdg_surface_v6_object;
- that->m_resource_map.erase(resource->client());
- that->zxdg_surface_v6_destroy_resource(resource);
- delete resource;
- }
-
- zxdg_surface_v6::Resource *zxdg_surface_v6::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zxdg_surface_v6_interface, version, id);
- return bind(handle);
- }
-
- zxdg_surface_v6::Resource *zxdg_surface_v6::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zxdg_surface_v6_allocate();
- resource->zxdg_surface_v6_object = this;
-
- wl_resource_set_implementation(handle, &m_zxdg_surface_v6_interface, resource, destroy_func);
- resource->handle = handle;
- zxdg_surface_v6_bind_resource(resource);
- return resource;
- }
- zxdg_surface_v6::Resource *zxdg_surface_v6::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zxdg_surface_v6_interface, &m_zxdg_surface_v6_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zxdg_surface_v6_interface zxdg_surface_v6::m_zxdg_surface_v6_interface = {
- zxdg_surface_v6::handle_destroy,
- zxdg_surface_v6::handle_get_toplevel,
- zxdg_surface_v6::handle_get_popup,
- zxdg_surface_v6::handle_set_window_geometry,
- zxdg_surface_v6::handle_ack_configure
- };
-
- void zxdg_surface_v6::zxdg_surface_v6_destroy(Resource *)
- {
- }
-
- void zxdg_surface_v6::zxdg_surface_v6_get_toplevel(Resource *, uint32_t)
- {
- }
-
- void zxdg_surface_v6::zxdg_surface_v6_get_popup(Resource *, uint32_t, struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
- void zxdg_surface_v6::zxdg_surface_v6_set_window_geometry(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void zxdg_surface_v6::zxdg_surface_v6_ack_configure(Resource *, uint32_t )
- {
- }
-
-
- void zxdg_surface_v6::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_surface_v6 *>(r->zxdg_surface_v6_object)->zxdg_surface_v6_destroy(
- r);
- }
-
- void zxdg_surface_v6::handle_get_toplevel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_surface_v6 *>(r->zxdg_surface_v6_object)->zxdg_surface_v6_get_toplevel(
- r,
- id);
- }
-
- void zxdg_surface_v6::handle_get_popup(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *parent,
- struct ::wl_resource *positioner)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_surface_v6 *>(r->zxdg_surface_v6_object)->zxdg_surface_v6_get_popup(
- r,
- id,
- parent,
- positioner);
- }
-
- void zxdg_surface_v6::handle_set_window_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_surface_v6 *>(r->zxdg_surface_v6_object)->zxdg_surface_v6_set_window_geometry(
- r,
- x,
- y,
- width,
- height);
- }
-
- void zxdg_surface_v6::handle_ack_configure(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_surface_v6 *>(r->zxdg_surface_v6_object)->zxdg_surface_v6_ack_configure(
- r,
- serial);
- }
-
- void zxdg_surface_v6::send_configure(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "zxdg_surface_v6::configure", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zxdg_surface_v6::configure as it's not initialised");
- return;
- }
- send_configure(
- m_resource->handle,
- serial);
- }
-
- void zxdg_surface_v6::send_configure(struct ::wl_resource *resource, uint32_t serial)
- {
- zxdg_surface_v6_send_configure(
- resource,
- serial);
- }
-
-
- zxdg_toplevel_v6::zxdg_toplevel_v6(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zxdg_toplevel_v6::zxdg_toplevel_v6(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zxdg_toplevel_v6::zxdg_toplevel_v6(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zxdg_toplevel_v6::zxdg_toplevel_v6()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zxdg_toplevel_v6::~zxdg_toplevel_v6()
- {
- std::multimap<struct ::wl_client*, zxdg_toplevel_v6::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zxdg_toplevel_v6::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zxdg_toplevel_v6::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zxdg_toplevel_v6::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zxdg_toplevel_v6::Resource *zxdg_toplevel_v6::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zxdg_toplevel_v6::Resource *zxdg_toplevel_v6::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zxdg_toplevel_v6::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zxdg_toplevel_v6_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zxdg_toplevel_v6::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zxdg_toplevel_v6::interface()
- {
- return &::zxdg_toplevel_v6_interface;
- }
-
- zxdg_toplevel_v6::Resource *zxdg_toplevel_v6::zxdg_toplevel_v6_allocate()
- {
- return new Resource;
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_bind_resource(Resource *)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_destroy_resource(Resource *)
- {
- }
-
- void zxdg_toplevel_v6::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zxdg_toplevel_v6 *that = static_cast<zxdg_toplevel_v6 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zxdg_toplevel_v6::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zxdg_toplevel_v6 *that = static_cast<zxdg_toplevel_v6::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zxdg_toplevel_v6::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zxdg_toplevel_v6 *that = resource->zxdg_toplevel_v6_object;
- that->m_resource_map.erase(resource->client());
- that->zxdg_toplevel_v6_destroy_resource(resource);
- delete resource;
- }
-
- zxdg_toplevel_v6::Resource *zxdg_toplevel_v6::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zxdg_toplevel_v6_interface, version, id);
- return bind(handle);
- }
-
- zxdg_toplevel_v6::Resource *zxdg_toplevel_v6::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zxdg_toplevel_v6_allocate();
- resource->zxdg_toplevel_v6_object = this;
-
- wl_resource_set_implementation(handle, &m_zxdg_toplevel_v6_interface, resource, destroy_func);
- resource->handle = handle;
- zxdg_toplevel_v6_bind_resource(resource);
- return resource;
- }
- zxdg_toplevel_v6::Resource *zxdg_toplevel_v6::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zxdg_toplevel_v6_interface, &m_zxdg_toplevel_v6_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zxdg_toplevel_v6_interface zxdg_toplevel_v6::m_zxdg_toplevel_v6_interface = {
- zxdg_toplevel_v6::handle_destroy,
- zxdg_toplevel_v6::handle_set_parent,
- zxdg_toplevel_v6::handle_set_title,
- zxdg_toplevel_v6::handle_set_app_id,
- zxdg_toplevel_v6::handle_show_window_menu,
- zxdg_toplevel_v6::handle_move,
- zxdg_toplevel_v6::handle_resize,
- zxdg_toplevel_v6::handle_set_max_size,
- zxdg_toplevel_v6::handle_set_min_size,
- zxdg_toplevel_v6::handle_set_maximized,
- zxdg_toplevel_v6::handle_unset_maximized,
- zxdg_toplevel_v6::handle_set_fullscreen,
- zxdg_toplevel_v6::handle_unset_fullscreen,
- zxdg_toplevel_v6::handle_set_minimized
- };
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_destroy(Resource *)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_set_parent(Resource *, struct ::wl_resource *)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_set_title(Resource *, const std::string &)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_set_app_id(Resource *, const std::string &)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_show_window_menu(Resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t )
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_move(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_resize(Resource *, struct ::wl_resource *, uint32_t , uint32_t )
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_set_max_size(Resource *, int32_t , int32_t )
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_set_min_size(Resource *, int32_t , int32_t )
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_set_maximized(Resource *)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_unset_maximized(Resource *)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_set_fullscreen(Resource *, struct ::wl_resource *)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_unset_fullscreen(Resource *)
- {
- }
-
- void zxdg_toplevel_v6::zxdg_toplevel_v6_set_minimized(Resource *)
- {
- }
-
-
- void zxdg_toplevel_v6::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_destroy(
- r);
- }
-
- void zxdg_toplevel_v6::handle_set_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *parent)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_set_parent(
- r,
- parent);
- }
-
- void zxdg_toplevel_v6::handle_set_title(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *title)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_set_title(
- r,
- std::string(title));
- }
-
- void zxdg_toplevel_v6::handle_set_app_id(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_set_app_id(
- r,
- std::string(app_id));
- }
-
- void zxdg_toplevel_v6::handle_show_window_menu(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_show_window_menu(
- r,
- seat,
- serial,
- x,
- y);
- }
-
- void zxdg_toplevel_v6::handle_move(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_move(
- r,
- seat,
- serial);
- }
-
- void zxdg_toplevel_v6::handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- uint32_t edges)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_resize(
- r,
- seat,
- serial,
- edges);
- }
-
- void zxdg_toplevel_v6::handle_set_max_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_set_max_size(
- r,
- width,
- height);
- }
-
- void zxdg_toplevel_v6::handle_set_min_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_set_min_size(
- r,
- width,
- height);
- }
-
- void zxdg_toplevel_v6::handle_set_maximized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_set_maximized(
- r);
- }
-
- void zxdg_toplevel_v6::handle_unset_maximized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_unset_maximized(
- r);
- }
-
- void zxdg_toplevel_v6::handle_set_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_set_fullscreen(
- r,
- output);
- }
-
- void zxdg_toplevel_v6::handle_unset_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_unset_fullscreen(
- r);
- }
-
- void zxdg_toplevel_v6::handle_set_minimized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_toplevel_v6 *>(r->zxdg_toplevel_v6_object)->zxdg_toplevel_v6_set_minimized(
- r);
- }
-
- void zxdg_toplevel_v6::send_configure(int32_t width, int32_t height, struct ::wl_array *states)
- {
- DS_ASSERT_X(m_resource, "zxdg_toplevel_v6::configure", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zxdg_toplevel_v6::configure as it's not initialised");
- return;
- }
- send_configure(
- m_resource->handle,
- width,
- height,
- states);
- }
-
- void zxdg_toplevel_v6::send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, struct ::wl_array *states)
- {
- zxdg_toplevel_v6_send_configure(
- resource,
- width,
- height,
- states);
- }
-
-
- void zxdg_toplevel_v6::send_close()
- {
- DS_ASSERT_X(m_resource, "zxdg_toplevel_v6::close", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zxdg_toplevel_v6::close as it's not initialised");
- return;
- }
- send_close(
- m_resource->handle);
- }
-
- void zxdg_toplevel_v6::send_close(struct ::wl_resource *resource)
- {
- zxdg_toplevel_v6_send_close(
- resource);
- }
-
-
- zxdg_popup_v6::zxdg_popup_v6(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- zxdg_popup_v6::zxdg_popup_v6(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- zxdg_popup_v6::zxdg_popup_v6(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- zxdg_popup_v6::zxdg_popup_v6()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- zxdg_popup_v6::~zxdg_popup_v6()
- {
- std::multimap<struct ::wl_client*, zxdg_popup_v6::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- zxdg_popup_v6::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void zxdg_popup_v6::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void zxdg_popup_v6::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- zxdg_popup_v6::Resource *zxdg_popup_v6::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- zxdg_popup_v6::Resource *zxdg_popup_v6::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void zxdg_popup_v6::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::zxdg_popup_v6_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = zxdg_popup_v6::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *zxdg_popup_v6::interface()
- {
- return &::zxdg_popup_v6_interface;
- }
-
- zxdg_popup_v6::Resource *zxdg_popup_v6::zxdg_popup_v6_allocate()
- {
- return new Resource;
- }
-
- void zxdg_popup_v6::zxdg_popup_v6_bind_resource(Resource *)
- {
- }
-
- void zxdg_popup_v6::zxdg_popup_v6_destroy_resource(Resource *)
- {
- }
-
- void zxdg_popup_v6::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- zxdg_popup_v6 *that = static_cast<zxdg_popup_v6 *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void zxdg_popup_v6::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- zxdg_popup_v6 *that = static_cast<zxdg_popup_v6::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void zxdg_popup_v6::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- zxdg_popup_v6 *that = resource->zxdg_popup_v6_object;
- that->m_resource_map.erase(resource->client());
- that->zxdg_popup_v6_destroy_resource(resource);
- delete resource;
- }
-
- zxdg_popup_v6::Resource *zxdg_popup_v6::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::zxdg_popup_v6_interface, version, id);
- return bind(handle);
- }
-
- zxdg_popup_v6::Resource *zxdg_popup_v6::bind(struct ::wl_resource *handle)
- {
- Resource *resource = zxdg_popup_v6_allocate();
- resource->zxdg_popup_v6_object = this;
-
- wl_resource_set_implementation(handle, &m_zxdg_popup_v6_interface, resource, destroy_func);
- resource->handle = handle;
- zxdg_popup_v6_bind_resource(resource);
- return resource;
- }
- zxdg_popup_v6::Resource *zxdg_popup_v6::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::zxdg_popup_v6_interface, &m_zxdg_popup_v6_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::zxdg_popup_v6_interface zxdg_popup_v6::m_zxdg_popup_v6_interface = {
- zxdg_popup_v6::handle_destroy,
- zxdg_popup_v6::handle_grab
- };
-
- void zxdg_popup_v6::zxdg_popup_v6_destroy(Resource *)
- {
- }
-
- void zxdg_popup_v6::zxdg_popup_v6_grab(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
-
- void zxdg_popup_v6::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_popup_v6 *>(r->zxdg_popup_v6_object)->zxdg_popup_v6_destroy(
- r);
- }
-
- void zxdg_popup_v6::handle_grab(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<zxdg_popup_v6 *>(r->zxdg_popup_v6_object)->zxdg_popup_v6_grab(
- r,
- seat,
- serial);
- }
-
- void zxdg_popup_v6::send_configure(int32_t x, int32_t y, int32_t width, int32_t height)
- {
- DS_ASSERT_X(m_resource, "zxdg_popup_v6::configure", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zxdg_popup_v6::configure as it's not initialised");
- return;
- }
- send_configure(
- m_resource->handle,
- x,
- y,
- width,
- height);
- }
-
- void zxdg_popup_v6::send_configure(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
- {
- zxdg_popup_v6_send_configure(
- resource,
- x,
- y,
- width,
- height);
- }
-
-
- void zxdg_popup_v6::send_popup_done()
- {
- DS_ASSERT_X(m_resource, "zxdg_popup_v6::popup_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call zxdg_popup_v6::popup_done as it's not initialised");
- return;
- }
- send_popup_done(
- m_resource->handle);
- }
-
- void zxdg_popup_v6::send_popup_done(struct ::wl_resource *resource)
- {
- zxdg_popup_v6_send_popup_done(
- resource);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/xdg-shell-unstable-v6.xml */
-
-#ifndef __DS_XDG_SHELL_UNSTABLE_V6_PROTOCOL_H__
-#define __DS_XDG_SHELL_UNSTABLE_V6_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "xdg-shell-unstable-v6-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class zxdg_shell_v6
- {
- public:
- zxdg_shell_v6(struct ::wl_client *client, uint32_t id, int version);
- zxdg_shell_v6(struct ::wl_display *display, int version);
- zxdg_shell_v6(struct ::wl_resource *resource);
- zxdg_shell_v6();
-
- virtual ~zxdg_shell_v6();
-
- class Resource
- {
- public:
- Resource() : zxdg_shell_v6_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zxdg_shell_v6 *zxdg_shell_v6_object;
- zxdg_shell_v6 *object() { return zxdg_shell_v6_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_role = 0, // given wl_surface has another role
- error_defunct_surfaces = 1, // xdg_shell was destroyed before children
- error_not_the_topmost_popup = 2, // the client tried to map or destroy a non-topmost popup
- error_invalid_popup_parent = 3, // the client specified an invalid popup parent surface
- error_invalid_surface_state = 4, // the client provided an invalid surface state
- error_invalid_positioner = 5, // the client provided an invalid positioner
- };
-
- void send_ping(uint32_t serial);
- void send_ping(struct ::wl_resource *resource, uint32_t serial);
-
- protected:
- virtual Resource *zxdg_shell_v6_allocate();
-
- virtual void zxdg_shell_v6_bind_resource(Resource *resource);
- virtual void zxdg_shell_v6_destroy_resource(Resource *resource);
-
- virtual void zxdg_shell_v6_destroy(Resource *resource);
- virtual void zxdg_shell_v6_create_positioner(Resource *resource, uint32_t id);
- virtual void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void zxdg_shell_v6_pong(Resource *resource, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zxdg_shell_v6_interface m_zxdg_shell_v6_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_create_positioner(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_get_xdg_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_pong(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zxdg_shell_v6 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class zxdg_positioner_v6
- {
- public:
- zxdg_positioner_v6(struct ::wl_client *client, uint32_t id, int version);
- zxdg_positioner_v6(struct ::wl_display *display, int version);
- zxdg_positioner_v6(struct ::wl_resource *resource);
- zxdg_positioner_v6();
-
- virtual ~zxdg_positioner_v6();
-
- class Resource
- {
- public:
- Resource() : zxdg_positioner_v6_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zxdg_positioner_v6 *zxdg_positioner_v6_object;
- zxdg_positioner_v6 *object() { return zxdg_positioner_v6_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_input = 0, // invalid input provided
- };
-
- enum anchor {
- anchor_none = 0, // the center of the anchor rectangle
- anchor_top = 1, // the top edge of the anchor rectangle
- anchor_bottom = 2, // the bottom edge of the anchor rectangle
- anchor_left = 4, // the left edge of the anchor rectangle
- anchor_right = 8, // the right edge of the anchor rectangle
- };
-
- enum gravity {
- gravity_none = 0, // center over the anchor edge
- gravity_top = 1, // position above the anchor edge
- gravity_bottom = 2, // position below the anchor edge
- gravity_left = 4, // position to the left of the anchor edge
- gravity_right = 8, // position to the right of the anchor edge
- };
-
- enum constraint_adjustment {
- constraint_adjustment_none = 0,
- constraint_adjustment_slide_x = 1,
- constraint_adjustment_slide_y = 2,
- constraint_adjustment_flip_x = 4,
- constraint_adjustment_flip_y = 8,
- constraint_adjustment_resize_x = 16,
- constraint_adjustment_resize_y = 32,
- };
-
- protected:
- virtual Resource *zxdg_positioner_v6_allocate();
-
- virtual void zxdg_positioner_v6_bind_resource(Resource *resource);
- virtual void zxdg_positioner_v6_destroy_resource(Resource *resource);
-
- virtual void zxdg_positioner_v6_destroy(Resource *resource);
- virtual void zxdg_positioner_v6_set_size(Resource *resource, int32_t width, int32_t height);
- virtual void zxdg_positioner_v6_set_anchor_rect(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- virtual void zxdg_positioner_v6_set_anchor(Resource *resource, uint32_t anchor);
- virtual void zxdg_positioner_v6_set_gravity(Resource *resource, uint32_t gravity);
- virtual void zxdg_positioner_v6_set_constraint_adjustment(Resource *resource, uint32_t constraint_adjustment);
- virtual void zxdg_positioner_v6_set_offset(Resource *resource, int32_t x, int32_t y);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zxdg_positioner_v6_interface m_zxdg_positioner_v6_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height);
- static void handle_set_anchor_rect(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- static void handle_set_anchor(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t anchor);
- static void handle_set_gravity(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t gravity);
- static void handle_set_constraint_adjustment(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t constraint_adjustment);
- static void handle_set_offset(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zxdg_positioner_v6 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class zxdg_surface_v6
- {
- public:
- zxdg_surface_v6(struct ::wl_client *client, uint32_t id, int version);
- zxdg_surface_v6(struct ::wl_display *display, int version);
- zxdg_surface_v6(struct ::wl_resource *resource);
- zxdg_surface_v6();
-
- virtual ~zxdg_surface_v6();
-
- class Resource
- {
- public:
- Resource() : zxdg_surface_v6_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zxdg_surface_v6 *zxdg_surface_v6_object;
- zxdg_surface_v6 *object() { return zxdg_surface_v6_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_not_constructed = 1,
- error_already_constructed = 2,
- error_unconfigured_buffer = 3,
- };
-
- void send_configure(uint32_t serial);
- void send_configure(struct ::wl_resource *resource, uint32_t serial);
-
- protected:
- virtual Resource *zxdg_surface_v6_allocate();
-
- virtual void zxdg_surface_v6_bind_resource(Resource *resource);
- virtual void zxdg_surface_v6_destroy_resource(Resource *resource);
-
- virtual void zxdg_surface_v6_destroy(Resource *resource);
- virtual void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id);
- virtual void zxdg_surface_v6_get_popup(Resource *resource, uint32_t id, struct ::wl_resource *parent, struct ::wl_resource *positioner);
- virtual void zxdg_surface_v6_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- virtual void zxdg_surface_v6_ack_configure(Resource *resource, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zxdg_surface_v6_interface m_zxdg_surface_v6_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_get_toplevel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_get_popup(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *parent,
- struct ::wl_resource *positioner);
- static void handle_set_window_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- static void handle_ack_configure(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zxdg_surface_v6 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class zxdg_toplevel_v6
- {
- public:
- zxdg_toplevel_v6(struct ::wl_client *client, uint32_t id, int version);
- zxdg_toplevel_v6(struct ::wl_display *display, int version);
- zxdg_toplevel_v6(struct ::wl_resource *resource);
- zxdg_toplevel_v6();
-
- virtual ~zxdg_toplevel_v6();
-
- class Resource
- {
- public:
- Resource() : zxdg_toplevel_v6_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zxdg_toplevel_v6 *zxdg_toplevel_v6_object;
- zxdg_toplevel_v6 *object() { return zxdg_toplevel_v6_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum resize_edge {
- resize_edge_none = 0,
- resize_edge_top = 1,
- resize_edge_bottom = 2,
- resize_edge_left = 4,
- resize_edge_top_left = 5,
- resize_edge_bottom_left = 6,
- resize_edge_right = 8,
- resize_edge_top_right = 9,
- resize_edge_bottom_right = 10,
- };
-
- enum state {
- state_maximized = 1, // the surface is maximized
- state_fullscreen = 2, // the surface is fullscreen
- state_resizing = 3, // the surface is being resized
- state_activated = 4, // the surface is now activated
- };
-
- void send_configure(int32_t width, int32_t height, struct ::wl_array *states);
- void send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, struct ::wl_array *states);
- void send_close();
- void send_close(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *zxdg_toplevel_v6_allocate();
-
- virtual void zxdg_toplevel_v6_bind_resource(Resource *resource);
- virtual void zxdg_toplevel_v6_destroy_resource(Resource *resource);
-
- virtual void zxdg_toplevel_v6_destroy(Resource *resource);
- virtual void zxdg_toplevel_v6_set_parent(Resource *resource, struct ::wl_resource *parent);
- virtual void zxdg_toplevel_v6_set_title(Resource *resource, const std::string &title);
- virtual void zxdg_toplevel_v6_set_app_id(Resource *resource, const std::string &app_id);
- virtual void zxdg_toplevel_v6_show_window_menu(Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y);
- virtual void zxdg_toplevel_v6_move(Resource *resource, struct ::wl_resource *seat, uint32_t serial);
- virtual void zxdg_toplevel_v6_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges);
- virtual void zxdg_toplevel_v6_set_max_size(Resource *resource, int32_t width, int32_t height);
- virtual void zxdg_toplevel_v6_set_min_size(Resource *resource, int32_t width, int32_t height);
- virtual void zxdg_toplevel_v6_set_maximized(Resource *resource);
- virtual void zxdg_toplevel_v6_unset_maximized(Resource *resource);
- virtual void zxdg_toplevel_v6_set_fullscreen(Resource *resource, struct ::wl_resource *output);
- virtual void zxdg_toplevel_v6_unset_fullscreen(Resource *resource);
- virtual void zxdg_toplevel_v6_set_minimized(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zxdg_toplevel_v6_interface m_zxdg_toplevel_v6_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *parent);
- static void handle_set_title(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *title);
- static void handle_set_app_id(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id);
- static void handle_show_window_menu(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y);
- static void handle_move(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial);
- static void handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- uint32_t edges);
- static void handle_set_max_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height);
- static void handle_set_min_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height);
- static void handle_set_maximized(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_unset_maximized(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output);
- static void handle_unset_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_minimized(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zxdg_toplevel_v6 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class zxdg_popup_v6
- {
- public:
- zxdg_popup_v6(struct ::wl_client *client, uint32_t id, int version);
- zxdg_popup_v6(struct ::wl_display *display, int version);
- zxdg_popup_v6(struct ::wl_resource *resource);
- zxdg_popup_v6();
-
- virtual ~zxdg_popup_v6();
-
- class Resource
- {
- public:
- Resource() : zxdg_popup_v6_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- zxdg_popup_v6 *zxdg_popup_v6_object;
- zxdg_popup_v6 *object() { return zxdg_popup_v6_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_grab = 0, // tried to grab after being mapped
- };
-
- void send_configure(int32_t x, int32_t y, int32_t width, int32_t height);
- void send_configure(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- void send_popup_done();
- void send_popup_done(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *zxdg_popup_v6_allocate();
-
- virtual void zxdg_popup_v6_bind_resource(Resource *resource);
- virtual void zxdg_popup_v6_destroy_resource(Resource *resource);
-
- virtual void zxdg_popup_v6_destroy(Resource *resource);
- virtual void zxdg_popup_v6_grab(Resource *resource, struct ::wl_resource *seat, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::zxdg_popup_v6_interface m_zxdg_popup_v6_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_grab(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- zxdg_popup_v6 *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/xdg-shell.xml */
-
-#include "dswayland-server-xdg-shell.h"
-
-#ifndef DS_UNLIKELY
-#define DS_UNLIKELY(X) X
-#endif
-#ifndef DS_UNUSED
-#define DS_UNUSED(X) (void)X
-#endif
-#ifndef DS_ASSERT
-#define DS_ASSERT(COND) assert(COND)
-#endif
-#ifndef DS_ASSERT_X
-#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \
- do {\
- if (! (COND))\
- {\
- fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\
- assert(COND);\
- }\
- } while(0)
-#endif
-#ifndef WRN
-#define WRN(X...) fprintf(stderr,##X)
-#endif
-
-namespace DSWaylandServer {
- xdg_wm_base::xdg_wm_base(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- xdg_wm_base::xdg_wm_base(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- xdg_wm_base::xdg_wm_base(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- xdg_wm_base::xdg_wm_base()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- xdg_wm_base::~xdg_wm_base()
- {
- std::multimap<struct ::wl_client*, xdg_wm_base::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- xdg_wm_base::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void xdg_wm_base::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void xdg_wm_base::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- xdg_wm_base::Resource *xdg_wm_base::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- xdg_wm_base::Resource *xdg_wm_base::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void xdg_wm_base::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::xdg_wm_base_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = xdg_wm_base::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *xdg_wm_base::interface()
- {
- return &::xdg_wm_base_interface;
- }
-
- xdg_wm_base::Resource *xdg_wm_base::xdg_wm_base_allocate()
- {
- return new Resource;
- }
-
- void xdg_wm_base::xdg_wm_base_bind_resource(Resource *)
- {
- }
-
- void xdg_wm_base::xdg_wm_base_destroy_resource(Resource *)
- {
- }
-
- void xdg_wm_base::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- xdg_wm_base *that = static_cast<xdg_wm_base *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void xdg_wm_base::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- xdg_wm_base *that = static_cast<xdg_wm_base::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void xdg_wm_base::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- xdg_wm_base *that = resource->xdg_wm_base_object;
- that->m_resource_map.erase(resource->client());
- that->xdg_wm_base_destroy_resource(resource);
- delete resource;
- }
-
- xdg_wm_base::Resource *xdg_wm_base::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::xdg_wm_base_interface, version, id);
- return bind(handle);
- }
-
- xdg_wm_base::Resource *xdg_wm_base::bind(struct ::wl_resource *handle)
- {
- Resource *resource = xdg_wm_base_allocate();
- resource->xdg_wm_base_object = this;
-
- wl_resource_set_implementation(handle, &m_xdg_wm_base_interface, resource, destroy_func);
- resource->handle = handle;
- xdg_wm_base_bind_resource(resource);
- return resource;
- }
- xdg_wm_base::Resource *xdg_wm_base::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::xdg_wm_base_interface, &m_xdg_wm_base_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::xdg_wm_base_interface xdg_wm_base::m_xdg_wm_base_interface = {
- xdg_wm_base::handle_destroy,
- xdg_wm_base::handle_create_positioner,
- xdg_wm_base::handle_get_xdg_surface,
- xdg_wm_base::handle_pong
- };
-
- void xdg_wm_base::xdg_wm_base_destroy(Resource *)
- {
- }
-
- void xdg_wm_base::xdg_wm_base_create_positioner(Resource *, uint32_t)
- {
- }
-
- void xdg_wm_base::xdg_wm_base_get_xdg_surface(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void xdg_wm_base::xdg_wm_base_pong(Resource *, uint32_t )
- {
- }
-
-
- void xdg_wm_base::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_wm_base *>(r->xdg_wm_base_object)->xdg_wm_base_destroy(
- r);
- }
-
- void xdg_wm_base::handle_create_positioner(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_wm_base *>(r->xdg_wm_base_object)->xdg_wm_base_create_positioner(
- r,
- id);
- }
-
- void xdg_wm_base::handle_get_xdg_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_wm_base *>(r->xdg_wm_base_object)->xdg_wm_base_get_xdg_surface(
- r,
- id,
- surface);
- }
-
- void xdg_wm_base::handle_pong(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_wm_base *>(r->xdg_wm_base_object)->xdg_wm_base_pong(
- r,
- serial);
- }
-
- void xdg_wm_base::send_ping(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "xdg_wm_base::ping", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call xdg_wm_base::ping as it's not initialised");
- return;
- }
- send_ping(
- m_resource->handle,
- serial);
- }
-
- void xdg_wm_base::send_ping(struct ::wl_resource *resource, uint32_t serial)
- {
- xdg_wm_base_send_ping(
- resource,
- serial);
- }
-
-
- xdg_positioner::xdg_positioner(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- xdg_positioner::xdg_positioner(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- xdg_positioner::xdg_positioner(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- xdg_positioner::xdg_positioner()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- xdg_positioner::~xdg_positioner()
- {
- std::multimap<struct ::wl_client*, xdg_positioner::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- xdg_positioner::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void xdg_positioner::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void xdg_positioner::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- xdg_positioner::Resource *xdg_positioner::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- xdg_positioner::Resource *xdg_positioner::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void xdg_positioner::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::xdg_positioner_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = xdg_positioner::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *xdg_positioner::interface()
- {
- return &::xdg_positioner_interface;
- }
-
- xdg_positioner::Resource *xdg_positioner::xdg_positioner_allocate()
- {
- return new Resource;
- }
-
- void xdg_positioner::xdg_positioner_bind_resource(Resource *)
- {
- }
-
- void xdg_positioner::xdg_positioner_destroy_resource(Resource *)
- {
- }
-
- void xdg_positioner::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- xdg_positioner *that = static_cast<xdg_positioner *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void xdg_positioner::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- xdg_positioner *that = static_cast<xdg_positioner::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void xdg_positioner::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- xdg_positioner *that = resource->xdg_positioner_object;
- that->m_resource_map.erase(resource->client());
- that->xdg_positioner_destroy_resource(resource);
- delete resource;
- }
-
- xdg_positioner::Resource *xdg_positioner::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::xdg_positioner_interface, version, id);
- return bind(handle);
- }
-
- xdg_positioner::Resource *xdg_positioner::bind(struct ::wl_resource *handle)
- {
- Resource *resource = xdg_positioner_allocate();
- resource->xdg_positioner_object = this;
-
- wl_resource_set_implementation(handle, &m_xdg_positioner_interface, resource, destroy_func);
- resource->handle = handle;
- xdg_positioner_bind_resource(resource);
- return resource;
- }
- xdg_positioner::Resource *xdg_positioner::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::xdg_positioner_interface, &m_xdg_positioner_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::xdg_positioner_interface xdg_positioner::m_xdg_positioner_interface = {
- xdg_positioner::handle_destroy,
- xdg_positioner::handle_set_size,
- xdg_positioner::handle_set_anchor_rect,
- xdg_positioner::handle_set_anchor,
- xdg_positioner::handle_set_gravity,
- xdg_positioner::handle_set_constraint_adjustment,
- xdg_positioner::handle_set_offset
- };
-
- void xdg_positioner::xdg_positioner_destroy(Resource *)
- {
- }
-
- void xdg_positioner::xdg_positioner_set_size(Resource *, int32_t , int32_t )
- {
- }
-
- void xdg_positioner::xdg_positioner_set_anchor_rect(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void xdg_positioner::xdg_positioner_set_anchor(Resource *, uint32_t )
- {
- }
-
- void xdg_positioner::xdg_positioner_set_gravity(Resource *, uint32_t )
- {
- }
-
- void xdg_positioner::xdg_positioner_set_constraint_adjustment(Resource *, uint32_t )
- {
- }
-
- void xdg_positioner::xdg_positioner_set_offset(Resource *, int32_t , int32_t )
- {
- }
-
-
- void xdg_positioner::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_positioner *>(r->xdg_positioner_object)->xdg_positioner_destroy(
- r);
- }
-
- void xdg_positioner::handle_set_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_positioner *>(r->xdg_positioner_object)->xdg_positioner_set_size(
- r,
- width,
- height);
- }
-
- void xdg_positioner::handle_set_anchor_rect(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_positioner *>(r->xdg_positioner_object)->xdg_positioner_set_anchor_rect(
- r,
- x,
- y,
- width,
- height);
- }
-
- void xdg_positioner::handle_set_anchor(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t anchor)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_positioner *>(r->xdg_positioner_object)->xdg_positioner_set_anchor(
- r,
- anchor);
- }
-
- void xdg_positioner::handle_set_gravity(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t gravity)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_positioner *>(r->xdg_positioner_object)->xdg_positioner_set_gravity(
- r,
- gravity);
- }
-
- void xdg_positioner::handle_set_constraint_adjustment(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t constraint_adjustment)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_positioner *>(r->xdg_positioner_object)->xdg_positioner_set_constraint_adjustment(
- r,
- constraint_adjustment);
- }
-
- void xdg_positioner::handle_set_offset(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_positioner *>(r->xdg_positioner_object)->xdg_positioner_set_offset(
- r,
- x,
- y);
- }
-
- xdg_surface::xdg_surface(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- xdg_surface::xdg_surface(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- xdg_surface::xdg_surface(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- xdg_surface::xdg_surface()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- xdg_surface::~xdg_surface()
- {
- std::multimap<struct ::wl_client*, xdg_surface::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- xdg_surface::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void xdg_surface::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void xdg_surface::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- xdg_surface::Resource *xdg_surface::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- xdg_surface::Resource *xdg_surface::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void xdg_surface::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::xdg_surface_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = xdg_surface::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *xdg_surface::interface()
- {
- return &::xdg_surface_interface;
- }
-
- xdg_surface::Resource *xdg_surface::xdg_surface_allocate()
- {
- return new Resource;
- }
-
- void xdg_surface::xdg_surface_bind_resource(Resource *)
- {
- }
-
- void xdg_surface::xdg_surface_destroy_resource(Resource *)
- {
- }
-
- void xdg_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- xdg_surface *that = static_cast<xdg_surface *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void xdg_surface::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- xdg_surface *that = static_cast<xdg_surface::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void xdg_surface::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- xdg_surface *that = resource->xdg_surface_object;
- that->m_resource_map.erase(resource->client());
- that->xdg_surface_destroy_resource(resource);
- delete resource;
- }
-
- xdg_surface::Resource *xdg_surface::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::xdg_surface_interface, version, id);
- return bind(handle);
- }
-
- xdg_surface::Resource *xdg_surface::bind(struct ::wl_resource *handle)
- {
- Resource *resource = xdg_surface_allocate();
- resource->xdg_surface_object = this;
-
- wl_resource_set_implementation(handle, &m_xdg_surface_interface, resource, destroy_func);
- resource->handle = handle;
- xdg_surface_bind_resource(resource);
- return resource;
- }
- xdg_surface::Resource *xdg_surface::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::xdg_surface_interface, &m_xdg_surface_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::xdg_surface_interface xdg_surface::m_xdg_surface_interface = {
- xdg_surface::handle_destroy,
- xdg_surface::handle_get_toplevel,
- xdg_surface::handle_get_popup,
- xdg_surface::handle_set_window_geometry,
- xdg_surface::handle_ack_configure
- };
-
- void xdg_surface::xdg_surface_destroy(Resource *)
- {
- }
-
- void xdg_surface::xdg_surface_get_toplevel(Resource *, uint32_t)
- {
- }
-
- void xdg_surface::xdg_surface_get_popup(Resource *, uint32_t, struct ::wl_resource *, struct ::wl_resource *)
- {
- }
-
- void xdg_surface::xdg_surface_set_window_geometry(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void xdg_surface::xdg_surface_ack_configure(Resource *, uint32_t )
- {
- }
-
-
- void xdg_surface::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface *>(r->xdg_surface_object)->xdg_surface_destroy(
- r);
- }
-
- void xdg_surface::handle_get_toplevel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface *>(r->xdg_surface_object)->xdg_surface_get_toplevel(
- r,
- id);
- }
-
- void xdg_surface::handle_get_popup(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *parent,
- struct ::wl_resource *positioner)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface *>(r->xdg_surface_object)->xdg_surface_get_popup(
- r,
- id,
- parent,
- positioner);
- }
-
- void xdg_surface::handle_set_window_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface *>(r->xdg_surface_object)->xdg_surface_set_window_geometry(
- r,
- x,
- y,
- width,
- height);
- }
-
- void xdg_surface::handle_ack_configure(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface *>(r->xdg_surface_object)->xdg_surface_ack_configure(
- r,
- serial);
- }
-
- void xdg_surface::send_configure(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "xdg_surface::configure", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call xdg_surface::configure as it's not initialised");
- return;
- }
- send_configure(
- m_resource->handle,
- serial);
- }
-
- void xdg_surface::send_configure(struct ::wl_resource *resource, uint32_t serial)
- {
- xdg_surface_send_configure(
- resource,
- serial);
- }
-
-
- xdg_toplevel::xdg_toplevel(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- xdg_toplevel::xdg_toplevel(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- xdg_toplevel::xdg_toplevel(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- xdg_toplevel::xdg_toplevel()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- xdg_toplevel::~xdg_toplevel()
- {
- std::multimap<struct ::wl_client*, xdg_toplevel::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- xdg_toplevel::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void xdg_toplevel::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void xdg_toplevel::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- xdg_toplevel::Resource *xdg_toplevel::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- xdg_toplevel::Resource *xdg_toplevel::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void xdg_toplevel::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::xdg_toplevel_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = xdg_toplevel::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *xdg_toplevel::interface()
- {
- return &::xdg_toplevel_interface;
- }
-
- xdg_toplevel::Resource *xdg_toplevel::xdg_toplevel_allocate()
- {
- return new Resource;
- }
-
- void xdg_toplevel::xdg_toplevel_bind_resource(Resource *)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_destroy_resource(Resource *)
- {
- }
-
- void xdg_toplevel::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- xdg_toplevel *that = static_cast<xdg_toplevel *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void xdg_toplevel::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- xdg_toplevel *that = static_cast<xdg_toplevel::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void xdg_toplevel::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- xdg_toplevel *that = resource->xdg_toplevel_object;
- that->m_resource_map.erase(resource->client());
- that->xdg_toplevel_destroy_resource(resource);
- delete resource;
- }
-
- xdg_toplevel::Resource *xdg_toplevel::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::xdg_toplevel_interface, version, id);
- return bind(handle);
- }
-
- xdg_toplevel::Resource *xdg_toplevel::bind(struct ::wl_resource *handle)
- {
- Resource *resource = xdg_toplevel_allocate();
- resource->xdg_toplevel_object = this;
-
- wl_resource_set_implementation(handle, &m_xdg_toplevel_interface, resource, destroy_func);
- resource->handle = handle;
- xdg_toplevel_bind_resource(resource);
- return resource;
- }
- xdg_toplevel::Resource *xdg_toplevel::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::xdg_toplevel_interface, &m_xdg_toplevel_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::xdg_toplevel_interface xdg_toplevel::m_xdg_toplevel_interface = {
- xdg_toplevel::handle_destroy,
- xdg_toplevel::handle_set_parent,
- xdg_toplevel::handle_set_title,
- xdg_toplevel::handle_set_app_id,
- xdg_toplevel::handle_show_window_menu,
- xdg_toplevel::handle_move,
- xdg_toplevel::handle_resize,
- xdg_toplevel::handle_set_max_size,
- xdg_toplevel::handle_set_min_size,
- xdg_toplevel::handle_set_maximized,
- xdg_toplevel::handle_unset_maximized,
- xdg_toplevel::handle_set_fullscreen,
- xdg_toplevel::handle_unset_fullscreen,
- xdg_toplevel::handle_set_minimized
- };
-
- void xdg_toplevel::xdg_toplevel_destroy(Resource *)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_set_parent(Resource *, struct ::wl_resource *)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_set_title(Resource *, const std::string &)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_set_app_id(Resource *, const std::string &)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_show_window_menu(Resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t )
- {
- }
-
- void xdg_toplevel::xdg_toplevel_move(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void xdg_toplevel::xdg_toplevel_resize(Resource *, struct ::wl_resource *, uint32_t , uint32_t )
- {
- }
-
- void xdg_toplevel::xdg_toplevel_set_max_size(Resource *, int32_t , int32_t )
- {
- }
-
- void xdg_toplevel::xdg_toplevel_set_min_size(Resource *, int32_t , int32_t )
- {
- }
-
- void xdg_toplevel::xdg_toplevel_set_maximized(Resource *)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_unset_maximized(Resource *)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_set_fullscreen(Resource *, struct ::wl_resource *)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_unset_fullscreen(Resource *)
- {
- }
-
- void xdg_toplevel::xdg_toplevel_set_minimized(Resource *)
- {
- }
-
-
- void xdg_toplevel::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_destroy(
- r);
- }
-
- void xdg_toplevel::handle_set_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *parent)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_set_parent(
- r,
- parent);
- }
-
- void xdg_toplevel::handle_set_title(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *title)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_set_title(
- r,
- std::string(title));
- }
-
- void xdg_toplevel::handle_set_app_id(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_set_app_id(
- r,
- std::string(app_id));
- }
-
- void xdg_toplevel::handle_show_window_menu(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_show_window_menu(
- r,
- seat,
- serial,
- x,
- y);
- }
-
- void xdg_toplevel::handle_move(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_move(
- r,
- seat,
- serial);
- }
-
- void xdg_toplevel::handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- uint32_t edges)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_resize(
- r,
- seat,
- serial,
- edges);
- }
-
- void xdg_toplevel::handle_set_max_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_set_max_size(
- r,
- width,
- height);
- }
-
- void xdg_toplevel::handle_set_min_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_set_min_size(
- r,
- width,
- height);
- }
-
- void xdg_toplevel::handle_set_maximized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_set_maximized(
- r);
- }
-
- void xdg_toplevel::handle_unset_maximized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_unset_maximized(
- r);
- }
-
- void xdg_toplevel::handle_set_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_set_fullscreen(
- r,
- output);
- }
-
- void xdg_toplevel::handle_unset_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_unset_fullscreen(
- r);
- }
-
- void xdg_toplevel::handle_set_minimized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_toplevel *>(r->xdg_toplevel_object)->xdg_toplevel_set_minimized(
- r);
- }
-
- void xdg_toplevel::send_configure(int32_t width, int32_t height, struct ::wl_array *states)
- {
- DS_ASSERT_X(m_resource, "xdg_toplevel::configure", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call xdg_toplevel::configure as it's not initialised");
- return;
- }
- send_configure(
- m_resource->handle,
- width,
- height,
- states);
- }
-
- void xdg_toplevel::send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, struct ::wl_array *states)
- {
- xdg_toplevel_send_configure(
- resource,
- width,
- height,
- states);
- }
-
-
- void xdg_toplevel::send_close()
- {
- DS_ASSERT_X(m_resource, "xdg_toplevel::close", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call xdg_toplevel::close as it's not initialised");
- return;
- }
- send_close(
- m_resource->handle);
- }
-
- void xdg_toplevel::send_close(struct ::wl_resource *resource)
- {
- xdg_toplevel_send_close(
- resource);
- }
-
-
- xdg_popup::xdg_popup(struct ::wl_client *client, uint32_t id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(client, id, version);
- }
-
- xdg_popup::xdg_popup(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(display, version);
- }
-
- xdg_popup::xdg_popup(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- init(resource);
- }
-
- xdg_popup::xdg_popup()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- , m_globalVersion(0)
- , m_displayDestroyedListener()
- {
- }
-
- xdg_popup::~xdg_popup()
- {
- std::multimap<struct ::wl_client*, xdg_popup::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- xdg_popup::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void xdg_popup::init(struct ::wl_client *client, uint32_t id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void xdg_popup::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- xdg_popup::Resource *xdg_popup::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- xdg_popup::Resource *xdg_popup::add(struct ::wl_client *client, uint32_t id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void xdg_popup::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::xdg_popup_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = xdg_popup::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *xdg_popup::interface()
- {
- return &::xdg_popup_interface;
- }
-
- xdg_popup::Resource *xdg_popup::xdg_popup_allocate()
- {
- return new Resource;
- }
-
- void xdg_popup::xdg_popup_bind_resource(Resource *)
- {
- }
-
- void xdg_popup::xdg_popup_destroy_resource(Resource *)
- {
- }
-
- void xdg_popup::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- xdg_popup *that = static_cast<xdg_popup *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void xdg_popup::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- xdg_popup *that = static_cast<xdg_popup::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void xdg_popup::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- xdg_popup *that = resource->xdg_popup_object;
- that->m_resource_map.erase(resource->client());
- that->xdg_popup_destroy_resource(resource);
- delete resource;
- }
-
- xdg_popup::Resource *xdg_popup::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::xdg_popup_interface, version, id);
- return bind(handle);
- }
-
- xdg_popup::Resource *xdg_popup::bind(struct ::wl_resource *handle)
- {
- Resource *resource = xdg_popup_allocate();
- resource->xdg_popup_object = this;
-
- wl_resource_set_implementation(handle, &m_xdg_popup_interface, resource, destroy_func);
- resource->handle = handle;
- xdg_popup_bind_resource(resource);
- return resource;
- }
- xdg_popup::Resource *xdg_popup::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::xdg_popup_interface, &m_xdg_popup_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::xdg_popup_interface xdg_popup::m_xdg_popup_interface = {
- xdg_popup::handle_destroy,
- xdg_popup::handle_grab
- };
-
- void xdg_popup::xdg_popup_destroy(Resource *)
- {
- }
-
- void xdg_popup::xdg_popup_grab(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
-
- void xdg_popup::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_popup *>(r->xdg_popup_object)->xdg_popup_destroy(
- r);
- }
-
- void xdg_popup::handle_grab(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_popup *>(r->xdg_popup_object)->xdg_popup_grab(
- r,
- seat,
- serial);
- }
-
- void xdg_popup::send_configure(int32_t x, int32_t y, int32_t width, int32_t height)
- {
- DS_ASSERT_X(m_resource, "xdg_popup::configure", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call xdg_popup::configure as it's not initialised");
- return;
- }
- send_configure(
- m_resource->handle,
- x,
- y,
- width,
- height);
- }
-
- void xdg_popup::send_configure(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
- {
- xdg_popup_send_configure(
- resource,
- x,
- y,
- width,
- height);
- }
-
-
- void xdg_popup::send_popup_done()
- {
- DS_ASSERT_X(m_resource, "xdg_popup::popup_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call xdg_popup::popup_done as it's not initialised");
- return;
- }
- send_popup_done(
- m_resource->handle);
- }
-
- void xdg_popup::send_popup_done(struct ::wl_resource *resource)
- {
- xdg_popup_send_popup_done(
- resource);
- }
-
-}
-
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*LCOV_EXCL_START*/
-/* Protocol XML file : wayland-extension/xdg-shell.xml */
-
-#ifndef __DS_XDG_SHELL_PROTOCOL_H__
-#define __DS_XDG_SHELL_PROTOCOL_H__
-
-#include "wayland-server-core.h"
-#include "xdg-shell-server-protocol.h"
-#include <cstdio>
-#include <cassert>
-#include <string>
-#include <map>
-#include <algorithm>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-
-namespace DSWaylandServer {
- class xdg_wm_base
- {
- public:
- xdg_wm_base(struct ::wl_client *client, uint32_t id, int version);
- xdg_wm_base(struct ::wl_display *display, int version);
- xdg_wm_base(struct ::wl_resource *resource);
- xdg_wm_base();
-
- virtual ~xdg_wm_base();
-
- class Resource
- {
- public:
- Resource() : xdg_wm_base_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- xdg_wm_base *xdg_wm_base_object;
- xdg_wm_base *object() { return xdg_wm_base_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_role = 0, // given wl_surface has another role
- error_defunct_surfaces = 1, // xdg_wm_base was destroyed before children
- error_not_the_topmost_popup = 2, // the client tried to map or destroy a non-topmost popup
- error_invalid_popup_parent = 3, // the client specified an invalid popup parent surface
- error_invalid_surface_state = 4, // the client provided an invalid surface state
- error_invalid_positioner = 5, // the client provided an invalid positioner
- };
-
- void send_ping(uint32_t serial);
- void send_ping(struct ::wl_resource *resource, uint32_t serial);
-
- protected:
- virtual Resource *xdg_wm_base_allocate();
-
- virtual void xdg_wm_base_bind_resource(Resource *resource);
- virtual void xdg_wm_base_destroy_resource(Resource *resource);
-
- virtual void xdg_wm_base_destroy(Resource *resource);
- virtual void xdg_wm_base_create_positioner(Resource *resource, uint32_t id);
- virtual void xdg_wm_base_get_xdg_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void xdg_wm_base_pong(Resource *resource, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::xdg_wm_base_interface m_xdg_wm_base_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_create_positioner(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_get_xdg_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_pong(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- xdg_wm_base *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class xdg_positioner
- {
- public:
- xdg_positioner(struct ::wl_client *client, uint32_t id, int version);
- xdg_positioner(struct ::wl_display *display, int version);
- xdg_positioner(struct ::wl_resource *resource);
- xdg_positioner();
-
- virtual ~xdg_positioner();
-
- class Resource
- {
- public:
- Resource() : xdg_positioner_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- xdg_positioner *xdg_positioner_object;
- xdg_positioner *object() { return xdg_positioner_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_input = 0, // invalid input provided
- };
-
- enum anchor {
- anchor_none = 0,
- anchor_top = 1,
- anchor_bottom = 2,
- anchor_left = 3,
- anchor_right = 4,
- anchor_top_left = 5,
- anchor_bottom_left = 6,
- anchor_top_right = 7,
- anchor_bottom_right = 8,
- };
-
- enum gravity {
- gravity_none = 0,
- gravity_top = 1,
- gravity_bottom = 2,
- gravity_left = 3,
- gravity_right = 4,
- gravity_top_left = 5,
- gravity_bottom_left = 6,
- gravity_top_right = 7,
- gravity_bottom_right = 8,
- };
-
- enum constraint_adjustment {
- constraint_adjustment_none = 0,
- constraint_adjustment_slide_x = 1,
- constraint_adjustment_slide_y = 2,
- constraint_adjustment_flip_x = 4,
- constraint_adjustment_flip_y = 8,
- constraint_adjustment_resize_x = 16,
- constraint_adjustment_resize_y = 32,
- };
-
- protected:
- virtual Resource *xdg_positioner_allocate();
-
- virtual void xdg_positioner_bind_resource(Resource *resource);
- virtual void xdg_positioner_destroy_resource(Resource *resource);
-
- virtual void xdg_positioner_destroy(Resource *resource);
- virtual void xdg_positioner_set_size(Resource *resource, int32_t width, int32_t height);
- virtual void xdg_positioner_set_anchor_rect(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- virtual void xdg_positioner_set_anchor(Resource *resource, uint32_t anchor);
- virtual void xdg_positioner_set_gravity(Resource *resource, uint32_t gravity);
- virtual void xdg_positioner_set_constraint_adjustment(Resource *resource, uint32_t constraint_adjustment);
- virtual void xdg_positioner_set_offset(Resource *resource, int32_t x, int32_t y);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::xdg_positioner_interface m_xdg_positioner_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height);
- static void handle_set_anchor_rect(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- static void handle_set_anchor(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t anchor);
- static void handle_set_gravity(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t gravity);
- static void handle_set_constraint_adjustment(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t constraint_adjustment);
- static void handle_set_offset(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- xdg_positioner *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class xdg_surface
- {
- public:
- xdg_surface(struct ::wl_client *client, uint32_t id, int version);
- xdg_surface(struct ::wl_display *display, int version);
- xdg_surface(struct ::wl_resource *resource);
- xdg_surface();
-
- virtual ~xdg_surface();
-
- class Resource
- {
- public:
- Resource() : xdg_surface_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- xdg_surface *xdg_surface_object;
- xdg_surface *object() { return xdg_surface_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_not_constructed = 1,
- error_already_constructed = 2,
- error_unconfigured_buffer = 3,
- };
-
- void send_configure(uint32_t serial);
- void send_configure(struct ::wl_resource *resource, uint32_t serial);
-
- protected:
- virtual Resource *xdg_surface_allocate();
-
- virtual void xdg_surface_bind_resource(Resource *resource);
- virtual void xdg_surface_destroy_resource(Resource *resource);
-
- virtual void xdg_surface_destroy(Resource *resource);
- virtual void xdg_surface_get_toplevel(Resource *resource, uint32_t id);
- virtual void xdg_surface_get_popup(Resource *resource, uint32_t id, struct ::wl_resource *parent, struct ::wl_resource *positioner);
- virtual void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- virtual void xdg_surface_ack_configure(Resource *resource, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::xdg_surface_interface m_xdg_surface_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_get_toplevel(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id);
- static void handle_get_popup(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *parent,
- struct ::wl_resource *positioner);
- static void handle_set_window_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- static void handle_ack_configure(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- xdg_surface *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class xdg_toplevel
- {
- public:
- xdg_toplevel(struct ::wl_client *client, uint32_t id, int version);
- xdg_toplevel(struct ::wl_display *display, int version);
- xdg_toplevel(struct ::wl_resource *resource);
- xdg_toplevel();
-
- virtual ~xdg_toplevel();
-
- class Resource
- {
- public:
- Resource() : xdg_toplevel_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- xdg_toplevel *xdg_toplevel_object;
- xdg_toplevel *object() { return xdg_toplevel_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum resize_edge {
- resize_edge_none = 0,
- resize_edge_top = 1,
- resize_edge_bottom = 2,
- resize_edge_left = 4,
- resize_edge_top_left = 5,
- resize_edge_bottom_left = 6,
- resize_edge_right = 8,
- resize_edge_top_right = 9,
- resize_edge_bottom_right = 10,
- };
-
- enum state {
- state_maximized = 1, // the surface is maximized
- state_fullscreen = 2, // the surface is fullscreen
- state_resizing = 3, // the surface is being resized
- state_activated = 4, // the surface is now activated
- state_tiled_left = 5,
- state_tiled_right = 6,
- state_tiled_top = 7,
- state_tiled_bottom = 8,
- };
-
- void send_configure(int32_t width, int32_t height, struct ::wl_array *states);
- void send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, struct ::wl_array *states);
- void send_close();
- void send_close(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *xdg_toplevel_allocate();
-
- virtual void xdg_toplevel_bind_resource(Resource *resource);
- virtual void xdg_toplevel_destroy_resource(Resource *resource);
-
- virtual void xdg_toplevel_destroy(Resource *resource);
- virtual void xdg_toplevel_set_parent(Resource *resource, struct ::wl_resource *parent);
- virtual void xdg_toplevel_set_title(Resource *resource, const std::string &title);
- virtual void xdg_toplevel_set_app_id(Resource *resource, const std::string &app_id);
- virtual void xdg_toplevel_show_window_menu(Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y);
- virtual void xdg_toplevel_move(Resource *resource, struct ::wl_resource *seat, uint32_t serial);
- virtual void xdg_toplevel_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges);
- virtual void xdg_toplevel_set_max_size(Resource *resource, int32_t width, int32_t height);
- virtual void xdg_toplevel_set_min_size(Resource *resource, int32_t width, int32_t height);
- virtual void xdg_toplevel_set_maximized(Resource *resource);
- virtual void xdg_toplevel_unset_maximized(Resource *resource);
- virtual void xdg_toplevel_set_fullscreen(Resource *resource, struct ::wl_resource *output);
- virtual void xdg_toplevel_unset_fullscreen(Resource *resource);
- virtual void xdg_toplevel_set_minimized(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::xdg_toplevel_interface m_xdg_toplevel_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *parent);
- static void handle_set_title(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *title);
- static void handle_set_app_id(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id);
- static void handle_show_window_menu(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y);
- static void handle_move(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial);
- static void handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- uint32_t edges);
- static void handle_set_max_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height);
- static void handle_set_min_size(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t width,
- int32_t height);
- static void handle_set_maximized(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_unset_maximized(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output);
- static void handle_unset_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_minimized(
- ::wl_client *client,
- struct wl_resource *resource);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- xdg_toplevel *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class xdg_popup
- {
- public:
- xdg_popup(struct ::wl_client *client, uint32_t id, int version);
- xdg_popup(struct ::wl_display *display, int version);
- xdg_popup(struct ::wl_resource *resource);
- xdg_popup();
-
- virtual ~xdg_popup();
-
- class Resource
- {
- public:
- Resource() : xdg_popup_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- xdg_popup *xdg_popup_object;
- xdg_popup *object() { return xdg_popup_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, uint32_t id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, uint32_t id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum error {
- error_invalid_grab = 0, // tried to grab after being mapped
- };
-
- void send_configure(int32_t x, int32_t y, int32_t width, int32_t height);
- void send_configure(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- void send_popup_done();
- void send_popup_done(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *xdg_popup_allocate();
-
- virtual void xdg_popup_bind_resource(Resource *resource);
- virtual void xdg_popup_destroy_resource(Resource *resource);
-
- virtual void xdg_popup_destroy(Resource *resource);
- virtual void xdg_popup_grab(Resource *resource, struct ::wl_resource *seat, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::xdg_popup_interface m_xdg_popup_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_grab(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- xdg_popup *parent;
- DisplayDestroyedListener(): parent(NULL) {}
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-#endif
-/*LCOV_EXCL_STOP*/
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWindow.h"
-#include "DSWindowPrivate.h"
-#include "DSWaylandSurface.h"
-#include "IDSBuffer.h"
-
-namespace display_server
-{
-
-DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr),
- __parent(nullptr),
- __type(0),
- __x(0),
- __y(0),
- __w(0),
- __h(0),
- __zOrder(0),
- __committedW(0),
- __committedH(0),
- __created(false),
- __hasFocus(false),
- __waylandSurface(nullptr),
- __acceptsFocus(true),
- __allowUserGeometry(false),
- __title(""),
- __vkbd_floating(false),
- __renderView(nullptr),
- __displayDeviceHWCWindow(nullptr)
-{
-}
-
-DSWindowPrivate::~DSWindowPrivate()
-{
-}
-
-bool DSWindowPrivate::create(std::shared_ptr<DSWaylandSurface> waylandSurface)
-{
- __waylandSurface = waylandSurface;
- __created = true;
-
- __waylandSurface->registerCallbackSurfaceCommitted(this, std::bind(&DSWindowPrivate::__onSurfaceCommitted, this, std::placeholders::_1));
-
- return true;
-}
-
-void DSWindowPrivate::destroy(void)
-{
-}
-
-void DSWindowPrivate::setType(int type)
-{
- __type = type;
-}
-
-int DSWindowPrivate::getType(void)
-{
- return __type;
-}
-
-void DSWindowPrivate::setParent(DSWindow *parent)
-{
- __parent = parent;
-}
-
-DSWindow *DSWindowPrivate::getParent(void)
-{
- return __parent;
-}
-
-bool DSWindowPrivate::show(void)
-{
- return true;
-}
-
-bool DSWindowPrivate::hide(bool autoFocus)
-{
- return true;
-}
-
-int DSWindowPrivate::showState(void)
-{
- return 0;
-}
-
-bool DSWindowPrivate::setTitle(const std::string &title)
-{
- __title.replace(__title.begin(), __title.end(), title);
- return true;
-}
-
-const std::string DSWindowPrivate::getTitle(void)
-{
- return __title;
-}
-
-bool DSWindowPrivate::setSkipFocus(bool set)
-{
- __acceptsFocus = !set;
- return true;
-}
-
-bool DSWindowPrivate::getSkipFocus(void)
-{
- if (__acceptsFocus)
- return false;
- else
- return true;
-}
-
-void DSWindowPrivate::allowUserGeometry(bool set)
-{
- __allowUserGeometry = set;
-}
-
-bool DSWindowPrivate::isAllowUserGeometry(void)
-{
- return __allowUserGeometry;
-}
-
-bool DSWindowPrivate::setLayer(int layer)
-{
- return true;
-}
-
-bool DSWindowPrivate::raise(void)
-{
- raiseToTop();
- return true;
-}
-
-bool DSWindowPrivate::lower(void)
-{
- lowerToBottom();
- return true;
-}
-
-bool DSWindowPrivate::raiseToTop()
-{
- if (__renderView)
- __renderView->raiseToTop();
-
- // TODO: set raiseToTop to hwc window ???
- // if (__displayDeviceHWCWindow)
- // __displayDeviceHWCWindow->raiseToTop();
-
- return true;
-}
-
-bool DSWindowPrivate::lowerToBottom()
-{
- if (__renderView)
- __renderView->lowerToBottom();
-
- // TODO: set lowerToBottom to hwc window ???
- // if (__displayDeviceHWCWindow)
- // __displayDeviceHWCWindow->lowerToBottom();
-
- return true;
-}
-
-bool DSWindowPrivate::unsetFocus(void)
-{
- __hasFocus = false;
- return true;
-}
-
-bool DSWindowPrivate::setFocus(void)
-{
- __hasFocus = true;
- return true;
-}
-
-bool DSWindowPrivate::isCreated()
-{
- return __created;
-}
-
-void DSWindowPrivate::setPosition(int x, int y)
-{
- __x = x;
- __y = y;
-
- if (__renderView)
- __renderView->setPosition(x, y);
-
- // TODO: set lowerToBottom to hwc window ???
- // if (__displayDeviceHWCWindow)
- // __displayDeviceHWCWindow->lowerToBottom();
-}
-
-bool DSWindowPrivate::setVkbdFloating(bool set)
-{
- __vkbd_floating = set;
- return true;
-}
-
-bool DSWindowPrivate::getVkbdFloating()
-{
- return __vkbd_floating;
-}
-
-void DSWindowPrivate::setRenderView(std::shared_ptr<DSRenderView> &renderView)
-{
- __renderView = renderView;
-}
-
-void DSWindowPrivate::setDisplayDeviceHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> &displayDeviceHWCWindow)
-{
- __displayDeviceHWCWindow = displayDeviceHWCWindow;
-}
-
-void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo)
-{
- DS_GET_PUB(DSWindow);
-
- if (!waylandSurfaceCommitInfo->bufferChanged())
- return;
-
- std::shared_ptr<IDSBuffer> buffer = waylandSurfaceCommitInfo->getBuffer();
-
- if (__renderView) {
- __renderView->setBuffer(buffer);
- }
-
- //TODO: set the buffer to the hwc window
- // if (__displayDeviceHWCWindow) {
- // __displayDeviceHWCWindow->setBuffer(buffer);
- //}
-
- // TODO: get more information from waylandSurfaceCommitInfo. ex) damageSurface, damageBuffer, transform, scale and so on
-
- // emit a signal of the buffer changed
- pub->__bufferChangedSignal.emit(buffer);
-}
-
-DSWindow::DSWindow()
- : DS_INIT_PRIVATE_PTR(DSWindow)
-{}
-
-DSWindow::DSWindow(std::shared_ptr<DSWaylandSurface> waylandSurface)
- : DS_INIT_PRIVATE_PTR(DSWindow)
-{
- create(waylandSurface);
-}
-
-DSWindow::~DSWindow()
-{
-}
-
-bool DSWindow::create(std::shared_ptr<DSWaylandSurface> waylandSurface)
-{
- DS_GET_PRIV(DSWindow);
-
- if (!priv->isCreated())
- {
- return priv->create(waylandSurface);
- }
-
- return true;
-}
-
-void DSWindow::destroy(void)
-{
- DS_GET_PRIV(DSWindow);
-
- priv->destroy();
-}
-
-void DSWindow::setType(int type)
-{
- DSLOG_DBG("DSWindow", "Set type (%d). DSWindow:%p", type, this);
- DS_GET_PRIV(DSWindow);
- priv->setType(type);
-}
-
-int DSWindow::getType(void)
-{
- DS_GET_PRIV(DSWindow);
- return priv->getType();
-}
-
-void DSWindow::setParent(DSWindow *parent)
-{
- if (parent == this) return;
-
- DS_GET_PRIV(DSWindow);
- priv->setParent(parent);
-}
-
-DSWindow *DSWindow::getParent(void)
-{
- DS_GET_PRIV(DSWindow);
- return priv->getParent();
-}
-
-bool DSWindow::show(void)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->show();
-}
-
-bool DSWindow::hide(bool autoFocus)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->hide(autoFocus);
-}
-
-int DSWindow::showState(void)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->showState();
-}
-
-bool DSWindow::setTitle(const std::string &title)
-{
- DSLOG_DBG("DSWindow", "title:%s. DSWindow:%p", title.c_str(), this);
-
- DS_GET_PRIV(DSWindow);
- return priv->setTitle(title);
-}
-
-const std::string DSWindow::getTitle(void)
-{
- DS_GET_PRIV(DSWindow);
- return priv->getTitle();
-}
-
-bool DSWindow::setSkipFocus(bool set)
-{
- DS_GET_PRIV(DSWindow);
- return priv->setSkipFocus(set);
-}
-
-bool DSWindow::getSkipFocus(void)
-{
- DS_GET_PRIV(DSWindow);
- return priv->getSkipFocus();
-}
-
-void DSWindow::allowUserGeometry(bool set)
-{
- DS_GET_PRIV(DSWindow);
- priv->allowUserGeometry(set);
-}
-
-bool DSWindow::isAllowUserGeometry(void)
-{
- DS_GET_PRIV(DSWindow);
- return priv->isAllowUserGeometry();
-}
-
-bool DSWindow::setLayer(int layer)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->setLayer(layer);
-}
-
-bool DSWindow::raise(void)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->raise();
-}
-
-bool DSWindow::lower(void)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->lower();
-}
-
-bool DSWindow::raiseToTop()
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->raiseToTop();
-}
-
-bool DSWindow::lowerToBottom()
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->lowerToBottom();
-}
-
-bool DSWindow::unsetFocus(void)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->unsetFocus();
-}
-
-bool DSWindow::setFocus(void)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->setFocus();
-}
-
-bool DSWindow::hasFocus(void)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->__hasFocus;
-}
-
-void DSWindow::setPosition(int x, int y)
-{
- DS_GET_PRIV(DSWindow);
-
- priv->setPosition(x, y);
-}
-
-stPosition DSWindow::getPosition(void)
-{
- DS_GET_PRIV(DSWindow);
-
- stPosition pos;
- pos.x = priv->__x;
- pos.y = priv->__y;
-
- return pos;
-}
-
-stSize DSWindow::getSize()
-{
- DS_GET_PRIV(DSWindow);
-
- stSize size;
- size.w = priv->__w;
- size.h = priv->__h;
-
- return size;
-}
-
-void DSWindow::setSize(unsigned int w, unsigned int h)
-{
- DS_GET_PRIV(DSWindow);
-
- priv->__w = w;
- priv->__h = h;
-}
-
-void DSWindow::setSize(stSize size)
-{
- DS_GET_PRIV(DSWindow);
-
- priv->__w = size.w;
- priv->__h = size.h;
-}
-
-void DSWindow::setZOrder(unsigned int zOrder)
-{
- DS_GET_PRIV(DSWindow);
-
- priv->__zOrder = zOrder;
-}
-
-unsigned int DSWindow::getZOrder()
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->__zOrder;
-}
-
-bool DSWindow::setVkbdFloating(bool set)
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->setVkbdFloating(set);
-}
-
-bool DSWindow::getVkbdFloating()
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->getVkbdFloating();
-}
-
-DSWaylandSurface *DSWindow::surface()
-{
- DS_GET_PRIV(DSWindow);
-
- return priv->__waylandSurface.get();
-}
-
-void DSWindow::setRenderView(std::shared_ptr<DSRenderView> &renderView)
-{
- DS_GET_PRIV(DSWindow);
-
- priv->setRenderView(renderView);
-}
-
-void DSWindow::setDisplayDeviceHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> &displayDeviceHWCWindow)
-{
- DS_GET_PRIV(DSWindow);
-
- priv->setDisplayDeviceHWCWindow(displayDeviceHWCWindow);
-}
-
-void DSWindow::registerCallbackBufferChanged(DSObject *slot, std::function<void(std::shared_ptr<IDSBuffer>)> func)
-{
- __bufferChangedSignal.connect(slot, func);
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WINDOW_H_
-#define _DS_WINDOW_H_
-
-#include "DSCore.h"
-#include "DSStruct.h"
-#include "DSObject.h"
-#include "DSSignal.h"
-#include "IDSBuffer.h"
-#include "DSRenderView.h"
-#include "IDSDisplayDeviceHWCWindow.h"
-
-namespace display_server
-{
-
-class DSWindowPrivate;
-class DSWaylandSurface;
-
-class DSWindow : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(DSWindow)
-
-public:
- explicit DSWindow();
- DSWindow(std::shared_ptr<DSWaylandSurface> waylandSurface);
- virtual ~DSWindow();
-
- bool create(std::shared_ptr<DSWaylandSurface> waylandSurface);
- void destroy(void);
-
- void setType(int type);
- int getType(void);
-
- void setParent(DSWindow *parent);
- DSWindow *getParent(void);
-
- bool show(void);
- bool hide(bool autoFocus = true);
- int showState(void);
-
- bool setTitle(const std::string &title);
- const std::string getTitle(void);
-
- bool setSkipFocus(bool set);
- bool getSkipFocus(void);
-
- void allowUserGeometry(bool set);
- bool isAllowUserGeometry(void);
-
- bool setLayer(int layer);
- bool raise(void);
- bool lower(void);
- bool raiseToTop();
- bool lowerToBottom();
-
- bool unsetFocus(void);
- bool setFocus(void);
- bool hasFocus(void);
-
- void setPosition(int x, int y);
- stPosition getPosition(void);
-
- stSize getSize(void);
- void setSize(unsigned int w, unsigned int h);
- void setSize(stSize size);
-
- void setZOrder(unsigned int zOrder);
- unsigned int getZOrder();
-
- bool setVkbdFloating(bool set);
- bool getVkbdFloating();
-
- DSWaylandSurface *surface();
-
- void setRenderView(std::shared_ptr<DSRenderView> &renderView);
- void setDisplayDeviceHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> &displayDeviceHWCWindow);
-
- void registerCallbackBufferChanged(DSObject *slot, std::function<void(std::shared_ptr<IDSBuffer>)> func);
-
-protected:
- //virtual bool _onFocus(void);
- //virtual bool _onShowStateChange(void);
-
-private:
- // signals
- DSSignal<std::shared_ptr<IDSBuffer>> __bufferChangedSignal;
-};
-
-}
-
-#endif // _DS_WINDOW_H_
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WINDOW_PRIVATE_H_
-#define _DS_WINDOW_PRIVATE_H_
-
-#include "DSCore.h"
-#include "DSObjectPrivate.h"
-#include "DSWaylandSurface.h"
-#include "DSRenderView.h"
-#include "IDSDisplayDeviceHWCWindow.h"
-
-namespace display_server
-{
-
-class DSWindow;
-
-class DSWindowPrivate : public DSObjectPrivate, public DSObject
-{
- DS_PIMPL_USE_PUBLIC(DSWindow)
-
-public:
- DSWindowPrivate() = delete;
- DSWindowPrivate(DSWindow *p_ptr);
- ~DSWindowPrivate();
-
- bool create(std::shared_ptr<DSWaylandSurface> waylandSurface);
- void destroy(void);
-
- void setType(int type);
- int getType(void);
-
- void setParent(DSWindow *parent);
- DSWindow *getParent(void);
-
- bool show(void);
- bool hide(bool autoFocus);
- int showState(void);
-
- bool setTitle(const std::string &title);
- const std::string getTitle(void);
-
- bool setSkipFocus(bool set);
- bool getSkipFocus(void);
-
- void allowUserGeometry(bool set);
- bool isAllowUserGeometry(void);
-
- bool setLayer(int layer);
- bool raise(void);
- bool lower(void);
- bool raiseToTop();
- bool lowerToBottom();
-
- bool unsetFocus(void);
- bool setFocus(void);
- bool isCreated();
-
- void setPosition(int x, int y);
-
- bool setVkbdFloating(bool set);
- bool getVkbdFloating();
-
- void setRenderView(std::shared_ptr<DSRenderView> &renderView);
- void setDisplayDeviceHWCWindow(std::shared_ptr<IDSDisplayDeviceHWCWindow> &displayDeviceHWCWindow);
-
-private:
- void __onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo);
-
- DSWindow *__parent;
- std::list<DSWindow*> __childList;
- int __type;
- int __x, __y;
- unsigned int __w;
- unsigned int __h;
- unsigned int __zOrder;
- unsigned int __committedW, __committedH;
- bool __created;
- bool __hasFocus;
- std::shared_ptr<DSWaylandSurface> __waylandSurface;
- bool __acceptsFocus;
- bool __allowUserGeometry;
- std::string __title;
-
- bool __vkbd_floating;
-
- std::shared_ptr<DSRenderView> __renderView;
- std::shared_ptr<IDSDisplayDeviceHWCWindow> __displayDeviceHWCWindow;
-};
-
-}
-
-#endif // _DS_WINDOW_PRIVATE_H_
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWindowManager.h"
-#include "DSWindowManagerPrivate.h"
-#include "DSZone.h"
-#include "DSWindow.h"
-#include "DSWaylandSurface.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-/* reference count, mutex and compositor pointer for DSWindowManager singleton */
-int DSWindowManager::__refCount { 0 };
-std::mutex DSWindowManager::__mutex;
-DSWindowManager* DSWindowManager::__windowMgr { nullptr };
-
-DSWindowManagerPrivate::DSWindowManagerPrivate(DSWindowManager *p_ptr)
- : DSObjectPrivate(p_ptr),
- __p_ptr(p_ptr)
-{
-}
-
-DSWindowManagerPrivate::~DSWindowManagerPrivate()
-{
-}
-
-DSZone *DSWindowManagerPrivate::__getZone(DSWindow *window)
-{
- auto it = __zoneWinMap.find(window);
- if (it != __zoneWinMap.end())
- return it->second;
-
- return nullptr;
-}
-
-DSZone *DSWindowManagerPrivate::__getZone(DSWaylandSurface *surface)
-{
- auto it = __zoneSurfaceMap.find(surface);
- if (it != __zoneSurfaceMap.end())
- return it->second;
-
- return nullptr;
-}
-
-bool DSWindowManagerPrivate::__checkZone(DSZone *zone)
-{
- std::list<DSZone *> zList = __zoneList;
- for (DSZone *z : zList)
- {
- if (z == zone)
- {
- return true;
- }
- }
-
- return false;
-}
-
-void DSWindowManagerPrivate::__registerZone(DSZone *zone)
-{
- __zoneList.push_front(zone);
-}
-
-bool DSWindowManagerPrivate::registerZone(DSZone *zone)
-{
- // find zone in zone List
- if (__checkZone(zone))
- {
- // Error... Already exist!!!
- return false;
- }
-
- DSLOG_DBG("WindowManager", "Register Zone:%p", zone);
- // add zone to list
- __registerZone(zone);
- return true;
-}
-
-void DSWindowManagerPrivate::__unregisterZone(DSZone *zone)
-{
- __zoneList.remove(zone);
-}
-
-void DSWindowManagerPrivate::unregisterZone(DSZone *zone)
-{
- // find zone in zone list
- if (!__checkZone(zone)) return;
-
- DSLOG_DBG("WindowManager", "Unregister Zone:%p", zone);
- // remove zone from list
- __unregisterZone(zone);
-}
-
-void DSWindowManagerPrivate::__registerWindow(DSZone *zone, DSWindow *window)
-{
- __zoneWinMap.insert(std::make_pair(window, zone));
-}
-
-bool DSWindowManagerPrivate::registerWindow(DSZone *zone, DSWindow *window)
-{
- // find zone in zone list
- if (!__checkZone(zone))
- {
- // Error.. Zone is not exist
- return false;
- }
-
- // map window to zone
- __registerWindow(zone, window);
- return true;
-}
-
-void DSWindowManagerPrivate::__unregisterWindow(DSWindow *window)
-{
- __zoneWinMap.erase(window);
-}
-
-void DSWindowManagerPrivate::unregisterWindow(DSZone *zone, DSWindow *window)
-{
- // find zone in zone list
- if (!__checkZone(zone))
- {
- // Error.. Zone is not exist
- return;
- }
-
- // unmap window from zone
- __unregisterWindow(window);
-}
-
-DSZone *DSWindowManagerPrivate::getZone(DSWindow *window)
-{
- return __getZone(window);
-}
-
-void DSWindowManagerPrivate::__registerSurface(DSZone *zone, DSWaylandSurface *surface)
-{
- __zoneSurfaceMap.insert(std::make_pair(surface, zone));
-}
-
-bool DSWindowManagerPrivate::registerSurface(DSZone *zone, DSWaylandSurface *surface)
-{
- // find zone in zone list
- if (!__checkZone(zone))
- {
- // Error.. Zone is not exist
- return false;
- }
-
- DSLOG_DBG("WindowManager", "Register Surface:%p to Zone:%p", surface, zone);
-
- // map window to zone
- __registerSurface(zone, surface);
- return true;
-}
-
-void DSWindowManagerPrivate::__unregisterSurface(DSWaylandSurface *surface)
-{
- __zoneSurfaceMap.erase(surface);
-}
-
-void DSWindowManagerPrivate::unregisterSurface(DSZone *zone, DSWaylandSurface *surface)
-{
- // find zone in zone list
- if (!__checkZone(zone))
- {
- // Error.. Zone is not exist
- return;
- }
-
- DSLOG_DBG("WindowManager", "Unregister Surface:%p from Zone:%p", surface, zone);
-
- // unmap window from zone
- __unregisterSurface(surface);
-}
-
-DSZone *DSWindowManagerPrivate::getZone(DSWaylandSurface *surface)
-{
- return __getZone(surface);
-}
-
-bool DSWindowManagerPrivate::setWindowParent(DSWaylandSurface *dswlSurface, DSWaylandSurface *dswlParentSurface)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (!zone) return false;
-
- if (dswlParentSurface)
- {
- DSZone *pZone = __getZone(dswlParentSurface);
- if (zone != pZone) return false;
- }
-
- return zone->setWindowParent(dswlSurface, dswlParentSurface);
-}
-
-void DSWindowManagerPrivate::setWindowTitle(DSWaylandSurface *dsSurface, const std::string &title)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dsSurface);
- if (zone)
- {
- zone->setWindowTitle(dsSurface, title);
- }
- else
- {
- // Do something if there is no zone
- }
-}
-
-void DSWindowManagerPrivate::setWindowType(DSWaylandSurface *dsSurface, int type)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dsSurface);
- if (zone)
- {
- zone->setWindowType(dsSurface, type);
- }
- else
- {
- // Do something if there is no zone
- }
-}
-
-void DSWindowManagerPrivate::setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dsSurface);
- if (zone)
- {
- zone->setWindowGeometry(dsSurface, x, y, w, h);
- }
- else
- {
- // Do something if there is no zone
- }
-}
-
-void DSWindowManagerPrivate::setWindowPosition(DSWaylandSurface *dsSurface, int x, int y)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dsSurface);
- if (zone)
- {
- zone->setWindowPosition(dsSurface, x, y);
- }
- else
- {
- // Do something if there is no zone
- }
-}
-
-stGeometry DSWindowManagerPrivate::getWindowGeometry(DSWaylandSurface *dsSurface)
-{
- DSZone *zone = __getZone(dsSurface);
- stGeometry geometry = {0, };
- if (zone)
- {
- return zone->getWindowGeometry(dsSurface);
- }
- return geometry;
-}
-
-void DSWindowManagerPrivate::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (!zone) return;
-
- zone->addWindowAuxHint(dswlSurface, id, name, value);
-}
-
-void DSWindowManagerPrivate::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (!zone) return;
-
- zone->changeWindowAuxHint(dswlSurface, id, value);
-}
-
-void DSWindowManagerPrivate::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (!zone) return;
-
- zone->removeWindowAuxHint(dswlSurface, id);
-}
-
-std::list<std::string> DSWindowManagerPrivate::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface)
-{
- // find dsSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (!zone)
- {
- std::list<std::string> nullList;
- return nullList;
- }
-
- return zone->getWindowSupportedAuxHints(dswlSurface);
-}
-
-void DSWindowManagerPrivate::activateWindow(DSWaylandSurface *dswlSurface)
-{
- // find dswlSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (zone)
- {
- zone->activateWindow(dswlSurface);
- }
-}
-
-void DSWindowManagerPrivate::raiseWindow(DSWaylandSurface *dswlSurface)
-{
- // find dswlSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (zone)
- {
- zone->raiseWindow(dswlSurface);
- }
-}
-
-void DSWindowManagerPrivate::lowerWindow(DSWaylandSurface *dswlSurface)
-{
- // find dswlSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (zone)
- {
- zone->lowerWindow(dswlSurface);
- }
-}
-
-void DSWindowManagerPrivate::setWindowSkipFocus(DSWaylandSurface *dswlSurface, bool set)
-{
- // find dswlSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (zone)
- {
- zone->setWindowSkipFocus(dswlSurface, set);
- }
-}
-
-bool DSWindowManagerPrivate::setWindowVkbdFloating(DSWaylandSurface *dswlSurface, bool set)
-{
- // find dswlSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (zone)
- {
- return zone->setWindowVkbdFloating(dswlSurface, set);
- }
- else
- return false;
-}
-
-bool DSWindowManagerPrivate::getWindowVkbdFloating(DSWaylandSurface *dswlSurface)
-{
- // find dswlSurface's window
- DSZone *zone = __getZone(dswlSurface);
- if (zone)
- {
- return zone->getWindowVkbdFloating(dswlSurface);
- }
- else
- return false;
-}
-
-void DSWindowManagerPrivate::setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set)
-{
- DSZone *zone = __getZone(dswlSurface);
- if (zone)
- zone->setWindowAllowUserGeometry(dswlSurface, set);
-}
-
-
-DSWindowManager::DSWindowManager(DSObject *parent)
- : DS_INIT_PRIVATE_PTR(DSWindowManager)
-{
-}
-
-DSWindowManager::~DSWindowManager()
-{
-}
-
-/* getInstance for DSWindowManager singleton */
-//static
-DSWindowManager *DSWindowManager::getInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- DSLOG_INF("DSWindowManager",
- "[Get] instance __refCount=%d !", __refCount);
-
- if (!__windowMgr && (__refCount == 0))
- {
- __windowMgr = new DSWindowManager(new DSObject);
- DSLOG_INF("DSWindowManager",
- "DSWindowManager instance has been created !");
- }
-
- ++__refCount;
- return __windowMgr;
-}
-
-/* releaseInstance for DSWindowManager singleton */
-// static
-void DSWindowManager::releaseInstance()
-{
- std::lock_guard<std::mutex> tLock(__mutex);
-
- --__refCount;
- if (__refCount < 0)
- __refCount = 0;
- DSLOG_INF("DSWindowManager",
- "[Release] instance __refCount=%d !", __refCount);
-
- if ((0 == __refCount) && __windowMgr)
- {
- delete __windowMgr;
- __windowMgr = nullptr;
- DSLOG_INF("DSWindowManager",
- "DSWindowManager instance has been removed !");
- }
-}
-
-bool DSWindowManager::registerZone(DSZone *zone)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->registerZone(zone);
-}
-
-void DSWindowManager::unregisterZone(DSZone *zone)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->unregisterZone(zone);
-}
-
-bool DSWindowManager::registerWindow(DSZone *zone, DSWindow *window)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->registerWindow(zone, window);
-}
-
-void DSWindowManager::unregisterWindow(DSZone *zone, DSWindow *window)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->unregisterWindow(zone, window);
-}
-
-DSZone *DSWindowManager::getZone(DSWindow *window)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->getZone(window);
-}
-
-bool DSWindowManager::registerSurface(DSZone *zone, DSWaylandSurface *surface)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->registerSurface(zone, surface);
-}
-
-void DSWindowManager::unregisterSurface(DSZone *zone, DSWaylandSurface *surface)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->unregisterSurface(zone, surface);
-}
-
-DSZone *DSWindowManager::getZone(DSWaylandSurface *surface)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->getZone(surface);
-}
-
-bool DSWindowManager::setWindowParent(DSWaylandSurface *dswlSurface, DSWaylandSurface *dswlParentSurface)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->setWindowParent(dswlSurface, dswlParentSurface);
-}
-
-void DSWindowManager::setWindowTitle(DSWaylandSurface *dsSurface, const std::string &title)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->setWindowTitle(dsSurface, title);
-}
-
-void DSWindowManager::setWindowType(DSWaylandSurface *dsSurface, int type)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->setWindowType(dsSurface, type);
-}
-
-void DSWindowManager::setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->setWindowGeometry(dsSurface, x, y, w, h);
-}
-
-void DSWindowManager::setWindowPosition(DSWaylandSurface *dsSurface, int x, int y)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->setWindowPosition(dsSurface, x, y);
-}
-
-stGeometry DSWindowManager::getWindowGeometry(DSWaylandSurface *dsSurface)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->getWindowGeometry(dsSurface);
-}
-
-void DSWindowManager::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->addWindowAuxHint(dswlSurface, id, name, value);
-}
-
-void DSWindowManager::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->changeWindowAuxHint(dswlSurface, id, value);
-}
-
-void DSWindowManager::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->removeWindowAuxHint(dswlSurface, id);
-}
-
-std::list<std::string> DSWindowManager::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->getWindowSupportedAuxHints(dswlSurface);
-}
-
-void DSWindowManager::activateWindow(DSWaylandSurface *dswlSurface)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->activateWindow(dswlSurface);
-}
-
-void DSWindowManager::raiseWindow(DSWaylandSurface *dswlSurface)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->raiseWindow(dswlSurface);
-}
-
-void DSWindowManager::lowerWindow(DSWaylandSurface *dswlSurface)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->lowerWindow(dswlSurface);
-}
-
-void DSWindowManager::setWindowSkipFocus(DSWaylandSurface *dswlSurface, bool set)
-{
- DS_GET_PRIV(DSWindowManager);
- priv->setWindowSkipFocus(dswlSurface, set);
-}
-
-bool DSWindowManager::setWindowVkbdFloating(DSWaylandSurface *dswlSurface, bool set)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->setWindowVkbdFloating(dswlSurface, set);
-}
-
-bool DSWindowManager::getWindowVkbdFloating(DSWaylandSurface *dswlSurface)
-{
- DS_GET_PRIV(DSWindowManager);
- return priv->getWindowVkbdFloating(dswlSurface);
-}
-
-void DSWindowManager::setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set)
-{
- DS_GET_PRIV(DSWindowManager);
-
- priv->setWindowAllowUserGeometry(dswlSurface, set);
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WINDOW_MANAGER_H__
-#define __DS_WINDOW_MANAGER_H__
-
-#include "DSCore.h"
-#include "DSObject.h"
-#include "DSStruct.h"
-
-namespace display_server
-{
-
-class DSWindowManagerPrivate;
-class DSZone;
-class DSWindow;
-class DSWaylandSurface;
-
-class DSWindowManager : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSWindowManager)
-
-public:
- static DSWindowManager *getInstance();
- static void releaseInstance();
-
- // APIs for DSZone related
- bool registerZone(DSZone *zone);
- void unregisterZone(DSZone *zone);
-
- bool registerWindow(DSZone *zone, DSWindow *window);
- void unregisterWindow(DSZone *zone, DSWindow *window);
- DSZone *getZone(DSWindow *window);
-
- bool registerSurface(DSZone *zone, DSWaylandSurface *surface);
- void unregisterSurface(DSZone *zone, DSWaylandSurface *surface);
- DSZone *getZone(DSWaylandSurface *surface);
-
- bool setWindowParent(DSWaylandSurface *dswlSurface, DSWaylandSurface *dswlParentSurface);
- void setWindowTitle(DSWaylandSurface *dsSurface, const std::string &title);
- void setWindowType(DSWaylandSurface *dsSurface, int type);
- void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h);
- void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y);
- stGeometry getWindowGeometry(DSWaylandSurface *dsSurface);
-
- void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value);
- void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value);
- void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id);
- std::list<std::string> getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface);
-
- void activateWindow(DSWaylandSurface *dswlSurface);
- void raiseWindow(DSWaylandSurface *dswlSurface);
- void lowerWindow(DSWaylandSurface *dswlSurface);
-
- void setWindowSkipFocus(DSWaylandSurface *dswlSurface, bool set);
-
- bool setWindowVkbdFloating(DSWaylandSurface *dswlSurface, bool set);
- bool getWindowVkbdFloating(DSWaylandSurface *dswlSurface);
-
- void setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set);
-
-protected:
-
-private:
- DSWindowManager() = delete;
- ~DSWindowManager();
- DSWindowManager(DSObject *parent);
- DSWindowManager& operator=(const DSWindowManager&) = delete;
-
-private:
- static std::mutex __mutex;
- static DSWindowManager *__windowMgr;
- static int __refCount;
-};
-
-}
-
-#endif // __DS_WINDOW_MANAGER_H__
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_WINDOW_MANAGER_PRIVATE__
-#define __DS_WINDOW_MANAGER_PRIVATE__
-
-#include <unordered_map>
-#include "DSWindowManager.h"
-
-namespace display_server
-{
-
-class DSWindowManagerPrivate : public DSObjectPrivate
-{
- DS_PIMPL_USE_PUBLIC(DSWindowManager);
-
-public:
- DSWindowManagerPrivate() = delete;
- DSWindowManagerPrivate(DSWindowManager *p_ptr);
- ~DSWindowManagerPrivate();
-
- bool registerZone(DSZone *zone);
- void unregisterZone(DSZone *zone);
-
- bool registerWindow(DSZone *zone, DSWindow *window);
- void unregisterWindow(DSZone *zone, DSWindow *window);
- DSZone *getZone(DSWindow *window);
-
- bool registerSurface(DSZone *zone, DSWaylandSurface *surface);
- void unregisterSurface(DSZone *zone, DSWaylandSurface *surface);
- DSZone *getZone(DSWaylandSurface *surface);
-
- bool setWindowParent(DSWaylandSurface *dswlSurface, DSWaylandSurface *dswlParentSurface);
- void setWindowTitle(DSWaylandSurface *dsSurface, const std::string &title);
- void setWindowType(DSWaylandSurface *dsSurface, int type);
- void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h);
- void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y);
- stGeometry getWindowGeometry(DSWaylandSurface *dsSurface);
-
- void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value);
- void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value);
- void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id);
- std::list<std::string> getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface);
-
- void activateWindow(DSWaylandSurface *dswlSurface);
- void raiseWindow(DSWaylandSurface *dswlSurface);
- void lowerWindow(DSWaylandSurface *dswlSurface);
-
- void setWindowSkipFocus(DSWaylandSurface *dswlSurface, bool set);
-
- bool setWindowVkbdFloating(DSWaylandSurface *dswlSurface, bool set);
- bool getWindowVkbdFloating(DSWaylandSurface *dswlSurface);
-
- void setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set);
-
-private:
- DSZone *__getZone(DSWindow *window);
- DSZone *__getZone(DSWaylandSurface *surface);
- bool __checkZone(DSZone *zone);
-
- void __registerZone(DSZone *zone);
- void __unregisterZone(DSZone *zone);
-
- void __registerWindow(DSZone *zone, DSWindow *window);
- void __unregisterWindow(DSWindow *window);
-
- void __registerSurface(DSZone *zone, DSWaylandSurface *surface);
- void __unregisterSurface(DSWaylandSurface *surface);
-
-
-private:
- std::list<DSZone *> __zoneList;
- std::unordered_map<DSWindow*, DSZone*> __zoneWinMap;
- std::unordered_map<DSWaylandSurface*, DSZone*> __zoneSurfaceMap;
-};
-
-} // namespace display_server
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSWindowShell.h"
-#include "DSWindowShellPrivate.h"
-
-namespace display_server
-{
-
-struct DTWindowShell
-{
-};
-
-DSWindowShell::DSWindowShell(DSWindow *window)
- : _d_ptr(std::make_unique<DSWindowShellPrivate>(this, window))
-{}
-
-DSWindowShell::~DSWindowShell()
-{
-
-}
-
-bool DSWindowShell::create(DSWindowShell *pParent)
-{
- return true;
-}
-
-bool DSWindowShell::create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pParent)
-{
- return true;
-}
-
-void DSWindowShell::destroy(void)
-{
-
-}
-
-bool DSWindowShell::setZone(DSZone *zone)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->setZone(zone);
-}
-
-DSZone *DSWindowShell::getZone(void)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->getZone();
-}
-
-void DSWindowShell::setShellSurface(IDSWaylandShellSurface *shellSurface)
-{
- DS_GET_PRIV(DSWindowShell);
- priv->setShellSurface(shellSurface);
-}
-
-IDSWaylandShellSurface *DSWindowShell::getShellSurface(void)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->getShellSurface();
-}
-
-DSWindow *DSWindowShell::getWindow(void)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->getWindow();
-}
-
-bool DSWindowShell::setParent(DSWindowShell *parentWinShell)
-{
- if (parentWinShell == this)
- return false;
-
- DS_GET_PRIV(DSWindowShell);
- return priv->setParent(parentWinShell);
-}
-
-DSWindowShell *DSWindowShell::getParent(void)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->getParent();
-}
-
-bool DSWindowShell::addChild(DSWindowShell *childWinShell)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->addChild(childWinShell);
-}
-
-void DSWindowShell::removeChild(DSWindowShell *childWinShell)
-{
- DS_GET_PRIV(DSWindowShell);
- priv->removeChild(childWinShell);
-}
-
-bool DSWindowShell::setTitle(const std::string &title)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->setTitle(title);
-}
-
-bool DSWindowShell::setSkipFocus(bool set)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->setSkipFocus(set);
-}
-
-bool DSWindowShell::setPosition(int x, int y)
-{
- DSLOG_DBG("DSWindowShell", "DSWindowShell:%p, Set Position (%d, %d)", this, x, y);
-
- DS_GET_PRIV(DSWindowShell);
- return priv->setPosition(x, y);
-}
-
-stPosition DSWindowShell::getPosition(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->getPosition();
-}
-
-bool DSWindowShell::setSize(unsigned int w, unsigned int h)
-{
- DSLOG_DBG("DSWindowShell", "DSWindowShell:%p, Set Size (%d, %d)", this, w, h);
-
- DS_GET_PRIV(DSWindowShell);
- return priv->setSize(w, h);
-}
-
-bool DSWindowShell::setGeometry(int x, int y, unsigned int w, unsigned int h)
-{
- DSLOG_DBG("DSWindowShell", "DSWindowShell:%p, Set Geometry (%d, %d, %d, %d)", this, x, y, w, h);
-
- DS_GET_PRIV(DSWindowShell);
- return priv->setGeometry(x, y, w, h);
-}
-
-stGeometry DSWindowShell::getGeometry(void)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->getGeometry();
-}
-
-void DSWindowShell::addAuxHint(int32_t id, const std::string &name, const std::string &value)
-{
- DS_GET_PRIV(DSWindowShell);
- priv->addAuxHint(id, name, value);
-}
-
-void DSWindowShell::changeAuxHint(int32_t id, const std::string &value)
-{
- DS_GET_PRIV(DSWindowShell);
- priv->changeAuxHint(id, value);
-}
-
-void DSWindowShell::removeAuxHint(int32_t id)
-{
- DS_GET_PRIV(DSWindowShell);
- priv->removeAuxHint(id);
-}
-
-bool DSWindowShell::show(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->show();
-}
-
-bool DSWindowShell::hide(bool autoFocus)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->hide(autoFocus);
-}
-
-int DSWindowShell::showState(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->showState();
-}
-
-
-bool DSWindowShell::setLayer(int layer)
-{
- DS_GET_PRIV(DSWindowShell);
- return priv->setLayer(layer);
-}
-
-int DSWindowShell::getLayer(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->getLayer();
-}
-
-
-bool DSWindowShell::raise(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->raise();
-}
-
-bool DSWindowShell::lower(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->lower();
-}
-
-bool DSWindowShell::unsetFocus(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->unsetFocus();
-}
-
-bool DSWindowShell::setFocus(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->setFocus();
-}
-
-bool DSWindowShell::isFocused(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->isFocused();
-}
-
-
-bool DSWindowShell::activate(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->activate();
-}
-
-bool DSWindowShell::isActivated(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->isActivated();
-}
-
-
-bool DSWindowShell::iconify(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->iconify();
-}
-
-bool DSWindowShell::iconify(bool by_client)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->iconify(by_client);
-}
-
-bool DSWindowShell::uniconify(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->uniconify();
-}
-
-bool DSWindowShell::uniconify(bool by_client)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->uniconify(by_client);
-}
-
-int DSWindowShell::getIconicState(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->getIconicState();
-}
-
-
-bool DSWindowShell::setType(int type)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->setType(type);
-}
-
-int DSWindowShell::getType(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->getType();
-}
-
-
-bool DSWindowShell::maximize(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->maximize();
-}
-
-bool DSWindowShell::isMaximized(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->isMaximized();
-}
-
-
-bool DSWindowShell::fullscreen(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->fullscreen();
-}
-
-bool DSWindowShell::isFullscreen(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->isFullscreen();
-}
-
-
-bool DSWindowShell::setRole(const char *role)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->setRole(role);
-}
-
-const char* DSWindowShell::getRole(void)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->getRole();
-}
-
-bool DSWindowShell::setVkbdFloating(bool set)
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->setVkbdFloating(set);
-}
-
-bool DSWindowShell::getVkbdFloating()
-{
- DS_GET_PRIV(DSWindowShell);
-
- return priv->getVkbdFloating();
-}
-
-void DSWindowShell::setAllowUserGeometry(bool set)
-{
- DS_GET_PRIV(DSWindowShell);
-
- priv->setAllowUserGeometry(set);
-}
-
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WINDOW_SHELL_H_
-#define _DS_WINDOW_SHELL_H_
-
-#include "DSStruct.h"
-#include "DSCore.h"
-#include "IDSWaylandShell.h"
-
-namespace display_server
-{
-
-class DSWindow;
-class DSWindowShellPrivate;
-class DSZone;
-
-class DSWindowShell
-{
-DS_PIMPL_USE_PRIVATE(DSWindowShell)
-
-public:
- explicit DSWindowShell(DSWindow *window);
- virtual ~DSWindowShell();
-
- bool create(DSWindowShell *pParent);
- bool create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pParent);
-
- void destroy(void);
-
- bool setZone(DSZone *zone);
- DSZone *getZone(void);
-
- void setShellSurface(IDSWaylandShellSurface *zxdgSurface);
- IDSWaylandShellSurface *getShellSurface(void);
-
- DSWindow *getWindow(void);
-
- bool setParent(DSWindowShell *parentWinShell);
- DSWindowShell *getParent(void);
-
- bool addChild(DSWindowShell *childWinShell);
- void removeChild(DSWindowShell *childWinShell);
-
- bool setTitle(const std::string &title);
-
- bool setSkipFocus(bool set);
-
- bool setPosition(int x, int y);
- stPosition getPosition(void);
-
- bool setSize(unsigned int w, unsigned int h);
-
- bool setGeometry(int x, int y, unsigned int w, unsigned int h);
- stGeometry getGeometry(void);
-
- void addAuxHint(int32_t id, const std::string &name, const std::string &value);
- void changeAuxHint(int32_t id, const std::string &value);
- void removeAuxHint(int32_t id);
-
- bool show(void);
- bool hide(bool autoFocus = true);
- int showState(void);
-
- bool setLayer(int layer);
- int getLayer(void);
-
- bool raise(void);
- bool lower(void);
-
- bool unsetFocus(void);
- bool setFocus(void);
- bool isFocused(void);
-
- bool activate(void);
- bool isActivated(void);
-
- bool iconify(void);
- bool iconify(bool by_client);
- bool uniconify(void);
- bool uniconify(bool by_client);
- int getIconicState(void);
-
- bool setType(int type);
- int getType(void);
-
- bool maximize(void);
- bool isMaximized(void);
-
- bool fullscreen(void);
- bool isFullscreen(void);
-
- bool setRole(const char *role);
- const char* getRole(void);
-
- bool setVkbdFloating(bool set);
- bool getVkbdFloating();
-
- void setAllowUserGeometry(bool set);
-
-protected:
-
-private:
-};
-
-}
-
-#endif // _DS_WINDOW_SHELL_H_
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSZone.h"
-#include "DSWindowShell.h"
-#include "DSWindowShellPrivate.h"
-
-namespace display_server
-{
-
-enum _Hint_Type
-{
- DS_WINDOW_HINT_USER_GEOMETRY = 0,
- DS_WINDOW_HINT_FIXED_RESIZE = 1,
- DS_WINDOW_HINT_DEICONIFY_UPDATE = 2,
- DS_WINDOW_HINT_ICONIFY = 3,
- DS_WINDOW_HINT_ABOVE_LOCKSCREEN = 4,
- DS_WINDOW_HINT_GESTURE_DISABLE = 5,
- DS_WINDOW_HINT_EFFECT_DISABLE = 6,
- DS_WINDOW_HINT_MSG_USE = 7,
- DS_WINDOW_HINT_ALWAYS_SELECTIVE = 8,
- DS_WINDOW_HINT_DEPENDENT_ROTATION = 9,
- DS_WINDOW_HINT_ROT_RENDER_NOPENDING = 10,
- DS_WINDOW_HINT_ICONIFY_BUFFER_FLUSH = 11,
-};
-
-static const char *sHintNames[] =
-{
- "wm.policy.win.user.geometry",
- "wm.policy.win.fixed.resize",
- "wm.policy.win.deiconify.update",
- "wm.policy.win.iconify",
- "wm.policy.win.above.lock",
- "wm.policy.win.gesture.disable",
- "wm.policy.win.effect.disable",
- "wm.policy.win.msg.use",
- "wm.comp.win.always.selective.mode",
- "wm.policy.win.rot.dependent",
- "wm.policy.win.rot.render.nopending",
- "wm.policy.win.iconify.buffer.flush",
-};
-
-DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *window)
- : __p_ptr(p_ptr),
- __window(window),
- __shellSurface(nullptr),
- __zone(nullptr),
- __x(0), __y(0),
- __w(0), __h(0),
- __reqX(0), __reqY(0),
- __reqW(0), __reqH(0),
- __parent(nullptr),
- __layer(0),
- __firstCommit(true),
- __changedGeometry(false),
- __visible(false)
-{
- if (__window)
- __window->registerCallbackBufferChanged(this, std::bind(&DSWindowShellPrivate::__onWindowBufferChanged, this, std::placeholders::_1));
-}
-
-DSWindowShellPrivate::~DSWindowShellPrivate()
-{
- for (stWindowAuxHint *hint : __auxHintsList)
- {
- delete hint;
- }
-}
-
-bool DSWindowShellPrivate::__findInChildList(DSWindowShell *parentWinShell)
-{
- for (auto ws : __childList)
- {
- if (ws == parentWinShell)
- return true;
- }
-
- return false;
-}
-
-bool DSWindowShellPrivate::__setParent(DSWindowShell *parentWinShell)
-{
- DS_GET_PUB(DSWindowShell);
-
- if (__parent == parentWinShell)
- return true;
-
- if (__findInChildList(parentWinShell))
- {
- DSLOG_ERR("DSWindowShell", "Fatal error. Set parent each other. winShell:%p, parentWinShell:%p", pub, parentWinShell);
- return false;
- }
-
- if (__parent)
- {
- // remove this from old parent's child list
- __parent->removeChild(pub);
- }
-
- __parent = parentWinShell;
- if (__parent)
- {
- __parent->addChild(pub);
- }
-
- if (__window)
- {
- if (__parent)
- {
- DSWindow *parentWin = __parent->getWindow();
- __window->setParent(parentWin);
- }
- else
- __window->setParent(nullptr);
- }
-
- return true;
-}
-
-struct stWindowAuxHint *DSWindowShellPrivate::__findAuxHint(int32_t id)
-{
- for (stWindowAuxHint* hint : __auxHintsList)
- {
- if (hint->id == id)
- return hint;
- }
-
- return nullptr;
-}
-
-void DSWindowShellPrivate::__handleAuxHint(stWindowAuxHint *hint)
-{
- if (!__window) return;
-
- // do something for each hints
- if (hint->name == sHintNames[DS_WINDOW_HINT_USER_GEOMETRY]) // user geometry
- {
- bool set;
-
- if (hint->value == "1")
- set = true;
- else
- set = false;
-
- __handleUserGeometryProperty(set);
- }
-}
-
-bool DSWindowShellPrivate::__handleUserGeometryProperty(bool setUserGeometry)
-{
- if (!__window) return false;
-
- __window->allowUserGeometry(setUserGeometry);
- if (setUserGeometry)
- {
- // reset windows geometry
- __x = __y = __w = __h = 0;
- __window->setPosition(__x, __y);
- __window->setSize(__w, __h);
- __changedGeometry = true;
- }
- else
- {
- // apply zone's geometry
- if (__zone)
- {
- stPosition zPos = __zone->getPosition();
- stSize zSize = __zone->getSize();
- __x = zPos.x;
- __y = zPos.y;
- __w = zSize.w;
- __h = zSize.h;
-
- __window->setPosition(__x, __y);
- __window->setSize(__w, __h);
- __changedGeometry = true;
- }
- }
-
- return true;
-}
-
-bool DSWindowShellPrivate::create(DSWindowShell *pParent)
-{
- return true;
-}
-
-bool DSWindowShellPrivate::create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pParent)
-{
- __x = x;
- __y = y;
- __w = w;
- __h = h;
-
- if (__window)
- {
- __window->setPosition(__x, __y);
- __window->setSize(__w, __h);
- __changedGeometry = true;
- }
-
- return true;
-}
-
-
-void DSWindowShellPrivate::destroy(void)
-{
-
-}
-
-bool DSWindowShellPrivate::setZone(DSZone *zone)
-{
- if (__zone)
- {
- // unset information for old zone
- }
-
- __zone = zone;
- if (__zone)
- {
- stPosition zPos = __zone->getPosition();
- stSize zSize = __zone->getSize();
-
- // check whether DSWindowShell's geometry has to change or not
- if (__window)
- {
- if (!__window->isAllowUserGeometry())
- {
- __x = zPos.x;
- __y = zPos.y;
- __w = zSize.w;
- __h = zSize.h;
-
- __window->setPosition(__x, __y);
- __window->setSize(__w, __h);
- __changedGeometry = true;
- }
- }
- else
- {
- __x = zPos.x;
- __y = zPos.y;
- __w = zSize.w;
- __h = zSize.h;
- }
- }
-
- return true;
-}
-
-DSZone *DSWindowShellPrivate::getZone(void)
-{
- return __zone;
-}
-
-void DSWindowShellPrivate::setShellSurface(IDSWaylandShellSurface *shellSurface)
-{
- __shellSurface = shellSurface;
- DSLOG_DBG("DSWindowShell", "Set ShellSurface(%p). Send configure", shellSurface);
- __sendConfigure();
-}
-
-IDSWaylandShellSurface *DSWindowShellPrivate::getShellSurface(void)
-{
- return __shellSurface;
-}
-
-DSWindow *DSWindowShellPrivate::getWindow(void)
-{
- return __window;
-}
-
-bool DSWindowShellPrivate::setParent(DSWindowShell *parentWinShell)
-{
- return __setParent(parentWinShell);
-}
-
-DSWindowShell *DSWindowShellPrivate::getParent(void)
-{
- return __parent;
-}
-
-bool DSWindowShellPrivate::addChild(DSWindowShell *childWinShell)
-{
- __childList.push_back(childWinShell);
- return true;
-}
-
-void DSWindowShellPrivate::removeChild(DSWindowShell *childWinShell)
-{
- __childList.remove(childWinShell);
-}
-
-bool DSWindowShellPrivate::setTitle(const std::string &title)
-{
- if (__window)
- {
- __window->setTitle(title);
- return true;
- }
- else
- return false;
-}
-
-bool DSWindowShellPrivate::setSkipFocus(bool set)
-{
- if (__window)
- {
- __window->setSkipFocus(set);
- return true;
- }
- else
- return false;
-}
-
-bool DSWindowShellPrivate::setPosition(int x, int y)
-{
- __reqX = x;
- __reqY = y;
-
- if (__window)
- {
- if (__window->isAllowUserGeometry())
- {
- __x = x;
- __y = y;
- __window->setPosition(__x, __y);
- __changedGeometry = true;
- }
- }
- else
- {
- __x = x;
- __y = y;
- }
-
- return true;
-}
-
-stPosition DSWindowShellPrivate::getPosition(void)
-{
- stPosition pos;
-
- pos.x = __x;
- pos.y = __y;
-
- return pos;
-}
-
-bool DSWindowShellPrivate::setSize(unsigned int w, unsigned int h)
-{
- __reqW = w;
- __reqH = h;
-
- if (__window)
- {
- if (__window->isAllowUserGeometry())
- {
- __w = w;
- __h = h;
- __window->setSize(__w, __h);
- }
- }
- else
- {
- __w = w;
- __h = h;
- }
-
- return true;
-}
-
-bool DSWindowShellPrivate::setGeometry(int x, int y, unsigned int w, unsigned int h)
-{
- __reqX = x;
- __reqY = y;
- __reqW = w;
- __reqH = h;
-
- if (__window)
- {
- if (__window->isAllowUserGeometry())
- {
- __x = x;
- __y = y;
- __w = w;
- __h = h;
- __window->setPosition(__x, __y);
- __window->setSize(__w, __h);
- __changedGeometry = true;
- }
- }
- else
- {
- __x = x;
- __y = y;
- __w = w;
- __h = h;
- }
-
- return true;
-}
-
-stGeometry DSWindowShellPrivate::getGeometry(void)
-{
- stGeometry geo;
- geo.x = __x;
- geo.y = __y;
- geo.w = __w;
- geo.h = __h;
- return geo;
-}
-
-void DSWindowShellPrivate::addAuxHint(int32_t id, const std::string &name, const std::string &value)
-{
- stWindowAuxHint *hint;
- hint = __findAuxHint(id);
- if (!hint)
- {
- hint = new stWindowAuxHint();
- if (!hint) return;
-
- __auxHintsList.push_back(hint);
- }
-
- hint->id = id;
- hint->name = name;
- hint->value = value;
- hint->changed = true;
- hint->deleted = false;
-
- DSLOG_DBG("DSWindowShell", "Add aux hint... id:%d, name:%s, value:%s", id, name.c_str(), value.c_str());
-
- __handleAuxHint(hint);
-}
-
-void DSWindowShellPrivate::changeAuxHint(int32_t id, const std::string &value)
-{
- stWindowAuxHint *hint;
- hint = __findAuxHint(id);
- if (!hint) return;
-
- hint->value = value;
- hint->changed = true;
-
- __handleAuxHint(hint);
-}
-
-void DSWindowShellPrivate::removeAuxHint(int32_t id)
-{
- stWindowAuxHint *hint;
- hint = __findAuxHint(id);
- if (!hint) return;
-
- hint->changed = true;
- hint->deleted = true;
-
- __auxHintsList.remove(hint);
-}
-
-bool DSWindowShellPrivate::show(void)
-{
- return true;
-}
-
-bool DSWindowShellPrivate::hide(bool autoFocus)
-{
- return true;
-}
-
-int DSWindowShellPrivate::showState(void)
-{
- return 0;
-}
-
-
-bool DSWindowShellPrivate::setLayer(int layer)
-{
- __layer = layer;
- return true;
-}
-
-int DSWindowShellPrivate::getLayer(void)
-{
- return __layer;
-}
-
-
-bool DSWindowShellPrivate::raise(void)
-{
- if (__window)
- return __window->raise();
-
- return false;
-}
-
-bool DSWindowShellPrivate::lower(void)
-{
- if (__window)
- return __window->lower();
-
- return false;
-}
-
-bool DSWindowShellPrivate::unsetFocus(void)
-{
- if (__window)
- return __window->unsetFocus();
- return false;
-}
-
-bool DSWindowShellPrivate::setFocus(void)
-{
- if (__window)
- return __window->setFocus();
- return false;
-}
-
-bool DSWindowShellPrivate::isFocused(void)
-{
- if (__window)
- return __window->hasFocus();
- return false;
-}
-
-
-bool DSWindowShellPrivate::activate(void)
-{
- if (__window)
- return __window->raiseToTop();
-
- return false;
-}
-
-bool DSWindowShellPrivate::isActivated(void)
-{
- return true;
-}
-
-
-bool DSWindowShellPrivate::iconify(void)
-{
- return true;
-}
-
-bool DSWindowShellPrivate::iconify(bool by_client)
-{
- return true;
-}
-
-bool DSWindowShellPrivate::uniconify(void)
-{
- return true;
-}
-
-bool DSWindowShellPrivate::uniconify(bool by_client)
-{
- return true;
-}
-
-int DSWindowShellPrivate::getIconicState(void)
-{
- return 0;
-}
-
-
-bool DSWindowShellPrivate::setType(int type)
-{
- if (__window)
- __window->setType(type);
-
- if (type == 9) // utility
- __handleUserGeometryProperty(true);
-
- return true;
-}
-
-int DSWindowShellPrivate::getType(void)
-{
- if (__window)
- return __window->getType();
-
- return 0;
-}
-
-
-bool DSWindowShellPrivate::maximize(void)
-{
- return true;
-}
-
-bool DSWindowShellPrivate::isMaximized(void)
-{
- return true;
-}
-
-
-bool DSWindowShellPrivate::fullscreen(void)
-{
- return true;
-}
-
-bool DSWindowShellPrivate::isFullscreen(void)
-{
- return true;
-}
-
-
-bool DSWindowShellPrivate::setRole(const char *role)
-{
- return true;
-}
-
-const char* DSWindowShellPrivate::getRole(void)
-{
- return nullptr;
-}
-
-bool DSWindowShellPrivate::setVkbdFloating(bool set)
-{
- if (__window)
- {
- __window->setVkbdFloating(set);
- return true;
- }
- else
- return false;
-}
-
-bool DSWindowShellPrivate::getVkbdFloating()
-{
- if (__window)
- {
- return __window->getVkbdFloating();
- }
- else
- return false;
-}
-
-void DSWindowShellPrivate::setAllowUserGeometry(bool set)
-{
- __handleUserGeometryProperty(set);
-}
-
-
-void DSWindowShellPrivate::__sendConfigure(void)
-{
- if (__shellSurface)
- {
- __shellSurface->sendConfigure(__x, __y, __w, __h);
- }
-}
-
-void DSWindowShellPrivate::__onWindowBufferChanged(std::shared_ptr<IDSBuffer> buffer)
-{
- if (__firstCommit)
- {
- DSLOG_DBG("DSWindow", "First Commit!!! ");
- __firstCommit = false;
- }
-
- if (__changedGeometry)
- {
- std::shared_ptr<stSize> bufferSize = buffer->getSize();
- DSLOG_DBG("DSWindow", "Geometry Changed!!! Send Configure... geo(%d,%d,%d,%d) commit(%d,%d)", __x, __y, __w, __h, bufferSize->w, bufferSize->h);
- __sendConfigure();
- __changedGeometry = false;
- }
-
- if (buffer) {
- __visible = true;
- } else {
- __visible = false;
- }
-
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef _DS_WINDOW_SHELL_PRIVATE_H_
-#define _DS_WINDOW_SHELL_PRIVATE_H_
-
-#include "DSWindow.h"
-
-namespace display_server
-{
-
-struct stWindowAuxHint
-{
- int32_t id;
- std::string name;
- std::string value;
- bool changed;
- bool deleted;
-};
-
-class DSWindowShellPrivate : public DSObject
-{
-DS_PIMPL_USE_PUBLIC(DSWindowShell)
-
-public:
- DSWindowShellPrivate() = delete;
- DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *window);
- ~DSWindowShellPrivate();
-
- bool create(DSWindowShell *pParent);
- bool create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pParent);
-
- void destroy(void);
-
- bool setZone(DSZone *zone);
- DSZone *getZone(void);
-
- void setShellSurface(IDSWaylandShellSurface *shellSurface);
- IDSWaylandShellSurface *getShellSurface(void);
-
- DSWindow *getWindow(void);
-
- bool setParent(DSWindowShell *parentWinShell);
- DSWindowShell *getParent(void);
-
- bool addChild(DSWindowShell *childWinShell);
- void removeChild(DSWindowShell *childWinShell);
-
- bool setTitle(const std::string &title);
-
- bool setSkipFocus(bool set);
-
- bool setPosition(int x, int y);
- stPosition getPosition(void);
-
- bool setSize(unsigned int w, unsigned int h);
-
- bool setGeometry(int x, int y, unsigned int w, unsigned int h);
- stGeometry getGeometry(void);
-
- void addAuxHint(int32_t id, const std::string &name, const std::string &value);
- void changeAuxHint(int32_t id, const std::string &value);
- void removeAuxHint(int32_t id);
-
- bool show(void);
- bool hide(bool autoFocus = true);
- int showState(void);
-
- bool setLayer(int layer);
- int getLayer(void);
-
- bool raise(void);
- bool lower(void);
-
- bool unsetFocus(void);
- bool setFocus(void);
- bool isFocused(void);
-
- bool activate(void);
- bool isActivated(void);
-
- bool iconify(void);
- bool iconify(bool by_client);
- bool uniconify(void);
- bool uniconify(bool by_client);
- int getIconicState(void);
-
- bool setType(int type);
- int getType(void);
-
- bool maximize(void);
- bool isMaximized(void);
-
- bool fullscreen(void);
- bool isFullscreen(void);
-
- bool setRole(const char *role);
- const char* getRole(void);
-
- bool setVkbdFloating(bool set);
- bool getVkbdFloating();
-
- void setAllowUserGeometry(bool set);
-
-private:
- bool __create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pWin, DSWindowShell *pParent);
- bool __findInChildList(DSWindowShell *parentWinShell);
- bool __setParent(DSWindowShell *parentWinShell);
- void __sendConfigure(void);
-
- struct stWindowAuxHint* __findAuxHint(int32_t id);
- void __handleAuxHint(stWindowAuxHint *hint);
- bool __handleUserGeometryProperty(bool setUserGeometry);
-
- void __onWindowBufferChanged(std::shared_ptr<IDSBuffer> buffer);
-
-private:
- DSWindow *__window;
- IDSWaylandShellSurface *__shellSurface;
- DSZone *__zone;
- int __x, __y; // real (applied) position
- unsigned int __w, __h; // real (applied) size
- int __reqX, __reqY; // requested position by client
- unsigned int __reqW, __reqH; // requested size by client
- DSWindowShell *__parent;
- int __layer;
- bool __firstCommit;
- bool __changedGeometry;
- bool __visible;
- std::list<DSWindowShell*> __childList;
- std::list<stWindowAuxHint*> __auxHintsList;
-};
-
-}
-
-#endif // _DS_WINDOW_SHELL_PRIVATE_H_
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSXkb.h"
-#include "DSXkbPrivate.h"
-
-#include <fcntl.h>
-#include <sys/mman.h>
-
-namespace display_server
-{
-
-DSXkbPrivate::DSXkbPrivate(DSXkb *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr),
- __xkb_state(nullptr), __xkb_keymap(nullptr), __xkb_context(nullptr),
- __keymap_fd(-1), __keymap_size(0), __keymap_area(nullptr),
- __depressed(0), __latched(0), __locked(0), __group(0)
-{
-}
-
-DSXkbPrivate::~DSXkbPrivate()
-{
- xkb_state_unref(__xkb_state);
- xkb_keymap_unref(__xkb_keymap);
- xkb_context_unref(__xkb_context);
-}
-
-bool DSXkbPrivate::makeKeymap()
-{
- DS_GET_PUB(DSXkb);
-
- __xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
- if (!__xkb_context)
- {
- DSLOG_ERR("DSXkb", "Failed to xkb_context_new()..\n");
- return false;
- }
-
- struct ::xkb_rule_names names = { pub->__rules.c_str(), pub->__model.c_str(), pub->__layout.c_str(), pub->__variant.c_str(), pub->__options.c_str() };
-
- __xkb_keymap = xkb_map_new_from_names(__xkb_context, &names, XKB_KEYMAP_COMPILE_NO_FLAGS);
- if (!__xkb_keymap)
- {
- DSLOG_ERR("DSXkb", "Failed to xkb_map_new_from_names()..\n");
- xkb_context_unref(__xkb_context);
- return false;
- }
-
- __xkb_state = xkb_state_new(__xkb_keymap);
- if (!__xkb_state)
- {
- DSLOG_ERR("DSXkb", "Failed to xkb_state_new()..\n");
- xkb_keymap_unref(__xkb_keymap);
- xkb_context_unref(__xkb_context);
- return false;
- }
-
- return true;
-}
-
-void DSXkbPrivate::mmapKeymap()
-{
- char *tmp;
-
- if (__keymap_area)
- {
- munmap(__keymap_area, __keymap_size);
- }
- if (__keymap_fd >= 0)
- {
- close(__keymap_fd);
- __keymap_fd = -1;
- }
- __keymap_size = 0;
-
- if (!(tmp = xkb_map_get_as_string(__xkb_keymap)))
- {
- DSLOG_ERR("DSXkb", "Could not get keymap string");
- return;
- }
-
- __keymap_size = strlen(tmp) + 1;
- __keymap_fd = __getKeymapFd(__keymap_size);
- if (__keymap_fd < 0)
- {
- DSLOG_ERR("DSXkb", "Could not create keymap file");
- free(tmp);
- __keymap_size = 0;
- return;
- }
-
- __keymap_area = (char *)mmap(nullptr, __keymap_size, (PROT_READ | PROT_WRITE), MAP_SHARED, __keymap_fd, 0);
- if (__keymap_area == MAP_FAILED)
- {
- DSLOG_ERR("DSXkb", "Failed to mmap keymap area: %m");
- free(tmp);
- __keymap_size = 0;
- close(__keymap_fd);
- __keymap_fd = -1;
- return;
- }
-
- strncpy(__keymap_area, tmp, __keymap_size);
- free(tmp);
-}
-
-void DSXkbPrivate::updateModifier(int keycode, bool pressed)
-{
- enum xkb_key_direction direction;
-
- if (pressed)
- direction = XKB_KEY_DOWN;
- else
- direction = XKB_KEY_UP;
-
- xkb_state_update_key(__xkb_state, keycode, direction);
-
- __depressed = xkb_state_serialize_mods(__xkb_state, XKB_STATE_MODS_DEPRESSED);
- __latched = xkb_state_serialize_mods(__xkb_state, XKB_STATE_MODS_LATCHED);
- __locked = xkb_state_serialize_mods(__xkb_state, XKB_STATE_MODS_LOCKED);
- __group = xkb_state_serialize_mods(__xkb_state, XKB_STATE_LAYOUT_EFFECTIVE);
-}
-
-uint32_t DSXkbPrivate::getModifierDepressed()
-{
- return __depressed;
-}
-
-uint32_t DSXkbPrivate::getModifierLatched()
-{
- return __latched;
-}
-
-uint32_t DSXkbPrivate::getModifierLocked()
-{
- return __locked;
-}
-
-uint32_t DSXkbPrivate::getModifierGroup()
-{
- return __group;
-}
-
-int DSXkbPrivate::getKeymapFd()
-{
- return __keymap_fd;
-}
-
-int DSXkbPrivate::getKeymapSize()
-{
- return __keymap_size;
-}
-
-std::string DSXkbPrivate::getKeyname(int keycode)
-{
- int nsyms;
- const xkb_keysym_t *syms;
- xkb_keysym_t sym = XKB_KEY_NoSymbol;
- char key[256] = {0, };
- std::string keyname;
-
- nsyms = xkb_key_get_syms(__xkb_state, keycode, &syms);
- if (nsyms == 1) sym = syms[0];
-
- if (sym == XKB_KEY_NoSymbol)
- {
- snprintf(key, sizeof(key), "Keycode-%u", keycode);
- }
- else
- {
- /* get the keyname for this sym */
- xkb_keysym_get_name(sym, key, sizeof(key));
- }
-
- if (key[0] == '\0')
- {
- snprintf(key, sizeof(key), "Keycode-%u", keycode);
- }
-
- keyname = key;
- return keyname;
-}
-
-typedef struct _keycode_map
-{
- xkb_keysym_t keysym;
- xkb_keycode_t keycode;
-} keycode_map;
-
-static void
-find_keycode(struct xkb_keymap *keymap, xkb_keycode_t key, void *data)
-{
- keycode_map *found_keycodes = (keycode_map *)data;
- xkb_keysym_t keysym = found_keycodes->keysym;
- int nsyms = 0;
- const xkb_keysym_t *syms_out = NULL;
-
- if (found_keycodes->keycode) return;
-
- nsyms = xkb_keymap_key_get_syms_by_level(keymap, key, 0, 0, &syms_out);
- if (nsyms && syms_out)
- {
- if (*syms_out == keysym)
- {
- found_keycodes->keycode = key;
- }
- }
-}
-
-int DSXkbPrivate::getKeycode(std::string keyname)
-{
- xkb_keysym_t keysym = 0x0;
- xkb_keycode_t keycode = 0;
-
- if (keyname.compare("Keycode-") == 0)
- {
- keycode = std::stoi(keyname);
- }
- else
- {
- keysym = xkb_keysym_from_name(keyname.c_str(), XKB_KEYSYM_NO_FLAGS);
- keycode_map found_keycodes = {0,};
- found_keycodes.keysym = keysym;
- xkb_keymap_key_for_each(__xkb_keymap, find_keycode, &found_keycodes);
-
- keycode = found_keycodes.keycode;
- }
-
- return keycode;
-}
-
-int DSXkbPrivate::__getKeymapFd(off_t size)
-{
- int fd = 0, blen = 0, len = 0;
- char *path = nullptr, *env = nullptr;
- char tmp[PATH_MAX] = {0, };
- long flags;
- mode_t old_umask;
-
- blen = sizeof(tmp) - 20;
-
- env = getenv("XDG_RUNTIME_DIR");
- if (env)
- {
- path = strdup(env);
- }
- if (!path) return -1;
-
- len = strlen(path) + 19;
- if (len < blen)
- {
- strncpy(tmp, path, PATH_MAX - 20);
- strncat(tmp, "/e-wl-keymap-XXXXXX", 19);
- free(path);
- }
- else
- {
- free(path);
- return -1;
- }
-
- old_umask = umask(S_IRWXG|S_IRWXO);
- fd = mkstemp(tmp);
- umask(old_umask);
-
- if (fd < 0)
- {
- return -1;
- }
-
- flags = fcntl(fd, F_GETFD);
- if (flags < 0)
- {
- close(fd);
- return -1;
- }
-
- if (fcntl(fd, F_SETFD, (flags | FD_CLOEXEC)) == -1)
- {
- close(fd);
- return -1;
- }
-
- if (ftruncate(fd, size) < 0)
- {
- close(fd);
- return -1;
- }
-
- unlink(tmp);
- return fd;
-}
-
-
-DSXkb::DSXkb(DSSeat *seat)
- : DS_INIT_PRIVATE_PTR(DSXkb),
- __seat(seat),
- __rules("evdev"), __model("pc105"), __layout("us"), __variant(""), __options("")
-{
- DS_GET_PRIV(DSXkb);
-
- priv->makeKeymap();
- priv->mmapKeymap();
-}
-
-DSXkb::DSXkb(DSSeat *seat, std::string rules, std::string model, std::string layout, std::string variant, std::string options)
- : DS_INIT_PRIVATE_PTR(DSXkb),
- __seat(seat),
- __rules(rules), __model(model), __layout(layout), __variant(variant), __options(options)
-{
- DS_GET_PRIV(DSXkb);
-
- priv->makeKeymap();
- priv->mmapKeymap();
-}
-
-DSXkb::~DSXkb()
-{
-}
-
-void DSXkb::updateModifier(int keycode, bool pressed)
-{
- DS_GET_PRIV(DSXkb);
-
- priv->updateModifier(keycode, pressed);
-}
-
-uint32_t DSXkb::getModifierDepressed()
-{
- DS_GET_PRIV(DSXkb);
-
- return priv->getModifierDepressed();
-}
-
-uint32_t DSXkb::getModifierLatched()
-{
- DS_GET_PRIV(DSXkb);
-
- return priv->getModifierLatched();
-}
-
-uint32_t DSXkb::getModifierLocked()
-{
- DS_GET_PRIV(DSXkb);
-
- return priv->getModifierLocked();
-}
-
-uint32_t DSXkb::getModifierGroup()
-{
- DS_GET_PRIV(DSXkb);
-
- return priv->getModifierGroup();
-}
-
-int DSXkb::getKeymapFd()
-{
- DS_GET_PRIV(DSXkb);
-
- return priv->getKeymapFd();
-}
-
-int DSXkb::getKeymapSize()
-{
- DS_GET_PRIV(DSXkb);
-
- return priv->getKeymapSize();
-}
-
-std::string DSXkb::getKeyname(int keycode)
-{
- DS_GET_PRIV(DSXkb);
-
- return priv->getKeyname(keycode);
-}
-
-int DSXkb::getKeycode(std::string keyname)
-{
- DS_GET_PRIV(DSXkb);
-
- return priv->getKeycode(keyname);
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_XKB_H__
-#define __DS_XKB_H__
-
-#include <DSCore.h>
-#include <DSSeat.h>
-
-namespace display_server
-{
-
-class DSXkbPrivate;
-
-class DSXkb : public DSObject
-{
-DS_PIMPL_USE_PRIVATE(DSXkb);
-public:
- DSXkb(DSSeat *seat);
- DSXkb(DSSeat *seat, std::string rules, std::string model, std::string layout, std::string variant, std::string options);
- ~DSXkb() override;
-
- void updateModifier(int keycode, bool pressed);
- uint32_t getModifierDepressed();
- uint32_t getModifierLatched();
- uint32_t getModifierLocked();
- uint32_t getModifierGroup();
- int getKeymapFd();
- int getKeymapSize();
-
- std::string getKeyname(int keycode);
- int getKeycode(std::string keyname);
-
-private:
- DSSeat* __seat;
- std::string __rules;
- std::string __model;
- std::string __layout;
- std::string __variant;
- std::string __options;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_XKB_PRIVATE_H__
-#define __DS_XKB_PRIVATE_H__
-
-#include <DSCore.h>
-#include <DSSeat.h>
-#include "DSXkb.h"
-
-#include <xkbcommon/xkbcommon.h>
-
-namespace display_server
-{
-
-class DSXkbPrivate : public DSObjectPrivate
-{
-DS_PIMPL_USE_PUBLIC(DSXkb);
-public:
- DSXkbPrivate() = delete;
- DSXkbPrivate(DSXkb *p_ptr);
- ~DSXkbPrivate();
-
- bool makeKeymap();
- void updateModifier(int keycode, bool pressed);
- xkb_mod_mask_t getModifierDepressed();
- xkb_mod_mask_t getModifierLatched();
- xkb_mod_mask_t getModifierLocked();
- xkb_mod_mask_t getModifierGroup();
- int getKeymapFd();
- int getKeymapSize();
-
- std::string getKeyname(int keycode);
- int getKeycode(std::string keyname);
-
-protected:
- void mmapKeymap();
-
-private:
- struct ::xkb_state *__xkb_state;
- struct ::xkb_keymap *__xkb_keymap;
- struct ::xkb_context *__xkb_context;
-
- int __keymap_fd;
- size_t __keymap_size;
- char *__keymap_area;
-
- xkb_mod_mask_t __depressed;
- xkb_mod_mask_t __latched;
- xkb_mod_mask_t __locked;
- xkb_mod_mask_t __group;
-
- int __getKeymapFd(off_t size);
-};
-
-}
-
-#endif
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "DSZone.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandSurface.h"
-#include "IDSWaylandShell.h"
-#include "DSWaylandZxdgShellV6.h"
-#include "DSDebugLog.h"
-
-namespace display_server
-{
-
-DSZone::DSZone()
- : __position{0, 0},
- __size{0, 0},
- __waylandCompositor(nullptr),
- __wm(nullptr),
- __eventLoop(nullptr),
- __waylandShell(nullptr),
- __stackChanged(false)
-{
- __waylandCompositor = DSWaylandCompositor::getInstance();
- if (__waylandCompositor)
- {
- __waylandCompositor->registerCallbackSurfaceCreated(this, std::bind(&DSZone::__onSurfaceCreated, this, std::placeholders::_1));
- __waylandCompositor->registerCallbackSurfaceDestroy(this, std::bind(&DSZone::__onSurfaceDestroy, this, std::placeholders::_1));
-
- __wm = DSWindowManager::getInstance();
- if (__wm)
- __wm->registerZone(this);
-
- __eventLoop = DSEventLoop::getInstance();
- if (__eventLoop)
- __eventLoop->registerCallbackIdleEnterer(this, std::bind(&DSZone::__onEventIdleEnterer, this, std::placeholders::_1));
-
-
- __waylandShell = __waylandCompositor->getShell();
- if (__waylandShell)
- {
- __waylandShell->registerCallbackShellSurfaceCreated(this, std::bind(&DSZone::__onShellSurfaceCreated, this, std::placeholders::_1));
- __waylandShell->registerCallbackShellSurfaceDestroyed(this, std::bind(&DSZone::__onShellSurfaceDestroyed, this, std::placeholders::_1));
- }
- }
-
- __setSupportAuxHints();
-}
-
-DSZone::~DSZone()
-{
- if (__wm)
- __wm->unregisterZone(this);
- if (__eventLoop)
- DSEventLoop::releaseInstance();
- if (__wm)
- DSWindowManager::releaseInstance();
- if (__waylandCompositor)
- DSWaylandCompositor::releaseInstance();
-}
-
-void DSZone::__setSupportAuxHints(void)
-{
- __supportedAuxHints.push_back("wm.policy.win.user.geometry");
-}
-
-void DSZone::setPosition(stPosition &position)
-{
- __position.x = position.x;
- __position.y = position.y;
-}
-
-void DSZone::setSize(stSize &size)
-{
- __size.w = size.w;
- __size.h = size.h;
-}
-
-stPosition DSZone::getPosition()
-{
- stPosition position;
- position.x = __position.x;
- position.y = __position.y;
-
- return position;
-}
-
-stSize DSZone::getSize()
-{
- stSize size;
- size.w = __size.w;
- size.h = __size.h;
-
- return size;
-}
-
-void DSZone::registerCallbackWindowCreated(DSObject *slot, std::function<void(std::shared_ptr<DSWindow>)> func)
-{
- __windowCreatedSignal.connect(slot, func);
-}
-
-void DSZone::registerCallbackWindowShellCreated(DSObject *slot, std::function<void(std::shared_ptr<DSWindowShell>)> func)
-{
- __windowShellCreatedSignal.connect(slot, func);
-}
-
-void DSZone::registerCallbackWindowStackChanged(DSObject *slot, std::function<void(std::shared_ptr<DSWindow>)> func)
-{
- __windowStackChangedSignal.connect(slot, func);
-}
-
-void DSZone::registerCallbackWindowDestroy(DSObject *slot, std::function<void(std::shared_ptr<DSWindow>)> func)
-{
- __windowDestroySignal.connect(slot, func);
-}
-
-void DSZone::callCallbackWindowCreated()
-{
- __windowCreatedSignal.emit(nullptr);
-}
-
-void DSZone::__onEventIdleEnterer(void *data)
-{
- if (__stackChanged)
- {
- DSLOG_DBG("DSZone", "Calculate Visibility...");
-
- // calculate visibility?
- __stackChanged = false;
- }
-}
-
-void DSZone::__onSurfaceCreated(std::shared_ptr<DSWaylandSurface> waylandSurface)
-{
- DSLOG_DBG("DSZone", "waylandSurface:(shared:%p, pure:%p)", waylandSurface, waylandSurface.get());
-
- if (__wm)
- __wm->registerSurface(this, waylandSurface.get());
-
- // create DSWindow
- std::shared_ptr<DSWindow> window = __createWindow(waylandSurface);
-
- // create DSWindowShell
- std::shared_ptr<DSWindowShell> shell = __createWindowShell(window);
-}
-
-void DSZone::__onSurfaceDestroy(std::shared_ptr<DSWaylandSurface> waylandSurface)
-{
- DSWaylandSurface *dswSurfacePtr = waylandSurface.get();
-
- if (__wm)
- __wm->unregisterSurface(this, dswSurfacePtr);
-
- DSWindowShell *shell = __findWindowShell(dswSurfacePtr);
- __destroyWindowShell(shell, dswSurfacePtr);
-
- std::shared_ptr<DSWindow> window = __findWindow(dswSurfacePtr);
- __destroyWindow(window);
-}
-
-void DSZone::__onShellSurfaceCreated(IDSWaylandShellSurface *waylandShellSurface)
-{
- DSLOG_DBG("DSZone", "Created waylandShellSurface:(pure:%p)", waylandShellSurface);
-
- if (waylandShellSurface)
- {
- struct ::wl_resource *wlSurface = waylandShellSurface->getWlSurface();
- DSLOG_DBG("DSZone", "get wl_surface:%p", wlSurface);
-
- DSWaylandSurface *dsSurface = waylandShellSurface->getSurface();
- DSLOG_DBG("DSZone", "get DSWaylandSurface:%p", dsSurface);
-
- if (dsSurface)
- {
- // find DSWindowShell associated with DSWaylandSurface
- DSWindowShell *dsWinShell = __findWindowShell(dsSurface);
- if (dsWinShell)
- {
- DSLOG_DBG("DSZONE", "Find DSWindowShell (%p)... setShellSurface!", dsWinShell);
- dsWinShell->setShellSurface(waylandShellSurface);
- }
- }
- }
-}
-
-void DSZone::__onShellSurfaceDestroyed(IDSWaylandShellSurface *waylandShellSurface)
-{
- DSLOG_DBG("DSZone", "Destroyed waylandShellSurface:(pure:%p)", waylandShellSurface);
-
- if (waylandShellSurface)
- {
- struct ::wl_resource *wlSurface = waylandShellSurface->getWlSurface();
- DSLOG_DBG("DSZone", "get wl_surface:%p", wlSurface);
-
- DSWaylandSurface *dsSurface = waylandShellSurface->getSurface();
- DSLOG_DBG("DSZone", "get DSWaylandSurface:%p", dsSurface);
-
- if (dsSurface)
- {
- // find DSWindowShell associated with DSWaylandSurface
- DSWindowShell *dsWinShell = __findWindowShell(dsSurface);
- if (dsWinShell)
- {
- DSLOG_DBG("DSZONE", "Find DSWindowShell (%p)... setShellSurface to nullptr!", dsWinShell);
- dsWinShell->setShellSurface(nullptr);
- }
- }
- }
-}
-
-// for Test
-void DSZone::callCallbackWindowShellCreated(std::shared_ptr<DSWindowShell> winShell)
-{
- __windowShellCreatedSignal.emit(winShell);
-}
-
-bool DSZone::testCreateWindow(std::shared_ptr<DSWaylandSurface> waylandSurface)
-{
- if (waylandSurface == nullptr)
- return false;
-
- __onSurfaceCreated(waylandSurface);
- return true;
-}
-
-bool DSZone::testDestroyWindow(std::shared_ptr<DSWaylandSurface> waylandSurface)
-{
- if (waylandSurface == nullptr)
- return false;
-
- __onSurfaceDestroy(waylandSurface);
- return true;
-}
-
-std::list<std::shared_ptr<DSWindow>> DSZone::getWindowList()
-{
- return __windowList;
-}
-
-std::list<std::shared_ptr<DSWindowShell>> DSZone::getWindowShellList()
-{
- return __windowShellList;
-}
-
-void DSZone::__prependWindowList(std::shared_ptr<DSWindow> window)
-{
- __windowList.remove(window);
- __windowList.push_front(window);
-
- __stackChanged = true;
- __updateWindowOrder();
-
- std::shared_ptr<DSWindow> wTop(__windowList.front());
- __windowStackChangedSignal.emit(wTop);
-}
-
-void DSZone::__appendWindowList(std::shared_ptr<DSWindow> window)
-{
- __windowList.remove(window);
- __windowList.push_back(window);
-
- __stackChanged = true;
- __updateWindowOrder();
-
- std::shared_ptr<DSWindow> wTop(__windowList.front());
- __windowStackChangedSignal.emit(wTop);
-}
-
-std::shared_ptr<DSWindow> DSZone::__findWindow(DSWaylandSurface *dswlSurface)
-{
- std::list<std::shared_ptr<DSWindow>> wList = getWindowList();
- for (auto w : wList)
- {
- if (w->surface() == dswlSurface)
- {
- DSLOG_INF("DSZone", "Window found (win=%p, surface=%p)", w, dswlSurface);
- return w;
- }
- }
-
- return nullptr;
-}
-
-DSWindowShell *DSZone::__findWindowShell(DSWaylandSurface *dswlSurface)
-{
- DSWindowShell *dsWinShell = nullptr;
-
- std::map<DSWaylandSurface*, DSWindowShell*>::iterator iter;
- iter = __windowShellMap.find(dswlSurface);
- if(iter == __windowShellMap.end())
- {
- DSLOG_DBG("DSZone", "Doesn't Exist DSWindowShell... DSWaylandSurface(%p)", dswlSurface);
- return nullptr;
- }
-
- dsWinShell = iter->second;
- return dsWinShell;
-}
-
-std::shared_ptr<DSWindow> DSZone::__createWindow(std::shared_ptr<DSWaylandSurface> waylandSurface)
-{
- std::shared_ptr<DSWindow> window = std::make_shared<DSWindow>(waylandSurface);
- __prependWindowList(window);
-
- // emit a signal of the surface committed
- __windowCreatedSignal.emit(window);
-
- return window;
-}
-
-void DSZone::__destroyWindow(std::shared_ptr<DSWindow> window)
-{
- __windowDestroySignal.emit(window);
- __windowList.remove(window);
-
- __stackChanged = true;
- __updateWindowOrder();
-
- std::shared_ptr<DSWindow> wTop(__windowList.front());
- __windowStackChangedSignal.emit(wTop);
-}
-
-void DSZone::__updateWindowOrder(void)
-{
- uint32_t zOrder = 0;
- std::list<std::shared_ptr<DSWindow>> wList = getWindowList();
- for (auto w : wList)
- {
- /* TODO : check if the w is in its visible state */
- w->setZOrder(zOrder++);
- }
-}
-
-std::shared_ptr<DSWindowShell> DSZone::__createWindowShell(std::shared_ptr<DSWindow> window)
-{
- DSWindow *ptrWindow = window.get();
-
- std::shared_ptr<DSWindowShell> shell = std::make_shared<DSWindowShell>(ptrWindow);
- if (!shell) return nullptr;
-
- shell->setZone(this);
-
- __windowShellList.push_front(shell);
-
- __windowShellMap.insert(std::make_pair(ptrWindow->surface(), shell.get()));
-
- // emit a signal of the shell created
- __windowShellCreatedSignal.emit(shell);
-
- return shell;
-}
-
-void DSZone::__destroyWindowShell(DSWindowShell* windowShell, DSWaylandSurface *surface)
-{
- // remove from map
- __windowShellMap.erase(surface);
-
- // remove from __windowShellList
- std::list<std::shared_ptr<DSWindowShell>> wsList = getWindowShellList();
- for (auto ws : wsList)
- {
- if (ws.get() == windowShell)
- {
- __windowShellDestroySignal.emit(ws);
- __windowShellList.remove(ws);
- break;
- }
- }
-}
-
-bool DSZone::setWindowParent(DSWaylandSurface *dswlSurface, DSWaylandSurface *dswlParentSurface)
-{
- DSWindowShell *wShell = __findWindowShell(dswlSurface);
- if (!wShell) return false;
-
- DSWindowShell *pwShell = __findWindowShell(dswlParentSurface);
-
- return wShell->setParent(pwShell);
-}
-
-bool DSZone::setWindowTitle(DSWaylandSurface *dswSurface, const std::string &title)
-{
- DSWindowShell *wShell = __findWindowShell(dswSurface);
- if (!wShell) return false;
-
- return wShell->setTitle(title);
-
-/*
- std::shared_ptr<DSWindow> window = __findWindow(dswSurface);
- if (!window) return false;
-
- return window->setTitle(title);
-*/
-}
-
-bool DSZone::setWindowType(DSWaylandSurface *dswSurface, int type)
-{
- DSWindowShell *wShell = __findWindowShell(dswSurface);
- if (!wShell) return false;
-
- return wShell->setType(type);
-
-/*
- std::shared_ptr<DSWindow> window = __findWindow(dswSurface);
- if (!window) return false;
-
- return window->setType(type);
-*/
-}
-
-bool DSZone::setWindowGeometry(DSWaylandSurface *dswSurface, int x, int y, unsigned int w, unsigned h)
-{
- DSWindowShell *wShell = __findWindowShell(dswSurface);
- if (!wShell) return false;
-
- return wShell->setGeometry(x, y, w, h);
-
-/*
- std::shared_ptr<DSWindow> window = __findWindow(dswSurface);
- if (!window) return false;
-
- return window->setGeometry(x, y, w, h);
-*/
-}
-
-bool DSZone::setWindowPosition(DSWaylandSurface *dswSurface, int x, int y)
-{
- DSWindowShell *wShell = __findWindowShell(dswSurface);
- if (!wShell) return false;
-
- return wShell->setPosition(x, y);
-
-/*
- std::shared_ptr<DSWindow> window = __findWindow(dswSurface);
- if (!window) return false;
-
- return window->setPosition(x, y);
-*/
-}
-
-stGeometry DSZone::getWindowGeometry(DSWaylandSurface *dswSurface)
-{
- stGeometry geometry = {0, };
- DSWindowShell *wShell = __findWindowShell(dswSurface);
- if (!wShell) return geometry;
-
- return wShell->getGeometry();
-}
-
-void DSZone::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value)
-{
- DSWindowShell *wShell = __findWindowShell(dswlSurface);
- if (!wShell) return;
-
- wShell->addAuxHint(id, name, value);
-}
-
-void DSZone::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value)
-{
- DSWindowShell *wShell = __findWindowShell(dswlSurface);
- if (!wShell) return;
-
- wShell->changeAuxHint(id, value);
-}
-
-void DSZone::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id)
-{
- DSWindowShell *wShell = __findWindowShell(dswlSurface);
- if (!wShell) return;
-
- wShell->removeAuxHint(id);
-}
-
-std::list<std::string> DSZone::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface)
-{
- // TODO: we have to change code to use DSPolicy instead of DSZone
- return __supportedAuxHints;
-}
-
-void DSZone::activateWindow(DSWaylandSurface *dswlSurface)
-{
- if (!dswlSurface) return;
-
- std::shared_ptr<DSWindow> window = __findWindow(dswlSurface);
- __prependWindowList(window);
-
- DSWindowShell *wShell = __findWindowShell(dswlSurface);
- if (!wShell) return;
-
- wShell->activate();
-}
-
-void DSZone::raiseWindow(DSWaylandSurface* dswlSurface)
-{
- if (!dswlSurface) return;
-
- std::shared_ptr<DSWindow> window = __findWindow(dswlSurface);
- __prependWindowList(window);
-
- DSWindowShell *wShell = __findWindowShell(dswlSurface);
- if (!wShell) return;
-
- wShell->raise();
-}
-
-void DSZone::lowerWindow(DSWaylandSurface* dswlSurface)
-{
- if (!dswlSurface) return;
-
- std::shared_ptr<DSWindow> window = __findWindow(dswlSurface);
- __appendWindowList(window);
-
- DSWindowShell *wShell = __findWindowShell(dswlSurface);
- if (!wShell) return;
-
- wShell->lower();
-}
-
-void DSZone::setWindowSkipFocus(DSWaylandSurface *dswlSurface, bool set)
-{
- DSWindowShell *wShell = __findWindowShell(dswlSurface);
- if (!wShell) return;
-
- wShell->setSkipFocus(set);
-}
-
-bool DSZone::setWindowVkbdFloating(DSWaylandSurface *dswlsurface, bool set)
-{
- DSWindowShell *wShell = __findWindowShell(dswlsurface);
- if (!wShell) return false;
-
- return wShell->setVkbdFloating(set);
-}
-
-bool DSZone::getWindowVkbdFloating(DSWaylandSurface *dswlsurface)
-{
- DSWindowShell *wShell = __findWindowShell(dswlsurface);
- if (!wShell) return false;
-
- return wShell->getVkbdFloating();
-}
-
-void DSZone::setWindowAllowUserGeometry(DSWaylandSurface *dswlsurface, bool set)
-{
- DSWindowShell *wShell = __findWindowShell(dswlsurface);
- if (!wShell) return;
-
- wShell->setAllowUserGeometry(set);
-}
-
-} // namespace display_server
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __DS_ZONE_H__
-#define __DS_ZONE_H__
-
-#include <DSCore.h>
-#include "DSWindowManager.h"
-#include "DSWindow.h"
-#include "DSWindowShell.h"
-#include "DSSignal.h"
-#include "DSStruct.h"
-#include "DSEventLoop.h"
-
-namespace display_server
-{
-class DSWaylandCompositor;
-class DSWaylandSurface;
-class DSWaylandZxdgSurfaceV6;
-class IDSWaylandShell;
-class IDSWaylandShellSurface;
-
-class DSZone : public DSObject
-{
-public:
- explicit DSZone();
- virtual ~DSZone();
-
- void setPosition(stPosition &position);
- void setSize(stSize &size);
- stPosition getPosition();
- stSize getSize();
-
- // Callback methods
- void registerCallbackWindowCreated(DSObject *slot, std::function<void(std::shared_ptr<DSWindow>)> func);
- void registerCallbackWindowDestroy(DSObject *slot, std::function<void(std::shared_ptr<DSWindow>)> func);
- void registerCallbackWindowShellCreated(DSObject *slot, std::function<void(std::shared_ptr<DSWindowShell>)> func);
- void registerCallbackWindowStackChanged(DSObject *slot, std::function<void(std::shared_ptr<DSWindow>)> func);
-
- // emit functions for testing
- void callCallbackWindowCreated();
- void callCallbackWindowShellCreated(std::shared_ptr<DSWindowShell> winShell);
- // for test
- bool testCreateWindow(std::shared_ptr<DSWaylandSurface> waylandSurface);
- bool testDestroyWindow(std::shared_ptr<DSWaylandSurface> waylandSurface);
-
- // for window property
- bool setWindowParent(DSWaylandSurface *dswlSurface, DSWaylandSurface *dswlParentSurface);
- bool setWindowTitle(DSWaylandSurface *dswSurface, const std::string &title);
- bool setWindowType(DSWaylandSurface *dswSurface, int type);
- bool setWindowGeometry(DSWaylandSurface *dswSurface, int x, int y, unsigned int w, unsigned h);
- bool setWindowPosition(DSWaylandSurface *dswSurface, int x, int y);
- stGeometry getWindowGeometry(DSWaylandSurface *dswSurface);
-
- void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value);
- void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value);
- void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id);
- std::list<std::string> getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface);
-
- void activateWindow(DSWaylandSurface *dswlSurface);
- void raiseWindow(DSWaylandSurface* dswlSurface);
- void lowerWindow(DSWaylandSurface* dswlSurface);
-
- void setWindowSkipFocus(DSWaylandSurface *dswlSurface, bool set);
-
- bool setWindowVkbdFloating(DSWaylandSurface *dswlSurface, bool set);
- bool getWindowVkbdFloating(DSWaylandSurface *dswlSurface);
-
- void setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set);
-
- std::list<std::shared_ptr<DSWindow>> getWindowList();
- std::list<std::shared_ptr<DSWindowShell>> getWindowShellList();
-
-private:
- void __onEventIdleEnterer(void *data);
-
- void __onSurfaceCreated(std::shared_ptr<DSWaylandSurface> waylandSurface);
- void __onSurfaceDestroy(std::shared_ptr<DSWaylandSurface> waylandSurface);
-
- void __onShellSurfaceCreated(IDSWaylandShellSurface *waylandShellSurface);
- void __onShellSurfaceDestroyed(IDSWaylandShellSurface *waylandShellSurface);
-
- std::shared_ptr<DSWindow> __createWindow(std::shared_ptr<DSWaylandSurface> waylandSurface);
- void __destroyWindow(std::shared_ptr<DSWindow> window);
- void __updateWindowOrder(void);
-
- std::shared_ptr<DSWindowShell> __createWindowShell(std::shared_ptr<DSWindow> window);
- void __destroyWindowShell(DSWindowShell* windowShell, DSWaylandSurface *surface);
-
- void __prependWindowList(std::shared_ptr<DSWindow> window);
- void __appendWindowList(std::shared_ptr<DSWindow> window);
-
- std::shared_ptr<DSWindow> __findWindow(DSWaylandSurface *dswlSurface);
- DSWindowShell* __findWindowShell(DSWaylandSurface *dswlSurface);
-
- void __setSupportAuxHints(void);
-
- stPosition __position;
- stSize __size;
- std::list<std::shared_ptr<DSWindow>> __windowList;
- std::list<std::shared_ptr<DSWindowShell>> __windowShellList;
- DSWaylandCompositor *__waylandCompositor;
- DSWindowManager *__wm;
- DSEventLoop *__eventLoop;
- IDSWaylandShell *__waylandShell;
- bool __stackChanged;
-
- std::map<DSWaylandSurface*, DSWindowShell*> __windowShellMap;
- std::list<std::string> __supportedAuxHints;
-
- // signals
- DSSignal<std::shared_ptr<DSWindow>> __windowCreatedSignal;
- DSSignal<std::shared_ptr<DSWindow>> __windowDestroySignal;
- DSSignal<std::shared_ptr<DSWindow>> __windowStackChangedSignal;
- DSSignal<std::shared_ptr<DSWindowShell>> __windowShellCreatedSignal;
- DSSignal<std::shared_ptr<DSWindowShell>> __windowShellDestroySignal;
-};
-
-}
-
-#endif
+++ /dev/null
-
-libds_srcs = [
- 'DSBase/DSRefBase.cpp',
- 'DSBase/DSRefBase.h',
- 'DSBuffer/DSBufferQueueTBMImpl.cpp',
- 'DSBuffer/DSBufferTBMImpl.cpp',
- 'DSBuffer/DSBufferManager.cpp',
- 'DSBuffer/DSBufferManager.h',
- 'DSBuffer/DSBufferManagerPrivate.h',
- 'DSBuffer/DSBufferRef.cpp',
- 'DSBuffer/DSBufferRef.h',
- 'DSCallback/DSCallback.h',
- 'DSCanvas/DSCanvas.cpp',
- 'DSCompositor/DSCompositor.cpp',
- 'DSDebug/DSDebugLog.cpp',
- 'DSDisplayArea/DSDisplayArea.cpp',
- 'DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp',
- 'DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.cpp',
- 'DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp',
- 'DSDisplayDevice/DSDisplayDeviceOutputModeTDMImpl.cpp',
- 'DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.cpp',
- 'DSDisplayDevice/DSDisplayDeviceTDMImpl.cpp',
- 'DSEventLoop/DSEventLoop.cpp',
- 'DSInput/DSInput.cpp',
- 'DSInput/DSInput.h',
- 'DSInput/DSInputPrivate.h',
- 'DSInput/DSInputEvent.h',
- 'DSInput/DSLibinput.cpp',
- 'DSInput/DSLibinput.h',
- 'DSObject/DSObject.cpp',
- 'DSObject/DSObject.h',
- 'DSObject/DSObjectPrivate.cpp',
- 'DSObject/DSObjectPrivate.h',
- 'DSOutput/DSOutputImpl.cpp',
- 'DSPolicyArea/DSPolicyArea.cpp',
- 'DSProperty/DSProperty.cpp',
- 'DSProperty/DSProperty.h',
- 'DSProperty/DSPropertyPrivate.cpp',
- 'DSProperty/DSPropertyPrivate.h',
- 'DSRender/DSRenderEngineEcoreEvasImpl.cpp',
- 'DSRender/DSRenderEngineDaliImpl.cpp',
- 'DSRender/DSRenderView.cpp',
- 'DSRender/DSRenderViewEcoreEvasImpl.cpp',
- 'DSRender/DSRenderViewDaliImpl.cpp',
- 'DSSeat/DSSeat.cpp',
- 'DSSeat/DSKeyboard.cpp',
- 'DSSeat/DSKeyboard.h',
- 'DSSeat/DSPointer.cpp',
- 'DSSeat/DSPointer.h',
- 'DSSeat/DSTouch.cpp',
- 'DSSeat/DSTouch.h',
- 'DSSignal/DSSignal.cpp',
- 'DSSignal/DSSignal.h',
- 'DSSignal/DSSignalBroker.cpp',
- 'DSSignal/DSSignalBroker.h',
- 'DSCore/DSStruct.h',
- 'DSCore/DSCore.h',
- 'DSWaylandExtension/DSWaylandExtension.cpp',
- 'DSTizenAppinfo/DSTizenAppinfo.h',
- 'DSTizenAppinfo/DSTizenAppinfo.cpp',
- 'DSTizenAppinfo/DSTizenAppinfoMgr.h',
- 'DSTizenAppinfo/DSTizenAppinfoMgrPrivate.h',
- 'DSTizenAppinfo/DSTizenAppinfoMgr.cpp',
- 'DSWindow/DSWindow.h',
- 'DSWindow/DSWindowPrivate.h',
- 'DSWindow/DSWindow.cpp',
- 'DSWindowManager/DSWindowManager.cpp',
- 'DSWindowShell/DSWindowShell.cpp',
- 'DSWindowShell/DSWindowShellPrivate.cpp',
- 'DSZone/DSZone.cpp',
- 'DSClient/DSClientPrivate.h',
- 'DSClient/DSClient.h',
- 'DSClient/DSClient.cpp',
- 'DSXkb/DSXkbPrivate.h',
- 'DSXkb/DSXkb.h',
- 'DSXkb/DSXkb.cpp',
- 'DSTextInput/DSTextInputPrivate.h',
- 'DSTextInput/DSTextInput.h',
- 'DSTextInput/DSTextInput.cpp',
- 'DSUtil/DSUtilSocket.h',
- 'DSUtil/DSUtilSocket.cpp',
- 'DSTraceInfo/DSTraceInfo.h',
- 'DSTraceInfo/DSTraceInfo.cpp',
- ]
-
-libds_wayland_srcs = [
- 'DSWaylandServer/dswayland-server-wayland.cpp',
- 'DSWaylandServer/dswayland-server-wayland.h',
- 'DSWaylandServer/dswayland-server-tizen-extension.cpp',
- 'DSWaylandServer/dswayland-server-tizen-extension.h',
- 'DSWaylandServer/dswayland-server-xdg-shell-unstable-v6.cpp',
- 'DSWaylandServer/dswayland-server-xdg-shell-unstable-v6.h',
- 'DSWaylandServer/dswayland-server-xdg-shell.cpp',
- 'DSWaylandServer/dswayland-server-xdg-shell.h',
- 'DSWaylandServer/dswayland-server-tizen-surface.cpp',
- 'DSWaylandServer/dswayland-server-tizen-surface.h',
- 'DSWaylandServer/dswayland-server-text.cpp',
- 'DSWaylandServer/dswayland-server-text.h',
- 'DSWaylandServer/dswayland-server-tizen-launch.cpp',
- 'DSWaylandServer/dswayland-server-tizen-launch.h',
- 'DSWaylandServer/dswayland-server-input-method-unstable-v1.cpp',
- 'DSWaylandServer/dswayland-server-input-method-unstable-v1.h',
- 'DSWaylandServer/dswayland-server-tizen-policy-ext.cpp',
- 'DSWaylandServer/dswayland-server-tizen-policy-ext.h',
- 'DSWaylandServer/DSWaylandCallback.cpp',
- 'DSWaylandServer/DSWaylandCallback.h',
- 'DSWaylandServer/DSWaylandCallbackPrivate.h',
- 'DSWaylandServer/DSWaylandOutput.cpp',
- 'DSWaylandServer/DSWaylandOutput.h',
- 'DSWaylandServer/DSWaylandOutputPrivate.h',
- 'DSWaylandServer/DSWaylandSurface.cpp',
- 'DSWaylandServer/DSWaylandSurface.h',
- 'DSWaylandServer/DSWaylandSurfacePrivate.h',
- 'DSWaylandServer/DSWaylandRegion.cpp',
- 'DSWaylandServer/DSWaylandRegion.h',
- 'DSWaylandServer/DSWaylandRegionPrivate.h',
- 'DSWaylandServer/DSWaylandTizenInputDevice.h',
- 'DSWaylandServer/DSWaylandTizenInputDevicePrivate.h',
- 'DSWaylandServer/DSWaylandTizenInputDeviceManager.cpp',
- 'DSWaylandServer/DSWaylandTizenInputDeviceManager.h',
- 'DSWaylandServer/DSWaylandTizenInputDeviceManagerPrivate.h',
- 'DSWaylandServer/DSWaylandTizenPolicy.cpp',
- 'DSWaylandServer/DSWaylandTizenPosition.cpp',
- 'DSWaylandServer/DSWaylandTizenVisibility.cpp',
- 'DSWaylandServer/DSWaylandTizenSurface.cpp',
- 'DSWaylandServer/DSWaylandTizenSurface.h',
- 'DSWaylandServer/DSWaylandTizenSurfacePrivate.h',
- 'DSWaylandServer/DSWaylandTizenSurfaceShm.cpp',
- 'DSWaylandServer/DSWaylandTizenSurfaceShm.h',
- 'DSWaylandServer/DSWaylandTizenSurfaceShmPrivate.h',
- 'DSWaylandServer/DSWaylandZxdgShellV6.cpp',
- 'DSWaylandServer/DSWaylandZxdgShellV6.h',
- 'DSWaylandServer/DSWaylandZxdgShellV6Private.h',
- 'DSWaylandServer/DSWaylandCompositorPrivate.h',
- 'DSWaylandServer/DSWaylandCompositor.h',
- 'DSWaylandServer/DSWaylandCompositor.cpp',
- 'DSWaylandServer/DSWaylandClientPrivate.h',
- 'DSWaylandServer/DSWaylandClient.h',
- 'DSWaylandServer/DSWaylandClient.cpp',
- 'DSWaylandServer/DSWaylandSeatPrivate.h',
- 'DSWaylandServer/DSWaylandSeat.h',
- 'DSWaylandServer/DSWaylandSeat.cpp',
- 'DSWaylandServer/DSWaylandPointerPrivate.h',
- 'DSWaylandServer/DSWaylandPointer.h',
- 'DSWaylandServer/DSWaylandPointer.cpp',
- 'DSWaylandServer/DSWaylandKeyboardPrivate.h',
- 'DSWaylandServer/DSWaylandKeyboard.h',
- 'DSWaylandServer/DSWaylandKeyboard.cpp',
- 'DSWaylandServer/DSWaylandTouchPrivate.h',
- 'DSWaylandServer/DSWaylandTouch.h',
- 'DSWaylandServer/DSWaylandTouch.cpp',
- 'DSWaylandServer/DSWaylandBufferPrivate.h',
- 'DSWaylandServer/DSWaylandBuffer.h',
- 'DSWaylandServer/DSWaylandBuffer.cpp',
- 'DSWaylandServer/DSWaylandTizenIndicatorPrivate.h',
- 'DSWaylandServer/DSWaylandTizenIndicator.h',
- 'DSWaylandServer/DSWaylandTizenIndicator.cpp',
- 'DSWaylandServer/DSWaylandInputMethodContextPrivate.h',
- 'DSWaylandServer/DSWaylandInputMethodContext.h',
- 'DSWaylandServer/DSWaylandInputMethodPrivate.h',
- 'DSWaylandServer/DSWaylandInputMethod.h',
- 'DSWaylandServer/DSWaylandInputMethod.cpp',
- 'DSWaylandServer/DSWaylandTextInputManagerPrivate.h',
- 'DSWaylandServer/DSWaylandTextInputManager.h',
- 'DSWaylandServer/DSWaylandTextInputPrivate.h',
- 'DSWaylandServer/DSWaylandTextInput.h',
- 'DSWaylandServer/DSWaylandTextInput.cpp',
- 'DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h',
- 'DSWaylandServer/DSWaylandInputPanelSurface.h',
- 'DSWaylandServer/DSWaylandInputPanelPrivate.h',
- 'DSWaylandServer/DSWaylandInputPanel.h',
- 'DSWaylandServer/DSWaylandInputPanel.cpp',
- 'DSWaylandServer/DSWaylandTizenAppinfoPrivate.h',
- 'DSWaylandServer/DSWaylandTizenAppinfo.h',
- 'DSWaylandServer/DSWaylandTizenAppinfo.cpp',
- 'DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h',
- 'DSWaylandServer/DSWaylandTizenLaunchEffect.h',
- 'DSWaylandServer/DSWaylandTizenLaunchEffect.cpp',
- 'DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h',
- 'DSWaylandServer/DSWaylandTizenLaunchSplash.h',
- 'DSWaylandServer/DSWaylandTizenLaunchSplash.cpp',
- 'DSWaylandServer/DSWaylandProtocolTracePrivate.h',
- 'DSWaylandServer/DSWaylandProtocolTraceStruct.h',
- 'DSWaylandServer/DSWaylandProtocolTrace.h',
- 'DSWaylandServer/DSWaylandProtocolTrace.cpp',
- 'DSWaylandServer/DSWaylandTizenPolicyExt.h',
- 'DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h',
- 'DSWaylandServer/DSWaylandTizenPolicyExt.cpp',
- ]
-
-libds_srcs += libds_wayland_srcs
-
-install_headers(
- 'DSObject/DSObject.h',
- 'DSSignal/DSSignal.h',
- 'DSBase/DSRefBase.h',
- )
-
-pkgconfig = import('pkgconfig')
-ecore_dep = dependency('ecore')
-ecore_evas_dep = dependency('ecore-evas')
-dlog_dep = dependency('dlog')
-libtdm_dep = dependency('libtdm')
-libtbm_dep = dependency('libtbm')
-wayland_tbm_server_dep = dependency('wayland-tbm-server')
-wayland_dep = dependency('wayland-server')
-libinput_dep = dependency('libinput')
-libudev_dep = dependency('libudev')
-xkbcommon_dep = dependency('xkbcommon')
-
-tizen_ext_dep = dependency('tizen-extension-server')
-xdg_shell_unstable_v6_dep = dependency('xdg-shell-unstable-v6-server')
-xdg_shell_dep = dependency('xdg-shell-server')
-tizen_surface_dep = dependency('tizen-surface-server')
-input_method_dep = dependency('input-method-server')
-text_dep = dependency('text-server')
-tizen_launch_dep = dependency('tizen-launch-server')
-tizen_policy_ext_dep = dependency('tizen-policy-ext-server')
-
-dali_core_dep = dependency('dali2-core')
-dali_adaptor_dep = dependency('dali2-adaptor')
-dali_toolkit_dep = dependency('dali2-toolkit')
-
-dali_deps = [dali_core_dep, dali_adaptor_dep, dali_toolkit_dep]
-tizen_ext_deps = [tizen_ext_dep, input_method_dep, text_dep, tizen_launch_dep, tizen_surface_dep]
-tizen_ext_deps += [xdg_shell_unstable_v6_dep, xdg_shell_dep, tizen_policy_ext_dep]
-libds_deps = [ecore_dep]
-
-libds_include_dirs = include_directories(
- '.',
- './DSBase',
- './DSBuffer',
- './DSCallback',
- './DSCanvas',
- './DSCompositor',
- './DSDebug',
- './DSDisplayArea',
- './DSDisplayDevice',
- './DSEventLoop',
- './DSInput',
- './DSObject',
- './DSOutput',
- './DSPolicyArea',
- './DSProperty',
- './DSRender',
- './DSSeat',
- './DSSignal',
- './DSCore',
- './DSWaylandExtension',
- './DSWaylandServer',
- './DSWindow',
- './DSWindowManager',
- './DSWindowShell',
- './DSZone',
- './DSClient',
- './DSXkb',
- './DSTextInput',
- './DSTizenAppinfo',
- './DSUtil',
- './DSTraceInfo',
- )
-
-libds_lib = shared_library(
- 'ds',
- libds_srcs,
- dependencies : [dlog_dep, libtdm_dep, wayland_dep, tizen_ext_deps, ecore_dep, ecore_evas_dep, libinput_dep, libudev_dep, xkbcommon_dep, libtbm_dep, wayland_tbm_server_dep, dali_deps],
- include_directories : [libds_include_dirs],
- version : meson.project_version(),
- install : true
- )
-
-pkgconfig.generate(
- filebase : 'libds',
- name : 'libds',
- description : 'Display Server library',
- version : meson.project_version(),
- libraries : libds_lib
- )
-
-libds_declared_dep = declare_dependency(
- link_with : libds_lib,
- dependencies : [libds_deps, ecore_dep],
- include_directories : [libds_include_dirs]
- )
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "IDSBuffer.h"
-#include "DSBufferManager.h"
-#include "DSBufferTBMImpl.h"
-#include "DSWaylandCompositor.h"
-
-using namespace display_server;
-
-class DSBufferManagerTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSBufferManagerTest, GetBufferManager)
-{
- DSBufferManager* bufferManager = DSBufferManager::getInstance();
- EXPECT_TRUE(bufferManager != nullptr);
-
- DSBufferManager::releaseInstance();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "IDSBuffer.h"
-#include "DSBufferRef.h"
-#include "DSBufferTBMImpl.h"
-
-using namespace display_server;
-
-class DSBufferRefTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSBufferRefTest, CreateBufferRef)
-{
- std::shared_ptr<IDSBuffer> buffer = std::make_unique<DSBufferTBMImpl>(100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(buffer.get() != nullptr);
-
- std::shared_ptr<DSBufferRef> bufferRef = std::make_shared<DSBufferRef>(buffer);
- EXPECT_TRUE(bufferRef.get() != nullptr);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "IDSBuffer.h"
-#include "DSBufferTBMImpl.h"
-#include "DSBufferQueueTBMImpl.h"
-
-using namespace display_server;
-
-class DSBufferTBMImplTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSBufferTBMImplTest, CreateBuffer)
-{
- std::unique_ptr<IDSBuffer> buffer = std::make_unique<DSBufferTBMImpl>(100, 200, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(buffer.get() != nullptr);
-
- std::shared_ptr<stSize> size = buffer->getSize();
- EXPECT_TRUE(size->w == 100);
- EXPECT_TRUE(size->h == 200);
-}
-
-TEST_F(DSBufferTBMImplTest, CreateBufferQueue)
-{
- std::unique_ptr<IDSBufferQueue> bufferQueue = std::make_unique<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue.get() != nullptr);
-}
-
-TEST_F(DSBufferTBMImplTest, CheckInitialValues)
-{
- std::unique_ptr<IDSBufferQueue> bufferQueue = std::make_unique<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue.get() != nullptr);
- EXPECT_TRUE(bufferQueue->getBufferWidth() == 100);
- EXPECT_TRUE(bufferQueue->getBufferHeight() == 100);
- EXPECT_TRUE(bufferQueue->getNativeBufferQueue() != nullptr);
-}
-
-TEST_F(DSBufferTBMImplTest, DequeueBuffer)
-{
- std::unique_ptr<IDSBufferQueue> bufferQueue = std::make_unique<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue.get() != nullptr);
-
- std::shared_ptr<IDSBuffer> buffer = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer != nullptr);
-}
-
-TEST_F(DSBufferTBMImplTest, EnqueueBuffer)
-{
- std::unique_ptr<IDSBufferQueue> bufferQueue = std::make_unique<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue.get() != nullptr);
-
- std::shared_ptr<IDSBuffer> buffer = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer != nullptr);
- EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer));
-}
-
-TEST_F(DSBufferTBMImplTest, AcquireBuffer)
-{
- std::unique_ptr<IDSBufferQueue> bufferQueue = std::make_unique<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue.get() != nullptr);
-
- std::shared_ptr<IDSBuffer> buffer1 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer1 != nullptr);
- EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer1));
- std::shared_ptr<IDSBuffer> buffer2 = bufferQueue->acquireBuffer();
- EXPECT_TRUE(buffer2 != nullptr);
-}
-
-TEST_F(DSBufferTBMImplTest, ReleaseBuffer)
-{
- std::unique_ptr<IDSBufferQueue> bufferQueue = std::make_unique<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue.get() != nullptr);
-
- std::shared_ptr<IDSBuffer> buffer1 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer1 != nullptr);
- EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer1));
- std::shared_ptr<IDSBuffer> buffer2 = bufferQueue->acquireBuffer();
- EXPECT_TRUE(buffer2 != nullptr);
- EXPECT_TRUE(bufferQueue->releaseBuffer(buffer2));
-}
-
-TEST_F(DSBufferTBMImplTest, DequeueBuffer_4Times)
-{
- std::unique_ptr<IDSBufferQueue> bufferQueue = std::make_unique<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue.get() != nullptr);
-
- std::shared_ptr<IDSBuffer> buffer1 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer1 != nullptr);
- std::shared_ptr<IDSBuffer> buffer2 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer2 != nullptr);
- std::shared_ptr<IDSBuffer> buffer3 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer3 != nullptr);
- EXPECT_TRUE(bufferQueue->releaseBuffer(buffer1));
- EXPECT_TRUE(bufferQueue->releaseBuffer(buffer2));
- EXPECT_TRUE(bufferQueue->releaseBuffer(buffer3));
-
- std::shared_ptr<IDSBuffer> buffer4 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer1.get() == buffer4.get());
- std::shared_ptr<IDSBuffer> buffer5 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer2.get() == buffer5.get());
- std::shared_ptr<IDSBuffer> buffer6 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer3.get() == buffer6.get());
- EXPECT_TRUE(bufferQueue->releaseBuffer(buffer4));
- EXPECT_TRUE(bufferQueue->releaseBuffer(buffer5));
- EXPECT_TRUE(bufferQueue->releaseBuffer(buffer6));
-}
-
-TEST_F(DSBufferTBMImplTest, CanAcquireBuffer)
-{
- auto bufferQueue = std::make_unique<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue.get() != nullptr);
-
- auto buffer1 = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer1 != nullptr);
- EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer1));
- EXPECT_TRUE(bufferQueue->canAcquireBuffer(true));
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSCanvas.h"
-#include "IDSOutput.h"
-#include "DSOutputImpl.h"
-#include "IDSDisplayDeviceOutput.h"
-#include "DSDisplayDeviceTDMImpl.h"
-
-using namespace display_server;
-
-class DSCanvasTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSCanvasTest, NewDSCanvas)
-{
- auto canvas = std::make_unique<DSCanvas>();
- EXPECT_TRUE(canvas != nullptr);
-}
-
-TEST_F(DSCanvasTest, attachPolicyArea_Positive1)
-{
- auto canvas = std::make_unique<DSCanvas>();
- EXPECT_TRUE(canvas != nullptr);
- auto policyArea = std::make_shared<DSPolicyArea>();
- EXPECT_TRUE(policyArea != nullptr);
- EXPECT_TRUE(canvas->attachPolicyArea(policyArea) == true);
-}
-
-TEST_F(DSCanvasTest, attachPolicyArea_Twice)
-{
- auto canvas = std::make_unique<DSCanvas>();
- EXPECT_TRUE(canvas != nullptr);
- auto policyArea = std::make_shared<DSPolicyArea>();
- EXPECT_TRUE(policyArea != nullptr);
- EXPECT_TRUE(canvas->attachPolicyArea(policyArea) == true);
-
- EXPECT_TRUE(canvas->attachPolicyArea(policyArea) == false);
-}
-
-TEST_F(DSCanvasTest, attachPolicyArea_N_DisplayArea)
-{
- auto canvas = std::make_unique<DSCanvas>();
- EXPECT_TRUE(canvas != nullptr);
-
- auto policyArea = std::make_shared<DSPolicyArea>();
- EXPECT_TRUE(policyArea != nullptr);
- EXPECT_TRUE(canvas->attachPolicyArea(policyArea) == true);
-
- auto displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
- EXPECT_TRUE(output != nullptr);
- EXPECT_TRUE(output->applyResolutionAuto() == true);
- auto displayArea = std::make_shared<DSDisplayArea>(output);
- EXPECT_TRUE(displayArea != nullptr);
- EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == true);
- }
-}
-
-TEST_F(DSCanvasTest, attachDisplayArea_Positive1)
-{
- auto canvas = std::make_unique<DSCanvas>();
- EXPECT_TRUE(canvas != nullptr);
-
- auto displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
- EXPECT_TRUE(output != nullptr);
- EXPECT_TRUE(output->applyResolutionAuto() == true);
- auto displayArea = std::make_shared<DSDisplayArea>(output);
- EXPECT_TRUE(displayArea != nullptr);
- EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == true);
- }
-}
-
-TEST_F(DSCanvasTest, attachDisplayArea_Twice)
-{
- auto canvas = std::make_unique<DSCanvas>();
- EXPECT_TRUE(canvas != nullptr);
-
- auto displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
- EXPECT_TRUE(output != nullptr);
- EXPECT_TRUE(output->applyResolutionAuto() == true);
- auto displayArea = std::make_shared<DSDisplayArea>(output);
- EXPECT_TRUE(displayArea != nullptr);
- EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == true);
-
- EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == false);
- }
-}
-
-TEST_F(DSCanvasTest, attachDisplayArea_N_PolicyArea)
-{
- auto canvas = std::make_unique<DSCanvas>();
- EXPECT_TRUE(canvas != nullptr);
-
- auto displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
- EXPECT_TRUE(output != nullptr);
- EXPECT_TRUE(output->applyResolutionAuto() == true);
- auto displayArea = std::make_shared<DSDisplayArea>(output);
- EXPECT_TRUE(displayArea != nullptr);
- EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == true);
-
- auto policyArea = std::make_shared<DSPolicyArea>();
- EXPECT_TRUE(policyArea != nullptr);
- EXPECT_TRUE(canvas->attachPolicyArea(policyArea) == true);
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSObject.h"
-#include "DSClient.h"
-#include "DSCompositor.h"
-#include "DSWaylandCompositor.h"
-#include "DSWindow.h"
-#include "DSWaylandClient.h"
-#include <list>
-
-using namespace display_server;
-
-class DSClientTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSClientTest, NewDSClientWithDSWaylandClient)
-{
- DSWaylandCompositor *dswlComp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(dswlComp != nullptr);
-
- if (dswlComp)
- {
- /* client must be created with a valid wl_client ptr later. */
- DSWaylandClient *dswlClient = new DSWaylandClient(dswlComp, (wl_client *)nullptr);
- EXPECT_TRUE(dswlClient != nullptr);
-
- if (dswlClient)
- {
- DSClient *client = new DSClient(nullptr, dswlClient);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- delete client;
-
- delete dswlClient;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSClientTest, AddRemoveHasWindow)
-{
- DSWindow *win = new DSWindow();
- EXPECT_TRUE(win != nullptr);
-
- if (win)
- {
- DSClient *client = new DSClient(nullptr);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- {
- client->addWindow(win);
- EXPECT_TRUE(client->hasWindow() == true);
-
- client->removeWindow(win);
- EXPECT_TRUE(client->hasWindow() != true);
-
- delete client;
- }
-
- delete win;
- }
-}
-
-TEST_F(DSClientTest, GetWindowsNumWindows)
-{
- DSWindow *win1 = new DSWindow();
- EXPECT_TRUE(win1 != nullptr);
-
- DSWindow *win2 = new DSWindow();
- EXPECT_TRUE(win2 != nullptr);
-
- DSWindow *win3 = new DSWindow();
- EXPECT_TRUE(win3 != nullptr);
-
- if (win1 && win2 && win3)
- {
- DSClient *client = new DSClient(nullptr);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- {
- client->addWindow(win1);
- EXPECT_TRUE(client->numWindows() == 1);
- client->addWindow(win2);
- EXPECT_TRUE(client->numWindows() == 2);
- client->addWindow(win3);
- EXPECT_TRUE(client->numWindows() == 3);
-
- int cnt = 3;
- std::list<DSWindow *> winList = client->getWindows();
- for (auto win : winList)
- {
- if (win == win1 ||
- win == win2 ||
- win == win3)
- cnt--;
- }
-
- EXPECT_TRUE(cnt == 0);
-
- client->removeWindow(win1);
- EXPECT_TRUE(client->numWindows() == 2);
- client->removeWindow(win2);
- EXPECT_TRUE(client->numWindows() == 1);
- client->removeWindow(win3);
- EXPECT_TRUE(client->numWindows() == 0);
-
- delete client;
- }
-
- delete win1;
- delete win2;
- delete win3;
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSCompositor.h"
-#include <Ecore.h>
-
-using namespace display_server;
-
-class DSCompositorTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- // for wl_display_add_socket(private_loop->wl_display, "tdm-socket") at tdm_server_init
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-class MockCompositor : public DSCompositor
-{
-public:
- MockCompositor() {}
- ~MockCompositor() {}
-
- std::shared_ptr<DSCanvas> _onInitialized() override
- {
- auto canvas = std::make_shared<DSCanvas>();
- return canvas;
- }
-
- void _onOutputAdded(std::shared_ptr<IDSOutput> output) override
- {}
-
- void _onOutputRemoved(std::shared_ptr<IDSOutput> output) override
- {}
-
- void _onInputAdded(std::shared_ptr<DSInput> input) override
- {}
-
- void _onInputRemoved(std::shared_ptr<DSInput> input) override
- {}
-};
-
-TEST_F(DSCompositorTest, NewDSCompositor)
-{
- std::shared_ptr<DSCompositor> compositor = std::make_shared<MockCompositor>();
- EXPECT_TRUE(compositor != nullptr);
-}
-
-TEST_F(DSCompositorTest, RunAndQuit)
-{
- std::shared_ptr<DSCompositor> compositor = std::make_shared<MockCompositor>();
- EXPECT_TRUE(compositor != nullptr);
-
- Ecore_Timer *timer = nullptr;
- double delayInSecond = 1.0;
- auto cb = [](void *data) -> Eina_Bool {
- MockCompositor *comp = (MockCompositor *)data;
- EXPECT_TRUE(comp->quit() == true);
- return EINA_FALSE;
- };
-
- timer = ecore_timer_loop_add(delayInSecond, cb, compositor.get());
- EXPECT_TRUE(timer != nullptr);
-
- if (timer != nullptr) {
- EXPECT_TRUE(compositor->run() == true);
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSDebugLog.h"
-
-using namespace display_server;
-
-class DSDebugLogTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSDebugLogTest, GetInstance)
-{
- DSDebugLog *log = DSDebugLog::GetInstance();
- EXPECT_TRUE(log->getLogLevel() == DSDebugLog::LOG_LEVEL_DEBUG);
-}
-
-TEST_F(DSDebugLogTest, PrintLog)
-{
- const char *str = "Hi world";
- DSDebugLog *log = DSDebugLog::GetInstance();
-
- log->printLog(DSDebugLog::LOG_LEVEL_DEBUG, "DSDebugLogTest", __func__, __LINE__, "Hello world");
- log->printLog(DSDebugLog::LOG_LEVEL_INFO, "DSDebugLogTest", __func__, __LINE__, "%s", str);
- log->printLog(DSDebugLog::LOG_LEVEL_WARN, "DSDebugLogTest", __func__, __LINE__, "Greeting world");
- log->printLog(DSDebugLog::LOG_LEVEL_ERR, "DSDebugLogTest", __func__, __LINE__, "Hey world");
-
- EXPECT_TRUE(true);
-}
-
-TEST_F(DSDebugLogTest, LogMacros)
-{
- const char *str = "Hi world";
-
- DSLOG_DBG("DSTEST", "Hello world");
- DSLOG_INF("DSTEST", "%s", str);
- DSLOG_WRN("DSTEST", "Greeting world");
- DSLOG_ERR("DSTEST", "Hey world");
-
- EXPECT_TRUE(true);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSDisplayArea.h"
-#include "IDSOutput.h"
-#include "DSOutputImpl.h"
-#include "IDSDisplayDeviceOutput.h"
-#include "DSDisplayDeviceTDMImpl.h"
-
-using namespace display_server;
-
-class DSDisplayAreaTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- // for wl_display_add_socket(private_loop->wl_display, "tdm-socket") at tdm_server_init
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSDisplayAreaTest, NewDSDisplayArea)
-{
- auto displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
- EXPECT_TRUE(output != nullptr);
- EXPECT_TRUE(output->applyResolutionAuto() == true);
-
- auto displayArea = std::make_shared<DSDisplayArea>(output);
- }
-}
-
-TEST_F(DSDisplayAreaTest, BasicMethods)
-{
- auto displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
- EXPECT_TRUE(output != nullptr);
- EXPECT_TRUE(output->applyResolutionAuto() == true);
-
- auto displayArea = std::make_shared<DSDisplayArea>(output);
- EXPECT_TRUE(displayArea->getWidth() == output->getResolutionWidth());
- EXPECT_TRUE(displayArea->getHeight() == output->getResolutionHeight());
- EXPECT_TRUE(displayArea->getOutput() == output);
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWindow.h"
-#include "DSDisplayDeviceTDMImpl.h"
-#include "DSDisplayDeviceOutputTDMImpl.h"
-
-using namespace display_server;
-
-class DSDisplayDeviceTDMImplTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-// DSDisplayDeviceTDMImpl
-class MockDisplayDevice : public DSObject
-{
-public:
- MockDisplayDevice()
- : flagOutputAdded(false),
- flagOutputRemoved(false)
- {}
- ~MockDisplayDevice()
- {}
-
- void outputAdded(std::shared_ptr<IDSDisplayDeviceOutput> output) {
- flagOutputAdded = true;
- }
-
- void outputRemoved(std::shared_ptr<IDSDisplayDeviceOutput> output) {
- flagOutputRemoved = true;
- }
-
- bool flagOutputAdded;
- bool flagOutputRemoved;
-};
-
-TEST_F(DSDisplayDeviceTDMImplTest, Device_New)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- EXPECT_TRUE(displayDevice != nullptr);
-}
-
-TEST_F(DSDisplayDeviceTDMImplTest, Device_getOutputList)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- EXPECT_TRUE(displayDevice != nullptr);
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-}
-
-TEST_F(DSDisplayDeviceTDMImplTest, Device_OutputAdded)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::shared_ptr<MockDisplayDevice> mockDisplayDevice = std::make_shared<MockDisplayDevice>();
- displayDevice->registerCallbackOutputAdded(mockDisplayDevice.get(), std::bind(&MockDisplayDevice::outputAdded, mockDisplayDevice, std::placeholders::_1));
-
- std::unique_ptr<DSDisplayDeviceTDMImpl> displayDeviceTDM(static_cast<DSDisplayDeviceTDMImpl*>(displayDevice.release())); // down-casting of std::unique_ptr
- displayDeviceTDM->callCallbackOutputAdded();
- EXPECT_TRUE(mockDisplayDevice->flagOutputAdded);
-}
-
-TEST_F(DSDisplayDeviceTDMImplTest, Device_OutputRemoved)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::shared_ptr<MockDisplayDevice> mockDisplayDevice = std::make_shared<MockDisplayDevice>();
- displayDevice->registerCallbackOutputRemoved(mockDisplayDevice.get(), std::bind(&MockDisplayDevice::outputRemoved, mockDisplayDevice, std::placeholders::_1));
-
- std::unique_ptr<DSDisplayDeviceTDMImpl> displayDeviceTDM(static_cast<DSDisplayDeviceTDMImpl*>(displayDevice.release())); // down-casting of std::unique_ptr
- displayDeviceTDM->callCallbackOutputRemoved();
- EXPECT_TRUE(mockDisplayDevice->flagOutputRemoved);
-}
-
-// DSDisplayDeviceTDMOutputImpl
-
-TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_getInitialValues)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED) {
- EXPECT_TRUE((output->getAvailableModes()).size() != 0);
- EXPECT_TRUE(output->getResolutionWidth() == 0);
- EXPECT_TRUE(output->getResolutionHeight() == 0);
- EXPECT_TRUE(output->getPhysicalMMWidth() == 0);
- EXPECT_TRUE(output->getPhysicalMMHeight() == 0);
- EXPECT_TRUE(output->getMode() == nullptr);
- EXPECT_TRUE(output->getDPMSMode() == IDSDisplayDeviceOutput::DPMS_OFF);
- EXPECT_TRUE(output->getHWC() != nullptr);
- } else { // IDSDisplayDeviceOutput::STATE_CONNECTED and IDSDisplayDeviceOutput::STATE_MODESET
- EXPECT_TRUE((output->getAvailableModes()).size() != 0);
- EXPECT_TRUE(output->getResolutionWidth() == 0);
- EXPECT_TRUE(output->getResolutionHeight() == 0);
- EXPECT_TRUE(output->getPhysicalMMWidth() > 0);
- EXPECT_TRUE(output->getPhysicalMMHeight() > 0);
- EXPECT_TRUE(output->getMode() == nullptr);
- EXPECT_TRUE(output->getDPMSMode() == IDSDisplayDeviceOutput::DPMS_OFF);
- EXPECT_TRUE(output->getHWC() != nullptr);
- }
- }
-}
-
-TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_setModeBestResolution)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- auto bestMode = (output->getAvailableModes()).front();
- EXPECT_TRUE(output->setMode(bestMode) == true);
- EXPECT_TRUE(output->getMode() == bestMode);
- }
-}
-
-class MockDisplayDeviceOutput : public DSObject
-{
-public:
- MockDisplayDeviceOutput()
- : flagOutputConnected(false),
- flagOutputDisconnected(false),
- flagOutputResolutionSet(false)
- {}
- ~MockDisplayDeviceOutput() = default;
-
- void outputConnected(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOuptut) {
- flagOutputConnected = true;
- }
-
- void outputDisconnected(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOuptut) {
- flagOutputDisconnected = true;
- }
-
- void outputResolutionSet(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOuptut) {
- flagOutputResolutionSet = true;
- }
-
- bool flagOutputConnected;
- bool flagOutputDisconnected;
- bool flagOutputResolutionSet;
-};
-
-TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_registerCallbackOutputConnected)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
- displayDeviceOutput->registerCallbackOutputConnected(mockDisplayDeviceOutput.get(), std::bind(&MockDisplayDeviceOutput::outputConnected, mockDisplayDeviceOutput, std::placeholders::_1));
-
- auto displayDeviceOutputTDM = std::dynamic_pointer_cast<DSDisplayDeviceOutputTDMImpl>(displayDeviceOutput); // down-casting of std::shared_ptr
- displayDeviceOutputTDM->callCallbackOutputConnected();
- EXPECT_TRUE(mockDisplayDeviceOutput->flagOutputConnected);
- }
-}
-
-TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_registerCallbackOutputDisconnected)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
- displayDeviceOutput->registerCallbackOutputDisconnected(mockDisplayDeviceOutput.get(), std::bind(&MockDisplayDeviceOutput::outputDisconnected, mockDisplayDeviceOutput, std::placeholders::_1));
-
- auto displayDeviceOutputTDM = std::dynamic_pointer_cast<DSDisplayDeviceOutputTDMImpl>(displayDeviceOutput); // down-casting of std::shared_ptr
- displayDeviceOutputTDM->callCallbackOutputDisconnected();
- EXPECT_TRUE(mockDisplayDeviceOutput->flagOutputDisconnected);
- }
-}
-
-TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_registerCallbackOutputResolutionSet)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- auto outputList = displayDevice->getOutputList();
- for (auto displayDeviceOutput : outputList) {
- auto mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
- displayDeviceOutput->registerCallbackOutputResolutionSet(mockDisplayDeviceOutput.get(), std::bind(&MockDisplayDeviceOutput::outputResolutionSet, mockDisplayDeviceOutput, std::placeholders::_1));
-
- auto displayDeviceOutputTDM = std::dynamic_pointer_cast<DSDisplayDeviceOutputTDMImpl>(displayDeviceOutput); // down-casting of std::shared_ptr
- displayDeviceOutputTDM->callCallbackOutputResolutionSet();
- EXPECT_TRUE(mockDisplayDeviceOutput->flagOutputResolutionSet);
- }
-}
-
-// DSDisplayDeviceTDMHWC
-
-TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_makeHWCWindow)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
- std::shared_ptr<IDSDisplayDeviceHWC> deviceHWC;
- std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- deviceHWC = output->getHWC();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- deviceHWCWindow = deviceHWC->makeHWCWindow();
- EXPECT_TRUE(deviceHWC != nullptr);
- }
-}
-
-TEST_F(DSDisplayDeviceTDMImplTest, DeviceHWC_commit)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
- std::shared_ptr<IDSDisplayDeviceHWC> deviceHWC;
- std::shared_ptr<IDSDisplayDeviceHWCWindow> deviceHWCWindow;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- auto bestMode = (output->getAvailableModes()).front();
- EXPECT_TRUE(output->setMode(bestMode) == true);
- EXPECT_TRUE(output->getMode() == bestMode);
-
- deviceHWC = output->getHWC();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto bufferQueue = deviceHWC->getTargetBufferQueue();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- deviceHWCWindow = deviceHWC->makeHWCWindow();
- EXPECT_TRUE(deviceHWC != nullptr);
- EXPECT_TRUE(deviceHWC->addVisibleHWCWindow(deviceHWCWindow));
-
- auto buffer = bufferQueue->dequeueBuffer();
- EXPECT_TRUE(buffer != nullptr);
- EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer));
-
- // commit
- EXPECT_TRUE(deviceHWC->commit());
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSEventLoop.h"
-#include <Ecore.h>
-
-using namespace display_server;
-
-class DSEventLoopTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSEventLoopTest, NewDSEventLoop)
-{
- DSEventLoop *eventLoop = DSEventLoop::getInstance();
- EXPECT_TRUE(eventLoop != nullptr);
- DSEventLoop::releaseInstance();
-}
-
-TEST_F(DSEventLoopTest, RunAndQuit)
-{
- DSEventLoop *eventLoop = DSEventLoop::getInstance();
-
- Ecore_Timer *timer = nullptr;
- double delayInSecond = 1.0;
- auto cb = [](void *data) -> Eina_Bool {
- DSEventLoop *loop = (DSEventLoop *)data;
- EXPECT_TRUE(loop->quit() == true);
- return EINA_FALSE;
- };
-
- timer = ecore_timer_loop_add(delayInSecond, cb, eventLoop);
- EXPECT_TRUE(timer != nullptr);
-
- if (timer != nullptr) {
- EXPECT_TRUE(eventLoop->run() == true);
- }
-
- DSEventLoop::releaseInstance();
-}
-
-TEST_F(DSEventLoopTest, registerCallbackIdleEnterer)
-{
- DSEventLoop *eventLoop = DSEventLoop::getInstance();
-
- Ecore_Timer *timer = nullptr;
- double delayInSecond = 1.0;
- auto timerCb = [](void *data) -> Eina_Bool {
- DSEventLoop *loop = (DSEventLoop *)data;
- EXPECT_TRUE(loop->quit() == true);
- return EINA_FALSE;
- };
-
- auto idleCb = [](void *data) -> Eina_Bool {
- EXPECT_TRUE(true);
- DSLOG_ERR("soolim", "idleCB");
- return EINA_TRUE;
- };
-
- timer = ecore_timer_loop_add(delayInSecond, timerCb, eventLoop);
- EXPECT_TRUE(timer != nullptr);
-
- eventLoop->registerCallbackIdleEnterer(nullptr, idleCb);
-
- if (timer != nullptr) {
- EXPECT_TRUE(eventLoop->run() == true);
- }
-
- DSEventLoop::releaseInstance();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSInput.h"
-#include "DSSeat.h"
-#include "DSInputEvent.h"
-
-using namespace display_server;
-
-class DSInputTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-class MockInput : public DSObject
-{
-public:
- MockInput()
- : device(std::make_shared<DSInputDevice>("None", "None", DSInput::NoneClass, DSInput::NoneSubclass))
- {}
- ~MockInput()
- {}
-
- void slotDeviceAdded(std::shared_ptr<DSInputDevice> device) {
- this->device.reset();
- this->device = device;
- }
-
- void slotDeviceRemoved(std::shared_ptr<DSInputDevice> device) {
- this->device.reset();
- this->device = device;
- }
-
- std::shared_ptr<DSInputDevice> device;
-};
-
-
-TEST_F(DSInputTest, NewDSInput)
-{
- DSInput *input = new DSInput();
- EXPECT_TRUE(input != nullptr);
-
- if (input)
- delete input;
-}
-
-TEST_F(DSInputTest, DSInputInit)
-{
- DSInput *input = new DSInput();
- EXPECT_TRUE(input != nullptr);
-
- if (input)
- {
- input->init();
- delete input;
- }
-}
-
-TEST_F(DSInputTest, DSInputDeviceAddedRemoved)
-{
- DSInput *input = new DSInput();
- DSInputDevice *device = new DSInputDevice("MockTestDevice", "MockTest", DSInput::KeyboardClass, DSInput::NoneSubclass);
- MockInput *mockInput = new MockInput;
- MockInput *mockInput2 = new MockInput;
-
- EXPECT_TRUE(input != nullptr);
- EXPECT_TRUE(device != nullptr);
- EXPECT_TRUE(mockInput != nullptr);
- EXPECT_TRUE(mockInput2 != nullptr);
-
- if (input)
- {
- input->init();
-
- input->registerCallbackDeviceAdd(mockInput, std::bind(&MockInput::slotDeviceAdded, mockInput, std::placeholders::_1));
- input->deviceAdd(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
- EXPECT_TRUE(*(mockInput->device.get()) == *device);
-
- input->registerCallbackDeviceAdd(mockInput2, std::bind(&MockInput::slotDeviceAdded, mockInput2, std::placeholders::_1));
- input->deviceAdd(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
- EXPECT_FALSE(*(mockInput2->device.get()) == *device);
-
- input->registerCallbackDeviceRemove(mockInput, std::bind(&MockInput::slotDeviceRemoved, mockInput, std::placeholders::_1));
- input->deviceRemove(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
- EXPECT_TRUE(*(mockInput->device.get()) == *device);
-
- input->registerCallbackDeviceRemove(mockInput2, std::bind(&MockInput::slotDeviceRemoved, mockInput2, std::placeholders::_1));
- input->deviceRemove(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
-
- EXPECT_FALSE(*(mockInput2->device.get()) == *device);
-
- delete mockInput2;
- delete mockInput;
- delete device;
- delete input;
- }
-}
-
-
-class DSInputDeviceTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {}
- void TearDown(void) override
- {}
-};
-
-TEST_F(DSInputDeviceTest, NewDSInputDevice)
-{
- DSInputDevice *inputDevice = new DSInputDevice;
- delete inputDevice;
- inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::NoneClass, DSInput::NoneSubclass);
- delete inputDevice;
- ASSERT_TRUE(true);
-}
-
-TEST_F(DSInputDeviceTest, DSInputDeviceSetGetName)
-{
- std::string tName = "TestDevice";
- DSInputDevice *inputDevice = new DSInputDevice;
- inputDevice->setName(tName);
- std::string name = inputDevice->getName();
- EXPECT_TRUE(name.compare(tName) == 0);
- delete inputDevice;
-}
-
-TEST_F(DSInputDeviceTest, DSInputDeviceSetGetIdentifier)
-{
- std::string tIdentifier = "virtual-0";
- DSInputDevice *inputDevice = new DSInputDevice;
- inputDevice->setIdentifier(tIdentifier);
- std::string identifier = inputDevice->getIdentifier();
- EXPECT_TRUE(identifier.compare(tIdentifier) == 0);
- delete inputDevice;
-}
-
-TEST_F(DSInputDeviceTest, DSInputDeviceSetGetClass)
-{
- DSInput::DeviceClass tDevClass;
- DSInput::DeviceClass devClass;
- DSInputDevice *inputDevice = new DSInputDevice;
-
- tDevClass = DSInput::PointerClass;
- inputDevice->setClass(tDevClass);
- devClass = inputDevice->getClass();
- EXPECT_TRUE(tDevClass == devClass);
-
- tDevClass = DSInput::KeyboardClass;
- inputDevice->setClass(tDevClass);
- devClass = inputDevice->getClass();
- EXPECT_TRUE(tDevClass == devClass);
-
- tDevClass = DSInput::TouchClass;
- inputDevice->setClass(tDevClass);
- devClass = inputDevice->getClass();
- EXPECT_TRUE(tDevClass == devClass);
-
- delete inputDevice;
-}
-
-TEST_F(DSInputDeviceTest, DSInputDeviceSetGetSubclass)
-{
- DSInput::DeviceSubclass tDevSubclass;
- DSInputDevice *inputDevice = new DSInputDevice;
-
- tDevSubclass = DSInput::NoneSubclass;
- inputDevice->setSubclass(tDevSubclass);
- DSInput::DeviceSubclass devSubclass = inputDevice->getSubclass();
- EXPECT_TRUE(tDevSubclass == devSubclass);
-
- delete inputDevice;
-}
-
-class DSInputEventTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {}
- void TearDown(void) override
- {}
-};
-
-TEST_F(DSInputEventTest, NewDSInputEvent)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::NoneClass, DSInput::NoneSubclass);
- DSInputEvent *inputEvent = new DSInputEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime);
-
- EXPECT_TRUE(inputEvent != nullptr);
-
- delete inputEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputEventTest, GetDevice)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::NoneClass, DSInput::NoneSubclass);
- DSInputEvent *inputEvent = new DSInputEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime);
-
- EXPECT_TRUE(*(inputEvent->getDevice().get()) == *inputDevice);
-
- delete inputEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputEventTest, GetType)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::NoneClass, DSInput::NoneSubclass);
- DSInputEvent *inputEvent = new DSInputEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime);
-
- EXPECT_TRUE(inputEvent->getType() == eventType);
-
- delete inputEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputEventTest, GetTimestamp)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::NoneClass, DSInput::NoneSubclass);
- DSInputEvent *inputEvent = new DSInputEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime);
-
- EXPECT_TRUE((unsigned int)inputEvent->getTimestamp() == curTime);
-
- delete inputEvent;
- delete inputDevice;
-}
-
-class DSInputKeyboardEventTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {}
- void TearDown(void) override
- {}
-};
-
-TEST_F(DSInputKeyboardEventTest, NewDSInputKeyboardEvent)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int keycode = 166;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::KeyboardClass, DSInput::NoneSubclass);
- DSInputKeyboardEvent *keyboardEvent = new DSInputKeyboardEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, keycode);
-
- EXPECT_TRUE(keyboardEvent != nullptr);
-
- delete keyboardEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputKeyboardEventTest, GetKeycode)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int keycode = 166;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::KeyboardClass, DSInput::NoneSubclass);
- DSInputKeyboardEvent *keyboardEvent = new DSInputKeyboardEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, keycode);
-
- EXPECT_TRUE(keyboardEvent->getKeycode() == keycode);
-
- delete keyboardEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputKeyboardEventTest, GetSetKeyname)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int keycode = 166;
- std::string keyname = "TestKey";
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::KeyboardClass, DSInput::NoneSubclass);
- DSInputKeyboardEvent *keyboardEvent = new DSInputKeyboardEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, keycode);
- keyboardEvent->setKeyname(keyname);
-
- EXPECT_TRUE(keyboardEvent->getKeyname() == keyname);
-
- delete keyboardEvent;
- delete inputDevice;
-}
-
-class DSInputMouseEventTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {}
- void TearDown(void) override
- {}
-};
-
-TEST_F(DSInputMouseEventTest, NewDSInputMouseEvent)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int button = 1, x = 10, y = 20, z = 1;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::PointerClass, DSInput::NoneSubclass);
- DSInputMouseEvent *mouseEvent = new DSInputMouseEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, button, x, y, z);
-
- EXPECT_TRUE(mouseEvent != nullptr);
-
- delete mouseEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputMouseEventTest, GetAxis)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int button = 1, x = 10, y = 20, z = 1;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::PointerClass, DSInput::NoneSubclass);
- DSInputMouseEvent *mouseEvent = new DSInputMouseEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, button, x, y, z);
-
- EXPECT_TRUE(mouseEvent->getX() == x);
- EXPECT_TRUE(mouseEvent->getY() == y);
- EXPECT_TRUE(mouseEvent->getZ() == z);
-
- delete mouseEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputMouseEventTest, GetSetWinAxis)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int button = 1, x = 10, y = 20, z = 1;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::PointerClass, DSInput::NoneSubclass);
- DSInputMouseEvent *mouseEvent = new DSInputMouseEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, button, x, y, z);
-
- mouseEvent->setWinX(x);
- mouseEvent->setWinY(y);
- mouseEvent->setWinZ(z);
-
- EXPECT_TRUE(mouseEvent->getWinX() == x);
- EXPECT_TRUE(mouseEvent->getWinY() == y);
- EXPECT_TRUE(mouseEvent->getWinZ() == z);
-
- delete mouseEvent;
- delete inputDevice;
-}
-
-class DSInputTouchEventTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {}
- void TearDown(void) override
- {}
-};
-
-TEST_F(DSInputTouchEventTest, NewDSInputTouchEvent)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int index = 0, x = 10, y = 20;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::TouchClass, DSInput::NoneSubclass);
- DSInputTouchEvent *touchEvent = new DSInputTouchEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, index, x, y);
-
- EXPECT_TRUE(touchEvent != nullptr);
-
- delete touchEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputTouchEventTest, GetAxis)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int index = 0, x = 10, y = 20;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::TouchClass, DSInput::NoneSubclass);
- DSInputTouchEvent *touchEvent = new DSInputTouchEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, index, x, y);
-
- EXPECT_TRUE(touchEvent->getX() == x);
- EXPECT_TRUE(touchEvent->getY() == y);
-
- delete touchEvent;
- delete inputDevice;
-}
-
-TEST_F(DSInputTouchEventTest, GetSetWinAxis)
-{
- DSInputEvent::Type eventType = DSInputEvent::NoneEvent;
- unsigned int curTime = 0;
- int index = 0, x = 10, y = 20;
- DSInputDevice *inputDevice = new DSInputDevice("TestDevice", "virtual-0", DSInput::TouchClass, DSInput::NoneSubclass);
- DSInputTouchEvent *touchEvent = new DSInputTouchEvent(std::make_shared<DSInputDevice>(*inputDevice), eventType, curTime, index, x, y);
-
- touchEvent->setWinX(x);
- touchEvent->setWinY(y);
-
- EXPECT_TRUE(touchEvent->getWinX() == x);
- EXPECT_TRUE(touchEvent->getWinY() == y);
-
- delete touchEvent;
- delete inputDevice;
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSKeyboard.h"
-#include "DSSeat.h"
-#include "DSWaylandKeyboard.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandCompositor.h"
-#include "DSWindow.h"
-#include "DSWaylandSurface.h"
-
-using namespace display_server;
-
-class DSKeyboardTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSKeyboardTest, NewDSKeyboardWithDSSeat)
-{
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- auto keyboard = new DSKeyboard(seat);
- EXPECT_TRUE(keyboard != nullptr);
- }
-}
-
-TEST_F(DSKeyboardTest, NewDSKeyboardWithDSWaylandKeyboard)
-{
- auto waylandCompositor = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(waylandCompositor != nullptr);
-
- if (waylandCompositor)
- {
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- auto waylandSeat = new DSWaylandSeat(waylandCompositor, DSWaylandSeat::capAll);
- EXPECT_TRUE(waylandSeat != nullptr);
-
- if (seat && waylandSeat)
- {
- auto waylandKeyboard = new DSWaylandKeyboard(waylandSeat);
- EXPECT_TRUE(waylandKeyboard != nullptr);
-
- if (waylandKeyboard)
- {
- auto keyboard = new DSKeyboard(seat, waylandKeyboard);
- EXPECT_TRUE(keyboard != nullptr);
- }
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-
-}
-TEST_F(DSKeyboardTest, BasicMethods)
-{
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- auto window = std::make_shared<DSWindow>();
- EXPECT_TRUE(window != nullptr);
-
- auto waylandSurface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(waylandSurface != nullptr);
-
- window->create(waylandSurface);
-
- if (seat && window)
- {
- auto keyboard = new DSKeyboard(seat);
- EXPECT_TRUE(keyboard != nullptr);
-
- if (keyboard)
- {
- keyboard->setFocus(window);
- EXPECT_TRUE(window == keyboard->getFocus());
-
- keyboard->keyDown(100);
- keyboard->keyUp(100);
-
- keyboard->setRepeatRate(25);
- keyboard->setRepeatDelay(400);
- }
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSCore.h"
-#include "DSObject.h"
-
-using namespace display_server;
-
-class DSObjectTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Temporary classes for implemting PImpl Idiom based on DSObject/DSObjectPrivate classes */
-class TempObject;
-class TempObjectPrivate : public DSObjectPrivate
-{
- DS_PIMPL_USE_PUBLIC(TempObject);
-public:
- TempObjectPrivate() = delete;
- TempObjectPrivate(TempObject *p_ptr);
- ~TempObjectPrivate();
-
- unsigned int funcMiddle(void);
-
-protected:
-
-private:
-};
-
-class TempObject : public DSObject
-{
- DS_PIMPL_USE_PRIVATE(TempObject);
-public:
- explicit TempObject();
- virtual ~TempObject();
-
- unsigned int funcEnter(unsigned int val);
- unsigned int funcExit();
-
-protected:
-
-private:
- unsigned int __val = 0;
-};
-
-TempObjectPrivate::TempObjectPrivate(TempObject *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr)
-{
- ;
-}
-
-TempObjectPrivate::~TempObjectPrivate()
-{
- ;
-}
-
-unsigned int TempObjectPrivate::funcMiddle(void)
-{
- DS_GET_PUB(TempObject);
-
- return pub->funcExit();
-}
-
-TempObject::TempObject()
- : DS_INIT_PRIVATE_PTR(TempObject)
-{
- __val = 0;
-}
-
-unsigned int TempObject::funcEnter(unsigned int val)
-{
- DS_GET_PRIV(TempObject);
- __val = val;
- return priv->funcMiddle();
-}
-
-unsigned int TempObject::funcExit()
-{
- return __val;
-}
-
-TempObject::~TempObject()
-{
- ;
-}
-
-/* Test cases */
-TEST_F(DSObjectTest, NewDSObject)
-{
- DSObject *obj = new DSObject;
- EXPECT_TRUE(obj != nullptr);
-
- if (obj)
- delete obj;
-}
-
-TEST_F(DSObjectTest, DSObjectSetGetName)
-{
- std::string gName;
-
- DSObject *obj = new DSObject();
- EXPECT_TRUE(obj != nullptr);
-
- if (obj)
- {
- obj->setName(std::string{"DSObject"});
- gName = obj->getName();
- EXPECT_TRUE(gName.empty() == false);
- EXPECT_TRUE(gName.compare(std::string{"DSObject"}) == 0);
-
- if (!gName.empty())
- gName.clear();
-
- delete obj;
- }
-}
-
-TEST_F(DSObjectTest, DSObjectSetGetProperty)
-{
- DSObject *obj = new DSObject();
- ASSERT_NE(obj, nullptr) << "Failed to create DSObject";
-
- obj->setProperty("testKey", "testValue", DSPropertyType::STRING);
-
- try
- {
- std::string data = std::get<std::string>(obj->getProperty("testKey"));
- EXPECT_EQ(data, "testValue") << "value mismatch";
- }
- catch(const DSPropertyException &e)
- {
- ASSERT_TRUE(false) << "Exception catched! : " << e.what();
- }
-
- delete obj;
-}
-
-TEST_F(DSObjectTest, NewDSObjecPrivate)
-{
- DSObject *obj = nullptr;
- DSObjectPrivate *objPrivate = nullptr;
-
- obj = new DSObject();
- EXPECT_TRUE(obj != nullptr);
-
- if (obj)
- {
- objPrivate = new DSObjectPrivate(obj);
- EXPECT_TRUE(objPrivate != nullptr);
-
- if (objPrivate)
- delete objPrivate;
-
- delete obj;
- }
-}
-
-TEST_F(DSObjectTest, NewTempObject)
-{
- TempObject *obj = new TempObject();
- EXPECT_TRUE(obj != nullptr);
-
- if (obj)
- delete obj;
-}
-
-TEST_F(DSObjectTest, DerivedObjectSetGetName)
-{
- std::string gName;
-
- TempObject *obj = new TempObject();
- EXPECT_TRUE(obj != nullptr);
-
- if (obj)
- {
- obj->setName(std::string{"TempObject"});
- gName = obj->getName();
- EXPECT_TRUE(gName.empty() == false);
- EXPECT_TRUE(gName.compare(std::string{"TempObject"}) == 0);
-
- if (!gName.empty())
- gName.clear();
-
- delete obj;
- }
-}
-
-TEST_F(DSObjectTest, DerivedObjectGetProperty)
-{
- TempObject *obj = new TempObject();
- ASSERT_NE(obj, nullptr) << "Failed to create TempObject";
-
- obj->setProperty("testKey", "testValue", DSPropertyType::STRING);
-
- try
- {
- std::string data = std::get<std::string>(obj->getProperty("testKey"));
- EXPECT_EQ(data, "testValue") << "value mismatch";
- }
- catch(const DSPropertyException &e)
- {
- ASSERT_TRUE(false) << "Exception catched! : " << e.what();
- }
-
- delete obj;
-}
-
-TEST_F(DSObjectTest, DerivedObjectPimpl)
-{
- unsigned int vIn = 0xdeadbeaf;
- unsigned int vOut = 0;
-
- TempObject *obj = new TempObject();
- EXPECT_TRUE(obj != nullptr);
-
- if (obj)
- {
- vOut = obj->funcEnter(vIn);
- EXPECT_TRUE(vOut == vIn);
-
- delete obj;
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "IDSOutput.h"
-#include "DSOutputImpl.h"
-#include "IDSDisplayDeviceOutput.h"
-#include "DSDisplayDeviceOutputTDMImpl.h"
-
-using namespace display_server;
-
-class DSOutputTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSOutputTest, NewDSOutput)
-{
- auto displayDeviceOutput = std::make_shared<DSDisplayDeviceOutputTDMImpl>();
- EXPECT_TRUE(displayDeviceOutput != nullptr);
- auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
- EXPECT_TRUE(output != nullptr);
-}
-
-TEST_F(DSOutputTest, BasicMethods)
-{
- auto displayDeviceOutput = std::make_shared<DSDisplayDeviceOutputTDMImpl>();
- EXPECT_TRUE(displayDeviceOutput != nullptr);
- auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
- EXPECT_TRUE(output != nullptr);
-
- EXPECT_TRUE(output->getResolutionWidth() == 0);
- EXPECT_TRUE(output->getResolutionHeight() == 0);
- EXPECT_TRUE(output->applyResolutionAuto() == false);
- EXPECT_TRUE(output->getDisplayDeviceOutput() == displayDeviceOutput);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSPointer.h"
-#include "DSSeat.h"
-#include "DSWaylandPointer.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandCompositor.h"
-#include "DSWindow.h"
-#include "DSWaylandSurface.h"
-
-using namespace display_server;
-
-class DSPointerTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSPointerTest, NewDSPointerWithDSSeat)
-{
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- auto pointer = new DSPointer(seat);
- EXPECT_TRUE(pointer != nullptr);
- }
-}
-
-TEST_F(DSPointerTest, NewDSPointerWithDSWaylandPointer)
-{
- auto waylandCompositor = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(waylandCompositor != nullptr);
-
- if (waylandCompositor)
- {
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- auto waylandSeat = new DSWaylandSeat(waylandCompositor, DSWaylandSeat::capAll);
- EXPECT_TRUE(waylandSeat != nullptr);
-
- if (seat && waylandSeat)
- {
- auto waylandPointer = new DSWaylandPointer(waylandSeat);
- EXPECT_TRUE(waylandPointer != nullptr);
-
- if (waylandPointer)
- {
- auto pointer = new DSPointer(seat, waylandPointer);
- EXPECT_TRUE(pointer != nullptr);
- }
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-
-}
-TEST_F(DSPointerTest, BasicMethods)
-{
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- auto window = std::make_shared<DSWindow>();
- EXPECT_TRUE(window != nullptr);
-
- auto waylandSurface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(waylandSurface != nullptr);
-
- window->create(waylandSurface);
-
- if (seat && window)
- {
- auto pointer = new DSPointer(seat);
- EXPECT_TRUE(pointer != nullptr);
-
- if (pointer)
- {
- pointer->setFocus(window);
- EXPECT_TRUE(window == pointer->getFocus());
- }
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSPolicyArea.h"
-
-using namespace display_server;
-
-class DSPolicyAreaTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSPolicyAreaTest, NewDSPolicyArea)
-{
- std::unique_ptr<DSPolicyArea> policyArea = std::make_unique<DSPolicyArea>();
- EXPECT_TRUE(policyArea != nullptr);
-}
-
-TEST_F(DSPolicyAreaTest, BasicMethods)
-{
- std::unique_ptr<DSPolicyArea> policyArea = std::make_unique<DSPolicyArea>();
- EXPECT_TRUE(policyArea != nullptr);
- std::shared_ptr<DSSeat> seat = std::make_shared<DSSeat>();
- EXPECT_TRUE(seat != nullptr);
-
- EXPECT_TRUE(policyArea->setPosition(10, 10) == true);
- EXPECT_TRUE(policyArea->setSize(100, 100) == true);
- EXPECT_TRUE(policyArea->attachSeat(seat) == true);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSProperty.h"
-
-using namespace display_server;
-
-class DSPropertyTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSPropertyTest, NewDSProperty)
-{
- /* DSProperty::DSProperty()*/
- DSProperty *pro = new DSProperty();
- ASSERT_NE(pro, nullptr) << "Failed to DSProperty()";
- delete pro;
-}
-
-TEST_F(DSPropertyTest, SetGetProperty)
-{
- /* DSProperty::DSProperty(std::__cxx11::string, const DSPropertyVariant&, DSPropertyType) */
- DSProperty *pro = new DSProperty("testProperty", 2020, DSPropertyType::INTEGER);
- ASSERT_NE(pro, nullptr) << "Failed to DSProperty(key, data, type)";
- ASSERT_EQ(pro->getKey(), "testProperty") << "Key value mismatch!";
- ASSERT_EQ(pro->getType(), DSPropertyType::INTEGER) << "Type mistmatch!!";
- try {
- int data = std::get<int>(pro->getData());
- ASSERT_TRUE(data == 2020) << "data value mismatch!!";
- } catch (DSPropertyException &e) {
- ASSERT_TRUE(false) << e.what();
- }
- delete pro;
-}
-
-TEST_F(DSPropertyTest, NewProperty2)
-{
- /* DSProperty::DSProperty(DSProperty&) */
- DSProperty pro_s("testProperty2", 20.20, DSPropertyType::DOUBLE);
- DSProperty *pro = new DSProperty(pro_s);
- ASSERT_NE(pro, nullptr) << "Failed to DSProperty(const DSProperty&)";
- ASSERT_EQ(pro->getKey(), "testProperty2") << "Key value mismatch!";
- ASSERT_EQ(pro->getType(), DSPropertyType::DOUBLE) << "Type mistmatch!!";
- try {
- double data = std::get<double>(pro->getData());
- ASSERT_TRUE(data == 20.20) << "data value mismatch!!";
- } catch (DSPropertyException &e) {
- ASSERT_TRUE(false) << e.what();
- }
- delete pro;
-}
-
-TEST_F(DSPropertyTest, CopyAssign)
-{
- /* DSProperty::DSProperty(DSProperty&) */
- DSObject *obj = new DSObject();
- DSProperty pro_s("testProperty3", (void *)obj, DSPropertyType::POINTER);
- DSProperty pro = pro_s;
- ASSERT_EQ(pro.getKey(), "testProperty3") << "Key value mismatch!";
- ASSERT_EQ(pro.getType(), DSPropertyType::POINTER) << "Type mistmatch!!";
- try {
- DSObject *data = (DSObject *)std::get<void *>(pro.getData());
- ASSERT_TRUE(data == obj) << "data value mismatch!!";
- } catch (DSPropertyException &e) {
- ASSERT_TRUE(false) << e.what();
- }
-
- if (obj) delete obj;
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSRefBase.h"
-
-using namespace display_server;
-
-class DSRefBaseTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSRefBaseTest, CreateRefBase)
-{
- DSRefBase *refBase = new DSRefBase();
-
- int count1;
- int count2;
-
- count1 = refBase->getref();
- refBase->ref();
- count2 = refBase->getref();
- refBase->unref();
- refBase->unref();
-
- ASSERT_TRUE(count1 == 1);
- ASSERT_TRUE(count2 == 2);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSRenderEngineDaliImpl.h"
-#include "DSBufferQueueTBMImpl.h"
-#include "DSBufferTBMImpl.h"
-#include "DSEventLoop.h"
-#include <Ecore.h>
-
-#include "DSDisplayDeviceTDMImpl.h"
-#include "DSDisplayDeviceOutputTDMImpl.h"
-
-#include <tbm_surface.h>
-#include <tbm_surface_internal.h>
-
-#include <unistd.h>
-
-using namespace display_server;
-
-class DSRenderEngineDaliTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- Ecore_Timer *timer = nullptr;
-
- DSWaylandCompositor::getInstance();
- __eventLoop = DSEventLoop::getInstance();
- double delayInSecond = 0.5;
- auto timerCb = [](void *data) -> Eina_Bool {
- DSEventLoop *loop = (DSEventLoop *)data;
- EXPECT_TRUE(loop->quit() == true);
- return EINA_FALSE;
- };
-
- timer = ecore_timer_loop_add(delayInSecond, timerCb, __eventLoop);
- EXPECT_TRUE(timer != nullptr);
-
- __eventLoop->run();
-
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- setenv("TBM_DISPLAY_SERVER", "1", 1);
- }
- void TearDown(void) override
- {
- __eventLoop->quit();
- DSEventLoop::releaseInstance();
- DSWaylandCompositor::releaseInstance();
-
- unsetenv("XDG_RUNTIME_DIR");
- unsetenv("TBM_DISPLAY_SERVER");
- }
-
- tbm_surface_h createTbmTexture(int w, int h, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
- {
- tbm_surface_h tbmSurface;
- tbm_surface_info_s tbmSurface_info;
-
- tbmSurface = tbm_surface_create(w, h, TBM_FORMAT_ARGB8888);
- tbm_surface_map(tbmSurface, TBM_SURF_OPTION_WRITE | TBM_SURF_OPTION_READ, &tbmSurface_info);
-
- uint32_t stride = tbmSurface_info.planes[0].stride;
- unsigned char *ptr = tbmSurface_info.planes[0].ptr;
-
- for (int j = 0; j < h; j++)
- {
- for (int i = 0; i < (int)stride/4; i++)
- {
- if (i < w) {
- ptr[0] = b;
- ptr[1] = g;
- ptr[2] = r;
- ptr[3] = a;
- }
- ptr += 4;
- }
- }
- tbm_surface_unmap(tbmSurface);
-
- return tbmSurface;
- }
-
-private:
- DSEventLoop *__eventLoop;
-};
-
-TEST_F(DSRenderEngineDaliTest, RenderEngine_Create)
-{
- auto bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue != nullptr);
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
-}
-
-TEST_F(DSRenderEngineDaliTest, RenderEngine_CreateRenderView)
-{
- auto bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue != nullptr);
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
- auto renderView = renderEngine->makeRenderView();
- EXPECT_TRUE(renderView != nullptr);
-}
-
-TEST_F(DSRenderEngineDaliTest, RenderView_SetBuffer)
-{
- auto bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue != nullptr);
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
- auto renderView = renderEngine->makeRenderView();
- EXPECT_TRUE(renderView != nullptr);
- auto buffer = std::make_shared<DSBufferTBMImpl>(100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(renderView->setBuffer(buffer));
-}
-
-TEST_F(DSRenderEngineDaliTest, RenderEngine_RenderFrame)
-{
- auto bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue != nullptr);
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
- auto renderView = renderEngine->makeRenderView();
- EXPECT_TRUE(renderView != nullptr);
- auto buffer = std::make_shared<DSBufferTBMImpl> (100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(renderView->setBuffer(buffer));
- EXPECT_TRUE(renderEngine->renderFrame());
-}
-
-TEST_F(DSRenderEngineDaliTest, RenderEngine_RenderOnlyOneFrame)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
- std::shared_ptr<IDSDisplayDeviceHWC> deviceHWC;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- auto bestMode = (output->getAvailableModes()).front();
- EXPECT_TRUE(output->setMode(bestMode) == true);
- EXPECT_TRUE(output->getMode() == bestMode);
-
- deviceHWC = output->getHWC();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto bufferQueue = deviceHWC->getTargetBufferQueue();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
- auto renderView = renderEngine->makeRenderView();
- EXPECT_TRUE(renderView != nullptr);
-
- int imgWidth = 500;
- int imgHeight = 500;
-
- tbm_surface_h tbmTexture = DSRenderEngineDaliTest::createTbmTexture(
- imgWidth, imgHeight, 255, 0, 0, 255);
- EXPECT_TRUE(tbmTexture != nullptr);
-
- auto imageSourceBuffer = std::make_shared<DSBufferTBMImpl> (imgWidth, imgHeight, IDSBuffer::FORMAT_ARGB8888, tbmTexture);
- EXPECT_TRUE(renderView->setBuffer(imageSourceBuffer));
- EXPECT_TRUE(renderEngine->renderFrame());
-
- usleep(1000000);
-
- EXPECT_TRUE(bufferQueue->canAcquireBuffer(true));
-
- // commit
- EXPECT_TRUE(deviceHWC->commit());
-
- usleep(1000000);
- }
-}
-
-TEST_F(DSRenderEngineDaliTest, RenderEngine_ComposeTwoRenderView)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
- std::shared_ptr<IDSDisplayDeviceHWC> deviceHWC;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- auto bestMode = (output->getAvailableModes()).front();
- EXPECT_TRUE(output->setMode(bestMode) == true);
- EXPECT_TRUE(output->getMode() == bestMode);
-
- deviceHWC = output->getHWC();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto bufferQueue = deviceHWC->getTargetBufferQueue();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
-
- int imgWidth = 500;
- int imgHeight = 500;
-
- // for 1st renderView -- begin --
- auto renderViewA = renderEngine->makeRenderView();
- EXPECT_TRUE(renderViewA != nullptr);
-
- // create RED image buffer
- tbm_surface_h tbmTextureA = DSRenderEngineDaliTest::createTbmTexture(
- imgWidth, imgHeight, 255, 0, 0, 255);
- EXPECT_TRUE(tbmTextureA != nullptr);
-
- auto imageSourceBufferA = std::make_shared<DSBufferTBMImpl> (imgWidth, imgHeight, IDSBuffer::FORMAT_ARGB8888, tbmTextureA);
- EXPECT_TRUE(renderViewA->setBuffer(imageSourceBufferA));
- // -- end --
-
- // for 2nd renderView -- begin --
- auto renderViewB = renderEngine->makeRenderView();
- EXPECT_TRUE(renderViewB != nullptr);
-
- // The buffer size of the second renderView is half of the first.
- // create BLUE image buffer
- tbm_surface_h tbmTextureB = DSRenderEngineDaliTest::createTbmTexture(
- imgWidth/2, imgHeight/2, 0, 0, 255, 255);
- EXPECT_TRUE(tbmTextureB != nullptr);
-
- auto imageSourceBufferB = std::make_shared<DSBufferTBMImpl> (imgWidth/2, imgHeight/2, IDSBuffer::FORMAT_ARGB8888, tbmTextureB);
- EXPECT_TRUE(renderViewB->setBuffer(imageSourceBufferB));
- // -- end --
-
- EXPECT_TRUE(renderEngine->renderFrame());
-
- /*
- * Since renderViewA was created and added before renderViewB,
- * renderViewB should be drawn above and renderViewA below.
- *
- * ┌──────┬──────┐
- * │ B │ │
- * │ blue │ A │
- * ┣──────┘ │
- * │ red │
- * │ │
- * └─────────────┘
- */
-
- usleep(1000000);
-
- EXPECT_TRUE(bufferQueue->canAcquireBuffer(true));
-
- // commit
- EXPECT_TRUE(deviceHWC->commit());
-
- usleep(1000000);
- }
-}
-
-TEST_F(DSRenderEngineDaliTest, RenderEngine_RaiseToTop)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
- std::shared_ptr<IDSDisplayDeviceHWC> deviceHWC;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- auto bestMode = (output->getAvailableModes()).front();
- EXPECT_TRUE(output->setMode(bestMode) == true);
- EXPECT_TRUE(output->getMode() == bestMode);
-
- deviceHWC = output->getHWC();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto bufferQueue = deviceHWC->getTargetBufferQueue();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
-
- int imgWidth = 500;
- int imgHeight = 500;
-
- // for 1st renderView -- begin --
- auto renderViewA = renderEngine->makeRenderView();
- EXPECT_TRUE(renderViewA != nullptr);
-
- // create RED image buffer
- tbm_surface_h tbmTextureA = DSRenderEngineDaliTest::createTbmTexture(
- imgWidth, imgHeight, 255, 0, 0, 255);
- EXPECT_TRUE(tbmTextureA != nullptr);
-
- auto imageSourceBufferA = std::make_shared<DSBufferTBMImpl> (imgWidth, imgHeight, IDSBuffer::FORMAT_ARGB8888, tbmTextureA);
- EXPECT_TRUE(renderViewA->setBuffer(imageSourceBufferA));
- // -- end --
-
- // for 2nd renderView -- begin --
- auto renderViewB = renderEngine->makeRenderView();
- EXPECT_TRUE(renderViewB != nullptr);
-
- // The buffer size of the second renderView is half of the first.
- // create BLUE image buffer
- tbm_surface_h tbmTextureB = DSRenderEngineDaliTest::createTbmTexture(
- imgWidth/2, imgHeight/2, 0, 0, 255, 255);
- EXPECT_TRUE(tbmTextureB != nullptr);
-
- auto imageSourceBufferB = std::make_shared<DSBufferTBMImpl> (imgWidth/2, imgHeight/2, IDSBuffer::FORMAT_ARGB8888, tbmTextureB);
- EXPECT_TRUE(renderViewB->setBuffer(imageSourceBufferB));
- // -- end --
-
- // raise renderViewA to Top
- renderViewA->raiseToTop();
-
- EXPECT_TRUE(renderEngine->renderFrame());
-
- /*
- * Since renderViewA was created and added before renderViewB,
- * renderViewB should be drawn above and renderViewA below.
- * But because renderViewA called raiseToTop(), A rises up and covers B.
- *
- * ┌─────────────┐
- * │ │
- * │ A │
- * │ │
- * │ red │
- * │ │
- * └─────────────┘
- */
-
- usleep(1000000);
-
- EXPECT_TRUE(bufferQueue->canAcquireBuffer(true));
-
- // commit
- EXPECT_TRUE(deviceHWC->commit());
-
- usleep(1000000);
- }
-}
-
-TEST_F(DSRenderEngineDaliTest, RenderEngine_LowerToBottom)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
- std::shared_ptr<IDSDisplayDeviceHWC> deviceHWC;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- auto bestMode = (output->getAvailableModes()).front();
- EXPECT_TRUE(output->setMode(bestMode) == true);
- EXPECT_TRUE(output->getMode() == bestMode);
-
- deviceHWC = output->getHWC();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto bufferQueue = deviceHWC->getTargetBufferQueue();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
-
- int imgWidth = 500;
- int imgHeight = 500;
-
- // for 1st renderView -- begin --
- auto renderViewA = renderEngine->makeRenderView();
- EXPECT_TRUE(renderViewA != nullptr);
-
- // create RED image buffer
- tbm_surface_h tbmTextureA = DSRenderEngineDaliTest::createTbmTexture(
- imgWidth, imgHeight, 255, 0, 0, 255);
- EXPECT_TRUE(tbmTextureA != nullptr);
-
- auto imageSourceBufferA = std::make_shared<DSBufferTBMImpl> (imgWidth, imgHeight, IDSBuffer::FORMAT_ARGB8888, tbmTextureA);
- EXPECT_TRUE(renderViewA->setBuffer(imageSourceBufferA));
- // -- end --
-
- // for 2nd renderView -- begin --
- auto renderViewB = renderEngine->makeRenderView();
- EXPECT_TRUE(renderViewB != nullptr);
-
- // The buffer size of the second renderView is half of the first.
- // create BLUE image buffer
- tbm_surface_h tbmTextureB = DSRenderEngineDaliTest::createTbmTexture(
- imgWidth/2, imgHeight/2, 0, 0, 255, 255);
- EXPECT_TRUE(tbmTextureB != nullptr);
-
- auto imageSourceBufferB = std::make_shared<DSBufferTBMImpl> (imgWidth/2, imgHeight/2, IDSBuffer::FORMAT_ARGB8888, tbmTextureB);
- EXPECT_TRUE(renderViewB->setBuffer(imageSourceBufferB));
- // -- end --
-
- // raise renderViewA to Top
- renderViewB->lowerToBottom();
-
- EXPECT_TRUE(renderEngine->renderFrame());
-
- /*
- * Since renderViewA was created and added before renderViewB,
- * renderViewB should be drawn above and renderViewA below.
- * But because renderViewB called lowerToBottom(), B lower down and covered by A.
- *
- * ┌─────────────┐
- * │ │
- * │ A │
- * │ │
- * │ red │
- * │ │
- * └─────────────┘
- */
-
- usleep(1000000);
-
- EXPECT_TRUE(bufferQueue->canAcquireBuffer(true));
-
- // commit
- EXPECT_TRUE(deviceHWC->commit());
-
- usleep(1000000);
- }
-}
-
-TEST_F(DSRenderEngineDaliTest, RenderEngine_SetPosition)
-{
- std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
- EXPECT_TRUE(outputList.size() != 0);
-
- IDSDisplayDeviceOutput::ConnectorType connType;
- IDSDisplayDeviceOutput::ConnectState connState;
- std::shared_ptr<IDSDisplayDeviceHWC> deviceHWC;
-
- for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
- connType = output->getConnectType();
- EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
- connState = output->getConnectState();
- EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET);
- if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED)
- continue;
-
- auto bestMode = (output->getAvailableModes()).front();
- EXPECT_TRUE(output->setMode(bestMode) == true);
- EXPECT_TRUE(output->getMode() == bestMode);
-
- deviceHWC = output->getHWC();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto bufferQueue = deviceHWC->getTargetBufferQueue();
- EXPECT_TRUE(deviceHWC != nullptr);
-
- auto renderEngine = std::make_unique<DSRenderEngineDaliImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
- auto renderView = renderEngine->makeRenderView();
- EXPECT_TRUE(renderView != nullptr);
-
- renderView->setPosition(200, 200);
-
- int imgWidth = 500;
- int imgHeight = 500;
-
- tbm_surface_h tbmTexture = DSRenderEngineDaliTest::createTbmTexture(
- imgWidth, imgHeight, 255, 0, 0, 255);
- EXPECT_TRUE(tbmTexture != nullptr);
-
- auto imageSourceBuffer = std::make_shared<DSBufferTBMImpl> (imgWidth, imgHeight, IDSBuffer::FORMAT_ARGB8888, tbmTexture);
- EXPECT_TRUE(renderView->setBuffer(imageSourceBuffer));
- EXPECT_TRUE(renderEngine->renderFrame());
-
- usleep(1000000);
-
- EXPECT_TRUE(bufferQueue->canAcquireBuffer(true));
-
- // commit
- EXPECT_TRUE(deviceHWC->commit());
-
- usleep(1000000);
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSRenderEngineEcoreEvasImpl.h"
-#include "DSBufferQueueTBMImpl.h"
-#include "DSBufferTBMImpl.h"
-
-using namespace display_server;
-
-class DSRenderEngineEcoreEvasTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_Create)
-{
- auto bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue != nullptr);
- auto renderEngine = std::make_unique<DSRenderEngineEcoreEvasImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
-}
-
-TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_MakeRenderView)
-{
- auto bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue != nullptr);
- auto renderEngine = std::make_unique<DSRenderEngineEcoreEvasImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
- auto renderView = renderEngine->makeRenderView();
- EXPECT_TRUE(renderView != nullptr);
-}
-
-TEST_F(DSRenderEngineEcoreEvasTest, RenderView_SetBuffer)
-{
- auto bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue != nullptr);
- auto renderEngine = std::make_unique<DSRenderEngineEcoreEvasImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
- auto renderView = renderEngine->makeRenderView();
- EXPECT_TRUE(renderView != nullptr);
- auto buffer = std::make_shared<DSBufferTBMImpl> (100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(renderView->setBuffer(buffer));
-}
-
-TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_RenderFrame)
-{
- auto bufferQueue = std::make_shared<DSBufferQueueTBMImpl>(3, 100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(bufferQueue != nullptr);
- auto renderEngine = std::make_unique<DSRenderEngineEcoreEvasImpl>(bufferQueue);
- EXPECT_TRUE(renderEngine != nullptr);
- auto renderView = renderEngine->makeRenderView();
- EXPECT_TRUE(renderView != nullptr);
- auto buffer = std::make_shared<DSBufferTBMImpl> (100, 100, IDSBuffer::FORMAT_ARGB8888);
- EXPECT_TRUE(renderView->setBuffer(buffer));
- EXPECT_TRUE(renderEngine->renderFrame());
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSSeat.h"
-#include "DSCompositor.h"
-#include "DSZone.h"
-
-using namespace display_server;
-
-class DSSeatTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-class MockCompositor : public DSCompositor
-{
-public:
- MockCompositor() {}
- ~MockCompositor() {}
-
- std::shared_ptr<DSCanvas> _onInitialized() override
- {
- auto canvas = std::make_shared<DSCanvas>();
- return canvas;
- }
-
- void _onOutputAdded(std::shared_ptr<IDSOutput> output) override
- {}
-
- void _onOutputRemoved(std::shared_ptr<IDSOutput> output) override
- {}
-
- void _onInputAdded(std::shared_ptr<DSInput> input) override
- {}
-
- void _onInputRemoved(std::shared_ptr<DSInput> input) override
- {}
-};
-
-TEST_F(DSSeatTest, NewDSSeat)
-{
- DSSeat *seat = new DSSeat();
-
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- delete seat;
-}
-
-TEST_F(DSSeatTest, GetName)
-{
- std::string seatName{"default"};
- auto compositor = std::make_shared<MockCompositor>();
- EXPECT_TRUE(compositor != nullptr);
-
- if (compositor)
- {
- auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- EXPECT_TRUE(seat->getName().compare(seatName) == 0);
- }
- }
-}
-
-TEST_F(DSSeatTest, HasPointerKeyboardTouch)
-{
- std::string seatName{"default"};
- auto compositor = std::make_shared<MockCompositor>();
- EXPECT_TRUE(compositor != nullptr);
-
- if (compositor)
- {
- auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- seat->addPointer();
- seat->addKeyboard();
- seat->addTouch();
-
- EXPECT_TRUE(seat->hasPointer() == true);
- EXPECT_TRUE(seat->hasKeyboard() == true);
- EXPECT_TRUE(seat->hasTouch() == true);
-
- seat->removePointer();
- seat->removeKeyboard();
- seat->removeTouch();
- }
- }
-}
-
-TEST_F(DSSeatTest, AttachGetDetachZone)
-{
- std::string seatName{"default"};
- auto compositor = std::make_shared<MockCompositor>();
- EXPECT_TRUE(compositor != nullptr);
-
- if (compositor)
- {
- auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- if (zone)
- {
- EXPECT_TRUE(seat->attachZone(zone) == true);
- EXPECT_TRUE(seat->getZone().get() == zone.get());
- EXPECT_TRUE(seat->detachZone() == true);
- }
- }
- }
-}
-
-TEST_F(DSSeatTest, GetXKB)
-{
- std::string seatName{"default"};
- auto compositor = std::make_shared<MockCompositor>();
- EXPECT_TRUE(compositor != nullptr);
-
- if (compositor)
- {
- auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- EXPECT_TRUE(seat->getXkb() != nullptr);
- }
- }
-}
-
-TEST_F(DSSeatTest, getTopWindow)
-{
- std::string seatName{"default"};
- auto compositor = std::make_shared<MockCompositor>();
- EXPECT_TRUE(compositor != nullptr);
-
- if (compositor)
- {
- auto seat = std::make_shared<DSSeat>(compositor.get(), seatName);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- if (zone)
- {
- EXPECT_TRUE(seat->attachZone(zone) == true);
-
- auto winTop = seat->getTopWindow(nullptr);
- EXPECT_TRUE(winTop == nullptr);
-
- auto winTopOnPosition = seat->getTopWindowOnPosition(100, 100);
- EXPECT_TRUE(winTopOnPosition == nullptr);
-
- EXPECT_TRUE(seat->detachZone() == true);
- }
- }
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSSignal.h"
-#include "DSDebugLog.h"
-
-using namespace display_server;
-
-class DSSignalTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-class SenderMock : public DSObject
-{
-public:
- SenderMock()
- : signalA(std::make_unique<DSSignal<int>>()),
- signalB(std::make_unique<DSSignal<double>>())
- {}
- ~SenderMock() = default;
-
- void emitSignalA(int value) {
- signalA->emit(value);
- }
-
- void emitSignalB(double value) {
- signalB->emit(value);
- }
-
- std::unique_ptr<DSSignal<int>> signalA;
- std::unique_ptr<DSSignal<double>> signalB;
-};
-
-class ReceiverMock : public DSObject
-{
-public:
- ReceiverMock(std::shared_ptr<SenderMock> sender)
- : __sender(sender)
- {
- sender->signalA->connect(this, std::bind(&ReceiverMock::slotA, this, std::placeholders::_1));
- sender->signalB->connect(this, std::bind(&ReceiverMock::slotB, this, std::placeholders::_1));
- }
- ~ReceiverMock() = default;
-
- void slotA(int value) {
- DSLOG_INF("DSTEST", "%s is invoked! : value, %d", __func__, value);
- }
-
- void slotB(double value) {
- DSLOG_INF("DSTEST", "%s is invoked! : value, %lf", __func__, value);
- }
-
-private:
- std::shared_ptr<SenderMock> __sender;
-};
-
-TEST_F(DSSignalTest, CreateSignal)
-{
- DSSignal<int> *signal = new DSSignal<int>();
- delete signal;
- ASSERT_TRUE(true);
-}
-
-TEST_F(DSSignalTest, ConnectSignal)
-{
- auto sender1 = std::make_shared<SenderMock>();
- auto receiver = std::make_unique<ReceiverMock>(sender1);
-
- sender1->emitSignalA(30);
- sender1->emitSignalB(3.0);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include <iostream>
-#include "libds-tests.h"
-#include "DSSignal.h"
-#include "DSSignalBroker.h"
-#include "DSDebugLog.h"
-
-using namespace display_server;
-
-struct stItem
-{
- std::string str1;
- std::string str2;
-};
-
-class MockSender : public DSObject
-{
-public:
- MockSender() {}
- ~MockSender() {}
-
- bool registerSignal(std::string signalString)
- {
- DSSignalBroker *sigbro = DSSignalBroker::getInstance();
- bool res = false;
-
- if (sigbro == nullptr)
- return false;
-
- res = sigbro->registerSignal(signalString, this);
-
- if (sigbro)
- sigbro->releaseInstance();
-
- return res;
- }
-
- bool sendSignal1(std::string signalString, int data)
- {
- DSSignalBroker *sigbro = DSSignalBroker::getInstance();
- bool res = false;
-
- if (sigbro == nullptr)
- return false;
-
- res = sigbro->emitSignal(signalString, this, data);
-
- if (sigbro)
- sigbro->releaseInstance();
-
- return res;
- }
-
- bool sendSignal2(std::string signalString, double data)
- {
- DSSignalBroker *sigbro = DSSignalBroker::getInstance();
- bool res = false;
-
- if (sigbro == nullptr)
- return false;
-
- res = sigbro->emitSignal(signalString, this, data);
-
- if (sigbro)
- sigbro->releaseInstance();
-
- return res;
- }
-
- bool sendSignal3(std::string signalString, std::string data1, std::string data2, std::string data3)
- {
- DSSignalBroker *sigbro = DSSignalBroker::getInstance();
- bool res = false;
-
- if (sigbro == nullptr)
- return false;
-
- struct stItem testItem = {data2, data3};
-
- res = sigbro->emitSignal(signalString, this, data1, testItem);
-
- if (sigbro)
- sigbro->releaseInstance();
-
- return res;
- }
-};
-
-class MockReceiver : public DSObject
-{
-public:
- MockReceiver() :
- result1(0),
- result2(0.0),
- result3("")
- {
- }
- ~MockReceiver() {}
-
-public:
- int result1;
- double result2;
- std::string result3;
-
-public:
- bool registerCallback1(std::string targetSignal)
- {
- bool res = false;
- DSSignalBroker *sigbro = DSSignalBroker::getInstance();
- if (sigbro == nullptr) return false;
-
- std::function<void(int)> func = std::bind(&MockReceiver::UserCallback1, this, std::placeholders::_1);
- res = sigbro->registerCallback(targetSignal, this, func);
-
- if (sigbro)
- sigbro->releaseInstance();
-
- return res;
- }
-
- bool registerCallback2(std::string targetSignal)
- {
- bool res = false;
- DSSignalBroker *sigbro = DSSignalBroker::getInstance();
- if (sigbro == nullptr) return false;
-
- std::function<void(double)> func = std::bind(&MockReceiver::UserCallback2, this, std::placeholders::_1);
- res = sigbro->registerCallback(targetSignal, this, func);
-
- if (sigbro)
- sigbro->releaseInstance();
-
- return res;
- }
-
- bool registerCallback3(std::string targetSignal)
- {
- bool res = false;
- DSSignalBroker *sigbro = DSSignalBroker::getInstance();
- if (sigbro == nullptr) return false;
-
- std::function<void(std::string, struct stItem)> func = std::bind(&MockReceiver::UserCallback3, this, std::placeholders::_1, std::placeholders::_2);
- res = sigbro->registerCallback(targetSignal, this, func);
-
- if (sigbro)
- sigbro->releaseInstance();
-
- return res;
- }
-
- void UserCallback1(int arg)
- {
- DSLOG_INF("DSTEST", "%s is invoked!, arg: %d", __func__, arg);
- result1 = arg;
- }
-
- void UserCallback2(double arg)
- {
- DSLOG_INF("DSTEST", "%s is invoked!, arg: %d", __func__, arg);
- result2 = arg;
- }
-
- void UserCallback3(std::string arg1, struct stItem arg2)
- {
- DSLOG_INF("DSTEST", "%s is invoked!, arg1: %s, arg2{%s, %s}", __func__, arg1.c_str(), arg2.str1.c_str(), arg2.str2.c_str());
- result3 = arg1;
- }
-};
-
-class DSSignalBrokerTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-std::shared_ptr<MockReceiver> __receiver;
-std::shared_ptr<MockSender> __sender;
-
-TEST_F(DSSignalBrokerTest, getInstance)
-{
- DSSignalBroker *sigbro = DSSignalBroker::getInstance();
- EXPECT_TRUE(sigbro != nullptr);
-
- if (sigbro)
- sigbro->releaseInstance();
-}
-
-TEST_F(DSSignalBrokerTest, registerSignal)
-{
- __sender = std::make_shared<MockSender>();
- ASSERT_TRUE(__sender != nullptr);
-
- __sender->registerSignal("SampleSignal1");
-}
-
-TEST_F(DSSignalBrokerTest, registerCallback)
-{
- __receiver = std::make_shared<MockReceiver>();
- ASSERT_TRUE(__receiver != nullptr);
-
- __receiver->registerCallback1("SampleSignal1");
-}
-
-TEST_F(DSSignalBrokerTest, emitSignal)
-{
- ASSERT_TRUE(__sender != nullptr);
- ASSERT_TRUE(__receiver != nullptr);
-
- EXPECT_TRUE(__sender->sendSignal1("SampleSignal1", 1));
- EXPECT_TRUE(__receiver->result1 == 1);
-}
-
-TEST_F(DSSignalBrokerTest, registerAndEmit1)
-{
- auto sender1 = std::make_shared<MockSender>();
- auto sender2 = std::make_shared<MockSender>();
-
- auto receiver1 = std::make_shared<MockReceiver>();
- auto receiver2 = std::make_shared<MockReceiver>();
-
- ASSERT_TRUE(sender1 != nullptr &&
- sender2 != nullptr &&
- receiver1 != nullptr &&
- receiver2 != nullptr);
-
- // 1. register Signal
- EXPECT_TRUE(sender1->registerSignal("SampleSignal1"));
- EXPECT_TRUE(sender2->registerSignal("SampleSignal2"));
-
- // 2. register Callback
- EXPECT_TRUE(receiver1->registerCallback1("SampleSignal1"));
- EXPECT_TRUE(receiver2->registerCallback2("SampleSignal2"));
-
- // 3. emit Signal
- EXPECT_TRUE(sender1->sendSignal1("SampleSignal1", 11));
- EXPECT_TRUE(sender2->sendSignal2("SampleSignal2", 10.10));
-
- // 4. see Changes
- EXPECT_TRUE(receiver1->result1 == 11);
- EXPECT_TRUE(receiver2->result2 == 10.10);
-}
-
-TEST_F(DSSignalBrokerTest, emitMultiItems)
-{
- auto sender = std::make_shared<MockSender>();
- auto receiver = std::make_shared<MockReceiver>();
-
- ASSERT_TRUE(sender != nullptr &&
- receiver != nullptr);
-
- // 1. register Signal
- EXPECT_TRUE(sender->registerSignal("SampleSignal3"));
-
- // 2. register Callback
- EXPECT_TRUE(receiver->registerCallback3("SampleSignal3"));
-
- // 3. emit Signal
- EXPECT_TRUE(sender->sendSignal3("SampleSignal3", "Test", "Hello", "signal"));
-
- // 4. see Changes
- EXPECT_TRUE(receiver->result3 == "Test");
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSTextInput.h"
-
-using namespace display_server;
-
-class DSTextInputTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSTextInputTest, NewDSTextInput)
-{
- DSTextInput *textInput = new DSTextInput();
- EXPECT_TRUE(textInput != nullptr);
-
- delete textInput;
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSTizenAppinfo.h"
-#include "DSTizenAppinfoMgr.h"
-
-using namespace display_server;
-
-class DSTizenAppinfoTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSTizenAppinfoTest, NewTizenAppinfo)
-{
- std::string appId1{"com.appinfo.first"};
- std::string appId2{"com.appinfo.second"};
-
- DSTizenAppinfo *appinfo = new DSTizenAppinfo(appId1);
- EXPECT_TRUE(appinfo != nullptr);
-
- if (appinfo)
- {
- pid_t pid = 1234;
- appinfo->setPid(pid);
- appinfo->setAppId(appId2);
- EXPECT_TRUE(appinfo->getAppId().compare(appId2) == 0);
-
- EXPECT_TRUE(appinfo->getBaseOutputAvailable() == false);
- EXPECT_TRUE(appinfo->getBaseOutputWidth() == 0);
- EXPECT_TRUE(appinfo->getBaseOutputHeight() == 0);
-
- delete appinfo;
- }
-}
-
-TEST_F(DSTizenAppinfoTest, NewTizenAppinfoMgr)
-{
- DSTizenAppinfoMgr *appinfoMgr = DSTizenAppinfoMgr::getInstance();
- EXPECT_TRUE(appinfoMgr != nullptr);
-
- if (appinfoMgr)
- {
- std::string appId1{"com.appinfo.first"};
- std::string appId2{"com.appinfo.second"};
- std::string appId3{"com.appinfo.third"};
- pid_t pid1 = 1234, pid2 = 4321;
- int res_w = 0, res_h = 0;
-
- std::shared_ptr<DSTizenAppinfo> app1(nullptr), app2(nullptr), app3(nullptr), temp(nullptr);
-
- app1 = appinfoMgr->addTizenAppinfo(appId1);
- EXPECT_TRUE(app1 != nullptr);
- app2 = appinfoMgr->addTizenAppinfo(appId2);
- EXPECT_TRUE(app2 != nullptr);
- //FAIL to add a new appinfo using the existing appId
- app3 = appinfoMgr->addTizenAppinfo(appId2);
- EXPECT_TRUE(app3 == nullptr);
-
- temp = appinfoMgr->getTizenAppinfo(appId2);
- EXPECT_TRUE(temp != nullptr);
-
- EXPECT_TRUE(appinfoMgr->removeTizenAppinfo(appId2) == true);
- //FAIL to remove non-existing appinfo
- EXPECT_TRUE(appinfoMgr->removeTizenAppinfo("com.appinfo.noname") == false);
-
- app1->setPid(pid1); //app1 - (appId1, 1234)
- temp = nullptr;
- temp = appinfoMgr->getTizenAppinfo(pid1); //temp = app1 - (appId1, 1234)
- EXPECT_TRUE(temp != nullptr);
-
- appinfoMgr->updateTizenAppinfo(appId1, pid2); //app1 - (appId1, 4321)
- appinfoMgr->updateTizenAppinfo(appId2, pid2); //no appinfo with appId2
-
- EXPECT_TRUE(appinfoMgr->getBaseOutputResolution(pid1, &res_w, &res_h) == false); //no appinfo with pid1
-
- app1->setBaseOutputAvailable(true);
- app1->setBaseOutputWidth(720);
- app1->setBaseOutputHeight(1280);
-
- EXPECT_TRUE(appinfoMgr->getBaseOutputResolution(pid2, &res_w, &res_h) == true); //app1
- EXPECT_TRUE(res_w == 720);
- EXPECT_TRUE(res_h == 1280);
- appinfoMgr->removeTizenAppinfo(app1->getAppId());
-
- DSTizenAppinfoMgr::releaseInstance();
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSTouch.h"
-#include "DSSeat.h"
-#include "DSWaylandTouch.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandCompositor.h"
-#include "DSWindow.h"
-#include "DSWaylandSurface.h"
-
-using namespace display_server;
-
-class DSTouchTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSTouchTest, NewDSTouchWithDSSeat)
-{
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- auto touch = new DSTouch(seat);
- EXPECT_TRUE(touch != nullptr);
- }
-}
-
-TEST_F(DSTouchTest, NewDSTouchWithDSWaylandTouch)
-{
- auto waylandCompositor = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(waylandCompositor != nullptr);
-
- if (waylandCompositor)
- {
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- auto waylandSeat = new DSWaylandSeat(waylandCompositor, DSWaylandSeat::capAll);
- EXPECT_TRUE(waylandSeat != nullptr);
-
- if (seat && waylandSeat)
- {
- auto waylandTouch = new DSWaylandTouch(waylandSeat);
- EXPECT_TRUE(waylandTouch != nullptr);
-
- if (waylandTouch)
- {
- auto touch = new DSTouch(seat, waylandTouch);
- EXPECT_TRUE(touch != nullptr);
- }
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-
-}
-TEST_F(DSTouchTest, BasicMethods)
-{
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- auto window = std::make_shared<DSWindow>();
- EXPECT_TRUE(window != nullptr);
-
- auto waylandSurface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(waylandSurface != nullptr);
-
- window->create(waylandSurface);
-
- if (seat && window)
- {
- auto touch = new DSTouch(seat);
- EXPECT_TRUE(touch != nullptr);
-
- if (touch)
- {
- touch->setFocus(window);
- EXPECT_TRUE(window == touch->getFocus());
- }
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSTraceInfo.h"
-
-using namespace display_server;
-
-class DSTraceInfoTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- Ecore_Timer *timer = nullptr;
-
- DSWaylandCompositor::getInstance();
- eventLoop = DSEventLoop::getInstance();
- double delayInSecond = 0.5;
- auto timerCb = [](void *data) -> Eina_Bool {
- DSEventLoop *loop = (DSEventLoop *)data;
- EXPECT_TRUE(loop->quit() == true);
- return EINA_FALSE;
- };
-
- timer = ecore_timer_loop_add(delayInSecond, timerCb, eventLoop);
- EXPECT_TRUE(timer != nullptr);
-
- eventLoop->run();
-
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- eventLoop->quit();
- DSEventLoop::releaseInstance();
- DSWaylandCompositor::releaseInstance();
-
- unsetenv("XDG_RUNTIME_DIR");
- }
- DSEventLoop *eventLoop;
-private:
-
-};
-
-TEST_F(DSTraceInfoTest, NewTraceInfo)
-{
- auto traceInfo = std::make_unique<DSTraceInfo>();
- EXPECT_TRUE(traceInfo != nullptr);
-}
-
-TEST_F(DSTraceInfoTest, attachPolicyArea)
-{
- auto traceInfo = std::make_unique<DSTraceInfo>();
- EXPECT_TRUE(traceInfo != nullptr);
- auto policyArea = std::make_shared<DSPolicyArea>();
- EXPECT_TRUE(policyArea != nullptr);
- EXPECT_TRUE(traceInfo->attachPolicyArea(policyArea) == true);
-}
-
-TEST_F(DSTraceInfoTest, printWindowsInfo)
-{
- std::shared_ptr<DSZone> zone(nullptr);
-
- auto traceInfo = std::make_unique<DSTraceInfo>();
- EXPECT_TRUE(traceInfo != nullptr);
- auto policyArea = std::make_shared<DSPolicyArea>();
- EXPECT_TRUE(policyArea != nullptr);
- if (traceInfo->attachPolicyArea(policyArea))
- {
- std::string title1{"TestWindow1"};
- std::string title2{"TestWindow2"};
- zone = traceInfo->getZone();
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(zone->testCreateWindow(dswlSurface1));
-
- auto dswlSurface2 = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(zone->testCreateWindow(dswlSurface2));
-
- usleep(100000);
- eventLoop->testEmitIdleEntererFuncs(nullptr);
-
- zone->raiseWindow(dswlSurface1.get());
- eventLoop->testEmitIdleEntererFuncs(nullptr);
-
- EXPECT_TRUE(zone->testDestroyWindow(dswlSurface1));
- eventLoop->testEmitIdleEntererFuncs(nullptr);
-
- EXPECT_TRUE(zone->testDestroyWindow(dswlSurface2));
- eventLoop->testEmitIdleEntererFuncs(nullptr);
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandBuffer.h"
-
-using namespace display_server;
-
-class DSWaylandBufferTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandBufferTest, NewDSWaylandBuffer)
-{
- DSWaylandBuffer *buffer = new DSWaylandBuffer;
- delete buffer;
- EXPECT_TRUE(true);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandCallback.h"
-
-using namespace display_server;
-
-class DSWaylandCallbackTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandCallbackTest, NewDSWaylandCallback)
-{
- DSWaylandCallback *callback = new DSWaylandCallback;
- delete callback;
- EXPECT_TRUE(true);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandClient.h"
-
-using namespace display_server;
-
-class DSWaylandClientTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandClientTest, NewDSWaylandClient)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- /* client must be created with a valid wl_client ptr later. */
- DSWaylandClient *client = new DSWaylandClient(comp, (wl_client *)nullptr);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- delete client;
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandClientTest, GetClientFromWlClient)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- /* client must be created with a valid wl_client ptr later. */
- auto client = new DSWaylandClient(comp, (wl_client *)nullptr);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- {
- DSWaylandClient *client2 = client->fromWlClient((wl_client *)nullptr);
- EXPECT_TRUE(client2 == nullptr);
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandClientTest, GetWlClient)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- /* client must be created with a valid wl_client ptr later. */
- auto client = new DSWaylandClient(comp, (wl_client *)nullptr);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- {
- wl_client *wclient = client->wlClient();
- EXPECT_TRUE(wclient == nullptr);
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandClientTest, GetCompositor)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- /* client must be created with a valid wl_client ptr later. */
- DSWaylandClient *client = new DSWaylandClient(comp, (wl_client *)nullptr);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- {
- DSWaylandCompositor *comp2 = client->getCompositor();
- EXPECT_TRUE(comp2 == comp);
-
- delete client;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandClientTest, GetPidUidGid)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- /* client must be created with a valid wl_client ptr later. */
- auto client = new DSWaylandClient(comp, (wl_client *)nullptr);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- {
- pid_t pID;
- uid_t uID;
- gid_t gID;
-
- pID = client->pid();
- uID = client->uid();
- gID = client->gid();
-
- EXPECT_TRUE(pID == 0);
- EXPECT_TRUE(uID == 0);
- EXPECT_TRUE(gID == 0);
-
- delete client;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandClient.h"
-#include "DSWaylandSeat.h"
-
-using namespace display_server;
-
-class DSWaylandCompositorTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandCompositorTest, NewDSWaylandCompositor)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandCompositorTest, CreateTest)
-{
- bool res;
-
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- res = comp->create();
- EXPECT_TRUE(res == true);
-
- res = comp->isCreated();
- EXPECT_TRUE(res == true);
-
- std::string sockName = comp->socketName().substr(0, 8);
- EXPECT_TRUE(sockName.compare(std::string{"wayland-"}) == 0);
-
- sockName.clear();
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandCompositorTest, DisplayGet)
-{
- bool res;
-
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- res = comp->create();
- EXPECT_TRUE(res == true);
- EXPECT_TRUE(comp->display() != nullptr);
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandCompositorTest, NextSerialGet)
-{
- bool res;
- uint32_t nSerial;
-
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- res = comp->create();
- EXPECT_TRUE(res == true);
-
- nSerial = comp->nextSerial();
- EXPECT_TRUE((nSerial+1) == comp->nextSerial());
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandCompositorTest, GetCurrentTime)
-{
- bool res;
- uint32_t currentTime;
-
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- res = comp->create();
- EXPECT_TRUE(res == true);
-
- currentTime = comp->currentTime();
- EXPECT_TRUE(currentTime <= comp->currentTime());
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandCompositorTest, AddRemoveClient)
-{
- bool res;
- std::list<DSWaylandClient *> l;
-
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- res = comp->create();
- EXPECT_TRUE(res == true);
-
- DSWaylandClient *client = new DSWaylandClient(comp, (wl_client *)nullptr);
- EXPECT_TRUE(client != nullptr);
-
- if (client)
- {
- comp->addClient(client);
-
- l = comp->clients();
- EXPECT_TRUE(l.size() != 0);
-
- comp->removeClient(client);
-
- l = comp->clients();
- EXPECT_TRUE(l.size() == 0);
-
- delete client;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandCompositorTest, GetDefaultSeat)
-{
- bool res;
-
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- res = comp->create();
- EXPECT_TRUE(res == true);
-
- DSWaylandSeat *seat = comp->addSeat((uint32_t)DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- EXPECT_TRUE(comp->defaultSeat() != nullptr);
-
- comp->removeSeat(seat);
- EXPECT_TRUE(comp->defaultSeat() == nullptr);
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-static void
-handle_global(void *data, struct wl_registry *registry, uint32_t name,
- const char *interface, uint32_t version)
-{
- struct TestClient *testClient = (struct TestClient *)data;
-
- if (strcmp(interface, "wl_compositor") == 0) {
- testClient->compositor = (struct wl_compositor *)wl_registry_bind(registry, name, &wl_compositor_interface, 1);
- if (!testClient->compositor)
- DSLOG_ERR("TEST", "wl_registry_bind compositor fails.");
- }
-}
-
-static void
-handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
-{}
-
-static const struct wl_registry_listener registry_listener = {
- handle_global,
- handle_global_remove
-};
-
-TEST_F(DSWaylandCompositorTest, registerCallbackSurfaceCreated)
-{
- auto mockWaylandCompositor = std::make_unique<MockWaylandCompositor>();
-
- Ecore_Timer *serverQuitTimer = nullptr;
- double severQuitTime = 1.0;
- auto serverQuitFunc = [](void *data) -> Eina_Bool {
- MockWaylandCompositor *comp = (MockWaylandCompositor *)data;
-
- // quit server
- comp->quit();
- // check the emitting the surfaceCreated
- EXPECT_TRUE(comp->surfaceCreated);
-
- return EINA_FALSE;
- };
- serverQuitTimer = ecore_timer_loop_add(severQuitTime, serverQuitFunc, mockWaylandCompositor.get());
- EXPECT_TRUE(serverQuitTimer != nullptr);
-
- // create the wayland client which creates the wl_surface.
- std::future<bool> clientThread = std::async(std::launch::async, []() -> bool {
- std::this_thread::sleep_for(std::chrono::milliseconds(40));
- auto testClient = std::make_shared<TestClient>();
-
- testClient->display = wl_display_connect(NULL);
- EXPECT_TRUE(testClient->display != nullptr);
-
- testClient->registry = wl_display_get_registry(testClient->display);
- wl_registry_add_listener(testClient->registry, ®istry_listener, testClient.get());
- wl_display_dispatch(testClient->display);
- wl_display_roundtrip(testClient->display);
- EXPECT_TRUE(testClient->compositor != nullptr);
-
- testClient->surface = wl_compositor_create_surface(testClient->compositor);
- EXPECT_TRUE(testClient->surface != nullptr);
- wl_display_roundtrip(testClient->display);
-
- wl_display_disconnect(testClient->display);
-
- return true;
- }
- );
-
- mockWaylandCompositor->run();
- EXPECT_TRUE(clientThread.get()); // join(wait) and get the return value.
-}
-
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSObject.h"
-#include "DSWaylandExtension.h"
-#include "DSStruct.h"
-
-using namespace display_server;
-
-class DSWaylandExtensionTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandExtensionTest, NewWaylandExtension)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- auto wlExtension = std::make_shared<DSWaylandExtension>(comp);
- EXPECT_TRUE(wlExtension != nullptr);
-
- DSWaylandCompositor::releaseInstance();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandInputMethod.h"
-
-using namespace display_server;
-
-class DSWaylandInputMethodTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandInputMethodTest, NewDSWaylandInputMethod)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ActivateDeactivate)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- bool activated = inputMethod->contextActivated();
- if (activated)
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ShowHideInputPanel)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->showInputPanel(0);
- inputMethod->hideInputPanel(0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ResetTextInput)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->resetTextInput();
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, SetContentType)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->setContentType(10, 0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, SetPreferredLanguage)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->setPreferredLanguage("en_US");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, CommitState)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->commitState(5);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, InvokeAction)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->invokeAction(1, 0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, SetReturnKeyType)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->setReturnKeyType(0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ReturnKeyDisabled)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->returnKeyDisabled(0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, SetInputPanelData)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->setInputPanelData("WILL_HIDE_ACK", 13);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, BidiDirection)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->bidiDirection(1);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, SetCursorPosition)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->setCursorPosition(0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ProcessInputDeviceEvent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->processInputDeviceEvent(0, "", 0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, FilterKeyEvent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->filterKeyEvent(1, 0, "A", 1, 1, "ime", 2, 12, 0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, SetCapitalMode)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->setCapitalMode(0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, PredictionHint)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->predictionHint("");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, SetMimeType)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->setMimeType("");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, FinalizeContent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->finalizeContent("", 0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, PredictionHintData)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->predictionHintData("appid", "");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextCommitString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextCommitString(0, "");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextPreeditString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextPreeditString(1, "", "");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextPreeditStyling)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextPreeditStyling(1, 1, 1);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextPreeditCursor)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextPreeditCursor(0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextDeleteSurroundingText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextDeleteSurroundingText(1, 1);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextCursorPosition)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextCursorPosition(1, 1);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextModifiersMap)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextModifiersMap("");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextKeysym)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextKeysym(1, 10, 65, 1, 1);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextLanguage)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextLanguage(1, "en_US");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextTextDirection)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextTextDirection(1, 1);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextSelectionRegion)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextSelectionRegion(1, 10, 20);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextPrivateCommand)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextPrivateCommand(1, "CONFORMANT_RESET");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextUpdateInputPanelData)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextUpdateInputPanelData(1, "", 0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextHideInputPanel)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextHideInputPanel(1);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextGetSelectionText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextGetSelectionText(5);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextGetSurroundingText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextGetSurroundingText(5, 10, 5);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextFilterKeyEventDone)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextFilterKeyEventDone(1, 0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextUpdateIseGeometry)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextUpdateIseGeometry(1, 0, 100, 200, 100);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextRecaptureString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextRecaptureString(1, 1, 0, "", "", "");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextInputPanelEvent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextInputPanelEvent(1, 1, 0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextCommitContent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextCommitContent(1, "", "", "");
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextUpdateCandidateState)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextUpdateCandidateState(0);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, ContextReshowInputPanel)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->contextReshowInputPanel();
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodTest, SetGeometryUpdated)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- EXPECT_TRUE(inputMethod != nullptr);
-
- inputMethod->activate(0);
- inputMethod->setGeometryUpdated(true);
- inputMethod->deactivate();
-
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandInputMethod.h"
-#include "DSWaylandInputMethodContext.h"
-
-using namespace display_server;
-
-class DSWaylandInputMethodContextTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandInputMethodContextTest, NewDSWaylandInputMethodContext)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendReset)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendReset(nullptr);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendContentType)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendContentType(nullptr, 10, 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendPreferredLanguage)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendPreferredLanguage(nullptr, "en_US");
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendCommitState)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendCommitState(nullptr, 5);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendInvokeAction)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendInvokeAction(nullptr, 1, 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendReturnKeyType)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendReturnKeyType(nullptr, 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendReturnKeyDisabled)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendReturnKeyDisabled(nullptr, 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendInputPanelData)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendInputPanelData(nullptr, "WILL_HIDE_ACK", 13);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendBidiDirection)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendBidiDirection(nullptr, 1);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendCursorPosition)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendCursorPosition(nullptr, 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendProcessInputDeviceEvent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendProcessInputDeviceEvent(nullptr, 0, "", 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendFilterKeyEvent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendFilterKeyEvent(nullptr, 1, 0, "A", 1, 1, "ime", 2, 12, 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendCapitalMode)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendCapitalMode(nullptr, 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendPredictionHint)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendPredictionHint(nullptr, "");
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendMimeType)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendMimeType(nullptr, "");
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendFinalizedContent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendFinalizedContent(nullptr, "", 0);
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputMethodContextTest, SendPredictionHintData)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp);
- DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(comp, inputMethod);
- EXPECT_TRUE(inputMethodContext != nullptr);
-
- inputMethodContext->sendPredictionHintData(nullptr, "appid", "");
-
- delete inputMethodContext;
- delete inputMethod;
- DSWaylandCompositor::releaseInstance();
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandInputPanel.h"
-
-using namespace display_server;
-
-class DSWaylandInputPanelTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandInputPanelTest, NewDSWaylandInputPanel)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, CreateClearSurface)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->createSurface(nullptr, nullptr, 0, nullptr);
- inputPanel->clearSurfaces(nullptr);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, GetSetWaitUpdate)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->setWaitUpdate(true);
- bool waitUpdate = inputPanel->getWaitUpdate();
-
- EXPECT_TRUE(waitUpdate == true);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, UpdateInputPanelState)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->updateInputPanelState(true);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, SetFloatingMovingRequest)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->setFloatingMovingRequest(true);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, GetSetRerunPanelShow)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->setRerunPanelShow(true);
- EXPECT_TRUE(true == inputPanel->getRerunPanelShow());
-
- inputPanel->setRerunPanelShow(false);
- EXPECT_TRUE(false == inputPanel->getRerunPanelShow());
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, SetTransientFor)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->setTransientFor(nullptr);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, ChangeVisibility)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->changeVisibility(true);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, IsEffectRunning)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->isEffectRunning(nullptr);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, SetFloatingPosition)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->setFloatingPosition(0, 0);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, GetFloatingData)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- auto floatingData = inputPanel->getFloatingData();
-
- EXPECT_TRUE(floatingData != nullptr);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, GetSurfaceGeometry)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->getSurfaceGeometry(nullptr);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, UpdateTextInputPanelState)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- inputPanel->updateTextInputPanelState(true);
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelTest, GetTextInputSurface)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- EXPECT_TRUE(inputPanel != nullptr);
-
- (void)inputPanel->getTextInputSurface();
-
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandInputPanelSurface.h"
-
-using namespace display_server;
-
-class DSWaylandInputPanelSurfaceTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandInputPanelSurfaceTest, NewDSWaylandInputPanelSurface)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelSurfaceTest, CreateClearGlobal)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- inputPanelSurface->createGlobal(nullptr, nullptr, 0, nullptr);
- inputPanelSurface->clearGlobals(nullptr);
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelSurfaceTest, FlushFrame)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- inputPanelSurface->flushFrame();
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelSurfaceTest, SetTransientForSurface)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- inputPanelSurface->setTransientForSurface(nullptr);
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelSurfaceTest, UpdateSurfaceVisibility)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- inputPanelSurface->updateSurfaceVisibility(true);
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelSurfaceTest, SsEffectRunning)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- inputPanelSurface->isEffectRunning(nullptr);
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelSurfaceTest, SetPosition)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- inputPanelSurface->setPosition(nullptr, 0, 0);
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelSurfaceTest, SetFloatingPosition)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- inputPanelSurface->setFloatingPosition(0, 0);
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandInputPanelSurfaceTest, GetGeometry)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
- DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
- EXPECT_TRUE(inputPanelSurface != nullptr);
-
- inputPanelSurface->getGeometry(nullptr);
-
- delete inputPanelSurface;
- delete inputPanel;
- DSWaylandCompositor::releaseInstance();
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandKeyboard.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandSurface.h"
-
-using namespace display_server;
-
-class DSWaylandKeyboardTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandKeyboardTest, NewDSWaylandKeyboard)
-{
- DSWaylandKeyboard *keyboard = new DSWaylandKeyboard(nullptr);
- EXPECT_TRUE(keyboard != nullptr);
-
- if (keyboard)
- delete keyboard;
-}
-
-TEST_F(DSWaylandKeyboardTest, GetSeat)
-{
- DSWaylandSeat *seat = new DSWaylandSeat(nullptr, DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- DSWaylandKeyboard *keyboard = new DSWaylandKeyboard(seat);
- EXPECT_TRUE(keyboard != nullptr);
-
- if (keyboard)
- {
- EXPECT_TRUE(keyboard->seat() == seat);
-
- delete keyboard;
- }
-
- delete seat;
- }
-}
-
-TEST_F(DSWaylandKeyboardTest, SetGetRepeatRateDelay)
-{
- DSWaylandKeyboard *keyboard = new DSWaylandKeyboard(nullptr);
- EXPECT_TRUE(keyboard != nullptr);
-
- if (keyboard)
- {
- uint32_t uRepeatRate = 25;
- uint32_t uRepeatDelay = 400;
-
- keyboard->setRepeatRate(uRepeatRate);
- EXPECT_TRUE(keyboard->repeatRate() == uRepeatRate);
-
- keyboard->setRepeatDelay(uRepeatDelay);
- EXPECT_TRUE(keyboard->repeatDelay() == uRepeatDelay);
-
- delete keyboard;
- }
-}
-
-TEST_F(DSWaylandKeyboardTest, SetGetFocus)
-{
- auto keyboard = new DSWaylandKeyboard(nullptr);
- EXPECT_TRUE(keyboard != nullptr);
-
- if (keyboard)
- {
- auto waylandSurface = std::make_unique<DSWaylandSurface>();
- EXPECT_TRUE(waylandSurface != nullptr);
-
- if (waylandSurface)
- {
- /* FIXME: currently we cannot create wl_surface so setFocus will be always set nullptr to focus
- * so temporary I set nullptr to focus for test but this will be fixed
- * keyboard->setFocus(waylandSurface.get());
- * EXPECT_TRUE(waylandSurface.get() == keyboard->getFocus());
- */
- keyboard->setFocus(nullptr);
- EXPECT_TRUE(nullptr == keyboard->getFocus());
- }
- }
-}
-
-TEST_F(DSWaylandKeyboardTest, BasicMethods)
-{
- auto keyboard = new DSWaylandKeyboard(nullptr);
- EXPECT_TRUE(keyboard != nullptr);
-
- if (keyboard)
- {
- keyboard->sendKeyDown(100);
- keyboard->sendKeyUp(100);
- }
-}
-
-TEST_F(DSWaylandKeyboardTest, ResetFocus)
-{
- auto keyboard = new DSWaylandKeyboard(nullptr);
- EXPECT_TRUE(keyboard != nullptr);
-
- if (keyboard)
- {
- keyboard->resetFocus();
- EXPECT_TRUE(nullptr == keyboard->getFocus());
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandOutput.h"
-
-using namespace display_server;
-
-class DSWaylandOutputTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandOutputTest, NewDSWaylandOutput)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandOutput *output = new DSWaylandOutput(comp, "unknown", "unknown", "unknown", 0, 0, 1280, 720, 100, 80, 30, 0, 0);
- EXPECT_TRUE(output != nullptr);
-
- if (output)
- delete output;
- DSWaylandCompositor::releaseInstance();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandPointer.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandSurface.h"
-
-using namespace display_server;
-
-class DSWaylandPointerTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandPointerTest, NewDSWaylandPointer)
-{
- DSWaylandPointer *pointer = new DSWaylandPointer(nullptr);
- EXPECT_TRUE(pointer != nullptr);
-
- if (pointer)
- delete pointer;
-}
-
-TEST_F(DSWaylandPointerTest, GetSeat)
-{
- DSWaylandSeat *seat = new DSWaylandSeat(nullptr, DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- DSWaylandPointer *pointer = new DSWaylandPointer(seat);
- EXPECT_TRUE(pointer != nullptr);
-
- if (pointer)
- {
- EXPECT_TRUE(pointer->seat() == seat);
-
- delete pointer;
- }
-
- delete seat;
- }
-}
-
-TEST_F(DSWaylandPointerTest, SetGetFocus)
-{
- auto pointer = new DSWaylandPointer(nullptr);
- EXPECT_TRUE(pointer != nullptr);
-
- if (pointer)
- {
- auto waylandSurface = std::make_unique<DSWaylandSurface>();
- EXPECT_TRUE(waylandSurface != nullptr);
-
- if (waylandSurface)
- {
- pointer->setFocus(waylandSurface.get());
- EXPECT_TRUE(waylandSurface.get() == pointer->getFocus());
- }
- }
-}
-
-TEST_F(DSWaylandPointerTest, ResetFocus)
-{
- auto pointer = new DSWaylandPointer(nullptr);
- EXPECT_TRUE(pointer != nullptr);
-
- if (pointer)
- {
- pointer->resetFocus();
- EXPECT_TRUE(nullptr == pointer->getFocus());
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandProtocolTrace.h"
-
-using namespace display_server;
-
-class DSWaylandProtocolTraceTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- setenv("E_INFO_RULE_FILE", "/tmp/rule", 1);
- setenv("E_INFO_TRACE_FILE", "/tmp/trace", 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- unsetenv("E_INFO_RULE_FILE");
- unsetenv("E_INFO_TRACE_FILE");
- }
-};
-
-TEST_F(DSWaylandProtocolTraceTest, NewDSWaylandProtocolTrace)
-{
- DSWaylandProtocolTrace *pTrace = DSWaylandProtocolTrace::getInstance();
- EXPECT_TRUE(pTrace != nullptr);
-
- if(pTrace)
- DSWaylandProtocolTrace::releaseInstance();
-}
-
-TEST_F(DSWaylandProtocolTraceTest, DSWaylandProtocolTraceInit)
-{
- DSWaylandProtocolTrace *pTrace = DSWaylandProtocolTrace::getInstance();
- static FILE *rule_file = NULL;
-
- if(pTrace)
- {
- rule_file = fopen("/tmp/rule", "a");
- if(!rule_file)
- {
- EXPECT_TRUE(false);
- DSWaylandProtocolTrace::releaseInstance();
- return;
- }
-
- EXPECT_TRUE(pTrace->init() == true);
-
- if(rule_file != nullptr)
- {
- fclose(rule_file);
- rule_file = nullptr;
- }
- DSWaylandProtocolTrace::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandProtocolTraceTest, DSWaylandProtocolTraceUpdateRule)
-{
- DSWaylandProtocolTrace *pTrace = DSWaylandProtocolTrace::getInstance();
-
- if(pTrace)
- {
- pTrace->init();
-
- int argc = 3;
- const char *argv[3];
- argv[0] = "add";
- argv[1] = "ALLOW";
- argv[2] = "all";
- EXPECT_TRUE(pTrace->updateProtocolRule(argc, (const char**)&(argv[0])) == true);
-
- argc = 2;
- argv[0] = "remove";
- argv[1] = "all";
- argv[2] = nullptr;
- EXPECT_TRUE(pTrace->updateProtocolRule(argc, (const char**)&(argv[0])) == true);
-
- argc = 1;
- argv[0] = "print";
- argv[1] = nullptr;
- argv[2] = nullptr;
- EXPECT_TRUE(pTrace->updateProtocolRule(argc, (const char**)&(argv[0])) == true);
-
- argc = 1;
- argv[0] = "help";
- argv[1] = nullptr;
- argv[2] = nullptr;
- EXPECT_TRUE(pTrace->updateProtocolRule(argc, (const char**)&(argv[0])) == true);
-
- argc = 1;
- argv[0] = "command";
- argv[1] = nullptr;
- argv[2] = nullptr;
- EXPECT_TRUE(pTrace->updateProtocolRule(argc, (const char**)&(argv[0])) == true);
- DSWaylandProtocolTrace::releaseInstance();
- }
-
-}
-
-TEST_F(DSWaylandProtocolTraceTest, DSWaylandProtocolTraceEnableTraceFalse)
-{
- DSWaylandProtocolTrace *pTrace = DSWaylandProtocolTrace::getInstance();
- bool trace_state = false; //disable
-
- if(pTrace)
- {
- pTrace->init();
- EXPECT_TRUE(pTrace->enableProtocolTrace(trace_state) == 0);
- DSWaylandProtocolTrace::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandProtocolTraceTest, DSWaylandProtocolTraceEnableTraceTrue)
-{
- DSWaylandProtocolTrace *pTrace = DSWaylandProtocolTrace::getInstance();
- bool trace_state = true;
-
- if(pTrace)
- {
- pTrace->init();
- EXPECT_TRUE(pTrace->enableProtocolTrace(trace_state) == 1);
- DSWaylandProtocolTrace::releaseInstance();
- }
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandSeat.h"
-#include "DSSeat.h"
-#include "DSXkb.h"
-
-using namespace display_server;
-
-class DSWaylandSeatTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandSeatTest, NewDSWaylandSeat)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- DSWaylandSeat *seat = new DSWaylandSeat(comp, DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- delete seat;
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandSeatTest, SetUpdateGetCapabilities)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- DSWaylandSeat *seat = new DSWaylandSeat(comp, DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- EXPECT_TRUE(DSWaylandSeat::capDefault == seat->getCapability());
-
- seat->setCapability(DSWaylandSeat::capKeyboard);
- EXPECT_TRUE(DSWaylandSeat::capKeyboard == seat->getCapability());
-
- seat->setCapability(DSWaylandSeat::capPointer);
- EXPECT_TRUE(DSWaylandSeat::capPointer == seat->getCapability());
-
- seat->setCapability(DSWaylandSeat::capTouch);
- EXPECT_TRUE(DSWaylandSeat::capTouch == seat->getCapability());
-
- delete seat;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandSeatTest, SetGetName)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- DSWaylandSeat *seat = new DSWaylandSeat(comp, DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- std::string sName{"seat0"};
- std::string gName;
-
- seat->setName(sName);
- gName = seat->getName();
- EXPECT_TRUE(gName.compare(std::string{"seat0"}) == 0);
-
- delete seat;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandSeatTest, getKeyboardPointerTouch)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- DSWaylandSeat *seat = new DSWaylandSeat(comp, DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- EXPECT_TRUE(seat->getPointer () != nullptr);
- EXPECT_TRUE(seat->getKeyboard () != nullptr);
- EXPECT_TRUE(seat->getTouch () != nullptr);
-
- delete seat;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandSeatTest, GetSetCurrentEventTime)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- auto seat = new DSWaylandSeat(comp, DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- uint32_t currentTime = comp->currentTime();
- seat->setCurrentEventTime(currentTime);
- EXPECT_TRUE(currentTime == seat->getCurrentEventTime());
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandSeatTest, GetSetXkb)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- if (comp)
- {
- auto seat = new DSSeat();
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- auto xkb = seat->getXkb();
- EXPECT_TRUE(xkb != nullptr);
-
- if (xkb)
- {
- auto waylandSeat = new DSWaylandSeat(comp, DSWaylandSeat::capDefault);
- EXPECT_TRUE(waylandSeat != nullptr);
-
- waylandSeat->setXkb(xkb);
- EXPECT_TRUE(xkb == waylandSeat->getXkb());
- }
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandSurface.h"
-
-using namespace display_server;
-
-class DSWaylandSurfaceTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-static void
-handle_global(void *data, struct wl_registry *registry, uint32_t name,
- const char *interface, uint32_t version)
-{
- struct TestClient *testClient = (struct TestClient *)data;
-
- if (strcmp(interface, "wl_compositor") == 0) {
- testClient->compositor = (struct wl_compositor *)wl_registry_bind(registry, name, &wl_compositor_interface, 1);
- if (!testClient->compositor)
- DSLOG_ERR("TEST", "wl_registry_bind compositor fails.");
- }
-}
-
-static void
-handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
-{}
-
-static const struct wl_registry_listener registry_listener = {
- handle_global,
- handle_global_remove
-};
-
-TEST_F(DSWaylandSurfaceTest, NewDSWaylandSurface)
-{
- auto waylandSurface = std::make_unique<DSWaylandSurface>();
- EXPECT_TRUE(waylandSurface != nullptr);
-}
-
-TEST_F(DSWaylandSurfaceTest, NewDSWaylandSurfaceWithPrams)
-{
- DSWaylandCompositor *waylandCompositor = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(waylandCompositor != nullptr);
-
- if (waylandCompositor)
- {
- DSWaylandClient *waylandClient = new DSWaylandClient(waylandCompositor, (wl_client *)nullptr);
- EXPECT_TRUE(waylandClient != nullptr);
-
- if (waylandClient)
- {
- auto waylandSurface = std::make_unique<DSWaylandSurface>(waylandClient, 0);
- EXPECT_TRUE(waylandSurface != nullptr);
-
- delete waylandClient;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandSurfaceTest, registerCallbackSurfaceCommitted)
-{
- auto mockWaylandCompositor = std::make_unique<MockWaylandCompositor>();
-
- Ecore_Timer *serverQuitTimer = nullptr;
- double severQuitTime = 1.0;
- auto serverQuitFunc = [](void *data) -> Eina_Bool {
- MockWaylandCompositor *comp = (MockWaylandCompositor *)data;
-
- // quit server
- comp->quit();
- // check the emitting the surfaceCommitted
- EXPECT_TRUE(comp->surfaceCommitted);
-
- return EINA_FALSE;
- };
- serverQuitTimer = ecore_timer_loop_add(severQuitTime, serverQuitFunc, mockWaylandCompositor.get());
- EXPECT_TRUE(serverQuitTimer != nullptr);
-
- // create the wayland client which creates the wl_surface.
- std::future<bool> clientThread = std::async(std::launch::async, []() -> bool {
- std::this_thread::sleep_for(std::chrono::milliseconds(40));
- auto testClient = std::make_shared<TestClient>();
-
- testClient->display = wl_display_connect(NULL);
- EXPECT_TRUE(testClient->display != nullptr);
-
- testClient->registry = wl_display_get_registry(testClient->display);
- wl_registry_add_listener(testClient->registry, ®istry_listener, testClient.get());
- wl_display_dispatch(testClient->display);
- wl_display_roundtrip(testClient->display);
- EXPECT_TRUE(testClient->compositor != nullptr);
-
- testClient->surface = wl_compositor_create_surface(testClient->compositor);
- EXPECT_TRUE(testClient->surface != nullptr);
- wl_display_roundtrip(testClient->display);
-
- testClient->tbm_client = wayland_tbm_client_init(testClient->display);
- EXPECT_TRUE(testClient->tbm_client != nullptr);
- testClient->tbmBuffer = tbm_surface_create(720, 1280, TBM_FORMAT_ARGB8888);
- EXPECT_TRUE(testClient->tbmBuffer != nullptr);
- testClient->buffer = wayland_tbm_client_create_buffer(testClient->tbm_client, testClient->tbmBuffer);
- EXPECT_TRUE(testClient->buffer != nullptr);
-
- wl_surface_attach(testClient->surface, testClient->buffer, 0, 0);
- wl_surface_damage(testClient->surface, 0, 0, 100, 100);
- wl_surface_set_buffer_transform(testClient->surface, 0);
- wl_surface_set_buffer_scale(testClient->surface, 1);
- wl_surface_damage_buffer(testClient->surface, 0, 0, 100, 100);
- wl_surface_frame(testClient->surface);
- wl_surface_commit(testClient->surface);
-
- wl_display_roundtrip(testClient->display);
-
- wayland_tbm_client_destroy_buffer(testClient->tbm_client, testClient->buffer);
- tbm_surface_destroy(testClient->tbmBuffer);
- wayland_tbm_client_deinit(testClient->tbm_client);
-
- wl_display_disconnect(testClient->display);
-
- return true;
- }
- );
-
- mockWaylandCompositor->run();
- EXPECT_TRUE(clientThread.get()); // join(wait) and get the return value.
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTextInput.h"
-#include "DSWaylandTextInputManager.h"
-
-using namespace display_server;
-
-class DSWaylandTextInputTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandTextInputTest, NewDSWaylandTextInput)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, ShowInputPanel)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->showInputPanel();
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, HideInputPanel)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->hideInputPanel();
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendCommitString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendCommitString(0, "");
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendPreeditString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendPreeditString(1, "", "");
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendPreeditStyling)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendPreeditStyling(1, 1, 1);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendPreeditCursor)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendPreeditCursor(0);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendDeleteSurroundingText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendDeleteSurroundingText(1, 1);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendCursorPosition)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendCursorPosition(1, 1);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendModifiersMap)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendModifiersMap("");
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendKeysym)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendKeysym(1, 10, 65, 1, 1);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendLanguage)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendLanguage(1, "en_US");
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendTextDirection)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendTextDirection(1, 1);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendSelectionRegion)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendSelectionRegion(1, 10, 20);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendPrivateCommand)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendPrivateCommand(1, "CONFORMANT_RESET");
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendInputPanelData)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendInputPanelData(1, "", 0);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendGetSelectionText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendGetSelectionText(5);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendGetSurroundingText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendGetSurroundingText(5, 10, 5);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendFilterKeyEventDone)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendFilterKeyEventDone(1, 0);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendInputPanelGeometry)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendInputPanelGeometry(0, 100, 200, 100);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendRecaptureString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendRecaptureString(1, 1, 0, "", "", "");
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendInputPanelEvent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendInputPanelEvent(1, 1, 0);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SendCommitContent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->sendCommitContent(1, "", "", "");
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, UpdatePanelState)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->updatePanelState(true);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, SetGeometryUpdated)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- textInput->setGeometryUpdated(true);
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputTest, GetClientSurface)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager);
- EXPECT_TRUE(textInput != nullptr);
-
- (void)textInput->getClientSurface();
-
- delete textInput;
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTextInputManager.h"
-
-using namespace display_server;
-
-class DSWaylandTextInputManagerTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandTextInputManagerTest, NewDSWaylandTextInputManager)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextCommitString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextCommitString(0, "");
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextPreeditString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextPreeditString(1, "", "");
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextPreeditStyling)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextPreeditStyling(1, 1, 1);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextPreeditCursor)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextPreeditCursor(0);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextDeleteSurroundingText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextDeleteSurroundingText(1, 1);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextCursorPosition)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextCursorPosition(1, 1);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextModifiersMap)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextModifiersMap("");
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextKeysym)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextKeysym(1, 10, 65, 1, 1);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextLanguage)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextLanguage(1, "en_US");
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextTextDirection)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextTextDirection(1, 1);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextSelectionRegion)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextSelectionRegion(1, 10, 20);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextPrivateCommand)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextPrivateCommand(1, "CONFORMANT_RESET");
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextUpdateInputPanelData)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextUpdateInputPanelData(1, "", 0);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextShowInputPanel)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextShowInputPanel();
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextHideInputPanel)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextHideInputPanel();
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextGetSelectionText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextGetSelectionText(5);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextGetSurroundingText)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextGetSurroundingText(5, 10, 5);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextFilterKeyEventDone)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextFilterKeyEventDone(1, 0);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextUpdateIseGeometry)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextUpdateIseGeometry(0, 100, 200, 100);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextRecaptureString)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextRecaptureString(1, 1, 0, "", "", "");
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextInputPanelEvent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextInputPanelEvent(1, 1, 0);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, ContextCommitContent)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->contextCommitContent(1, "", "", "");
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, UpdateTextInputPanelState)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->updateTextInputPanelState(true);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, SetGeometryUpdated)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- textInputManager->setGeometryUpdated(true);
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTextInputManagerTest, GetTextInputSurface)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp);
- EXPECT_TRUE(textInputManager != nullptr);
-
- (void)textInputManager->getTextInputSurface();
-
- delete textInputManager;
- DSWaylandCompositor::releaseInstance();
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include <wayland-extension/tizen-launch-client-protocol.h>
-#include "DSWaylandTizenAppinfo.h"
-#include "DSTizenAppinfoMgr.h"
-
-using namespace display_server;
-
-class DSWaylandTizenAppinfoTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenAppinfoTest, New_Appinfo)
-{
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- DSWaylandTizenAppinfo *tzAppinfo = new DSWaylandTizenAppinfo(compositor);
- EXPECT_TRUE(tzAppinfo != nullptr);
-
- if (tzAppinfo)
- delete tzAppinfo;
-
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTizenAppinfoTest, New_Appinfo_with_AppinfoMgr)
-{
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- DSTizenAppinfoMgr *dsAppinfoMgr = DSTizenAppinfoMgr::getInstance();
- DSWaylandTizenAppinfo *tzAppinfo = new DSWaylandTizenAppinfo(compositor, dsAppinfoMgr);
- EXPECT_TRUE(tzAppinfo != nullptr);
-
- if (tzAppinfo)
- delete tzAppinfo;
-
- DSTizenAppinfoMgr::releaseInstance();
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTizenAppinfoTest, Initialize_Appinfo)
-{
- bool ret;
-
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- DSWaylandTizenAppinfo *tzAppinfo = new DSWaylandTizenAppinfo(compositor);
-
- ret = tzAppinfo->initialize(compositor);
- EXPECT_TRUE(ret == true);
-
- if (tzAppinfo)
- delete tzAppinfo;
-
- DSWaylandCompositor::releaseInstance();
-}
-
-static struct tizen_launch_appinfo *tz_appinfo = nullptr;
-
-static void
-handle_global(void *data, struct wl_registry *registry, uint32_t name,
- const char *interface, uint32_t version)
-{
- struct TestClient *testClient = (struct TestClient *)data;
-
- if (strcmp(interface, "wl_compositor") == 0) {
- testClient->compositor = (struct wl_compositor *)wl_registry_bind(registry, name, &wl_compositor_interface, 1);
- if (!testClient->compositor)
- DSLOG_ERR("TEST", "wl_registry_bind compositor fails.");
- }
- else if(strcmp(interface, "tizen_launch_appinfo") == 0)
- {
- const char * appId = "com.samsung.clocksetting";
-
- tz_appinfo = (struct tizen_launch_appinfo *)wl_registry_bind(registry, name, &tizen_launch_appinfo_interface, 1);
-
- tizen_launch_appinfo_register_appid(tz_appinfo, appId);
- tizen_launch_appinfo_set_pid(tz_appinfo, appId, 4077);
- tizen_launch_appinfo_deregister_appid(tz_appinfo, appId);
- }
-}
-
-static void
-handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
-{}
-
-static const struct wl_registry_listener registry_listener = {
- handle_global,
- handle_global_remove
-};
-TEST_F(DSWaylandTizenAppinfoTest, testRequest_Appinfo)
-{
- auto mockWaylandCompositor = std::make_unique<MockWaylandCompositor>();
-
- Ecore_Timer *serverQuitTimer = nullptr;
- double severQuitTime = 1.0;
- auto serverQuitFunc = [](void *data) -> Eina_Bool {
- MockWaylandCompositor *comp = (MockWaylandCompositor *)data;
-
- // quit server
- comp->quit();
- // check the emitting the surfaceCreated
- EXPECT_TRUE(tz_appinfo != nullptr);
-
- return EINA_FALSE;
- };
- serverQuitTimer = ecore_timer_loop_add(severQuitTime, serverQuitFunc, mockWaylandCompositor.get());
- EXPECT_TRUE(serverQuitTimer != nullptr);
-
- // create the wayland client which creates the wl_surface.
- std::future<bool> clientThread = std::async(std::launch::async, []() -> bool {
- std::this_thread::sleep_for(std::chrono::milliseconds(40));
- auto testClient = std::make_shared<TestClient>();
-
- testClient->display = wl_display_connect(NULL);
- EXPECT_TRUE(testClient->display != nullptr);
-
- testClient->registry = wl_display_get_registry(testClient->display);
- wl_registry_add_listener(testClient->registry, ®istry_listener, testClient.get());
- wl_display_dispatch(testClient->display);
- wl_display_roundtrip(testClient->display);
- EXPECT_TRUE(testClient->compositor != nullptr);
-
- wl_display_disconnect(testClient->display);
-
- return true;
- }
- );
-
- mockWaylandCompositor->run();
- EXPECT_TRUE(clientThread.get()); // join(wait) and get the return value.
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTizenIndicator.h"
-
-using namespace display_server;
-
-class DSWaylandTizenIndicatorTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenIndicatorTest, NewDSWaylandTizenIndicator)
-{
- DSWaylandTizenIndicator *tzInd = new DSWaylandTizenIndicator;
- EXPECT_TRUE(tzInd != nullptr);
-
- if (tzInd)
- delete tzInd;
-}
-
-TEST_F(DSWaylandTizenIndicatorTest, VisibleTypeSetGet)
-{
- DSWaylandTizenIndicator *tzInd = new DSWaylandTizenIndicator;
- EXPECT_TRUE(tzInd != nullptr);
-
- tzInd->setVisibleType(DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN);
- EXPECT_TRUE(tzInd->getVisibleType() == DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN);
-
- if (tzInd)
- delete tzInd;
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTizenInputDevice.h"
-
-using namespace display_server;
-
-class DSWaylandTizenInputDeviceTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenInputDeviceTest, NewDSWaylandTizenInputDevice)
-{
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(compositor != nullptr);
-
- if (compositor)
- {
- DSWaylandTizenInputDeviceManager *inputDeviceManager = new DSWaylandTizenInputDeviceManager(compositor);
- EXPECT_TRUE(inputDeviceManager != nullptr);
-
- if (inputDeviceManager)
- {
- DSWaylandTizenInputDevice *inputDevice = new DSWaylandTizenInputDevice(inputDeviceManager);
- EXPECT_TRUE(inputDevice != nullptr);
-
- delete inputDevice;
- delete inputDeviceManager;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTizenInputDeviceManager.h"
-
-using namespace display_server;
-
-class DSWaylandTizenInputDeviceManagerTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenInputDeviceManagerTest, NewDSWaylandTizenInputDeviceManager)
-{
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(compositor != nullptr);
-
- if (compositor)
- {
- DSWaylandTizenInputDeviceManager *inputDeviceManager = new DSWaylandTizenInputDeviceManager(compositor);
- EXPECT_TRUE(inputDeviceManager != nullptr);
-
- if (inputDeviceManager)
- delete inputDeviceManager;
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
-TEST_F(DSWaylandTizenInputDeviceManagerTest, getTizenInputDevice)
-{
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(compositor != nullptr);
-
- if (compositor)
- {
- DSWaylandTizenInputDeviceManager *inputDeviceManager = new DSWaylandTizenInputDeviceManager(compositor);
- EXPECT_TRUE(inputDeviceManager != nullptr);
-
- if (inputDeviceManager)
- {
- EXPECT_TRUE(inputDeviceManager->getTizenInputDevice());
-
- delete inputDeviceManager;
- }
-
- DSWaylandCompositor::releaseInstance();
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTizenLaunchEffect.h"
-
-using namespace display_server;
-
-class DSWaylandTizenLaunchEffectTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenLaunchEffectTest, New_LaunchEffect)
-{
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- DSWaylandTizenLaunchEffect *tzLaunchEffect = new DSWaylandTizenLaunchEffect(compositor);
- EXPECT_TRUE(tzLaunchEffect != nullptr);
-
- if (tzLaunchEffect)
- delete tzLaunchEffect;
-
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTizenLaunchEffectTest, Initialize_LaunchEffect)
-{
- bool ret;
-
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- DSWaylandTizenLaunchEffect *tzLaunchEffect = new DSWaylandTizenLaunchEffect(compositor);
-
- ret = tzLaunchEffect->initialize(compositor);
- EXPECT_TRUE(ret == true);
-
- if (tzLaunchEffect)
- delete tzLaunchEffect;
-
- DSWaylandCompositor::releaseInstance();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandCompositor.h"
-#include "DSWaylandTizenPolicy.h"
-
-using namespace display_server;
-
-class DSWaylandTizenPolicyTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenPolicyTest, new_P1)
-{
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- DSWaylandTizenPolicy *tizenPolicy = new DSWaylandTizenPolicy(compositor);
- delete tizenPolicy;
- EXPECT_TRUE(true);
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTizenPolicyTest, initialize_P1)
-{
- bool ret;
-
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- DSWaylandTizenPolicy *tizenPolicy = new DSWaylandTizenPolicy(compositor);
-
- ret = tizenPolicy->initialize(compositor);
- EXPECT_TRUE(ret == true);
-
- delete tizenPolicy;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTizenPolicyTest, initialize_P2)
-{
- bool ret;
-
- DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance();
- DSWaylandTizenPolicy *tizenPolicy = new DSWaylandTizenPolicy(nullptr);
-
- ret = tizenPolicy->initialize(compositor);
- EXPECT_TRUE(ret == true);
-
- delete tizenPolicy;
- DSWaylandCompositor::releaseInstance();
-}
-
-TEST_F(DSWaylandTizenPolicyTest, initialize_N1)
-{
- bool ret;
- DSWaylandTizenPolicy *tizenPolicy = new DSWaylandTizenPolicy(nullptr);
-
- ret = tizenPolicy->initialize(nullptr);
- EXPECT_TRUE(ret == false);
-
- delete tizenPolicy;
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTizenPolicyExt.h"
-
-using namespace display_server;
-
-class DSWaylandTizenPolicyExtTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenPolicyExtTest, NewDSWaylandTizenPolicyExt)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTizenPolicyExt *tizenPolicyExt = new DSWaylandTizenPolicyExt(comp);
- EXPECT_TRUE(tizenPolicyExt != nullptr);
-
- if (tizenPolicyExt)
- delete tizenPolicyExt;
- DSWaylandCompositor::releaseInstance();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTizenSurface.h"
-
-using namespace display_server;
-
-class DSWaylandTizenSurfaceTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenSurfaceTest, NewDSWaylandTizenSurface)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTizenSurface *tizenSurface = new DSWaylandTizenSurface(comp);
- EXPECT_TRUE(tizenSurface != nullptr);
-
- if (tizenSurface)
- delete tizenSurface;
- DSWaylandCompositor::releaseInstance();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTizenSurfaceShm.h"
-
-using namespace display_server;
-
-class DSWaylandTizenSurfaceShmTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandTizenSurfaceShmTest, NewDSWaylandTizenSurfaceShm)
-{
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- DSWaylandTizenSurfaceShm *shm = new DSWaylandTizenSurfaceShm(comp);
- EXPECT_TRUE(shm != nullptr);
-
- if (shm)
- delete shm;
- DSWaylandCompositor::releaseInstance();
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandTouch.h"
-#include "DSWaylandSeat.h"
-#include "DSWaylandSurface.h"
-
-using namespace display_server;
-
-class DSWaylandTouchTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-/* Test cases */
-TEST_F(DSWaylandTouchTest, NewDSWaylandTouch)
-{
- DSWaylandTouch *touch = new DSWaylandTouch(nullptr);
- EXPECT_TRUE(touch != nullptr);
-
- if (touch)
- delete touch;
-}
-
-TEST_F(DSWaylandTouchTest, GetSeat)
-{
- DSWaylandSeat *seat = new DSWaylandSeat(nullptr, DSWaylandSeat::capDefault);
- EXPECT_TRUE(seat != nullptr);
-
- if (seat)
- {
- DSWaylandTouch *touch = new DSWaylandTouch(seat);
- EXPECT_TRUE(touch != nullptr);
-
- if (touch)
- {
- EXPECT_TRUE(touch->seat() == seat);
-
- delete touch;
- }
-
- delete seat;
- }
-}
-
-TEST_F(DSWaylandTouchTest, SetGetFocus)
-{
- auto touch = new DSWaylandTouch(nullptr);
- EXPECT_TRUE(touch != nullptr);
-
- if (touch)
- {
- auto waylandSurface = std::make_unique<DSWaylandSurface>();
- EXPECT_TRUE(waylandSurface != nullptr);
-
- if (waylandSurface)
- {
- touch->setFocus(waylandSurface.get());
- EXPECT_TRUE(waylandSurface.get() == touch->getFocus());
- }
- }
-}
-
-TEST_F(DSWaylandTouchTest, ResetFocus)
-{
- auto touch = new DSWaylandTouch(nullptr);
- EXPECT_TRUE(touch != nullptr);
-
- if (touch)
- {
- touch->resetFocus();
- EXPECT_TRUE(nullptr == touch->getFocus());
- }
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandZxdgShellV6.h"
-
-using namespace display_server;
-
-class DSWaylandZxdgShellV6Test : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgShellV6)
-{
- DSWaylandZxdgShellV6 *zxdgShell = new DSWaylandZxdgShellV6;
- EXPECT_TRUE(zxdgShell != nullptr);
-
- if (zxdgShell)
- delete zxdgShell;
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, ShellAddSurface)
-{
- DSWaylandZxdgShellV6 *zxdgShell = new DSWaylandZxdgShellV6;
- DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(zxdgShell);
- EXPECT_TRUE(zxdgShell != nullptr);
- EXPECT_TRUE(zxdgSurface != nullptr);
-
- zxdgShell->addSurface(zxdgSurface);
- EXPECT_TRUE(true);
-
- if (zxdgSurface) delete zxdgSurface;
- if (zxdgShell) delete zxdgShell;
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, ShellGetSurfaceList)
-{
- DSWaylandZxdgShellV6 *zxdgShell = new DSWaylandZxdgShellV6;
- DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(zxdgShell);
- EXPECT_TRUE(zxdgShell != nullptr);
- EXPECT_TRUE(zxdgSurface != nullptr);
-
- zxdgShell->addSurface(zxdgSurface);
- auto surfList = zxdgShell->getSurfaceList();
-
- for (auto iter = surfList.begin() ; iter != surfList.end() ; iter++)
- {
- EXPECT_TRUE(*iter == zxdgSurface);
- }
-
- if (zxdgSurface) delete zxdgSurface;
- if (zxdgShell) delete zxdgShell;
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgPositionerV6)
-{
- DSWaylandZxdgPositionerV6 *zxdgPositioner = new DSWaylandZxdgPositionerV6;
- EXPECT_TRUE(zxdgPositioner != nullptr);
-
- if (zxdgPositioner)
- delete zxdgPositioner;
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgSurfaceV6)
-{
- DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(nullptr);
- EXPECT_TRUE(zxdgSurface != nullptr);
-
- if (zxdgSurface)
- delete zxdgSurface;
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, SetSurface)
-{
- auto dsSurface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(dsSurface != nullptr);
-
- auto zxdgSurface = std::make_shared<DSWaylandZxdgSurfaceV6>(nullptr);
- EXPECT_TRUE(zxdgSurface != nullptr);
-
- if (zxdgSurface && dsSurface)
- {
- DSWaylandSurface *ptrDsSurface = dsSurface.get();
- zxdgSurface->setSurface(ptrDsSurface);
-
- DSWaylandSurface *resultSurf = zxdgSurface->getSurface();
- EXPECT_TRUE(resultSurf == ptrDsSurface);
- }
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, SurfaceSetWindowTitle)
-{
- DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(nullptr);
- std::string inputStr("test");
- EXPECT_TRUE(zxdgSurface != nullptr);
-
- zxdgSurface->setWindowTitle(inputStr);
- EXPECT_TRUE(inputStr.compare(zxdgSurface->getWindowTitle().c_str()) == 0);
-
- if (zxdgSurface)
- delete zxdgSurface;
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, SurfaceSetAppID)
-{
- DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(nullptr);
- std::string inputStr("test");
- EXPECT_TRUE(zxdgSurface != nullptr);
-
- zxdgSurface->setAppID(inputStr);
- EXPECT_TRUE(inputStr.compare(zxdgSurface->getAppID().c_str()) == 0);
-
- if (zxdgSurface)
- delete zxdgSurface;
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgToplevelV6)
-{
- DSWaylandZxdgToplevelV6 *zxdgToplevel = new DSWaylandZxdgToplevelV6;
- EXPECT_TRUE(zxdgToplevel != nullptr);
-
- if (zxdgToplevel)
- delete zxdgToplevel;
-}
-
-TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgPopupV6)
-{
- DSWaylandZxdgPopupV6 *zxdgPopup = new DSWaylandZxdgPopupV6;
- EXPECT_TRUE(zxdgPopup != nullptr);
-
- if (zxdgPopup)
- delete zxdgPopup;
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSObject.h"
-#include "DSWindow.h"
-#include "DSWindowShell.h"
-#include "DSStruct.h"
-
-using namespace display_server;
-
-class DSWindowTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWindowTest, NewDSWindow)
-{
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-}
-
-TEST_F(DSWindowTest, NewDSWindowWithDSWaylandSurface)
-{
- auto waylandSurface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(waylandSurface != nullptr);
- auto window = std::make_shared<DSWindow>(waylandSurface);
- EXPECT_TRUE(window != nullptr);
-}
-
-TEST_F(DSWindowTest, BasicMethods)
-{
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-
- EXPECT_TRUE(win->show() == true);
- EXPECT_TRUE(win->hide(true) == true);
- EXPECT_TRUE(win->showState() == 0);
-
- EXPECT_TRUE(win->setLayer(100) == true);
-
- EXPECT_TRUE(win->raise() == true);
- EXPECT_TRUE(win->lower() == true);
-
- EXPECT_TRUE(win->hasFocus() == false);
- EXPECT_TRUE(win->setFocus() == true);
- EXPECT_TRUE(win->hasFocus() == true);
- EXPECT_TRUE(win->unsetFocus() == true);
- EXPECT_TRUE(win->hasFocus() != true);
-}
-
-TEST_F(DSWindowTest, SizeTest)
-{
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-
- stSize size = win->getSize();
- EXPECT_TRUE(size.w == 0);
- EXPECT_TRUE(size.h == 0);
-
- win->setSize(1280, 720);
- size = win->getSize();
- EXPECT_TRUE(size.w == 1280);
- EXPECT_TRUE(size.h == 720);
-
- stSize sSize;
- sSize.w = 700;
- sSize.h = 700;
- win->setSize(sSize);
-
- size = win->getSize();
- EXPECT_TRUE(size.w == sSize.w);
- EXPECT_TRUE(size.h == sSize.h);
-}
-
-TEST_F(DSWindowTest, PositionTest)
-{
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-
- stPosition pos = win->getPosition();
- EXPECT_TRUE(pos.x == 0);
- EXPECT_TRUE(pos.y == 0);
-
- win->setPosition(100, 200);
- pos = win->getPosition();
- EXPECT_TRUE(pos.x == 100);
- EXPECT_TRUE(pos.y == 200);
-}
-
-TEST_F(DSWindowTest, WindowShellTest)
-{
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-
- auto winShell = std::make_shared<DSWindowShell>(win.get());
- EXPECT_TRUE(winShell != nullptr);
-}
-
-TEST_F(DSWindowTest, TitleTest)
-{
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-
- bool ret = false;
- ret = win->setTitle("test title");
- EXPECT_TRUE(ret == true);
-
- std::string title = win->getTitle();
- EXPECT_TRUE(title.compare("test title") == 0);
-}
-
-TEST_F(DSWindowTest, SkipFocusTest)
-{
- bool ret;
- bool skip;
-
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-
- skip = win->getSkipFocus();
- EXPECT_TRUE(skip == false);
-
- ret = win->setSkipFocus(true);
- EXPECT_TRUE(ret == true);
-
- skip = win->getSkipFocus();
- EXPECT_TRUE(skip == true);
-
- ret = win->setSkipFocus(false);
- EXPECT_TRUE(ret == true);
-
- skip = win->getSkipFocus();
- EXPECT_TRUE(skip == false);
-}
-
-TEST_F(DSWindowTest, ParentTest)
-{
- auto parent = std::make_shared<DSWindow>();
- EXPECT_TRUE(parent != nullptr);
- EXPECT_TRUE(parent->getParent() == nullptr);
-
- auto child = std::make_shared<DSWindow>();
- EXPECT_TRUE(child != nullptr);
- EXPECT_TRUE(child->getParent() == nullptr);
-
- child->setParent(parent.get());
- EXPECT_TRUE(child->getParent() == parent.get());
-
- child->setParent(nullptr);
- EXPECT_TRUE(child->getParent() == nullptr);
-
- child->setParent(child.get());
- EXPECT_TRUE(child->getParent() == nullptr);
-}
-
-TEST_F(DSWindowTest, UserGeometryTest)
-{
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-
- EXPECT_FALSE(win->isAllowUserGeometry());
-
- win->allowUserGeometry(true);
- EXPECT_TRUE(win->isAllowUserGeometry());
-}
-
-TEST_F(DSWindowTest, TypeTest)
-{
- auto win = std::make_shared<DSWindow>();
- EXPECT_TRUE(win != nullptr);
-
- int type;
- type = win->getType();
- EXPECT_TRUE(type == 0);
-
- win->setType(3);
-
- type = win->getType();
- EXPECT_TRUE(type == 3);
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSWaylandCompositor.h"
-#include "DSWindowManager.h"
-#include "DSZone.h"
-#include "DSWindow.h"
-#include "DSWaylandSurface.h"
-
-
-using namespace display_server;
-
-class DSWindowManagerTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWindowManagerTest, GetWindowManager)
-{
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
- DSWindowManager::releaseInstance();
-}
-
-TEST_F(DSWindowManagerTest, RegisterWindow)
-{
- bool ret = false;
- DSZone *foundZone = nullptr;
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto window = std::make_shared<DSWindow>();
- EXPECT_TRUE(window != nullptr);
-
- foundZone = winMgr->getZone(window.get());
- EXPECT_TRUE(foundZone == nullptr);
-
- ret = winMgr->registerWindow(zone.get(), window.get());
- EXPECT_TRUE(ret == true);
-
- foundZone = winMgr->getZone(window.get());
- EXPECT_TRUE(foundZone == zone.get());
-
- winMgr->unregisterWindow(zone.get(), window.get());
-
- foundZone = winMgr->getZone(window.get());
- EXPECT_TRUE(foundZone == nullptr);
-
- DSWindowManager::releaseInstance();
-}
-
-TEST_F(DSWindowManagerTest, RegisterSurface)
-{
- bool ret = false;
- DSZone *foundZone = nullptr;
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto surface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface != nullptr);
-
- foundZone = winMgr->getZone(surface.get());
- EXPECT_TRUE(foundZone == nullptr);
-
- ret = winMgr->registerSurface(zone.get(), surface.get());
- EXPECT_TRUE(ret == true);
-
- foundZone = winMgr->getZone(surface.get());
- EXPECT_TRUE(foundZone == zone.get());
-
- winMgr->unregisterSurface(zone.get(), surface.get());
-
- foundZone = winMgr->getZone(surface.get());
- EXPECT_TRUE(foundZone == nullptr);
-
- DSWindowManager::releaseInstance();
-}
-
-TEST_F(DSWindowManagerTest, ParentTest_P1)
-{
- bool ret = false;
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto surface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface != nullptr);
-
- auto surface2 = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface2 != nullptr);
-
- zone->testCreateWindow(surface);
- zone->testCreateWindow(surface2);
-
- ret = winMgr->registerSurface(zone.get(), surface.get());
- EXPECT_TRUE(ret == true);
-
- ret = winMgr->registerSurface(zone.get(), surface2.get());
- EXPECT_TRUE(ret == true);
-
- ret = winMgr->setWindowParent(surface.get(), nullptr);
- EXPECT_TRUE(ret == true);
-
- ret = winMgr->setWindowParent(surface.get(), surface2.get());
- EXPECT_TRUE(ret == true);
-
- DSWindowManager::releaseInstance();
-}
-
-TEST_F(DSWindowManagerTest, ParentTest_N1)
-{
- bool ret = false;
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto zone2 = std::make_shared<DSZone>();
- EXPECT_TRUE(zone2 != nullptr);
-
- auto surface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface != nullptr);
-
- auto surface2 = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface2 != nullptr);
-
- // Not registered to DSZone
- ret = winMgr->setWindowParent(surface.get(), surface2.get());
- EXPECT_TRUE(ret == false);
-
- winMgr->registerSurface(zone.get(), surface.get());
- winMgr->registerSurface(zone2.get(), surface2.get());
-
- // Not SAME DSZone
- ret = winMgr->setWindowParent(surface.get(), surface2.get());
- EXPECT_TRUE(ret == false);
-
- DSWindowManager::releaseInstance();
-}
-
-TEST_F(DSWindowManagerTest, PropertyTest)
-{
- bool ret = false;
- DSWindow *window = nullptr;
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto surface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface != nullptr);
-
- DSWaylandSurface *surface_ptr = surface.get();
- EXPECT_TRUE(surface_ptr != nullptr);
-
- zone->testCreateWindow(surface);
-
- ret = winMgr->registerSurface(zone.get(), surface_ptr);
- EXPECT_TRUE(ret == true);
-
- std::list<std::shared_ptr<DSWindow>> winList = zone->getWindowList();
- for (auto w : winList)
- {
- if (w->surface() == surface_ptr)
- {
- window = w.get();
- }
- }
- EXPECT_TRUE(window != nullptr);
-
- winMgr->setWindowTitle(surface_ptr, "test");
- const std::string str = window->getTitle();
- EXPECT_TRUE(str == "test");
-
- winMgr->setWindowType(surface_ptr, 3);
-
- winMgr->setWindowAllowUserGeometry(surface_ptr, true);
- winMgr->setWindowGeometry(surface_ptr, 100, 200, 320, 480);
- stGeometry geo = winMgr->getWindowGeometry(surface_ptr);
- EXPECT_TRUE(geo.x == 100);
- EXPECT_TRUE(geo.y == 200);
- EXPECT_TRUE(geo.w == 320);
- EXPECT_TRUE(geo.h == 480);
-
- winMgr->setWindowPosition(surface_ptr, 50, 100);
- geo = winMgr->getWindowGeometry(surface_ptr);
- EXPECT_TRUE(geo.x == 50);
- EXPECT_TRUE(geo.y == 100);
-
- DSWindowManager::releaseInstance();
-}
-
-TEST_F(DSWindowManagerTest, AuxHintsTest)
-{
- bool ret = false;
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto surface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface != nullptr);
-
- DSWaylandSurface *surface_ptr = surface.get();
- EXPECT_TRUE(surface_ptr != nullptr);
-
- zone->testCreateWindow(surface);
-
- ret = winMgr->registerSurface(zone.get(), surface_ptr);
- EXPECT_TRUE(ret == true);
-
- std::list<std::string> auxList = winMgr->getWindowSupportedAuxHints(surface_ptr);
- EXPECT_TRUE(auxList.size() > 0);
-
- winMgr->addWindowAuxHint(surface_ptr, 1, "wm.policy.win.user.geometry", "1");
- winMgr->setWindowGeometry(surface_ptr, 100, 200, 320, 480);
- stGeometry geo = winMgr->getWindowGeometry(surface_ptr);
- EXPECT_TRUE(geo.x == 100);
- EXPECT_TRUE(geo.y == 200);
- EXPECT_TRUE(geo.w == 320);
- EXPECT_TRUE(geo.h == 480);
-
- winMgr->changeWindowAuxHint(surface_ptr, 1, "0");
- geo = winMgr->getWindowGeometry(surface_ptr);
- EXPECT_TRUE(geo.x == 0);
- EXPECT_TRUE(geo.y == 0);
-
- winMgr->removeWindowAuxHint(surface_ptr, 1);
-
- DSWindowManager::releaseInstance();
-}
-
-TEST_F(DSWindowManagerTest, StackTest)
-{
- bool ret = false;
- DSWindow *resultWindow[3];
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto surface0 = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface0 != nullptr);
- DSWaylandSurface *surface_ptr0 = surface0.get();
- EXPECT_TRUE(surface_ptr0 != nullptr);
-
- auto surface1 = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface1 != nullptr);
- DSWaylandSurface *surface_ptr1 = surface1.get();
- EXPECT_TRUE(surface_ptr1 != nullptr);
-
- auto surface2 = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface2 != nullptr);
- DSWaylandSurface *surface_ptr2 = surface2.get();
- EXPECT_TRUE(surface_ptr2 != nullptr);
-
- zone->testCreateWindow(surface0);
- zone->testCreateWindow(surface1);
- zone->testCreateWindow(surface2);
-
- ret = winMgr->registerSurface(zone.get(), surface_ptr0);
- EXPECT_TRUE(ret == true);
- ret = winMgr->registerSurface(zone.get(), surface_ptr1);
- EXPECT_TRUE(ret == true);
- ret = winMgr->registerSurface(zone.get(), surface_ptr2);
- EXPECT_TRUE(ret == true);
-
- std::list<std::shared_ptr<DSWindow>> winList = zone->getWindowList();
- int id = 0;
- for (auto w : winList)
- {
- resultWindow[id] = w.get();
- id++;
- }
- EXPECT_TRUE(resultWindow[0]->surface() == surface_ptr2);
- EXPECT_TRUE(resultWindow[1]->surface() == surface_ptr1);
- EXPECT_TRUE(resultWindow[2]->surface() == surface_ptr0);
-
- // ACTIVATE window
- winMgr->activateWindow(surface_ptr0);
-
- winList = zone->getWindowList();
- id = 0;
- for (auto w : winList)
- {
- resultWindow[id] = w.get();
- id++;
- }
- EXPECT_TRUE(resultWindow[0]->surface() == surface_ptr0);
- EXPECT_TRUE(resultWindow[1]->surface() == surface_ptr2);
- EXPECT_TRUE(resultWindow[2]->surface() == surface_ptr1);
-
- // LOWER window
- winMgr->lowerWindow(surface_ptr2);
-
- winList = zone->getWindowList();
- id = 0;
- for (auto w : winList)
- {
- resultWindow[id] = w.get();
- id++;
- }
- EXPECT_TRUE(resultWindow[0]->surface() == surface_ptr0);
- EXPECT_TRUE(resultWindow[1]->surface() == surface_ptr1);
- EXPECT_TRUE(resultWindow[2]->surface() == surface_ptr2);
-
- // RAISE window
- winMgr->raiseWindow(surface_ptr2);
-
- winList = zone->getWindowList();
- id = 0;
- for (auto w : winList)
- {
- resultWindow[id] = w.get();
- id++;
- }
- EXPECT_TRUE(resultWindow[0]->surface() == surface_ptr2);
- EXPECT_TRUE(resultWindow[1]->surface() == surface_ptr0);
- EXPECT_TRUE(resultWindow[2]->surface() == surface_ptr1);
-
- DSWindowManager::releaseInstance();
-}
-
-TEST_F(DSWindowManagerTest, FocusTest)
-{
- bool ret = false;
- DSWindow *window = nullptr;
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto surface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface != nullptr);
-
- DSWaylandSurface *surface_ptr = surface.get();
- EXPECT_TRUE(surface_ptr != nullptr);
-
- zone->testCreateWindow(surface);
-
- ret = winMgr->registerSurface(zone.get(), surface_ptr);
- EXPECT_TRUE(ret == true);
-
- std::list<std::shared_ptr<DSWindow>> winList = zone->getWindowList();
- for (auto w : winList)
- {
- if (w->surface() == surface_ptr)
- {
- window = w.get();
- }
- }
- EXPECT_TRUE(window != nullptr);
-
- EXPECT_TRUE(window->getSkipFocus() == false);
-
- winMgr->setWindowSkipFocus(surface_ptr, true);
- EXPECT_TRUE(window->getSkipFocus() == true);
-}
-
-TEST_F(DSWindowManagerTest, KeyboardTest)
-{
- bool ret = false;
-
- DSWindowManager *winMgr = DSWindowManager::getInstance();
- EXPECT_TRUE(winMgr != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-
- auto surface = std::make_shared<DSWaylandSurface>();
- EXPECT_TRUE(surface != nullptr);
-
- DSWaylandSurface *surface_ptr = surface.get();
- EXPECT_TRUE(surface_ptr != nullptr);
-
- zone->testCreateWindow(surface);
-
- ret = winMgr->registerSurface(zone.get(), surface_ptr);
- EXPECT_TRUE(ret == true);
-
- ret = winMgr->setWindowVkbdFloating(surface_ptr, true);
- EXPECT_TRUE(ret == true);
-
- ret = winMgr->getWindowVkbdFloating(surface_ptr);
- EXPECT_TRUE(ret == true);
-
- ret = winMgr->setWindowVkbdFloating(surface_ptr, false);
- EXPECT_TRUE(ret == true);
-
- ret = winMgr->getWindowVkbdFloating(surface_ptr);
- EXPECT_TRUE(ret == false);
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSObject.h"
-#include "DSZone.h"
-#include "DSWindow.h"
-#include "DSWindowShell.h"
-#include "IDSWaylandShell.h"
-#include "DSWaylandZxdgShellV6.h"
-
-using namespace display_server;
-
-class DSWindowShellTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSWindowShellTest, NewDSWindowShell)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-}
-
-TEST_F(DSWindowShellTest, create_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(nullptr) == true);
-}
-
-TEST_F(DSWindowShellTest, create_P2)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
-}
-
-TEST_F(DSWindowShellTest, zone_P1)
-{
- auto zone = std::make_shared<DSZone>();
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->setZone(zone.get()));
-
- DSZone *tZone = winShell->getZone();
- EXPECT_TRUE(zone.get() == tZone);
-}
-
-TEST_F(DSWindowShellTest, shellSurface_P1)
-{
-/*
- DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
- EXPECT_TRUE(comp != nullptr);
-
- auto zone = std::make_shared<DSZone>();
- auto window = std::make_shared<DSWindow>();
- auto zxdgShell = std::make_shared<DSWaylandZxdgShellV6>(comp);
- auto shellSurface = std::make_shared<DSWaylandZxdgSurfaceV6>(zxdgShell.get());
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- winShell->setShellSurface(shellSurface.get());
-
- DSWaylandZxdgSurfaceV6 *tShellSurface = (DSWaylandZxdgSurfaceV6*)winShell->getShellSurface();
- EXPECT_TRUE(shellSurface.get() == tShellSurface);
-
- DSWaylandCompositor::releaseInstance();
-*/
-}
-
-TEST_F(DSWindowShellTest, window_P1)
-{
- auto zone = std::make_shared<DSZone>();
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- DSWindow *tWindow = winShell->getWindow();
- EXPECT_TRUE(window.get() == tWindow);
-}
-
-TEST_F(DSWindowShellTest, parent_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->getParent() == nullptr);
-
- auto childWindow = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> childWinShell = std::make_unique<DSWindowShell>(childWindow.get());
- EXPECT_TRUE(childWinShell != nullptr);
-
- EXPECT_TRUE(childWinShell->setParent(winShell.get()) == true);
- EXPECT_TRUE(childWinShell->getParent() == winShell.get());
-
- // test for set parent each other
- EXPECT_TRUE(winShell->setParent(childWinShell.get()) == false);
-
- // test for set parent itself
- EXPECT_TRUE(childWinShell->setParent(childWinShell.get()) == false);
-
- EXPECT_TRUE(childWinShell->setParent(nullptr) == true);
- EXPECT_TRUE(childWinShell->getParent() == nullptr);
-}
-
-TEST_F(DSWindowShellTest, child_P1)
-{
- auto zone = std::make_shared<DSZone>();
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- auto cWindow = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> cShell = std::make_unique<DSWindowShell>(cWindow.get());
-
- EXPECT_TRUE(winShell->addChild(cShell.get()));
- winShell->removeChild(cShell.get());
-}
-
-TEST_F(DSWindowShellTest, setTitle_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->setTitle("test setTitle") == true);
-}
-
-TEST_F(DSWindowShellTest, setSkipFocus_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->setSkipFocus(true));
-}
-
-TEST_F(DSWindowShellTest, setPosition_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->setPosition(100, 150) == true);
-}
-
-TEST_F(DSWindowShellTest, getPosition_P1)
-{
- stPosition pos;
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->setPosition(100, 150) == true);
- pos = winShell->getPosition();
-
- EXPECT_TRUE(pos.x == 0);
- EXPECT_TRUE(pos.y == 0);
-}
-
-TEST_F(DSWindowShellTest, getPosition_P2)
-{
- stPosition pos;
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- // set user geometry
- winShell->addAuxHint(1, "wm.policy.win.user.geometry", "1");
-
- EXPECT_TRUE(winShell->setPosition(100, 150) == true);
-
- pos = winShell->getPosition();
-
- EXPECT_TRUE(pos.x == 100);
- EXPECT_TRUE(pos.y == 150);
-}
-
-TEST_F(DSWindowShellTest, setSize_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->setSize(720, 1280) == true);
-}
-
-TEST_F(DSWindowShellTest, Geometry_P1)
-{
- stGeometry geo;
-
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- winShell->setGeometry(100, 150, 480, 800);
- geo = winShell->getGeometry();
-
- EXPECT_TRUE(geo.x == 0);
- EXPECT_TRUE(geo.y == 0);
- EXPECT_TRUE(geo.w == 0);
- EXPECT_TRUE(geo.h == 0);
-}
-
-TEST_F(DSWindowShellTest, Geometry_P2)
-{
- stGeometry geo;
-
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- // set user geometry
- winShell->addAuxHint(1, "wm.policy.win.user.geometry", "1");
-
- winShell->setGeometry(100, 150, 480, 800);
- geo = winShell->getGeometry();
-
- EXPECT_TRUE(geo.x == 100);
- EXPECT_TRUE(geo.y == 150);
- EXPECT_TRUE(geo.w == 480);
- EXPECT_TRUE(geo.h == 800);
-}
-
-TEST_F(DSWindowShellTest, auxHints_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- winShell->addAuxHint(1, "wm.policy.win.user.geometry", "1");
- winShell->changeAuxHint(1, "0");
- winShell->removeAuxHint(1);
-}
-
-TEST_F(DSWindowShellTest, show_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->show() == true);
-}
-
-TEST_F(DSWindowShellTest, hide_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->hide(true) == true);
-}
-
-TEST_F(DSWindowShellTest, showState_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->showState() == 0);
-}
-
-TEST_F(DSWindowShellTest, setLayer_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->setLayer(100) == true);
-}
-
-TEST_F(DSWindowShellTest, getLayer_P1)
-{
- int layer = -1;
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->setLayer(100) == true);
-
- layer = winShell->getLayer();
- EXPECT_TRUE(layer == 100);
-}
-
-TEST_F(DSWindowShellTest, raise_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->raise() == true);
-}
-
-TEST_F(DSWindowShellTest, lower_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->lower() == true);
-}
-
-TEST_F(DSWindowShellTest, setFocus_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->setFocus() == true);
-}
-
-TEST_F(DSWindowShellTest, isFocused_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->setFocus() == true);
-
- EXPECT_TRUE(winShell->isFocused() == true);
-}
-
-TEST_F(DSWindowShellTest, unsetFocus)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->create(0, 0, 720, 1280, nullptr) == true);
- EXPECT_TRUE(winShell->setFocus() == true);
- EXPECT_TRUE(winShell->isFocused() == true);
- EXPECT_TRUE(winShell->unsetFocus() == true);
- EXPECT_TRUE(winShell->isFocused() == false);
-}
-
-TEST_F(DSWindowShellTest, activate_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->activate());
-}
-
-TEST_F(DSWindowShellTest, activate_N1)
-{
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(nullptr);
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_FALSE(winShell->activate());
-}
-
-TEST_F(DSWindowShellTest, isActivated_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->isActivated());
-}
-
-TEST_F(DSWindowShellTest, iconify_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- bool ret = winShell->iconify();
- EXPECT_TRUE(ret == true);
-}
-
-TEST_F(DSWindowShellTest, iconify_P2)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- bool ret = winShell->iconify(true);
- EXPECT_TRUE(ret == true);
-}
-
-TEST_F(DSWindowShellTest, uniconify_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- bool ret = winShell->uniconify();
- EXPECT_TRUE(ret == true);
-}
-
-TEST_F(DSWindowShellTest, uniconify_P2)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- bool ret = winShell->uniconify(true);
- EXPECT_TRUE(ret == true);
-}
-
-TEST_F(DSWindowShellTest, getIconicState_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- int state = winShell->getIconicState();
- EXPECT_TRUE(state == 0);
-}
-
-TEST_F(DSWindowShellTest, setType_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- bool ret = winShell->setType(1);
- EXPECT_TRUE(ret == true);
-
- int type = winShell->getType();
- EXPECT_TRUE(type == 1);
-}
-
-TEST_F(DSWindowShellTest, maximize_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- bool ret = winShell->maximize();
- EXPECT_TRUE(ret == true);
-
- bool maximized = winShell->isMaximized();
- EXPECT_TRUE(maximized == true);
-}
-
-TEST_F(DSWindowShellTest, fullscreen_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- bool ret = winShell->fullscreen();
- EXPECT_TRUE(ret == true);
-
- bool fullscreen = winShell->isFullscreen();
- EXPECT_TRUE(fullscreen == true);
-}
-
-TEST_F(DSWindowShellTest, setRole_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- const char *role = winShell->getRole();
- EXPECT_TRUE(role == nullptr);
-
- bool ret = winShell->setRole("quickpanel");
- EXPECT_TRUE(ret == true);
-}
-
-TEST_F(DSWindowShellTest, vkbdFloating_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- EXPECT_TRUE(winShell->getVkbdFloating() == false);
-
- EXPECT_TRUE(winShell->setVkbdFloating(true));
- EXPECT_TRUE(winShell->getVkbdFloating());
-
- EXPECT_TRUE(winShell->setVkbdFloating(false));
- EXPECT_TRUE(winShell->getVkbdFloating() == false);
-}
-
-TEST_F(DSWindowShellTest, allowUserGeometry_P1)
-{
- auto window = std::make_shared<DSWindow>();
- std::unique_ptr<DSWindowShell> winShell = std::make_unique<DSWindowShell>(window.get());
- EXPECT_TRUE(winShell != nullptr);
-
- winShell->setAllowUserGeometry(true);
-
- // do something for checking this property
-}
-
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSXkb.h"
-
-using namespace display_server;
-
-class DSXkbTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-TEST_F(DSXkbTest, NewDSXkb)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
- EXPECT_TRUE(xkb != nullptr);
-
- delete xkb;
- delete seat;
-}
-
-TEST_F(DSXkbTest, GetKeyname)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
- EXPECT_TRUE(xkb != nullptr);
-
- std::string keyname = xkb->getKeyname(166);
-
- EXPECT_TRUE(!keyname.empty());
-
- delete xkb;
- delete seat;
-}
-
-TEST_F(DSXkbTest, GetKeycode)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
- EXPECT_TRUE(xkb != nullptr);
-
- int keycode = xkb->getKeycode("XF86Back");
-
- EXPECT_TRUE(keycode > 8);
-
- delete xkb;
- delete seat;
-}
-
-TEST_F(DSXkbTest, GetModifierDepressed)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
- uint32_t depressed = xkb->getModifierDepressed();
- int keycode = xkb->getKeycode("Shift_L");
-
- xkb->updateModifier(keycode, true);
-
- EXPECT_TRUE(depressed != xkb->getModifierDepressed());
- xkb->updateModifier(keycode, false);
-
- delete xkb;
- delete seat;
-}
-
-TEST_F(DSXkbTest, GetModifierLatched)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
-
- (void)xkb->getModifierLatched();
-
- delete xkb;
- delete seat;
-}
-
-TEST_F(DSXkbTest, GetModifierLocked)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
- uint32_t locked = xkb->getModifierLocked();
- int keycode = xkb->getKeycode("Caps_Lock");
-
- xkb->updateModifier(keycode, true);
- xkb->updateModifier(keycode, false);
-
- EXPECT_TRUE(locked != xkb->getModifierLocked());
-
- xkb->updateModifier(keycode, true);
- xkb->updateModifier(keycode, false);
-
- delete xkb;
- delete seat;
-}
-
-TEST_F(DSXkbTest, GetModifierGroup)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
-
- (void)xkb->getModifierGroup();
-
- delete xkb;
- delete seat;
-}
-
-TEST_F(DSXkbTest, GetKeymapFd)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
- int fd = xkb->getKeymapFd();
-
- EXPECT_TRUE(fd >= 0);
-
- delete xkb;
- delete seat;
-}
-
-TEST_F(DSXkbTest, GetKeymapSize)
-{
- DSSeat *seat = new DSSeat;
- DSXkb *xkb = new DSXkb(seat);
- int size = xkb->getKeymapSize();
-
- EXPECT_TRUE(size > 0);
-
- delete xkb;
- delete seat;
-}
-
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-#include "DSZone.h"
-#include "DSWaylandSurface.h"
-#include "DSWindow.h"
-#include "DSPolicyArea.h"
-#include "DSPolicyAreaPrivate.h"
-
-using namespace display_server;
-
-class DSZoneTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {
- char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR");
- setenv("XDG_RUNTIME_DIR", xdir, 1);
- }
- void TearDown(void) override
- {
- unsetenv("XDG_RUNTIME_DIR");
- }
-};
-
-class TestZone : public DSObject
-{
-public:
- TestZone(std::shared_ptr<DSZone> zone)
- : __boolOnWindowCreated(false),
- __boolOnWindowShellCreated(false)
- {
- zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1));
- zone->registerCallbackWindowShellCreated(this, std::bind(&TestZone::onWindowShellCreated, this, std::placeholders::_1));
- __zone = zone;
-
- __countWindow = 0;
-
- for (int i=0; i<5; i++)
- myWindow[i] = nullptr;
- }
-
- ~TestZone()
- {}
-
- void callOnWindowCreated() {
- __zone->callCallbackWindowCreated();
- }
-
- bool getResultOnWindowCreated() {
- return __boolOnWindowCreated;
- }
-
- void onWindowCreated(std::shared_ptr<DSWindow> window) {
- __boolOnWindowCreated = true;
-
- myWindow[__countWindow] = window.get();
- __countWindow++;
- }
-
- void callOnWindowShellCreated(std::shared_ptr<DSWindowShell> winShell) {
- __zone->callCallbackWindowShellCreated(winShell);
- }
-
- bool getResultOnWindowShellCreated() {
- return __boolOnWindowShellCreated;
- }
-
- void onWindowShellCreated(std::shared_ptr<DSWindowShell> windowShell) {
- __boolOnWindowShellCreated = true;
- }
-
- std::list<std::shared_ptr<DSWindow>> getWindowList() {
- return __zone->getWindowList();
- }
-
- int getWindowCount() {
- return __countWindow;
- }
-
-public:
- DSWindow* myWindow[5];
-
-private:
- bool __boolOnWindowCreated;
- bool __boolOnWindowShellCreated;
- std::shared_ptr<DSZone> __zone;
- int __countWindow;
-};
-
-TEST_F(DSZoneTest, NewDSZone)
-{
- auto zone = std::make_unique<DSZone>();
- EXPECT_TRUE(zone != nullptr);
-}
-
-TEST_F(DSZoneTest, SetGetPosition)
-{
- auto zone = std::make_unique<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- stPosition position1;
- position1.x = 10;
- position1.y = 10;
- zone->setPosition(position1);
-
- stPosition position2;
- position2 = zone->getPosition();
- EXPECT_TRUE(position1.x == position2.x) << "didn't match position X";
- EXPECT_TRUE(position1.y == position2.y) << "didn't match position Y";
-}
-
-TEST_F(DSZoneTest, SetGetSize)
-{
- auto zone = std::make_unique<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- stSize size1;
- size1.w = 100;
- size1.h = 100;
- zone->setSize(size1);
-
- stSize size2;
- size2 = zone->getSize();
- EXPECT_TRUE(size1.w == size2.w) << "didn't match size W";
- EXPECT_TRUE(size1.h == size2.h) << "didn't match size H";
-}
-
-TEST_F(DSZoneTest, registerCallbackWindowCreated)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_TRUE(zone != nullptr);
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_TRUE(testZone != nullptr);
-
- testZone->callOnWindowCreated();
- EXPECT_TRUE(testZone->getResultOnWindowCreated());
-}
-
-TEST_F(DSZoneTest, registerCallbackWindowShellCreated)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_TRUE(zone != nullptr);
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_TRUE(testZone != nullptr);
-
- // before calling WindowShell created
- EXPECT_FALSE(testZone->getResultOnWindowShellCreated());
-
- testZone->callOnWindowShellCreated(nullptr);
-
- // after calling WindowShell created
- EXPECT_TRUE(testZone->getResultOnWindowShellCreated());
-}
-
-TEST_F(DSZoneTest, stackChangedRaiseLower)
-{
- int count;
-
- auto zone = std::make_shared<DSZone>();
- ASSERT_TRUE(zone != nullptr);
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_TRUE(testZone != nullptr);
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1));
-
- auto dswlSurface2 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface2));
-
- count = testZone->getWindowCount();
- for (std::shared_ptr<DSWindow> w : zone->getWindowList())
- {
- EXPECT_TRUE(w.get() == testZone->myWindow[count-1]);
- count--;
- }
-
- zone->raiseWindow(dswlSurface1.get());
-
- count = 0;
- for (std::shared_ptr<DSWindow> w : zone->getWindowList())
- {
- EXPECT_TRUE(w.get() == testZone->myWindow[count]);
- count++;
- }
-
- zone->lowerWindow(dswlSurface1.get());
-
- count = testZone->getWindowCount();
- for (std::shared_ptr<DSWindow> w : zone->getWindowList())
- {
- EXPECT_TRUE(w.get() == testZone->myWindow[count-1]);
- count--;
- }
-}
-
-TEST_F(DSZoneTest, stackChangedActivate)
-{
- int count;
-
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1));
-
- auto dswlSurface2 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface2));
-
- count = testZone->getWindowCount();
- for (std::shared_ptr<DSWindow> w : zone->getWindowList())
- {
- EXPECT_TRUE(w.get() == testZone->myWindow[count-1]);
- count--;
- }
-
- zone->activateWindow(dswlSurface1.get());
-
- count = 0;
- for (std::shared_ptr<DSWindow> w : zone->getWindowList())
- {
- EXPECT_TRUE(w.get() == testZone->myWindow[count]);
- count++;
- }
-}
-
-TEST_F(DSZoneTest, SetWindowParent)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1)) << "Failed to create test window1";
-
- auto dswlSurface2 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface2)) << "Failed to create test window2";
-
- EXPECT_TRUE(zone->setWindowParent(dswlSurface1.get(), dswlSurface2.get())) << "Failed to set window parent";
-}
-
-TEST_F(DSZoneTest, SetWindowType)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1)) << "Failed to create test window1";
-
- EXPECT_TRUE(zone->setWindowType(dswlSurface1.get(), 1)) << "Failed to set window type";
-}
-
-TEST_F(DSZoneTest, SetGetWindowGeometry)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1)) << "Failed to create test window1";
-
- // set window geometry
- EXPECT_TRUE(zone->setWindowGeometry(dswlSurface1.get(), 11, 22, 33, 44)) << "Failed to set window type";
-
- // get window geometry
- stGeometry geom;
- geom = zone->getWindowGeometry(dswlSurface1.get());
- EXPECT_NE(geom.x, 11) << "didn't match geometry X";
- EXPECT_NE(geom.y, 22) << "didn't match geometry Y";
- EXPECT_NE(geom.w, 33) << "didn't match geometry W";
- EXPECT_NE(geom.h, 44) << "didn't match geometry H";
-}
-
-TEST_F(DSZoneTest, SetWindowPosition)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1)) << "Failed to create test window1";
-
- // set window position
- EXPECT_TRUE(zone->setWindowPosition(dswlSurface1.get(), 11, 22)) << "Failed to set window type";
-
- // get window geometry
- stGeometry geom;
- geom = zone->getWindowGeometry(dswlSurface1.get());
- EXPECT_NE(geom.x, 11) << "didn't match geometry X";
- EXPECT_NE(geom.y, 22) << "didn't match geometry Y";
-}
-
-TEST_F(DSZoneTest, WindowAuxHint)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1)) << "Failed to create test window1";
-
- // TODO: need to add verity method
-
- // add test aux hint
- zone->addWindowAuxHint(dswlSurface1.get(), 1, "test.aux.hint", "1");
-
- // change aux hint value
- zone->changeWindowAuxHint(dswlSurface1.get(), 1, "0");
-
- // remove aux hint value
- zone->removeWindowAuxHint(dswlSurface1.get(), 1);
-}
-
-TEST_F(DSZoneTest, SetWindowSkipFocus)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1)) << "Failed to create test window1";
-
- // TODO: need to add verity method
- zone->setWindowSkipFocus(dswlSurface1.get(), true);
-}
-
-TEST_F(DSZoneTest, SetGetVkbdFloating)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1)) << "Failed to create test window1";
-
- EXPECT_TRUE(zone->setWindowVkbdFloating(dswlSurface1.get(), true)) << "Failed to set window vkbd floating";
-
- EXPECT_TRUE(zone->getWindowVkbdFloating(dswlSurface1.get())) << "didn't matching vkbd floating value";
-}
-
-TEST_F(DSZoneTest, SetWindowAllowUserGeometry)
-{
- auto zone = std::make_shared<DSZone>();
- ASSERT_NE(zone, nullptr) << "Failed to create DSZone";
-
- auto testZone = std::make_shared<TestZone>(zone);
- ASSERT_NE(testZone, nullptr) << "Failed to create TestZone";
-
- auto dswlSurface1 = std::make_shared<DSWaylandSurface>();
- ASSERT_TRUE(zone->testCreateWindow(dswlSurface1)) << "Failed to create test window1";
-
- // TODO: need to add verity method
- zone->setWindowAllowUserGeometry(dswlSurface1.get(), true);
-}
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Contact: SooChan Lim <sc1.lim@samsung.com>
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __LIBDS_MOCK_H__
-#define __LIBDS_MOCK_H__
-
-#include "DSWaylandCompositor.h"
-#include "DSWaylandSurface.h"
-#include "DSEventLoop.h"
-#include "DSDebugLog.h"
-
-using namespace display_server;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// wayland MockCompositor
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-class MockWaylandCompositor : public DSObject
-{
-public:
- MockWaylandCompositor()
- : surfaceCreated(false),
- surfaceCommitted(false),
- __waylandSurface(nullptr)
- {
- __eventLoop = DSEventLoop::getInstance();
-
- __waylandCompositor = DSWaylandCompositor::getInstance();
-
- if (__waylandCompositor)
- {
- __waylandCompositor->create();
- __waylandCompositor->registerCallbackSurfaceCreated(this, std::bind(&MockWaylandCompositor::onSurfaceCreated, this, std::placeholders::_1));
- }
- }
-
- ~MockWaylandCompositor()
- {
- __waylandSurface.reset();
- DSWaylandCompositor::releaseInstance();
- DSEventLoop::releaseInstance();
- }
-
- void onSurfaceCreated(std::shared_ptr<DSWaylandSurface> waylandSurface)
- {
- surfaceCreated = true;
- __waylandSurface = waylandSurface;
- __waylandSurface->registerCallbackSurfaceCommitted(this, std::bind(&MockWaylandCompositor::onSurfaceCommitted, this, std::placeholders::_1));
- }
-
- void onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo) {
- surfaceCommitted = true;
- }
-
- void run()
- {
- __eventLoop->run();
- }
-
- void quit()
- {
- __eventLoop->quit();
- }
-
- bool surfaceCreated; // result of surfaceCreated
- bool surfaceCommitted; // result of surfaceCommitted
-
-private:
- DSWaylandCompositor *__waylandCompositor;
- std::shared_ptr<DSWaylandSurface> __waylandSurface;
- DSEventLoop *__eventLoop;
-};
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// wayland Test Client
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-struct TestClient
-{
- struct wl_display *display;
- struct wl_compositor *compositor;
- struct wl_registry *registry;
- struct wl_surface *surface;
- struct wl_buffer *buffer;
- struct wayland_tbm_client *tbm_client;
- tbm_surface_h tbmBuffer;
- int dx, dy, dw, dh; // damage x,y,w,h
- int ax, ay; // attach x,y
-};
-
-#endif // UT_H
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Contact: SooChan Lim <sc1.lim@samsung.com>
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#include "libds-tests.h"
-
-int main(int argc, char **argv)
-{
- char *strEnv = nullptr;
- auto AllTestSuccess = false;
-
-#ifdef TIZEN_TEST_GCOV
- setenv("GCOV_PREFIX", "/tmp", 1);
-#endif
- strEnv = getenv("DEFAULT_XDG_RUNTIME_DIR");
- if (!strEnv) {
- setenv("DEFAULT_XDG_RUNTIME_DIR", "/tmp", 1);
- }
-
- try {
- ::testing::InitGoogleMock(&argc, argv);
- ::testing::FLAGS_gtest_death_test_style = "fast";
- } catch ( ... ) {
- std::cout << "error while trying to init google tests.\n";
- exit(EXIT_FAILURE);
- }
-
- try {
- AllTestSuccess = RUN_ALL_TESTS() == 0 ? true : false;
- } catch (const ::testing::internal::GoogleTestFailureException & e) {
- AllTestSuccess = false;
- std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
- std::cout << "\n";
- }
-
-#ifdef TIZEN_TEST_GCOV
- __gcov_flush();
-#endif
- return AllTestSuccess;
-}
+++ /dev/null
-/*
-* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
-*
-* Contact: SooChan Lim <sc1.lim@samsung.com>
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-* DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef __LIBDS_TESTS_H__
-#define __LIBDS_TESTS_H__
-
-#include <iostream>
-#include <memory>
-#include <chrono>
-#include <thread>
-#include <future>
-#include <mutex>
-#include <wayland-client-protocol.h>
-#include <wayland-tbm-client.h>
-#include <Ecore.h>
-#include <gmock/gmock.h>
-
-#include "libds-mock.h"
-
-#ifdef TIZEN_TEST_GCOV
-extern "C" void __gcov_flush(void);
-#endif
-
-using ::testing::TestWithParam;
-using ::testing::Bool;
-using ::testing::Values;
-using ::testing::Combine;
-
-#endif // UT_H
+++ /dev/null
-libds_tests_srcs = [
- 'libds-tests.cpp',
- 'DSRefBase-test.cpp',
- 'DSProperty-test.cpp',
- 'DSBufferTBMImpl-test.cpp',
- 'DSBufferRef-test.cpp',
- 'DSBufferManager-test.cpp',
- 'DSRenderEngineEcoreEvasImpl-test.cpp',
- 'DSRenderEngineDaliImpl-test.cpp',
- 'DSCompositor-test.cpp',
- 'DSOutputImpl-test.cpp',
- 'DSInput-test.cpp',
- 'DSCanvas-test.cpp',
- 'DSSeat-test.cpp',
- 'DSPolicyArea-test.cpp',
- 'DSDisplayArea-test.cpp',
- 'DSDebugLog-test.cpp',
- 'DSDisplayDeviceTDMImpl-test.cpp',
- 'DSSignal-test.cpp',
- 'DSSignalBroker-test.cpp',
- 'DSWindowManager-test.cpp',
- 'DSWindow-test.cpp',
- 'DSWindowShell-test.cpp',
- 'DSWaylandCallback-test.cpp',
- 'DSWaylandExtension-test.cpp',
- 'DSWaylandOutput-test.cpp',
- 'DSWaylandSurface-test.cpp',
- 'DSWaylandTizenInputDeviceManager-test.cpp',
- 'DSWaylandTizenInputDevice-test.cpp',
- 'DSWaylandTizenPolicy-test.cpp',
- 'DSWaylandTizenSurface-test.cpp',
- 'DSWaylandTizenSurfaceShm-test.cpp',
- 'DSWaylandTizenIndicator-test.cpp',
- 'DSWaylandTizenAppinfo-test.cpp',
- 'DSWaylandTizenLaunchEffect-test.cpp',
- 'DSWaylandZxdgShellV6-test.cpp',
- 'DSWaylandBuffer-test.cpp',
- 'DSObject-test.cpp',
- 'DSEventLoop-test.cpp',
- 'DSWaylandCompositor-test.cpp',
- 'DSWaylandSeat-test.cpp',
- 'DSWaylandClient-test.cpp',
- 'DSWaylandPointer-test.cpp',
- 'DSWaylandKeyboard-test.cpp',
- 'DSWaylandTouch-test.cpp',
- 'DSZone-test.cpp',
- 'DSClient-test.cpp',
- 'DSTextInput-test.cpp',
- 'DSWaylandInputMethod-test.cpp',
- 'DSWaylandInputMethodContext-test.cpp',
- 'DSWaylandTextInput-test.cpp',
- 'DSWaylandTextInputManager-test.cpp',
- 'DSWaylandInputPanel-test.cpp',
- 'DSWaylandInputPanelSurface-test.cpp',
- 'DSXkb-test.cpp',
- 'DSPointer-test.cpp',
- 'DSKeyboard-test.cpp',
- 'DSTouch-test.cpp',
- 'DSTizenAppinfo-test.cpp',
- 'DSWaylandProtocolTrace-test.cpp',
- 'DSTraceInfo-test.cpp',
- 'DSWaylandTizenPolicyExt-test.cpp',
- ]
-
-gmock_dep = dependency('gmock', method : 'pkg-config')
-ecore_dep = dependency('ecore', method : 'pkg-config')
-wl_client_dep = dependency('wayland-client', method : 'pkg-config')
-wl_tbm_dep = dependency('wayland-tbm-client', method : 'pkg-config')
-tizen_launch_client_dep = dependency('tizen-launch-client')
-
-executable(
- 'libds-tests',
- libds_tests_srcs,
- dependencies : [libds_declared_dep, gmock_dep, ecore_dep, ecore_evas_dep, wl_client_dep, wl_tbm_dep, tizen_launch_client_dep],
- install_dir : libds_prefix_bindir,
- install : true
- )
-