Add pepper-dali 80/54180/10 accepted/tizen/common/20160321.150713 accepted/tizen/common/20160404.123652 accepted/tizen/common/20160406.144348 accepted/tizen/ivi/20160406.073020 accepted/tizen/mobile/20160406.072912 accepted/tizen/tv/20160406.072954 accepted/tizen/wearable/20160406.073000 submit/tizen/20160321.053920 submit/tizen/20160404.093500 submit/tizen/20160406.023958
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 14 Dec 2015 02:17:22 +0000 (11:17 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 16 Mar 2016 01:15:44 +0000 (10:15 +0900)
Change-Id: Ifaec85111577a1244746806267de4ae7c04c081b

46 files changed:
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
INSTALL [new file with mode: 0644]
LICENSE [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
TODO [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
packaging/pepper-dali.spec [new file with mode: 0644]
pepper-dali.manifest [new file with mode: 0644]
pepper-dali.pc.in [new file with mode: 0644]
pepper-dali/Makefile.am [new file with mode: 0644]
pepper-dali/internal/compositor-impl.cpp [new file with mode: 0644]
pepper-dali/internal/compositor-impl.h [new file with mode: 0644]
pepper-dali/internal/file.list [new file with mode: 0644]
pepper-dali/internal/input-impl.cpp [new file with mode: 0644]
pepper-dali/internal/input-impl.h [new file with mode: 0644]
pepper-dali/internal/input.cpp [new file with mode: 0644]
pepper-dali/internal/input.h [new file with mode: 0644]
pepper-dali/internal/object-impl.cpp [new file with mode: 0644]
pepper-dali/internal/object-impl.h [new file with mode: 0644]
pepper-dali/internal/object-view-impl.cpp [new file with mode: 0644]
pepper-dali/internal/object-view-impl.h [new file with mode: 0644]
pepper-dali/internal/object.cpp [new file with mode: 0644]
pepper-dali/internal/object.h [new file with mode: 0644]
pepper-dali/internal/output-impl.cpp [new file with mode: 0644]
pepper-dali/internal/output-impl.h [new file with mode: 0644]
pepper-dali/internal/output.cpp [new file with mode: 0644]
pepper-dali/internal/output.h [new file with mode: 0644]
pepper-dali/internal/shell-client-impl.cpp [new file with mode: 0644]
pepper-dali/internal/shell-client-impl.h [new file with mode: 0644]
pepper-dali/internal/shell-client.cpp [new file with mode: 0644]
pepper-dali/internal/shell-client.h [new file with mode: 0644]
pepper-dali/internal/shell-impl.cpp [new file with mode: 0644]
pepper-dali/internal/shell-impl.h [new file with mode: 0644]
pepper-dali/internal/shell.cpp [new file with mode: 0644]
pepper-dali/internal/shell.h [new file with mode: 0644]
pepper-dali/public-api/compositor/compositor.cpp [new file with mode: 0644]
pepper-dali/public-api/compositor/compositor.h [new file with mode: 0644]
pepper-dali/public-api/file.list [new file with mode: 0644]
pepper-dali/public-api/object-view/object-view.cpp [new file with mode: 0644]
pepper-dali/public-api/object-view/object-view.h [new file with mode: 0644]
pepper-dali/public-api/pepper-dali.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..b1d0089
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,20 @@
+Copyright (C) 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..2099840
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,370 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
+Inc.
+
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+   Briefly, the shell command `./configure && make && make install'
+should configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+   The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package, generally using the just-built uninstalled binaries.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved.  Use GNU `make'
+instead.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS
+     KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf limitation.  Until the limitation is lifted, you can use
+this workaround:
+
+     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..dc0510e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,70 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work
+To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..1ff1a03
--- /dev/null
@@ -0,0 +1,5 @@
+SUBDIRS = pepper-dali
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = pepper-dali.pc
+
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..de9499c
--- /dev/null
+++ b/README
@@ -0,0 +1,52 @@
+T.O.C.
+======
+
+ 1.   GBS Builds
+ 1.1. NON-SMACK Targets
+ 1.2. SMACK enabled Targets
+ 2.   Building for Ubuntu desktop
+ 2.1. Minimum Requirements
+ 2.2. Building the Repository
+
+
+
+1. GBS Builds
+=============
+
+1.1. NON-SMACK Targets
+----------------------
+
+ gbs build -A [TARGET_ARCH]
+
+1.2. SMACK enabled Targets
+--------------------------
+
+ gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
+
+1.3. MOBILE Profile
+-------------------
+
+ gbs build -A [TARGET_ARCH] --spec dali-toolkit-mobile.spec
+
+2. Building for Ubuntu desktop
+==============================
+
+2.1. Minimum Requirements
+------------------------
+
+ - Ubuntu 14.04
+ - Environment created using dali_env script in dali-core repository
+
+2.2. Building the Repository
+----------------------------
+
+To build the repository enter the 'build/tizen' folder:
+
+ cd dali-toolkit/build/tizen
+
+Then run the following commands:
+
+ autoreconf --install
+ ./configure --prefix=$DESKTOP_PREFIX
+ make install -j8
+
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..d247709
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+rm -rf autom4te.cache
+rm -f aclocal.m4 ltmain.sh
+
+echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1
+echo "Running autoheader..." ; autoheader || exit 1
+echo "Running autoconf..." ; autoconf || exit 1
+echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
+echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
+
+if [ -z "$NOCONFIGURE" ]; then
+         ./configure "$@"
+fi
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..e838e95
--- /dev/null
@@ -0,0 +1,27 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.64])
+AC_INIT([pepper-dali], [0.0.1])
+AC_CONFIG_SRCDIR([configure.ac])
+AC_CONFIG_HEADERS([config.h])
+
+AM_INIT_AUTOMAKE(1.6)
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_LIBTOOL
+
+# Checks for libraries.
+PKG_CHECK_MODULES([PEPPER], [pepper xkbcommon])
+PKG_CHECK_MODULES([WAYLAND], [wayland-server xdg-shell-server tizen-extension-client])
+PKG_CHECK_MODULES([DALI], [dali-core dali-adaptor dali-toolkit])
+PKG_CHECK_MODULES([EFL], [ecore ecore-input ecore-wayland])
+
+AC_CONFIG_FILES([
+Makefile
+pepper-dali/Makefile
+])
+AC_OUTPUT([
+pepper-dali.pc
+])
diff --git a/packaging/pepper-dali.spec b/packaging/pepper-dali.spec
new file mode 100644 (file)
index 0000000..9e47b85
--- /dev/null
@@ -0,0 +1,73 @@
+Name:       pepper-dali
+Version:    0.0.1
+Release:    0
+Summary:    DALi backend for pepper
+License:    MIT
+Group:      Graphics & UI Framework/Wayland Window System
+
+Source:     %{name}-%{version}.tar.xz
+
+BuildRequires: pkgconfig(dali-core)
+BuildRequires: pkgconfig(dali-adaptor)
+BuildRequires: pkgconfig(dali-toolkit)
+BuildRequires: pkgconfig(wayland-server)
+BuildRequires: pkgconfig(pepper)
+BuildRequires: pkgconfig(xdg-shell-server)
+BuildRequires: pkgconfig(xkbcommon)
+BuildRequires: pkgconfig(tizen-extension-client)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(ecore-input)
+BuildRequires: pkgconfig(ecore-wayland)
+BuildRequires: pkgconfig(wayland-tbm-server)
+BuildRequires: pkgconfig(wayland-tbm-client)
+Requires: libwayland-extension-server
+
+%description
+DALi backend for pepper.
+Pepper is a lightweight and flexible library for developing various types of wayland compositors.
+
+##############################
+# devel
+##############################
+%package devel
+Summary:    Development components for pepper-dali
+Group:      Development/Building
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+This package includes developer files common to all packages.
+
+##############################
+# Preparation
+##############################
+%prep
+%setup -q
+                      
+##############################
+# Build
+##############################
+%build
+%autogen
+make %{?_smp_mflags}
+
+##############################
+# Installation
+##############################
+%install
+%make_install
+
+##############################
+# Files in Binary Packages
+##############################
+%files -n %{name}
+%manifest pepper-dali.manifest     
+%defattr(-,root,root,-)
+%{_libdir}/lib%{name}.so*
+
+%files devel
+%defattr(-,root,root,-)
+%dir %{_includedir}/%{name}/
+%{_includedir}/%{name}/pepper-dali.h 
+%{_includedir}/%{name}/public-api/*
+%{_libdir}/pkgconfig/%{name}.pc
+
diff --git a/pepper-dali.manifest b/pepper-dali.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/pepper-dali.pc.in b/pepper-dali.pc.in
new file mode 100644 (file)
index 0000000..ce92385
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_DIR@
+libdir=@LIB_DIR@
+includedir=@INC_DIR@
+
+Name: Pepper DALi
+Description: The Pepper DALi Libaray
+Version: @VERSION@
+Requires: dali-toolkit
+Libs: -L${libdir} -lpepper-dali
+Cflags: -I${includedir}/pepper-dali
diff --git a/pepper-dali/Makefile.am b/pepper-dali/Makefile.am
new file mode 100644 (file)
index 0000000..0f07dff
--- /dev/null
@@ -0,0 +1,35 @@
+internal_src_dir = internal
+include internal/file.list
+
+public_api_src_dir = public-api
+include public-api/file.list
+
+src_files = $(internal_src_files) \
+            $(public_api_src_files)
+
+pepper_dali_includes = \
+        -I.
+
+libpepper_dali_la_LTLIBRARIES = libpepper-dali.la
+libpepper_dali_ladir = $(libdir)
+libpepper_dali_la_LIBADD = @DALI_LIBS@ @WAYLAND_LIBS@ @PEPPER_LIBS@
+libpepper_dali_la_LDFLAGS = ${LDFLAGS}
+libpepper_dali_la_CXXFLAGS = \
+    ${CFLAGS} \
+    $(DALICORE_CFLAGS) \
+    @EFL_CFLAGS@ \
+    @WAYLAND_CFLAGS@ \
+    @PEPPER_CFLAGS@ \
+    $(pepper_dali_includes)
+
+libpepper_dali_la_SOURCES = $(src_files)
+
+libpepperdalidir = $(includedir)/pepper-dali
+libpepperdali_HEADERS = $(public_api_header_files)
+
+libpepperdalicompositordir = $(includedir)/pepper-dali/public-api/compositor
+libpepperdalicompositor_HEADERS = $(public_api_compositor_header_files)
+
+libpepperdaliobjectviewdir = $(includedir)/pepper-dali/public-api/object-view
+libpepperdaliobjectview_HEADERS = $(public_api_object_view_header_files)
+
diff --git a/pepper-dali/internal/compositor-impl.cpp b/pepper-dali/internal/compositor-impl.cpp
new file mode 100644 (file)
index 0000000..dc09c8c
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/compositor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <wayland-server.h>
+#include <tizen-extension-client-protocol.h>
+#include <Ecore_Wayland.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gPepperCompositorLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_PEPPER_COMPOSITOR" );
+#endif
+
+static void EmbeddedCompositorGetSocket( void* data, struct tizen_embedded_compositor* embeddedCompositor, int fd )
+{
+  int* socketFd = (int*)data;
+
+  *socketFd = fd;
+  return;
+}
+
+static const struct tizen_embedded_compositor_listener tizenEmbeddedCompositorListener =
+{
+  EmbeddedCompositorGetSocket
+};
+
+} // unnamed namespace
+
+CompositorPtr Compositor::New( Application application, const std::string& name )
+{
+  CompositorPtr impl = new Compositor();
+
+  // Second-phase init of the implementation
+  impl->Initialize( application, name );
+
+  return impl;
+}
+
+Compositor::Compositor()
+: mCompositor( NULL ),
+  mDisplay( NULL ),
+  mEventLoop( NULL ),
+  mFdHandler( NULL ),
+  mTbmServer( NULL ),
+  mShell( NULL ),
+  mInput( NULL ),
+  mOutput( NULL ),
+  mSocketName()
+{
+}
+
+Compositor::~Compositor()
+{
+  if( mTbmServer )
+  {
+    wayland_tbm_server_deinit( mTbmServer );
+  }
+
+  if( mCompositor )
+  {
+    pepper_compositor_destroy( mCompositor );
+  }
+
+  if( mFdHandler )
+  {
+    ecore_main_fd_handler_del( mFdHandler );
+  }
+}
+
+void* Compositor::GetCompositorHandle()
+{
+  return static_cast< void* >( mCompositor );
+}
+
+void Compositor::Initialize( Application application, const std::string& name )
+{
+  // Get socket fd from server
+  int socketFd = GetSocketFdFromServer();
+  if( socketFd == -1 )
+  {
+    DALI_LOG_INFO( gPepperCompositorLogging, Debug::General, "Compositor::Initialize: socket fd is invalid.\n" );
+    return;
+  }
+
+  // create compositor
+  mCompositor = pepper_compositor_create_fd( name.c_str(), socketFd );
+  if( !mCompositor )
+  {
+    DALI_LOG_INFO( gPepperCompositorLogging, Debug::General, "Compositor::Initialize: pepper_compositor_create_fd is failed. [%d]\n", socketFd );
+    return;
+  }
+
+  mDisplay = pepper_compositor_get_display( mCompositor );
+
+#if 0
+  mTbmServer = wayland_tbm_server_init( mDisplay, NULL, -1, 0 );
+  if( !mTbmServer )
+  {
+    DALI_LOG_INFO( gPepperCompositorLogging, Debug::General, "Compositor::Initialize: wayland_tbm_server_init is failed.\n" );
+    pepper_compositor_destroy( mCompositor );
+    mCompositor = NULL;
+    return;
+  }
+#endif
+
+  // create shell
+  mShell = Pepper::Shell::New( Pepper::Compositor( this ) );
+  if( !mShell )
+  {
+    DALI_LOG_INFO( gPepperCompositorLogging, Debug::General, "Compositor::Initialize: Fail to create shell.\n" );
+    wayland_tbm_server_deinit( mTbmServer );
+    mTbmServer = NULL;
+    pepper_compositor_destroy( mCompositor );
+    mCompositor = NULL;
+    return;
+  }
+
+  // create input
+  mInput = Pepper::Input::New( Pepper::Compositor( this ) );
+  if( !mInput )
+  {
+    DALI_LOG_INFO( gPepperCompositorLogging, Debug::General, "Compositor::Initialize: Fail to create input.\n" );
+    wayland_tbm_server_deinit( mTbmServer );
+    mTbmServer = NULL;
+    pepper_compositor_destroy( mCompositor );
+    mCompositor = NULL;
+    return;
+  }
+
+  mSocketName = pepper_compositor_get_socket_name( mCompositor );
+
+  mEventLoop = wl_display_get_event_loop( mDisplay );
+
+  int loopFd = wl_event_loop_get_fd( mEventLoop );
+
+  mFdHandler = ecore_main_fd_handler_add( loopFd, (Ecore_Fd_Handler_Flags)(ECORE_FD_READ | ECORE_FD_ERROR), Compositor::FdReadCallback, this, NULL, NULL );
+
+  ecore_main_fd_handler_prepare_callback_set( mFdHandler, Compositor::FdPrepareCallback, this );
+
+  // create output
+  mOutput = Pepper::Output::New( Pepper::Compositor( this ), application, mInput );
+  if( !mOutput )
+  {
+    DALI_LOG_INFO( gPepperCompositorLogging, Debug::General, "Compositor::Initialize: Fail to create output.\n" );
+
+    ecore_main_fd_handler_del( mFdHandler );
+    mFdHandler = NULL;
+    wayland_tbm_server_deinit( mTbmServer );
+    mTbmServer = NULL;
+    pepper_compositor_destroy( mCompositor );
+    mCompositor = NULL;
+    return;
+  }
+
+  mOutput.ObjectViewAddedSignal().Connect( this, &Compositor::OnObjectViewAdded );
+  mOutput.ObjectViewDeletedSignal().Connect( this, &Compositor::OnObjectViewDeleted );
+
+  DALI_LOG_INFO( gPepperCompositorLogging, Debug::Verbose, "Compositor::Initialize: success. socket name = %s\n", mSocketName.c_str() );
+
+  // TODO: temp
+  setenv("WAYLAND_DISPLAY", mSocketName.c_str(), 1);
+}
+
+int Compositor::GetSocketFdFromServer()
+{
+  Eina_Inlist* list;
+  Eina_Inlist* tmp;
+  Ecore_Wl_Global* global;
+  struct tizen_embedded_compositor* embeddedCompositor = NULL;
+  int fd = -1;
+
+  list = ecore_wl_globals_get();
+  if( !list )
+  {
+    DALI_LOG_INFO( gPepperCompositorLogging, Debug::General, "Compositor::GetSocketFdFromServer: ecore_wl_globals_get returns NULL.\n" );
+    return -1;
+  }
+
+  EINA_INLIST_FOREACH_SAFE( list, tmp, global )
+  {
+    if( !strcmp( global->interface, "tizen_embedded_compositor" ) )
+    {
+      embeddedCompositor = static_cast< struct tizen_embedded_compositor* >( wl_registry_bind( ecore_wl_registry_get(), global->id, &tizen_embedded_compositor_interface, 1 ) );
+
+      tizen_embedded_compositor_add_listener( embeddedCompositor, &tizenEmbeddedCompositorListener, &fd );
+      break;
+    }
+  }
+
+  if( !embeddedCompositor )
+  {
+    DALI_LOG_INFO( gPepperCompositorLogging, Debug::General, "Compositor::GetSocketFdFromServer: tizen_embedded_compositor is not supported.\n" );
+    return -1;
+  }
+
+  tizen_embedded_compositor_get_socket( embeddedCompositor );
+  ecore_wl_sync();
+
+  tizen_embedded_compositor_destroy( embeddedCompositor );
+
+  return fd;
+}
+
+Pepper::Compositor::CompositorSignalType& Compositor::ObjectViewAddedSignal()
+{
+  return mObjectViewAddedSignal;
+}
+
+Pepper::Compositor::CompositorSignalType& Compositor::ObjectViewDeletedSignal()
+{
+  return mObjectViewDeletedSignal;
+}
+
+void Compositor::OnObjectViewAdded( Pepper::Output output, Pepper::ObjectView objectView )
+{
+  Pepper::Compositor handle( this );
+  mObjectViewAddedSignal.Emit( handle, objectView );
+
+  DALI_LOG_INFO( gPepperCompositorLogging, Debug::Verbose, "Compositor::ObjectViewAddedSignal: ObjectView is added!\n" );
+}
+
+void Compositor::OnObjectViewDeleted( Pepper::Output output, Pepper::ObjectView objectView )
+{
+  Pepper::Compositor handle( this );
+  mObjectViewDeletedSignal.Emit( handle, objectView );
+
+  DALI_LOG_INFO( gPepperCompositorLogging, Debug::Verbose, "Compositor::ObjectViewDeletedSignal: ObjectView is deleted!\n" );
+}
+
+Eina_Bool Compositor::FdReadCallback( void* data, Ecore_Fd_Handler* handler )
+{
+  Compositor* compositor = static_cast< Compositor* >( data );
+
+  wl_event_loop_dispatch( compositor->mEventLoop, 0 );
+
+  return ECORE_CALLBACK_RENEW;
+}
+
+void Compositor::FdPrepareCallback( void* data, Ecore_Fd_Handler* handler )
+{
+  Compositor* compositor = static_cast< Compositor* >( data );
+
+  wl_display_flush_clients( compositor->mDisplay );
+}
+
+} // namespace Internal
+
+} // namespace Pepper
+
+} // namespace Dali
diff --git a/pepper-dali/internal/compositor-impl.h b/pepper-dali/internal/compositor-impl.h
new file mode 100644 (file)
index 0000000..6a56870
--- /dev/null
@@ -0,0 +1,140 @@
+#ifndef __DALI_PEPPER_INTERNAL_COMPOSITOR_H__
+#define __DALI_PEPPER_INTERNAL_COMPOSITOR_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/public-api/compositor/compositor.h>
+#include <pepper-dali/internal/shell.h>
+#include <pepper-dali/internal/input.h>
+#include <pepper-dali/internal/output.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/connection-tracker.h>
+#include <pepper.h>
+#include <wayland-tbm-server.h>
+#include <Ecore.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+class Compositor;
+typedef IntrusivePtr<Compositor> CompositorPtr;
+
+class Compositor : public BaseObject, public ConnectionTracker
+{
+public:
+
+  /**
+   * @copydoc Dali::Pepper::Compositor::New()
+   */
+  static CompositorPtr New( Application application, const std::string& name );
+
+  void* GetCompositorHandle();
+
+public: //Signals
+
+  Pepper::Compositor::CompositorSignalType& ObjectViewAddedSignal();
+  Pepper::Compositor::CompositorSignalType& ObjectViewDeletedSignal();
+
+private:
+
+  /**
+   * Construct a new Compositor.
+   */
+  Compositor();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~Compositor();
+
+  /**
+   * Second-phase constructor. Must be called immediately after creating a new Compositor;
+   */
+  void Initialize( Application application, const std::string& name );
+
+  int GetSocketFdFromServer();
+
+  void OnObjectViewAdded( Pepper::Output output, Pepper::ObjectView obejctView );
+  void OnObjectViewDeleted( Pepper::Output output, Pepper::ObjectView objectView );
+
+  static Eina_Bool FdReadCallback( void* data, Ecore_Fd_Handler* handler );
+  static void FdPrepareCallback( void* data, Ecore_Fd_Handler* handler );
+
+private:
+
+  // Undefined
+  Compositor( const Compositor& );
+
+  // Undefined
+  Compositor& operator=( const Compositor& rhs );
+
+private: // Data
+
+  pepper_compositor_t* mCompositor;
+  wl_display* mDisplay;
+  wl_event_loop* mEventLoop;
+  Ecore_Fd_Handler* mFdHandler;
+  wayland_tbm_server* mTbmServer;
+
+  Pepper::Shell mShell;
+  Pepper::Input mInput;
+  Pepper::Output mOutput;
+
+  std::string mSocketName;
+
+  // Signals
+  Pepper::Compositor::CompositorSignalType mObjectViewAddedSignal;
+  Pepper::Compositor::CompositorSignalType mObjectViewDeletedSignal;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Pepper::Internal::Compositor& GetImplementation( Pepper::Compositor& compositor )
+{
+  DALI_ASSERT_ALWAYS( compositor && "Compositor handle is empty" );
+
+  BaseObject& handle = compositor.GetBaseObject();
+
+  return static_cast< Internal::Compositor& >( handle );
+}
+
+inline const Pepper::Internal::Compositor& GetImplementation( const Pepper::Compositor& compositor )
+{
+  DALI_ASSERT_ALWAYS( compositor && "Compositor handle is empty" );
+
+  const BaseObject& handle = compositor.GetBaseObject();
+
+  return static_cast< const Internal::Compositor& >( handle );
+}
+
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_INTERNAL_COMPOSITOR_H__
diff --git a/pepper-dali/internal/file.list b/pepper-dali/internal/file.list
new file mode 100644 (file)
index 0000000..9ad8756
--- /dev/null
@@ -0,0 +1,16 @@
+# Add internal source files here
+
+internal_src_files = \
+  $(internal_src_dir)/compositor-impl.cpp \
+  $(internal_src_dir)/input.cpp \
+  $(internal_src_dir)/input-impl.cpp \
+  $(internal_src_dir)/object.cpp \
+  $(internal_src_dir)/object-impl.cpp \
+  $(internal_src_dir)/object-view-impl.cpp \
+  $(internal_src_dir)/output.cpp \
+  $(internal_src_dir)/output-impl.cpp \
+  $(internal_src_dir)/shell.cpp \
+  $(internal_src_dir)/shell-impl.cpp \
+  $(internal_src_dir)/shell-client.cpp \
+  $(internal_src_dir)/shell-client-impl.cpp
+
diff --git a/pepper-dali/internal/input-impl.cpp b/pepper-dali/internal/input-impl.cpp
new file mode 100644 (file)
index 0000000..507163e
--- /dev/null
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/input-impl.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/compositor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <pepper-input-backend.h>
+#include <Ecore_Input.h>
+#include <xkbcommon/xkbcommon.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gPepperInputLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_PEPPER_INPUT" );
+#endif
+
+} // unnamed namespace
+
+InputPtr Input::New( Pepper::Compositor compositor )
+{
+  InputPtr impl = new Input();
+
+  // Second-phase init of the implementation
+  impl->Initialize( compositor );
+
+  return impl;
+}
+
+Input::Input()
+: mSeat( NULL ),
+  mDevice( NULL ),
+  mPointer( NULL ),
+  mKeyboard( NULL ),
+  mTouch( NULL ),
+  mContext( NULL ),
+  mEcoreEventHandler()
+{
+}
+
+Input::~Input()
+{
+  for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
+  {
+    ecore_event_handler_del( *iter );
+  }
+
+  xkb_context_unref( mContext );
+
+  pepper_seat_remove_input_device( mSeat, mDevice );
+  pepper_input_device_destroy( mDevice );
+
+  pepper_seat_destroy( mSeat );
+}
+
+void Input::Initialize( Pepper::Compositor& compositor )
+{
+  const char *defaultName = "seat0";
+
+  mSeat = pepper_compositor_add_seat( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( compositor ).GetCompositorHandle() ), defaultName );
+  if( !mSeat )
+  {
+    DALI_LOG_INFO( gPepperInputLogging, Debug::General, "pepper_compositor_add_seat is failed\n" );
+    return;
+  }
+
+  /* create and add devices. */
+  mDevice = pepper_input_device_create( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( compositor ).GetCompositorHandle() ),
+                                        WL_SEAT_CAPABILITY_TOUCH, NULL, NULL );
+//  mDevice = pepper_input_device_create( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( compositor ).GetCompositorHandle() ),
+//                                        ( WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD | WL_SEAT_CAPABILITY_TOUCH ), NULL, NULL );
+  if( !mDevice )
+  {
+    DALI_LOG_INFO( gPepperInputLogging, Debug::General, "pepper_input_device_create is failed\n" );
+    pepper_seat_destroy( mSeat );
+    return;
+  }
+
+  pepper_seat_add_input_device( mSeat, mDevice );
+
+  /* get device resource from seat */
+  mPointer = pepper_seat_get_pointer( mSeat );
+  mKeyboard = pepper_seat_get_keyboard( mSeat );
+  mTouch = pepper_seat_get_touch( mSeat );
+
+  mCompositor = compositor;
+
+  SetKeymap();
+
+  mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
+  mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
+
+  DALI_LOG_INFO( gPepperInputLogging, Debug::Verbose, "Input::Initialize: success\n" );
+}
+
+void Input::SetKeymap()
+{
+  struct xkb_keymap* keymap;
+  struct xkb_context* context;
+  struct xkb_rule_names names;
+
+  names.rules = "evdev";
+  names.model = "pc105";
+  names.layout = "us";
+  names.options = NULL;
+
+  context = xkb_context_new( XKB_CONTEXT_NO_FLAGS );
+  if( !context )
+  {
+    DALI_LOG_INFO( gPepperInputLogging, Debug::General, "failed to create xkb_context\n" );
+    return;
+  }
+
+  keymap = xkb_map_new_from_names( context, &names, XKB_KEYMAP_COMPILE_NO_FLAGS );
+  if( !keymap )
+  {
+    DALI_LOG_INFO( gPepperInputLogging, Debug::General, "failed to get keymap\n" );
+    xkb_context_unref( context );
+    return;
+  }
+
+  pepper_keyboard_set_keymap( mKeyboard, keymap );
+  xkb_map_unref( keymap );
+
+  mContext = context;
+}
+
+Eina_Bool Input::EcoreEventKeyDown( void* data, int type, void* event )
+{
+  Input* input = static_cast< Input* >( data );
+  pepper_view_t* view;
+  Ecore_Event_Key *keyEvent = static_cast< Ecore_Event_Key* >( event );
+  uint32_t keycode;
+
+  if( !( view = pepper_keyboard_get_focus( input->mKeyboard ) ) )
+  {
+    return ECORE_CALLBACK_RENEW;
+  }
+
+  keycode = (keyEvent->keycode - 8);
+
+  pepper_keyboard_send_key( input->mKeyboard, view, keyEvent->timestamp, keycode, WL_KEYBOARD_KEY_STATE_PRESSED );
+
+  return ECORE_CALLBACK_RENEW;
+}
+
+Eina_Bool Input::EcoreEventKeyUp( void* data, int type, void* event )
+{
+  Input* input = static_cast< Input* >( data );
+  pepper_view_t* view;
+  Ecore_Event_Key *keyEvent = static_cast< Ecore_Event_Key* >( event );
+  uint32_t keycode;
+
+  if( !( view = pepper_keyboard_get_focus( input->mKeyboard ) ) )
+  {
+    return ECORE_CALLBACK_RENEW;
+  }
+
+  keycode = (keyEvent->keycode - 8);
+
+  pepper_keyboard_send_key( input->mKeyboard, view, keyEvent->timestamp, keycode, WL_KEYBOARD_KEY_STATE_RELEASED );
+
+  return ECORE_CALLBACK_RENEW;
+}
+
+pepper_pointer_t* Input::GetPointer()
+{
+  return mPointer;
+}
+
+pepper_keyboard_t* Input::GetKeyboard()
+{
+  return mKeyboard;
+}
+
+pepper_touch_t* Input::GetTouch()
+{
+  return mTouch;
+}
+
+} // namespace Internal
+
+} // namespace Pepper
+
+} // namespace Dali
diff --git a/pepper-dali/internal/input-impl.h b/pepper-dali/internal/input-impl.h
new file mode 100644 (file)
index 0000000..ae6ab8d
--- /dev/null
@@ -0,0 +1,124 @@
+#ifndef __DALI_PEPPER_INTERNAL_INPUT_H__
+#define __DALI_PEPPER_INTERNAL_INPUT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/input.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/object/base-object.h>
+#include <Ecore.h>
+
+struct xkb_context;
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+class Input;
+typedef IntrusivePtr<Input> InputPtr;
+
+class Input : public BaseObject
+{
+public:
+
+  static InputPtr New( Pepper::Compositor compositor );
+
+  static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event );
+  static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event );
+
+  pepper_pointer_t* GetPointer();
+  pepper_keyboard_t* GetKeyboard();
+  pepper_touch_t* GetTouch();
+
+private:
+
+  /**
+   * Construct a new Input.
+   */
+  Input();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~Input();
+
+  /**
+   * Second-phase constructor. Must be called immediately after creating a new Input;
+   */
+  void Initialize( Pepper::Compositor& compositor );
+
+  void SetKeymap();
+
+private:
+
+  // Undefined
+  Input( const Input& );
+
+  // Undefined
+  Input& operator=( const Input& rhs );
+
+private: // Data
+
+  Pepper::Compositor mCompositor;
+
+  pepper_seat_t* mSeat;
+  pepper_input_device_t* mDevice;
+  pepper_pointer_t* mPointer;
+  pepper_keyboard_t* mKeyboard;
+  pepper_touch_t* mTouch;
+
+  xkb_context* mContext;
+
+  std::vector<Ecore_Event_Handler*> mEcoreEventHandler;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Pepper::Internal::Input& GetImplementation( Pepper::Input& input )
+{
+  DALI_ASSERT_ALWAYS( input && "Input handle is empty" );
+
+  BaseObject& handle = input.GetBaseObject();
+
+  return static_cast< Internal::Input& >( handle );
+}
+
+inline const Pepper::Internal::Input& GetImplementation( const Pepper::Input& input )
+{
+  DALI_ASSERT_ALWAYS( input && "Input handle is empty" );
+
+  const BaseObject& handle = input.GetBaseObject();
+
+  return static_cast< const Internal::Input& >( handle );
+}
+
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_INTERNAL_INPUT_H__
diff --git a/pepper-dali/internal/input.cpp b/pepper-dali/internal/input.cpp
new file mode 100644 (file)
index 0000000..8d8a0aa
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/input.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/input-impl.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+Input Input::New( Pepper::Compositor compositor )
+{
+  Internal::InputPtr internal = Internal::Input::New( compositor );
+
+  return Input( internal.Get() );
+}
+
+Input Input::DownCast( BaseHandle handle )
+{
+  return Input( dynamic_cast< Internal::Input* >( handle.GetObjectPtr() ) );
+}
+
+Input::Input()
+{
+}
+
+Input::Input( const Input& handle )
+: BaseHandle(handle)
+{
+}
+
+Input& Input::operator=( const Input& handle )
+{
+  BaseHandle::operator=(handle);
+  return *this;
+}
+
+Input::~Input()
+{
+}
+
+Input::Input( Internal::Input* implementation )
+: BaseHandle( implementation )
+{
+}
+
+pepper_pointer_t* Input::GetPointer()
+{
+  return GetImplementation(*this).GetPointer();
+}
+
+pepper_keyboard_t* Input::GetKeyboard()
+{
+  return GetImplementation(*this).GetKeyboard();
+}
+
+pepper_touch_t* Input::GetTouch()
+{
+  return GetImplementation(*this).GetTouch();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/pepper-dali/internal/input.h b/pepper-dali/internal/input.h
new file mode 100644 (file)
index 0000000..32e384a
--- /dev/null
@@ -0,0 +1,122 @@
+#ifndef __DALI_PEPPER_INPUT_H__
+#define __DALI_PEPPER_INPUT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/public-api/compositor/compositor.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-handle.h>
+#include <pepper.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Input;
+}
+
+/**
+ * @addtogroup dali_pepper_compositor
+ * @{
+ */
+
+class Input : public BaseHandle
+{
+public:
+
+  /**
+   * @brief Create Input.
+   *
+   * @since_tizen 3.0
+   * @return A handle to Input.
+   */
+  static Input New( Pepper::Compositor compositor );
+
+  /**
+   * @brief Downcast a handle to Input handle.
+   *
+   * If the BaseHandle points is a Input the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a Input or an empty handle
+   */
+  static Input DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an empty handle.
+   * @since_tizen 3.0
+   */
+  Input();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  Input( const Input& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  Input& operator=( const Input& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~Input();
+
+  pepper_pointer_t* GetPointer();
+  pepper_keyboard_t* GetKeyboard();
+  pepper_touch_t* GetTouch();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the Pepper::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The Input implementation.
+   */
+  explicit DALI_INTERNAL Input( Internal::Input* implementation );
+};
+
+/**
+ * @}
+ */
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_INPUT_H__
diff --git a/pepper-dali/internal/object-impl.cpp b/pepper-dali/internal/object-impl.cpp
new file mode 100644 (file)
index 0000000..157d4dc
--- /dev/null
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/object-impl.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/shell-client-impl.h>
+#include <pepper-dali/internal/object-view-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/images/buffer-image.h>
+#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/adaptor-framework/native-image-source.h>
+#include <wayland-tbm-server.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gPepperObjectLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_PEPPER_OBJECT" );
+#endif
+
+} // unnamed namespace
+
+ObjectPtr Object::New( pepper_surface_t* surface, Pepper::Input input )
+{
+  ObjectPtr impl = new Object();
+
+  // Second-phase init of the implementation
+  impl->Initialize( surface, input );
+
+  return impl;
+}
+
+Object::Object()
+: mSurface( NULL ),
+  mBuffer( NULL ),
+  mPointer( NULL ),
+  mKeyboard( NULL ),
+  mTouch( NULL ),
+  mShmBuffer( NULL ),
+  mTbmSurface( 0 ),
+  mSurfaceDestroyListener( NULL ),
+  mBufferDestroyListener( NULL ),
+  mWidth( 0 ),
+  mHeight( 0 )
+{
+}
+
+Object::~Object()
+{
+  if( mBuffer )
+  {
+    pepper_buffer_unreference( mBuffer );
+    pepper_event_listener_remove( mBufferDestroyListener );
+  }
+
+  if( mSurfaceDestroyListener )
+  {
+    pepper_event_listener_remove( mSurfaceDestroyListener );
+  }
+}
+
+void Object::Initialize( pepper_surface_t* surface, Pepper::Input input )
+{
+  mSurface = surface;
+
+  mPointer = input.GetPointer();
+  mKeyboard = input.GetKeyboard();
+  mTouch = input.GetTouch();
+
+  mSurfaceDestroyListener = pepper_object_add_event_listener( (pepper_object_t*)surface, PEPPER_EVENT_OBJECT_DESTROY, 0, Object::OnDestroySurface, this );
+
+  DALI_LOG_INFO( gPepperObjectLogging, Debug::Verbose, "Object::Initialize: success\n" );
+}
+
+bool Object::AttchBuffer( int* width, int* height )
+{
+  pepper_buffer_t* buffer;
+  wl_resource* bufferResource;
+  wl_shm_buffer* shmBuffer;
+  tbm_surface_h tbmSurface;
+  int bufWidth, bufHeight;
+
+  buffer = pepper_surface_get_buffer( mSurface );
+  if( !buffer )
+  {
+    DALI_LOG_INFO( gPepperObjectLogging, Debug::General, "Object::AttchBuffer: pepper_surface_get_buffer is failed\n" );
+    return false;
+  }
+
+  if( mBuffer )
+  {
+    pepper_buffer_unreference( mBuffer );
+    pepper_event_listener_remove( mBufferDestroyListener );
+  }
+
+  pepper_buffer_reference( buffer );
+
+  mBuffer = buffer;
+  mBufferDestroyListener = pepper_object_add_event_listener( (pepper_object_t*)buffer, PEPPER_EVENT_OBJECT_DESTROY, 0, Object::OnDestroyBuffer, this );
+
+  bufferResource = pepper_buffer_get_resource( buffer );
+
+  shmBuffer = wl_shm_buffer_get( bufferResource );
+  if( shmBuffer )
+  {
+    bufWidth = wl_shm_buffer_get_width( shmBuffer );
+    bufHeight = wl_shm_buffer_get_height( shmBuffer );
+  }
+  else
+  {
+    tbmSurface = wayland_tbm_server_get_surface( NULL, bufferResource );
+    if( tbmSurface )
+    {
+      bufWidth = tbm_surface_get_width( tbmSurface );
+      bufHeight = tbm_surface_get_height( tbmSurface );
+    }
+    else
+    {
+      DALI_LOG_INFO( gPepperObjectLogging, Debug::General, "Object::AttchBuffer: Failed to get buffer\n" );
+      return false;
+    }
+  }
+
+  if( !mObjectView )
+  {
+    mObjectView = Pepper::ObjectView::New();
+
+    mObjectView.TouchedSignal().Connect( this, &Object::OnTouched );
+
+    // Set surface
+    Pepper::GetImplementation( mObjectView ).SetSurface( mSurface );
+
+    // TODO: support multi touch, focus in/out, mouse in/out
+
+    // TODO: resize callback
+
+    Pepper::Object handle( this );
+    mObjectViewAddedSignal.Emit( handle, mObjectView );
+  }
+
+  if( shmBuffer != mShmBuffer )
+  {
+    // create a new image
+    PixelBuffer* pixelBuffer = static_cast< PixelBuffer* >( wl_shm_buffer_get_data( shmBuffer ) );
+    mBufferImage = BufferImage::New( pixelBuffer, bufWidth, bufHeight );
+
+    mObjectView.SetImage( mBufferImage );
+
+    mShmBuffer = shmBuffer;
+  }
+  else if ( tbmSurface != mTbmSurface )
+  {
+    NativeImageSourcePtr nativeImageSource = NativeImageSource::New( tbmSurface );
+    mNativeImage = NativeImage::New( *nativeImageSource );
+
+    mObjectView.SetImage( mNativeImage );
+
+    mTbmSurface = tbmSurface;
+  }
+
+  if( ( mWidth != bufWidth ) || ( mHeight != bufHeight ) )
+  {
+    mWidth = bufWidth;
+    mHeight = bufHeight;
+
+    // resize actor
+    mObjectView.SetSize( mWidth, mHeight );
+  }
+
+  if( width )
+  {
+    *width = bufWidth;
+  }
+
+  if( height )
+  {
+    *height = bufHeight;
+  }
+
+  DALI_LOG_INFO( gPepperObjectLogging, Debug::Verbose, "Object::AttchBuffer: this = %p, width = %d, height = %d", this, bufWidth, bufHeight );
+
+  return true;
+}
+
+Pepper::Object::ObjectSignalType& Object::ObjectViewAddedSignal()
+{
+  return mObjectViewAddedSignal;
+}
+
+Pepper::Object::ObjectSignalType& Object::ObjectViewDeletedSignal()
+{
+  return mObjectViewDeletedSignal;
+}
+
+bool Object::OnTouched( Actor actor, const TouchEvent& touchEvent )
+{
+  const TouchPoint& point = touchEvent.GetPoint(0);
+
+  Pepper::Internal::ShellClientPtr shellClient = reinterpret_cast< Pepper::Internal::ShellClient* >( pepper_object_get_user_data( reinterpret_cast< pepper_object_t* >( mSurface ), pepper_surface_get_role( mSurface ) ) );
+  if( !shellClient )
+  {
+    DALI_LOG_INFO( gPepperObjectLogging, Debug::General, "Object::OnTouched: shellClient is null. mSurface = %p\n", mSurface );
+    return false;
+  }
+
+  switch( point.state )
+  {
+    case TouchPoint::Down:
+    {
+      pepper_touch_add_point( mTouch, point.deviceId, point.local.x, point.local.y );
+      pepper_touch_send_down( mTouch, shellClient->GetView(), touchEvent.time, point.deviceId, point.local.x, point.local.y );
+
+      DALI_LOG_INFO( gPepperObjectLogging, Debug::Verbose, "Object::OnTouched: Touch Down (%.2f, %.2f) device = %d surface = %p\n", point.local.x, point.local.y, point.deviceId, mSurface );
+      return true;
+    }
+    case TouchPoint::Up:
+    {
+      pepper_touch_send_up( mTouch, shellClient->GetView(), touchEvent.time, point.deviceId );
+      pepper_touch_remove_point( mTouch, point.deviceId );
+
+      DALI_LOG_INFO( gPepperObjectLogging, Debug::Verbose, "Object::OnTouched: Touch Up (%.2f, %.2f) surface = %p\n", point.local.x, point.local.y, mSurface );
+      return true;
+    }
+    case TouchPoint::Motion:
+    {
+      pepper_touch_send_motion( mTouch, shellClient->GetView(), touchEvent.time, point.deviceId, point.local.x, point.local.y );
+
+//      DALI_LOG_INFO( gPepperObjectLogging, Debug::Verbose, "Object::OnTouched: Touch Motion (%.2f, %.2f)\n", point.local.x, point.local.y );
+      return true;
+    }
+    default:
+    {
+      return false;
+    }
+  }
+
+  return false;
+}
+
+void Object::OnDestroySurface( pepper_event_listener_t* listener, pepper_object_t* pepperObject, uint32_t id, void* info, void* data )
+{
+  Object* object = static_cast< Object* >( data );
+
+  Pepper::Object handle( object );
+  object->mObjectViewDeletedSignal.Emit( handle, object->mObjectView );
+
+  object->mSurface = NULL;
+
+  if( object->mSurfaceDestroyListener )
+  {
+    pepper_event_listener_remove( object->mSurfaceDestroyListener );
+  }
+}
+
+void Object::OnDestroyBuffer( pepper_event_listener_t* listener, pepper_object_t* pepperObject, uint32_t id, void* info, void* data )
+{
+  Object* object = static_cast< Object* >( data );
+
+  if( object->mBuffer )
+  {
+    pepper_buffer_unreference( object->mBuffer );
+    pepper_event_listener_remove( object->mBufferDestroyListener );
+  }
+
+  if( object->mShmBuffer )
+  {
+    void* shmData = wl_shm_buffer_get_data( object->mShmBuffer );
+
+    object->mBufferImage = BufferImage::New( object->mWidth, object->mHeight );
+
+    PixelBuffer* buffer = object->mBufferImage.GetBuffer();
+    memcpy(buffer, shmData, object->mWidth * object->mHeight * 4);
+
+    object->mBufferImage.Update();
+
+    object->mObjectView.SetImage( object->mBufferImage );
+  }
+  else if( object->mTbmSurface )
+  {
+  }
+}
+
+} // namespace Internal
+
+} // namespace Pepper
+
+} // namespace Dali
diff --git a/pepper-dali/internal/object-impl.h b/pepper-dali/internal/object-impl.h
new file mode 100644 (file)
index 0000000..77b8d47
--- /dev/null
@@ -0,0 +1,140 @@
+#ifndef __DALI_PEPPER_INTERNAL_OBJECT_H__
+#define __DALI_PEPPER_INTERNAL_OBJECT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/object.h>
+#include <pepper-dali/public-api/object-view/object-view.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/images/buffer-image.h>
+#include <dali/public-api/images/native-image.h>
+#include <tbm_surface.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+class Object;
+typedef IntrusivePtr<Object> ObjectPtr;
+
+class Object : public BaseObject, public ConnectionTracker
+{
+public:
+
+  static ObjectPtr New( pepper_surface_t* surface, Pepper::Input input );
+
+  bool AttchBuffer( int* width, int* height );
+
+public: //Signals
+
+  Pepper::Object::ObjectSignalType& ObjectViewAddedSignal();
+  Pepper::Object::ObjectSignalType& ObjectViewDeletedSignal();
+
+private:
+
+  /**
+   * Construct a new Object.
+   */
+  Object();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~Object();
+
+  /**
+   * Second-phase constructor. Must be called immediately after creating a new Object;
+   */
+  void Initialize( pepper_surface_t* surface, Pepper::Input input );
+
+  bool OnTouched( Actor actor, const TouchEvent& touchEvent );
+
+  static void OnDestroySurface( pepper_event_listener_t* listener, pepper_object_t* object, uint32_t id, void* info, void* data );
+  static void OnDestroyBuffer( pepper_event_listener_t* listener, pepper_object_t* object, uint32_t id, void* info, void* data );
+
+private:
+
+  // Undefined
+  Object( const Object& );
+
+  // Undefined
+  Object& operator=( const Object& rhs );
+
+private: // Data
+
+  pepper_surface_t* mSurface;
+  pepper_buffer_t* mBuffer;
+
+  pepper_pointer_t* mPointer;
+  pepper_keyboard_t* mKeyboard;
+  pepper_touch_t* mTouch;
+
+  wl_shm_buffer* mShmBuffer;
+  tbm_surface_h mTbmSurface;
+
+  pepper_event_listener_t* mSurfaceDestroyListener;
+  pepper_event_listener_t* mBufferDestroyListener;
+
+  Pepper::ObjectView mObjectView;
+  BufferImage mBufferImage;
+  NativeImage mNativeImage;
+
+  int mWidth;
+  int mHeight;
+
+  // Signals
+  Pepper::Object::ObjectSignalType mObjectViewAddedSignal;
+  Pepper::Object::ObjectSignalType mObjectViewDeletedSignal;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Pepper::Internal::Object& GetImplementation( Pepper::Object& object )
+{
+  DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
+
+  BaseObject& handle = object.GetBaseObject();
+
+  return static_cast< Internal::Object& >( handle );
+}
+
+inline const Pepper::Internal::Object& GetImplementation( const Pepper::Object& object )
+{
+  DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
+
+  const BaseObject& handle = object.GetBaseObject();
+
+  return static_cast< const Internal::Object& >( handle );
+}
+
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_INTERNAL_OBJECT_H__
diff --git a/pepper-dali/internal/object-view-impl.cpp b/pepper-dali/internal/object-view-impl.cpp
new file mode 100644 (file)
index 0000000..40d9cbe
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/object-view-impl.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/shell-client-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gPepperObjectViewLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_PEPPER_OBJECT_VIEW" );
+#endif
+
+} // unnamed namespace
+
+Dali::Pepper::ObjectView ObjectView::New()
+{
+  // Create the implementation, temporarily owned on stack
+  IntrusivePtr< ObjectView > internalObjectView = new ObjectView();
+
+  // Pass ownership to CustomActor
+  Dali::Pepper::ObjectView objectView( *internalObjectView );
+
+  // Second-phase init of the implementation
+  // This can only be done after the CustomActor connection has been made...
+  internalObjectView->Initialize();
+
+  return objectView;
+}
+
+ObjectView::ObjectView()
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+  mWidth( 0 ),
+  mHeight( 0 ),
+  mSurface( NULL )
+{
+}
+
+ObjectView::~ObjectView()
+{
+}
+
+void ObjectView::SetImage( Image image )
+{
+  mImageView.SetImage( image );
+
+  DALI_LOG_INFO( gPepperObjectViewLogging, Debug::General, "ObjectView::SetImage: size = %d * %d\n", image.GetWidth(), image.GetHeight() );
+}
+
+pid_t ObjectView::GetPid() const
+{
+  pid_t pid = 0;
+  struct wl_client* client;
+
+  if( mSurface )
+  {
+    client = wl_resource_get_client( pepper_surface_get_resource( mSurface ) );
+    if( client )
+    {
+      wl_client_get_credentials( client, &pid, NULL, NULL );
+    }
+  }
+
+  DALI_LOG_INFO( gPepperObjectViewLogging, Debug::General, "ObjectView::GetPid: pid = %d\n", pid );
+
+  return pid;
+}
+
+std::string ObjectView::GetTitle() const
+{
+  std::string title;
+
+  if( mSurface )
+  {
+    Pepper::Internal::ShellClientPtr shellClient = reinterpret_cast< Pepper::Internal::ShellClient* >( pepper_object_get_user_data( reinterpret_cast< pepper_object_t* >( mSurface ), pepper_surface_get_role( mSurface ) ) );
+    if( shellClient )
+    {
+      title = shellClient->GetTitle();
+    }
+  }
+
+  DALI_LOG_INFO( gPepperObjectViewLogging, Debug::General, "ObjectView::GetTitle: title = %s\n", title.c_str() );
+
+  return title;
+}
+
+std::string ObjectView::GetAppId() const
+{
+  std::string appId;
+
+  if( mSurface )
+  {
+    Pepper::Internal::ShellClientPtr shellClient = reinterpret_cast< Pepper::Internal::ShellClient* >( pepper_object_get_user_data( reinterpret_cast< pepper_object_t* >( mSurface ), pepper_surface_get_role( mSurface ) ) );
+    if( shellClient )
+    {
+      appId = shellClient->GetAppId();
+    }
+  }
+
+  DALI_LOG_INFO( gPepperObjectViewLogging, Debug::General, "ObjectView::GetAppId: app id = %s\n", appId.c_str() );
+
+  return appId;
+}
+
+void ObjectView::SetSurface( pepper_surface_t* surface )
+{
+  mSurface = surface;
+}
+
+void ObjectView::OnInitialize()
+{
+  mImageView = Toolkit::ImageView::New();
+  mImageView.SetParentOrigin( ParentOrigin::CENTER );
+  mImageView.SetAnchorPoint( AnchorPoint::CENTER );
+
+  Self().Add( mImageView );
+  Self().SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
+}
+
+} // namespace Internal
+
+} // namespace Pepper
+
+} // namespace Dali
diff --git a/pepper-dali/internal/object-view-impl.h b/pepper-dali/internal/object-view-impl.h
new file mode 100644 (file)
index 0000000..fe5c28e
--- /dev/null
@@ -0,0 +1,137 @@
+#ifndef __DALI_PEPPER_INTERNAL_OBJECT_VIEW_H__
+#define __DALI_PEPPER_INTERNAL_OBJECT_VIEW_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/public-api/object-view/object-view.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/images/buffer-image.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <pepper.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+class ObjectView : public Toolkit::Internal::Control
+{
+public:
+
+  /**
+   * @copydoc Dali::Pepper::ObjectView::New
+   */
+  static Dali::Pepper::ObjectView New();
+
+  /**
+   * @copydoc Dali::Pepper::ObjectView::SetImage
+   */
+  void SetImage( Image image );
+
+  /**
+   * @copydoc Dali::Pepper::ObjectView::GetPid
+   */
+  pid_t GetPid() const;
+
+  /**
+   * @copydoc Dali::Pepper::ObjectView::GetTitle
+   */
+  std::string GetTitle() const;
+
+  /**
+   * @copydoc Dali::Pepper::ObjectView::GetAppId
+   */
+  std::string GetAppId() const;
+
+  /**
+   * Set pepper surface
+   */
+  void SetSurface( pepper_surface_t* surface );
+
+protected:
+
+  /**
+   * Construct a new ObjectView.
+   */
+  ObjectView();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~ObjectView();
+
+private: // From Control
+
+  /**
+   * @copydoc Dali::Toolkit::Control::OnInitialize()
+   */
+  virtual void OnInitialize();
+
+private:
+
+  // Undefined
+  ObjectView( const ObjectView& );
+
+  // Undefined
+  ObjectView& operator= ( const ObjectView& );
+
+private:
+
+  Toolkit::ImageView mImageView;
+  BufferImage mBufferImage;
+
+  int mWidth;
+  int mHeight;
+
+  pepper_surface_t* mSurface;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Pepper::Internal::ObjectView& GetImplementation( Pepper::ObjectView& objectView )
+{
+  DALI_ASSERT_ALWAYS( objectView );
+
+  Dali::RefObject& handle = objectView.GetImplementation();
+
+  return static_cast<Internal::ObjectView&>( handle );
+}
+
+inline const Pepper::Internal::ObjectView& GetImplementation( const Pepper::ObjectView& objectView )
+{
+  DALI_ASSERT_ALWAYS( objectView );
+
+  const Dali::RefObject& handle = objectView.GetImplementation();
+
+  return static_cast<const Internal::ObjectView&>( handle );
+}
+
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_INTERNAL_OBJECT_VIEW_H__
diff --git a/pepper-dali/internal/object.cpp b/pepper-dali/internal/object.cpp
new file mode 100644 (file)
index 0000000..593be87
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/object.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/object-impl.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+Object Object::New( pepper_surface_t* surface, Input input )
+{
+  Internal::ObjectPtr internal = Internal::Object::New( surface, input );
+
+  return Object( internal.Get() );
+}
+
+Object Object::DownCast( BaseHandle handle )
+{
+  return Object( dynamic_cast< Internal::Object* >( handle.GetObjectPtr() ) );
+}
+
+Object::Object()
+{
+}
+
+Object::Object( const Object& handle )
+: BaseHandle(handle)
+{
+}
+
+Object& Object::operator=( const Object& handle )
+{
+  BaseHandle::operator=(handle);
+  return *this;
+}
+
+Object::~Object()
+{
+}
+
+Object::Object( Internal::Object* implementation )
+: BaseHandle( implementation )
+{
+}
+
+bool Object::AttchBuffer( int* width, int* height )
+{
+  return GetImplementation( *this ).AttchBuffer( width, height );
+}
+
+Object::ObjectSignalType& Object::ObjectViewAddedSignal()
+{
+  return GetImplementation(*this).ObjectViewAddedSignal();
+}
+
+Object::ObjectSignalType& Object::ObjectViewDeletedSignal()
+{
+  return GetImplementation(*this).ObjectViewDeletedSignal();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/pepper-dali/internal/object.h b/pepper-dali/internal/object.h
new file mode 100644 (file)
index 0000000..d67e17a
--- /dev/null
@@ -0,0 +1,128 @@
+#ifndef __DALI_PEPPER_OBJECT_H__
+#define __DALI_PEPPER_OBJECT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/input.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <pepper.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Object;
+}
+
+/**
+ * @addtogroup dali_pepper_compositor
+ * @{
+ */
+
+class Object : public BaseHandle
+{
+public:
+
+  /**
+   * @brief Create Object.
+   *
+   * @since_tizen 3.0
+   * @return A handle to Object.
+   */
+  static Object New( pepper_surface_t* surface, Input input );
+
+  /**
+   * @brief Downcast a handle to Object handle.
+   *
+   * If the BaseHandle points is a Object the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a Object or an empty handle
+   */
+  static Object DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an empty handle.
+   * @since_tizen 3.0
+   */
+  Object();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  Object( const Object& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  Object& operator=( const Object& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~Object();
+
+  bool AttchBuffer( int* width, int* height );
+
+public: //Signals
+
+  typedef Signal< void ( Object, ObjectView ) > ObjectSignalType;
+
+  ObjectSignalType& ObjectViewAddedSignal();
+  ObjectSignalType& ObjectViewDeletedSignal();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the Pepper::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The Object implementation.
+   */
+  explicit DALI_INTERNAL Object( Internal::Object* implementation );
+};
+
+/**
+ * @}
+ */
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_OBJECT_H__
diff --git a/pepper-dali/internal/output-impl.cpp b/pepper-dali/internal/output-impl.cpp
new file mode 100644 (file)
index 0000000..afc2986
--- /dev/null
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/output-impl.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/compositor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gPepperOutputLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_PEPPER_OUTPUT" );
+#endif
+
+static const struct pepper_output_backend outputInterface =
+{
+  Output::OnDestroy,
+
+  Output::OnGetSubpixelOrder,
+  Output::OnGetMakerName,
+  Output::OnGetModelName,
+
+  Output::OnGetModeCount,
+  Output::OnGetMode,
+  Output::OnSetMode,
+
+  Output::OnAssignPlanes,
+  Output::OnStartRepaintLoop,
+  Output::OnRepaint,
+  Output::OnAttachSurface,
+  Output::OnFlushSurface
+};
+
+} // unnamed namespace
+
+OutputPtr Output::New( Pepper::Compositor compositor, Application application, Pepper::Input input )
+{
+  OutputPtr impl = new Output();
+
+  // Second-phase init of the implementation
+  impl->Initialize( compositor, application, input );
+
+  return impl;
+}
+
+Output::Output()
+: mSize(),
+  mOutput( NULL ),
+  mPrimaryPlane( NULL )
+{
+}
+
+Output::~Output()
+{
+}
+
+void Output::Initialize( Pepper::Compositor& compositor, Application application, Pepper::Input input )
+{
+  mCompositor = compositor;
+  mInput = input;
+
+  // TODO: use application info
+  mSize.width = 720.0f;
+  mSize.height = 1280.0f;
+
+  mOutput = pepper_compositor_add_output( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( compositor ).GetCompositorHandle() ), &outputInterface, "dali", this, WL_OUTPUT_TRANSFORM_NORMAL, 1 );
+  if( !mOutput )
+  {
+    DALI_LOG_INFO( gPepperOutputLogging, Debug::General, "Output::Initialize: pepper_compositor_add_output is failed\n" );
+    return;
+  }
+
+  mPrimaryPlane = pepper_output_add_plane( mOutput, NULL );
+  if( !mPrimaryPlane )
+  {
+    DALI_LOG_INFO( gPepperOutputLogging, Debug::General, "Output::Initialize: pepper_output_add_plane is failed\n" );
+    pepper_output_destroy( mOutput );
+    return;
+  }
+
+  application.ResizeSignal().Connect( this, &Output::OnResize );
+
+  // TODO: render post?
+
+  DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::Initialize: success\n" );
+}
+
+void Output::OnDestroy( void* data )
+{
+  Output* output = static_cast< Output* >( data );
+
+  if( output->mPrimaryPlane )
+  {
+    pepper_plane_destroy( output->mPrimaryPlane );
+    output->mPrimaryPlane = NULL;
+  }
+}
+
+int32_t Output::OnGetSubpixelOrder( void* data )
+{
+  return WL_OUTPUT_SUBPIXEL_UNKNOWN;
+}
+
+const char* Output::OnGetMakerName( void* data )
+{
+  return "PePPer DALi";
+}
+
+const char* Output::OnGetModelName( void* data )
+{
+  return "PePPer DALi";
+}
+
+int Output::OnGetModeCount( void* data )
+{
+  return 1;
+}
+
+void Output::OnGetMode( void* data, int index, pepper_output_mode_t* mode )
+{
+  Output* output = static_cast< Output* >( data );
+
+  if( index != 0 )
+  {
+    DALI_LOG_INFO( gPepperOutputLogging, Debug::General, "Output::OnGetMode: wrong index [%d]\n", index );
+    return;
+  }
+
+  if( mode )
+  {
+    mode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
+    mode->w = (int32_t)output->mSize.width;
+    mode->h = (int32_t)output->mSize.height;
+    mode->refresh = 60000;
+  }
+}
+
+pepper_bool_t Output::OnSetMode( void* data, const pepper_output_mode_t* mode )
+{
+  return PEPPER_FALSE;
+}
+
+void Output::OnAssignPlanes( void* data, const pepper_list_t* viewList )
+{
+  Output* output = static_cast< Output* >( data );
+  pepper_list_t* list;
+
+  pepper_list_for_each_list( list, viewList )
+  {
+    pepper_view_t* view = static_cast< pepper_view_t* >( list->item );
+    pepper_view_assign_plane( view, output->mOutput, output->mPrimaryPlane );
+  }
+}
+
+void Output::OnStartRepaintLoop( void* data )
+{
+  Output* output = static_cast< Output* >( data );
+  struct timespec ts;
+
+  DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnStartRepaintLoop\n" );
+
+  pepper_compositor_get_time( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( output->mCompositor ).GetCompositorHandle() ), &ts );
+  pepper_output_finish_frame( output->mOutput, &ts );
+}
+
+void Output::OnRepaint( void* data, const pepper_list_t* planeList )
+{
+  DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnRepaint\n" );
+
+  // TODO: repaint
+}
+
+void Output::OnAttachSurface( void* data, pepper_surface_t* surface, int* width, int* height )
+{
+  Output* output = static_cast< Output* >( data );
+  Pepper::Object object;
+
+  DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnAttachSurface: surface = %p\n", surface );
+
+  long index = reinterpret_cast< long >( pepper_object_get_user_data( (pepper_object_t*)surface, output ) );
+  if( index == 0 )
+  {
+    object = Pepper::Object::New( surface, output->mInput );
+
+    object.ObjectViewAddedSignal().Connect( output, &Output::OnObjectViewAdded );
+    object.ObjectViewDeletedSignal().Connect( output, &Output::OnObjectViewDeleted );
+
+    index = output->mObjectList.size() + 1;
+    output->mObjectList.push_back( object );
+
+    pepper_object_set_user_data( (pepper_object_t*)surface, output, reinterpret_cast< void* >( index ), NULL );
+
+    DALI_LOG_INFO( gPepperOutputLogging, Debug::Verbose, "Output::OnAttachSurface: object index = %d\n", index );
+  }
+  else
+  {
+    object = output->mObjectList[index - 1];
+  }
+
+  if( !object.AttchBuffer( width, height ) )
+  {
+    *width = 0;
+    *height = 0;
+  }
+
+  // TODO: temp
+  struct timespec ts;
+
+  pepper_compositor_get_time( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( output->mCompositor ).GetCompositorHandle() ), &ts );
+  pepper_output_finish_frame( output->mOutput, &ts );
+}
+
+void Output::OnFlushSurface( void* data, pepper_surface_t* surface, pepper_bool_t* keepBuffer )
+{
+}
+
+Pepper::Output::OutputSignalType& Output::ObjectViewAddedSignal()
+{
+  return mObjectViewAddedSignal;
+}
+
+Pepper::Output::OutputSignalType& Output::ObjectViewDeletedSignal()
+{
+  return mObjectViewDeletedSignal;
+}
+
+void Output::OnResize( Application& application )
+{
+  // TODO
+  // Can't get a new size! Use a new size later
+  mSize.width = 720.0f;
+  mSize.height = 1280.0f;
+
+  pepper_output_update_mode( mOutput );
+}
+
+void Output::OnObjectViewAdded( Pepper::Object object, Pepper::ObjectView objectView )
+{
+  Pepper::Output handle( this );
+  mObjectViewAddedSignal.Emit( handle, objectView );
+}
+
+void Output::OnObjectViewDeleted( Pepper::Object object, Pepper::ObjectView objectView )
+{
+  Pepper::Output handle( this );
+  mObjectViewDeletedSignal.Emit( handle, objectView );
+
+  for ( std::vector< Pepper::Object >::iterator iter = mObjectList.begin(); mObjectList.end() != iter; ++iter )
+  {
+    if( *iter == object )
+    {
+      mObjectList.erase( iter );
+    }
+  }
+}
+
+} // namespace Internal
+
+} // namespace Pepper
+
+} // namespace Dali
diff --git a/pepper-dali/internal/output-impl.h b/pepper-dali/internal/output-impl.h
new file mode 100644 (file)
index 0000000..2c06a18
--- /dev/null
@@ -0,0 +1,141 @@
+#ifndef __DALI_PEPPER_INTERNAL_OUTPUT_H__
+#define __DALI_PEPPER_INTERNAL_OUTPUT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/output.h>
+#include <pepper-dali/internal/object.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/connection-tracker.h>
+#include <pepper-output-backend.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+class Output;
+typedef IntrusivePtr<Output> OutputPtr;
+
+class Output : public BaseObject, public ConnectionTracker
+{
+public:
+
+  static OutputPtr New( Pepper::Compositor compositor, Application application, Pepper::Input input );
+
+  static void OnDestroy( void* data );
+  static int32_t OnGetSubpixelOrder( void* data );
+  static const char* OnGetMakerName( void* data );
+  static const char* OnGetModelName( void* data );
+  static int OnGetModeCount( void* data );
+  static void OnGetMode( void* data, int index, pepper_output_mode_t* mode );
+  static pepper_bool_t OnSetMode( void* data, const pepper_output_mode_t* mode );
+  static void OnAssignPlanes( void* data, const pepper_list_t* viewList );
+  static void OnStartRepaintLoop( void* data );
+  static void OnRepaint( void* data, const pepper_list_t* planeList );
+  static void OnAttachSurface( void* data, pepper_surface_t* surface, int* width, int* height );
+  static void OnFlushSurface( void* data, pepper_surface_t* surface, pepper_bool_t* keepBuffer );
+
+public: //Signals
+
+  Pepper::Output::OutputSignalType& ObjectViewAddedSignal();
+  Pepper::Output::OutputSignalType& ObjectViewDeletedSignal();
+
+private:
+
+  /**
+   * Construct a new Output.
+   */
+  Output();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~Output();
+
+  /**
+   * Second-phase constructor. Must be called immediately after creating a new Output;
+   */
+  void Initialize( Pepper::Compositor& compositor, Application application, Pepper::Input input );
+
+  void OnResize( Application& application );
+
+  void OnObjectViewAdded( Pepper::Object object, Pepper::ObjectView objectView );
+  void OnObjectViewDeleted( Pepper::Object object, Pepper::ObjectView objectView );
+
+private:
+
+  // Undefined
+  Output( const Output& );
+
+  // Undefined
+  Output& operator=( const Output& rhs );
+
+private: // Data
+
+  Pepper::Compositor mCompositor;
+
+  Vector2 mSize;
+
+  Pepper::Input mInput;
+  std::vector<Pepper::Object> mObjectList;
+
+  pepper_output_t* mOutput;
+  pepper_plane_t* mPrimaryPlane;
+
+  // Signals
+  Pepper::Output::OutputSignalType mObjectViewAddedSignal;
+  Pepper::Output::OutputSignalType mObjectViewDeletedSignal;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Pepper::Internal::Output& GetImplementation( Pepper::Output& output )
+{
+  DALI_ASSERT_ALWAYS( output && "Output handle is empty" );
+
+  BaseObject& handle = output.GetBaseObject();
+
+  return static_cast< Internal::Output& >( handle );
+}
+
+inline const Pepper::Internal::Output& GetImplementation( const Pepper::Output& output )
+{
+  DALI_ASSERT_ALWAYS( output && "Output handle is empty" );
+
+  const BaseObject& handle = output.GetBaseObject();
+
+  return static_cast< const Internal::Output& >( handle );
+}
+
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_INTERNAL_OUTPUT_H__
diff --git a/pepper-dali/internal/output.cpp b/pepper-dali/internal/output.cpp
new file mode 100644 (file)
index 0000000..d767303
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/output.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/output-impl.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+Output Output::New( Compositor compositor, Application application, Input input )
+{
+  Internal::OutputPtr internal = Internal::Output::New( compositor, application, input );
+
+  return Output( internal.Get() );
+}
+
+Output Output::DownCast( BaseHandle handle )
+{
+  return Output( dynamic_cast< Internal::Output* >( handle.GetObjectPtr() ) );
+}
+
+Output::Output()
+{
+}
+
+Output::Output( const Output& handle )
+: BaseHandle(handle)
+{
+}
+
+Output& Output::operator=( const Output& handle )
+{
+  BaseHandle::operator=(handle);
+  return *this;
+}
+
+Output::~Output()
+{
+}
+
+Output::Output( Internal::Output* implementation )
+: BaseHandle( implementation )
+{
+}
+
+Output::OutputSignalType& Output::ObjectViewAddedSignal()
+{
+  return GetImplementation(*this).ObjectViewAddedSignal();
+}
+
+Output::OutputSignalType& Output::ObjectViewDeletedSignal()
+{
+  return GetImplementation(*this).ObjectViewDeletedSignal();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/pepper-dali/internal/output.h b/pepper-dali/internal/output.h
new file mode 100644 (file)
index 0000000..4485fc9
--- /dev/null
@@ -0,0 +1,127 @@
+#ifndef __DALI_PEPPER_OUTPUT_H__
+#define __DALI_PEPPER_OUTPUT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/public-api/compositor/compositor.h>
+#include <pepper-dali/internal/input.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/adaptor-framework/application.h>
+#include <pepper.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Output;
+}
+
+/**
+ * @addtogroup dali_pepper_compositor
+ * @{
+ */
+
+class Output : public BaseHandle
+{
+public:
+
+  /**
+   * @brief Create Output.
+   *
+   * @since_tizen 3.0
+   * @return A handle to Output.
+   */
+  static Output New( Compositor compositor, Application application, Input input );
+
+  /**
+   * @brief Downcast a handle to Output handle.
+   *
+   * If the BaseHandle points is a Output the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a Output or an empty handle
+   */
+  static Output DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an empty handle.
+   * @since_tizen 3.0
+   */
+  Output();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  Output( const Output& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  Output& operator=( const Output& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~Output();
+
+public: //Signals
+
+  typedef Signal< void ( Output, ObjectView ) > OutputSignalType;
+
+  OutputSignalType& ObjectViewAddedSignal();
+  OutputSignalType& ObjectViewDeletedSignal();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the Pepper::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The Output implementation.
+   */
+  explicit DALI_INTERNAL Output( Internal::Output* implementation );
+};
+
+/**
+ * @}
+ */
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_OUTPUT_H__
diff --git a/pepper-dali/internal/shell-client-impl.cpp b/pepper-dali/internal/shell-client-impl.cpp
new file mode 100644 (file)
index 0000000..865b002
--- /dev/null
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/shell-client-impl.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/compositor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <xdg-shell-server-protocol.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gPepperShellClientLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_PEPPER_SHELL_CLIENT" );
+#endif
+
+static void XdgShellClientDestroy( struct wl_client* client, struct wl_resource* resource)
+{
+}
+
+static void XdgShellClientUseUnstableVersion( struct wl_client* client, struct wl_resource* resource, int32_t version )
+{
+}
+
+static void XdgShellClientGetSurface( struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* surfaceResource )
+{
+  ShellClient* shellClient = static_cast< ShellClient* >( wl_resource_get_user_data( resource ) );
+
+  shellClient->GetSurface( client, id, surfaceResource );
+}
+
+static void XdgShellClientGetPopup( struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* surfaceResource,
+                              struct wl_resource* parentResource, struct wl_resource* seatResource, uint32_t serial, int32_t x, int32_t y )
+{
+}
+
+static void XdgShellClientPong( struct wl_client* client, struct wl_resource* resource, uint32_t serial )
+{
+}
+
+static const struct xdg_shell_interface xdgImpl = {
+  XdgShellClientDestroy,
+  XdgShellClientUseUnstableVersion,
+  XdgShellClientGetSurface,
+  XdgShellClientGetPopup,
+  XdgShellClientPong
+};
+
+static void XdgSurfaceDestroy( struct wl_client* client, struct wl_resource* resource )
+{
+  wl_resource_destroy( resource );
+}
+
+static void XdgSurfaceSetParent( struct wl_client* client, struct wl_resource* resource, struct wl_resource* parentResource )
+{
+}
+
+static void XdgSurfaceSetTitle( struct wl_client* client, struct wl_resource* resource, const char* title )
+{
+  ShellClient* shellClient = static_cast< ShellClient* >( wl_resource_get_user_data( resource ) );
+
+  shellClient->SetTitle( title );
+}
+
+static void XdgSurfaceSetAppId( struct wl_client* client, struct wl_resource* resource, const char* appId )
+{
+  ShellClient* shellClient = static_cast< ShellClient* >( wl_resource_get_user_data( resource ) );
+
+  shellClient->SetAppId( appId );
+}
+
+static void XdgSurfaceShowWindowMenu( struct wl_client* client, struct wl_resource* surfaceResource, struct wl_resource* seatResource, uint32_t serial, int32_t x, int32_t y )
+{
+}
+
+static void XdgSurfaceMove( struct wl_client* client, struct wl_resource* resource, struct wl_resource* seatResource, uint32_t serial )
+{
+}
+
+static void XdgSurfaceResize( struct wl_client* client, struct wl_resource* resource, struct wl_resource* seatResource, uint32_t serial, uint32_t edges )
+{
+}
+
+static void XdgSurfaceAckConfigure( struct wl_client* client, struct wl_resource* resource, uint32_t serial )
+{
+  ShellClient* shellClient = static_cast< ShellClient* >( wl_resource_get_user_data( resource ) );
+
+  shellClient->AckConfigure();
+}
+
+static void XdgSurfaceSetWindowGeometry( struct wl_client* client, struct wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height )
+{
+}
+
+static void XdgSurfaceSetMaximized( struct wl_client* client, struct wl_resource* resource )
+{
+}
+
+static void XdgSurfaceUnsetMaximized( struct wl_client* client, struct wl_resource* resource )
+{
+}
+
+static void XdgSurfaceSetFullScreen( struct wl_client* client, struct wl_resource* resource, struct wl_resource* outputResource )
+{
+}
+
+static void XdgSurfaceUnsetFullScreen( struct wl_client* client, struct wl_resource* resource )
+{
+}
+
+static void XdgSurfaceSetMinimized( struct wl_client* client, struct wl_resource* resource )
+{
+}
+
+static const struct xdg_surface_interface xdgSurfaceImplementation =
+{
+   XdgSurfaceDestroy,
+   XdgSurfaceSetParent,
+   XdgSurfaceSetTitle,
+   XdgSurfaceSetAppId,
+   XdgSurfaceShowWindowMenu,
+   XdgSurfaceMove,
+   XdgSurfaceResize,
+   XdgSurfaceAckConfigure,
+   XdgSurfaceSetWindowGeometry,
+   XdgSurfaceSetMaximized,
+   XdgSurfaceUnsetMaximized,
+   XdgSurfaceSetFullScreen,
+   XdgSurfaceUnsetFullScreen,
+   XdgSurfaceSetMinimized,
+};
+
+} // unnamed namespace
+
+ShellClientPtr ShellClient::New( Pepper::Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id )
+{
+  ShellClientPtr impl = new ShellClient();
+
+  // Second-phase init of the implementation
+  impl->Initialize( compositor, client, version, id );
+
+  return impl;
+}
+
+ShellClient::ShellClient()
+: mClient( NULL ),
+  mSurfaceResource( NULL ),
+  mSurface( NULL ),
+  mView( NULL ),
+  mSurfaceDestroyListener( NULL ),
+  mSurfaceCommitListener( NULL ),
+  mTitle(),
+  mAppId(),
+  mSurfaceMapped( false ),
+  mAckConfigure( false ),
+  mConfigureCallback( NULL ),
+  mConfigureCallbackData( NULL ),
+  mWidth( 0 ),
+  mHeight( 0 )
+{
+}
+
+ShellClient::~ShellClient()
+{
+  if( mClient )
+  {
+    wl_resource_destroy( mClient );
+  }
+
+  if( mSurfaceResource )
+  {
+    wl_resource_destroy( mSurfaceResource );
+  }
+
+  if( mView )
+  {
+    pepper_view_destroy( mView );
+  }
+}
+
+void ShellClient::Initialize( Pepper::Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id )
+{
+  mCompositor = compositor;
+
+  mClient = wl_resource_create( client, &xdg_shell_interface, version, id );
+  if( !mClient )
+  {
+    DALI_LOG_INFO( gPepperShellClientLogging, Debug::General, "ShellClient::Initialize: wl_resource_create is failed\n" );
+    return;
+  }
+
+  wl_resource_set_implementation( mClient, &xdgImpl, this, NULL );
+
+  DALI_LOG_INFO( gPepperShellClientLogging, Debug::Verbose, "ShellClient::Initialize: success\n" );
+}
+
+void ShellClient::Configure( int width, int height, ConfigureCallback callback, void* data )
+{
+  struct wl_display* display;
+  struct wl_array states;
+  uint32_t *state;
+  uint32_t serial;
+
+  wl_array_init( &states );
+
+  state = (uint32_t*)wl_array_add( &states, sizeof( uint32_t ) );
+  *state = XDG_SURFACE_STATE_ACTIVATED; // this is arbitary.
+
+  display = pepper_compositor_get_display( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( mCompositor ).GetCompositorHandle() ) );
+  serial = wl_display_next_serial( display );
+
+  xdg_surface_send_configure( mSurfaceResource, width, height, &states, serial );
+
+  wl_array_release( &states );
+
+  mAckConfigure = false;
+
+  mWidth = width;
+  mHeight = height;
+  mConfigureCallback = callback;
+  mConfigureCallbackData = data;
+}
+
+void ShellClient::AckConfigure()
+{
+  mAckConfigure = true;
+
+  if( mConfigureCallback )
+  {
+    mConfigureCallback( mConfigureCallbackData, mWidth, mHeight );
+
+    mConfigureCallback = NULL;
+    mConfigureCallbackData = NULL;
+  }
+}
+
+pepper_view_t* ShellClient::GetView()
+{
+  return mView;
+}
+
+void ShellClient::GetSurface( wl_client* client, unsigned int id, wl_resource* surfaceResource )
+{
+  mSurface = static_cast< pepper_surface_t* >( wl_resource_get_user_data( surfaceResource ) );
+
+  mSurfaceResource = wl_resource_create( client, &xdg_surface_interface, 1, id );
+
+  mView = pepper_compositor_add_view( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( mCompositor ).GetCompositorHandle() ) );
+  if( !mView )
+  {
+    DALI_LOG_INFO( gPepperShellClientLogging, Debug::General, "pepper_compositor_add_view is failed\n" );
+    wl_client_post_no_memory( client );
+    return;
+  }
+
+  if( !pepper_view_set_surface( mView, mSurface ) )
+  {
+    DALI_LOG_INFO( gPepperShellClientLogging, Debug::General, "pepper_view_set_surface is failed\n" );
+    wl_client_post_no_memory( client );
+    return;
+  }
+
+  wl_resource_set_implementation( mSurfaceResource, &xdgSurfaceImplementation, this, ShellClient::SurfaceResourceDestroy );
+
+  mSurfaceDestroyListener = pepper_object_add_event_listener( reinterpret_cast< pepper_object_t* >( mSurface ), PEPPER_EVENT_OBJECT_DESTROY, 0, ShellClient::OnSurfaceDestroy, this );
+
+  mSurfaceCommitListener = pepper_object_add_event_listener( reinterpret_cast< pepper_object_t* >( mSurface ), PEPPER_EVENT_SURFACE_COMMIT, 0, ShellClient::OnSurfaceCommit, this );
+
+  mSurfaceMapped = false;
+
+  pepper_surface_set_role( mSurface, "xdg_surface" );
+
+  pepper_object_set_user_data( reinterpret_cast< pepper_object_t* >( mSurface ), pepper_surface_get_role( mSurface ), this, NULL );
+
+  DALI_LOG_INFO( gPepperShellClientLogging, Debug::Verbose, "ShellClient::GetSurface: success. surface = %p\n", mSurface );
+}
+
+void ShellClient::SetTitle( const std::string title )
+{
+  mTitle = title;
+}
+
+std::string ShellClient::GetTitle() const
+{
+  return mTitle;
+}
+
+void ShellClient::SetAppId( const std::string appId )
+{
+  mAppId = appId;
+}
+
+std::string ShellClient::GetAppId() const
+{
+  return mAppId;
+}
+
+void ShellClient::SurfaceResourceDestroy( struct wl_resource* resource )
+{
+  ShellClient* shellClient = static_cast< ShellClient* >( wl_resource_get_user_data( resource ) );
+
+  pepper_event_listener_remove( shellClient->mSurfaceDestroyListener );
+
+  if( !shellClient->mTitle.empty() )
+  {
+    shellClient->mTitle.clear();
+  }
+
+  if( !shellClient->mAppId.empty() )
+  {
+    shellClient->mAppId.clear();
+  }
+
+  if( !shellClient->mSurface )
+  {
+    pepper_object_set_user_data( reinterpret_cast< pepper_object_t* >( shellClient->mSurface ), pepper_surface_get_role( shellClient->mSurface ), NULL, NULL );
+  }
+
+  shellClient->mSurfaceResource = NULL;
+
+  DALI_LOG_INFO( gPepperShellClientLogging, Debug::Verbose, "ShellClient::SurfaceResourceDestroy: surface = %p\n", shellClient->mSurface );
+}
+
+void ShellClient::OnSurfaceDestroy( pepper_event_listener_t* listener, pepper_object_t* surface, uint32_t id, void* info, void* data )
+{
+  ShellClient* shellClient = static_cast< ShellClient* >( data );
+
+  shellClient->mSurface = NULL;
+
+  DALI_LOG_INFO( gPepperShellClientLogging, Debug::Verbose, "ShellClient::OnSurfaceDestroy: surface = %p\n", surface );
+}
+
+void ShellClient::OnSurfaceCommit( pepper_event_listener_t* listener, pepper_object_t* surface, uint32_t id, void* info, void* data )
+{
+  ShellClient* shellClient = static_cast< ShellClient* >( data );
+
+  if( !shellClient->mSurfaceMapped )
+  {
+    pepper_view_map( shellClient->mView );
+
+    shellClient->mSurfaceMapped = true;
+  }
+}
+
+} // namespace Internal
+
+} // namespace Pepper
+
+} // namespace Dali
diff --git a/pepper-dali/internal/shell-client-impl.h b/pepper-dali/internal/shell-client-impl.h
new file mode 100644 (file)
index 0000000..f414675
--- /dev/null
@@ -0,0 +1,142 @@
+#ifndef __DALI_PEPPER_INTERNAL_SHELL_CLIENT_H__
+#define __DALI_PEPPER_INTERNAL_SHELL_CLIENT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/shell-client.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/object/base-object.h>
+#include <wayland-server.h>
+#include <pepper.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+class ShellClient;
+typedef IntrusivePtr<ShellClient> ShellClientPtr;
+
+class ShellClient : public BaseObject
+{
+public:
+
+  typedef void (*ConfigureCallback)( void* data, int width, int height );
+
+  static ShellClientPtr New( Pepper::Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id );
+
+  void Configure( int width, int height, ConfigureCallback callback, void* data );
+  void AckConfigure();
+
+  pepper_view_t* GetView();
+  void GetSurface( wl_client* client, unsigned int id, wl_resource* surfaceResource );
+
+  void SetTitle( const std::string title );
+  std::string GetTitle() const;
+
+  void SetAppId( const std::string appId );
+  std::string GetAppId() const;
+
+private:
+
+  /**
+   * Construct a new ShellClient.
+   */
+  ShellClient();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~ShellClient();
+
+  /**
+   * Second-phase constructor. Must be called immediately after creating a new ShellClient;
+   */
+  void Initialize( Pepper::Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id );
+
+  static void SurfaceResourceDestroy( struct wl_resource* resource );
+  static void OnSurfaceDestroy( pepper_event_listener_t* listener, pepper_object_t* surface, uint32_t id, void* info, void* data );
+  static void OnSurfaceCommit( pepper_event_listener_t* listener, pepper_object_t* surface, uint32_t id, void* info, void* data );
+
+private:
+
+  // Undefined
+  ShellClient( const ShellClient& );
+
+  // Undefined
+  ShellClient& operator=( const ShellClient& rhs );
+
+private: // Data
+
+  Pepper::Compositor mCompositor;
+
+  wl_resource* mClient;
+  wl_resource* mSurfaceResource;
+
+  pepper_surface_t* mSurface;
+  pepper_view_t* mView;
+
+  pepper_event_listener_t* mSurfaceDestroyListener;
+  pepper_event_listener_t* mSurfaceCommitListener;
+
+  std::string mTitle;
+  std::string mAppId;
+
+  bool mSurfaceMapped;
+  bool mAckConfigure;
+
+  ConfigureCallback mConfigureCallback;
+  void* mConfigureCallbackData;
+  int mWidth;
+  int mHeight;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Pepper::Internal::ShellClient& GetImplementation( Pepper::ShellClient& shellClient )
+{
+  DALI_ASSERT_ALWAYS( shellClient && "ShellClient handle is empty" );
+
+  BaseObject& handle = shellClient.GetBaseObject();
+
+  return static_cast< Internal::ShellClient& >( handle );
+}
+
+inline const Pepper::Internal::ShellClient& GetImplementation( const Pepper::ShellClient& shellClient )
+{
+  DALI_ASSERT_ALWAYS( shellClient && "ShellClient handle is empty" );
+
+  const BaseObject& handle = shellClient.GetBaseObject();
+
+  return static_cast< const Internal::ShellClient& >( handle );
+}
+
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_INTERNAL_SHELL_CLIENT_H__
diff --git a/pepper-dali/internal/shell-client.cpp b/pepper-dali/internal/shell-client.cpp
new file mode 100644 (file)
index 0000000..e8b2f9c
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/shell-client.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/shell-client-impl.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+ShellClient ShellClient::New( Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id )
+{
+  Internal::ShellClientPtr internal = Internal::ShellClient::New( compositor, client, version, id );
+
+  return ShellClient( internal.Get() );
+}
+
+ShellClient ShellClient::DownCast( BaseHandle handle )
+{
+  return ShellClient( dynamic_cast< Internal::ShellClient* >( handle.GetObjectPtr() ) );
+}
+
+ShellClient::ShellClient()
+{
+}
+
+ShellClient::ShellClient( const ShellClient& handle )
+: BaseHandle(handle)
+{
+}
+
+ShellClient& ShellClient::operator=( const ShellClient& handle )
+{
+  BaseHandle::operator=(handle);
+  return *this;
+}
+
+ShellClient::~ShellClient()
+{
+}
+
+ShellClient::ShellClient( Internal::ShellClient* implementation )
+: BaseHandle( implementation )
+{
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/pepper-dali/internal/shell-client.h b/pepper-dali/internal/shell-client.h
new file mode 100644 (file)
index 0000000..69ab812
--- /dev/null
@@ -0,0 +1,118 @@
+#ifndef __DALI_PEPPER_SHELL_CLIENT_H__
+#define __DALI_PEPPER_SHELL_CLIENT_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/public-api/compositor/compositor.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+#include <wayland-server.h>
+#include <pepper.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal DALI_INTERNAL
+{
+class ShellClient;
+}
+
+/**
+ * @addtogroup dali_pepper_compositor
+ * @{
+ */
+
+class ShellClient : public BaseHandle
+{
+public:
+
+  /**
+   * @brief Create ShellClient.
+   *
+   * @since_tizen 3.0
+   * @return A handle to ShellClient.
+   */
+  static ShellClient New( Compositor compositor, struct wl_client* client, uint32_t version, uint32_t id );
+
+  /**
+   * @brief Downcast a handle to ShellClient handle.
+   *
+   * If the BaseHandle points is a ShellClient the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a ShellClient or an empty handle
+   */
+  static ShellClient DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an empty handle.
+   * @since_tizen 3.0
+   */
+  ShellClient();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  ShellClient( const ShellClient& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  ShellClient& operator=( const ShellClient& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~ShellClient();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the Pepper::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The ShellClient implementation.
+   */
+  explicit DALI_INTERNAL ShellClient( Internal::ShellClient* implementation );
+};
+
+/**
+ * @}
+ */
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_SHELL_CLIENT_H__
diff --git a/pepper-dali/internal/shell-impl.cpp b/pepper-dali/internal/shell-impl.cpp
new file mode 100644 (file)
index 0000000..49875ce
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/shell-impl.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/compositor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <xdg-shell-server-protocol.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gPepperShellLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_PEPPER_SHELL" );
+#endif
+
+static void ClientDestroyed( struct wl_listener* listener, void* data )
+{
+  ShellClientInfo* shellClientInfo = wl_container_of( listener, shellClientInfo, mDestroyListner );
+
+  shellClientInfo->mShell->OnClientDestroyed( shellClientInfo->mShellClient );
+}
+
+} // unnamed namespace
+
+ShellPtr Shell::New( Pepper::Compositor compositor )
+{
+  ShellPtr impl = new Shell();
+
+  // Second-phase init of the implementation
+  impl->Initialize( compositor );
+
+  return impl;
+}
+
+Shell::Shell()
+: mShellClientList()
+{
+}
+
+Shell::~Shell()
+{
+  mShellClientList.clear();
+}
+
+void Shell::Initialize( Pepper::Compositor& compositor )
+{
+  struct wl_display* display;
+
+  mCompositor = compositor;
+
+  display = pepper_compositor_get_display( static_cast< pepper_compositor_t* >( Pepper::GetImplementation( compositor ).GetCompositorHandle() ) );
+
+  if( !wl_global_create( display, &xdg_shell_interface, 1, this, Shell::OnBind ) )
+  {
+    DALI_LOG_INFO( gPepperShellLogging, Debug::General, "wl_global_create is failed\n" );
+  }
+
+  DALI_LOG_INFO( gPepperShellLogging, Debug::Verbose, "Shell::Initialize: success\n" );
+}
+
+void Shell::OnBind( struct wl_client* client, void* data, uint32_t version, uint32_t id )
+{
+  Shell* shell = static_cast< Shell* >( data );
+
+  Pepper::ShellClient shellClient = Pepper::ShellClient::New( shell->mCompositor, client, version, id );
+
+  shell->mShellClientList.push_back( shellClient );
+
+  ShellClientInfo* shellClientInfo = new ShellClientInfo;
+
+  shellClientInfo->mShell = shell;
+  shellClientInfo->mShellClient = shellClient;
+  shellClientInfo->mDestroyListner.notify = ClientDestroyed;
+
+  wl_client_add_destroy_listener( client, &shellClientInfo->mDestroyListner );
+
+  DALI_LOG_INFO( gPepperShellLogging, Debug::Verbose, "Shell::OnBind: success\n" );
+}
+
+void Shell::OnClientDestroyed( Pepper::ShellClient shellClient )
+{
+  for ( std::vector< Pepper::ShellClient >::iterator iter = mShellClientList.begin(); mShellClientList.end() != iter; ++iter )
+  {
+    if( *iter == shellClient )
+    {
+      mShellClientList.erase( iter );
+    }
+  }
+
+  DALI_LOG_INFO( gPepperShellLogging, Debug::Verbose, "Shell::OnClientDestroyed: success\n" );
+}
+
+} // namespace Internal
+
+} // namespace Pepper
+
+} // namespace Dali
diff --git a/pepper-dali/internal/shell-impl.h b/pepper-dali/internal/shell-impl.h
new file mode 100644 (file)
index 0000000..9a12fec
--- /dev/null
@@ -0,0 +1,117 @@
+#ifndef __DALI_PEPPER_INTERNAL_SHELL_H__
+#define __DALI_PEPPER_INTERNAL_SHELL_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/shell.h>
+#include <pepper-dali/internal/shell-client.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/object/base-object.h>
+#include <wayland-server.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal
+{
+
+class Shell;
+typedef IntrusivePtr<Shell> ShellPtr;
+
+struct ShellClientInfo
+{
+  ShellPtr mShell;
+  Pepper::ShellClient mShellClient;
+  struct wl_listener mDestroyListner;
+};
+
+class Shell : public BaseObject
+{
+public:
+
+  static ShellPtr New( Pepper::Compositor compositor );
+
+  void OnClientDestroyed( Pepper::ShellClient shellClient );
+
+private:
+
+  /**
+   * Construct a new Shell.
+   */
+  Shell();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~Shell();
+
+  /**
+   * Second-phase constructor. Must be called immediately after creating a new Shell;
+   */
+  void Initialize( Pepper::Compositor& compositor );
+
+  static void OnBind( struct wl_client* client, void* data, uint32_t version, uint32_t id );
+
+private:
+
+  // Undefined
+  Shell( const Shell& );
+
+  // Undefined
+  Shell& operator=( const Shell& rhs );
+
+private: // Data
+
+  Pepper::Compositor mCompositor;
+
+  std::vector<Pepper::ShellClient> mShellClientList;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Pepper::Internal::Shell& GetImplementation( Pepper::Shell& shell )
+{
+  DALI_ASSERT_ALWAYS( shell && "Shell handle is empty" );
+
+  BaseObject& handle = shell.GetBaseObject();
+
+  return static_cast< Internal::Shell& >( handle );
+}
+
+inline const Pepper::Internal::Shell& GetImplementation( const Pepper::Shell& shell )
+{
+  DALI_ASSERT_ALWAYS( shell && "Shell handle is empty" );
+
+  const BaseObject& handle = shell.GetBaseObject();
+
+  return static_cast< const Internal::Shell& >( handle );
+}
+
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_INTERNAL_SHELL_H__
diff --git a/pepper-dali/internal/shell.cpp b/pepper-dali/internal/shell.cpp
new file mode 100644 (file)
index 0000000..37bbbdb
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/internal/shell.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/shell-impl.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+Shell Shell::New( Compositor compositor )
+{
+  Internal::ShellPtr internal = Internal::Shell::New( compositor );
+
+  return Shell( internal.Get() );
+}
+
+Shell Shell::DownCast( BaseHandle handle )
+{
+  return Shell( dynamic_cast< Internal::Shell* >( handle.GetObjectPtr() ) );
+}
+
+Shell::Shell()
+{
+}
+
+Shell::Shell( const Shell& handle )
+: BaseHandle(handle)
+{
+}
+
+Shell& Shell::operator=( const Shell& handle )
+{
+  BaseHandle::operator=(handle);
+  return *this;
+}
+
+Shell::~Shell()
+{
+}
+
+Shell::Shell( Internal::Shell* implementation )
+: BaseHandle( implementation )
+{
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/pepper-dali/internal/shell.h b/pepper-dali/internal/shell.h
new file mode 100644 (file)
index 0000000..5657194
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef __DALI_PEPPER_SHELL_H__
+#define __DALI_PEPPER_SHELL_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/public-api/compositor/compositor.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Shell;
+}
+
+/**
+ * @addtogroup dali_pepper_compositor
+ * @{
+ */
+
+class Shell : public BaseHandle
+{
+public:
+
+  /**
+   * @brief Create Shell.
+   *
+   * @since_tizen 3.0
+   * @return A handle to Shell.
+   */
+  static Shell New( Compositor compositor );
+
+  /**
+   * @brief Downcast a handle to Shell handle.
+   *
+   * If the BaseHandle points is a Shell the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a Shell or an empty handle
+   */
+  static Shell DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an empty handle.
+   * @since_tizen 3.0
+   */
+  Shell();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  Shell( const Shell& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  Shell& operator=( const Shell& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~Shell();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the Pepper::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The Shell implementation.
+   */
+  explicit DALI_INTERNAL Shell( Internal::Shell* implementation );
+};
+
+/**
+ * @}
+ */
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_SHELL_H__
diff --git a/pepper-dali/public-api/compositor/compositor.cpp b/pepper-dali/public-api/compositor/compositor.cpp
new file mode 100644 (file)
index 0000000..026199a
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/public-api/compositor/compositor.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/compositor-impl.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+Compositor Compositor::New( Application application, const std::string& name )
+{
+  Internal::CompositorPtr internal = Internal::Compositor::New( application, name );
+
+  return Compositor( internal.Get() );
+}
+
+Compositor Compositor::DownCast( BaseHandle handle )
+{
+  return Compositor( dynamic_cast< Internal::Compositor* >( handle.GetObjectPtr() ) );
+}
+
+Compositor::Compositor()
+{
+}
+
+Compositor::Compositor( const Compositor& handle )
+: BaseHandle(handle)
+{
+}
+
+Compositor& Compositor::operator=( const Compositor& handle )
+{
+  BaseHandle::operator=(handle);
+  return *this;
+}
+
+Compositor::~Compositor()
+{
+}
+
+Compositor::Compositor( Internal::Compositor* implementation )
+: BaseHandle( implementation )
+{
+}
+
+Compositor::CompositorSignalType& Compositor::ObjectViewAddedSignal()
+{
+  return GetImplementation(*this).ObjectViewAddedSignal();
+}
+
+Compositor::CompositorSignalType& Compositor::ObjectViewDeletedSignal()
+{
+  return GetImplementation(*this).ObjectViewDeletedSignal();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/pepper-dali/public-api/compositor/compositor.h b/pepper-dali/public-api/compositor/compositor.h
new file mode 100644 (file)
index 0000000..9123637
--- /dev/null
@@ -0,0 +1,148 @@
+#ifndef __DALI_PEPPER_COMPOSITOR_H__
+#define __DALI_PEPPER_COMPOSITOR_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <pepper-dali/public-api/object-view/object-view.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/adaptor-framework/application.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Compositor;
+}
+
+/**
+ * @addtogroup dali_pepper_compositor
+ * @{
+ */
+
+/**
+ * @brief Compositor is the embedding compositor that serve surfaces of clients as DALi Actor
+ * and deliver input events to clients.
+ *
+ * ObjectView is added when the client surface is created and object view added signal is emitted.
+ *
+ * @since_tizen 3.0
+ */
+class DALI_IMPORT_API Compositor : public BaseHandle
+{
+public:
+
+  /**
+   * @brief Create the embedding compositer.
+   *
+   * @since_tizen 3.0
+   * @param[in] application Application class for the embedding compositor
+   * @param[in] name Socket name
+   * @return A handle to Compositor.
+   */
+  static Compositor New( Application application, const std::string& name );
+
+  /**
+   * @brief Downcast a handle to Compositor handle.
+   *
+   * If the BaseHandle points is a Compositor the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a Compositor or an empty handle
+   */
+  static Compositor DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an empty handle.
+   * @since_tizen 3.0
+   */
+  Compositor();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  Compositor( const Compositor& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  Compositor& operator=( const Compositor& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~Compositor();
+
+public: //Signals
+
+  typedef Signal< void ( Compositor, ObjectView ) > CompositorSignalType;   ///< Compositor signal type @since_tizen 3.0
+
+  /**
+   * @brief This signal is emitted when the client surface is created and ObjectView is added.
+   *
+   * @since_tizen 3.0
+   * @return The signal to connect to.
+   */
+  CompositorSignalType& ObjectViewAddedSignal();
+
+  /**
+   * @brief This signal is emitted when the client surface is deleted and ObjectView is deleted.
+   *
+   * @since_tizen 3.0
+   * @return The signal to connect to.
+   */
+  CompositorSignalType& ObjectViewDeletedSignal();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the Pepper::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The Compositor implementation.
+   */
+  explicit DALI_INTERNAL Compositor( Internal::Compositor* implementation );
+};
+
+/**
+ * @}
+ */
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_COMPOSITOR_H__
diff --git a/pepper-dali/public-api/file.list b/pepper-dali/public-api/file.list
new file mode 100644 (file)
index 0000000..6a0e2a7
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# Add public-api source files here
+#
+
+public_api_src_files = \
+  $(public_api_src_dir)/compositor/compositor.cpp \
+  $(public_api_src_dir)/object-view/object-view.cpp
+
+public_api_compositor_header_files = \
+  $(public_api_src_dir)/compositor/compositor.h
+
+public_api_object_view_header_files = \
+  $(public_api_src_dir)/object-view/object-view.h
+
+public_api_header_files = \
+  $(public_api_src_dir)/pepper-dali.h
+
diff --git a/pepper-dali/public-api/object-view/object-view.cpp b/pepper-dali/public-api/object-view/object-view.cpp
new file mode 100644 (file)
index 0000000..9485151
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <pepper-dali/public-api/object-view/object-view.h>
+
+// INTERNAL INCLUDES
+#include <pepper-dali/internal/object-view-impl.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+ObjectView ObjectView::New()
+{
+  return Internal::ObjectView::New();
+}
+
+ObjectView ObjectView::DownCast( BaseHandle handle )
+{
+  return Toolkit::Control::DownCast<ObjectView, Internal::ObjectView>( handle );
+}
+
+ObjectView::ObjectView()
+{
+}
+
+ObjectView::ObjectView( const ObjectView& handle )
+: Toolkit::Control( handle )
+{
+}
+
+ObjectView& ObjectView::operator=( const ObjectView& handle )
+{
+  if( &handle != this )
+  {
+    Control::operator=( handle );
+  }
+  return *this;
+}
+
+ObjectView::~ObjectView()
+{
+}
+
+void ObjectView::SetImage( Image image )
+{
+  Dali::Pepper::GetImplementation( *this ).SetImage( image );
+}
+
+pid_t ObjectView::GetPid() const
+{
+  return Dali::Pepper::GetImplementation( *this ).GetPid();
+}
+
+std::string ObjectView::GetTitle() const
+{
+  return Dali::Pepper::GetImplementation( *this ).GetTitle();
+}
+
+std::string ObjectView::GetAppId() const
+{
+  return Dali::Pepper::GetImplementation( *this ).GetAppId();
+}
+
+ObjectView::ObjectView( Internal::ObjectView& implementation )
+: Control( implementation )
+{
+}
+
+ObjectView::ObjectView( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+  VerifyCustomActorPointer<Internal::ObjectView>( internal );
+}
+
+} // namespace Pepper
+
+} // namespace Dali
diff --git a/pepper-dali/public-api/object-view/object-view.h b/pepper-dali/public-api/object-view/object-view.h
new file mode 100644 (file)
index 0000000..2e8d83b
--- /dev/null
@@ -0,0 +1,160 @@
+#ifndef __DALI_PEPPER_OBJECT_VIEW_H__
+#define __DALI_PEPPER_OBJECT_VIEW_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+
+namespace Dali
+{
+
+namespace Pepper
+{
+
+namespace Internal DALI_INTERNAL
+{
+class ObjectView;
+}
+
+/**
+ * @addtogroup dali_pepper_compositor
+ * @{
+ */
+
+/**
+ * @brief ObjectView is a container for images of client surfaces. It displays the images.
+ * And input events that ObjectView gets are delivered to the client.
+ *
+ * @since_tizen 3.0
+ */
+class DALI_IMPORT_API ObjectView : public Toolkit::Control
+{
+public:
+
+  /**
+   * @brief Create object view.
+   *
+   * @since_tizen 3.0
+   * @return A handle to ObjectView.
+   */
+  static ObjectView New();
+
+  /**
+   * @brief Downcast a handle to ObjectView handle.
+   *
+   * If the BaseHandle points is a ObjectView the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a ObjectView or an empty handle
+   */
+  static ObjectView DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an empty handle.
+   * @since_tizen 3.0
+   */
+  ObjectView();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  ObjectView( const ObjectView& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  ObjectView& operator=( const ObjectView& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~ObjectView();
+
+  /**
+   * @brief Sets this ObjectView from an Image.
+   *
+   * If the handle is empty, ObjectView will display nothing.
+   * @since_tizen 3.0
+   * @param[in] image The Image to display.
+   */
+  void SetImage( Image image );
+
+  /**
+   * @brief Gets pid of the client.
+   *
+   * @since_tizen 3.0
+   * @return pid on success, otherwise 0.
+   */
+  pid_t GetPid() const;
+
+  /**
+   * @brief Gets title of the client.
+   *
+   * @since_tizen 3.0
+   * @return title on success, otherwise empty string.
+   */
+  std::string GetTitle() const;
+
+  /**
+   * @brief Gets app id of the client.
+   *
+   * @since_tizen 3.0
+   * @return app id on success, otherwise empty string.
+   */
+  std::string GetAppId() const;
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the ObjectView::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The ObjectView implementation.
+   */
+  DALI_INTERNAL ObjectView( Internal::ObjectView& implementation );
+
+  /**
+   * @brief Allows the creation of this control from an Internal::CustomActor pointer.
+   *
+   * @since_tizen 3.0
+   * @param[in] internal A pointer to the internal CustomActor.
+   */
+  DALI_INTERNAL ObjectView( Dali::Internal::CustomActor* internal );
+};
+
+/**
+ * @}
+ */
+} // namespace Pepper
+
+} // namespace Dali
+
+#endif // __DALI_PEPPER_OBJECT_VIEW_H__
diff --git a/pepper-dali/public-api/pepper-dali.h b/pepper-dali/public-api/pepper-dali.h
new file mode 100644 (file)
index 0000000..a7de96b
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __PEPPER_DALI_H__
+#define __PEPPER_DALI_H__
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <pepper-dali/public-api/compositor/compositor.h>
+#include <pepper-dali/public-api/object-view/object-view.h>
+
+#endif  // __PEPPER_DALI_H__