Introduce webos_foreign

Change-Id: I407d4b73f289d07d9139cf0ad8c7ff68009dd2b4
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 3aec008..35104d2 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2013-2018 LG Electronics, Inc.
+# Copyright (c) 2013-2019 LG Electronics, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
 wayland_client_protocol(${CMAKE_SOURCE_DIR}/protocol/input-method.xml SOURCES input-method)
 wayland_client_protocol(${CMAKE_SOURCE_DIR}/protocol/webos-input-manager.xml SOURCES webos-input-manager)
 wayland_client_protocol(${CMAKE_SOURCE_DIR}/protocol/webos-extension.xml SOURCES webos-extension)
+wayland_client_protocol(${CMAKE_SOURCE_DIR}/protocol/webos-foreign.xml SOURCES webos-foreign)
 
 webos_add_linker_options(ALL --no-undefined)
 
diff --git a/protocol/webos-foreign.xml b/protocol/webos-foreign.xml
new file mode 100644
index 0000000..e131bec
--- /dev/null
+++ b/protocol/webos-foreign.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="webos_foreign">
+
+    <copyright>
+      Copyright (c) 2018-2019 LG Electronics, Inc.
+
+      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.
+    </copyright>
+
+    <interface name="wl_webos_foreign" version="1">
+      <description summary="entry point for webos_foreign"/>
+
+      <request name="destroy" type="destructor"/>
+
+      <enum name="webos_exported_type">
+        <description summary="type of webos_exported"/>
+        <entry name="video_object" value="0" summary="exported window for video object"/>
+        <entry name="subtitle_object" value="1" summary="exported window for subtitle object"/>
+      </enum>
+
+      <request name="export_element">
+        <description summary="create webos_exported"/>
+        <arg name="id" type="new_id" interface="wl_webos_exported"/>
+        <arg name="surface" type="object" interface="wl_surface"/>
+        <arg name="exported_type" type="uint"/>
+      </request>
+
+      <request name="import_element">
+        <description summary="create webos_imported"/>
+        <arg name="id" type="new_id" interface="wl_webos_imported"/>
+        <arg name="window_id" type="string" summary="window_id of associated exported window assigned by compositor"/>
+        <arg name="exported_type" type="uint"/>
+      </request>
+    </interface>
+
+    <interface name="wl_webos_exported" version="1">
+        <description summary="exported window"/>
+
+        <request name="destroy" type="destructor"/>
+
+        <request name="set_exported_window">
+            <description summary="set window to be exported"/>
+            <arg name="source_region" type="object" interface="wl_region" summary="source region of exported window"/>
+            <arg name="destination_region" type="object" interface="wl_region" summary="destination region of exported window"/>
+        </request>
+
+        <event name="window_id_assigned">
+            <description summary="window is associated with this wl_webos_exported"/>
+            <arg name="window_id" type="string" summary="window_id of associated exported window"/>
+            <arg name="exported_type" type="uint"/>
+        </event>
+
+    </interface>
+
+    <interface name="wl_webos_imported" version="1">
+        <description summary="imported content or punchthrough to be placed in exported window"/>
+
+        <enum name="surface_alignment" bitfield="true">
+            <entry name="stretch" value="0"/>
+            <entry name="north" value="1"/>
+            <entry name="west" value="2"/>
+            <entry name="south" value="4"/>
+            <entry name="east" value="8"/>
+            <entry name="center" value="16"/>
+        </enum>
+
+        <request name="set_surface_alignment">
+          <arg name="format" type="uint" enum="surface_alignment" summary="alignment the texture onto export"/>
+        </request>
+
+        <request name="destroy" type="destructor"/>
+
+        <request name="attach_punchthrough">
+            <description summary="attach punchthrough to webos_imported"/>
+        </request>
+
+        <request name="detach_punchthrough">
+            <description summary="detach punchthrough from webos_imported"/>
+        </request>
+
+        <request name="attach_surface">
+            <description summary="attach surface to webos_imported"/>
+            <arg name="surface" type="object" interface="wl_surface"/>
+        </request>
+
+        <request name="detach_surface">
+          <description summary="detach surface from webos_imported"/>
+          <arg name="surface" type="object" interface="wl_surface"/>
+        </request>
+
+        <event name="destination_region_changed">
+            <description summary="destination region of associated exported window has changed"/>
+            <arg name="width" type="uint" summary="destination width of exported window"/>
+            <arg name="height" type="uint" summary="destination height of exported window"/>
+        </event>
+    </interface>
+</protocol>
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index 4c72161..0f68f29 100644
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2013-2018 LG Electronics, Inc.
+# Copyright (c) 2013-2019 LG Electronics, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
 wayland_server_protocol(${CMAKE_SOURCE_DIR}/protocol/input-method.xml SOURCES input-method)
 wayland_server_protocol(${CMAKE_SOURCE_DIR}/protocol/webos-input-manager.xml SOURCES webos-input-manager)
 wayland_server_protocol(${CMAKE_SOURCE_DIR}/protocol/webos-extension.xml SOURCES webos-extension)
+wayland_server_protocol(${CMAKE_SOURCE_DIR}/protocol/webos-foreign.xml SOURCES webos-foreign)
 
 webos_add_linker_options(ALL --no-undefined)