From e52f1975800ecf6553312de6ec6d1438b8536d2b Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 8 Jun 2020 18:40:16 +0900 Subject: [PATCH 01/16] DSCanvas: add initial code for DSCanvas add initial DSCanvas class and testcase for it. Change-Id: Id99ad0553f0541190554b8b32d0d9fb8d79ed784 --- meson.build | 1 + src/lib/DSCanvas/DSCanvas.cpp | 12 ++++++++++++ src/lib/DSCanvas/DSCanvas.h | 17 +++++++++++++++++ tests/DSCanvas-test.cpp | 18 ++++++++++++++++++ tests/meson.build | 2 ++ 5 files changed, 50 insertions(+) create mode 100644 src/lib/DSCanvas/DSCanvas.cpp create mode 100644 src/lib/DSCanvas/DSCanvas.h create mode 100644 tests/DSCanvas-test.cpp diff --git a/meson.build b/meson.build index 73d54af..8e08864 100644 --- a/meson.build +++ b/meson.build @@ -49,6 +49,7 @@ src_libds = [ 'src/lib/DSCompositor/DSCompositor.cpp', 'src/lib/DSOutput/DSOutput.cpp', 'src/lib/DSInput/DSInput.cpp', + 'src/lib/DSCanvas/DSCanvas.cpp', ] pkgconfig = import('pkgconfig') diff --git a/src/lib/DSCanvas/DSCanvas.cpp b/src/lib/DSCanvas/DSCanvas.cpp new file mode 100644 index 0000000..ad02a95 --- /dev/null +++ b/src/lib/DSCanvas/DSCanvas.cpp @@ -0,0 +1,12 @@ +#include "DSCanvas.h" + +namespace display_server +{ + DSCanvas::DSCanvas() + { + } + + DSCanvas::~DSCanvas() + { + } +} // namespace display_server \ No newline at end of file diff --git a/src/lib/DSCanvas/DSCanvas.h b/src/lib/DSCanvas/DSCanvas.h new file mode 100644 index 0000000..f0e69aa --- /dev/null +++ b/src/lib/DSCanvas/DSCanvas.h @@ -0,0 +1,17 @@ +#ifndef _DSCANVAS_H_ +#define _DSCANVAS_H_ + +namespace display_server +{ + class DSCanvas + { + public: + DSCanvas(); + virtual ~DSCanvas(); + + private: + /* data */ + }; +} + +#endif \ No newline at end of file diff --git a/tests/DSCanvas-test.cpp b/tests/DSCanvas-test.cpp new file mode 100644 index 0000000..ac1f5ed --- /dev/null +++ b/tests/DSCanvas-test.cpp @@ -0,0 +1,18 @@ +#include "libds-tests.h" +#include "DSCanvas.h" + +using namespace display_server; + +class DSCanvasTest : public ::testing::Test +{ +public: + void SetUp(void) override {} + void TearDown(void) override {} +}; + +TEST_F(DSCanvasTest, NewDSCanvas) +{ + DSCanvas *canvas = new DSCanvas; + delete canvas; + ASSERT_TRUE(true); +} diff --git a/tests/meson.build b/tests/meson.build index 0ede0e7..00c4b33 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -5,6 +5,7 @@ incdir = include_directories( '../src/lib/DSCompositor', '../src/lib/DSOutput', '../src/lib/DSInput', + '../src/lib/DSCanvas', ) libds_unittests_src = [ @@ -17,6 +18,7 @@ libds_unittests_src = [ 'DSCompositor-test.cpp', 'DSOutput-test.cpp', 'DSInput-test.cpp', + 'DSCanvas-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From 173069899a700e6ab7738a13e52734852244b178 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 8 Jun 2020 18:51:02 +0900 Subject: [PATCH 02/16] DSSeat: add initial code for DSSeat add initial DSSeat class and testcase for it. Change-Id: Iaf71bad6c99506b85689259f94af6aaed70136a2 --- meson.build | 1 + src/lib/DSSeat/DSSeat.cpp | 12 ++++++++++++ src/lib/DSSeat/DSSeat.h | 17 +++++++++++++++++ tests/DSSeat-test.cpp | 18 ++++++++++++++++++ tests/meson.build | 2 ++ 5 files changed, 50 insertions(+) create mode 100644 src/lib/DSSeat/DSSeat.cpp create mode 100644 src/lib/DSSeat/DSSeat.h create mode 100644 tests/DSSeat-test.cpp diff --git a/meson.build b/meson.build index 8e08864..64e47ed 100644 --- a/meson.build +++ b/meson.build @@ -50,6 +50,7 @@ src_libds = [ 'src/lib/DSOutput/DSOutput.cpp', 'src/lib/DSInput/DSInput.cpp', 'src/lib/DSCanvas/DSCanvas.cpp', + 'src/lib/DSSeat/DSSeat.cpp', ] pkgconfig = import('pkgconfig') diff --git a/src/lib/DSSeat/DSSeat.cpp b/src/lib/DSSeat/DSSeat.cpp new file mode 100644 index 0000000..9f9a1cd --- /dev/null +++ b/src/lib/DSSeat/DSSeat.cpp @@ -0,0 +1,12 @@ +#include "DSSeat.h" + +namespace display_server +{ + DSSeat::DSSeat() + { + } + + DSSeat::~DSSeat() + { + } +} // namespace display_server \ No newline at end of file diff --git a/src/lib/DSSeat/DSSeat.h b/src/lib/DSSeat/DSSeat.h new file mode 100644 index 0000000..d15176f --- /dev/null +++ b/src/lib/DSSeat/DSSeat.h @@ -0,0 +1,17 @@ +#ifndef _DSSEAT_H_ +#define _DSSEAT_H_ + +namespace display_server +{ + class DSSeat + { + public: + DSSeat(); + virtual ~DSSeat(); + + private: + /* data */ + }; +} + +#endif \ No newline at end of file diff --git a/tests/DSSeat-test.cpp b/tests/DSSeat-test.cpp new file mode 100644 index 0000000..a6c1e67 --- /dev/null +++ b/tests/DSSeat-test.cpp @@ -0,0 +1,18 @@ +#include "libds-tests.h" +#include "DSSeat.h" + +using namespace display_server; + +class DSSeatTest : public ::testing::Test +{ +public: + void SetUp(void) override {} + void TearDown(void) override {} +}; + +TEST_F(DSSeatTest, NewDSSeat) +{ + DSSeat *seat = new DSSeat; + delete seat; + ASSERT_TRUE(true); +} diff --git a/tests/meson.build b/tests/meson.build index 00c4b33..9d7fbfd 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -6,6 +6,7 @@ incdir = include_directories( '../src/lib/DSOutput', '../src/lib/DSInput', '../src/lib/DSCanvas', + '../src/lib/DSSeat', ) libds_unittests_src = [ @@ -19,6 +20,7 @@ libds_unittests_src = [ 'DSOutput-test.cpp', 'DSInput-test.cpp', 'DSCanvas-test.cpp', + 'DSSeat-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From 5a462ab9b547e88fa37428782f2e8af876da404d Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 8 Jun 2020 19:01:37 +0900 Subject: [PATCH 03/16] DSPolicyArea: add initial code for DSPolicyArea add initial DSPolicyArea class and testcase for it. Change-Id: I124cc78a4c84292cc9383549f07bdf4cd30384d9 --- meson.build | 1 + src/lib/DSPolicyArea/DSPolicyArea.cpp | 12 ++++++++++++ src/lib/DSPolicyArea/DSPolicyArea.h | 17 +++++++++++++++++ tests/DSPolicyArea-test.cpp | 18 ++++++++++++++++++ tests/meson.build | 2 ++ 5 files changed, 50 insertions(+) create mode 100644 src/lib/DSPolicyArea/DSPolicyArea.cpp create mode 100644 src/lib/DSPolicyArea/DSPolicyArea.h create mode 100644 tests/DSPolicyArea-test.cpp diff --git a/meson.build b/meson.build index 64e47ed..cfdf325 100644 --- a/meson.build +++ b/meson.build @@ -51,6 +51,7 @@ src_libds = [ 'src/lib/DSInput/DSInput.cpp', 'src/lib/DSCanvas/DSCanvas.cpp', 'src/lib/DSSeat/DSSeat.cpp', + 'src/lib/DSPolicyArea/DSPolicyArea.cpp', ] pkgconfig = import('pkgconfig') diff --git a/src/lib/DSPolicyArea/DSPolicyArea.cpp b/src/lib/DSPolicyArea/DSPolicyArea.cpp new file mode 100644 index 0000000..8e333d6 --- /dev/null +++ b/src/lib/DSPolicyArea/DSPolicyArea.cpp @@ -0,0 +1,12 @@ +#include "DSPolicyArea.h" + +namespace display_server +{ + DSPolicyArea::DSPolicyArea() + { + } + + DSPolicyArea::~DSPolicyArea() + { + } +} // namespace display_server \ No newline at end of file diff --git a/src/lib/DSPolicyArea/DSPolicyArea.h b/src/lib/DSPolicyArea/DSPolicyArea.h new file mode 100644 index 0000000..50653c9 --- /dev/null +++ b/src/lib/DSPolicyArea/DSPolicyArea.h @@ -0,0 +1,17 @@ +#ifndef _DSPOLICYAREA_H_ +#define _DSPOLICYAREA_H_ + +namespace display_server +{ + class DSPolicyArea + { + public: + DSPolicyArea(); + virtual ~DSPolicyArea(); + + private: + /* data */ + }; +} + +#endif \ No newline at end of file diff --git a/tests/DSPolicyArea-test.cpp b/tests/DSPolicyArea-test.cpp new file mode 100644 index 0000000..938fa83 --- /dev/null +++ b/tests/DSPolicyArea-test.cpp @@ -0,0 +1,18 @@ +#include "libds-tests.h" +#include "DSPolicyArea.h" + +using namespace display_server; + +class DSPolicyAreaTest : public ::testing::Test +{ +public: + void SetUp(void) override {} + void TearDown(void) override {} +}; + +TEST_F(DSPolicyAreaTest, NewDSPolicyArea) +{ + DSPolicyArea *policyArea = new DSPolicyArea; + delete policyArea; + ASSERT_TRUE(true); +} diff --git a/tests/meson.build b/tests/meson.build index 9d7fbfd..fc6658d 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -7,6 +7,7 @@ incdir = include_directories( '../src/lib/DSInput', '../src/lib/DSCanvas', '../src/lib/DSSeat', + '../src/lib/DSPolicyArea', ) libds_unittests_src = [ @@ -21,6 +22,7 @@ libds_unittests_src = [ 'DSInput-test.cpp', 'DSCanvas-test.cpp', 'DSSeat-test.cpp', + 'DSPolicyArea-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From ad5efacfc6dc6403a22975a56c12fcaeee673eca Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 8 Jun 2020 19:09:56 +0900 Subject: [PATCH 04/16] DSDisplayArea: add initial code for DSDisplayArea add initial DSDisplayArea class and testcase for it. Change-Id: Ibf4d30c86c73e7cd06fd21eb2356d89e9ad10fe2 --- meson.build | 1 + src/lib/DSDisplayArea/DSDisplayArea.cpp | 12 ++++++++++++ src/lib/DSDisplayArea/DSDisplayArea.h | 17 +++++++++++++++++ tests/DSDisplayArea-test.cpp | 18 ++++++++++++++++++ tests/meson.build | 2 ++ 5 files changed, 50 insertions(+) create mode 100644 src/lib/DSDisplayArea/DSDisplayArea.cpp create mode 100644 src/lib/DSDisplayArea/DSDisplayArea.h create mode 100644 tests/DSDisplayArea-test.cpp diff --git a/meson.build b/meson.build index cfdf325..5862b62 100644 --- a/meson.build +++ b/meson.build @@ -52,6 +52,7 @@ src_libds = [ 'src/lib/DSCanvas/DSCanvas.cpp', 'src/lib/DSSeat/DSSeat.cpp', 'src/lib/DSPolicyArea/DSPolicyArea.cpp', + 'src/lib/DSDisplayArea/DSDisplayArea.cpp', ] pkgconfig = import('pkgconfig') diff --git a/src/lib/DSDisplayArea/DSDisplayArea.cpp b/src/lib/DSDisplayArea/DSDisplayArea.cpp new file mode 100644 index 0000000..5cc684d --- /dev/null +++ b/src/lib/DSDisplayArea/DSDisplayArea.cpp @@ -0,0 +1,12 @@ +#include "DSDisplayArea.h" + +namespace display_server +{ + DSDisplayArea::DSDisplayArea() + { + } + + DSDisplayArea::~DSDisplayArea() + { + } +} // namespace display_server \ No newline at end of file diff --git a/src/lib/DSDisplayArea/DSDisplayArea.h b/src/lib/DSDisplayArea/DSDisplayArea.h new file mode 100644 index 0000000..4892ba1 --- /dev/null +++ b/src/lib/DSDisplayArea/DSDisplayArea.h @@ -0,0 +1,17 @@ +#ifndef _DSDISPLAYAREA_H_ +#define _DSDISPLAYAREA_H_ + +namespace display_server +{ + class DSDisplayArea + { + public: + DSDisplayArea(); + virtual ~DSDisplayArea(); + + private: + /* data */ + }; +} + +#endif \ No newline at end of file diff --git a/tests/DSDisplayArea-test.cpp b/tests/DSDisplayArea-test.cpp new file mode 100644 index 0000000..b36c29b --- /dev/null +++ b/tests/DSDisplayArea-test.cpp @@ -0,0 +1,18 @@ +#include "libds-tests.h" +#include "DSDisplayArea.h" + +using namespace display_server; + +class DSDisplayAreaTest : public ::testing::Test +{ +public: + void SetUp(void) override {} + void TearDown(void) override {} +}; + +TEST_F(DSDisplayAreaTest, NewDSDisplayArea) +{ + DSDisplayArea *displayArea = new DSDisplayArea; + delete displayArea; + ASSERT_TRUE(true); +} diff --git a/tests/meson.build b/tests/meson.build index fc6658d..46c197a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -8,6 +8,7 @@ incdir = include_directories( '../src/lib/DSCanvas', '../src/lib/DSSeat', '../src/lib/DSPolicyArea', + '../src/lib/DSDisplayArea', ) libds_unittests_src = [ @@ -23,6 +24,7 @@ libds_unittests_src = [ 'DSCanvas-test.cpp', 'DSSeat-test.cpp', 'DSPolicyArea-test.cpp', + 'DSDisplayArea-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From 3bbfe3d037bff5d9082d5927ab8a6b8f23b9193b Mon Sep 17 00:00:00 2001 From: review-bot Date: Tue, 9 Jun 2020 09:07:23 +0900 Subject: [PATCH 05/16] Apply Coding Style Change-Id: I8c3c260f75eeabfc0b6a1c9653e3b0ebf2eb7ccf --- src/lib/DSCanvas/DSCanvas.cpp | 10 ++++------ src/lib/DSCanvas/DSCanvas.h | 16 ++++++++-------- src/lib/DSCompositor/DSCompositor.cpp | 10 ++++------ src/lib/DSCompositor/DSCompositor.h | 16 ++++++++-------- src/lib/DSDisplayArea/DSDisplayArea.cpp | 10 ++++------ src/lib/DSDisplayArea/DSDisplayArea.h | 16 ++++++++-------- src/lib/DSInput/DSInput.cpp | 10 ++++------ src/lib/DSInput/DSInput.h | 16 ++++++++-------- src/lib/DSOutput/DSOutput.cpp | 10 ++++------ src/lib/DSOutput/DSOutput.h | 16 ++++++++-------- src/lib/DSPolicyArea/DSPolicyArea.cpp | 10 ++++------ src/lib/DSPolicyArea/DSPolicyArea.h | 16 ++++++++-------- src/lib/DSSeat/DSSeat.cpp | 10 ++++------ src/lib/DSSeat/DSSeat.h | 16 ++++++++-------- tests/DSCanvas-test.cpp | 6 ++++-- tests/DSCompositor-test.cpp | 6 ++++-- tests/DSDisplayArea-test.cpp | 6 ++++-- tests/DSInput-test.cpp | 6 ++++-- tests/DSOutput-test.cpp | 6 ++++-- tests/DSPolicyArea-test.cpp | 6 ++++-- tests/DSSeat-test.cpp | 6 ++++-- 21 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/lib/DSCanvas/DSCanvas.cpp b/src/lib/DSCanvas/DSCanvas.cpp index ad02a95..3465c5f 100644 --- a/src/lib/DSCanvas/DSCanvas.cpp +++ b/src/lib/DSCanvas/DSCanvas.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSCanvas::DSCanvas() - { - } +DSCanvas::DSCanvas() +{} - DSCanvas::~DSCanvas() - { - } +DSCanvas::~DSCanvas() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSCanvas/DSCanvas.h b/src/lib/DSCanvas/DSCanvas.h index f0e69aa..47063ab 100644 --- a/src/lib/DSCanvas/DSCanvas.h +++ b/src/lib/DSCanvas/DSCanvas.h @@ -3,15 +3,15 @@ namespace display_server { - class DSCanvas - { - public: - DSCanvas(); - virtual ~DSCanvas(); +class DSCanvas +{ +public: + DSCanvas(); + virtual ~DSCanvas(); - private: - /* data */ - }; +private: + /* data */ +}; } #endif \ No newline at end of file diff --git a/src/lib/DSCompositor/DSCompositor.cpp b/src/lib/DSCompositor/DSCompositor.cpp index 7b58146..c345bfc 100644 --- a/src/lib/DSCompositor/DSCompositor.cpp +++ b/src/lib/DSCompositor/DSCompositor.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSCompositor::DSCompositor() - { - } +DSCompositor::DSCompositor() +{} - DSCompositor::~DSCompositor() - { - } +DSCompositor::~DSCompositor() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSCompositor/DSCompositor.h b/src/lib/DSCompositor/DSCompositor.h index 0f977fc..fb3ec50 100644 --- a/src/lib/DSCompositor/DSCompositor.h +++ b/src/lib/DSCompositor/DSCompositor.h @@ -3,15 +3,15 @@ namespace display_server { - class DSCompositor - { - public: - DSCompositor(); - virtual ~DSCompositor(); +class DSCompositor +{ +public: + DSCompositor(); + virtual ~DSCompositor(); - private: - /* data */ - }; +private: + /* data */ +}; } #endif \ No newline at end of file diff --git a/src/lib/DSDisplayArea/DSDisplayArea.cpp b/src/lib/DSDisplayArea/DSDisplayArea.cpp index 5cc684d..22239f9 100644 --- a/src/lib/DSDisplayArea/DSDisplayArea.cpp +++ b/src/lib/DSDisplayArea/DSDisplayArea.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSDisplayArea::DSDisplayArea() - { - } +DSDisplayArea::DSDisplayArea() +{} - DSDisplayArea::~DSDisplayArea() - { - } +DSDisplayArea::~DSDisplayArea() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSDisplayArea/DSDisplayArea.h b/src/lib/DSDisplayArea/DSDisplayArea.h index 4892ba1..586e5d4 100644 --- a/src/lib/DSDisplayArea/DSDisplayArea.h +++ b/src/lib/DSDisplayArea/DSDisplayArea.h @@ -3,15 +3,15 @@ namespace display_server { - class DSDisplayArea - { - public: - DSDisplayArea(); - virtual ~DSDisplayArea(); +class DSDisplayArea +{ +public: + DSDisplayArea(); + virtual ~DSDisplayArea(); - private: - /* data */ - }; +private: + /* data */ +}; } #endif \ No newline at end of file diff --git a/src/lib/DSInput/DSInput.cpp b/src/lib/DSInput/DSInput.cpp index 9606309..2950dc1 100644 --- a/src/lib/DSInput/DSInput.cpp +++ b/src/lib/DSInput/DSInput.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSInput::DSInput() - { - } +DSInput::DSInput() +{} - DSInput::~DSInput() - { - } +DSInput::~DSInput() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSInput/DSInput.h b/src/lib/DSInput/DSInput.h index f745b80..5269376 100644 --- a/src/lib/DSInput/DSInput.h +++ b/src/lib/DSInput/DSInput.h @@ -3,15 +3,15 @@ namespace display_server { - class DSInput - { - public: - DSInput(); - virtual ~DSInput(); +class DSInput +{ +public: + DSInput(); + virtual ~DSInput(); - private: - /* data */ - }; +private: + /* data */ +}; } #endif \ No newline at end of file diff --git a/src/lib/DSOutput/DSOutput.cpp b/src/lib/DSOutput/DSOutput.cpp index 7fe0a8c..61d33be 100644 --- a/src/lib/DSOutput/DSOutput.cpp +++ b/src/lib/DSOutput/DSOutput.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSOutput::DSOutput() - { - } +DSOutput::DSOutput() +{} - DSOutput::~DSOutput() - { - } +DSOutput::~DSOutput() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSOutput/DSOutput.h b/src/lib/DSOutput/DSOutput.h index f924af9..30f8387 100644 --- a/src/lib/DSOutput/DSOutput.h +++ b/src/lib/DSOutput/DSOutput.h @@ -3,15 +3,15 @@ namespace display_server { - class DSOutput - { - public: - DSOutput(); - virtual ~DSOutput(); +class DSOutput +{ +public: + DSOutput(); + virtual ~DSOutput(); - private: - /* data */ - }; +private: + /* data */ +}; } #endif \ No newline at end of file diff --git a/src/lib/DSPolicyArea/DSPolicyArea.cpp b/src/lib/DSPolicyArea/DSPolicyArea.cpp index 8e333d6..9ed13e4 100644 --- a/src/lib/DSPolicyArea/DSPolicyArea.cpp +++ b/src/lib/DSPolicyArea/DSPolicyArea.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSPolicyArea::DSPolicyArea() - { - } +DSPolicyArea::DSPolicyArea() +{} - DSPolicyArea::~DSPolicyArea() - { - } +DSPolicyArea::~DSPolicyArea() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSPolicyArea/DSPolicyArea.h b/src/lib/DSPolicyArea/DSPolicyArea.h index 50653c9..aeaa130 100644 --- a/src/lib/DSPolicyArea/DSPolicyArea.h +++ b/src/lib/DSPolicyArea/DSPolicyArea.h @@ -3,15 +3,15 @@ namespace display_server { - class DSPolicyArea - { - public: - DSPolicyArea(); - virtual ~DSPolicyArea(); +class DSPolicyArea +{ +public: + DSPolicyArea(); + virtual ~DSPolicyArea(); - private: - /* data */ - }; +private: + /* data */ +}; } #endif \ No newline at end of file diff --git a/src/lib/DSSeat/DSSeat.cpp b/src/lib/DSSeat/DSSeat.cpp index 9f9a1cd..559e703 100644 --- a/src/lib/DSSeat/DSSeat.cpp +++ b/src/lib/DSSeat/DSSeat.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSSeat::DSSeat() - { - } +DSSeat::DSSeat() +{} - DSSeat::~DSSeat() - { - } +DSSeat::~DSSeat() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSSeat/DSSeat.h b/src/lib/DSSeat/DSSeat.h index d15176f..c3e64ab 100644 --- a/src/lib/DSSeat/DSSeat.h +++ b/src/lib/DSSeat/DSSeat.h @@ -3,15 +3,15 @@ namespace display_server { - class DSSeat - { - public: - DSSeat(); - virtual ~DSSeat(); +class DSSeat +{ +public: + DSSeat(); + virtual ~DSSeat(); - private: - /* data */ - }; +private: + /* data */ +}; } #endif \ No newline at end of file diff --git a/tests/DSCanvas-test.cpp b/tests/DSCanvas-test.cpp index ac1f5ed..5efc393 100644 --- a/tests/DSCanvas-test.cpp +++ b/tests/DSCanvas-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSCanvasTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; TEST_F(DSCanvasTest, NewDSCanvas) diff --git a/tests/DSCompositor-test.cpp b/tests/DSCompositor-test.cpp index 3dc05a5..5b4639f 100644 --- a/tests/DSCompositor-test.cpp +++ b/tests/DSCompositor-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSComopsitorTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; TEST_F(DSComopsitorTest, NewDSCompositor) diff --git a/tests/DSDisplayArea-test.cpp b/tests/DSDisplayArea-test.cpp index b36c29b..2c660c6 100644 --- a/tests/DSDisplayArea-test.cpp +++ b/tests/DSDisplayArea-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSDisplayAreaTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; TEST_F(DSDisplayAreaTest, NewDSDisplayArea) diff --git a/tests/DSInput-test.cpp b/tests/DSInput-test.cpp index da5658e..657803c 100644 --- a/tests/DSInput-test.cpp +++ b/tests/DSInput-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSInputTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; TEST_F(DSInputTest, NewDSInput) diff --git a/tests/DSOutput-test.cpp b/tests/DSOutput-test.cpp index 69f6f6e..fb77982 100644 --- a/tests/DSOutput-test.cpp +++ b/tests/DSOutput-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSOutputTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; TEST_F(DSOutputTest, NewDSOutput) diff --git a/tests/DSPolicyArea-test.cpp b/tests/DSPolicyArea-test.cpp index 938fa83..a1a20e5 100644 --- a/tests/DSPolicyArea-test.cpp +++ b/tests/DSPolicyArea-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSPolicyAreaTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; TEST_F(DSPolicyAreaTest, NewDSPolicyArea) diff --git a/tests/DSSeat-test.cpp b/tests/DSSeat-test.cpp index a6c1e67..72c53d9 100644 --- a/tests/DSSeat-test.cpp +++ b/tests/DSSeat-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSSeatTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; TEST_F(DSSeatTest, NewDSSeat) -- 2.7.4 From a000555d51f6221e6d5e861668ed123d49a7580e Mon Sep 17 00:00:00 2001 From: review-bot Date: Thu, 9 Apr 2020 14:30:27 +0900 Subject: [PATCH 06/16] "[Reform] Apply Coding Style" Change-Id: I48cac0d4f8c51d5a6fe874e9921c5c8e11af4354 --- src/lib/DSRender/DSRenderEngine.cpp | 10 +++---- src/lib/DSRender/DSRenderEngine.h | 16 +++++------ src/lib/DSRender/DSRenderEngineDali.cpp | 10 +++---- src/lib/DSRender/DSRenderEngineDali.h | 16 +++++------ src/lib/DSRender/DSRenderEngineEcoreEvas.cpp | 10 +++---- src/lib/DSRender/DSRenderEngineEcoreEvas.h | 16 +++++------ src/lib/DSRender/DSRenderFactory.h | 16 +++++------ src/lib/DSRender/DSRenderFactoryDali.cpp | 40 +++++++++++++-------------- src/lib/DSRender/DSRenderFactoryDali.h | 22 +++++++-------- src/lib/DSRender/DSRenderFactoryEcoreEvas.cpp | 40 +++++++++++++-------------- src/lib/DSRender/DSRenderFactoryEcoreEvas.h | 22 +++++++-------- src/lib/DSRender/DSRenderSurface.cpp | 10 +++---- src/lib/DSRender/DSRenderSurface.h | 16 +++++------ src/lib/DSRender/DSRenderSurfaceDali.cpp | 10 +++---- src/lib/DSRender/DSRenderSurfaceDali.h | 16 +++++------ src/lib/DSRender/DSRenderSurfaceEcoreEvas.cpp | 10 +++---- src/lib/DSRender/DSRenderSurfaceEcoreEvas.h | 16 +++++------ src/lib/DSRender/DSRenderView.cpp | 10 +++---- src/lib/DSRender/DSRenderView.h | 16 +++++------ src/lib/DSRender/DSRenderViewDali.cpp | 10 +++---- src/lib/DSRender/DSRenderViewDali.h | 16 +++++------ src/lib/DSRender/DSRenderViewEcoreEvas.cpp | 10 +++---- src/lib/DSRender/DSRenderViewEcoreEvas.h | 16 +++++------ tests/DSRenderFactoryDali-test.cpp | 33 +++++++++++----------- tests/DSRenderFactoryEcoreEvas-test.cpp | 33 +++++++++++----------- 25 files changed, 210 insertions(+), 230 deletions(-) diff --git a/src/lib/DSRender/DSRenderEngine.cpp b/src/lib/DSRender/DSRenderEngine.cpp index 04e73eb..33390e6 100644 --- a/src/lib/DSRender/DSRenderEngine.cpp +++ b/src/lib/DSRender/DSRenderEngine.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderEngine::DSRenderEngine(/* args */) - { - } +DSRenderEngine::DSRenderEngine(/* args */) +{} - DSRenderEngine::~DSRenderEngine() - { - } +DSRenderEngine::~DSRenderEngine() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSRender/DSRenderEngine.h b/src/lib/DSRender/DSRenderEngine.h index 604be64..fd8a47f 100644 --- a/src/lib/DSRender/DSRenderEngine.h +++ b/src/lib/DSRender/DSRenderEngine.h @@ -5,14 +5,14 @@ namespace display_server { - class DSRenderEngine - { - private: - /* data */ - public: - DSRenderEngine(/* args */); - virtual ~DSRenderEngine(); - }; +class DSRenderEngine +{ +private: + /* data */ +public: + DSRenderEngine(/* args */); + virtual ~DSRenderEngine(); +}; } #endif diff --git a/src/lib/DSRender/DSRenderEngineDali.cpp b/src/lib/DSRender/DSRenderEngineDali.cpp index ddf189a..8ee5e0b 100644 --- a/src/lib/DSRender/DSRenderEngineDali.cpp +++ b/src/lib/DSRender/DSRenderEngineDali.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderEngineDali::DSRenderEngineDali(/* args */) - { - } +DSRenderEngineDali::DSRenderEngineDali(/* args */) +{} - DSRenderEngineDali::~DSRenderEngineDali() - { - } +DSRenderEngineDali::~DSRenderEngineDali() +{} } // namespace display_server diff --git a/src/lib/DSRender/DSRenderEngineDali.h b/src/lib/DSRender/DSRenderEngineDali.h index 9196bb5..b421c1c 100644 --- a/src/lib/DSRender/DSRenderEngineDali.h +++ b/src/lib/DSRender/DSRenderEngineDali.h @@ -5,14 +5,14 @@ namespace display_server { - class DSRenderEngineDali : public DSRenderEngine - { - private: - /* data */ - public: - DSRenderEngineDali(/* args */); - ~DSRenderEngineDali(); - }; +class DSRenderEngineDali : public DSRenderEngine +{ +private: + /* data */ +public: + DSRenderEngineDali(/* args */); + ~DSRenderEngineDali(); +}; } #endif diff --git a/src/lib/DSRender/DSRenderEngineEcoreEvas.cpp b/src/lib/DSRender/DSRenderEngineEcoreEvas.cpp index 4de9a33..77a0cd4 100644 --- a/src/lib/DSRender/DSRenderEngineEcoreEvas.cpp +++ b/src/lib/DSRender/DSRenderEngineEcoreEvas.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderEngineEcoreEvas::DSRenderEngineEcoreEvas(/* args */) - { - } +DSRenderEngineEcoreEvas::DSRenderEngineEcoreEvas(/* args */) +{} - DSRenderEngineEcoreEvas::~DSRenderEngineEcoreEvas() - { - } +DSRenderEngineEcoreEvas::~DSRenderEngineEcoreEvas() +{} } // namespace display_server diff --git a/src/lib/DSRender/DSRenderEngineEcoreEvas.h b/src/lib/DSRender/DSRenderEngineEcoreEvas.h index 28110e5..043baae 100644 --- a/src/lib/DSRender/DSRenderEngineEcoreEvas.h +++ b/src/lib/DSRender/DSRenderEngineEcoreEvas.h @@ -5,14 +5,14 @@ namespace display_server { - class DSRenderEngineEcoreEvas : public DSRenderEngine - { - private: - /* data */ - public: - DSRenderEngineEcoreEvas(/* args */); - ~DSRenderEngineEcoreEvas(); - }; +class DSRenderEngineEcoreEvas : public DSRenderEngine +{ +private: + /* data */ +public: + DSRenderEngineEcoreEvas(/* args */); + ~DSRenderEngineEcoreEvas(); +}; } #endif diff --git a/src/lib/DSRender/DSRenderFactory.h b/src/lib/DSRender/DSRenderFactory.h index 24c6bf8..3c12718 100644 --- a/src/lib/DSRender/DSRenderFactory.h +++ b/src/lib/DSRender/DSRenderFactory.h @@ -7,15 +7,15 @@ namespace display_server { - class DSRenderFactory - { - public: - virtual ~DSRenderFactory() = default; +class DSRenderFactory +{ +public: + virtual ~DSRenderFactory() = default; - virtual DSRenderEngine* createDSRenderEngine() = 0; - virtual DSRenderSurface* createDSRenderSurface() = 0; - virtual DSRenderView* createDSRenderView() = 0; - }; + virtual DSRenderEngine *createDSRenderEngine() = 0; + virtual DSRenderSurface *createDSRenderSurface() = 0; + virtual DSRenderView *createDSRenderView() = 0; +}; } #endif diff --git a/src/lib/DSRender/DSRenderFactoryDali.cpp b/src/lib/DSRender/DSRenderFactoryDali.cpp index 505d068..b6bdb4b 100644 --- a/src/lib/DSRender/DSRenderFactoryDali.cpp +++ b/src/lib/DSRender/DSRenderFactoryDali.cpp @@ -2,29 +2,27 @@ namespace display_server { - DSRenderFactoryDali::DSRenderFactoryDali(/* args */) - { - } +DSRenderFactoryDali::DSRenderFactoryDali(/* args */) +{} - DSRenderFactoryDali::~DSRenderFactoryDali() - { - } +DSRenderFactoryDali::~DSRenderFactoryDali() +{} - DSRenderEngine* DSRenderFactoryDali::createDSRenderEngine() - { - DSRenderEngine* renderer = new DSRenderEngineDali; - return renderer; - } +DSRenderEngine *DSRenderFactoryDali::createDSRenderEngine() +{ + DSRenderEngine *renderer = new DSRenderEngineDali; + return renderer; +} - DSRenderSurface* DSRenderFactoryDali::createDSRenderSurface() - { - DSRenderSurface* renderSurface = new DSRenderSurfaceDali; - return renderSurface; - } +DSRenderSurface *DSRenderFactoryDali::createDSRenderSurface() +{ + DSRenderSurface *renderSurface = new DSRenderSurfaceDali; + return renderSurface; +} - DSRenderView* DSRenderFactoryDali::createDSRenderView() - { - DSRenderView* renderView = new DSRenderViewDali; - return renderView; - } +DSRenderView *DSRenderFactoryDali::createDSRenderView() +{ + DSRenderView *renderView = new DSRenderViewDali; + return renderView; +} } // namespace display_server diff --git a/src/lib/DSRender/DSRenderFactoryDali.h b/src/lib/DSRender/DSRenderFactoryDali.h index 9e74360..bb39631 100644 --- a/src/lib/DSRender/DSRenderFactoryDali.h +++ b/src/lib/DSRender/DSRenderFactoryDali.h @@ -8,18 +8,18 @@ namespace display_server { - class DSRenderFactoryDali : public DSRenderFactory - { - private: - /* data */ - public: - DSRenderFactoryDali(/* args */); - ~DSRenderFactoryDali(); +class DSRenderFactoryDali : public DSRenderFactory +{ +private: + /* data */ +public: + DSRenderFactoryDali(/* args */); + ~DSRenderFactoryDali(); - DSRenderEngine* createDSRenderEngine() override; - DSRenderSurface* createDSRenderSurface() override; - DSRenderView* createDSRenderView() override; - }; + DSRenderEngine *createDSRenderEngine() override; + DSRenderSurface *createDSRenderSurface() override; + DSRenderView *createDSRenderView() override; +}; } #endif diff --git a/src/lib/DSRender/DSRenderFactoryEcoreEvas.cpp b/src/lib/DSRender/DSRenderFactoryEcoreEvas.cpp index 7895db1..c31dd81 100644 --- a/src/lib/DSRender/DSRenderFactoryEcoreEvas.cpp +++ b/src/lib/DSRender/DSRenderFactoryEcoreEvas.cpp @@ -2,29 +2,27 @@ namespace display_server { - DSRenderFactoryEcoreEvas::DSRenderFactoryEcoreEvas(/* args */) - { - } +DSRenderFactoryEcoreEvas::DSRenderFactoryEcoreEvas(/* args */) +{} - DSRenderFactoryEcoreEvas::~DSRenderFactoryEcoreEvas() - { - } +DSRenderFactoryEcoreEvas::~DSRenderFactoryEcoreEvas() +{} - DSRenderEngine* DSRenderFactoryEcoreEvas::createDSRenderEngine() - { - DSRenderEngine* renderer = new DSRenderEngineEcoreEvas; - return renderer; - } +DSRenderEngine *DSRenderFactoryEcoreEvas::createDSRenderEngine() +{ + DSRenderEngine *renderer = new DSRenderEngineEcoreEvas; + return renderer; +} - DSRenderSurface* DSRenderFactoryEcoreEvas::createDSRenderSurface() - { - DSRenderSurface* renderSurface = new DSRenderSurfaceEcoreEvas; - return renderSurface; - } +DSRenderSurface *DSRenderFactoryEcoreEvas::createDSRenderSurface() +{ + DSRenderSurface *renderSurface = new DSRenderSurfaceEcoreEvas; + return renderSurface; +} - DSRenderView* DSRenderFactoryEcoreEvas::createDSRenderView() - { - DSRenderView* renderView = new DSRenderViewEcoreEvas; - return renderView; - } +DSRenderView *DSRenderFactoryEcoreEvas::createDSRenderView() +{ + DSRenderView *renderView = new DSRenderViewEcoreEvas; + return renderView; +} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSRender/DSRenderFactoryEcoreEvas.h b/src/lib/DSRender/DSRenderFactoryEcoreEvas.h index 8f6a796..70c45e5 100644 --- a/src/lib/DSRender/DSRenderFactoryEcoreEvas.h +++ b/src/lib/DSRender/DSRenderFactoryEcoreEvas.h @@ -8,18 +8,18 @@ namespace display_server { - class DSRenderFactoryEcoreEvas : public DSRenderFactory - { - private: - /* data */ - public: - DSRenderFactoryEcoreEvas(/* args */); - ~DSRenderFactoryEcoreEvas(); +class DSRenderFactoryEcoreEvas : public DSRenderFactory +{ +private: + /* data */ +public: + DSRenderFactoryEcoreEvas(/* args */); + ~DSRenderFactoryEcoreEvas(); - DSRenderEngine* createDSRenderEngine() override; - DSRenderSurface* createDSRenderSurface() override; - DSRenderView* createDSRenderView() override; - }; + DSRenderEngine *createDSRenderEngine() override; + DSRenderSurface *createDSRenderSurface() override; + DSRenderView *createDSRenderView() override; +}; } #endif diff --git a/src/lib/DSRender/DSRenderSurface.cpp b/src/lib/DSRender/DSRenderSurface.cpp index 60cc563..27e1642 100644 --- a/src/lib/DSRender/DSRenderSurface.cpp +++ b/src/lib/DSRender/DSRenderSurface.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderSurface::DSRenderSurface(/* args */) - { - } +DSRenderSurface::DSRenderSurface(/* args */) +{} - DSRenderSurface::~DSRenderSurface() - { - } +DSRenderSurface::~DSRenderSurface() +{} } // namespace display_server diff --git a/src/lib/DSRender/DSRenderSurface.h b/src/lib/DSRender/DSRenderSurface.h index b674e09..098a166 100644 --- a/src/lib/DSRender/DSRenderSurface.h +++ b/src/lib/DSRender/DSRenderSurface.h @@ -3,14 +3,14 @@ namespace display_server { - class DSRenderSurface - { - private: - /* data */ - public: - DSRenderSurface(/* args */); - virtual ~DSRenderSurface(); - }; +class DSRenderSurface +{ +private: + /* data */ +public: + DSRenderSurface(/* args */); + virtual ~DSRenderSurface(); +}; } #endif diff --git a/src/lib/DSRender/DSRenderSurfaceDali.cpp b/src/lib/DSRender/DSRenderSurfaceDali.cpp index 3665bfb..bda44bc 100644 --- a/src/lib/DSRender/DSRenderSurfaceDali.cpp +++ b/src/lib/DSRender/DSRenderSurfaceDali.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderSurfaceDali::DSRenderSurfaceDali(/* args */) - { - } +DSRenderSurfaceDali::DSRenderSurfaceDali(/* args */) +{} - DSRenderSurfaceDali::~DSRenderSurfaceDali() - { - } +DSRenderSurfaceDali::~DSRenderSurfaceDali() +{} } // namespace display_server diff --git a/src/lib/DSRender/DSRenderSurfaceDali.h b/src/lib/DSRender/DSRenderSurfaceDali.h index d1a9409..7347805 100644 --- a/src/lib/DSRender/DSRenderSurfaceDali.h +++ b/src/lib/DSRender/DSRenderSurfaceDali.h @@ -5,14 +5,14 @@ namespace display_server { - class DSRenderSurfaceDali : public DSRenderSurface - { - private: - /* data */ - public: - DSRenderSurfaceDali(/* args */); - ~DSRenderSurfaceDali(); - }; +class DSRenderSurfaceDali : public DSRenderSurface +{ +private: + /* data */ +public: + DSRenderSurfaceDali(/* args */); + ~DSRenderSurfaceDali(); +}; } #endif diff --git a/src/lib/DSRender/DSRenderSurfaceEcoreEvas.cpp b/src/lib/DSRender/DSRenderSurfaceEcoreEvas.cpp index 4e9312d..b491f02 100644 --- a/src/lib/DSRender/DSRenderSurfaceEcoreEvas.cpp +++ b/src/lib/DSRender/DSRenderSurfaceEcoreEvas.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderSurfaceEcoreEvas::DSRenderSurfaceEcoreEvas(/* args */) - { - } +DSRenderSurfaceEcoreEvas::DSRenderSurfaceEcoreEvas(/* args */) +{} - DSRenderSurfaceEcoreEvas::~DSRenderSurfaceEcoreEvas() - { - } +DSRenderSurfaceEcoreEvas::~DSRenderSurfaceEcoreEvas() +{} } // namespace display_server diff --git a/src/lib/DSRender/DSRenderSurfaceEcoreEvas.h b/src/lib/DSRender/DSRenderSurfaceEcoreEvas.h index 044cc27..af7a530 100644 --- a/src/lib/DSRender/DSRenderSurfaceEcoreEvas.h +++ b/src/lib/DSRender/DSRenderSurfaceEcoreEvas.h @@ -5,14 +5,14 @@ namespace display_server { - class DSRenderSurfaceEcoreEvas : public DSRenderSurface - { - private: - /* data */ - public: - DSRenderSurfaceEcoreEvas(/* args */); - ~DSRenderSurfaceEcoreEvas(); - }; +class DSRenderSurfaceEcoreEvas : public DSRenderSurface +{ +private: + /* data */ +public: + DSRenderSurfaceEcoreEvas(/* args */); + ~DSRenderSurfaceEcoreEvas(); +}; } #endif diff --git a/src/lib/DSRender/DSRenderView.cpp b/src/lib/DSRender/DSRenderView.cpp index 7578c2b..fc4e77f 100644 --- a/src/lib/DSRender/DSRenderView.cpp +++ b/src/lib/DSRender/DSRenderView.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderView::DSRenderView(/* args */) - { - } +DSRenderView::DSRenderView(/* args */) +{} - DSRenderView::~DSRenderView() - { - } +DSRenderView::~DSRenderView() +{} } // namespace display_server diff --git a/src/lib/DSRender/DSRenderView.h b/src/lib/DSRender/DSRenderView.h index 7dd0839..c96ecdf 100644 --- a/src/lib/DSRender/DSRenderView.h +++ b/src/lib/DSRender/DSRenderView.h @@ -3,14 +3,14 @@ namespace display_server { - class DSRenderView - { - private: - /* data */ - public: - DSRenderView(/* args */); - virtual ~DSRenderView(); - }; +class DSRenderView +{ +private: + /* data */ +public: + DSRenderView(/* args */); + virtual ~DSRenderView(); +}; } #endif diff --git a/src/lib/DSRender/DSRenderViewDali.cpp b/src/lib/DSRender/DSRenderViewDali.cpp index d476245..edbc0cb 100644 --- a/src/lib/DSRender/DSRenderViewDali.cpp +++ b/src/lib/DSRender/DSRenderViewDali.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderViewDali::DSRenderViewDali(/* args */) - { - } +DSRenderViewDali::DSRenderViewDali(/* args */) +{} - DSRenderViewDali::~DSRenderViewDali() - { - } +DSRenderViewDali::~DSRenderViewDali() +{} } // namespace display_server \ No newline at end of file diff --git a/src/lib/DSRender/DSRenderViewDali.h b/src/lib/DSRender/DSRenderViewDali.h index 5ecfe3b..0baa33b 100644 --- a/src/lib/DSRender/DSRenderViewDali.h +++ b/src/lib/DSRender/DSRenderViewDali.h @@ -5,14 +5,14 @@ namespace display_server { - class DSRenderViewDali : public DSRenderView - { - private: - /* data */ - public: - DSRenderViewDali(/* args */); - ~DSRenderViewDali(); - }; +class DSRenderViewDali : public DSRenderView +{ +private: + /* data */ +public: + DSRenderViewDali(/* args */); + ~DSRenderViewDali(); +}; } #endif diff --git a/src/lib/DSRender/DSRenderViewEcoreEvas.cpp b/src/lib/DSRender/DSRenderViewEcoreEvas.cpp index 3b33d00..97186a0 100644 --- a/src/lib/DSRender/DSRenderViewEcoreEvas.cpp +++ b/src/lib/DSRender/DSRenderViewEcoreEvas.cpp @@ -2,11 +2,9 @@ namespace display_server { - DSRenderViewEcoreEvas::DSRenderViewEcoreEvas(/* args */) - { - } +DSRenderViewEcoreEvas::DSRenderViewEcoreEvas(/* args */) +{} - DSRenderViewEcoreEvas::~DSRenderViewEcoreEvas() - { - } +DSRenderViewEcoreEvas::~DSRenderViewEcoreEvas() +{} } // namespace display_server diff --git a/src/lib/DSRender/DSRenderViewEcoreEvas.h b/src/lib/DSRender/DSRenderViewEcoreEvas.h index 681e9b2..b9f0db2 100644 --- a/src/lib/DSRender/DSRenderViewEcoreEvas.h +++ b/src/lib/DSRender/DSRenderViewEcoreEvas.h @@ -5,14 +5,14 @@ namespace display_server { - class DSRenderViewEcoreEvas : public DSRenderView - { - private: - /* data */ - public: - DSRenderViewEcoreEvas(/* args */); - ~DSRenderViewEcoreEvas(); - }; +class DSRenderViewEcoreEvas : public DSRenderView +{ +private: + /* data */ +public: + DSRenderViewEcoreEvas(/* args */); + ~DSRenderViewEcoreEvas(); +}; } #endif diff --git a/tests/DSRenderFactoryDali-test.cpp b/tests/DSRenderFactoryDali-test.cpp index 667ee39..c99dbca 100644 --- a/tests/DSRenderFactoryDali-test.cpp +++ b/tests/DSRenderFactoryDali-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSRenderFactoryDaliTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; class DSBufferQueueMock : public DSBufferQueue @@ -15,13 +17,13 @@ class DSBufferQueueMock : public DSBufferQueue public: DSBufferQueueMock() {}; ~DSBufferQueueMock() {}; - //MOCK_METHOD(ReturnType, MethodName, (Args...)); - //MOCK_METHOD(ReturnType, MethodName, (Args...), (Specs...)); + //MOCK_METHOD(ReturnType, MethodName, (Args...)); + //MOCK_METHOD(ReturnType, MethodName, (Args...), (Specs...)); }; TEST_F(DSRenderFactoryDaliTest, CreateRenderFactoryDali) { - DSRenderFactory* renderFactory = new DSRenderFactoryDali; + DSRenderFactory *renderFactory = new DSRenderFactoryDali; EXPECT_TRUE(renderFactory != nullptr); delete renderFactory; @@ -29,10 +31,10 @@ TEST_F(DSRenderFactoryDaliTest, CreateRenderFactoryDali) TEST_F(DSRenderFactoryDaliTest, createDSRenderEngine) { - DSRenderFactory* renderFactory = new DSRenderFactoryDali; + DSRenderFactory *renderFactory = new DSRenderFactoryDali; EXPECT_TRUE(renderFactory != nullptr); - DSRenderEngine* renderEngine = renderFactory->createDSRenderEngine(); + DSRenderEngine *renderEngine = renderFactory->createDSRenderEngine(); EXPECT_TRUE(renderEngine != nullptr); delete renderEngine; @@ -41,23 +43,22 @@ TEST_F(DSRenderFactoryDaliTest, createDSRenderEngine) TEST_F(DSRenderFactoryDaliTest, createDSRenderSurface) { - DSRenderFactory* renderFactory = new DSRenderFactoryDali; + DSRenderFactory *renderFactory = new DSRenderFactoryDali; EXPECT_TRUE(renderFactory != nullptr); - DSRenderSurface* renderSurface = renderFactory->createDSRenderSurface(); + DSRenderSurface *renderSurface = renderFactory->createDSRenderSurface(); EXPECT_TRUE(renderSurface != nullptr); delete renderSurface; delete renderFactory; } - TEST_F(DSRenderFactoryDaliTest, createDSRenderView) { - DSRenderFactory* renderFactory = new DSRenderFactoryDali; + DSRenderFactory *renderFactory = new DSRenderFactoryDali; EXPECT_TRUE(renderFactory != nullptr); - DSRenderView* renderView = renderFactory->createDSRenderView(); + DSRenderView *renderView = renderFactory->createDSRenderView(); EXPECT_TRUE(renderView != nullptr); delete renderView; @@ -66,14 +67,14 @@ TEST_F(DSRenderFactoryDaliTest, createDSRenderView) TEST_F(DSRenderFactoryDaliTest, CreateRenderFactoryDaliAll) { - DSRenderFactory* renderFactory = new DSRenderFactoryDali; + DSRenderFactory *renderFactory = new DSRenderFactoryDali; EXPECT_TRUE(renderFactory != nullptr); - DSRenderEngine* renderEngine = renderFactory->createDSRenderEngine(); + DSRenderEngine *renderEngine = renderFactory->createDSRenderEngine(); EXPECT_TRUE(renderEngine != nullptr); - DSRenderSurface* renderSurface = renderFactory->createDSRenderSurface(); + DSRenderSurface *renderSurface = renderFactory->createDSRenderSurface(); EXPECT_TRUE(renderSurface != nullptr); - DSRenderView* renderView = renderFactory->createDSRenderView(); + DSRenderView *renderView = renderFactory->createDSRenderView(); EXPECT_TRUE(renderView != nullptr); delete renderView; diff --git a/tests/DSRenderFactoryEcoreEvas-test.cpp b/tests/DSRenderFactoryEcoreEvas-test.cpp index 4516e33..8711d1b 100644 --- a/tests/DSRenderFactoryEcoreEvas-test.cpp +++ b/tests/DSRenderFactoryEcoreEvas-test.cpp @@ -6,8 +6,10 @@ using namespace display_server; class DSRenderFactoryEcoreEvasTest : public ::testing::Test { public: - void SetUp(void) override {} - void TearDown(void) override {} + void SetUp(void) override + {} + void TearDown(void) override + {} }; class DSBufferQueueMock : public DSBufferQueue @@ -15,13 +17,13 @@ class DSBufferQueueMock : public DSBufferQueue public: DSBufferQueueMock() {}; ~DSBufferQueueMock() {}; - //MOCK_METHOD(ReturnType, MethodName, (Args...)); - //MOCK_METHOD(ReturnType, MethodName, (Args...), (Specs...)); + //MOCK_METHOD(ReturnType, MethodName, (Args...)); + //MOCK_METHOD(ReturnType, MethodName, (Args...), (Specs...)); }; TEST_F(DSRenderFactoryEcoreEvasTest, CreateRenderFactoryEcoreEvas) { - DSRenderFactory* renderFactory = new DSRenderFactoryEcoreEvas; + DSRenderFactory *renderFactory = new DSRenderFactoryEcoreEvas; EXPECT_TRUE(renderFactory != nullptr); delete renderFactory; @@ -29,10 +31,10 @@ TEST_F(DSRenderFactoryEcoreEvasTest, CreateRenderFactoryEcoreEvas) TEST_F(DSRenderFactoryEcoreEvasTest, createDSRenderEngine) { - DSRenderFactory* renderFactory = new DSRenderFactoryEcoreEvas; + DSRenderFactory *renderFactory = new DSRenderFactoryEcoreEvas; EXPECT_TRUE(renderFactory != nullptr); - DSRenderEngine* renderEngine = renderFactory->createDSRenderEngine(); + DSRenderEngine *renderEngine = renderFactory->createDSRenderEngine(); EXPECT_TRUE(renderEngine != nullptr); delete renderEngine; @@ -41,23 +43,22 @@ TEST_F(DSRenderFactoryEcoreEvasTest, createDSRenderEngine) TEST_F(DSRenderFactoryEcoreEvasTest, createDSRenderSurface) { - DSRenderFactory* renderFactory = new DSRenderFactoryEcoreEvas; + DSRenderFactory *renderFactory = new DSRenderFactoryEcoreEvas; EXPECT_TRUE(renderFactory != nullptr); - DSRenderSurface* renderSurface = renderFactory->createDSRenderSurface(); + DSRenderSurface *renderSurface = renderFactory->createDSRenderSurface(); EXPECT_TRUE(renderSurface != nullptr); delete renderSurface; delete renderFactory; } - TEST_F(DSRenderFactoryEcoreEvasTest, createDSRenderView) { - DSRenderFactory* renderFactory = new DSRenderFactoryEcoreEvas; + DSRenderFactory *renderFactory = new DSRenderFactoryEcoreEvas; EXPECT_TRUE(renderFactory != nullptr); - DSRenderView* renderView = renderFactory->createDSRenderView(); + DSRenderView *renderView = renderFactory->createDSRenderView(); EXPECT_TRUE(renderView != nullptr); delete renderView; @@ -66,14 +67,14 @@ TEST_F(DSRenderFactoryEcoreEvasTest, createDSRenderView) TEST_F(DSRenderFactoryEcoreEvasTest, CreateRenderFactoryEcoreEvasAll) { - DSRenderFactory* renderFactory = new DSRenderFactoryEcoreEvas; + DSRenderFactory *renderFactory = new DSRenderFactoryEcoreEvas; EXPECT_TRUE(renderFactory != nullptr); - DSRenderEngine* renderEngine = renderFactory->createDSRenderEngine(); + DSRenderEngine *renderEngine = renderFactory->createDSRenderEngine(); EXPECT_TRUE(renderEngine != nullptr); - DSRenderSurface* renderSurface = renderFactory->createDSRenderSurface(); + DSRenderSurface *renderSurface = renderFactory->createDSRenderSurface(); EXPECT_TRUE(renderSurface != nullptr); - DSRenderView* renderView = renderFactory->createDSRenderView(); + DSRenderView *renderView = renderFactory->createDSRenderView(); EXPECT_TRUE(renderView != nullptr); delete renderView; -- 2.7.4 From 219e4ad43af61d5170fe1473ee1f97eac3a7b9ea Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 9 Jun 2020 11:09:25 +0900 Subject: [PATCH 07/16] change the source directories and the menson.build files. make the source directories below. libds - - samples/menson.build --> samples sources | - src/menson.build --> libds sources | - tests/menson.build --> test sources - - meson.build Change-Id: Ib078b5d2d5664563d0b9499abd7360c724eb3317 --- meson.build | 123 ++------------------- {src/bin/example => samples}/exampleCompositor.cpp | 0 .../bin/example => samples}/exampleObjectPimpl.cpp | 0 {src/bin/example => samples}/exampleProperty.cpp | 0 {src/bin/example => samples}/exampleSignalSlot.cpp | 0 samples/meson.build | 20 ++++ src/{lib => DSBase}/DSRefBase.cpp | 0 src/{lib => DSBase}/DSRefBase.h | 0 src/{lib => }/DSBuffer/DSBufferQueue.cpp | 0 src/{lib => }/DSBuffer/DSBufferQueue.h | 0 src/{lib => }/DSBuffer/README.md | 0 src/{lib => DSCallback}/DSCallback.h | 0 src/{lib => }/DSCanvas/DSCanvas.cpp | 0 src/{lib => }/DSCanvas/DSCanvas.h | 0 src/{lib => }/DSCompositor/DSCompositor.cpp | 0 src/{lib => }/DSCompositor/DSCompositor.h | 0 src/{lib => }/DSDisplayArea/DSDisplayArea.cpp | 0 src/{lib => }/DSDisplayArea/DSDisplayArea.h | 0 src/{lib => }/DSHWC/README.md | 0 src/{lib => }/DSInput/DSInput.cpp | 0 src/{lib => }/DSInput/DSInput.h | 0 src/{lib => DSObject}/DSObject.cpp | 0 src/{lib => DSObject}/DSObject.h | 0 src/{lib => DSObject}/DSObjectPrivate.cpp | 0 src/{lib => DSObject}/DSObjectPrivate.h | 0 src/{lib => }/DSOutput/DSOutput.cpp | 0 src/{lib => }/DSOutput/DSOutput.h | 0 src/{lib => }/DSOutput/README.md | 0 src/{lib => }/DSPolicyArea/DSPolicyArea.cpp | 0 src/{lib => }/DSPolicyArea/DSPolicyArea.h | 0 src/{lib => DSProperty}/DSProperty.cpp | 0 src/{lib => DSProperty}/DSProperty.h | 0 src/{lib => DSProperty}/DSPropertyPrivate.cpp | 0 src/{lib => DSProperty}/DSPropertyPrivate.h | 0 src/{lib => }/DSRender/DSRenderEngine.cpp | 0 src/{lib => }/DSRender/DSRenderEngine.h | 0 src/{lib => }/DSRender/DSRenderEngineDali.cpp | 0 src/{lib => }/DSRender/DSRenderEngineDali.h | 0 src/{lib => }/DSRender/DSRenderEngineEcoreEvas.cpp | 0 src/{lib => }/DSRender/DSRenderEngineEcoreEvas.h | 0 src/{lib => }/DSRender/DSRenderFactory.h | 0 src/{lib => }/DSRender/DSRenderFactoryDali.cpp | 0 src/{lib => }/DSRender/DSRenderFactoryDali.h | 0 .../DSRender/DSRenderFactoryEcoreEvas.cpp | 0 src/{lib => }/DSRender/DSRenderFactoryEcoreEvas.h | 0 src/{lib => }/DSRender/DSRenderSurface.cpp | 0 src/{lib => }/DSRender/DSRenderSurface.h | 0 src/{lib => }/DSRender/DSRenderSurfaceDali.cpp | 0 src/{lib => }/DSRender/DSRenderSurfaceDali.h | 0 .../DSRender/DSRenderSurfaceEcoreEvas.cpp | 0 src/{lib => }/DSRender/DSRenderSurfaceEcoreEvas.h | 0 src/{lib => }/DSRender/DSRenderView.cpp | 0 src/{lib => }/DSRender/DSRenderView.h | 0 src/{lib => }/DSRender/DSRenderViewDali.cpp | 0 src/{lib => }/DSRender/DSRenderViewDali.h | 0 src/{lib => }/DSRender/DSRenderViewEcoreEvas.cpp | 0 src/{lib => }/DSRender/DSRenderViewEcoreEvas.h | 0 src/{lib => }/DSRender/README.md | 0 src/{lib => }/DSSeat/DSSeat.cpp | 0 src/{lib => }/DSSeat/DSSeat.h | 0 src/{lib => DSSignal}/DSSignal.cpp | 0 src/{lib => DSSignal}/DSSignal.h | 0 src/meson.build | 88 +++++++++++++++ tests/meson.build | 28 ++--- 64 files changed, 125 insertions(+), 134 deletions(-) rename {src/bin/example => samples}/exampleCompositor.cpp (100%) rename {src/bin/example => samples}/exampleObjectPimpl.cpp (100%) rename {src/bin/example => samples}/exampleProperty.cpp (100%) rename {src/bin/example => samples}/exampleSignalSlot.cpp (100%) create mode 100644 samples/meson.build rename src/{lib => DSBase}/DSRefBase.cpp (100%) rename src/{lib => DSBase}/DSRefBase.h (100%) rename src/{lib => }/DSBuffer/DSBufferQueue.cpp (100%) rename src/{lib => }/DSBuffer/DSBufferQueue.h (100%) rename src/{lib => }/DSBuffer/README.md (100%) rename src/{lib => DSCallback}/DSCallback.h (100%) rename src/{lib => }/DSCanvas/DSCanvas.cpp (100%) rename src/{lib => }/DSCanvas/DSCanvas.h (100%) rename src/{lib => }/DSCompositor/DSCompositor.cpp (100%) rename src/{lib => }/DSCompositor/DSCompositor.h (100%) rename src/{lib => }/DSDisplayArea/DSDisplayArea.cpp (100%) rename src/{lib => }/DSDisplayArea/DSDisplayArea.h (100%) rename src/{lib => }/DSHWC/README.md (100%) rename src/{lib => }/DSInput/DSInput.cpp (100%) rename src/{lib => }/DSInput/DSInput.h (100%) rename src/{lib => DSObject}/DSObject.cpp (100%) rename src/{lib => DSObject}/DSObject.h (100%) rename src/{lib => DSObject}/DSObjectPrivate.cpp (100%) rename src/{lib => DSObject}/DSObjectPrivate.h (100%) rename src/{lib => }/DSOutput/DSOutput.cpp (100%) rename src/{lib => }/DSOutput/DSOutput.h (100%) rename src/{lib => }/DSOutput/README.md (100%) rename src/{lib => }/DSPolicyArea/DSPolicyArea.cpp (100%) rename src/{lib => }/DSPolicyArea/DSPolicyArea.h (100%) rename src/{lib => DSProperty}/DSProperty.cpp (100%) rename src/{lib => DSProperty}/DSProperty.h (100%) rename src/{lib => DSProperty}/DSPropertyPrivate.cpp (100%) rename src/{lib => DSProperty}/DSPropertyPrivate.h (100%) rename src/{lib => }/DSRender/DSRenderEngine.cpp (100%) rename src/{lib => }/DSRender/DSRenderEngine.h (100%) rename src/{lib => }/DSRender/DSRenderEngineDali.cpp (100%) rename src/{lib => }/DSRender/DSRenderEngineDali.h (100%) rename src/{lib => }/DSRender/DSRenderEngineEcoreEvas.cpp (100%) rename src/{lib => }/DSRender/DSRenderEngineEcoreEvas.h (100%) rename src/{lib => }/DSRender/DSRenderFactory.h (100%) rename src/{lib => }/DSRender/DSRenderFactoryDali.cpp (100%) rename src/{lib => }/DSRender/DSRenderFactoryDali.h (100%) rename src/{lib => }/DSRender/DSRenderFactoryEcoreEvas.cpp (100%) rename src/{lib => }/DSRender/DSRenderFactoryEcoreEvas.h (100%) rename src/{lib => }/DSRender/DSRenderSurface.cpp (100%) rename src/{lib => }/DSRender/DSRenderSurface.h (100%) rename src/{lib => }/DSRender/DSRenderSurfaceDali.cpp (100%) rename src/{lib => }/DSRender/DSRenderSurfaceDali.h (100%) rename src/{lib => }/DSRender/DSRenderSurfaceEcoreEvas.cpp (100%) rename src/{lib => }/DSRender/DSRenderSurfaceEcoreEvas.h (100%) rename src/{lib => }/DSRender/DSRenderView.cpp (100%) rename src/{lib => }/DSRender/DSRenderView.h (100%) rename src/{lib => }/DSRender/DSRenderViewDali.cpp (100%) rename src/{lib => }/DSRender/DSRenderViewDali.h (100%) rename src/{lib => }/DSRender/DSRenderViewEcoreEvas.cpp (100%) rename src/{lib => }/DSRender/DSRenderViewEcoreEvas.h (100%) rename src/{lib => }/DSRender/README.md (100%) rename src/{lib => }/DSSeat/DSSeat.cpp (100%) rename src/{lib => }/DSSeat/DSSeat.h (100%) rename src/{lib => DSSignal}/DSSignal.cpp (100%) rename src/{lib => DSSignal}/DSSignal.h (100%) create mode 100644 src/meson.build diff --git a/meson.build b/meson.build index 5862b62..df7137c 100644 --- a/meson.build +++ b/meson.build @@ -1,121 +1,16 @@ -project('libds', 'cpp', +project( + 'libds', + 'cpp', version : '0.0.1', license : 'MIT', default_options : ['cpp_std=c++17'] ) -libDS_version = meson.project_version().split('.') - -dir_prefix = get_option('prefix') -dir_lib = join_paths(dir_prefix, get_option('libdir')) -dir_bin = join_paths(dir_prefix, get_option('bindir')) - -## libds - -install_headers( - 'src/lib/DSObject.h', - 'src/lib/DSSignal.h', - 'src/lib/DSRefBase.h', - 'src/lib/DSBuffer/DSBufferQueue.h', - ) - -src_libds = [ - 'src/lib/DSRefBase.cpp', - 'src/lib/DSRefBase.h', - 'src/lib/DSObject.cpp', - 'src/lib/DSObject.h', - 'src/lib/DSObjectPrivate.cpp', - 'src/lib/DSObjectPrivate.h', - 'src/lib/DSSignal.cpp', - 'src/lib/DSSignal.h', - 'src/lib/DSCallback.h', - 'src/lib/DSProperty.cpp', - 'src/lib/DSProperty.h', - 'src/lib/DSPropertyPrivate.cpp', - 'src/lib/DSPropertyPrivate.h', - 'src/lib/DSBuffer/DSBufferQueue.cpp', - 'src/lib/DSBuffer/DSBufferQueue.h', - 'src/lib/DSRender/DSRenderEngine.cpp', - 'src/lib/DSRender/DSRenderEngineEcoreEvas.cpp', - 'src/lib/DSRender/DSRenderEngineDali.cpp', - 'src/lib/DSRender/DSRenderSurface.cpp', - 'src/lib/DSRender/DSRenderSurfaceEcoreEvas.cpp', - 'src/lib/DSRender/DSRenderSurfaceDali.cpp', - 'src/lib/DSRender/DSRenderView.cpp', - 'src/lib/DSRender/DSRenderViewEcoreEvas.cpp', - 'src/lib/DSRender/DSRenderViewDali.cpp', - 'src/lib/DSRender/DSRenderFactoryEcoreEvas.cpp', - 'src/lib/DSRender/DSRenderFactoryDali.cpp', - 'src/lib/DSCompositor/DSCompositor.cpp', - 'src/lib/DSOutput/DSOutput.cpp', - 'src/lib/DSInput/DSInput.cpp', - 'src/lib/DSCanvas/DSCanvas.cpp', - 'src/lib/DSSeat/DSSeat.cpp', - 'src/lib/DSPolicyArea/DSPolicyArea.cpp', - 'src/lib/DSDisplayArea/DSDisplayArea.cpp', - ] - -pkgconfig = import('pkgconfig') -deps_libds = [] - -link_args = '-W' - -ds_inc = include_directories( - 'src/lib', - 'src/lib/DSBuffer', - 'src/lib/DSRender', - ) - -lib_libds = shared_library( - 'libds', - src_libds, - dependencies : deps_libds, - include_directories : [ds_inc], - version : meson.project_version(), - link_args : link_args, - install : true - ) - -dep_libds = declare_dependency( - link_with : lib_libds, - dependencies : deps_libds, - include_directories : [ds_inc]) - -pkgconfig.generate( - filebase : 'libds', - name : 'Libds', - description : 'DS library', - version : meson.project_version(), - libraries : lib_libds -) +libds_version = meson.project_version().split('.') +libds_prefix = get_option('prefix') +libds_prefix_bindir = join_paths(libds_prefix, get_option('bindir')) +libds_prefix_libdir = join_paths(libds_prefix, get_option('libdir')) +subdir('src') subdir('tests') - -## For libds - -path_test_server = dir_bin -#deps_test_server = [ dep_libds, dependency('libds') ] - -executable('exampleSignalSlot', - 'src/bin/example/exampleSignalSlot.cpp', - dependencies : dep_libds, - link_args : link_args, - install_dir : path_test_server, - install : true - ) - -executable('exampleObjectPimpl', - 'src/bin/example/exampleObjectPimpl.cpp', - dependencies : dep_libds, - link_args : link_args, - install_dir : path_test_server, - install : true - ) - -executable('exampleProperty', - 'src/bin/example/exampleProperty.cpp', - dependencies : dep_libds, - link_args : link_args, - install_dir : path_test_server, - install : true - ) +subdir('samples') diff --git a/src/bin/example/exampleCompositor.cpp b/samples/exampleCompositor.cpp similarity index 100% rename from src/bin/example/exampleCompositor.cpp rename to samples/exampleCompositor.cpp diff --git a/src/bin/example/exampleObjectPimpl.cpp b/samples/exampleObjectPimpl.cpp similarity index 100% rename from src/bin/example/exampleObjectPimpl.cpp rename to samples/exampleObjectPimpl.cpp diff --git a/src/bin/example/exampleProperty.cpp b/samples/exampleProperty.cpp similarity index 100% rename from src/bin/example/exampleProperty.cpp rename to samples/exampleProperty.cpp diff --git a/src/bin/example/exampleSignalSlot.cpp b/samples/exampleSignalSlot.cpp similarity index 100% rename from src/bin/example/exampleSignalSlot.cpp rename to samples/exampleSignalSlot.cpp diff --git a/samples/meson.build b/samples/meson.build new file mode 100644 index 0000000..1380272 --- /dev/null +++ b/samples/meson.build @@ -0,0 +1,20 @@ +executable('exampleSignalSlot', + 'exampleSignalSlot.cpp', + dependencies : libds_declared_dep, + install_dir : libds_prefix_bindir, + install : true + ) + +executable('exampleObjectPimpl', + 'exampleObjectPimpl.cpp', + dependencies : libds_declared_dep, + install_dir : libds_prefix_bindir, + install : true + ) + +executable('exampleProperty', + 'exampleProperty.cpp', + dependencies : libds_declared_dep, + install_dir : libds_prefix_bindir, + install : true + ) diff --git a/src/lib/DSRefBase.cpp b/src/DSBase/DSRefBase.cpp similarity index 100% rename from src/lib/DSRefBase.cpp rename to src/DSBase/DSRefBase.cpp diff --git a/src/lib/DSRefBase.h b/src/DSBase/DSRefBase.h similarity index 100% rename from src/lib/DSRefBase.h rename to src/DSBase/DSRefBase.h diff --git a/src/lib/DSBuffer/DSBufferQueue.cpp b/src/DSBuffer/DSBufferQueue.cpp similarity index 100% rename from src/lib/DSBuffer/DSBufferQueue.cpp rename to src/DSBuffer/DSBufferQueue.cpp diff --git a/src/lib/DSBuffer/DSBufferQueue.h b/src/DSBuffer/DSBufferQueue.h similarity index 100% rename from src/lib/DSBuffer/DSBufferQueue.h rename to src/DSBuffer/DSBufferQueue.h diff --git a/src/lib/DSBuffer/README.md b/src/DSBuffer/README.md similarity index 100% rename from src/lib/DSBuffer/README.md rename to src/DSBuffer/README.md diff --git a/src/lib/DSCallback.h b/src/DSCallback/DSCallback.h similarity index 100% rename from src/lib/DSCallback.h rename to src/DSCallback/DSCallback.h diff --git a/src/lib/DSCanvas/DSCanvas.cpp b/src/DSCanvas/DSCanvas.cpp similarity index 100% rename from src/lib/DSCanvas/DSCanvas.cpp rename to src/DSCanvas/DSCanvas.cpp diff --git a/src/lib/DSCanvas/DSCanvas.h b/src/DSCanvas/DSCanvas.h similarity index 100% rename from src/lib/DSCanvas/DSCanvas.h rename to src/DSCanvas/DSCanvas.h diff --git a/src/lib/DSCompositor/DSCompositor.cpp b/src/DSCompositor/DSCompositor.cpp similarity index 100% rename from src/lib/DSCompositor/DSCompositor.cpp rename to src/DSCompositor/DSCompositor.cpp diff --git a/src/lib/DSCompositor/DSCompositor.h b/src/DSCompositor/DSCompositor.h similarity index 100% rename from src/lib/DSCompositor/DSCompositor.h rename to src/DSCompositor/DSCompositor.h diff --git a/src/lib/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp similarity index 100% rename from src/lib/DSDisplayArea/DSDisplayArea.cpp rename to src/DSDisplayArea/DSDisplayArea.cpp diff --git a/src/lib/DSDisplayArea/DSDisplayArea.h b/src/DSDisplayArea/DSDisplayArea.h similarity index 100% rename from src/lib/DSDisplayArea/DSDisplayArea.h rename to src/DSDisplayArea/DSDisplayArea.h diff --git a/src/lib/DSHWC/README.md b/src/DSHWC/README.md similarity index 100% rename from src/lib/DSHWC/README.md rename to src/DSHWC/README.md diff --git a/src/lib/DSInput/DSInput.cpp b/src/DSInput/DSInput.cpp similarity index 100% rename from src/lib/DSInput/DSInput.cpp rename to src/DSInput/DSInput.cpp diff --git a/src/lib/DSInput/DSInput.h b/src/DSInput/DSInput.h similarity index 100% rename from src/lib/DSInput/DSInput.h rename to src/DSInput/DSInput.h diff --git a/src/lib/DSObject.cpp b/src/DSObject/DSObject.cpp similarity index 100% rename from src/lib/DSObject.cpp rename to src/DSObject/DSObject.cpp diff --git a/src/lib/DSObject.h b/src/DSObject/DSObject.h similarity index 100% rename from src/lib/DSObject.h rename to src/DSObject/DSObject.h diff --git a/src/lib/DSObjectPrivate.cpp b/src/DSObject/DSObjectPrivate.cpp similarity index 100% rename from src/lib/DSObjectPrivate.cpp rename to src/DSObject/DSObjectPrivate.cpp diff --git a/src/lib/DSObjectPrivate.h b/src/DSObject/DSObjectPrivate.h similarity index 100% rename from src/lib/DSObjectPrivate.h rename to src/DSObject/DSObjectPrivate.h diff --git a/src/lib/DSOutput/DSOutput.cpp b/src/DSOutput/DSOutput.cpp similarity index 100% rename from src/lib/DSOutput/DSOutput.cpp rename to src/DSOutput/DSOutput.cpp diff --git a/src/lib/DSOutput/DSOutput.h b/src/DSOutput/DSOutput.h similarity index 100% rename from src/lib/DSOutput/DSOutput.h rename to src/DSOutput/DSOutput.h diff --git a/src/lib/DSOutput/README.md b/src/DSOutput/README.md similarity index 100% rename from src/lib/DSOutput/README.md rename to src/DSOutput/README.md diff --git a/src/lib/DSPolicyArea/DSPolicyArea.cpp b/src/DSPolicyArea/DSPolicyArea.cpp similarity index 100% rename from src/lib/DSPolicyArea/DSPolicyArea.cpp rename to src/DSPolicyArea/DSPolicyArea.cpp diff --git a/src/lib/DSPolicyArea/DSPolicyArea.h b/src/DSPolicyArea/DSPolicyArea.h similarity index 100% rename from src/lib/DSPolicyArea/DSPolicyArea.h rename to src/DSPolicyArea/DSPolicyArea.h diff --git a/src/lib/DSProperty.cpp b/src/DSProperty/DSProperty.cpp similarity index 100% rename from src/lib/DSProperty.cpp rename to src/DSProperty/DSProperty.cpp diff --git a/src/lib/DSProperty.h b/src/DSProperty/DSProperty.h similarity index 100% rename from src/lib/DSProperty.h rename to src/DSProperty/DSProperty.h diff --git a/src/lib/DSPropertyPrivate.cpp b/src/DSProperty/DSPropertyPrivate.cpp similarity index 100% rename from src/lib/DSPropertyPrivate.cpp rename to src/DSProperty/DSPropertyPrivate.cpp diff --git a/src/lib/DSPropertyPrivate.h b/src/DSProperty/DSPropertyPrivate.h similarity index 100% rename from src/lib/DSPropertyPrivate.h rename to src/DSProperty/DSPropertyPrivate.h diff --git a/src/lib/DSRender/DSRenderEngine.cpp b/src/DSRender/DSRenderEngine.cpp similarity index 100% rename from src/lib/DSRender/DSRenderEngine.cpp rename to src/DSRender/DSRenderEngine.cpp diff --git a/src/lib/DSRender/DSRenderEngine.h b/src/DSRender/DSRenderEngine.h similarity index 100% rename from src/lib/DSRender/DSRenderEngine.h rename to src/DSRender/DSRenderEngine.h diff --git a/src/lib/DSRender/DSRenderEngineDali.cpp b/src/DSRender/DSRenderEngineDali.cpp similarity index 100% rename from src/lib/DSRender/DSRenderEngineDali.cpp rename to src/DSRender/DSRenderEngineDali.cpp diff --git a/src/lib/DSRender/DSRenderEngineDali.h b/src/DSRender/DSRenderEngineDali.h similarity index 100% rename from src/lib/DSRender/DSRenderEngineDali.h rename to src/DSRender/DSRenderEngineDali.h diff --git a/src/lib/DSRender/DSRenderEngineEcoreEvas.cpp b/src/DSRender/DSRenderEngineEcoreEvas.cpp similarity index 100% rename from src/lib/DSRender/DSRenderEngineEcoreEvas.cpp rename to src/DSRender/DSRenderEngineEcoreEvas.cpp diff --git a/src/lib/DSRender/DSRenderEngineEcoreEvas.h b/src/DSRender/DSRenderEngineEcoreEvas.h similarity index 100% rename from src/lib/DSRender/DSRenderEngineEcoreEvas.h rename to src/DSRender/DSRenderEngineEcoreEvas.h diff --git a/src/lib/DSRender/DSRenderFactory.h b/src/DSRender/DSRenderFactory.h similarity index 100% rename from src/lib/DSRender/DSRenderFactory.h rename to src/DSRender/DSRenderFactory.h diff --git a/src/lib/DSRender/DSRenderFactoryDali.cpp b/src/DSRender/DSRenderFactoryDali.cpp similarity index 100% rename from src/lib/DSRender/DSRenderFactoryDali.cpp rename to src/DSRender/DSRenderFactoryDali.cpp diff --git a/src/lib/DSRender/DSRenderFactoryDali.h b/src/DSRender/DSRenderFactoryDali.h similarity index 100% rename from src/lib/DSRender/DSRenderFactoryDali.h rename to src/DSRender/DSRenderFactoryDali.h diff --git a/src/lib/DSRender/DSRenderFactoryEcoreEvas.cpp b/src/DSRender/DSRenderFactoryEcoreEvas.cpp similarity index 100% rename from src/lib/DSRender/DSRenderFactoryEcoreEvas.cpp rename to src/DSRender/DSRenderFactoryEcoreEvas.cpp diff --git a/src/lib/DSRender/DSRenderFactoryEcoreEvas.h b/src/DSRender/DSRenderFactoryEcoreEvas.h similarity index 100% rename from src/lib/DSRender/DSRenderFactoryEcoreEvas.h rename to src/DSRender/DSRenderFactoryEcoreEvas.h diff --git a/src/lib/DSRender/DSRenderSurface.cpp b/src/DSRender/DSRenderSurface.cpp similarity index 100% rename from src/lib/DSRender/DSRenderSurface.cpp rename to src/DSRender/DSRenderSurface.cpp diff --git a/src/lib/DSRender/DSRenderSurface.h b/src/DSRender/DSRenderSurface.h similarity index 100% rename from src/lib/DSRender/DSRenderSurface.h rename to src/DSRender/DSRenderSurface.h diff --git a/src/lib/DSRender/DSRenderSurfaceDali.cpp b/src/DSRender/DSRenderSurfaceDali.cpp similarity index 100% rename from src/lib/DSRender/DSRenderSurfaceDali.cpp rename to src/DSRender/DSRenderSurfaceDali.cpp diff --git a/src/lib/DSRender/DSRenderSurfaceDali.h b/src/DSRender/DSRenderSurfaceDali.h similarity index 100% rename from src/lib/DSRender/DSRenderSurfaceDali.h rename to src/DSRender/DSRenderSurfaceDali.h diff --git a/src/lib/DSRender/DSRenderSurfaceEcoreEvas.cpp b/src/DSRender/DSRenderSurfaceEcoreEvas.cpp similarity index 100% rename from src/lib/DSRender/DSRenderSurfaceEcoreEvas.cpp rename to src/DSRender/DSRenderSurfaceEcoreEvas.cpp diff --git a/src/lib/DSRender/DSRenderSurfaceEcoreEvas.h b/src/DSRender/DSRenderSurfaceEcoreEvas.h similarity index 100% rename from src/lib/DSRender/DSRenderSurfaceEcoreEvas.h rename to src/DSRender/DSRenderSurfaceEcoreEvas.h diff --git a/src/lib/DSRender/DSRenderView.cpp b/src/DSRender/DSRenderView.cpp similarity index 100% rename from src/lib/DSRender/DSRenderView.cpp rename to src/DSRender/DSRenderView.cpp diff --git a/src/lib/DSRender/DSRenderView.h b/src/DSRender/DSRenderView.h similarity index 100% rename from src/lib/DSRender/DSRenderView.h rename to src/DSRender/DSRenderView.h diff --git a/src/lib/DSRender/DSRenderViewDali.cpp b/src/DSRender/DSRenderViewDali.cpp similarity index 100% rename from src/lib/DSRender/DSRenderViewDali.cpp rename to src/DSRender/DSRenderViewDali.cpp diff --git a/src/lib/DSRender/DSRenderViewDali.h b/src/DSRender/DSRenderViewDali.h similarity index 100% rename from src/lib/DSRender/DSRenderViewDali.h rename to src/DSRender/DSRenderViewDali.h diff --git a/src/lib/DSRender/DSRenderViewEcoreEvas.cpp b/src/DSRender/DSRenderViewEcoreEvas.cpp similarity index 100% rename from src/lib/DSRender/DSRenderViewEcoreEvas.cpp rename to src/DSRender/DSRenderViewEcoreEvas.cpp diff --git a/src/lib/DSRender/DSRenderViewEcoreEvas.h b/src/DSRender/DSRenderViewEcoreEvas.h similarity index 100% rename from src/lib/DSRender/DSRenderViewEcoreEvas.h rename to src/DSRender/DSRenderViewEcoreEvas.h diff --git a/src/lib/DSRender/README.md b/src/DSRender/README.md similarity index 100% rename from src/lib/DSRender/README.md rename to src/DSRender/README.md diff --git a/src/lib/DSSeat/DSSeat.cpp b/src/DSSeat/DSSeat.cpp similarity index 100% rename from src/lib/DSSeat/DSSeat.cpp rename to src/DSSeat/DSSeat.cpp diff --git a/src/lib/DSSeat/DSSeat.h b/src/DSSeat/DSSeat.h similarity index 100% rename from src/lib/DSSeat/DSSeat.h rename to src/DSSeat/DSSeat.h diff --git a/src/lib/DSSignal.cpp b/src/DSSignal/DSSignal.cpp similarity index 100% rename from src/lib/DSSignal.cpp rename to src/DSSignal/DSSignal.cpp diff --git a/src/lib/DSSignal.h b/src/DSSignal/DSSignal.h similarity index 100% rename from src/lib/DSSignal.h rename to src/DSSignal/DSSignal.h diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..c62a4a3 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,88 @@ + +libds_srcs = [ + 'DSBase/DSRefBase.cpp', + 'DSBase/DSRefBase.h', + 'DSBuffer/DSBufferQueue.cpp', + 'DSBuffer/DSBufferQueue.h', + 'DSCallback/DSCallback.h', + 'DSCanvas/DSCanvas.cpp', + 'DSCompositor/DSCompositor.cpp', + 'DSDisplayArea/DSDisplayArea.cpp', + 'DSInput/DSInput.cpp', + 'DSObject/DSObject.cpp', + 'DSObject/DSObject.h', + 'DSObject/DSObjectPrivate.cpp', + 'DSObject/DSObjectPrivate.h', + 'DSOutput/DSOutput.cpp', + 'DSPolicyArea/DSPolicyArea.cpp', + 'DSProperty/DSProperty.cpp', + 'DSProperty/DSProperty.h', + 'DSProperty/DSPropertyPrivate.cpp', + 'DSProperty/DSPropertyPrivate.h', + 'DSRender/DSRenderEngine.cpp', + 'DSRender/DSRenderEngineEcoreEvas.cpp', + 'DSRender/DSRenderEngineDali.cpp', + 'DSRender/DSRenderSurface.cpp', + 'DSRender/DSRenderSurfaceEcoreEvas.cpp', + 'DSRender/DSRenderSurfaceDali.cpp', + 'DSRender/DSRenderView.cpp', + 'DSRender/DSRenderViewEcoreEvas.cpp', + 'DSRender/DSRenderViewDali.cpp', + 'DSRender/DSRenderFactoryEcoreEvas.cpp', + 'DSRender/DSRenderFactoryDali.cpp', + 'DSSeat/DSSeat.cpp', + 'DSSignal/DSSignal.cpp', + 'DSSignal/DSSignal.h', + ] + +install_headers( + 'DSObject/DSObject.h', + 'DSSignal/DSSignal.h', + 'DSBase/DSRefBase.h', + ) + +pkgconfig = import('pkgconfig') +libds_deps = [] + +libds_include_dirs = include_directories( + '.', + './DSBase', + './DSBuffer', + './DSCallback', + './DSCanvas', + './DSCompositor', + './DSDisplayArea', + './DSHWC', + './DSInput', + './DSObject', + './DSOutput', + './DSPolicyArea', + './DSProperty', + './DSRender', + './DSSeat', + './DSSignal', + ) + +libds_lib = shared_library( + 'libds', + libds_srcs, + dependencies : libds_deps, + include_directories : [libds_include_dirs], + version : meson.project_version(), + install : true + ) + +pkgconfig.generate( + filebase : 'libds', + name : 'libds', + description : 'Display Server library', + version : meson.project_version(), + libraries : libds_lib + ) + +libds_declared_dep = declare_dependency( + link_with : libds_lib, + dependencies : libds_deps, + include_directories : [libds_include_dirs] + ) + diff --git a/tests/meson.build b/tests/meson.build index 46c197a..258ec49 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,17 +1,4 @@ -incdir = include_directories( - '../src/lib', - '../src/lib/DSBuffer', - '../src/lib/DSRender', - '../src/lib/DSCompositor', - '../src/lib/DSOutput', - '../src/lib/DSInput', - '../src/lib/DSCanvas', - '../src/lib/DSSeat', - '../src/lib/DSPolicyArea', - '../src/lib/DSDisplayArea', - ) - -libds_unittests_src = [ +libds_unittests_srcs = [ 'libds-tests.cpp', 'DSRefBase-test.cpp', 'DSProperty-test.cpp', @@ -29,10 +16,11 @@ libds_unittests_src = [ gmock_dep = dependency('gmock', method : 'pkg-config') -executable('libds-unittests', libds_unittests_src, - include_directories : incdir, - link_with : lib_libds, - dependencies : gmock_dep, - install_dir : dir_bin, - install : true) +executable( + 'libds-unittests', + libds_unittests_srcs, + dependencies : [libds_declared_dep, gmock_dep], + install_dir : libds_prefix_bindir, + install : true + ) -- 2.7.4 From 5350964a3cf76604fe1ea70b1ee0fce43ce2f2ff Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 8 Jun 2020 19:53:04 +0900 Subject: [PATCH 08/16] DSOutput: add getResolutionWidth/Height methods Change-Id: I9a2184ede44b7987e99832cbfe3c03df8a578d2b --- src/DSOutput/DSOutput.cpp | 13 ++++++++++++- src/DSOutput/DSOutput.h | 7 +++++-- tests/DSOutput-test.cpp | 12 ++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/DSOutput/DSOutput.cpp b/src/DSOutput/DSOutput.cpp index 61d33be..5dad86e 100644 --- a/src/DSOutput/DSOutput.cpp +++ b/src/DSOutput/DSOutput.cpp @@ -3,8 +3,19 @@ namespace display_server { DSOutput::DSOutput() + : resolutionWidth(1280), resolutionHeight(720) {} DSOutput::~DSOutput() {} -} // namespace display_server \ No newline at end of file + +int DSOutput::getResolutionWidth() +{ + return resolutionWidth; +} + +int DSOutput::getResolutionHeight() +{ + return resolutionHeight; +} +} // namespace display_server diff --git a/src/DSOutput/DSOutput.h b/src/DSOutput/DSOutput.h index 30f8387..0227a9a 100644 --- a/src/DSOutput/DSOutput.h +++ b/src/DSOutput/DSOutput.h @@ -8,10 +8,13 @@ class DSOutput public: DSOutput(); virtual ~DSOutput(); + int getResolutionWidth(); + int getResolutionHeight(); private: - /* data */ + int resolutionWidth; + int resolutionHeight; }; } -#endif \ No newline at end of file +#endif diff --git a/tests/DSOutput-test.cpp b/tests/DSOutput-test.cpp index fb77982..9c610e8 100644 --- a/tests/DSOutput-test.cpp +++ b/tests/DSOutput-test.cpp @@ -18,3 +18,15 @@ TEST_F(DSOutputTest, NewDSOutput) delete output; ASSERT_TRUE(true); } + +TEST_F(DSOutputTest, GetResolutionWidthHeight) +{ + DSOutput *output = new DSOutput; + + int width = output->getResolutionWidth(); + EXPECT_TRUE(width == 1280); + int height = output->getResolutionHeight(); + EXPECT_TRUE(height == 720); + + delete output; +} -- 2.7.4 From ae3eb7ed53558fde6dbc95faa56b22fa8989ff48 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 8 Jun 2020 19:53:38 +0900 Subject: [PATCH 09/16] DSDisplayArea: add getWidth/Height methods Change-Id: Ib525af6b4cd8ea38105993943cbab3a17566e237 --- src/DSDisplayArea/DSDisplayArea.cpp | 23 ++++++++++++++++++++++- src/DSDisplayArea/DSDisplayArea.h | 9 +++++++-- tests/DSDisplayArea-test.cpp | 20 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp index 22239f9..e6036a1 100644 --- a/src/DSDisplayArea/DSDisplayArea.cpp +++ b/src/DSDisplayArea/DSDisplayArea.cpp @@ -3,8 +3,29 @@ namespace display_server { DSDisplayArea::DSDisplayArea() + : mOutput(nullptr) +{} + +DSDisplayArea::DSDisplayArea(DSOutput *output) + : mOutput(output) {} DSDisplayArea::~DSDisplayArea() {} -} // namespace display_server \ No newline at end of file + +int DSDisplayArea::getWidth() +{ + if (mOutput == nullptr) + return -1; + + return mOutput->getResolutionWidth(); +} + +int DSDisplayArea::getHeight() +{ + if (mOutput == nullptr) + return -1; + + return mOutput->getResolutionHeight(); +} +} // namespace display_server diff --git a/src/DSDisplayArea/DSDisplayArea.h b/src/DSDisplayArea/DSDisplayArea.h index 586e5d4..1adaf3a 100644 --- a/src/DSDisplayArea/DSDisplayArea.h +++ b/src/DSDisplayArea/DSDisplayArea.h @@ -1,17 +1,22 @@ #ifndef _DSDISPLAYAREA_H_ #define _DSDISPLAYAREA_H_ +#include + namespace display_server { class DSDisplayArea { public: DSDisplayArea(); + DSDisplayArea(DSOutput *output); virtual ~DSDisplayArea(); + int getWidth(); + int getHeight(); private: - /* data */ + DSOutput *mOutput; }; } -#endif \ No newline at end of file +#endif diff --git a/tests/DSDisplayArea-test.cpp b/tests/DSDisplayArea-test.cpp index 2c660c6..c967a60 100644 --- a/tests/DSDisplayArea-test.cpp +++ b/tests/DSDisplayArea-test.cpp @@ -16,5 +16,25 @@ TEST_F(DSDisplayAreaTest, NewDSDisplayArea) { DSDisplayArea *displayArea = new DSDisplayArea; delete displayArea; + + DSOutput *output = new DSOutput; + DSDisplayArea *displayArea1 = new DSDisplayArea(output); + delete displayArea1; + delete output; + ASSERT_TRUE(true); } + +TEST_F(DSDisplayAreaTest, GetWidthHeight) +{ + DSOutput *output = new DSOutput; + DSDisplayArea *displayArea = new DSDisplayArea(output); + + int width = displayArea->getWidth(); + EXPECT_TRUE(width == 1280); + + int height = displayArea->getHeight(); + EXPECT_TRUE(height == 720); + + delete displayArea; +} -- 2.7.4 From b0f8e60b7ef0c56853047b49834a757fb24bf4e8 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 9 Jun 2020 19:53:50 +0900 Subject: [PATCH 10/16] DSDebug: add DSDebugLog class Change-Id: Ie4b16276ddff6c8a68e05eb97859570824b115cc --- packaging/libds.spec | 1 + src/DSDebug/DSDebugLog.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++ src/DSDebug/DSDebugLog.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++ src/meson.build | 5 +++- tests/DSDebugLog-test.cpp | 44 ++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 6 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 src/DSDebug/DSDebugLog.cpp create mode 100644 src/DSDebug/DSDebugLog.h create mode 100644 tests/DSDebugLog-test.cpp diff --git a/packaging/libds.spec b/packaging/libds.spec index 8fb7766..9b1a70a 100644 --- a/packaging/libds.spec +++ b/packaging/libds.spec @@ -10,6 +10,7 @@ Source1001: %name.manifest BuildRequires: meson BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gmock) +BuildRequires: pkgconfig(dlog) %description diff --git a/src/DSDebug/DSDebugLog.cpp b/src/DSDebug/DSDebugLog.cpp new file mode 100644 index 0000000..603da86 --- /dev/null +++ b/src/DSDebug/DSDebugLog.cpp @@ -0,0 +1,56 @@ + +#include +#include +#include "DSDebugLog.h" + +#define COLOR_RED "\x1b[31m" /* for error */ +#define COLOR_YELLOW "\x1b[33m" /* for warning */ +#define COLOR_GREEN "\x1b[32m" /* for info */ +#define COLOR_RESET "\x1b[0m" + +namespace display_server +{ +DSDebugLog::DSDebugLog() + : mLogLevel(LOG_LEVEL_DEBUG) +{} + +DSDebugLog::~DSDebugLog() +{} + +DSDebugLog *DSDebugLog::mInstance{nullptr}; +std::mutex DSDebugLog::mMutex; + +DSDebugLog *DSDebugLog::GetInstance() +{ + if (mInstance == nullptr) { + std::lock_guard lock(mMutex); + if (mInstance == nullptr) { + mInstance = new DSDebugLog(); + } + } + + return mInstance; +} + +void DSDebugLog::printLog(int logLevel, const char *fmt, ...) +{ + //TODO: apply logLevel + //TODO: use dlog or stdout + //TODO: use dlog filters + va_list arg; + char *lvl_str[] = {"DS_DBG", "DS_INF", "DS_WRN", "DS_ERR"}; + char *color[] = {COLOR_RESET, COLOR_GREEN, COLOR_YELLOW, COLOR_RED}; + + va_start(arg, fmt); + printf("%s", color[logLevel]); + printf("[%s]", lvl_str[logLevel]); + vprintf(fmt, arg); + va_end(arg); +} + +int DSDebugLog::getLogLevel() +{ + return mLogLevel; +} + +} // namespace display_serer diff --git a/src/DSDebug/DSDebugLog.h b/src/DSDebug/DSDebugLog.h new file mode 100644 index 0000000..b48b124 --- /dev/null +++ b/src/DSDebug/DSDebugLog.h @@ -0,0 +1,60 @@ +#ifndef _DSDEBUG_H_ +#define _DSDEBUG_H_ + +#include +#include + +namespace display_server +{ +class DSDebugLog +{ +public: + enum Log_Level { + LOG_LEVEL_DEBUG, + LOG_LEVEL_INFO, + LOG_LEVEL_WARN, + LOG_LEVEL_ERR, + }; +public: + DSDebugLog(DSDebugLog &other) = delete; // should not be cloneable + void operator=(const DSDebugLog &) = delete; // should not be assignable + + static DSDebugLog *GetInstance(); + void printLog(int logLevel, const char *fmt, ...); + int getLogLevel(); + +private: + DSDebugLog(); // private constructor + ~DSDebugLog(); // private desctructor + + static DSDebugLog *mInstance; // singleton instance + static std::mutex mMutex; // mutex + int mLogLevel; // current log level +}; + +#define DSLOG_DBG(domain, fmt, args...) \ + do { \ + DSDebugLog *log = DSDebugLog::GetInstance(); \ + log->printLog(DSDebugLog::LOG_LEVEL_DEBUG, "[" domain "]: " fmt, ##args); \ + } while (0) + +#define DSLOG_INF(domain, fmt, args...) \ + do { \ + DSDebugLog *log = DSDebugLog::GetInstance(); \ + log->printLog(DSDebugLog::LOG_LEVEL_INFO, "[" domain "]: " fmt, ##args); \ + } while (0) + +#define DSLOG_WRN(domain, fmt, args...) \ + do { \ + DSDebugLog *log = DSDebugLog::GetInstance(); \ + log->printLog(DSDebugLog::LOG_LEVEL_WARN, "[" domain "]: " fmt, ##args); \ + } while (0) + +#define DSLOG_ERR(domain, fmt, args...) \ + do { \ + DSDebugLog *log = DSDebugLog::GetInstance(); \ + log->printLog(DSDebugLog::LOG_LEVEL_ERR, "[" domain "]: " fmt, ##args); \ + } while (0) +} + +#endif diff --git a/src/meson.build b/src/meson.build index c62a4a3..b78b54c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,6 +7,7 @@ libds_srcs = [ 'DSCallback/DSCallback.h', 'DSCanvas/DSCanvas.cpp', 'DSCompositor/DSCompositor.cpp', + 'DSDebug/DSDebugLog.cpp', 'DSDisplayArea/DSDisplayArea.cpp', 'DSInput/DSInput.cpp', 'DSObject/DSObject.cpp', @@ -42,6 +43,7 @@ install_headers( ) pkgconfig = import('pkgconfig') +dlog_dep = dependency('dlog') libds_deps = [] libds_include_dirs = include_directories( @@ -51,6 +53,7 @@ libds_include_dirs = include_directories( './DSCallback', './DSCanvas', './DSCompositor', + './DSDebug', './DSDisplayArea', './DSHWC', './DSInput', @@ -66,7 +69,7 @@ libds_include_dirs = include_directories( libds_lib = shared_library( 'libds', libds_srcs, - dependencies : libds_deps, + dependencies : dlog_dep, include_directories : [libds_include_dirs], version : meson.project_version(), install : true diff --git a/tests/DSDebugLog-test.cpp b/tests/DSDebugLog-test.cpp new file mode 100644 index 0000000..6fc7d8d --- /dev/null +++ b/tests/DSDebugLog-test.cpp @@ -0,0 +1,44 @@ +#include "libds-tests.h" +#include "DSDebugLog.h" + +using namespace display_server; + +class DSDebugLogTest : public ::testing::Test +{ +public: + void SetUp(void) override + {} + void TearDown(void) override + {} +}; + +TEST_F(DSDebugLogTest, GetInstance) +{ + DSDebugLog *log = DSDebugLog::GetInstance(); + EXPECT_TRUE(log->getLogLevel() == DSDebugLog::LOG_LEVEL_DEBUG); +} + +TEST_F(DSDebugLogTest, PrintLog) +{ + const char *str = "Hi world"; + DSDebugLog *log = DSDebugLog::GetInstance(); + + log->printLog(DSDebugLog::LOG_LEVEL_DEBUG, "Hello world\n"); + log->printLog(DSDebugLog::LOG_LEVEL_INFO, "%s\n", str); + log->printLog(DSDebugLog::LOG_LEVEL_WARN, "Greeting world\n"); + log->printLog(DSDebugLog::LOG_LEVEL_ERR, "Hey world\n"); + + EXPECT_TRUE(true); +} + +TEST_F(DSDebugLogTest, LogMacros) +{ + const char *str = "Hi world"; + + DSLOG_DBG("DSTEST", "Hello world\n"); + DSLOG_INF("DSTEST", "%s\n", str); + DSLOG_WRN("DSTEST", "Greeting world\n"); + DSLOG_ERR("DSTEST", "Hey world\n"); + + EXPECT_TRUE(true); +} \ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build index 258ec49..7aa3b8d 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -12,6 +12,7 @@ libds_unittests_srcs = [ 'DSSeat-test.cpp', 'DSPolicyArea-test.cpp', 'DSDisplayArea-test.cpp', + 'DSDebugLog-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From 0d8e48396b637c9eb22b2038a645f53fe5a90f90 Mon Sep 17 00:00:00 2001 From: review-bot Date: Wed, 10 Jun 2020 11:05:16 +0900 Subject: [PATCH 11/16] Apply Coding Style Change-Id: Ic24fb5d02e1d4203db8121e7c8bc5bdd30a9b115 --- src/DSDisplayArea/DSDisplayArea.cpp | 6 ++---- src/DSOutput/DSOutput.cpp | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp index e6036a1..34cac5e 100644 --- a/src/DSDisplayArea/DSDisplayArea.cpp +++ b/src/DSDisplayArea/DSDisplayArea.cpp @@ -2,12 +2,10 @@ namespace display_server { -DSDisplayArea::DSDisplayArea() - : mOutput(nullptr) +DSDisplayArea::DSDisplayArea() : mOutput(nullptr) {} -DSDisplayArea::DSDisplayArea(DSOutput *output) - : mOutput(output) +DSDisplayArea::DSDisplayArea(DSOutput *output) : mOutput(output) {} DSDisplayArea::~DSDisplayArea() diff --git a/src/DSOutput/DSOutput.cpp b/src/DSOutput/DSOutput.cpp index 5dad86e..db3e5bd 100644 --- a/src/DSOutput/DSOutput.cpp +++ b/src/DSOutput/DSOutput.cpp @@ -2,8 +2,7 @@ namespace display_server { -DSOutput::DSOutput() - : resolutionWidth(1280), resolutionHeight(720) +DSOutput::DSOutput() : resolutionWidth(1280), resolutionHeight(720) {} DSOutput::~DSOutput() -- 2.7.4 From 40b31aebf3c3a5c6c3cc60c0ffe3bb0ebf45ad37 Mon Sep 17 00:00:00 2001 From: review-bot Date: Thu, 11 Jun 2020 12:59:22 +0900 Subject: [PATCH 12/16] Apply Coding Style Change-Id: I0c519b59b8ce2544fff4abab0937ab1d8003bd78 --- src/DSDebug/DSDebugLog.cpp | 15 +++++++-------- src/DSDebug/DSDebugLog.h | 40 +++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/DSDebug/DSDebugLog.cpp b/src/DSDebug/DSDebugLog.cpp index 603da86..12255ce 100644 --- a/src/DSDebug/DSDebugLog.cpp +++ b/src/DSDebug/DSDebugLog.cpp @@ -3,21 +3,20 @@ #include #include "DSDebugLog.h" -#define COLOR_RED "\x1b[31m" /* for error */ -#define COLOR_YELLOW "\x1b[33m" /* for warning */ -#define COLOR_GREEN "\x1b[32m" /* for info */ +#define COLOR_RED "\x1b[31m" /* for error */ +#define COLOR_YELLOW "\x1b[33m" /* for warning */ +#define COLOR_GREEN "\x1b[32m" /* for info */ #define COLOR_RESET "\x1b[0m" namespace display_server { -DSDebugLog::DSDebugLog() - : mLogLevel(LOG_LEVEL_DEBUG) +DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG) {} DSDebugLog::~DSDebugLog() {} -DSDebugLog *DSDebugLog::mInstance{nullptr}; +DSDebugLog *DSDebugLog::mInstance { nullptr }; std::mutex DSDebugLog::mMutex; DSDebugLog *DSDebugLog::GetInstance() @@ -38,8 +37,8 @@ void DSDebugLog::printLog(int logLevel, const char *fmt, ...) //TODO: use dlog or stdout //TODO: use dlog filters va_list arg; - char *lvl_str[] = {"DS_DBG", "DS_INF", "DS_WRN", "DS_ERR"}; - char *color[] = {COLOR_RESET, COLOR_GREEN, COLOR_YELLOW, COLOR_RED}; + char *lvl_str[] = { "DS_DBG", "DS_INF", "DS_WRN", "DS_ERR" }; + char *color[] = { COLOR_RESET, COLOR_GREEN, COLOR_YELLOW, COLOR_RED }; va_start(arg, fmt); printf("%s", color[logLevel]); diff --git a/src/DSDebug/DSDebugLog.h b/src/DSDebug/DSDebugLog.h index b48b124..2530221 100644 --- a/src/DSDebug/DSDebugLog.h +++ b/src/DSDebug/DSDebugLog.h @@ -9,12 +9,14 @@ namespace display_server class DSDebugLog { public: - enum Log_Level { + enum Log_Level + { LOG_LEVEL_DEBUG, LOG_LEVEL_INFO, LOG_LEVEL_WARN, LOG_LEVEL_ERR, }; + public: DSDebugLog(DSDebugLog &other) = delete; // should not be cloneable void operator=(const DSDebugLog &) = delete; // should not be assignable @@ -32,28 +34,32 @@ private: int mLogLevel; // current log level }; -#define DSLOG_DBG(domain, fmt, args...) \ - do { \ - DSDebugLog *log = DSDebugLog::GetInstance(); \ - log->printLog(DSDebugLog::LOG_LEVEL_DEBUG, "[" domain "]: " fmt, ##args); \ +#define DSLOG_DBG(domain, fmt, args...) \ + do { \ + DSDebugLog *log = DSDebugLog::GetInstance(); \ + log->printLog(DSDebugLog::LOG_LEVEL_DEBUG, "[" domain "]: " fmt, \ + ##args); \ } while (0) -#define DSLOG_INF(domain, fmt, args...) \ - do { \ - DSDebugLog *log = DSDebugLog::GetInstance(); \ - log->printLog(DSDebugLog::LOG_LEVEL_INFO, "[" domain "]: " fmt, ##args); \ +#define DSLOG_INF(domain, fmt, args...) \ + do { \ + DSDebugLog *log = DSDebugLog::GetInstance(); \ + log->printLog(DSDebugLog::LOG_LEVEL_INFO, "[" domain "]: " fmt, \ + ##args); \ } while (0) -#define DSLOG_WRN(domain, fmt, args...) \ - do { \ - DSDebugLog *log = DSDebugLog::GetInstance(); \ - log->printLog(DSDebugLog::LOG_LEVEL_WARN, "[" domain "]: " fmt, ##args); \ +#define DSLOG_WRN(domain, fmt, args...) \ + do { \ + DSDebugLog *log = DSDebugLog::GetInstance(); \ + log->printLog(DSDebugLog::LOG_LEVEL_WARN, "[" domain "]: " fmt, \ + ##args); \ } while (0) -#define DSLOG_ERR(domain, fmt, args...) \ - do { \ - DSDebugLog *log = DSDebugLog::GetInstance(); \ - log->printLog(DSDebugLog::LOG_LEVEL_ERR, "[" domain "]: " fmt, ##args); \ +#define DSLOG_ERR(domain, fmt, args...) \ + do { \ + DSDebugLog *log = DSDebugLog::GetInstance(); \ + log->printLog(DSDebugLog::LOG_LEVEL_ERR, "[" domain "]: " fmt, \ + ##args); \ } while (0) } -- 2.7.4 From 49d57aeab2983a5ff6dbce90a81ea1b30f0de844 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 10 Jun 2020 13:07:41 +0900 Subject: [PATCH 13/16] samples: fix the typos Change-Id: I12e6036f2654f234c4b4c9d153092a2c9f07c781 --- samples/exampleCompositor.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/exampleCompositor.cpp b/samples/exampleCompositor.cpp index 1ade054..6d938f9 100644 --- a/samples/exampleCompositor.cpp +++ b/samples/exampleCompositor.cpp @@ -6,7 +6,7 @@ #include #include -using display_server; +using namespace display_server; /* 1. MyCompositor and DSCompositor are created. @@ -45,12 +45,12 @@ public: MyCompositor() { int width, height; - width = displayArea.getWidth(); - height = displayArea.getHeight(); + width = displayArea->getWidth(); + height = displayArea->getHeight(); - canvas = new Canvas(); + canvas = new DSCanvas(); - policyArea = new DSPoliyArea(); + policyArea = new DSPolicyArea(); //policyArea->selectWmPolicy(PolicyAreaWmPolicy::MOBILE); //policyArea->selectEffectPolicy(PolicyAreaEffectPolicy::MOBILE); policyArea->setPosition(0, 0); @@ -73,8 +73,8 @@ public: void OutputResolutionSet(DSOutput *output, int width, int height) { displayArea = new DSDisplayArea(output); - displayArea.setPosition(0, 0) - displayArea.setSize(width, height); + displayArea->setPosition(0, 0); + displayArea->setSize(width, height); } void OutputRemove(DSOutput *output) { @@ -96,7 +96,7 @@ private: DSSeat *seat; DSPolicyArea *policyArea; DSDisplayArea *displayArea; -} +}; int main() { DSCompositor *compositor = new MyCompositor(); -- 2.7.4 From c9faa2a7ed8e3a92273fc20fb3ffe289d29e228d Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 15 Jun 2020 21:02:57 +0900 Subject: [PATCH 14/16] DSWaylandServer: add code for DSWaylandServer Change-Id: I769b485b5bdd384664411a21c64011d23c6adfa3 Signed-off-by: Sung-Jin Park --- src/DSWaylandServer/README.md | 2 + .../dswayland-server-fullscreen-shell.cpp | 456 ++ .../dswayland-server-fullscreen-shell.h | 218 + .../dswayland-server-input-method.cpp | 1738 +++++ .../dswayland-server-input-method.h | 580 ++ src/DSWaylandServer/dswayland-server-scaler.cpp | 445 ++ src/DSWaylandServer/dswayland-server-scaler.h | 222 + .../dswayland-server-screenshooter.cpp | 215 + .../dswayland-server-screenshooter.h | 109 + .../dswayland-server-text-cursor-position.cpp | 199 + .../dswayland-server-text-cursor-position.h | 107 + src/DSWaylandServer/dswayland-server-text.cpp | 1350 ++++ src/DSWaylandServer/dswayland-server-text.h | 466 ++ .../dswayland-server-tizen-dpms.cpp | 273 + src/DSWaylandServer/dswayland-server-tizen-dpms.h | 135 + .../dswayland-server-tizen-extension.cpp | 7893 ++++++++++++++++++++ .../dswayland-server-tizen-extension.h | 3192 ++++++++ src/DSWaylandServer/dswayland-server-tizen-hwc.cpp | 399 + src/DSWaylandServer/dswayland-server-tizen-hwc.h | 188 + .../dswayland-server-tizen-launch.cpp | 823 ++ .../dswayland-server-tizen-launch.h | 374 + .../dswayland-server-tizen-remote-surface.cpp | 1261 ++++ .../dswayland-server-tizen-remote-surface.h | 573 ++ .../dswayland-server-tizen-surface.cpp | 412 + .../dswayland-server-tizen-surface.h | 195 + src/DSWaylandServer/dswayland-server-transform.cpp | 406 + src/DSWaylandServer/dswayland-server-transform.h | 202 + src/DSWaylandServer/dswayland-server-wayland.cpp | 5221 +++++++++++++ src/DSWaylandServer/dswayland-server-wayland.h | 2224 ++++++ 29 files changed, 29878 insertions(+) create mode 100644 src/DSWaylandServer/README.md create mode 100644 src/DSWaylandServer/dswayland-server-fullscreen-shell.cpp create mode 100644 src/DSWaylandServer/dswayland-server-fullscreen-shell.h create mode 100644 src/DSWaylandServer/dswayland-server-input-method.cpp create mode 100644 src/DSWaylandServer/dswayland-server-input-method.h create mode 100644 src/DSWaylandServer/dswayland-server-scaler.cpp create mode 100644 src/DSWaylandServer/dswayland-server-scaler.h create mode 100644 src/DSWaylandServer/dswayland-server-screenshooter.cpp create mode 100644 src/DSWaylandServer/dswayland-server-screenshooter.h create mode 100644 src/DSWaylandServer/dswayland-server-text-cursor-position.cpp create mode 100644 src/DSWaylandServer/dswayland-server-text-cursor-position.h create mode 100644 src/DSWaylandServer/dswayland-server-text.cpp create mode 100644 src/DSWaylandServer/dswayland-server-text.h create mode 100644 src/DSWaylandServer/dswayland-server-tizen-dpms.cpp create mode 100644 src/DSWaylandServer/dswayland-server-tizen-dpms.h create mode 100644 src/DSWaylandServer/dswayland-server-tizen-extension.cpp create mode 100644 src/DSWaylandServer/dswayland-server-tizen-extension.h create mode 100644 src/DSWaylandServer/dswayland-server-tizen-hwc.cpp create mode 100644 src/DSWaylandServer/dswayland-server-tizen-hwc.h create mode 100644 src/DSWaylandServer/dswayland-server-tizen-launch.cpp create mode 100644 src/DSWaylandServer/dswayland-server-tizen-launch.h create mode 100644 src/DSWaylandServer/dswayland-server-tizen-remote-surface.cpp create mode 100644 src/DSWaylandServer/dswayland-server-tizen-remote-surface.h create mode 100644 src/DSWaylandServer/dswayland-server-tizen-surface.cpp create mode 100644 src/DSWaylandServer/dswayland-server-tizen-surface.h create mode 100644 src/DSWaylandServer/dswayland-server-transform.cpp create mode 100644 src/DSWaylandServer/dswayland-server-transform.h create mode 100644 src/DSWaylandServer/dswayland-server-wayland.cpp create mode 100644 src/DSWaylandServer/dswayland-server-wayland.h diff --git a/src/DSWaylandServer/README.md b/src/DSWaylandServer/README.md new file mode 100644 index 0000000..10eb855 --- /dev/null +++ b/src/DSWaylandServer/README.md @@ -0,0 +1,2 @@ +# DSWaylandServer +A collection of classes and headers of wayland server side objects diff --git a/src/DSWaylandServer/dswayland-server-fullscreen-shell.cpp b/src/DSWaylandServer/dswayland-server-fullscreen-shell.cpp new file mode 100644 index 0000000..0a4a29b --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-fullscreen-shell.cpp @@ -0,0 +1,456 @@ +/* Protocol XML file : wayland-extension/fullscreen-shell.xml */ + +#include "dswayland-server-fullscreen-shell.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + _wl_fullscreen_shell::_wl_fullscreen_shell(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + _wl_fullscreen_shell::_wl_fullscreen_shell(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + _wl_fullscreen_shell::_wl_fullscreen_shell(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + _wl_fullscreen_shell::_wl_fullscreen_shell() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + _wl_fullscreen_shell::~_wl_fullscreen_shell() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + _wl_fullscreen_shell::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void _wl_fullscreen_shell::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void _wl_fullscreen_shell::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void _wl_fullscreen_shell::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::_wl_fullscreen_shell_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = _wl_fullscreen_shell::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *_wl_fullscreen_shell::interface() + { + return &::_wl_fullscreen_shell_interface; + } + + _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::_wl_fullscreen_shell_allocate() + { + return new Resource; + } + + void _wl_fullscreen_shell::_wl_fullscreen_shell_bind_resource(Resource *) + { + } + + void _wl_fullscreen_shell::_wl_fullscreen_shell_destroy_resource(Resource *) + { + } + + void _wl_fullscreen_shell::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + _wl_fullscreen_shell *that = static_cast<_wl_fullscreen_shell *>(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void _wl_fullscreen_shell::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + _wl_fullscreen_shell *that = static_cast<_wl_fullscreen_shell::DisplayDestroyedListener *>(listener)->parent; + that->m_global = NULL; + } + + void _wl_fullscreen_shell::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + _wl_fullscreen_shell *that = resource->_wl_fullscreen_shell_object; + that->m_resource_map.erase(resource->client()); + that->_wl_fullscreen_shell_destroy_resource(resource); + delete resource; + } + + _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::_wl_fullscreen_shell_interface, version, id); + return bind(handle); + } + + _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::bind(struct ::wl_resource *handle) + { + Resource *resource = _wl_fullscreen_shell_allocate(); + resource->_wl_fullscreen_shell_object = this; + + wl_resource_set_implementation(handle, &m__wl_fullscreen_shell_interface, resource, destroy_func); + resource->handle = handle; + _wl_fullscreen_shell_bind_resource(resource); + return resource; + } + _wl_fullscreen_shell::Resource *_wl_fullscreen_shell::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::_wl_fullscreen_shell_interface, &m__wl_fullscreen_shell_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::_wl_fullscreen_shell_interface _wl_fullscreen_shell::m__wl_fullscreen_shell_interface = { + _wl_fullscreen_shell::handle_release, + _wl_fullscreen_shell::handle_present_surface, + _wl_fullscreen_shell::handle_present_surface_for_mode + }; + + void _wl_fullscreen_shell::_wl_fullscreen_shell_release(Resource *) + { + } + + void _wl_fullscreen_shell::_wl_fullscreen_shell_present_surface(Resource *, struct ::wl_resource *, uint32_t , struct ::wl_resource *) + { + } + + void _wl_fullscreen_shell::_wl_fullscreen_shell_present_surface_for_mode(Resource *, struct ::wl_resource *, struct ::wl_resource *, int32_t , uint32_t) + { + } + + + void _wl_fullscreen_shell::handle_release( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast<_wl_fullscreen_shell *>(r->_wl_fullscreen_shell_object)->_wl_fullscreen_shell_release( + r); + } + + void _wl_fullscreen_shell::handle_present_surface( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t method, + struct ::wl_resource *output) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast<_wl_fullscreen_shell *>(r->_wl_fullscreen_shell_object)->_wl_fullscreen_shell_present_surface( + r, + surface, + method, + output); + } + + void _wl_fullscreen_shell::handle_present_surface_for_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + struct ::wl_resource *output, + int32_t framerate, + uint32_t feedback) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast<_wl_fullscreen_shell *>(r->_wl_fullscreen_shell_object)->_wl_fullscreen_shell_present_surface_for_mode( + r, + surface, + output, + framerate, + feedback); + } + + void _wl_fullscreen_shell::send_capability(uint32_t capability) + { + DS_ASSERT_X(m_resource, "_wl_fullscreen_shell::capability", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call _wl_fullscreen_shell::capability as it's not initialised"); + return; + } + send_capability( + m_resource->handle, + capability); + } + + void _wl_fullscreen_shell::send_capability(struct ::wl_resource *resource, uint32_t capability) + { + _wl_fullscreen_shell_send_capability( + resource, + capability); + } + + + _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + _wl_fullscreen_shell_mode_feedback::~_wl_fullscreen_shell_mode_feedback() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + _wl_fullscreen_shell_mode_feedback::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void _wl_fullscreen_shell_mode_feedback::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void _wl_fullscreen_shell_mode_feedback::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void _wl_fullscreen_shell_mode_feedback::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::_wl_fullscreen_shell_mode_feedback_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = _wl_fullscreen_shell_mode_feedback::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *_wl_fullscreen_shell_mode_feedback::interface() + { + return &::_wl_fullscreen_shell_mode_feedback_interface; + } + + _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback_allocate() + { + return new Resource; + } + + void _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback_bind_resource(Resource *) + { + } + + void _wl_fullscreen_shell_mode_feedback::_wl_fullscreen_shell_mode_feedback_destroy_resource(Resource *) + { + } + + void _wl_fullscreen_shell_mode_feedback::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + _wl_fullscreen_shell_mode_feedback *that = static_cast<_wl_fullscreen_shell_mode_feedback *>(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void _wl_fullscreen_shell_mode_feedback::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + _wl_fullscreen_shell_mode_feedback *that = static_cast<_wl_fullscreen_shell_mode_feedback::DisplayDestroyedListener *>(listener)->parent; + that->m_global = NULL; + } + + void _wl_fullscreen_shell_mode_feedback::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + _wl_fullscreen_shell_mode_feedback *that = resource->_wl_fullscreen_shell_mode_feedback_object; + that->m_resource_map.erase(resource->client()); + that->_wl_fullscreen_shell_mode_feedback_destroy_resource(resource); + delete resource; + } + + _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::_wl_fullscreen_shell_mode_feedback_interface, version, id); + return bind(handle); + } + + _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::bind(struct ::wl_resource *handle) + { + Resource *resource = _wl_fullscreen_shell_mode_feedback_allocate(); + resource->_wl_fullscreen_shell_mode_feedback_object = this; + + wl_resource_set_implementation(handle, NULL, resource, destroy_func); + resource->handle = handle; + _wl_fullscreen_shell_mode_feedback_bind_resource(resource); + return resource; + } + _wl_fullscreen_shell_mode_feedback::Resource *_wl_fullscreen_shell_mode_feedback::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::_wl_fullscreen_shell_mode_feedback_interface, NULL)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + void _wl_fullscreen_shell_mode_feedback::send_mode_successful() + { + DS_ASSERT_X(m_resource, "_wl_fullscreen_shell_mode_feedback::mode_successful", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call _wl_fullscreen_shell_mode_feedback::mode_successful as it's not initialised"); + return; + } + send_mode_successful( + m_resource->handle); + } + + void _wl_fullscreen_shell_mode_feedback::send_mode_successful(struct ::wl_resource *resource) + { + _wl_fullscreen_shell_mode_feedback_send_mode_successful( + resource); + } + + + void _wl_fullscreen_shell_mode_feedback::send_mode_failed() + { + DS_ASSERT_X(m_resource, "_wl_fullscreen_shell_mode_feedback::mode_failed", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call _wl_fullscreen_shell_mode_feedback::mode_failed as it's not initialised"); + return; + } + send_mode_failed( + m_resource->handle); + } + + void _wl_fullscreen_shell_mode_feedback::send_mode_failed(struct ::wl_resource *resource) + { + _wl_fullscreen_shell_mode_feedback_send_mode_failed( + resource); + } + + + void _wl_fullscreen_shell_mode_feedback::send_present_cancelled() + { + DS_ASSERT_X(m_resource, "_wl_fullscreen_shell_mode_feedback::present_cancelled", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call _wl_fullscreen_shell_mode_feedback::present_cancelled as it's not initialised"); + return; + } + send_present_cancelled( + m_resource->handle); + } + + void _wl_fullscreen_shell_mode_feedback::send_present_cancelled(struct ::wl_resource *resource) + { + _wl_fullscreen_shell_mode_feedback_send_present_cancelled( + resource); + } + +} + diff --git a/src/DSWaylandServer/dswayland-server-fullscreen-shell.h b/src/DSWaylandServer/dswayland-server-fullscreen-shell.h new file mode 100644 index 0000000..e3d9ac9 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-fullscreen-shell.h @@ -0,0 +1,218 @@ +/* Protocol XML file : wayland-extension/fullscreen-shell.xml */ + +#ifndef __DS_FULLSCREEN_SHELL_PROTOCOL_H__ +#define __DS_FULLSCREEN_SHELL_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "fullscreen-shell-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class _wl_fullscreen_shell + { + public: + _wl_fullscreen_shell(struct ::wl_client *client, int id, int version); + _wl_fullscreen_shell(struct ::wl_display *display, int version); + _wl_fullscreen_shell(struct ::wl_resource *resource); + _wl_fullscreen_shell(); + + virtual ~_wl_fullscreen_shell(); + + class Resource + { + public: + Resource() : _wl_fullscreen_shell_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + _wl_fullscreen_shell *_wl_fullscreen_shell_object; + _wl_fullscreen_shell *object() { return _wl_fullscreen_shell_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum capability { + capability_arbitrary_modes = 1, // compositor is capable of almost any output mode + capability_cursor_plane = 2, // compositor has a separate cursor plane + }; + + enum present_method { + present_method_default = 0, // no preference, apply default policy + present_method_center = 1, // center the surface on the output + present_method_zoom = 2, // scale the surface, preserving aspect ratio, to the largest size that will fit on the output + present_method_zoom_crop = 3, // scale the surface, preserving aspect ratio, to fully fill the output cropping if needed + present_method_stretch = 4, // scale the surface to the size of the output ignoring aspect ratio + }; + + enum error { + error_invalid_method = 0, // present_method is not known + }; + + void send_capability(uint32_t capability); + void send_capability(struct ::wl_resource *resource, uint32_t capability); + + protected: + virtual Resource *_wl_fullscreen_shell_allocate(); + + virtual void _wl_fullscreen_shell_bind_resource(Resource *resource); + virtual void _wl_fullscreen_shell_destroy_resource(Resource *resource); + + virtual void _wl_fullscreen_shell_release(Resource *resource); + virtual void _wl_fullscreen_shell_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output); + virtual void _wl_fullscreen_shell_present_surface_for_mode(Resource *resource, struct ::wl_resource *surface, struct ::wl_resource *output, int32_t framerate, uint32_t feedback); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::_wl_fullscreen_shell_interface m__wl_fullscreen_shell_interface; + + static void handle_release( + ::wl_client *client, + struct wl_resource *resource); + static void handle_present_surface( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t method, + struct ::wl_resource *output); + static void handle_present_surface_for_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + struct ::wl_resource *output, + int32_t framerate, + uint32_t feedback); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + _wl_fullscreen_shell *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class _wl_fullscreen_shell_mode_feedback + { + public: + _wl_fullscreen_shell_mode_feedback(struct ::wl_client *client, int id, int version); + _wl_fullscreen_shell_mode_feedback(struct ::wl_display *display, int version); + _wl_fullscreen_shell_mode_feedback(struct ::wl_resource *resource); + _wl_fullscreen_shell_mode_feedback(); + + virtual ~_wl_fullscreen_shell_mode_feedback(); + + class Resource + { + public: + Resource() : _wl_fullscreen_shell_mode_feedback_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + _wl_fullscreen_shell_mode_feedback *_wl_fullscreen_shell_mode_feedback_object; + _wl_fullscreen_shell_mode_feedback *object() { return _wl_fullscreen_shell_mode_feedback_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_mode_successful(); + void send_mode_successful(struct ::wl_resource *resource); + void send_mode_failed(); + void send_mode_failed(struct ::wl_resource *resource); + void send_present_cancelled(); + void send_present_cancelled(struct ::wl_resource *resource); + + protected: + virtual Resource *_wl_fullscreen_shell_mode_feedback_allocate(); + + virtual void _wl_fullscreen_shell_mode_feedback_bind_resource(Resource *resource); + virtual void _wl_fullscreen_shell_mode_feedback_destroy_resource(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + _wl_fullscreen_shell_mode_feedback *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-input-method.cpp b/src/DSWaylandServer/dswayland-server-input-method.cpp new file mode 100644 index 0000000..2072859 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-input-method.cpp @@ -0,0 +1,1738 @@ +/* Protocol XML file : wayland-extension/input-method.xml */ + +#include "dswayland-server-input-method.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + wl_input_method_context::wl_input_method_context(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_input_method_context::wl_input_method_context(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_input_method_context::wl_input_method_context(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_input_method_context::wl_input_method_context() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_input_method_context::~wl_input_method_context() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_input_method_context::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_input_method_context::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_input_method_context::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_input_method_context::Resource *wl_input_method_context::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_input_method_context::Resource *wl_input_method_context::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_input_method_context::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_input_method_context_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_input_method_context::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_input_method_context::interface() + { + return &::wl_input_method_context_interface; + } + + wl_input_method_context::Resource *wl_input_method_context::input_method_context_allocate() + { + return new Resource; + } + + void wl_input_method_context::input_method_context_bind_resource(Resource *) + { + } + + void wl_input_method_context::input_method_context_destroy_resource(Resource *) + { + } + + void wl_input_method_context::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_input_method_context *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_input_method_context::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_input_method_context *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_input_method_context::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_input_method_context *that = resource->input_method_context_object; + that->m_resource_map.erase(resource->client()); + that->input_method_context_destroy_resource(resource); + delete resource; + } + + wl_input_method_context::Resource *wl_input_method_context::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_input_method_context_interface, version, id); + return bind(handle); + } + + wl_input_method_context::Resource *wl_input_method_context::bind(struct ::wl_resource *handle) + { + Resource *resource = input_method_context_allocate(); + resource->input_method_context_object = this; + + wl_resource_set_implementation(handle, &m_wl_input_method_context_interface, resource, destroy_func); + resource->handle = handle; + input_method_context_bind_resource(resource); + return resource; + } + wl_input_method_context::Resource *wl_input_method_context::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_input_method_context_interface, &m_wl_input_method_context_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_input_method_context_interface wl_input_method_context::m_wl_input_method_context_interface = { + wl_input_method_context::handle_destroy, + wl_input_method_context::handle_commit_string, + wl_input_method_context::handle_preedit_string, + wl_input_method_context::handle_preedit_styling, + wl_input_method_context::handle_preedit_cursor, + wl_input_method_context::handle_delete_surrounding_text, + wl_input_method_context::handle_cursor_position, + wl_input_method_context::handle_modifiers_map, + wl_input_method_context::handle_keysym, + wl_input_method_context::handle_grab_keyboard, + wl_input_method_context::handle_key, + wl_input_method_context::handle_modifiers, + wl_input_method_context::handle_language, + wl_input_method_context::handle_text_direction, + wl_input_method_context::handle_selection_region, + wl_input_method_context::handle_private_command, + wl_input_method_context::handle_update_input_panel_data, + wl_input_method_context::handle_hide_input_panel, + wl_input_method_context::handle_get_selection_text, + wl_input_method_context::handle_get_surrounding_text, + wl_input_method_context::handle_filter_key_event_done, + wl_input_method_context::handle_update_ise_geometry, + wl_input_method_context::handle_recapture_string, + wl_input_method_context::handle_input_panel_event, + wl_input_method_context::handle_commit_content, + wl_input_method_context::handle_update_candidate_state, + wl_input_method_context::handle_reshow_input_panel + }; + + void wl_input_method_context::input_method_context_destroy(Resource *) + { + } + + void wl_input_method_context::input_method_context_commit_string(Resource *, uint32_t , const std::string &) + { + } + + void wl_input_method_context::input_method_context_preedit_string(Resource *, uint32_t , const std::string &, const std::string &) + { + } + + void wl_input_method_context::input_method_context_preedit_styling(Resource *, uint32_t , uint32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_preedit_cursor(Resource *, int32_t ) + { + } + + void wl_input_method_context::input_method_context_delete_surrounding_text(Resource *, int32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_cursor_position(Resource *, int32_t , int32_t ) + { + } + + void wl_input_method_context::input_method_context_modifiers_map(Resource *, wl_array *) + { + } + + void wl_input_method_context::input_method_context_keysym(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_grab_keyboard(Resource *, uint32_t) + { + } + + void wl_input_method_context::input_method_context_key(Resource *, uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_modifiers(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_language(Resource *, uint32_t , const std::string &) + { + } + + void wl_input_method_context::input_method_context_text_direction(Resource *, uint32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_selection_region(Resource *, uint32_t , int32_t , int32_t ) + { + } + + void wl_input_method_context::input_method_context_private_command(Resource *, uint32_t , const std::string &) + { + } + + void wl_input_method_context::input_method_context_update_input_panel_data(Resource *, uint32_t , const std::string &, uint32_t ) + { + } + + void wl_input_method_context::input_method_context_hide_input_panel(Resource *, uint32_t ) + { + } + + void wl_input_method_context::input_method_context_get_selection_text(Resource *, int32_t ) + { + } + + void wl_input_method_context::input_method_context_get_surrounding_text(Resource *, uint32_t , uint32_t , int32_t ) + { + } + + void wl_input_method_context::input_method_context_filter_key_event_done(Resource *, uint32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_update_ise_geometry(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_recapture_string(Resource *, uint32_t , int32_t , uint32_t , const std::string &, const std::string &, const std::string &) + { + } + + void wl_input_method_context::input_method_context_input_panel_event(Resource *, uint32_t , uint32_t , uint32_t ) + { + } + + void wl_input_method_context::input_method_context_commit_content(Resource *, uint32_t , const std::string &, const std::string &, const std::string &) + { + } + + void wl_input_method_context::input_method_context_update_candidate_state(Resource *, uint32_t ) + { + } + + void wl_input_method_context::input_method_context_reshow_input_panel(Resource *) + { + } + + + void wl_input_method_context::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_destroy( + r); + } + + void wl_input_method_context::handle_commit_string( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *text) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_commit_string( + r, + serial, + std::string(text)); + } + + void wl_input_method_context::handle_preedit_string( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *text, + const char *commit) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_preedit_string( + r, + serial, + std::string(text), + std::string(commit)); + } + + void wl_input_method_context::handle_preedit_styling( + ::wl_client *client, + struct wl_resource *resource, + uint32_t index, + uint32_t length, + uint32_t style) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_preedit_styling( + r, + index, + length, + style); + } + + void wl_input_method_context::handle_preedit_cursor( + ::wl_client *client, + struct wl_resource *resource, + int32_t index) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_preedit_cursor( + r, + index); + } + + void wl_input_method_context::handle_delete_surrounding_text( + ::wl_client *client, + struct wl_resource *resource, + int32_t index, + uint32_t length) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_delete_surrounding_text( + r, + index, + length); + } + + void wl_input_method_context::handle_cursor_position( + ::wl_client *client, + struct wl_resource *resource, + int32_t index, + int32_t anchor) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_cursor_position( + r, + index, + anchor); + } + + void wl_input_method_context::handle_modifiers_map( + ::wl_client *client, + struct wl_resource *resource, + wl_array *map) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_modifiers_map( + r, + map); + } + + void wl_input_method_context::handle_keysym( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t time, + uint32_t sym, + uint32_t state, + uint32_t modifiers) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_keysym( + r, + serial, + time, + sym, + state, + modifiers); + } + + void wl_input_method_context::handle_grab_keyboard( + ::wl_client *client, + struct wl_resource *resource, + uint32_t keyboard) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_grab_keyboard( + r, + keyboard); + } + + void wl_input_method_context::handle_key( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t time, + uint32_t key, + uint32_t state) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_key( + r, + serial, + time, + key, + state); + } + + void wl_input_method_context::handle_modifiers( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_modifiers( + r, + serial, + mods_depressed, + mods_latched, + mods_locked, + group); + } + + void wl_input_method_context::handle_language( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *language) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_language( + r, + serial, + std::string(language)); + } + + void wl_input_method_context::handle_text_direction( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t direction) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_text_direction( + r, + serial, + direction); + } + + void wl_input_method_context::handle_selection_region( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + int32_t start, + int32_t end) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_selection_region( + r, + serial, + start, + end); + } + + void wl_input_method_context::handle_private_command( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *command) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_private_command( + r, + serial, + std::string(command)); + } + + void wl_input_method_context::handle_update_input_panel_data( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *input_panel_data, + uint32_t input_panel_data_length) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_update_input_panel_data( + r, + serial, + std::string(input_panel_data), + input_panel_data_length); + } + + void wl_input_method_context::handle_hide_input_panel( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_hide_input_panel( + r, + serial); + } + + void wl_input_method_context::handle_get_selection_text( + ::wl_client *client, + struct wl_resource *resource, + int32_t fd) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_get_selection_text( + r, + fd); + } + + void wl_input_method_context::handle_get_surrounding_text( + ::wl_client *client, + struct wl_resource *resource, + uint32_t maxlen_before, + uint32_t maxlen_after, + int32_t fd) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_get_surrounding_text( + r, + maxlen_before, + maxlen_after, + fd); + } + + void wl_input_method_context::handle_filter_key_event_done( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t state) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_filter_key_event_done( + r, + serial, + state); + } + + void wl_input_method_context::handle_update_ise_geometry( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t x, + uint32_t y, + uint32_t width, + uint32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_update_ise_geometry( + r, + serial, + x, + y, + width, + height); + } + + void wl_input_method_context::handle_recapture_string( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + int32_t index, + uint32_t length, + const char *preedit, + const char *preedit_commit, + const char *commit) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_recapture_string( + r, + serial, + index, + length, + std::string(preedit), + std::string(preedit_commit), + std::string(commit)); + } + + void wl_input_method_context::handle_input_panel_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t event_type, + uint32_t value) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_input_panel_event( + r, + serial, + event_type, + value); + } + + void wl_input_method_context::handle_commit_content( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *content, + const char *description, + const char *mime_types) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_commit_content( + r, + serial, + std::string(content), + std::string(description), + std::string(mime_types)); + } + + void wl_input_method_context::handle_update_candidate_state( + ::wl_client *client, + struct wl_resource *resource, + uint32_t state) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_update_candidate_state( + r, + state); + } + + void wl_input_method_context::handle_reshow_input_panel( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_method_context_object)->input_method_context_reshow_input_panel( + r); + } + + void wl_input_method_context::send_reset() + { + DS_ASSERT_X(m_resource, "wl_input_method_context::reset", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::reset as it's not initialised"); + return; + } + send_reset( + m_resource->handle); + } + + void wl_input_method_context::send_reset(struct ::wl_resource *resource) + { + wl_input_method_context_send_reset( + resource); + } + + + void wl_input_method_context::send_content_type(uint32_t hint, uint32_t purpose) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::content_type", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::content_type as it's not initialised"); + return; + } + send_content_type( + m_resource->handle, + hint, + purpose); + } + + void wl_input_method_context::send_content_type(struct ::wl_resource *resource, uint32_t hint, uint32_t purpose) + { + wl_input_method_context_send_content_type( + resource, + hint, + purpose); + } + + + void wl_input_method_context::send_invoke_action(uint32_t button, uint32_t index) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::invoke_action", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::invoke_action as it's not initialised"); + return; + } + send_invoke_action( + m_resource->handle, + button, + index); + } + + void wl_input_method_context::send_invoke_action(struct ::wl_resource *resource, uint32_t button, uint32_t index) + { + wl_input_method_context_send_invoke_action( + resource, + button, + index); + } + + + void wl_input_method_context::send_commit_state(uint32_t serial) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::commit_state", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::commit_state as it's not initialised"); + return; + } + send_commit_state( + m_resource->handle, + serial); + } + + void wl_input_method_context::send_commit_state(struct ::wl_resource *resource, uint32_t serial) + { + wl_input_method_context_send_commit_state( + resource, + serial); + } + + + void wl_input_method_context::send_preferred_language(const std::string &language) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::preferred_language", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::preferred_language as it's not initialised"); + return; + } + send_preferred_language( + m_resource->handle, + language); + } + + void wl_input_method_context::send_preferred_language(struct ::wl_resource *resource, const std::string &language) + { + wl_input_method_context_send_preferred_language( + resource, + language.c_str()); + } + + + void wl_input_method_context::send_return_key_type(uint32_t return_key_type) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::return_key_type", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::return_key_type as it's not initialised"); + return; + } + send_return_key_type( + m_resource->handle, + return_key_type); + } + + void wl_input_method_context::send_return_key_type(struct ::wl_resource *resource, uint32_t return_key_type) + { + wl_input_method_context_send_return_key_type( + resource, + return_key_type); + } + + + void wl_input_method_context::send_return_key_disabled(uint32_t return_key_disabled) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::return_key_disabled", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::return_key_disabled as it's not initialised"); + return; + } + send_return_key_disabled( + m_resource->handle, + return_key_disabled); + } + + void wl_input_method_context::send_return_key_disabled(struct ::wl_resource *resource, uint32_t return_key_disabled) + { + wl_input_method_context_send_return_key_disabled( + resource, + return_key_disabled); + } + + + void wl_input_method_context::send_input_panel_data(const std::string &input_panel_data, uint32_t input_panel_data_length) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::input_panel_data", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::input_panel_data as it's not initialised"); + return; + } + send_input_panel_data( + m_resource->handle, + input_panel_data, + input_panel_data_length); + } + + void wl_input_method_context::send_input_panel_data(struct ::wl_resource *resource, const std::string &input_panel_data, uint32_t input_panel_data_length) + { + wl_input_method_context_send_input_panel_data( + resource, + input_panel_data.c_str(), + input_panel_data_length); + } + + + void wl_input_method_context::send_bidi_direction(uint32_t direction) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::bidi_direction", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::bidi_direction as it's not initialised"); + return; + } + send_bidi_direction( + m_resource->handle, + direction); + } + + void wl_input_method_context::send_bidi_direction(struct ::wl_resource *resource, uint32_t direction) + { + wl_input_method_context_send_bidi_direction( + resource, + direction); + } + + + void wl_input_method_context::send_cursor_position(uint32_t cursor_position) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::cursor_position", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::cursor_position as it's not initialised"); + return; + } + send_cursor_position( + m_resource->handle, + cursor_position); + } + + void wl_input_method_context::send_cursor_position(struct ::wl_resource *resource, uint32_t cursor_position) + { + wl_input_method_context_send_cursor_position( + resource, + cursor_position); + } + + + void wl_input_method_context::send_process_input_device_event(uint32_t event_type, const std::string &event_data, uint32_t event_length) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::process_input_device_event", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::process_input_device_event as it's not initialised"); + return; + } + send_process_input_device_event( + m_resource->handle, + event_type, + event_data, + event_length); + } + + void wl_input_method_context::send_process_input_device_event(struct ::wl_resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length) + { + wl_input_method_context_send_process_input_device_event( + resource, + event_type, + event_data.c_str(), + event_length); + } + + + void wl_input_method_context::send_filter_key_event(uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::filter_key_event", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::filter_key_event as it's not initialised"); + return; + } + send_filter_key_event( + m_resource->handle, + serial, + time, + keyname, + state, + modifiers, + dev_name, + dev_class, + dev_subclass, + keycode); + } + + void wl_input_method_context::send_filter_key_event(struct ::wl_resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode) + { + wl_input_method_context_send_filter_key_event( + resource, + serial, + time, + keyname.c_str(), + state, + modifiers, + dev_name.c_str(), + dev_class, + dev_subclass, + keycode); + } + + + void wl_input_method_context::send_capital_mode(uint32_t mode) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::capital_mode", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::capital_mode as it's not initialised"); + return; + } + send_capital_mode( + m_resource->handle, + mode); + } + + void wl_input_method_context::send_capital_mode(struct ::wl_resource *resource, uint32_t mode) + { + wl_input_method_context_send_capital_mode( + resource, + mode); + } + + + void wl_input_method_context::send_prediction_hint(const std::string &text) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::prediction_hint", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::prediction_hint as it's not initialised"); + return; + } + send_prediction_hint( + m_resource->handle, + text); + } + + void wl_input_method_context::send_prediction_hint(struct ::wl_resource *resource, const std::string &text) + { + wl_input_method_context_send_prediction_hint( + resource, + text.c_str()); + } + + + void wl_input_method_context::send_mime_type(const std::string &type) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::mime_type", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::mime_type as it's not initialised"); + return; + } + send_mime_type( + m_resource->handle, + type); + } + + void wl_input_method_context::send_mime_type(struct ::wl_resource *resource, const std::string &type) + { + wl_input_method_context_send_mime_type( + resource, + type.c_str()); + } + + + void wl_input_method_context::send_finalized_content(const std::string &text, uint32_t cursor_position) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::finalized_content", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::finalized_content as it's not initialised"); + return; + } + send_finalized_content( + m_resource->handle, + text, + cursor_position); + } + + void wl_input_method_context::send_finalized_content(struct ::wl_resource *resource, const std::string &text, uint32_t cursor_position) + { + wl_input_method_context_send_finalized_content( + resource, + text.c_str(), + cursor_position); + } + + + void wl_input_method_context::send_prediction_hint_data(const std::string &key, const std::string &value) + { + DS_ASSERT_X(m_resource, "wl_input_method_context::prediction_hint_data", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method_context::prediction_hint_data as it's not initialised"); + return; + } + send_prediction_hint_data( + m_resource->handle, + key, + value); + } + + void wl_input_method_context::send_prediction_hint_data(struct ::wl_resource *resource, const std::string &key, const std::string &value) + { + wl_input_method_context_send_prediction_hint_data( + resource, + key.c_str(), + value.c_str()); + } + + + wl_input_method::wl_input_method(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_input_method::wl_input_method(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_input_method::wl_input_method(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_input_method::wl_input_method() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_input_method::~wl_input_method() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_input_method::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_input_method::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_input_method::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_input_method::Resource *wl_input_method::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_input_method::Resource *wl_input_method::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_input_method::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_input_method_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_input_method::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_input_method::interface() + { + return &::wl_input_method_interface; + } + + wl_input_method::Resource *wl_input_method::input_method_allocate() + { + return new Resource; + } + + void wl_input_method::input_method_bind_resource(Resource *) + { + } + + void wl_input_method::input_method_destroy_resource(Resource *) + { + } + + void wl_input_method::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_input_method *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_input_method::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_input_method *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_input_method::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_input_method *that = resource->input_method_object; + that->m_resource_map.erase(resource->client()); + that->input_method_destroy_resource(resource); + delete resource; + } + + wl_input_method::Resource *wl_input_method::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_input_method_interface, version, id); + return bind(handle); + } + + wl_input_method::Resource *wl_input_method::bind(struct ::wl_resource *handle) + { + Resource *resource = input_method_allocate(); + resource->input_method_object = this; + + wl_resource_set_implementation(handle, NULL, resource, destroy_func); + resource->handle = handle; + input_method_bind_resource(resource); + return resource; + } + wl_input_method::Resource *wl_input_method::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_input_method_interface, NULL)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + void wl_input_method::send_activate(struct ::wl_resource *id, uint32_t text_input_id, uint32_t focus_in_event) + { + DS_ASSERT_X(m_resource, "wl_input_method::activate", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method::activate as it's not initialised"); + return; + } + send_activate( + m_resource->handle, + id, + text_input_id, + focus_in_event); + } + + void wl_input_method::send_activate(struct ::wl_resource *resource, struct ::wl_resource *id, uint32_t text_input_id, uint32_t focus_in_event) + { + wl_input_method_send_activate( + resource, + id, + text_input_id, + focus_in_event); + } + + + void wl_input_method::send_deactivate(struct ::wl_resource *context, uint32_t focus_out_event) + { + DS_ASSERT_X(m_resource, "wl_input_method::deactivate", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method::deactivate as it's not initialised"); + return; + } + send_deactivate( + m_resource->handle, + context, + focus_out_event); + } + + void wl_input_method::send_deactivate(struct ::wl_resource *resource, struct ::wl_resource *context, uint32_t focus_out_event) + { + wl_input_method_send_deactivate( + resource, + context, + focus_out_event); + } + + + void wl_input_method::send_destroy(struct ::wl_resource *context) + { + DS_ASSERT_X(m_resource, "wl_input_method::destroy", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method::destroy as it's not initialised"); + return; + } + send_destroy( + m_resource->handle, + context); + } + + void wl_input_method::send_destroy(struct ::wl_resource *resource, struct ::wl_resource *context) + { + wl_input_method_send_destroy( + resource, + context); + } + + + void wl_input_method::send_show_input_panel(struct ::wl_resource *context) + { + DS_ASSERT_X(m_resource, "wl_input_method::show_input_panel", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method::show_input_panel as it's not initialised"); + return; + } + send_show_input_panel( + m_resource->handle, + context); + } + + void wl_input_method::send_show_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context) + { + wl_input_method_send_show_input_panel( + resource, + context); + } + + + void wl_input_method::send_hide_input_panel(struct ::wl_resource *context) + { + DS_ASSERT_X(m_resource, "wl_input_method::hide_input_panel", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_input_method::hide_input_panel as it's not initialised"); + return; + } + send_hide_input_panel( + m_resource->handle, + context); + } + + void wl_input_method::send_hide_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context) + { + wl_input_method_send_hide_input_panel( + resource, + context); + } + + + wl_input_panel::wl_input_panel(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_input_panel::wl_input_panel(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_input_panel::wl_input_panel(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_input_panel::wl_input_panel() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_input_panel::~wl_input_panel() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_input_panel::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_input_panel::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_input_panel::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_input_panel::Resource *wl_input_panel::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_input_panel::Resource *wl_input_panel::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_input_panel::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_input_panel_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_input_panel::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_input_panel::interface() + { + return &::wl_input_panel_interface; + } + + wl_input_panel::Resource *wl_input_panel::input_panel_allocate() + { + return new Resource; + } + + void wl_input_panel::input_panel_bind_resource(Resource *) + { + } + + void wl_input_panel::input_panel_destroy_resource(Resource *) + { + } + + void wl_input_panel::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_input_panel *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_input_panel::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_input_panel *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_input_panel::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_input_panel *that = resource->input_panel_object; + that->m_resource_map.erase(resource->client()); + that->input_panel_destroy_resource(resource); + delete resource; + } + + wl_input_panel::Resource *wl_input_panel::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_input_panel_interface, version, id); + return bind(handle); + } + + wl_input_panel::Resource *wl_input_panel::bind(struct ::wl_resource *handle) + { + Resource *resource = input_panel_allocate(); + resource->input_panel_object = this; + + wl_resource_set_implementation(handle, &m_wl_input_panel_interface, resource, destroy_func); + resource->handle = handle; + input_panel_bind_resource(resource); + return resource; + } + wl_input_panel::Resource *wl_input_panel::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_input_panel_interface, &m_wl_input_panel_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_input_panel_interface wl_input_panel::m_wl_input_panel_interface = { + wl_input_panel::handle_get_input_panel_surface + }; + + void wl_input_panel::input_panel_get_input_panel_surface(Resource *, uint32_t, struct ::wl_resource *) + { + } + + + void wl_input_panel::handle_get_input_panel_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_panel_object)->input_panel_get_input_panel_surface( + r, + id, + surface); + } + + wl_input_panel_surface::wl_input_panel_surface(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_input_panel_surface::wl_input_panel_surface(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_input_panel_surface::wl_input_panel_surface(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_input_panel_surface::wl_input_panel_surface() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_input_panel_surface::~wl_input_panel_surface() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_input_panel_surface::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_input_panel_surface::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_input_panel_surface::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_input_panel_surface::Resource *wl_input_panel_surface::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_input_panel_surface::Resource *wl_input_panel_surface::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_input_panel_surface::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_input_panel_surface_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_input_panel_surface::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_input_panel_surface::interface() + { + return &::wl_input_panel_surface_interface; + } + + wl_input_panel_surface::Resource *wl_input_panel_surface::input_panel_surface_allocate() + { + return new Resource; + } + + void wl_input_panel_surface::input_panel_surface_bind_resource(Resource *) + { + } + + void wl_input_panel_surface::input_panel_surface_destroy_resource(Resource *) + { + } + + void wl_input_panel_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_input_panel_surface *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_input_panel_surface::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_input_panel_surface *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_input_panel_surface::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_input_panel_surface *that = resource->input_panel_surface_object; + that->m_resource_map.erase(resource->client()); + that->input_panel_surface_destroy_resource(resource); + delete resource; + } + + wl_input_panel_surface::Resource *wl_input_panel_surface::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_input_panel_surface_interface, version, id); + return bind(handle); + } + + wl_input_panel_surface::Resource *wl_input_panel_surface::bind(struct ::wl_resource *handle) + { + Resource *resource = input_panel_surface_allocate(); + resource->input_panel_surface_object = this; + + wl_resource_set_implementation(handle, &m_wl_input_panel_surface_interface, resource, destroy_func); + resource->handle = handle; + input_panel_surface_bind_resource(resource); + return resource; + } + wl_input_panel_surface::Resource *wl_input_panel_surface::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_input_panel_surface_interface, &m_wl_input_panel_surface_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_input_panel_surface_interface wl_input_panel_surface::m_wl_input_panel_surface_interface = { + wl_input_panel_surface::handle_set_toplevel, + wl_input_panel_surface::handle_set_overlay_panel, + wl_input_panel_surface::handle_set_ready, + wl_input_panel_surface::handle_set_floating_panel, + wl_input_panel_surface::handle_set_floating_drag_enabled + }; + + void wl_input_panel_surface::input_panel_surface_set_toplevel(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void wl_input_panel_surface::input_panel_surface_set_overlay_panel(Resource *) + { + } + + void wl_input_panel_surface::input_panel_surface_set_ready(Resource *, uint32_t ) + { + } + + void wl_input_panel_surface::input_panel_surface_set_floating_panel(Resource *, uint32_t ) + { + } + + void wl_input_panel_surface::input_panel_surface_set_floating_drag_enabled(Resource *, uint32_t ) + { + } + + + void wl_input_panel_surface::handle_set_toplevel( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output, + uint32_t position) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_panel_surface_object)->input_panel_surface_set_toplevel( + r, + output, + position); + } + + void wl_input_panel_surface::handle_set_overlay_panel( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_panel_surface_object)->input_panel_surface_set_overlay_panel( + r); + } + + void wl_input_panel_surface::handle_set_ready( + ::wl_client *client, + struct wl_resource *resource, + uint32_t state) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_panel_surface_object)->input_panel_surface_set_ready( + r, + state); + } + + void wl_input_panel_surface::handle_set_floating_panel( + ::wl_client *client, + struct wl_resource *resource, + uint32_t state) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_panel_surface_object)->input_panel_surface_set_floating_panel( + r, + state); + } + + void wl_input_panel_surface::handle_set_floating_drag_enabled( + ::wl_client *client, + struct wl_resource *resource, + uint32_t enabled) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->input_panel_surface_object)->input_panel_surface_set_floating_drag_enabled( + r, + enabled); + } +} + diff --git a/src/DSWaylandServer/dswayland-server-input-method.h b/src/DSWaylandServer/dswayland-server-input-method.h new file mode 100644 index 0000000..9ca66c2 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-input-method.h @@ -0,0 +1,580 @@ +/* Protocol XML file : wayland-extension/input-method.xml */ + +#ifndef __DS_INPUT_METHOD_PROTOCOL_H__ +#define __DS_INPUT_METHOD_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "input-method-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class wl_input_method_context + { + public: + wl_input_method_context(struct ::wl_client *client, int id, int version); + wl_input_method_context(struct ::wl_display *display, int version); + wl_input_method_context(struct ::wl_resource *resource); + wl_input_method_context(); + + virtual ~wl_input_method_context(); + + class Resource + { + public: + Resource() : input_method_context_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_input_method_context *input_method_context_object; + wl_input_method_context *object() { return input_method_context_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_reset(); + void send_reset(struct ::wl_resource *resource); + void send_content_type(uint32_t hint, uint32_t purpose); + void send_content_type(struct ::wl_resource *resource, uint32_t hint, uint32_t purpose); + void send_invoke_action(uint32_t button, uint32_t index); + void send_invoke_action(struct ::wl_resource *resource, uint32_t button, uint32_t index); + void send_commit_state(uint32_t serial); + void send_commit_state(struct ::wl_resource *resource, uint32_t serial); + void send_preferred_language(const std::string &language); + void send_preferred_language(struct ::wl_resource *resource, const std::string &language); + void send_return_key_type(uint32_t return_key_type); + void send_return_key_type(struct ::wl_resource *resource, uint32_t return_key_type); + void send_return_key_disabled(uint32_t return_key_disabled); + void send_return_key_disabled(struct ::wl_resource *resource, uint32_t return_key_disabled); + void send_input_panel_data(const std::string &input_panel_data, uint32_t input_panel_data_length); + void send_input_panel_data(struct ::wl_resource *resource, const std::string &input_panel_data, uint32_t input_panel_data_length); + void send_bidi_direction(uint32_t direction); + void send_bidi_direction(struct ::wl_resource *resource, uint32_t direction); + void send_cursor_position(uint32_t cursor_position); + void send_cursor_position(struct ::wl_resource *resource, uint32_t cursor_position); + void send_process_input_device_event(uint32_t event_type, const std::string &event_data, uint32_t event_length); + void send_process_input_device_event(struct ::wl_resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length); + void send_filter_key_event(uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode); + void send_filter_key_event(struct ::wl_resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode); + void send_capital_mode(uint32_t mode); + void send_capital_mode(struct ::wl_resource *resource, uint32_t mode); + void send_prediction_hint(const std::string &text); + void send_prediction_hint(struct ::wl_resource *resource, const std::string &text); + void send_mime_type(const std::string &type); + void send_mime_type(struct ::wl_resource *resource, const std::string &type); + void send_finalized_content(const std::string &text, uint32_t cursor_position); + void send_finalized_content(struct ::wl_resource *resource, const std::string &text, uint32_t cursor_position); + void send_prediction_hint_data(const std::string &key, const std::string &value); + void send_prediction_hint_data(struct ::wl_resource *resource, const std::string &key, const std::string &value); + + protected: + virtual Resource *input_method_context_allocate(); + + virtual void input_method_context_bind_resource(Resource *resource); + virtual void input_method_context_destroy_resource(Resource *resource); + + virtual void input_method_context_destroy(Resource *resource); + virtual void input_method_context_commit_string(Resource *resource, uint32_t serial, const std::string &text); + virtual void input_method_context_preedit_string(Resource *resource, uint32_t serial, const std::string &text, const std::string &commit); + virtual void input_method_context_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style); + virtual void input_method_context_preedit_cursor(Resource *resource, int32_t index); + virtual void input_method_context_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length); + virtual void input_method_context_cursor_position(Resource *resource, int32_t index, int32_t anchor); + virtual void input_method_context_modifiers_map(Resource *resource, wl_array *map); + virtual void input_method_context_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers); + virtual void input_method_context_grab_keyboard(Resource *resource, uint32_t keyboard); + virtual void input_method_context_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state); + virtual void input_method_context_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group); + virtual void input_method_context_language(Resource *resource, uint32_t serial, const std::string &language); + virtual void input_method_context_text_direction(Resource *resource, uint32_t serial, uint32_t direction); + virtual void input_method_context_selection_region(Resource *resource, uint32_t serial, int32_t start, int32_t end); + virtual void input_method_context_private_command(Resource *resource, uint32_t serial, const std::string &command); + virtual void input_method_context_update_input_panel_data(Resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length); + virtual void input_method_context_hide_input_panel(Resource *resource, uint32_t serial); + virtual void input_method_context_get_selection_text(Resource *resource, int32_t fd); + virtual void input_method_context_get_surrounding_text(Resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd); + virtual void input_method_context_filter_key_event_done(Resource *resource, uint32_t serial, uint32_t state); + virtual void input_method_context_update_ise_geometry(Resource *resource, uint32_t serial, uint32_t x, uint32_t y, uint32_t width, uint32_t height); + virtual void input_method_context_recapture_string(Resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit); + virtual void input_method_context_input_panel_event(Resource *resource, uint32_t serial, uint32_t event_type, uint32_t value); + virtual void input_method_context_commit_content(Resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types); + virtual void input_method_context_update_candidate_state(Resource *resource, uint32_t state); + virtual void input_method_context_reshow_input_panel(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_input_method_context_interface m_wl_input_method_context_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_commit_string( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *text); + static void handle_preedit_string( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *text, + const char *commit); + static void handle_preedit_styling( + ::wl_client *client, + struct wl_resource *resource, + uint32_t index, + uint32_t length, + uint32_t style); + static void handle_preedit_cursor( + ::wl_client *client, + struct wl_resource *resource, + int32_t index); + static void handle_delete_surrounding_text( + ::wl_client *client, + struct wl_resource *resource, + int32_t index, + uint32_t length); + static void handle_cursor_position( + ::wl_client *client, + struct wl_resource *resource, + int32_t index, + int32_t anchor); + static void handle_modifiers_map( + ::wl_client *client, + struct wl_resource *resource, + wl_array *map); + static void handle_keysym( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t time, + uint32_t sym, + uint32_t state, + uint32_t modifiers); + static void handle_grab_keyboard( + ::wl_client *client, + struct wl_resource *resource, + uint32_t keyboard); + static void handle_key( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t time, + uint32_t key, + uint32_t state); + static void handle_modifiers( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t mods_depressed, + uint32_t mods_latched, + uint32_t mods_locked, + uint32_t group); + static void handle_language( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *language); + static void handle_text_direction( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t direction); + static void handle_selection_region( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + int32_t start, + int32_t end); + static void handle_private_command( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *command); + static void handle_update_input_panel_data( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *input_panel_data, + uint32_t input_panel_data_length); + static void handle_hide_input_panel( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial); + static void handle_get_selection_text( + ::wl_client *client, + struct wl_resource *resource, + int32_t fd); + static void handle_get_surrounding_text( + ::wl_client *client, + struct wl_resource *resource, + uint32_t maxlen_before, + uint32_t maxlen_after, + int32_t fd); + static void handle_filter_key_event_done( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t state); + static void handle_update_ise_geometry( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t x, + uint32_t y, + uint32_t width, + uint32_t height); + static void handle_recapture_string( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + int32_t index, + uint32_t length, + const char *preedit, + const char *preedit_commit, + const char *commit); + static void handle_input_panel_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t event_type, + uint32_t value); + static void handle_commit_content( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *content, + const char *description, + const char *mime_types); + static void handle_update_candidate_state( + ::wl_client *client, + struct wl_resource *resource, + uint32_t state); + static void handle_reshow_input_panel( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_input_method_context *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_input_method + { + public: + wl_input_method(struct ::wl_client *client, int id, int version); + wl_input_method(struct ::wl_display *display, int version); + wl_input_method(struct ::wl_resource *resource); + wl_input_method(); + + virtual ~wl_input_method(); + + class Resource + { + public: + Resource() : input_method_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_input_method *input_method_object; + wl_input_method *object() { return input_method_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_activate(struct ::wl_resource *id, uint32_t text_input_id, uint32_t focus_in_event); + void send_activate(struct ::wl_resource *resource, struct ::wl_resource *id, uint32_t text_input_id, uint32_t focus_in_event); + void send_deactivate(struct ::wl_resource *context, uint32_t focus_out_event); + void send_deactivate(struct ::wl_resource *resource, struct ::wl_resource *context, uint32_t focus_out_event); + void send_destroy(struct ::wl_resource *context); + void send_destroy(struct ::wl_resource *resource, struct ::wl_resource *context); + void send_show_input_panel(struct ::wl_resource *context); + void send_show_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context); + void send_hide_input_panel(struct ::wl_resource *context); + void send_hide_input_panel(struct ::wl_resource *resource, struct ::wl_resource *context); + + protected: + virtual Resource *input_method_allocate(); + + virtual void input_method_bind_resource(Resource *resource); + virtual void input_method_destroy_resource(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_input_method *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_input_panel + { + public: + wl_input_panel(struct ::wl_client *client, int id, int version); + wl_input_panel(struct ::wl_display *display, int version); + wl_input_panel(struct ::wl_resource *resource); + wl_input_panel(); + + virtual ~wl_input_panel(); + + class Resource + { + public: + Resource() : input_panel_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_input_panel *input_panel_object; + wl_input_panel *object() { return input_panel_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *input_panel_allocate(); + + virtual void input_panel_bind_resource(Resource *resource); + virtual void input_panel_destroy_resource(Resource *resource); + + virtual void input_panel_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_input_panel_interface m_wl_input_panel_interface; + + static void handle_get_input_panel_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_input_panel *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_input_panel_surface + { + public: + wl_input_panel_surface(struct ::wl_client *client, int id, int version); + wl_input_panel_surface(struct ::wl_display *display, int version); + wl_input_panel_surface(struct ::wl_resource *resource); + wl_input_panel_surface(); + + virtual ~wl_input_panel_surface(); + + class Resource + { + public: + Resource() : input_panel_surface_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_input_panel_surface *input_panel_surface_object; + wl_input_panel_surface *object() { return input_panel_surface_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum position { + position_center_bottom = 0, + }; + + protected: + virtual Resource *input_panel_surface_allocate(); + + virtual void input_panel_surface_bind_resource(Resource *resource); + virtual void input_panel_surface_destroy_resource(Resource *resource); + + virtual void input_panel_surface_set_toplevel(Resource *resource, struct ::wl_resource *output, uint32_t position); + virtual void input_panel_surface_set_overlay_panel(Resource *resource); + virtual void input_panel_surface_set_ready(Resource *resource, uint32_t state); + virtual void input_panel_surface_set_floating_panel(Resource *resource, uint32_t state); + virtual void input_panel_surface_set_floating_drag_enabled(Resource *resource, uint32_t enabled); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_input_panel_surface_interface m_wl_input_panel_surface_interface; + + static void handle_set_toplevel( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output, + uint32_t position); + static void handle_set_overlay_panel( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_ready( + ::wl_client *client, + struct wl_resource *resource, + uint32_t state); + static void handle_set_floating_panel( + ::wl_client *client, + struct wl_resource *resource, + uint32_t state); + static void handle_set_floating_drag_enabled( + ::wl_client *client, + struct wl_resource *resource, + uint32_t enabled); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_input_panel_surface *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-scaler.cpp b/src/DSWaylandServer/dswayland-server-scaler.cpp new file mode 100644 index 0000000..b59ff08 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-scaler.cpp @@ -0,0 +1,445 @@ +/* Protocol XML file : wayland-extension/scaler.xml */ + +#include "dswayland-server-scaler.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + wl_scaler::wl_scaler(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_scaler::wl_scaler(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_scaler::wl_scaler(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_scaler::wl_scaler() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_scaler::~wl_scaler() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_scaler::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_scaler::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_scaler::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_scaler::Resource *wl_scaler::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_scaler::Resource *wl_scaler::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_scaler::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_scaler_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_scaler::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_scaler::interface() + { + return &::wl_scaler_interface; + } + + wl_scaler::Resource *wl_scaler::scaler_allocate() + { + return new Resource; + } + + void wl_scaler::scaler_bind_resource(Resource *) + { + } + + void wl_scaler::scaler_destroy_resource(Resource *) + { + } + + void wl_scaler::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_scaler *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_scaler::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_scaler *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_scaler::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_scaler *that = resource->scaler_object; + that->m_resource_map.erase(resource->client()); + that->scaler_destroy_resource(resource); + delete resource; + } + + wl_scaler::Resource *wl_scaler::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_scaler_interface, version, id); + return bind(handle); + } + + wl_scaler::Resource *wl_scaler::bind(struct ::wl_resource *handle) + { + Resource *resource = scaler_allocate(); + resource->scaler_object = this; + + wl_resource_set_implementation(handle, &m_wl_scaler_interface, resource, destroy_func); + resource->handle = handle; + scaler_bind_resource(resource); + return resource; + } + wl_scaler::Resource *wl_scaler::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_scaler_interface, &m_wl_scaler_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_scaler_interface wl_scaler::m_wl_scaler_interface = { + wl_scaler::handle_destroy, + wl_scaler::handle_get_viewport + }; + + void wl_scaler::scaler_destroy(Resource *) + { + } + + void wl_scaler::scaler_get_viewport(Resource *, uint32_t, struct ::wl_resource *) + { + } + + + void wl_scaler::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->scaler_object)->scaler_destroy( + r); + } + + void wl_scaler::handle_get_viewport( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->scaler_object)->scaler_get_viewport( + r, + id, + surface); + } + + wl_viewport::wl_viewport(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_viewport::wl_viewport(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_viewport::wl_viewport(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_viewport::wl_viewport() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_viewport::~wl_viewport() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_viewport::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_viewport::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_viewport::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_viewport::Resource *wl_viewport::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_viewport::Resource *wl_viewport::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_viewport::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_viewport_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_viewport::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_viewport::interface() + { + return &::wl_viewport_interface; + } + + wl_viewport::Resource *wl_viewport::viewport_allocate() + { + return new Resource; + } + + void wl_viewport::viewport_bind_resource(Resource *) + { + } + + void wl_viewport::viewport_destroy_resource(Resource *) + { + } + + void wl_viewport::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_viewport *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_viewport::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_viewport *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_viewport::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_viewport *that = resource->viewport_object; + that->m_resource_map.erase(resource->client()); + that->viewport_destroy_resource(resource); + delete resource; + } + + wl_viewport::Resource *wl_viewport::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_viewport_interface, version, id); + return bind(handle); + } + + wl_viewport::Resource *wl_viewport::bind(struct ::wl_resource *handle) + { + Resource *resource = viewport_allocate(); + resource->viewport_object = this; + + wl_resource_set_implementation(handle, &m_wl_viewport_interface, resource, destroy_func); + resource->handle = handle; + viewport_bind_resource(resource); + return resource; + } + wl_viewport::Resource *wl_viewport::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_viewport_interface, &m_wl_viewport_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_viewport_interface wl_viewport::m_wl_viewport_interface = { + wl_viewport::handle_destroy, + wl_viewport::handle_set, + wl_viewport::handle_set_source, + wl_viewport::handle_set_destination + }; + + void wl_viewport::viewport_destroy(Resource *) + { + } + + void wl_viewport::viewport_set(Resource *, wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , int32_t , int32_t ) + { + } + + void wl_viewport::viewport_set_source(Resource *, wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t ) + { + } + + void wl_viewport::viewport_set_destination(Resource *, int32_t , int32_t ) + { + } + + + void wl_viewport::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->viewport_object)->viewport_destroy( + r); + } + + void wl_viewport::handle_set( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t src_x, + wl_fixed_t src_y, + wl_fixed_t src_width, + wl_fixed_t src_height, + int32_t dst_width, + int32_t dst_height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->viewport_object)->viewport_set( + r, + src_x, + src_y, + src_width, + src_height, + dst_width, + dst_height); + } + + void wl_viewport::handle_set_source( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t x, + wl_fixed_t y, + wl_fixed_t width, + wl_fixed_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->viewport_object)->viewport_set_source( + r, + x, + y, + width, + height); + } + + void wl_viewport::handle_set_destination( + ::wl_client *client, + struct wl_resource *resource, + int32_t width, + int32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->viewport_object)->viewport_set_destination( + r, + width, + height); + } +} + diff --git a/src/DSWaylandServer/dswayland-server-scaler.h b/src/DSWaylandServer/dswayland-server-scaler.h new file mode 100644 index 0000000..7380d8b --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-scaler.h @@ -0,0 +1,222 @@ +/* Protocol XML file : wayland-extension/scaler.xml */ + +#ifndef __DS_SCALER_PROTOCOL_H__ +#define __DS_SCALER_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "scaler-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class wl_scaler + { + public: + wl_scaler(struct ::wl_client *client, int id, int version); + wl_scaler(struct ::wl_display *display, int version); + wl_scaler(struct ::wl_resource *resource); + wl_scaler(); + + virtual ~wl_scaler(); + + class Resource + { + public: + Resource() : scaler_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_scaler *scaler_object; + wl_scaler *object() { return scaler_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_viewport_exists = 0, // the surface already has a viewport object associated + }; + + protected: + virtual Resource *scaler_allocate(); + + virtual void scaler_bind_resource(Resource *resource); + virtual void scaler_destroy_resource(Resource *resource); + + virtual void scaler_destroy(Resource *resource); + virtual void scaler_get_viewport(Resource *resource, uint32_t id, struct ::wl_resource *surface); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_scaler_interface m_wl_scaler_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_get_viewport( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_scaler *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_viewport + { + public: + wl_viewport(struct ::wl_client *client, int id, int version); + wl_viewport(struct ::wl_display *display, int version); + wl_viewport(struct ::wl_resource *resource); + wl_viewport(); + + virtual ~wl_viewport(); + + class Resource + { + public: + Resource() : viewport_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_viewport *viewport_object; + wl_viewport *object() { return viewport_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_bad_value = 0, // negative or zero values in width or height + }; + + protected: + virtual Resource *viewport_allocate(); + + virtual void viewport_bind_resource(Resource *resource); + virtual void viewport_destroy_resource(Resource *resource); + + virtual void viewport_destroy(Resource *resource); + virtual void viewport_set(Resource *resource, wl_fixed_t src_x, wl_fixed_t src_y, wl_fixed_t src_width, wl_fixed_t src_height, int32_t dst_width, int32_t dst_height); + virtual void viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height); + virtual void viewport_set_destination(Resource *resource, int32_t width, int32_t height); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_viewport_interface m_wl_viewport_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t src_x, + wl_fixed_t src_y, + wl_fixed_t src_width, + wl_fixed_t src_height, + int32_t dst_width, + int32_t dst_height); + static void handle_set_source( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t x, + wl_fixed_t y, + wl_fixed_t width, + wl_fixed_t height); + static void handle_set_destination( + ::wl_client *client, + struct wl_resource *resource, + int32_t width, + int32_t height); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_viewport *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-screenshooter.cpp b/src/DSWaylandServer/dswayland-server-screenshooter.cpp new file mode 100644 index 0000000..2ad7c2a --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-screenshooter.cpp @@ -0,0 +1,215 @@ +/* Protocol XML file : wayland-extension/screenshooter.xml */ + +#include "dswayland-server-screenshooter.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + screenshooter::screenshooter(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + screenshooter::screenshooter(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + screenshooter::screenshooter(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + screenshooter::screenshooter() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + screenshooter::~screenshooter() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + screenshooter::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void screenshooter::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void screenshooter::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + screenshooter::Resource *screenshooter::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + screenshooter::Resource *screenshooter::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void screenshooter::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::screenshooter_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = screenshooter::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *screenshooter::interface() + { + return &::screenshooter_interface; + } + + screenshooter::Resource *screenshooter::screenshooter_allocate() + { + return new Resource; + } + + void screenshooter::screenshooter_bind_resource(Resource *) + { + } + + void screenshooter::screenshooter_destroy_resource(Resource *) + { + } + + void screenshooter::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + screenshooter *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void screenshooter::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + screenshooter *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void screenshooter::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + screenshooter *that = resource->screenshooter_object; + that->m_resource_map.erase(resource->client()); + that->screenshooter_destroy_resource(resource); + delete resource; + } + + screenshooter::Resource *screenshooter::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::screenshooter_interface, version, id); + return bind(handle); + } + + screenshooter::Resource *screenshooter::bind(struct ::wl_resource *handle) + { + Resource *resource = screenshooter_allocate(); + resource->screenshooter_object = this; + + wl_resource_set_implementation(handle, &m_screenshooter_interface, resource, destroy_func); + resource->handle = handle; + screenshooter_bind_resource(resource); + return resource; + } + screenshooter::Resource *screenshooter::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::screenshooter_interface, &m_screenshooter_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::screenshooter_interface screenshooter::m_screenshooter_interface = { + screenshooter::handle_shoot + }; + + void screenshooter::screenshooter_shoot(Resource *, struct ::wl_resource *, struct ::wl_resource *) + { + } + + + void screenshooter::handle_shoot( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output, + struct ::wl_resource *buffer) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->screenshooter_object)->screenshooter_shoot( + r, + output, + buffer); + } + + void screenshooter::send_done() + { + DS_ASSERT_X(m_resource, "screenshooter::done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call screenshooter::done as it's not initialised"); + return; + } + send_done( + m_resource->handle); + } + + void screenshooter::send_done(struct ::wl_resource *resource) + { + screenshooter_send_done( + resource); + } + +} + diff --git a/src/DSWaylandServer/dswayland-server-screenshooter.h b/src/DSWaylandServer/dswayland-server-screenshooter.h new file mode 100644 index 0000000..1aefb67 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-screenshooter.h @@ -0,0 +1,109 @@ +/* Protocol XML file : wayland-extension/screenshooter.xml */ + +#ifndef __DS_SCREENSHOOTER_PROTOCOL_H__ +#define __DS_SCREENSHOOTER_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "screenshooter-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class screenshooter + { + public: + screenshooter(struct ::wl_client *client, int id, int version); + screenshooter(struct ::wl_display *display, int version); + screenshooter(struct ::wl_resource *resource); + screenshooter(); + + virtual ~screenshooter(); + + class Resource + { + public: + Resource() : screenshooter_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + screenshooter *screenshooter_object; + screenshooter *object() { return screenshooter_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_done(); + void send_done(struct ::wl_resource *resource); + + protected: + virtual Resource *screenshooter_allocate(); + + virtual void screenshooter_bind_resource(Resource *resource); + virtual void screenshooter_destroy_resource(Resource *resource); + + virtual void screenshooter_shoot(Resource *resource, struct ::wl_resource *output, struct ::wl_resource *buffer); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::screenshooter_interface m_screenshooter_interface; + + static void handle_shoot( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output, + struct ::wl_resource *buffer); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + screenshooter *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-text-cursor-position.cpp b/src/DSWaylandServer/dswayland-server-text-cursor-position.cpp new file mode 100644 index 0000000..a621ff7 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-text-cursor-position.cpp @@ -0,0 +1,199 @@ +/* Protocol XML file : wayland-extension/text-cursor-position.xml */ + +#include "dswayland-server-text-cursor-position.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + text_cursor_position::text_cursor_position(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + text_cursor_position::text_cursor_position(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + text_cursor_position::text_cursor_position(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + text_cursor_position::text_cursor_position() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + text_cursor_position::~text_cursor_position() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + text_cursor_position::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void text_cursor_position::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void text_cursor_position::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + text_cursor_position::Resource *text_cursor_position::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + text_cursor_position::Resource *text_cursor_position::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void text_cursor_position::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::text_cursor_position_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = text_cursor_position::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *text_cursor_position::interface() + { + return &::text_cursor_position_interface; + } + + text_cursor_position::Resource *text_cursor_position::text_cursor_position_allocate() + { + return new Resource; + } + + void text_cursor_position::text_cursor_position_bind_resource(Resource *) + { + } + + void text_cursor_position::text_cursor_position_destroy_resource(Resource *) + { + } + + void text_cursor_position::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + text_cursor_position *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void text_cursor_position::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + text_cursor_position *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void text_cursor_position::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + text_cursor_position *that = resource->text_cursor_position_object; + that->m_resource_map.erase(resource->client()); + that->text_cursor_position_destroy_resource(resource); + delete resource; + } + + text_cursor_position::Resource *text_cursor_position::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::text_cursor_position_interface, version, id); + return bind(handle); + } + + text_cursor_position::Resource *text_cursor_position::bind(struct ::wl_resource *handle) + { + Resource *resource = text_cursor_position_allocate(); + resource->text_cursor_position_object = this; + + wl_resource_set_implementation(handle, &m_text_cursor_position_interface, resource, destroy_func); + resource->handle = handle; + text_cursor_position_bind_resource(resource); + return resource; + } + text_cursor_position::Resource *text_cursor_position::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::text_cursor_position_interface, &m_text_cursor_position_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::text_cursor_position_interface text_cursor_position::m_text_cursor_position_interface = { + text_cursor_position::handle_notify + }; + + void text_cursor_position::text_cursor_position_notify(Resource *, struct ::wl_resource *, wl_fixed_t , wl_fixed_t ) + { + } + + + void text_cursor_position::handle_notify( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + wl_fixed_t x, + wl_fixed_t y) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_cursor_position_object)->text_cursor_position_notify( + r, + surface, + x, + y); + } +} + diff --git a/src/DSWaylandServer/dswayland-server-text-cursor-position.h b/src/DSWaylandServer/dswayland-server-text-cursor-position.h new file mode 100644 index 0000000..a7cfa10 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-text-cursor-position.h @@ -0,0 +1,107 @@ +/* Protocol XML file : wayland-extension/text-cursor-position.xml */ + +#ifndef __DS_TEXT_CURSOR_POSITION_PROTOCOL_H__ +#define __DS_TEXT_CURSOR_POSITION_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "text-cursor-position-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class text_cursor_position + { + public: + text_cursor_position(struct ::wl_client *client, int id, int version); + text_cursor_position(struct ::wl_display *display, int version); + text_cursor_position(struct ::wl_resource *resource); + text_cursor_position(); + + virtual ~text_cursor_position(); + + class Resource + { + public: + Resource() : text_cursor_position_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + text_cursor_position *text_cursor_position_object; + text_cursor_position *object() { return text_cursor_position_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *text_cursor_position_allocate(); + + virtual void text_cursor_position_bind_resource(Resource *resource); + virtual void text_cursor_position_destroy_resource(Resource *resource); + + virtual void text_cursor_position_notify(Resource *resource, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::text_cursor_position_interface m_text_cursor_position_interface; + + static void handle_notify( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + wl_fixed_t x, + wl_fixed_t y); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + text_cursor_position *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-text.cpp b/src/DSWaylandServer/dswayland-server-text.cpp new file mode 100644 index 0000000..1ef44dd --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-text.cpp @@ -0,0 +1,1350 @@ +/* Protocol XML file : wayland-extension/text.xml */ + +#include "dswayland-server-text.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + wl_text_input::wl_text_input(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_text_input::wl_text_input(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_text_input::wl_text_input(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_text_input::wl_text_input() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_text_input::~wl_text_input() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_text_input::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_text_input::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_text_input::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_text_input::Resource *wl_text_input::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_text_input::Resource *wl_text_input::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_text_input::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_text_input_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_text_input::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_text_input::interface() + { + return &::wl_text_input_interface; + } + + wl_text_input::Resource *wl_text_input::text_input_allocate() + { + return new Resource; + } + + void wl_text_input::text_input_bind_resource(Resource *) + { + } + + void wl_text_input::text_input_destroy_resource(Resource *) + { + } + + void wl_text_input::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_text_input *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_text_input::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_text_input *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_text_input::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_text_input *that = resource->text_input_object; + that->m_resource_map.erase(resource->client()); + that->text_input_destroy_resource(resource); + delete resource; + } + + wl_text_input::Resource *wl_text_input::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_text_input_interface, version, id); + return bind(handle); + } + + wl_text_input::Resource *wl_text_input::bind(struct ::wl_resource *handle) + { + Resource *resource = text_input_allocate(); + resource->text_input_object = this; + + wl_resource_set_implementation(handle, &m_wl_text_input_interface, resource, destroy_func); + resource->handle = handle; + text_input_bind_resource(resource); + return resource; + } + wl_text_input::Resource *wl_text_input::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_text_input_interface, &m_wl_text_input_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_text_input_interface wl_text_input::m_wl_text_input_interface = { + wl_text_input::handle_destroy, + wl_text_input::handle_activate, + wl_text_input::handle_deactivate, + wl_text_input::handle_show_input_panel, + wl_text_input::handle_hide_input_panel, + wl_text_input::handle_reset, + wl_text_input::handle_set_content_type, + wl_text_input::handle_set_cursor_rectangle, + wl_text_input::handle_set_preferred_language, + wl_text_input::handle_commit_state, + wl_text_input::handle_invoke_action, + wl_text_input::handle_set_return_key_type, + wl_text_input::handle_set_return_key_disabled, + wl_text_input::handle_set_input_panel_data, + wl_text_input::handle_bidi_direction, + wl_text_input::handle_set_cursor_position, + wl_text_input::handle_process_input_device_event, + wl_text_input::handle_filter_key_event, + wl_text_input::handle_get_hide_permission, + wl_text_input::handle_set_capital_mode, + wl_text_input::handle_prediction_hint, + wl_text_input::handle_set_mime_type, + wl_text_input::handle_set_input_panel_position, + wl_text_input::handle_finalize_content, + wl_text_input::handle_prediction_hint_data + }; + + void wl_text_input::text_input_destroy(Resource *) + { + } + + void wl_text_input::text_input_activate(Resource *, struct ::wl_resource *, struct ::wl_resource *) + { + } + + void wl_text_input::text_input_deactivate(Resource *, struct ::wl_resource *) + { + } + + void wl_text_input::text_input_show_input_panel(Resource *) + { + } + + void wl_text_input::text_input_hide_input_panel(Resource *) + { + } + + void wl_text_input::text_input_reset(Resource *) + { + } + + void wl_text_input::text_input_set_content_type(Resource *, uint32_t , uint32_t ) + { + } + + void wl_text_input::text_input_set_cursor_rectangle(Resource *, int32_t , int32_t , int32_t , int32_t ) + { + } + + void wl_text_input::text_input_set_preferred_language(Resource *, const std::string &) + { + } + + void wl_text_input::text_input_commit_state(Resource *, uint32_t ) + { + } + + void wl_text_input::text_input_invoke_action(Resource *, uint32_t , uint32_t ) + { + } + + void wl_text_input::text_input_set_return_key_type(Resource *, uint32_t ) + { + } + + void wl_text_input::text_input_set_return_key_disabled(Resource *, uint32_t ) + { + } + + void wl_text_input::text_input_set_input_panel_data(Resource *, const std::string &, uint32_t ) + { + } + + void wl_text_input::text_input_bidi_direction(Resource *, uint32_t ) + { + } + + void wl_text_input::text_input_set_cursor_position(Resource *, uint32_t ) + { + } + + void wl_text_input::text_input_process_input_device_event(Resource *, uint32_t , const std::string &, uint32_t ) + { + } + + void wl_text_input::text_input_filter_key_event(Resource *, uint32_t , uint32_t , const std::string &, uint32_t , uint32_t , const std::string &, uint32_t , uint32_t , uint32_t ) + { + } + + void wl_text_input::text_input_get_hide_permission(Resource *) + { + } + + void wl_text_input::text_input_set_capital_mode(Resource *, uint32_t ) + { + } + + void wl_text_input::text_input_prediction_hint(Resource *, const std::string &) + { + } + + void wl_text_input::text_input_set_mime_type(Resource *, const std::string &) + { + } + + void wl_text_input::text_input_set_input_panel_position(Resource *, uint32_t , uint32_t ) + { + } + + void wl_text_input::text_input_finalize_content(Resource *, const std::string &, uint32_t ) + { + } + + void wl_text_input::text_input_prediction_hint_data(Resource *, const std::string &, const std::string &) + { + } + + + void wl_text_input::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_destroy( + r); + } + + void wl_text_input::handle_activate( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_activate( + r, + seat, + surface); + } + + void wl_text_input::handle_deactivate( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_deactivate( + r, + seat); + } + + void wl_text_input::handle_show_input_panel( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_show_input_panel( + r); + } + + void wl_text_input::handle_hide_input_panel( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_hide_input_panel( + r); + } + + void wl_text_input::handle_reset( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_reset( + r); + } + + void wl_text_input::handle_set_content_type( + ::wl_client *client, + struct wl_resource *resource, + uint32_t hint, + uint32_t purpose) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_content_type( + r, + hint, + purpose); + } + + void wl_text_input::handle_set_cursor_rectangle( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_cursor_rectangle( + r, + x, + y, + width, + height); + } + + void wl_text_input::handle_set_preferred_language( + ::wl_client *client, + struct wl_resource *resource, + const char *language) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_preferred_language( + r, + std::string(language)); + } + + void wl_text_input::handle_commit_state( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_commit_state( + r, + serial); + } + + void wl_text_input::handle_invoke_action( + ::wl_client *client, + struct wl_resource *resource, + uint32_t button, + uint32_t index) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_invoke_action( + r, + button, + index); + } + + void wl_text_input::handle_set_return_key_type( + ::wl_client *client, + struct wl_resource *resource, + uint32_t return_key_type) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_return_key_type( + r, + return_key_type); + } + + void wl_text_input::handle_set_return_key_disabled( + ::wl_client *client, + struct wl_resource *resource, + uint32_t return_key_disabled) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_return_key_disabled( + r, + return_key_disabled); + } + + void wl_text_input::handle_set_input_panel_data( + ::wl_client *client, + struct wl_resource *resource, + const char *input_panel_data, + uint32_t input_panel_length) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_input_panel_data( + r, + std::string(input_panel_data), + input_panel_length); + } + + void wl_text_input::handle_bidi_direction( + ::wl_client *client, + struct wl_resource *resource, + uint32_t direction) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_bidi_direction( + r, + direction); + } + + void wl_text_input::handle_set_cursor_position( + ::wl_client *client, + struct wl_resource *resource, + uint32_t cursor_position) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_cursor_position( + r, + cursor_position); + } + + void wl_text_input::handle_process_input_device_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_type, + const char *event_data, + uint32_t event_length) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_process_input_device_event( + r, + event_type, + std::string(event_data), + event_length); + } + + void wl_text_input::handle_filter_key_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t time, + const char *keyname, + uint32_t state, + uint32_t modifiers, + const char *dev_name, + uint32_t dev_class, + uint32_t dev_subclass, + uint32_t keycode) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_filter_key_event( + r, + serial, + time, + std::string(keyname), + state, + modifiers, + std::string(dev_name), + dev_class, + dev_subclass, + keycode); + } + + void wl_text_input::handle_get_hide_permission( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_get_hide_permission( + r); + } + + void wl_text_input::handle_set_capital_mode( + ::wl_client *client, + struct wl_resource *resource, + uint32_t mode) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_capital_mode( + r, + mode); + } + + void wl_text_input::handle_prediction_hint( + ::wl_client *client, + struct wl_resource *resource, + const char *text) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_prediction_hint( + r, + std::string(text)); + } + + void wl_text_input::handle_set_mime_type( + ::wl_client *client, + struct wl_resource *resource, + const char *type) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_mime_type( + r, + std::string(type)); + } + + void wl_text_input::handle_set_input_panel_position( + ::wl_client *client, + struct wl_resource *resource, + uint32_t x, + uint32_t y) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_set_input_panel_position( + r, + x, + y); + } + + void wl_text_input::handle_finalize_content( + ::wl_client *client, + struct wl_resource *resource, + const char *text, + uint32_t cursor_position) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_finalize_content( + r, + std::string(text), + cursor_position); + } + + void wl_text_input::handle_prediction_hint_data( + ::wl_client *client, + struct wl_resource *resource, + const char *key, + const char *value) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_object)->text_input_prediction_hint_data( + r, + std::string(key), + std::string(value)); + } + + void wl_text_input::send_enter(struct ::wl_resource *surface) + { + DS_ASSERT_X(m_resource, "wl_text_input::enter", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::enter as it's not initialised"); + return; + } + send_enter( + m_resource->handle, + surface); + } + + void wl_text_input::send_enter(struct ::wl_resource *resource, struct ::wl_resource *surface) + { + wl_text_input_send_enter( + resource, + surface); + } + + + void wl_text_input::send_leave() + { + DS_ASSERT_X(m_resource, "wl_text_input::leave", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::leave as it's not initialised"); + return; + } + send_leave( + m_resource->handle); + } + + void wl_text_input::send_leave(struct ::wl_resource *resource) + { + wl_text_input_send_leave( + resource); + } + + + void wl_text_input::send_modifiers_map(const std::string &map) + { + DS_ASSERT_X(m_resource, "wl_text_input::modifiers_map", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::modifiers_map as it's not initialised"); + return; + } + send_modifiers_map( + m_resource->handle, + map); + } + + void wl_text_input::send_modifiers_map(struct ::wl_resource *resource, const std::string &map) + { + struct wl_array map_data; + map_data.size = map.size(); + map_data.data = static_cast(const_cast(map.c_str())); + map_data.alloc = 0; + + wl_text_input_send_modifiers_map( + resource, + &map_data); + } + + + void wl_text_input::send_input_panel_state(uint32_t state) + { + DS_ASSERT_X(m_resource, "wl_text_input::input_panel_state", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::input_panel_state as it's not initialised"); + return; + } + send_input_panel_state( + m_resource->handle, + state); + } + + void wl_text_input::send_input_panel_state(struct ::wl_resource *resource, uint32_t state) + { + wl_text_input_send_input_panel_state( + resource, + state); + } + + + void wl_text_input::send_preedit_string(uint32_t serial, const std::string &text, const std::string &commit) + { + DS_ASSERT_X(m_resource, "wl_text_input::preedit_string", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::preedit_string as it's not initialised"); + return; + } + send_preedit_string( + m_resource->handle, + serial, + text, + commit); + } + + void wl_text_input::send_preedit_string(struct ::wl_resource *resource, uint32_t serial, const std::string &text, const std::string &commit) + { + wl_text_input_send_preedit_string( + resource, + serial, + text.c_str(), + commit.c_str()); + } + + + void wl_text_input::send_preedit_styling(uint32_t index, uint32_t length, uint32_t style) + { + DS_ASSERT_X(m_resource, "wl_text_input::preedit_styling", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::preedit_styling as it's not initialised"); + return; + } + send_preedit_styling( + m_resource->handle, + index, + length, + style); + } + + void wl_text_input::send_preedit_styling(struct ::wl_resource *resource, uint32_t index, uint32_t length, uint32_t style) + { + wl_text_input_send_preedit_styling( + resource, + index, + length, + style); + } + + + void wl_text_input::send_preedit_cursor(int32_t index) + { + DS_ASSERT_X(m_resource, "wl_text_input::preedit_cursor", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::preedit_cursor as it's not initialised"); + return; + } + send_preedit_cursor( + m_resource->handle, + index); + } + + void wl_text_input::send_preedit_cursor(struct ::wl_resource *resource, int32_t index) + { + wl_text_input_send_preedit_cursor( + resource, + index); + } + + + void wl_text_input::send_commit_string(uint32_t serial, const std::string &text) + { + DS_ASSERT_X(m_resource, "wl_text_input::commit_string", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::commit_string as it's not initialised"); + return; + } + send_commit_string( + m_resource->handle, + serial, + text); + } + + void wl_text_input::send_commit_string(struct ::wl_resource *resource, uint32_t serial, const std::string &text) + { + wl_text_input_send_commit_string( + resource, + serial, + text.c_str()); + } + + + void wl_text_input::send_cursor_position(int32_t index, int32_t anchor) + { + DS_ASSERT_X(m_resource, "wl_text_input::cursor_position", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::cursor_position as it's not initialised"); + return; + } + send_cursor_position( + m_resource->handle, + index, + anchor); + } + + void wl_text_input::send_cursor_position(struct ::wl_resource *resource, int32_t index, int32_t anchor) + { + wl_text_input_send_cursor_position( + resource, + index, + anchor); + } + + + void wl_text_input::send_delete_surrounding_text(int32_t index, uint32_t length) + { + DS_ASSERT_X(m_resource, "wl_text_input::delete_surrounding_text", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::delete_surrounding_text as it's not initialised"); + return; + } + send_delete_surrounding_text( + m_resource->handle, + index, + length); + } + + void wl_text_input::send_delete_surrounding_text(struct ::wl_resource *resource, int32_t index, uint32_t length) + { + wl_text_input_send_delete_surrounding_text( + resource, + index, + length); + } + + + void wl_text_input::send_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) + { + DS_ASSERT_X(m_resource, "wl_text_input::keysym", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::keysym as it's not initialised"); + return; + } + send_keysym( + m_resource->handle, + serial, + time, + sym, + state, + modifiers); + } + + void wl_text_input::send_keysym(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) + { + wl_text_input_send_keysym( + resource, + serial, + time, + sym, + state, + modifiers); + } + + + void wl_text_input::send_language(uint32_t serial, const std::string &language) + { + DS_ASSERT_X(m_resource, "wl_text_input::language", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::language as it's not initialised"); + return; + } + send_language( + m_resource->handle, + serial, + language); + } + + void wl_text_input::send_language(struct ::wl_resource *resource, uint32_t serial, const std::string &language) + { + wl_text_input_send_language( + resource, + serial, + language.c_str()); + } + + + void wl_text_input::send_text_direction(uint32_t serial, uint32_t direction) + { + DS_ASSERT_X(m_resource, "wl_text_input::text_direction", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::text_direction as it's not initialised"); + return; + } + send_text_direction( + m_resource->handle, + serial, + direction); + } + + void wl_text_input::send_text_direction(struct ::wl_resource *resource, uint32_t serial, uint32_t direction) + { + wl_text_input_send_text_direction( + resource, + serial, + direction); + } + + + void wl_text_input::send_selection_region(uint32_t serial, int32_t start, int32_t end) + { + DS_ASSERT_X(m_resource, "wl_text_input::selection_region", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::selection_region as it's not initialised"); + return; + } + send_selection_region( + m_resource->handle, + serial, + start, + end); + } + + void wl_text_input::send_selection_region(struct ::wl_resource *resource, uint32_t serial, int32_t start, int32_t end) + { + wl_text_input_send_selection_region( + resource, + serial, + start, + end); + } + + + void wl_text_input::send_private_command(uint32_t serial, const std::string &command) + { + DS_ASSERT_X(m_resource, "wl_text_input::private_command", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::private_command as it's not initialised"); + return; + } + send_private_command( + m_resource->handle, + serial, + command); + } + + void wl_text_input::send_private_command(struct ::wl_resource *resource, uint32_t serial, const std::string &command) + { + wl_text_input_send_private_command( + resource, + serial, + command.c_str()); + } + + + void wl_text_input::send_input_panel_geometry(uint32_t x, uint32_t y, uint32_t width, uint32_t height) + { + DS_ASSERT_X(m_resource, "wl_text_input::input_panel_geometry", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::input_panel_geometry as it's not initialised"); + return; + } + send_input_panel_geometry( + m_resource->handle, + x, + y, + width, + height); + } + + void wl_text_input::send_input_panel_geometry(struct ::wl_resource *resource, uint32_t x, uint32_t y, uint32_t width, uint32_t height) + { + wl_text_input_send_input_panel_geometry( + resource, + x, + y, + width, + height); + } + + + void wl_text_input::send_input_panel_data(uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length) + { + DS_ASSERT_X(m_resource, "wl_text_input::input_panel_data", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::input_panel_data as it's not initialised"); + return; + } + send_input_panel_data( + m_resource->handle, + serial, + input_panel_data, + input_panel_data_length); + } + + void wl_text_input::send_input_panel_data(struct ::wl_resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length) + { + wl_text_input_send_input_panel_data( + resource, + serial, + input_panel_data.c_str(), + input_panel_data_length); + } + + + void wl_text_input::send_get_selection_text(int32_t fd) + { + DS_ASSERT_X(m_resource, "wl_text_input::get_selection_text", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::get_selection_text as it's not initialised"); + return; + } + send_get_selection_text( + m_resource->handle, + fd); + } + + void wl_text_input::send_get_selection_text(struct ::wl_resource *resource, int32_t fd) + { + wl_text_input_send_get_selection_text( + resource, + fd); + } + + + void wl_text_input::send_get_surrounding_text(uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd) + { + DS_ASSERT_X(m_resource, "wl_text_input::get_surrounding_text", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::get_surrounding_text as it's not initialised"); + return; + } + send_get_surrounding_text( + m_resource->handle, + maxlen_before, + maxlen_after, + fd); + } + + void wl_text_input::send_get_surrounding_text(struct ::wl_resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd) + { + wl_text_input_send_get_surrounding_text( + resource, + maxlen_before, + maxlen_after, + fd); + } + + + void wl_text_input::send_filter_key_event_done(uint32_t serial, uint32_t state) + { + DS_ASSERT_X(m_resource, "wl_text_input::filter_key_event_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::filter_key_event_done as it's not initialised"); + return; + } + send_filter_key_event_done( + m_resource->handle, + serial, + state); + } + + void wl_text_input::send_filter_key_event_done(struct ::wl_resource *resource, uint32_t serial, uint32_t state) + { + wl_text_input_send_filter_key_event_done( + resource, + serial, + state); + } + + + void wl_text_input::send_hide_permission(uint32_t response) + { + DS_ASSERT_X(m_resource, "wl_text_input::hide_permission", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::hide_permission as it's not initialised"); + return; + } + send_hide_permission( + m_resource->handle, + response); + } + + void wl_text_input::send_hide_permission(struct ::wl_resource *resource, uint32_t response) + { + wl_text_input_send_hide_permission( + resource, + response); + } + + + void wl_text_input::send_recapture_string(uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit) + { + DS_ASSERT_X(m_resource, "wl_text_input::recapture_string", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::recapture_string as it's not initialised"); + return; + } + send_recapture_string( + m_resource->handle, + serial, + index, + length, + preedit, + preedit_commit, + commit); + } + + void wl_text_input::send_recapture_string(struct ::wl_resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit) + { + wl_text_input_send_recapture_string( + resource, + serial, + index, + length, + preedit.c_str(), + preedit_commit.c_str(), + commit.c_str()); + } + + + void wl_text_input::send_input_panel_event(uint32_t serial, uint32_t event_type, uint32_t value) + { + DS_ASSERT_X(m_resource, "wl_text_input::input_panel_event", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::input_panel_event as it's not initialised"); + return; + } + send_input_panel_event( + m_resource->handle, + serial, + event_type, + value); + } + + void wl_text_input::send_input_panel_event(struct ::wl_resource *resource, uint32_t serial, uint32_t event_type, uint32_t value) + { + wl_text_input_send_input_panel_event( + resource, + serial, + event_type, + value); + } + + + void wl_text_input::send_commit_content(uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types) + { + DS_ASSERT_X(m_resource, "wl_text_input::commit_content", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_text_input::commit_content as it's not initialised"); + return; + } + send_commit_content( + m_resource->handle, + serial, + content, + description, + mime_types); + } + + void wl_text_input::send_commit_content(struct ::wl_resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types) + { + wl_text_input_send_commit_content( + resource, + serial, + content.c_str(), + description.c_str(), + mime_types.c_str()); + } + + + wl_text_input_manager::wl_text_input_manager(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_text_input_manager::wl_text_input_manager(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_text_input_manager::wl_text_input_manager(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_text_input_manager::wl_text_input_manager() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_text_input_manager::~wl_text_input_manager() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_text_input_manager::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_text_input_manager::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_text_input_manager::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_text_input_manager::Resource *wl_text_input_manager::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_text_input_manager::Resource *wl_text_input_manager::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_text_input_manager::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_text_input_manager_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_text_input_manager::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_text_input_manager::interface() + { + return &::wl_text_input_manager_interface; + } + + wl_text_input_manager::Resource *wl_text_input_manager::text_input_manager_allocate() + { + return new Resource; + } + + void wl_text_input_manager::text_input_manager_bind_resource(Resource *) + { + } + + void wl_text_input_manager::text_input_manager_destroy_resource(Resource *) + { + } + + void wl_text_input_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_text_input_manager *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_text_input_manager::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_text_input_manager *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_text_input_manager::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_text_input_manager *that = resource->text_input_manager_object; + that->m_resource_map.erase(resource->client()); + that->text_input_manager_destroy_resource(resource); + delete resource; + } + + wl_text_input_manager::Resource *wl_text_input_manager::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_text_input_manager_interface, version, id); + return bind(handle); + } + + wl_text_input_manager::Resource *wl_text_input_manager::bind(struct ::wl_resource *handle) + { + Resource *resource = text_input_manager_allocate(); + resource->text_input_manager_object = this; + + wl_resource_set_implementation(handle, &m_wl_text_input_manager_interface, resource, destroy_func); + resource->handle = handle; + text_input_manager_bind_resource(resource); + return resource; + } + wl_text_input_manager::Resource *wl_text_input_manager::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_text_input_manager_interface, &m_wl_text_input_manager_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_text_input_manager_interface wl_text_input_manager::m_wl_text_input_manager_interface = { + wl_text_input_manager::handle_create_text_input + }; + + void wl_text_input_manager::text_input_manager_create_text_input(Resource *, uint32_t) + { + } + + + void wl_text_input_manager::handle_create_text_input( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->text_input_manager_object)->text_input_manager_create_text_input( + r, + id); + } +} + diff --git a/src/DSWaylandServer/dswayland-server-text.h b/src/DSWaylandServer/dswayland-server-text.h new file mode 100644 index 0000000..9452f85 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-text.h @@ -0,0 +1,466 @@ +/* Protocol XML file : wayland-extension/text.xml */ + +#ifndef __DS_TEXT_PROTOCOL_H__ +#define __DS_TEXT_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "text-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class wl_text_input + { + public: + wl_text_input(struct ::wl_client *client, int id, int version); + wl_text_input(struct ::wl_display *display, int version); + wl_text_input(struct ::wl_resource *resource); + wl_text_input(); + + virtual ~wl_text_input(); + + class Resource + { + public: + Resource() : text_input_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_text_input *text_input_object; + wl_text_input *object() { return text_input_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum content_hint { + content_hint_none = 0x0, // no special behaviour + content_hint_default = 0x7, // auto completion, correction and capitalization + content_hint_password = 0xc0, // hidden and sensitive text + content_hint_auto_completion = 0x1, // suggest word completions + content_hint_auto_correction = 0x2, // suggest word corrections + content_hint_auto_capitalization = 0x4, // switch to uppercase letters at the start of a sentence + content_hint_lowercase = 0x8, // prefer lowercase letters + content_hint_uppercase = 0x10, // prefer uppercase letters + content_hint_titlecase = 0x20, // prefer casing for titles and headings (can be language dependent) + content_hint_hidden_text = 0x40, // characters should be hidden + content_hint_sensitive_data = 0x80, // typed text should not be stored + content_hint_latin = 0x100, // just latin characters should be entered + content_hint_multiline = 0x200, // the text input is multiline + content_hint_word_capitalization = 0x400, // switch to uppercase letters at the start of a word + content_hint_autofill_credit_card_expiration_date = 0x10000, // autofilled with credit card expiration date + content_hint_autofill_credit_card_expiration_day = 0x20000, // autofilled with credit card expiration day + content_hint_autofill_credit_card_expiration_month = 0x30000, // autofilled with credit card expiration month + content_hint_autofill_credit_card_expiration_year = 0x40000, // autofilled with credit card expiration year + content_hint_autofill_credit_card_number = 0x50000, // autofilled with credit card number + content_hint_autofill_email_address = 0x60000, // autofilled with email address + content_hint_autofill_phone = 0x70000, // autofilled with phone number + content_hint_autofill_postal_address = 0x80000, // autofilled with postal address + content_hint_autofill_postal_code = 0x90000, // autofilled with postal code + content_hint_autofill_id = 0xA0000, // autofilled with id + content_hint_autofill_name = 0xB0000, // autofilled with name + }; + + enum content_purpose { + content_purpose_normal = 0, // default input, allowing all characters + content_purpose_alpha = 1, // allow only alphabetic characters + content_purpose_digits = 2, // allow only digits + content_purpose_number = 3, // input a number (including decimal separator and sign) + content_purpose_phone = 4, // input a phone number + content_purpose_url = 5, // input an URL + content_purpose_email = 6, // input an email address + content_purpose_name = 7, // input a name of a person + content_purpose_password = 8, // input a password (combine with password or sensitive_data hint) + content_purpose_date = 9, // input a date + content_purpose_time = 10, // input a time + content_purpose_datetime = 11, // input a date and time + content_purpose_terminal = 12, // input for a terminal + content_purpose_ip = 13, // input for a IP (number and a-f for Ipv6) + content_purpose_emoticon = 14, // input for an emoticon + content_purpose_digits_signed = 15, // allow digits and negative sign + content_purpose_digits_decimal = 16, // allow digits and decimal point + content_purpose_digits_signeddecimal = 17, // allow digits, negative sign and decimal point + content_purpose_password_digits = 18, // input a password with only digits + content_purpose_filename = 19, // default input for the name of a file (symbols such as '/' should be disabled) + content_purpose_hex = 20, // input for a hexadecimal + content_purpose_voice = 21, // input for a voice + }; + + enum return_key_type { + return_key_type_default = 0, // default + return_key_type_done = 1, // done + return_key_type_go = 2, // go + return_key_type_join = 3, // join + return_key_type_login = 4, // login + return_key_type_next = 5, // next + return_key_type_search = 6, // search + return_key_type_send = 7, // send + }; + + enum capital_mode { + capital_mode_uppercase = 0, // uppercase + capital_mode_lowercase = 1, // lowercase + }; + + enum input_panel_state { + input_panel_state_hide = 0, // Notification prior to the dismissal of the input panel + input_panel_state_show = 1, // Notification after the display of the input panel + }; + + enum preedit_style { + preedit_style_default = 0, // default style for composing text + preedit_style_none = 1, // style should be the same as in non-composing text + preedit_style_active = 2, + preedit_style_inactive = 3, + preedit_style_highlight = 4, + preedit_style_underline = 5, + preedit_style_selection = 6, + preedit_style_incorrect = 7, + preedit_style_reverse = 8, // Draw the text in reverse color mode + preedit_style_bgcolor1 = 9, // Draw the text in underline background 1 mode + preedit_style_bgcolor2 = 10, // Draw the text in underline background 2 mode + preedit_style_bgcolor3 = 11, // Draw the text in underline background 3 mode + preedit_style_bgcolor4 = 12, // Draw the text in underline background 4 mode + }; + + enum text_direction { + text_direction_auto = 0, // automatic text direction based on text and language + text_direction_ltr = 1, // left-to-right + text_direction_rtl = 2, // right-to-left + }; + + void send_enter(struct ::wl_resource *surface); + void send_enter(struct ::wl_resource *resource, struct ::wl_resource *surface); + void send_leave(); + void send_leave(struct ::wl_resource *resource); + void send_modifiers_map(const std::string &map); + void send_modifiers_map(struct ::wl_resource *resource, const std::string &map); + void send_input_panel_state(uint32_t state); + void send_input_panel_state(struct ::wl_resource *resource, uint32_t state); + void send_preedit_string(uint32_t serial, const std::string &text, const std::string &commit); + void send_preedit_string(struct ::wl_resource *resource, uint32_t serial, const std::string &text, const std::string &commit); + void send_preedit_styling(uint32_t index, uint32_t length, uint32_t style); + void send_preedit_styling(struct ::wl_resource *resource, uint32_t index, uint32_t length, uint32_t style); + void send_preedit_cursor(int32_t index); + void send_preedit_cursor(struct ::wl_resource *resource, int32_t index); + void send_commit_string(uint32_t serial, const std::string &text); + void send_commit_string(struct ::wl_resource *resource, uint32_t serial, const std::string &text); + void send_cursor_position(int32_t index, int32_t anchor); + void send_cursor_position(struct ::wl_resource *resource, int32_t index, int32_t anchor); + void send_delete_surrounding_text(int32_t index, uint32_t length); + void send_delete_surrounding_text(struct ::wl_resource *resource, int32_t index, uint32_t length); + void send_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers); + void send_keysym(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers); + void send_language(uint32_t serial, const std::string &language); + void send_language(struct ::wl_resource *resource, uint32_t serial, const std::string &language); + void send_text_direction(uint32_t serial, uint32_t direction); + void send_text_direction(struct ::wl_resource *resource, uint32_t serial, uint32_t direction); + void send_selection_region(uint32_t serial, int32_t start, int32_t end); + void send_selection_region(struct ::wl_resource *resource, uint32_t serial, int32_t start, int32_t end); + void send_private_command(uint32_t serial, const std::string &command); + void send_private_command(struct ::wl_resource *resource, uint32_t serial, const std::string &command); + void send_input_panel_geometry(uint32_t x, uint32_t y, uint32_t width, uint32_t height); + void send_input_panel_geometry(struct ::wl_resource *resource, uint32_t x, uint32_t y, uint32_t width, uint32_t height); + void send_input_panel_data(uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length); + void send_input_panel_data(struct ::wl_resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length); + void send_get_selection_text(int32_t fd); + void send_get_selection_text(struct ::wl_resource *resource, int32_t fd); + void send_get_surrounding_text(uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd); + void send_get_surrounding_text(struct ::wl_resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd); + void send_filter_key_event_done(uint32_t serial, uint32_t state); + void send_filter_key_event_done(struct ::wl_resource *resource, uint32_t serial, uint32_t state); + void send_hide_permission(uint32_t response); + void send_hide_permission(struct ::wl_resource *resource, uint32_t response); + void send_recapture_string(uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit); + void send_recapture_string(struct ::wl_resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit); + void send_input_panel_event(uint32_t serial, uint32_t event_type, uint32_t value); + void send_input_panel_event(struct ::wl_resource *resource, uint32_t serial, uint32_t event_type, uint32_t value); + void send_commit_content(uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types); + void send_commit_content(struct ::wl_resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types); + + protected: + virtual Resource *text_input_allocate(); + + virtual void text_input_bind_resource(Resource *resource); + virtual void text_input_destroy_resource(Resource *resource); + + virtual void text_input_destroy(Resource *resource); + virtual void text_input_activate(Resource *resource, struct ::wl_resource *seat, struct ::wl_resource *surface); + virtual void text_input_deactivate(Resource *resource, struct ::wl_resource *seat); + virtual void text_input_show_input_panel(Resource *resource); + virtual void text_input_hide_input_panel(Resource *resource); + virtual void text_input_reset(Resource *resource); + virtual void text_input_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose); + virtual void text_input_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); + virtual void text_input_set_preferred_language(Resource *resource, const std::string &language); + virtual void text_input_commit_state(Resource *resource, uint32_t serial); + virtual void text_input_invoke_action(Resource *resource, uint32_t button, uint32_t index); + virtual void text_input_set_return_key_type(Resource *resource, uint32_t return_key_type); + virtual void text_input_set_return_key_disabled(Resource *resource, uint32_t return_key_disabled); + virtual void text_input_set_input_panel_data(Resource *resource, const std::string &input_panel_data, uint32_t input_panel_length); + virtual void text_input_bidi_direction(Resource *resource, uint32_t direction); + virtual void text_input_set_cursor_position(Resource *resource, uint32_t cursor_position); + virtual void text_input_process_input_device_event(Resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length); + virtual void text_input_filter_key_event(Resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode); + virtual void text_input_get_hide_permission(Resource *resource); + virtual void text_input_set_capital_mode(Resource *resource, uint32_t mode); + virtual void text_input_prediction_hint(Resource *resource, const std::string &text); + virtual void text_input_set_mime_type(Resource *resource, const std::string &type); + virtual void text_input_set_input_panel_position(Resource *resource, uint32_t x, uint32_t y); + virtual void text_input_finalize_content(Resource *resource, const std::string &text, uint32_t cursor_position); + virtual void text_input_prediction_hint_data(Resource *resource, const std::string &key, const std::string &value); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_text_input_interface m_wl_text_input_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_activate( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat, + struct ::wl_resource *surface); + static void handle_deactivate( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat); + static void handle_show_input_panel( + ::wl_client *client, + struct wl_resource *resource); + static void handle_hide_input_panel( + ::wl_client *client, + struct wl_resource *resource); + static void handle_reset( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_content_type( + ::wl_client *client, + struct wl_resource *resource, + uint32_t hint, + uint32_t purpose); + static void handle_set_cursor_rectangle( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height); + static void handle_set_preferred_language( + ::wl_client *client, + struct wl_resource *resource, + const char *language); + static void handle_commit_state( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial); + static void handle_invoke_action( + ::wl_client *client, + struct wl_resource *resource, + uint32_t button, + uint32_t index); + static void handle_set_return_key_type( + ::wl_client *client, + struct wl_resource *resource, + uint32_t return_key_type); + static void handle_set_return_key_disabled( + ::wl_client *client, + struct wl_resource *resource, + uint32_t return_key_disabled); + static void handle_set_input_panel_data( + ::wl_client *client, + struct wl_resource *resource, + const char *input_panel_data, + uint32_t input_panel_length); + static void handle_bidi_direction( + ::wl_client *client, + struct wl_resource *resource, + uint32_t direction); + static void handle_set_cursor_position( + ::wl_client *client, + struct wl_resource *resource, + uint32_t cursor_position); + static void handle_process_input_device_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_type, + const char *event_data, + uint32_t event_length); + static void handle_filter_key_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t time, + const char *keyname, + uint32_t state, + uint32_t modifiers, + const char *dev_name, + uint32_t dev_class, + uint32_t dev_subclass, + uint32_t keycode); + static void handle_get_hide_permission( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_capital_mode( + ::wl_client *client, + struct wl_resource *resource, + uint32_t mode); + static void handle_prediction_hint( + ::wl_client *client, + struct wl_resource *resource, + const char *text); + static void handle_set_mime_type( + ::wl_client *client, + struct wl_resource *resource, + const char *type); + static void handle_set_input_panel_position( + ::wl_client *client, + struct wl_resource *resource, + uint32_t x, + uint32_t y); + static void handle_finalize_content( + ::wl_client *client, + struct wl_resource *resource, + const char *text, + uint32_t cursor_position); + static void handle_prediction_hint_data( + ::wl_client *client, + struct wl_resource *resource, + const char *key, + const char *value); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_text_input *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_text_input_manager + { + public: + wl_text_input_manager(struct ::wl_client *client, int id, int version); + wl_text_input_manager(struct ::wl_display *display, int version); + wl_text_input_manager(struct ::wl_resource *resource); + wl_text_input_manager(); + + virtual ~wl_text_input_manager(); + + class Resource + { + public: + Resource() : text_input_manager_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_text_input_manager *text_input_manager_object; + wl_text_input_manager *object() { return text_input_manager_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *text_input_manager_allocate(); + + virtual void text_input_manager_bind_resource(Resource *resource); + virtual void text_input_manager_destroy_resource(Resource *resource); + + virtual void text_input_manager_create_text_input(Resource *resource, uint32_t id); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_text_input_manager_interface m_wl_text_input_manager_interface; + + static void handle_create_text_input( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_text_input_manager *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-tizen-dpms.cpp b/src/DSWaylandServer/dswayland-server-tizen-dpms.cpp new file mode 100644 index 0000000..b8ca081 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-dpms.cpp @@ -0,0 +1,273 @@ +/* Protocol XML file : wayland-extension/tizen-dpms.xml */ + +#include "dswayland-server-tizen-dpms.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + tizen_dpms_manager::tizen_dpms_manager(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_dpms_manager::tizen_dpms_manager(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_dpms_manager::tizen_dpms_manager(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_dpms_manager::tizen_dpms_manager() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_dpms_manager::~tizen_dpms_manager() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_dpms_manager::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_dpms_manager::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_dpms_manager::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_dpms_manager::Resource *tizen_dpms_manager::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_dpms_manager::Resource *tizen_dpms_manager::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_dpms_manager::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_dpms_manager_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_dpms_manager::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_dpms_manager::interface() + { + return &::tizen_dpms_manager_interface; + } + + tizen_dpms_manager::Resource *tizen_dpms_manager::tizen_dpms_manager_allocate() + { + return new Resource; + } + + void tizen_dpms_manager::tizen_dpms_manager_bind_resource(Resource *) + { + } + + void tizen_dpms_manager::tizen_dpms_manager_destroy_resource(Resource *) + { + } + + void tizen_dpms_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_dpms_manager *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_dpms_manager::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_dpms_manager *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_dpms_manager::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_dpms_manager *that = resource->tizen_dpms_manager_object; + that->m_resource_map.erase(resource->client()); + that->tizen_dpms_manager_destroy_resource(resource); + delete resource; + } + + tizen_dpms_manager::Resource *tizen_dpms_manager::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_dpms_manager_interface, version, id); + return bind(handle); + } + + tizen_dpms_manager::Resource *tizen_dpms_manager::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_dpms_manager_allocate(); + resource->tizen_dpms_manager_object = this; + + wl_resource_set_implementation(handle, &m_tizen_dpms_manager_interface, resource, destroy_func); + resource->handle = handle; + tizen_dpms_manager_bind_resource(resource); + return resource; + } + tizen_dpms_manager::Resource *tizen_dpms_manager::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_dpms_manager_interface, &m_tizen_dpms_manager_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_dpms_manager_interface tizen_dpms_manager::m_tizen_dpms_manager_interface = { + tizen_dpms_manager::handle_destroy, + tizen_dpms_manager::handle_set_dpms, + tizen_dpms_manager::handle_get_dpms + }; + + void tizen_dpms_manager::tizen_dpms_manager_destroy(Resource *) + { + } + + void tizen_dpms_manager::tizen_dpms_manager_set_dpms(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_dpms_manager::tizen_dpms_manager_get_dpms(Resource *, struct ::wl_resource *) + { + } + + + void tizen_dpms_manager::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_dpms_manager_object)->tizen_dpms_manager_destroy( + r); + } + + void tizen_dpms_manager::handle_set_dpms( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output, + uint32_t mode) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_dpms_manager_object)->tizen_dpms_manager_set_dpms( + r, + output, + mode); + } + + void tizen_dpms_manager::handle_get_dpms( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_dpms_manager_object)->tizen_dpms_manager_get_dpms( + r, + output); + } + + void tizen_dpms_manager::send_set_state(uint32_t mode, uint32_t error) + { + DS_ASSERT_X(m_resource, "tizen_dpms_manager::set_state", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_dpms_manager::set_state as it's not initialised"); + return; + } + send_set_state( + m_resource->handle, + mode, + error); + } + + void tizen_dpms_manager::send_set_state(struct ::wl_resource *resource, uint32_t mode, uint32_t error) + { + tizen_dpms_manager_send_set_state( + resource, + mode, + error); + } + + + void tizen_dpms_manager::send_get_state(uint32_t mode, uint32_t error) + { + DS_ASSERT_X(m_resource, "tizen_dpms_manager::get_state", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_dpms_manager::get_state as it's not initialised"); + return; + } + send_get_state( + m_resource->handle, + mode, + error); + } + + void tizen_dpms_manager::send_get_state(struct ::wl_resource *resource, uint32_t mode, uint32_t error) + { + tizen_dpms_manager_send_get_state( + resource, + mode, + error); + } + +} + diff --git a/src/DSWaylandServer/dswayland-server-tizen-dpms.h b/src/DSWaylandServer/dswayland-server-tizen-dpms.h new file mode 100644 index 0000000..5a3fde3 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-dpms.h @@ -0,0 +1,135 @@ +/* Protocol XML file : wayland-extension/tizen-dpms.xml */ + +#ifndef __DS_TIZEN_DPMS_PROTOCOL_H__ +#define __DS_TIZEN_DPMS_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "tizen-dpms-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class tizen_dpms_manager + { + public: + tizen_dpms_manager(struct ::wl_client *client, int id, int version); + tizen_dpms_manager(struct ::wl_display *display, int version); + tizen_dpms_manager(struct ::wl_resource *resource); + tizen_dpms_manager(); + + virtual ~tizen_dpms_manager(); + + class Resource + { + public: + Resource() : tizen_dpms_manager_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_dpms_manager *tizen_dpms_manager_object; + tizen_dpms_manager *object() { return tizen_dpms_manager_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_none = 0, // no error + error_invalid_permission = 1, // Permission deny + error_invalid_parameter = 2, // Given parameter is invalid + error_not_supported = 3, // Given service is not supported. + error_already_done = 4, // Given request is already done. + }; + + enum mode { + mode_on = 0, // DPMS ON + mode_standby = 1, // DPMS STANDBY + mode_suspend = 2, // DPMS SUSPEND + mode_off = 3, // DPMS OFF + }; + + void send_set_state(uint32_t mode, uint32_t error); + void send_set_state(struct ::wl_resource *resource, uint32_t mode, uint32_t error); + void send_get_state(uint32_t mode, uint32_t error); + void send_get_state(struct ::wl_resource *resource, uint32_t mode, uint32_t error); + + protected: + virtual Resource *tizen_dpms_manager_allocate(); + + virtual void tizen_dpms_manager_bind_resource(Resource *resource); + virtual void tizen_dpms_manager_destroy_resource(Resource *resource); + + virtual void tizen_dpms_manager_destroy(Resource *resource); + virtual void tizen_dpms_manager_set_dpms(Resource *resource, struct ::wl_resource *output, uint32_t mode); + virtual void tizen_dpms_manager_get_dpms(Resource *resource, struct ::wl_resource *output); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_dpms_manager_interface m_tizen_dpms_manager_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_dpms( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output, + uint32_t mode); + static void handle_get_dpms( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_dpms_manager *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-tizen-extension.cpp b/src/DSWaylandServer/dswayland-server-tizen-extension.cpp new file mode 100644 index 0000000..32cd967 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-extension.cpp @@ -0,0 +1,7893 @@ +/* Protocol XML file : wayland-extension/tizen-extension.xml */ + +#include "dswayland-server-tizen-extension.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + tizen_surface::tizen_surface(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_surface::tizen_surface(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_surface::tizen_surface(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_surface::tizen_surface() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_surface::~tizen_surface() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_surface::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_surface::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_surface::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_surface::Resource *tizen_surface::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_surface::Resource *tizen_surface::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_surface::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_surface_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_surface::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_surface::interface() + { + return &::tizen_surface_interface; + } + + tizen_surface::Resource *tizen_surface::tizen_surface_allocate() + { + return new Resource; + } + + void tizen_surface::tizen_surface_bind_resource(Resource *) + { + } + + void tizen_surface::tizen_surface_destroy_resource(Resource *) + { + } + + void tizen_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_surface *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_surface::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_surface *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_surface::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_surface *that = resource->tizen_surface_object; + that->m_resource_map.erase(resource->client()); + that->tizen_surface_destroy_resource(resource); + delete resource; + } + + tizen_surface::Resource *tizen_surface::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_surface_interface, version, id); + return bind(handle); + } + + tizen_surface::Resource *tizen_surface::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_surface_allocate(); + resource->tizen_surface_object = this; + + wl_resource_set_implementation(handle, &m_tizen_surface_interface, resource, destroy_func); + resource->handle = handle; + tizen_surface_bind_resource(resource); + return resource; + } + tizen_surface::Resource *tizen_surface::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_surface_interface, &m_tizen_surface_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_surface_interface tizen_surface::m_tizen_surface_interface = { + tizen_surface::handle_get_tizen_resource, + tizen_surface::handle_destroy + }; + + void tizen_surface::tizen_surface_get_tizen_resource(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_surface::tizen_surface_destroy(Resource *) + { + } + + + void tizen_surface::handle_get_tizen_resource( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_surface_object)->tizen_surface_get_tizen_resource( + r, + id, + surface); + } + + void tizen_surface::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_surface_object)->tizen_surface_destroy( + r); + } + + tizen_resource::tizen_resource(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_resource::tizen_resource(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_resource::tizen_resource(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_resource::tizen_resource() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_resource::~tizen_resource() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_resource::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_resource::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_resource::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_resource::Resource *tizen_resource::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_resource::Resource *tizen_resource::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_resource::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_resource_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_resource::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_resource::interface() + { + return &::tizen_resource_interface; + } + + tizen_resource::Resource *tizen_resource::tizen_resource_allocate() + { + return new Resource; + } + + void tizen_resource::tizen_resource_bind_resource(Resource *) + { + } + + void tizen_resource::tizen_resource_destroy_resource(Resource *) + { + } + + void tizen_resource::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_resource *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_resource::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_resource *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_resource::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_resource *that = resource->tizen_resource_object; + that->m_resource_map.erase(resource->client()); + that->tizen_resource_destroy_resource(resource); + delete resource; + } + + tizen_resource::Resource *tizen_resource::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_resource_interface, version, id); + return bind(handle); + } + + tizen_resource::Resource *tizen_resource::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_resource_allocate(); + resource->tizen_resource_object = this; + + wl_resource_set_implementation(handle, &m_tizen_resource_interface, resource, destroy_func); + resource->handle = handle; + tizen_resource_bind_resource(resource); + return resource; + } + tizen_resource::Resource *tizen_resource::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_resource_interface, &m_tizen_resource_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_resource_interface tizen_resource::m_tizen_resource_interface = { + tizen_resource::handle_destroy + }; + + void tizen_resource::tizen_resource_destroy(Resource *) + { + } + + + void tizen_resource::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_resource_object)->tizen_resource_destroy( + r); + } + + void tizen_resource::send_resource_id(uint32_t id) + { + DS_ASSERT_X(m_resource, "tizen_resource::resource_id", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_resource::resource_id as it's not initialised"); + return; + } + send_resource_id( + m_resource->handle, + id); + } + + void tizen_resource::send_resource_id(struct ::wl_resource *resource, uint32_t id) + { + tizen_resource_send_resource_id( + resource, + id); + } + + + tizen_policy::tizen_policy(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_policy::tizen_policy(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_policy::tizen_policy(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_policy::tizen_policy() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_policy::~tizen_policy() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_policy::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_policy::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_policy::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_policy::Resource *tizen_policy::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_policy::Resource *tizen_policy::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_policy::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_policy_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_policy::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_policy::interface() + { + return &::tizen_policy_interface; + } + + tizen_policy::Resource *tizen_policy::tizen_policy_allocate() + { + return new Resource; + } + + void tizen_policy::tizen_policy_bind_resource(Resource *) + { + } + + void tizen_policy::tizen_policy_destroy_resource(Resource *) + { + } + + void tizen_policy::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_policy *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_policy::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_policy *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_policy::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_policy *that = resource->tizen_policy_object; + that->m_resource_map.erase(resource->client()); + that->tizen_policy_destroy_resource(resource); + delete resource; + } + + tizen_policy::Resource *tizen_policy::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_policy_interface, version, id); + return bind(handle); + } + + tizen_policy::Resource *tizen_policy::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_policy_allocate(); + resource->tizen_policy_object = this; + + wl_resource_set_implementation(handle, &m_tizen_policy_interface, resource, destroy_func); + resource->handle = handle; + tizen_policy_bind_resource(resource); + return resource; + } + tizen_policy::Resource *tizen_policy::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_policy_interface, &m_tizen_policy_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_policy_interface tizen_policy::m_tizen_policy_interface = { + tizen_policy::handle_get_visibility, + tizen_policy::handle_get_position, + tizen_policy::handle_activate, + tizen_policy::handle_activate_below_by_res_id, + tizen_policy::handle_raise, + tizen_policy::handle_lower, + tizen_policy::handle_lower_by_res_id, + tizen_policy::handle_set_focus_skip, + tizen_policy::handle_unset_focus_skip, + tizen_policy::handle_set_role, + tizen_policy::handle_set_type, + tizen_policy::handle_set_conformant, + tizen_policy::handle_unset_conformant, + tizen_policy::handle_get_conformant, + tizen_policy::handle_set_notification_level, + tizen_policy::handle_set_transient_for, + tizen_policy::handle_unset_transient_for, + tizen_policy::handle_set_window_screen_mode, + tizen_policy::handle_place_subsurface_below_parent, + tizen_policy::handle_set_subsurface_stand_alone, + tizen_policy::handle_get_subsurface, + tizen_policy::handle_set_opaque_state, + tizen_policy::handle_iconify, + tizen_policy::handle_uniconify, + tizen_policy::handle_add_aux_hint, + tizen_policy::handle_change_aux_hint, + tizen_policy::handle_del_aux_hint, + tizen_policy::handle_get_supported_aux_hints, + tizen_policy::handle_set_background_state, + tizen_policy::handle_unset_background_state, + tizen_policy::handle_set_floating_mode, + tizen_policy::handle_unset_floating_mode, + tizen_policy::handle_set_stack_mode, + tizen_policy::handle_activate_above_by_res_id, + tizen_policy::handle_get_subsurface_watcher, + tizen_policy::handle_set_parent, + tizen_policy::handle_ack_conformant_region, + tizen_policy::handle_destroy, + tizen_policy::handle_has_video, + tizen_policy::handle_set_appid + }; + + void tizen_policy::tizen_policy_get_visibility(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_get_position(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_activate(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_activate_below_by_res_id(Resource *, uint32_t , uint32_t ) + { + } + + void tizen_policy::tizen_policy_raise(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_lower(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_lower_by_res_id(Resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_set_focus_skip(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_unset_focus_skip(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_set_role(Resource *, struct ::wl_resource *, const std::string &) + { + } + + void tizen_policy::tizen_policy_set_type(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_set_conformant(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_unset_conformant(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_get_conformant(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_set_notification_level(Resource *, struct ::wl_resource *, int32_t ) + { + } + + void tizen_policy::tizen_policy_set_transient_for(Resource *, uint32_t , uint32_t ) + { + } + + void tizen_policy::tizen_policy_unset_transient_for(Resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_set_window_screen_mode(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_place_subsurface_below_parent(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_set_subsurface_stand_alone(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_get_subsurface(Resource *, uint32_t, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_set_opaque_state(Resource *, struct ::wl_resource *, int32_t ) + { + } + + void tizen_policy::tizen_policy_iconify(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_uniconify(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_add_aux_hint(Resource *, struct ::wl_resource *, int32_t , const std::string &, const std::string &) + { + } + + void tizen_policy::tizen_policy_change_aux_hint(Resource *, struct ::wl_resource *, int32_t , const std::string &) + { + } + + void tizen_policy::tizen_policy_del_aux_hint(Resource *, struct ::wl_resource *, int32_t ) + { + } + + void tizen_policy::tizen_policy_get_supported_aux_hints(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_set_background_state(Resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_unset_background_state(Resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_set_floating_mode(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_unset_floating_mode(Resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_set_stack_mode(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_activate_above_by_res_id(Resource *, uint32_t , uint32_t ) + { + } + + void tizen_policy::tizen_policy_get_subsurface_watcher(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_set_parent(Resource *, struct ::wl_resource *, struct ::wl_resource *) + { + } + + void tizen_policy::tizen_policy_ack_conformant_region(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_destroy(Resource *) + { + } + + void tizen_policy::tizen_policy_has_video(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_policy::tizen_policy_set_appid(Resource *, int32_t , const std::string &) + { + } + + + void tizen_policy::handle_get_visibility( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_get_visibility( + r, + id, + surface); + } + + void tizen_policy::handle_get_position( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_get_position( + r, + id, + surface); + } + + void tizen_policy::handle_activate( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_activate( + r, + surface); + } + + void tizen_policy::handle_activate_below_by_res_id( + ::wl_client *client, + struct wl_resource *resource, + uint32_t res_id, + uint32_t below_res_id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_activate_below_by_res_id( + r, + res_id, + below_res_id); + } + + void tizen_policy::handle_raise( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_raise( + r, + surface); + } + + void tizen_policy::handle_lower( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_lower( + r, + surface); + } + + void tizen_policy::handle_lower_by_res_id( + ::wl_client *client, + struct wl_resource *resource, + uint32_t res_id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_lower_by_res_id( + r, + res_id); + } + + void tizen_policy::handle_set_focus_skip( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_focus_skip( + r, + surface); + } + + void tizen_policy::handle_unset_focus_skip( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_unset_focus_skip( + r, + surface); + } + + void tizen_policy::handle_set_role( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + const char *role) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_role( + r, + surface, + std::string(role)); + } + + void tizen_policy::handle_set_type( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t win_type) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_type( + r, + surface, + win_type); + } + + void tizen_policy::handle_set_conformant( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_conformant( + r, + surface); + } + + void tizen_policy::handle_unset_conformant( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_unset_conformant( + r, + surface); + } + + void tizen_policy::handle_get_conformant( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_get_conformant( + r, + surface); + } + + void tizen_policy::handle_set_notification_level( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t level) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_notification_level( + r, + surface, + level); + } + + void tizen_policy::handle_set_transient_for( + ::wl_client *client, + struct wl_resource *resource, + uint32_t child_id, + uint32_t parent_id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_transient_for( + r, + child_id, + parent_id); + } + + void tizen_policy::handle_unset_transient_for( + ::wl_client *client, + struct wl_resource *resource, + uint32_t child_id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_unset_transient_for( + r, + child_id); + } + + void tizen_policy::handle_set_window_screen_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t mode) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_window_screen_mode( + r, + surface, + mode); + } + + void tizen_policy::handle_place_subsurface_below_parent( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *subsurface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_place_subsurface_below_parent( + r, + subsurface); + } + + void tizen_policy::handle_set_subsurface_stand_alone( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *subsurface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_subsurface_stand_alone( + r, + subsurface); + } + + void tizen_policy::handle_get_subsurface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface, + uint32_t parent_id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_get_subsurface( + r, + id, + surface, + parent_id); + } + + void tizen_policy::handle_set_opaque_state( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t state) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_opaque_state( + r, + surface, + state); + } + + void tizen_policy::handle_iconify( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_iconify( + r, + surface); + } + + void tizen_policy::handle_uniconify( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_uniconify( + r, + surface); + } + + void tizen_policy::handle_add_aux_hint( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t id, + const char *name, + const char *value) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_add_aux_hint( + r, + surface, + id, + std::string(name), + std::string(value)); + } + + void tizen_policy::handle_change_aux_hint( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t id, + const char *value) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_change_aux_hint( + r, + surface, + id, + std::string(value)); + } + + void tizen_policy::handle_del_aux_hint( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_del_aux_hint( + r, + surface, + id); + } + + void tizen_policy::handle_get_supported_aux_hints( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_get_supported_aux_hints( + r, + surface); + } + + void tizen_policy::handle_set_background_state( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_background_state( + r, + pid); + } + + void tizen_policy::handle_unset_background_state( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_unset_background_state( + r, + pid); + } + + void tizen_policy::handle_set_floating_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_floating_mode( + r, + surface); + } + + void tizen_policy::handle_unset_floating_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_unset_floating_mode( + r, + surface); + } + + void tizen_policy::handle_set_stack_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t mode) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_stack_mode( + r, + surface, + mode); + } + + void tizen_policy::handle_activate_above_by_res_id( + ::wl_client *client, + struct wl_resource *resource, + uint32_t res_id, + uint32_t above_res_id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_activate_above_by_res_id( + r, + res_id, + above_res_id); + } + + void tizen_policy::handle_get_subsurface_watcher( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_get_subsurface_watcher( + r, + id, + surface); + } + + void tizen_policy::handle_set_parent( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *child, + struct ::wl_resource *parent) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_parent( + r, + child, + parent); + } + + void tizen_policy::handle_ack_conformant_region( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_ack_conformant_region( + r, + surface, + serial); + } + + void tizen_policy::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_destroy( + r); + } + + void tizen_policy::handle_has_video( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t has) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_has_video( + r, + surface, + has); + } + + void tizen_policy::handle_set_appid( + ::wl_client *client, + struct wl_resource *resource, + int32_t pid, + const char *appid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_policy_object)->tizen_policy_set_appid( + r, + pid, + std::string(appid)); + } + + void tizen_policy::send_conformant(struct ::wl_resource *surface, uint32_t is_conformant) + { + DS_ASSERT_X(m_resource, "tizen_policy::conformant", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::conformant as it's not initialised"); + return; + } + send_conformant( + m_resource->handle, + surface, + is_conformant); + } + + void tizen_policy::send_conformant(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t is_conformant) + { + tizen_policy_send_conformant( + resource, + surface, + is_conformant); + } + + + void tizen_policy::send_conformant_area(struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h) + { + DS_ASSERT_X(m_resource, "tizen_policy::conformant_area", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::conformant_area as it's not initialised"); + return; + } + send_conformant_area( + m_resource->handle, + surface, + conformant_part, + state, + x, + y, + w, + h); + } + + void tizen_policy::send_conformant_area(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h) + { + tizen_policy_send_conformant_area( + resource, + surface, + conformant_part, + state, + x, + y, + w, + h); + } + + + void tizen_policy::send_notification_done(struct ::wl_resource *surface, int32_t level, uint32_t error_state) + { + DS_ASSERT_X(m_resource, "tizen_policy::notification_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::notification_done as it's not initialised"); + return; + } + send_notification_done( + m_resource->handle, + surface, + level, + error_state); + } + + void tizen_policy::send_notification_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t level, uint32_t error_state) + { + tizen_policy_send_notification_done( + resource, + surface, + level, + error_state); + } + + + void tizen_policy::send_transient_for_done(uint32_t child_id) + { + DS_ASSERT_X(m_resource, "tizen_policy::transient_for_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::transient_for_done as it's not initialised"); + return; + } + send_transient_for_done( + m_resource->handle, + child_id); + } + + void tizen_policy::send_transient_for_done(struct ::wl_resource *resource, uint32_t child_id) + { + tizen_policy_send_transient_for_done( + resource, + child_id); + } + + + void tizen_policy::send_window_screen_mode_done(struct ::wl_resource *surface, uint32_t mode, uint32_t error_state) + { + DS_ASSERT_X(m_resource, "tizen_policy::window_screen_mode_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::window_screen_mode_done as it's not initialised"); + return; + } + send_window_screen_mode_done( + m_resource->handle, + surface, + mode, + error_state); + } + + void tizen_policy::send_window_screen_mode_done(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode, uint32_t error_state) + { + tizen_policy_send_window_screen_mode_done( + resource, + surface, + mode, + error_state); + } + + + void tizen_policy::send_iconify_state_changed(struct ::wl_resource *surface, uint32_t iconified, uint32_t force) + { + DS_ASSERT_X(m_resource, "tizen_policy::iconify_state_changed", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::iconify_state_changed as it's not initialised"); + return; + } + send_iconify_state_changed( + m_resource->handle, + surface, + iconified, + force); + } + + void tizen_policy::send_iconify_state_changed(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t iconified, uint32_t force) + { + tizen_policy_send_iconify_state_changed( + resource, + surface, + iconified, + force); + } + + + void tizen_policy::send_supported_aux_hints(struct ::wl_resource *surface, const std::string &hints, uint32_t num_hints) + { + DS_ASSERT_X(m_resource, "tizen_policy::supported_aux_hints", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::supported_aux_hints as it's not initialised"); + return; + } + send_supported_aux_hints( + m_resource->handle, + surface, + hints, + num_hints); + } + + void tizen_policy::send_supported_aux_hints(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &hints, uint32_t num_hints) + { + struct wl_array hints_data; + hints_data.size = hints.size(); + hints_data.data = static_cast(const_cast(hints.c_str())); + hints_data.alloc = 0; + + tizen_policy_send_supported_aux_hints( + resource, + surface, + &hints_data, + num_hints); + } + + + void tizen_policy::send_allowed_aux_hint(struct ::wl_resource *surface, int32_t id) + { + DS_ASSERT_X(m_resource, "tizen_policy::allowed_aux_hint", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::allowed_aux_hint as it's not initialised"); + return; + } + send_allowed_aux_hint( + m_resource->handle, + surface, + id); + } + + void tizen_policy::send_allowed_aux_hint(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t id) + { + tizen_policy_send_allowed_aux_hint( + resource, + surface, + id); + } + + + void tizen_policy::send_aux_message(struct ::wl_resource *surface, const std::string &key, const std::string &value, const std::string &options) + { + DS_ASSERT_X(m_resource, "tizen_policy::aux_message", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::aux_message as it's not initialised"); + return; + } + send_aux_message( + m_resource->handle, + surface, + key, + value, + options); + } + + void tizen_policy::send_aux_message(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &key, const std::string &value, const std::string &options) + { + struct wl_array options_data; + options_data.size = options.size(); + options_data.data = static_cast(const_cast(options.c_str())); + options_data.alloc = 0; + + tizen_policy_send_aux_message( + resource, + surface, + key.c_str(), + value.c_str(), + &options_data); + } + + + void tizen_policy::send_conformant_region(struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial) + { + DS_ASSERT_X(m_resource, "tizen_policy::conformant_region", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_policy::conformant_region as it's not initialised"); + return; + } + send_conformant_region( + m_resource->handle, + surface, + conformant_part, + state, + x, + y, + w, + h, + serial); + } + + void tizen_policy::send_conformant_region(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial) + { + tizen_policy_send_conformant_region( + resource, + surface, + conformant_part, + state, + x, + y, + w, + h, + serial); + } + + + tizen_visibility::tizen_visibility(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_visibility::tizen_visibility(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_visibility::tizen_visibility(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_visibility::tizen_visibility() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_visibility::~tizen_visibility() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_visibility::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_visibility::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_visibility::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_visibility::Resource *tizen_visibility::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_visibility::Resource *tizen_visibility::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_visibility::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_visibility_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_visibility::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_visibility::interface() + { + return &::tizen_visibility_interface; + } + + tizen_visibility::Resource *tizen_visibility::tizen_visibility_allocate() + { + return new Resource; + } + + void tizen_visibility::tizen_visibility_bind_resource(Resource *) + { + } + + void tizen_visibility::tizen_visibility_destroy_resource(Resource *) + { + } + + void tizen_visibility::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_visibility *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_visibility::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_visibility *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_visibility::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_visibility *that = resource->tizen_visibility_object; + that->m_resource_map.erase(resource->client()); + that->tizen_visibility_destroy_resource(resource); + delete resource; + } + + tizen_visibility::Resource *tizen_visibility::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_visibility_interface, version, id); + return bind(handle); + } + + tizen_visibility::Resource *tizen_visibility::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_visibility_allocate(); + resource->tizen_visibility_object = this; + + wl_resource_set_implementation(handle, &m_tizen_visibility_interface, resource, destroy_func); + resource->handle = handle; + tizen_visibility_bind_resource(resource); + return resource; + } + tizen_visibility::Resource *tizen_visibility::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_visibility_interface, &m_tizen_visibility_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_visibility_interface tizen_visibility::m_tizen_visibility_interface = { + tizen_visibility::handle_destroy + }; + + void tizen_visibility::tizen_visibility_destroy(Resource *) + { + } + + + void tizen_visibility::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_visibility_object)->tizen_visibility_destroy( + r); + } + + void tizen_visibility::send_notify(uint32_t visibility) + { + DS_ASSERT_X(m_resource, "tizen_visibility::notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_visibility::notify as it's not initialised"); + return; + } + send_notify( + m_resource->handle, + visibility); + } + + void tizen_visibility::send_notify(struct ::wl_resource *resource, uint32_t visibility) + { + tizen_visibility_send_notify( + resource, + visibility); + } + + + void tizen_visibility::send_changed(uint32_t type, uint32_t option) + { + DS_ASSERT_X(m_resource, "tizen_visibility::changed", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_visibility::changed as it's not initialised"); + return; + } + send_changed( + m_resource->handle, + type, + option); + } + + void tizen_visibility::send_changed(struct ::wl_resource *resource, uint32_t type, uint32_t option) + { + tizen_visibility_send_changed( + resource, + type, + option); + } + + + tizen_position::tizen_position(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_position::tizen_position(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_position::tizen_position(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_position::tizen_position() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_position::~tizen_position() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_position::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_position::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_position::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_position::Resource *tizen_position::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_position::Resource *tizen_position::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_position::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_position_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_position::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_position::interface() + { + return &::tizen_position_interface; + } + + tizen_position::Resource *tizen_position::tizen_position_allocate() + { + return new Resource; + } + + void tizen_position::tizen_position_bind_resource(Resource *) + { + } + + void tizen_position::tizen_position_destroy_resource(Resource *) + { + } + + void tizen_position::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_position *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_position::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_position *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_position::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_position *that = resource->tizen_position_object; + that->m_resource_map.erase(resource->client()); + that->tizen_position_destroy_resource(resource); + delete resource; + } + + tizen_position::Resource *tizen_position::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_position_interface, version, id); + return bind(handle); + } + + tizen_position::Resource *tizen_position::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_position_allocate(); + resource->tizen_position_object = this; + + wl_resource_set_implementation(handle, &m_tizen_position_interface, resource, destroy_func); + resource->handle = handle; + tizen_position_bind_resource(resource); + return resource; + } + tizen_position::Resource *tizen_position::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_position_interface, &m_tizen_position_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_position_interface tizen_position::m_tizen_position_interface = { + tizen_position::handle_destroy, + tizen_position::handle_set + }; + + void tizen_position::tizen_position_destroy(Resource *) + { + } + + void tizen_position::tizen_position_set(Resource *, int32_t , int32_t ) + { + } + + + void tizen_position::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_position_object)->tizen_position_destroy( + r); + } + + void tizen_position::handle_set( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_position_object)->tizen_position_set( + r, + x, + y); + } + + void tizen_position::send_changed(int32_t x, int32_t y) + { + DS_ASSERT_X(m_resource, "tizen_position::changed", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_position::changed as it's not initialised"); + return; + } + send_changed( + m_resource->handle, + x, + y); + } + + void tizen_position::send_changed(struct ::wl_resource *resource, int32_t x, int32_t y) + { + tizen_position_send_changed( + resource, + x, + y); + } + + + tizen_move_resize::tizen_move_resize(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_move_resize::tizen_move_resize(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_move_resize::tizen_move_resize(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_move_resize::tizen_move_resize() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_move_resize::~tizen_move_resize() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_move_resize::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_move_resize::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_move_resize::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_move_resize::Resource *tizen_move_resize::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_move_resize::Resource *tizen_move_resize::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_move_resize::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_move_resize_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_move_resize::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_move_resize::interface() + { + return &::tizen_move_resize_interface; + } + + tizen_move_resize::Resource *tizen_move_resize::tizen_move_resize_allocate() + { + return new Resource; + } + + void tizen_move_resize::tizen_move_resize_bind_resource(Resource *) + { + } + + void tizen_move_resize::tizen_move_resize_destroy_resource(Resource *) + { + } + + void tizen_move_resize::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_move_resize *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_move_resize::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_move_resize *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_move_resize::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_move_resize *that = resource->tizen_move_resize_object; + that->m_resource_map.erase(resource->client()); + that->tizen_move_resize_destroy_resource(resource); + delete resource; + } + + tizen_move_resize::Resource *tizen_move_resize::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_move_resize_interface, version, id); + return bind(handle); + } + + tizen_move_resize::Resource *tizen_move_resize::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_move_resize_allocate(); + resource->tizen_move_resize_object = this; + + wl_resource_set_implementation(handle, &m_tizen_move_resize_interface, resource, destroy_func); + resource->handle = handle; + tizen_move_resize_bind_resource(resource); + return resource; + } + tizen_move_resize::Resource *tizen_move_resize::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_move_resize_interface, &m_tizen_move_resize_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_move_resize_interface tizen_move_resize::m_tizen_move_resize_interface = { + tizen_move_resize::handle_destroy, + tizen_move_resize::handle_set_geometry + }; + + void tizen_move_resize::tizen_move_resize_destroy(Resource *) + { + } + + void tizen_move_resize::tizen_move_resize_set_geometry(Resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t , int32_t , int32_t ) + { + } + + + void tizen_move_resize::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_move_resize_object)->tizen_move_resize_destroy( + r); + } + + void tizen_move_resize::handle_set_geometry( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t serial, + int32_t x, + int32_t y, + int32_t w, + int32_t h) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_move_resize_object)->tizen_move_resize_set_geometry( + r, + surface, + serial, + x, + y, + w, + h); + } + + void tizen_move_resize::send_geometry_done(struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t error_state) + { + DS_ASSERT_X(m_resource, "tizen_move_resize::geometry_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_move_resize::geometry_done as it's not initialised"); + return; + } + send_geometry_done( + m_resource->handle, + surface, + serial, + x, + y, + w, + h, + error_state); + } + + void tizen_move_resize::send_geometry_done(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t error_state) + { + tizen_move_resize_send_geometry_done( + resource, + surface, + serial, + x, + y, + w, + h, + error_state); + } + + + tizen_gesture::tizen_gesture(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_gesture::tizen_gesture(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_gesture::tizen_gesture(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_gesture::tizen_gesture() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_gesture::~tizen_gesture() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_gesture::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_gesture::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_gesture::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_gesture::Resource *tizen_gesture::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_gesture::Resource *tizen_gesture::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_gesture::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_gesture_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_gesture::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_gesture::interface() + { + return &::tizen_gesture_interface; + } + + tizen_gesture::Resource *tizen_gesture::tizen_gesture_allocate() + { + return new Resource; + } + + void tizen_gesture::tizen_gesture_bind_resource(Resource *) + { + } + + void tizen_gesture::tizen_gesture_destroy_resource(Resource *) + { + } + + void tizen_gesture::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_gesture *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_gesture::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_gesture *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_gesture::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_gesture *that = resource->tizen_gesture_object; + that->m_resource_map.erase(resource->client()); + that->tizen_gesture_destroy_resource(resource); + delete resource; + } + + tizen_gesture::Resource *tizen_gesture::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_gesture_interface, version, id); + return bind(handle); + } + + tizen_gesture::Resource *tizen_gesture::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_gesture_allocate(); + resource->tizen_gesture_object = this; + + wl_resource_set_implementation(handle, &m_tizen_gesture_interface, resource, destroy_func); + resource->handle = handle; + tizen_gesture_bind_resource(resource); + return resource; + } + tizen_gesture::Resource *tizen_gesture::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_gesture_interface, &m_tizen_gesture_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_gesture_interface tizen_gesture::m_tizen_gesture_interface = { + tizen_gesture::handle_grab_edge_swipe, + tizen_gesture::handle_ungrab_edge_swipe, + tizen_gesture::handle_grab_edge_drag, + tizen_gesture::handle_ungrab_edge_drag, + tizen_gesture::handle_grab_tap, + tizen_gesture::handle_ungrab_tap, + tizen_gesture::handle_grab_palm_cover, + tizen_gesture::handle_ungrab_palm_cover, + tizen_gesture::handle_select_palm_cover, + tizen_gesture::handle_deselect_palm_cover, + tizen_gesture::handle_activate_set, + tizen_gesture::handle_destroy + }; + + void tizen_gesture::tizen_gesture_grab_edge_swipe(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void tizen_gesture::tizen_gesture_ungrab_edge_swipe(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void tizen_gesture::tizen_gesture_grab_edge_drag(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void tizen_gesture::tizen_gesture_ungrab_edge_drag(Resource *, uint32_t , uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void tizen_gesture::tizen_gesture_grab_tap(Resource *, uint32_t , uint32_t ) + { + } + + void tizen_gesture::tizen_gesture_ungrab_tap(Resource *, uint32_t , uint32_t ) + { + } + + void tizen_gesture::tizen_gesture_grab_palm_cover(Resource *) + { + } + + void tizen_gesture::tizen_gesture_ungrab_palm_cover(Resource *) + { + } + + void tizen_gesture::tizen_gesture_select_palm_cover(Resource *, struct ::wl_resource *) + { + } + + void tizen_gesture::tizen_gesture_deselect_palm_cover(Resource *, struct ::wl_resource *) + { + } + + void tizen_gesture::tizen_gesture_activate_set(Resource *, struct ::wl_resource *, uint32_t , uint32_t ) + { + } + + void tizen_gesture::tizen_gesture_destroy(Resource *) + { + } + + + void tizen_gesture::handle_grab_edge_swipe( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t edge, + uint32_t edge_size, + uint32_t start_point, + uint32_t end_point) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_grab_edge_swipe( + r, + fingers, + edge, + edge_size, + start_point, + end_point); + } + + void tizen_gesture::handle_ungrab_edge_swipe( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t edge, + uint32_t edge_size, + uint32_t start_point, + uint32_t end_point) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_ungrab_edge_swipe( + r, + fingers, + edge, + edge_size, + start_point, + end_point); + } + + void tizen_gesture::handle_grab_edge_drag( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t edge, + uint32_t edge_size, + uint32_t start_point, + uint32_t end_point) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_grab_edge_drag( + r, + fingers, + edge, + edge_size, + start_point, + end_point); + } + + void tizen_gesture::handle_ungrab_edge_drag( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t edge, + uint32_t edge_size, + uint32_t start_point, + uint32_t end_point) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_ungrab_edge_drag( + r, + fingers, + edge, + edge_size, + start_point, + end_point); + } + + void tizen_gesture::handle_grab_tap( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t repeats) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_grab_tap( + r, + fingers, + repeats); + } + + void tizen_gesture::handle_ungrab_tap( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t repeats) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_ungrab_tap( + r, + fingers, + repeats); + } + + void tizen_gesture::handle_grab_palm_cover( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_grab_palm_cover( + r); + } + + void tizen_gesture::handle_ungrab_palm_cover( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_ungrab_palm_cover( + r); + } + + void tizen_gesture::handle_select_palm_cover( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_select_palm_cover( + r, + surface); + } + + void tizen_gesture::handle_deselect_palm_cover( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_deselect_palm_cover( + r, + surface); + } + + void tizen_gesture::handle_activate_set( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t type, + uint32_t active) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_activate_set( + r, + surface, + type, + active); + } + + void tizen_gesture::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_gesture_object)->tizen_gesture_destroy( + r); + } + + void tizen_gesture::send_grab_edge_swipe_notify(uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error) + { + DS_ASSERT_X(m_resource, "tizen_gesture::grab_edge_swipe_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::grab_edge_swipe_notify as it's not initialised"); + return; + } + send_grab_edge_swipe_notify( + m_resource->handle, + fingers, + edge, + edge_size, + start_point, + end_point, + error); + } + + void tizen_gesture::send_grab_edge_swipe_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error) + { + tizen_gesture_send_grab_edge_swipe_notify( + resource, + fingers, + edge, + edge_size, + start_point, + end_point, + error); + } + + + void tizen_gesture::send_edge_swipe(uint32_t mode, uint32_t fingers, int32_t sx, int32_t sy, uint32_t edge) + { + DS_ASSERT_X(m_resource, "tizen_gesture::edge_swipe", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::edge_swipe as it's not initialised"); + return; + } + send_edge_swipe( + m_resource->handle, + mode, + fingers, + sx, + sy, + edge); + } + + void tizen_gesture::send_edge_swipe(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, int32_t sx, int32_t sy, uint32_t edge) + { + tizen_gesture_send_edge_swipe( + resource, + mode, + fingers, + sx, + sy, + edge); + } + + + void tizen_gesture::send_edge_drag_notify(uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error) + { + DS_ASSERT_X(m_resource, "tizen_gesture::edge_drag_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::edge_drag_notify as it's not initialised"); + return; + } + send_edge_drag_notify( + m_resource->handle, + fingers, + edge, + edge_size, + start_point, + end_point, + error); + } + + void tizen_gesture::send_edge_drag_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error) + { + tizen_gesture_send_edge_drag_notify( + resource, + fingers, + edge, + edge_size, + start_point, + end_point, + error); + } + + + void tizen_gesture::send_edge_drag(uint32_t mode, uint32_t fingers, int32_t cx, int32_t cy, uint32_t edge) + { + DS_ASSERT_X(m_resource, "tizen_gesture::edge_drag", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::edge_drag as it's not initialised"); + return; + } + send_edge_drag( + m_resource->handle, + mode, + fingers, + cx, + cy, + edge); + } + + void tizen_gesture::send_edge_drag(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, int32_t cx, int32_t cy, uint32_t edge) + { + tizen_gesture_send_edge_drag( + resource, + mode, + fingers, + cx, + cy, + edge); + } + + + void tizen_gesture::send_tap_notify(uint32_t fingers, uint32_t repeats, uint32_t error) + { + DS_ASSERT_X(m_resource, "tizen_gesture::tap_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::tap_notify as it's not initialised"); + return; + } + send_tap_notify( + m_resource->handle, + fingers, + repeats, + error); + } + + void tizen_gesture::send_tap_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t repeats, uint32_t error) + { + tizen_gesture_send_tap_notify( + resource, + fingers, + repeats, + error); + } + + + void tizen_gesture::send_tap(uint32_t mode, uint32_t fingers, uint32_t repeats) + { + DS_ASSERT_X(m_resource, "tizen_gesture::tap", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::tap as it's not initialised"); + return; + } + send_tap( + m_resource->handle, + mode, + fingers, + repeats); + } + + void tizen_gesture::send_tap(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, uint32_t repeats) + { + tizen_gesture_send_tap( + resource, + mode, + fingers, + repeats); + } + + + void tizen_gesture::send_palm_cover_notify(struct ::wl_resource *surface, uint32_t error) + { + DS_ASSERT_X(m_resource, "tizen_gesture::palm_cover_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::palm_cover_notify as it's not initialised"); + return; + } + send_palm_cover_notify( + m_resource->handle, + surface, + error); + } + + void tizen_gesture::send_palm_cover_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t error) + { + tizen_gesture_send_palm_cover_notify( + resource, + surface, + error); + } + + + void tizen_gesture::send_palm_cover(struct ::wl_resource *surface, uint32_t mode, uint32_t duration, int32_t cx, int32_t cy, uint32_t size, wl_fixed_t pressure) + { + DS_ASSERT_X(m_resource, "tizen_gesture::palm_cover", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::palm_cover as it's not initialised"); + return; + } + send_palm_cover( + m_resource->handle, + surface, + mode, + duration, + cx, + cy, + size, + pressure); + } + + void tizen_gesture::send_palm_cover(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode, uint32_t duration, int32_t cx, int32_t cy, uint32_t size, wl_fixed_t pressure) + { + tizen_gesture_send_palm_cover( + resource, + surface, + mode, + duration, + cx, + cy, + size, + pressure); + } + + + void tizen_gesture::send_activate_notify(struct ::wl_resource *surface, uint32_t type, uint32_t active, uint32_t error) + { + DS_ASSERT_X(m_resource, "tizen_gesture::activate_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_gesture::activate_notify as it's not initialised"); + return; + } + send_activate_notify( + m_resource->handle, + surface, + type, + active, + error); + } + + void tizen_gesture::send_activate_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type, uint32_t active, uint32_t error) + { + tizen_gesture_send_activate_notify( + resource, + surface, + type, + active, + error); + } + + + tizen_keyrouter::tizen_keyrouter(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_keyrouter::tizen_keyrouter(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_keyrouter::tizen_keyrouter(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_keyrouter::tizen_keyrouter() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_keyrouter::~tizen_keyrouter() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_keyrouter::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_keyrouter::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_keyrouter::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_keyrouter::Resource *tizen_keyrouter::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_keyrouter::Resource *tizen_keyrouter::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_keyrouter::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_keyrouter_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_keyrouter::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_keyrouter::interface() + { + return &::tizen_keyrouter_interface; + } + + tizen_keyrouter::Resource *tizen_keyrouter::tizen_keyrouter_allocate() + { + return new Resource; + } + + void tizen_keyrouter::tizen_keyrouter_bind_resource(Resource *) + { + } + + void tizen_keyrouter::tizen_keyrouter_destroy_resource(Resource *) + { + } + + void tizen_keyrouter::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_keyrouter *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_keyrouter::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_keyrouter *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_keyrouter::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_keyrouter *that = resource->tizen_keyrouter_object; + that->m_resource_map.erase(resource->client()); + that->tizen_keyrouter_destroy_resource(resource); + delete resource; + } + + tizen_keyrouter::Resource *tizen_keyrouter::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_keyrouter_interface, version, id); + return bind(handle); + } + + tizen_keyrouter::Resource *tizen_keyrouter::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_keyrouter_allocate(); + resource->tizen_keyrouter_object = this; + + wl_resource_set_implementation(handle, &m_tizen_keyrouter_interface, resource, destroy_func); + resource->handle = handle; + tizen_keyrouter_bind_resource(resource); + return resource; + } + tizen_keyrouter::Resource *tizen_keyrouter::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_keyrouter_interface, &m_tizen_keyrouter_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_keyrouter_interface tizen_keyrouter::m_tizen_keyrouter_interface = { + tizen_keyrouter::handle_set_keygrab, + tizen_keyrouter::handle_unset_keygrab, + tizen_keyrouter::handle_get_keygrab_status, + tizen_keyrouter::handle_set_keygrab_list, + tizen_keyrouter::handle_unset_keygrab_list, + tizen_keyrouter::handle_get_keygrab_list, + tizen_keyrouter::handle_set_register_none_key, + tizen_keyrouter::handle_get_keyregister_status, + tizen_keyrouter::handle_set_input_config, + tizen_keyrouter::handle_destroy + }; + + void tizen_keyrouter::tizen_keyrouter_set_keygrab(Resource *, struct ::wl_resource *, uint32_t , uint32_t ) + { + } + + void tizen_keyrouter::tizen_keyrouter_unset_keygrab(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_keyrouter::tizen_keyrouter_get_keygrab_status(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_keyrouter::tizen_keyrouter_set_keygrab_list(Resource *, struct ::wl_resource *, wl_array *) + { + } + + void tizen_keyrouter::tizen_keyrouter_unset_keygrab_list(Resource *, struct ::wl_resource *, wl_array *) + { + } + + void tizen_keyrouter::tizen_keyrouter_get_keygrab_list(Resource *, struct ::wl_resource *) + { + } + + void tizen_keyrouter::tizen_keyrouter_set_register_none_key(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void tizen_keyrouter::tizen_keyrouter_get_keyregister_status(Resource *, uint32_t ) + { + } + + void tizen_keyrouter::tizen_keyrouter_set_input_config(Resource *, struct ::wl_resource *, uint32_t , uint32_t ) + { + } + + void tizen_keyrouter::tizen_keyrouter_destroy(Resource *) + { + } + + + void tizen_keyrouter::handle_set_keygrab( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t key, + uint32_t mode) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_set_keygrab( + r, + surface, + key, + mode); + } + + void tizen_keyrouter::handle_unset_keygrab( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t key) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_unset_keygrab( + r, + surface, + key); + } + + void tizen_keyrouter::handle_get_keygrab_status( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t key) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_get_keygrab_status( + r, + surface, + key); + } + + void tizen_keyrouter::handle_set_keygrab_list( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + wl_array *grab_list) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_set_keygrab_list( + r, + surface, + grab_list); + } + + void tizen_keyrouter::handle_unset_keygrab_list( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + wl_array *ungrab_list) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_unset_keygrab_list( + r, + surface, + ungrab_list); + } + + void tizen_keyrouter::handle_get_keygrab_list( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_get_keygrab_list( + r, + surface); + } + + void tizen_keyrouter::handle_set_register_none_key( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t data) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_set_register_none_key( + r, + surface, + data); + } + + void tizen_keyrouter::handle_get_keyregister_status( + ::wl_client *client, + struct wl_resource *resource, + uint32_t data) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_get_keyregister_status( + r, + data); + } + + void tizen_keyrouter::handle_set_input_config( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t config_mode, + uint32_t value) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_set_input_config( + r, + surface, + config_mode, + value); + } + + void tizen_keyrouter::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_keyrouter_object)->tizen_keyrouter_destroy( + r); + } + + void tizen_keyrouter::send_keygrab_notify(struct ::wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error) + { + DS_ASSERT_X(m_resource, "tizen_keyrouter::keygrab_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_keyrouter::keygrab_notify as it's not initialised"); + return; + } + send_keygrab_notify( + m_resource->handle, + surface, + key, + mode, + error); + } + + void tizen_keyrouter::send_keygrab_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error) + { + tizen_keyrouter_send_keygrab_notify( + resource, + surface, + key, + mode, + error); + } + + + void tizen_keyrouter::send_keygrab_notify_list(struct ::wl_resource *surface, const std::string &grab_result) + { + DS_ASSERT_X(m_resource, "tizen_keyrouter::keygrab_notify_list", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_keyrouter::keygrab_notify_list as it's not initialised"); + return; + } + send_keygrab_notify_list( + m_resource->handle, + surface, + grab_result); + } + + void tizen_keyrouter::send_keygrab_notify_list(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &grab_result) + { + struct wl_array grab_result_data; + grab_result_data.size = grab_result.size(); + grab_result_data.data = static_cast(const_cast(grab_result.c_str())); + grab_result_data.alloc = 0; + + tizen_keyrouter_send_keygrab_notify_list( + resource, + surface, + &grab_result_data); + } + + + void tizen_keyrouter::send_getgrab_notify_list(struct ::wl_resource *surface, const std::string &grab_result) + { + DS_ASSERT_X(m_resource, "tizen_keyrouter::getgrab_notify_list", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_keyrouter::getgrab_notify_list as it's not initialised"); + return; + } + send_getgrab_notify_list( + m_resource->handle, + surface, + grab_result); + } + + void tizen_keyrouter::send_getgrab_notify_list(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &grab_result) + { + struct wl_array grab_result_data; + grab_result_data.size = grab_result.size(); + grab_result_data.data = static_cast(const_cast(grab_result.c_str())); + grab_result_data.alloc = 0; + + tizen_keyrouter_send_getgrab_notify_list( + resource, + surface, + &grab_result_data); + } + + + void tizen_keyrouter::send_set_register_none_key_notify(struct ::wl_resource *surface, uint32_t mode) + { + DS_ASSERT_X(m_resource, "tizen_keyrouter::set_register_none_key_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_keyrouter::set_register_none_key_notify as it's not initialised"); + return; + } + send_set_register_none_key_notify( + m_resource->handle, + surface, + mode); + } + + void tizen_keyrouter::send_set_register_none_key_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode) + { + tizen_keyrouter_send_set_register_none_key_notify( + resource, + surface, + mode); + } + + + void tizen_keyrouter::send_keyregister_notify(uint32_t status) + { + DS_ASSERT_X(m_resource, "tizen_keyrouter::keyregister_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_keyrouter::keyregister_notify as it's not initialised"); + return; + } + send_keyregister_notify( + m_resource->handle, + status); + } + + void tizen_keyrouter::send_keyregister_notify(struct ::wl_resource *resource, uint32_t status) + { + tizen_keyrouter_send_keyregister_notify( + resource, + status); + } + + + void tizen_keyrouter::send_set_input_config_notify(uint32_t status) + { + DS_ASSERT_X(m_resource, "tizen_keyrouter::set_input_config_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_keyrouter::set_input_config_notify as it's not initialised"); + return; + } + send_set_input_config_notify( + m_resource->handle, + status); + } + + void tizen_keyrouter::send_set_input_config_notify(struct ::wl_resource *resource, uint32_t status) + { + tizen_keyrouter_send_set_input_config_notify( + resource, + status); + } + + + void tizen_keyrouter::send_key_cancel(uint32_t key) + { + DS_ASSERT_X(m_resource, "tizen_keyrouter::key_cancel", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_keyrouter::key_cancel as it's not initialised"); + return; + } + send_key_cancel( + m_resource->handle, + key); + } + + void tizen_keyrouter::send_key_cancel(struct ::wl_resource *resource, uint32_t key) + { + tizen_keyrouter_send_key_cancel( + resource, + key); + } + + + void tizen_keyrouter::send_event_surface(struct ::wl_resource *surface, uint32_t key, uint32_t mode) + { + DS_ASSERT_X(m_resource, "tizen_keyrouter::event_surface", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_keyrouter::event_surface as it's not initialised"); + return; + } + send_event_surface( + m_resource->handle, + surface, + key, + mode); + } + + void tizen_keyrouter::send_event_surface(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode) + { + tizen_keyrouter_send_event_surface( + resource, + surface, + key, + mode); + } + + + tizen_screenshooter::tizen_screenshooter(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_screenshooter::tizen_screenshooter(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_screenshooter::tizen_screenshooter(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_screenshooter::tizen_screenshooter() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_screenshooter::~tizen_screenshooter() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_screenshooter::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_screenshooter::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_screenshooter::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_screenshooter::Resource *tizen_screenshooter::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_screenshooter::Resource *tizen_screenshooter::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_screenshooter::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_screenshooter_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_screenshooter::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_screenshooter::interface() + { + return &::tizen_screenshooter_interface; + } + + tizen_screenshooter::Resource *tizen_screenshooter::tizen_screenshooter_allocate() + { + return new Resource; + } + + void tizen_screenshooter::tizen_screenshooter_bind_resource(Resource *) + { + } + + void tizen_screenshooter::tizen_screenshooter_destroy_resource(Resource *) + { + } + + void tizen_screenshooter::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_screenshooter *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_screenshooter::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_screenshooter *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_screenshooter::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_screenshooter *that = resource->tizen_screenshooter_object; + that->m_resource_map.erase(resource->client()); + that->tizen_screenshooter_destroy_resource(resource); + delete resource; + } + + tizen_screenshooter::Resource *tizen_screenshooter::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_screenshooter_interface, version, id); + return bind(handle); + } + + tizen_screenshooter::Resource *tizen_screenshooter::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_screenshooter_allocate(); + resource->tizen_screenshooter_object = this; + + wl_resource_set_implementation(handle, &m_tizen_screenshooter_interface, resource, destroy_func); + resource->handle = handle; + tizen_screenshooter_bind_resource(resource); + return resource; + } + tizen_screenshooter::Resource *tizen_screenshooter::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_screenshooter_interface, &m_tizen_screenshooter_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_screenshooter_interface tizen_screenshooter::m_tizen_screenshooter_interface = { + tizen_screenshooter::handle_get_screenmirror, + tizen_screenshooter::handle_set_oneshot_auto_rotation, + tizen_screenshooter::handle_destroy + }; + + void tizen_screenshooter::tizen_screenshooter_get_screenmirror(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_screenshooter::tizen_screenshooter_set_oneshot_auto_rotation(Resource *, uint32_t ) + { + } + + void tizen_screenshooter::tizen_screenshooter_destroy(Resource *) + { + } + + + void tizen_screenshooter::handle_get_screenmirror( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *output) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenshooter_object)->tizen_screenshooter_get_screenmirror( + r, + id, + output); + } + + void tizen_screenshooter::handle_set_oneshot_auto_rotation( + ::wl_client *client, + struct wl_resource *resource, + uint32_t set) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenshooter_object)->tizen_screenshooter_set_oneshot_auto_rotation( + r, + set); + } + + void tizen_screenshooter::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenshooter_object)->tizen_screenshooter_destroy( + r); + } + + void tizen_screenshooter::send_format(uint32_t format) + { + DS_ASSERT_X(m_resource, "tizen_screenshooter::format", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_screenshooter::format as it's not initialised"); + return; + } + send_format( + m_resource->handle, + format); + } + + void tizen_screenshooter::send_format(struct ::wl_resource *resource, uint32_t format) + { + tizen_screenshooter_send_format( + resource, + format); + } + + + void tizen_screenshooter::send_screenshooter_notify(uint32_t noti) + { + DS_ASSERT_X(m_resource, "tizen_screenshooter::screenshooter_notify", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_screenshooter::screenshooter_notify as it's not initialised"); + return; + } + send_screenshooter_notify( + m_resource->handle, + noti); + } + + void tizen_screenshooter::send_screenshooter_notify(struct ::wl_resource *resource, uint32_t noti) + { + tizen_screenshooter_send_screenshooter_notify( + resource, + noti); + } + + + tizen_screenmirror::tizen_screenmirror(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_screenmirror::tizen_screenmirror(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_screenmirror::tizen_screenmirror(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_screenmirror::tizen_screenmirror() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_screenmirror::~tizen_screenmirror() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_screenmirror::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_screenmirror::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_screenmirror::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_screenmirror::Resource *tizen_screenmirror::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_screenmirror::Resource *tizen_screenmirror::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_screenmirror::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_screenmirror_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_screenmirror::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_screenmirror::interface() + { + return &::tizen_screenmirror_interface; + } + + tizen_screenmirror::Resource *tizen_screenmirror::tizen_screenmirror_allocate() + { + return new Resource; + } + + void tizen_screenmirror::tizen_screenmirror_bind_resource(Resource *) + { + } + + void tizen_screenmirror::tizen_screenmirror_destroy_resource(Resource *) + { + } + + void tizen_screenmirror::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_screenmirror *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_screenmirror::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_screenmirror *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_screenmirror::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_screenmirror *that = resource->tizen_screenmirror_object; + that->m_resource_map.erase(resource->client()); + that->tizen_screenmirror_destroy_resource(resource); + delete resource; + } + + tizen_screenmirror::Resource *tizen_screenmirror::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_screenmirror_interface, version, id); + return bind(handle); + } + + tizen_screenmirror::Resource *tizen_screenmirror::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_screenmirror_allocate(); + resource->tizen_screenmirror_object = this; + + wl_resource_set_implementation(handle, &m_tizen_screenmirror_interface, resource, destroy_func); + resource->handle = handle; + tizen_screenmirror_bind_resource(resource); + return resource; + } + tizen_screenmirror::Resource *tizen_screenmirror::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_screenmirror_interface, &m_tizen_screenmirror_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_screenmirror_interface tizen_screenmirror::m_tizen_screenmirror_interface = { + tizen_screenmirror::handle_destroy, + tizen_screenmirror::handle_set_stretch, + tizen_screenmirror::handle_queue, + tizen_screenmirror::handle_dequeue, + tizen_screenmirror::handle_start, + tizen_screenmirror::handle_stop + }; + + void tizen_screenmirror::tizen_screenmirror_destroy(Resource *) + { + } + + void tizen_screenmirror::tizen_screenmirror_set_stretch(Resource *, uint32_t ) + { + } + + void tizen_screenmirror::tizen_screenmirror_queue(Resource *, struct ::wl_resource *) + { + } + + void tizen_screenmirror::tizen_screenmirror_dequeue(Resource *, struct ::wl_resource *) + { + } + + void tizen_screenmirror::tizen_screenmirror_start(Resource *) + { + } + + void tizen_screenmirror::tizen_screenmirror_stop(Resource *) + { + } + + + void tizen_screenmirror::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenmirror_object)->tizen_screenmirror_destroy( + r); + } + + void tizen_screenmirror::handle_set_stretch( + ::wl_client *client, + struct wl_resource *resource, + uint32_t stretch) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenmirror_object)->tizen_screenmirror_set_stretch( + r, + stretch); + } + + void tizen_screenmirror::handle_queue( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *buffer) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenmirror_object)->tizen_screenmirror_queue( + r, + buffer); + } + + void tizen_screenmirror::handle_dequeue( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *buffer) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenmirror_object)->tizen_screenmirror_dequeue( + r, + buffer); + } + + void tizen_screenmirror::handle_start( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenmirror_object)->tizen_screenmirror_start( + r); + } + + void tizen_screenmirror::handle_stop( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screenmirror_object)->tizen_screenmirror_stop( + r); + } + + void tizen_screenmirror::send_dequeued(struct ::wl_resource *buffer) + { + DS_ASSERT_X(m_resource, "tizen_screenmirror::dequeued", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_screenmirror::dequeued as it's not initialised"); + return; + } + send_dequeued( + m_resource->handle, + buffer); + } + + void tizen_screenmirror::send_dequeued(struct ::wl_resource *resource, struct ::wl_resource *buffer) + { + tizen_screenmirror_send_dequeued( + resource, + buffer); + } + + + void tizen_screenmirror::send_content(uint32_t content) + { + DS_ASSERT_X(m_resource, "tizen_screenmirror::content", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_screenmirror::content as it's not initialised"); + return; + } + send_content( + m_resource->handle, + content); + } + + void tizen_screenmirror::send_content(struct ::wl_resource *resource, uint32_t content) + { + tizen_screenmirror_send_content( + resource, + content); + } + + + void tizen_screenmirror::send_stop() + { + DS_ASSERT_X(m_resource, "tizen_screenmirror::stop", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_screenmirror::stop as it's not initialised"); + return; + } + send_stop( + m_resource->handle); + } + + void tizen_screenmirror::send_stop(struct ::wl_resource *resource) + { + tizen_screenmirror_send_stop( + resource); + } + + + tizen_video::tizen_video(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_video::tizen_video(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_video::tizen_video(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_video::tizen_video() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_video::~tizen_video() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_video::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_video::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_video::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_video::Resource *tizen_video::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_video::Resource *tizen_video::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_video::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_video_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_video::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_video::interface() + { + return &::tizen_video_interface; + } + + tizen_video::Resource *tizen_video::tizen_video_allocate() + { + return new Resource; + } + + void tizen_video::tizen_video_bind_resource(Resource *) + { + } + + void tizen_video::tizen_video_destroy_resource(Resource *) + { + } + + void tizen_video::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_video *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_video::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_video *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_video::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_video *that = resource->tizen_video_object; + that->m_resource_map.erase(resource->client()); + that->tizen_video_destroy_resource(resource); + delete resource; + } + + tizen_video::Resource *tizen_video::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_video_interface, version, id); + return bind(handle); + } + + tizen_video::Resource *tizen_video::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_video_allocate(); + resource->tizen_video_object = this; + + wl_resource_set_implementation(handle, &m_tizen_video_interface, resource, destroy_func); + resource->handle = handle; + tizen_video_bind_resource(resource); + return resource; + } + tizen_video::Resource *tizen_video::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_video_interface, &m_tizen_video_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_video_interface tizen_video::m_tizen_video_interface = { + tizen_video::handle_get_object, + tizen_video::handle_get_viewport, + tizen_video::handle_destroy, + tizen_video::handle_get_surface_provider + }; + + void tizen_video::tizen_video_get_object(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_video::tizen_video_get_viewport(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_video::tizen_video_destroy(Resource *) + { + } + + void tizen_video::tizen_video_get_surface_provider(Resource *, uint32_t, struct ::wl_resource *) + { + } + + + void tizen_video::handle_get_object( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object)->tizen_video_get_object( + r, + id, + surface); + } + + void tizen_video::handle_get_viewport( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object)->tizen_video_get_viewport( + r, + id, + surface); + } + + void tizen_video::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object)->tizen_video_destroy( + r); + } + + void tizen_video::handle_get_surface_provider( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object)->tizen_video_get_surface_provider( + r, + id, + surface); + } + + void tizen_video::send_format(uint32_t format) + { + DS_ASSERT_X(m_resource, "tizen_video::format", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_video::format as it's not initialised"); + return; + } + send_format( + m_resource->handle, + format); + } + + void tizen_video::send_format(struct ::wl_resource *resource, uint32_t format) + { + tizen_video_send_format( + resource, + format); + } + + + tizen_video_surface_provider::tizen_video_surface_provider(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_video_surface_provider::tizen_video_surface_provider(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_video_surface_provider::tizen_video_surface_provider(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_video_surface_provider::tizen_video_surface_provider() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_video_surface_provider::~tizen_video_surface_provider() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_video_surface_provider::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_video_surface_provider::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_video_surface_provider::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_video_surface_provider::Resource *tizen_video_surface_provider::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_video_surface_provider::Resource *tizen_video_surface_provider::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_video_surface_provider::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_video_surface_provider_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_video_surface_provider::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_video_surface_provider::interface() + { + return &::tizen_video_surface_provider_interface; + } + + tizen_video_surface_provider::Resource *tizen_video_surface_provider::tizen_video_surface_provider_allocate() + { + return new Resource; + } + + void tizen_video_surface_provider::tizen_video_surface_provider_bind_resource(Resource *) + { + } + + void tizen_video_surface_provider::tizen_video_surface_provider_destroy_resource(Resource *) + { + } + + void tizen_video_surface_provider::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_video_surface_provider *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_video_surface_provider::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_video_surface_provider *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_video_surface_provider::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_video_surface_provider *that = resource->tizen_video_surface_provider_object; + that->m_resource_map.erase(resource->client()); + that->tizen_video_surface_provider_destroy_resource(resource); + delete resource; + } + + tizen_video_surface_provider::Resource *tizen_video_surface_provider::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_video_surface_provider_interface, version, id); + return bind(handle); + } + + tizen_video_surface_provider::Resource *tizen_video_surface_provider::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_video_surface_provider_allocate(); + resource->tizen_video_surface_provider_object = this; + + wl_resource_set_implementation(handle, &m_tizen_video_surface_provider_interface, resource, destroy_func); + resource->handle = handle; + tizen_video_surface_provider_bind_resource(resource); + return resource; + } + tizen_video_surface_provider::Resource *tizen_video_surface_provider::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_video_surface_provider_interface, &m_tizen_video_surface_provider_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_video_surface_provider_interface tizen_video_surface_provider::m_tizen_video_surface_provider_interface = { + tizen_video_surface_provider::handle_destroy, + tizen_video_surface_provider::handle_set_sync_serial + }; + + void tizen_video_surface_provider::tizen_video_surface_provider_destroy(Resource *) + { + } + + void tizen_video_surface_provider::tizen_video_surface_provider_set_sync_serial(Resource *, uint32_t ) + { + } + + + void tizen_video_surface_provider::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_surface_provider_object)->tizen_video_surface_provider_destroy( + r); + } + + void tizen_video_surface_provider::handle_set_sync_serial( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_surface_provider_object)->tizen_video_surface_provider_set_sync_serial( + r, + serial); + } + + void tizen_video_surface_provider::send_sync_done(uint32_t serial) + { + DS_ASSERT_X(m_resource, "tizen_video_surface_provider::sync_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_video_surface_provider::sync_done as it's not initialised"); + return; + } + send_sync_done( + m_resource->handle, + serial); + } + + void tizen_video_surface_provider::send_sync_done(struct ::wl_resource *resource, uint32_t serial) + { + tizen_video_surface_provider_send_sync_done( + resource, + serial); + } + + + tizen_video_object::tizen_video_object(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_video_object::tizen_video_object(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_video_object::tizen_video_object(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_video_object::tizen_video_object() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_video_object::~tizen_video_object() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_video_object::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_video_object::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_video_object::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_video_object::Resource *tizen_video_object::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_video_object::Resource *tizen_video_object::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_video_object::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_video_object_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_video_object::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_video_object::interface() + { + return &::tizen_video_object_interface; + } + + tizen_video_object::Resource *tizen_video_object::tizen_video_object_allocate() + { + return new Resource; + } + + void tizen_video_object::tizen_video_object_bind_resource(Resource *) + { + } + + void tizen_video_object::tizen_video_object_destroy_resource(Resource *) + { + } + + void tizen_video_object::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_video_object *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_video_object::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_video_object *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_video_object::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_video_object *that = resource->tizen_video_object_object; + that->m_resource_map.erase(resource->client()); + that->tizen_video_object_destroy_resource(resource); + delete resource; + } + + tizen_video_object::Resource *tizen_video_object::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_video_object_interface, version, id); + return bind(handle); + } + + tizen_video_object::Resource *tizen_video_object::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_video_object_allocate(); + resource->tizen_video_object_object = this; + + wl_resource_set_implementation(handle, &m_tizen_video_object_interface, resource, destroy_func); + resource->handle = handle; + tizen_video_object_bind_resource(resource); + return resource; + } + tizen_video_object::Resource *tizen_video_object::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_video_object_interface, &m_tizen_video_object_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_video_object_interface tizen_video_object::m_tizen_video_object_interface = { + tizen_video_object::handle_destroy, + tizen_video_object::handle_set_attribute, + tizen_video_object::handle_follow_topmost_visibility, + tizen_video_object::handle_unfollow_topmost_visibility, + tizen_video_object::handle_allowed_attribute, + tizen_video_object::handle_disallowed_attribute, + tizen_video_object::handle_set_sync_serial + }; + + void tizen_video_object::tizen_video_object_destroy(Resource *) + { + } + + void tizen_video_object::tizen_video_object_set_attribute(Resource *, const std::string &, int32_t ) + { + } + + void tizen_video_object::tizen_video_object_follow_topmost_visibility(Resource *) + { + } + + void tizen_video_object::tizen_video_object_unfollow_topmost_visibility(Resource *) + { + } + + void tizen_video_object::tizen_video_object_allowed_attribute(Resource *) + { + } + + void tizen_video_object::tizen_video_object_disallowed_attribute(Resource *) + { + } + + void tizen_video_object::tizen_video_object_set_sync_serial(Resource *, uint32_t ) + { + } + + + void tizen_video_object::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object_object)->tizen_video_object_destroy( + r); + } + + void tizen_video_object::handle_set_attribute( + ::wl_client *client, + struct wl_resource *resource, + const char *name, + int32_t value) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object_object)->tizen_video_object_set_attribute( + r, + std::string(name), + value); + } + + void tizen_video_object::handle_follow_topmost_visibility( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object_object)->tizen_video_object_follow_topmost_visibility( + r); + } + + void tizen_video_object::handle_unfollow_topmost_visibility( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object_object)->tizen_video_object_unfollow_topmost_visibility( + r); + } + + void tizen_video_object::handle_allowed_attribute( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object_object)->tizen_video_object_allowed_attribute( + r); + } + + void tizen_video_object::handle_disallowed_attribute( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object_object)->tizen_video_object_disallowed_attribute( + r); + } + + void tizen_video_object::handle_set_sync_serial( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_video_object_object)->tizen_video_object_set_sync_serial( + r, + serial); + } + + void tizen_video_object::send_attribute(const std::string &name, uint32_t value) + { + DS_ASSERT_X(m_resource, "tizen_video_object::attribute", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_video_object::attribute as it's not initialised"); + return; + } + send_attribute( + m_resource->handle, + name, + value); + } + + void tizen_video_object::send_attribute(struct ::wl_resource *resource, const std::string &name, uint32_t value) + { + tizen_video_object_send_attribute( + resource, + name.c_str(), + value); + } + + + void tizen_video_object::send_size(int32_t min_w, int32_t min_h, int32_t max_w, int32_t max_h, int32_t prefer_align) + { + DS_ASSERT_X(m_resource, "tizen_video_object::size", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_video_object::size as it's not initialised"); + return; + } + send_size( + m_resource->handle, + min_w, + min_h, + max_w, + max_h, + prefer_align); + } + + void tizen_video_object::send_size(struct ::wl_resource *resource, int32_t min_w, int32_t min_h, int32_t max_w, int32_t max_h, int32_t prefer_align) + { + tizen_video_object_send_size( + resource, + min_w, + min_h, + max_w, + max_h, + prefer_align); + } + + + tizen_subsurface_watcher::tizen_subsurface_watcher(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_subsurface_watcher::tizen_subsurface_watcher(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_subsurface_watcher::tizen_subsurface_watcher(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_subsurface_watcher::tizen_subsurface_watcher() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_subsurface_watcher::~tizen_subsurface_watcher() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_subsurface_watcher::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_subsurface_watcher::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_subsurface_watcher::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_subsurface_watcher::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_subsurface_watcher_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_subsurface_watcher::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_subsurface_watcher::interface() + { + return &::tizen_subsurface_watcher_interface; + } + + tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::tizen_subsurface_watcher_allocate() + { + return new Resource; + } + + void tizen_subsurface_watcher::tizen_subsurface_watcher_bind_resource(Resource *) + { + } + + void tizen_subsurface_watcher::tizen_subsurface_watcher_destroy_resource(Resource *) + { + } + + void tizen_subsurface_watcher::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_subsurface_watcher *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_subsurface_watcher::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_subsurface_watcher *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_subsurface_watcher::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_subsurface_watcher *that = resource->tizen_subsurface_watcher_object; + that->m_resource_map.erase(resource->client()); + that->tizen_subsurface_watcher_destroy_resource(resource); + delete resource; + } + + tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_subsurface_watcher_interface, version, id); + return bind(handle); + } + + tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_subsurface_watcher_allocate(); + resource->tizen_subsurface_watcher_object = this; + + wl_resource_set_implementation(handle, &m_tizen_subsurface_watcher_interface, resource, destroy_func); + resource->handle = handle; + tizen_subsurface_watcher_bind_resource(resource); + return resource; + } + tizen_subsurface_watcher::Resource *tizen_subsurface_watcher::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_subsurface_watcher_interface, &m_tizen_subsurface_watcher_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_subsurface_watcher_interface tizen_subsurface_watcher::m_tizen_subsurface_watcher_interface = { + tizen_subsurface_watcher::handle_destroy + }; + + void tizen_subsurface_watcher::tizen_subsurface_watcher_destroy(Resource *) + { + } + + + void tizen_subsurface_watcher::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_subsurface_watcher_object)->tizen_subsurface_watcher_destroy( + r); + } + + void tizen_subsurface_watcher::send_message(uint32_t value) + { + DS_ASSERT_X(m_resource, "tizen_subsurface_watcher::message", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_subsurface_watcher::message as it's not initialised"); + return; + } + send_message( + m_resource->handle, + value); + } + + void tizen_subsurface_watcher::send_message(struct ::wl_resource *resource, uint32_t value) + { + tizen_subsurface_watcher_send_message( + resource, + value); + } + + + tizen_viewport::tizen_viewport(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_viewport::tizen_viewport(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_viewport::tizen_viewport(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_viewport::tizen_viewport() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_viewport::~tizen_viewport() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_viewport::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_viewport::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_viewport::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_viewport::Resource *tizen_viewport::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_viewport::Resource *tizen_viewport::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_viewport::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_viewport_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_viewport::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_viewport::interface() + { + return &::tizen_viewport_interface; + } + + tizen_viewport::Resource *tizen_viewport::tizen_viewport_allocate() + { + return new Resource; + } + + void tizen_viewport::tizen_viewport_bind_resource(Resource *) + { + } + + void tizen_viewport::tizen_viewport_destroy_resource(Resource *) + { + } + + void tizen_viewport::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_viewport *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_viewport::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_viewport *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_viewport::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_viewport *that = resource->tizen_viewport_object; + that->m_resource_map.erase(resource->client()); + that->tizen_viewport_destroy_resource(resource); + delete resource; + } + + tizen_viewport::Resource *tizen_viewport::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_viewport_interface, version, id); + return bind(handle); + } + + tizen_viewport::Resource *tizen_viewport::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_viewport_allocate(); + resource->tizen_viewport_object = this; + + wl_resource_set_implementation(handle, &m_tizen_viewport_interface, resource, destroy_func); + resource->handle = handle; + tizen_viewport_bind_resource(resource); + return resource; + } + tizen_viewport::Resource *tizen_viewport::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_viewport_interface, &m_tizen_viewport_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_viewport_interface tizen_viewport::m_tizen_viewport_interface = { + tizen_viewport::handle_destroy, + tizen_viewport::handle_set_transform, + tizen_viewport::handle_set_source, + tizen_viewport::handle_set_destination, + tizen_viewport::handle_set_destination_ratio, + tizen_viewport::handle_get_destination_mode, + tizen_viewport::handle_query_parent_size, + tizen_viewport::handle_follow_parent_transform, + tizen_viewport::handle_unfollow_parent_transform + }; + + void tizen_viewport::tizen_viewport_destroy(Resource *) + { + } + + void tizen_viewport::tizen_viewport_set_transform(Resource *, uint32_t ) + { + } + + void tizen_viewport::tizen_viewport_set_source(Resource *, uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void tizen_viewport::tizen_viewport_set_destination(Resource *, int32_t , int32_t , uint32_t , uint32_t ) + { + } + + void tizen_viewport::tizen_viewport_set_destination_ratio(Resource *, wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t ) + { + } + + void tizen_viewport::tizen_viewport_get_destination_mode(Resource *, uint32_t) + { + } + + void tizen_viewport::tizen_viewport_query_parent_size(Resource *) + { + } + + void tizen_viewport::tizen_viewport_follow_parent_transform(Resource *) + { + } + + void tizen_viewport::tizen_viewport_unfollow_parent_transform(Resource *) + { + } + + + void tizen_viewport::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_destroy( + r); + } + + void tizen_viewport::handle_set_transform( + ::wl_client *client, + struct wl_resource *resource, + uint32_t transform) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_set_transform( + r, + transform); + } + + void tizen_viewport::handle_set_source( + ::wl_client *client, + struct wl_resource *resource, + uint32_t x, + uint32_t y, + uint32_t width, + uint32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_set_source( + r, + x, + y, + width, + height); + } + + void tizen_viewport::handle_set_destination( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + uint32_t width, + uint32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_set_destination( + r, + x, + y, + width, + height); + } + + void tizen_viewport::handle_set_destination_ratio( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t x, + wl_fixed_t y, + wl_fixed_t width, + wl_fixed_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_set_destination_ratio( + r, + x, + y, + width, + height); + } + + void tizen_viewport::handle_get_destination_mode( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_get_destination_mode( + r, + id); + } + + void tizen_viewport::handle_query_parent_size( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_query_parent_size( + r); + } + + void tizen_viewport::handle_follow_parent_transform( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_follow_parent_transform( + r); + } + + void tizen_viewport::handle_unfollow_parent_transform( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_viewport_object)->tizen_viewport_unfollow_parent_transform( + r); + } + + void tizen_viewport::send_destination_changed(uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height) + { + DS_ASSERT_X(m_resource, "tizen_viewport::destination_changed", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_viewport::destination_changed as it's not initialised"); + return; + } + send_destination_changed( + m_resource->handle, + transform, + x, + y, + width, + height); + } + + void tizen_viewport::send_destination_changed(struct ::wl_resource *resource, uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height) + { + tizen_viewport_send_destination_changed( + resource, + transform, + x, + y, + width, + height); + } + + + void tizen_viewport::send_parent_size(uint32_t width, uint32_t height) + { + DS_ASSERT_X(m_resource, "tizen_viewport::parent_size", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_viewport::parent_size as it's not initialised"); + return; + } + send_parent_size( + m_resource->handle, + width, + height); + } + + void tizen_viewport::send_parent_size(struct ::wl_resource *resource, uint32_t width, uint32_t height) + { + tizen_viewport_send_parent_size( + resource, + width, + height); + } + + + tizen_destination_mode::tizen_destination_mode(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_destination_mode::tizen_destination_mode(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_destination_mode::tizen_destination_mode(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_destination_mode::tizen_destination_mode() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_destination_mode::~tizen_destination_mode() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_destination_mode::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_destination_mode::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_destination_mode::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_destination_mode::Resource *tizen_destination_mode::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_destination_mode::Resource *tizen_destination_mode::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_destination_mode::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_destination_mode_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_destination_mode::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_destination_mode::interface() + { + return &::tizen_destination_mode_interface; + } + + tizen_destination_mode::Resource *tizen_destination_mode::tizen_destination_mode_allocate() + { + return new Resource; + } + + void tizen_destination_mode::tizen_destination_mode_bind_resource(Resource *) + { + } + + void tizen_destination_mode::tizen_destination_mode_destroy_resource(Resource *) + { + } + + void tizen_destination_mode::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_destination_mode *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_destination_mode::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_destination_mode *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_destination_mode::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_destination_mode *that = resource->tizen_destination_mode_object; + that->m_resource_map.erase(resource->client()); + that->tizen_destination_mode_destroy_resource(resource); + delete resource; + } + + tizen_destination_mode::Resource *tizen_destination_mode::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_destination_mode_interface, version, id); + return bind(handle); + } + + tizen_destination_mode::Resource *tizen_destination_mode::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_destination_mode_allocate(); + resource->tizen_destination_mode_object = this; + + wl_resource_set_implementation(handle, &m_tizen_destination_mode_interface, resource, destroy_func); + resource->handle = handle; + tizen_destination_mode_bind_resource(resource); + return resource; + } + tizen_destination_mode::Resource *tizen_destination_mode::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_destination_mode_interface, &m_tizen_destination_mode_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_destination_mode_interface tizen_destination_mode::m_tizen_destination_mode_interface = { + tizen_destination_mode::handle_destroy, + tizen_destination_mode::handle_follow_parent_transform, + tizen_destination_mode::handle_unfollow_parent_transform, + tizen_destination_mode::handle_set, + tizen_destination_mode::handle_set_ratio, + tizen_destination_mode::handle_set_scale, + tizen_destination_mode::handle_set_align, + tizen_destination_mode::handle_set_offset + }; + + void tizen_destination_mode::tizen_destination_mode_destroy(Resource *) + { + } + + void tizen_destination_mode::tizen_destination_mode_follow_parent_transform(Resource *) + { + } + + void tizen_destination_mode::tizen_destination_mode_unfollow_parent_transform(Resource *) + { + } + + void tizen_destination_mode::tizen_destination_mode_set(Resource *, uint32_t ) + { + } + + void tizen_destination_mode::tizen_destination_mode_set_ratio(Resource *, wl_fixed_t , wl_fixed_t ) + { + } + + void tizen_destination_mode::tizen_destination_mode_set_scale(Resource *, wl_fixed_t , wl_fixed_t ) + { + } + + void tizen_destination_mode::tizen_destination_mode_set_align(Resource *, wl_fixed_t , wl_fixed_t ) + { + } + + void tizen_destination_mode::tizen_destination_mode_set_offset(Resource *, int32_t , int32_t , int32_t , int32_t ) + { + } + + + void tizen_destination_mode::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_destination_mode_object)->tizen_destination_mode_destroy( + r); + } + + void tizen_destination_mode::handle_follow_parent_transform( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_destination_mode_object)->tizen_destination_mode_follow_parent_transform( + r); + } + + void tizen_destination_mode::handle_unfollow_parent_transform( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_destination_mode_object)->tizen_destination_mode_unfollow_parent_transform( + r); + } + + void tizen_destination_mode::handle_set( + ::wl_client *client, + struct wl_resource *resource, + uint32_t mode) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_destination_mode_object)->tizen_destination_mode_set( + r, + mode); + } + + void tizen_destination_mode::handle_set_ratio( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t horizontal, + wl_fixed_t vertical) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_destination_mode_object)->tizen_destination_mode_set_ratio( + r, + horizontal, + vertical); + } + + void tizen_destination_mode::handle_set_scale( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t horizontal, + wl_fixed_t vertical) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_destination_mode_object)->tizen_destination_mode_set_scale( + r, + horizontal, + vertical); + } + + void tizen_destination_mode::handle_set_align( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t horizontal, + wl_fixed_t vertical) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_destination_mode_object)->tizen_destination_mode_set_align( + r, + horizontal, + vertical); + } + + void tizen_destination_mode::handle_set_offset( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t w, + int32_t h) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_destination_mode_object)->tizen_destination_mode_set_offset( + r, + x, + y, + w, + h); + } + + tizen_embedded_compositor::tizen_embedded_compositor(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_embedded_compositor::tizen_embedded_compositor(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_embedded_compositor::tizen_embedded_compositor(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_embedded_compositor::tizen_embedded_compositor() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_embedded_compositor::~tizen_embedded_compositor() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_embedded_compositor::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_embedded_compositor::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_embedded_compositor::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_embedded_compositor::Resource *tizen_embedded_compositor::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_embedded_compositor::Resource *tizen_embedded_compositor::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_embedded_compositor::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_embedded_compositor_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_embedded_compositor::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_embedded_compositor::interface() + { + return &::tizen_embedded_compositor_interface; + } + + tizen_embedded_compositor::Resource *tizen_embedded_compositor::tizen_embedded_compositor_allocate() + { + return new Resource; + } + + void tizen_embedded_compositor::tizen_embedded_compositor_bind_resource(Resource *) + { + } + + void tizen_embedded_compositor::tizen_embedded_compositor_destroy_resource(Resource *) + { + } + + void tizen_embedded_compositor::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_embedded_compositor *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_embedded_compositor::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_embedded_compositor *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_embedded_compositor::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_embedded_compositor *that = resource->tizen_embedded_compositor_object; + that->m_resource_map.erase(resource->client()); + that->tizen_embedded_compositor_destroy_resource(resource); + delete resource; + } + + tizen_embedded_compositor::Resource *tizen_embedded_compositor::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_embedded_compositor_interface, version, id); + return bind(handle); + } + + tizen_embedded_compositor::Resource *tizen_embedded_compositor::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_embedded_compositor_allocate(); + resource->tizen_embedded_compositor_object = this; + + wl_resource_set_implementation(handle, &m_tizen_embedded_compositor_interface, resource, destroy_func); + resource->handle = handle; + tizen_embedded_compositor_bind_resource(resource); + return resource; + } + tizen_embedded_compositor::Resource *tizen_embedded_compositor::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_embedded_compositor_interface, &m_tizen_embedded_compositor_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_embedded_compositor_interface tizen_embedded_compositor::m_tizen_embedded_compositor_interface = { + tizen_embedded_compositor::handle_get_socket, + tizen_embedded_compositor::handle_destroy + }; + + void tizen_embedded_compositor::tizen_embedded_compositor_get_socket(Resource *) + { + } + + void tizen_embedded_compositor::tizen_embedded_compositor_destroy(Resource *) + { + } + + + void tizen_embedded_compositor::handle_get_socket( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_embedded_compositor_object)->tizen_embedded_compositor_get_socket( + r); + } + + void tizen_embedded_compositor::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_embedded_compositor_object)->tizen_embedded_compositor_destroy( + r); + } + + void tizen_embedded_compositor::send_socket(int32_t sock_fd) + { + DS_ASSERT_X(m_resource, "tizen_embedded_compositor::socket", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_embedded_compositor::socket as it's not initialised"); + return; + } + send_socket( + m_resource->handle, + sock_fd); + } + + void tizen_embedded_compositor::send_socket(struct ::wl_resource *resource, int32_t sock_fd) + { + tizen_embedded_compositor_send_socket( + resource, + sock_fd); + } + + + tizen_input_device_manager::tizen_input_device_manager(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_input_device_manager::tizen_input_device_manager(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_input_device_manager::tizen_input_device_manager(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_input_device_manager::tizen_input_device_manager() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_input_device_manager::~tizen_input_device_manager() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_input_device_manager::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_input_device_manager::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_input_device_manager::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_input_device_manager::Resource *tizen_input_device_manager::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_input_device_manager::Resource *tizen_input_device_manager::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_input_device_manager::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_input_device_manager_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_input_device_manager::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_input_device_manager::interface() + { + return &::tizen_input_device_manager_interface; + } + + tizen_input_device_manager::Resource *tizen_input_device_manager::tizen_input_device_manager_allocate() + { + return new Resource; + } + + void tizen_input_device_manager::tizen_input_device_manager_bind_resource(Resource *) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_destroy_resource(Resource *) + { + } + + void tizen_input_device_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_input_device_manager *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_input_device_manager::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_input_device_manager *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_input_device_manager::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_input_device_manager *that = resource->tizen_input_device_manager_object; + that->m_resource_map.erase(resource->client()); + that->tizen_input_device_manager_destroy_resource(resource); + delete resource; + } + + tizen_input_device_manager::Resource *tizen_input_device_manager::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_input_device_manager_interface, version, id); + return bind(handle); + } + + tizen_input_device_manager::Resource *tizen_input_device_manager::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_input_device_manager_allocate(); + resource->tizen_input_device_manager_object = this; + + wl_resource_set_implementation(handle, &m_tizen_input_device_manager_interface, resource, destroy_func); + resource->handle = handle; + tizen_input_device_manager_bind_resource(resource); + return resource; + } + tizen_input_device_manager::Resource *tizen_input_device_manager::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_input_device_manager_interface, &m_tizen_input_device_manager_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_input_device_manager_interface tizen_input_device_manager::m_tizen_input_device_manager_interface = { + tizen_input_device_manager::handle_block_events, + tizen_input_device_manager::handle_unblock_events, + tizen_input_device_manager::handle_init_generator, + tizen_input_device_manager::handle_deinit_generator, + tizen_input_device_manager::handle_generate_key, + tizen_input_device_manager::handle_generate_pointer, + tizen_input_device_manager::handle_generate_touch, + tizen_input_device_manager::handle_pointer_warp, + tizen_input_device_manager::handle_init_generator_with_name, + tizen_input_device_manager::handle_destroy, + tizen_input_device_manager::handle_generate_axis + }; + + void tizen_input_device_manager::tizen_input_device_manager_block_events(Resource *, uint32_t , uint32_t , uint32_t ) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_unblock_events(Resource *, uint32_t ) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_init_generator(Resource *, uint32_t ) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_deinit_generator(Resource *, uint32_t ) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_generate_key(Resource *, const std::string &, uint32_t ) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_generate_pointer(Resource *, uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_generate_touch(Resource *, uint32_t , uint32_t , uint32_t , uint32_t ) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_pointer_warp(Resource *, struct ::wl_resource *, wl_fixed_t , wl_fixed_t ) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_init_generator_with_name(Resource *, uint32_t , const std::string &) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_destroy(Resource *) + { + } + + void tizen_input_device_manager::tizen_input_device_manager_generate_axis(Resource *, uint32_t , wl_fixed_t ) + { + } + + + void tizen_input_device_manager::handle_block_events( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t clas, + uint32_t duration) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_block_events( + r, + serial, + clas, + duration); + } + + void tizen_input_device_manager::handle_unblock_events( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_unblock_events( + r, + serial); + } + + void tizen_input_device_manager::handle_init_generator( + ::wl_client *client, + struct wl_resource *resource, + uint32_t clas) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_init_generator( + r, + clas); + } + + void tizen_input_device_manager::handle_deinit_generator( + ::wl_client *client, + struct wl_resource *resource, + uint32_t clas) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_deinit_generator( + r, + clas); + } + + void tizen_input_device_manager::handle_generate_key( + ::wl_client *client, + struct wl_resource *resource, + const char *keyname, + uint32_t pressed) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_generate_key( + r, + std::string(keyname), + pressed); + } + + void tizen_input_device_manager::handle_generate_pointer( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type, + uint32_t x, + uint32_t y, + uint32_t button) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_generate_pointer( + r, + type, + x, + y, + button); + } + + void tizen_input_device_manager::handle_generate_touch( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type, + uint32_t x, + uint32_t y, + uint32_t finger) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_generate_touch( + r, + type, + x, + y, + finger); + } + + void tizen_input_device_manager::handle_pointer_warp( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + wl_fixed_t x, + wl_fixed_t y) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_pointer_warp( + r, + surface, + x, + y); + } + + void tizen_input_device_manager::handle_init_generator_with_name( + ::wl_client *client, + struct wl_resource *resource, + uint32_t clas, + const char *name) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_init_generator_with_name( + r, + clas, + std::string(name)); + } + + void tizen_input_device_manager::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_destroy( + r); + } + + void tizen_input_device_manager::handle_generate_axis( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type, + wl_fixed_t value) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_manager_object)->tizen_input_device_manager_generate_axis( + r, + type, + value); + } + + void tizen_input_device_manager::send_device_add(uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat) + { + DS_ASSERT_X(m_resource, "tizen_input_device_manager::device_add", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_input_device_manager::device_add as it's not initialised"); + return; + } + send_device_add( + m_resource->handle, + serial, + identifier, + device, + seat); + } + + void tizen_input_device_manager::send_device_add(struct ::wl_resource *resource, uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat) + { + tizen_input_device_manager_send_device_add( + resource, + serial, + identifier.c_str(), + device, + seat); + } + + + void tizen_input_device_manager::send_device_remove(uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat) + { + DS_ASSERT_X(m_resource, "tizen_input_device_manager::device_remove", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_input_device_manager::device_remove as it's not initialised"); + return; + } + send_device_remove( + m_resource->handle, + serial, + identifier, + device, + seat); + } + + void tizen_input_device_manager::send_device_remove(struct ::wl_resource *resource, uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat) + { + tizen_input_device_manager_send_device_remove( + resource, + serial, + identifier.c_str(), + device, + seat); + } + + + void tizen_input_device_manager::send_error(uint32_t errorcode) + { + DS_ASSERT_X(m_resource, "tizen_input_device_manager::error", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_input_device_manager::error as it's not initialised"); + return; + } + send_error( + m_resource->handle, + errorcode); + } + + void tizen_input_device_manager::send_error(struct ::wl_resource *resource, uint32_t errorcode) + { + tizen_input_device_manager_send_error( + resource, + errorcode); + } + + + void tizen_input_device_manager::send_block_expired() + { + DS_ASSERT_X(m_resource, "tizen_input_device_manager::block_expired", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_input_device_manager::block_expired as it's not initialised"); + return; + } + send_block_expired( + m_resource->handle); + } + + void tizen_input_device_manager::send_block_expired(struct ::wl_resource *resource) + { + tizen_input_device_manager_send_block_expired( + resource); + } + + + tizen_input_device::tizen_input_device(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_input_device::tizen_input_device(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_input_device::tizen_input_device(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_input_device::tizen_input_device() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_input_device::~tizen_input_device() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_input_device::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_input_device::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_input_device::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_input_device::Resource *tizen_input_device::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_input_device::Resource *tizen_input_device::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_input_device::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_input_device_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_input_device::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_input_device::interface() + { + return &::tizen_input_device_interface; + } + + tizen_input_device::Resource *tizen_input_device::tizen_input_device_allocate() + { + return new Resource; + } + + void tizen_input_device::tizen_input_device_bind_resource(Resource *) + { + } + + void tizen_input_device::tizen_input_device_destroy_resource(Resource *) + { + } + + void tizen_input_device::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_input_device *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_input_device::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_input_device *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_input_device::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_input_device *that = resource->tizen_input_device_object; + that->m_resource_map.erase(resource->client()); + that->tizen_input_device_destroy_resource(resource); + delete resource; + } + + tizen_input_device::Resource *tizen_input_device::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_input_device_interface, version, id); + return bind(handle); + } + + tizen_input_device::Resource *tizen_input_device::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_input_device_allocate(); + resource->tizen_input_device_object = this; + + wl_resource_set_implementation(handle, &m_tizen_input_device_interface, resource, destroy_func); + resource->handle = handle; + tizen_input_device_bind_resource(resource); + return resource; + } + tizen_input_device::Resource *tizen_input_device::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_input_device_interface, &m_tizen_input_device_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_input_device_interface tizen_input_device::m_tizen_input_device_interface = { + tizen_input_device::handle_select_axes, + tizen_input_device::handle_release + }; + + void tizen_input_device::tizen_input_device_select_axes(Resource *, wl_array *) + { + } + + void tizen_input_device::tizen_input_device_release(Resource *) + { + } + + + void tizen_input_device::handle_select_axes( + ::wl_client *client, + struct wl_resource *resource, + wl_array *axes) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_object)->tizen_input_device_select_axes( + r, + axes); + } + + void tizen_input_device::handle_release( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_input_device_object)->tizen_input_device_release( + r); + } + + void tizen_input_device::send_device_info(const std::string &name, uint32_t clas, uint32_t subclas, const std::string &axes) + { + DS_ASSERT_X(m_resource, "tizen_input_device::device_info", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_input_device::device_info as it's not initialised"); + return; + } + send_device_info( + m_resource->handle, + name, + clas, + subclas, + axes); + } + + void tizen_input_device::send_device_info(struct ::wl_resource *resource, const std::string &name, uint32_t clas, uint32_t subclas, const std::string &axes) + { + struct wl_array axes_data; + axes_data.size = axes.size(); + axes_data.data = static_cast(const_cast(axes.c_str())); + axes_data.alloc = 0; + + tizen_input_device_send_device_info( + resource, + name.c_str(), + clas, + subclas, + &axes_data); + } + + + void tizen_input_device::send_event_device(uint32_t serial, const std::string &name, uint32_t time) + { + DS_ASSERT_X(m_resource, "tizen_input_device::event_device", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_input_device::event_device as it's not initialised"); + return; + } + send_event_device( + m_resource->handle, + serial, + name, + time); + } + + void tizen_input_device::send_event_device(struct ::wl_resource *resource, uint32_t serial, const std::string &name, uint32_t time) + { + tizen_input_device_send_event_device( + resource, + serial, + name.c_str(), + time); + } + + + void tizen_input_device::send_axis(uint32_t axis_type, wl_fixed_t value) + { + DS_ASSERT_X(m_resource, "tizen_input_device::axis", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_input_device::axis as it's not initialised"); + return; + } + send_axis( + m_resource->handle, + axis_type, + value); + } + + void tizen_input_device::send_axis(struct ::wl_resource *resource, uint32_t axis_type, wl_fixed_t value) + { + tizen_input_device_send_axis( + resource, + axis_type, + value); + } + + + tizen_launchscreen::tizen_launchscreen(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_launchscreen::tizen_launchscreen(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_launchscreen::tizen_launchscreen(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_launchscreen::tizen_launchscreen() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_launchscreen::~tizen_launchscreen() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_launchscreen::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_launchscreen::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_launchscreen::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_launchscreen::Resource *tizen_launchscreen::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_launchscreen::Resource *tizen_launchscreen::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_launchscreen::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_launchscreen_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_launchscreen::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_launchscreen::interface() + { + return &::tizen_launchscreen_interface; + } + + tizen_launchscreen::Resource *tizen_launchscreen::tizen_launchscreen_allocate() + { + return new Resource; + } + + void tizen_launchscreen::tizen_launchscreen_bind_resource(Resource *) + { + } + + void tizen_launchscreen::tizen_launchscreen_destroy_resource(Resource *) + { + } + + void tizen_launchscreen::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_launchscreen *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_launchscreen::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_launchscreen *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_launchscreen::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_launchscreen *that = resource->tizen_launchscreen_object; + that->m_resource_map.erase(resource->client()); + that->tizen_launchscreen_destroy_resource(resource); + delete resource; + } + + tizen_launchscreen::Resource *tizen_launchscreen::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launchscreen_interface, version, id); + return bind(handle); + } + + tizen_launchscreen::Resource *tizen_launchscreen::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_launchscreen_allocate(); + resource->tizen_launchscreen_object = this; + + wl_resource_set_implementation(handle, &m_tizen_launchscreen_interface, resource, destroy_func); + resource->handle = handle; + tizen_launchscreen_bind_resource(resource); + return resource; + } + tizen_launchscreen::Resource *tizen_launchscreen::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_launchscreen_interface, &m_tizen_launchscreen_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_launchscreen_interface tizen_launchscreen::m_tizen_launchscreen_interface = { + tizen_launchscreen::handle_create_img, + tizen_launchscreen::handle_destroy + }; + + void tizen_launchscreen::tizen_launchscreen_create_img(Resource *, uint32_t) + { + } + + void tizen_launchscreen::tizen_launchscreen_destroy(Resource *) + { + } + + + void tizen_launchscreen::handle_create_img( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launchscreen_object)->tizen_launchscreen_create_img( + r, + id); + } + + void tizen_launchscreen::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launchscreen_object)->tizen_launchscreen_destroy( + r); + } + + tizen_launch_image::tizen_launch_image(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_launch_image::tizen_launch_image(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_launch_image::tizen_launch_image(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_launch_image::tizen_launch_image() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_launch_image::~tizen_launch_image() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_launch_image::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_launch_image::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_launch_image::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_launch_image::Resource *tizen_launch_image::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_launch_image::Resource *tizen_launch_image::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_launch_image::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_launch_image_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_launch_image::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_launch_image::interface() + { + return &::tizen_launch_image_interface; + } + + tizen_launch_image::Resource *tizen_launch_image::tizen_launch_image_allocate() + { + return new Resource; + } + + void tizen_launch_image::tizen_launch_image_bind_resource(Resource *) + { + } + + void tizen_launch_image::tizen_launch_image_destroy_resource(Resource *) + { + } + + void tizen_launch_image::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_launch_image *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_launch_image::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_launch_image *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_launch_image::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_launch_image *that = resource->tizen_launch_image_object; + that->m_resource_map.erase(resource->client()); + that->tizen_launch_image_destroy_resource(resource); + delete resource; + } + + tizen_launch_image::Resource *tizen_launch_image::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launch_image_interface, version, id); + return bind(handle); + } + + tizen_launch_image::Resource *tizen_launch_image::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_launch_image_allocate(); + resource->tizen_launch_image_object = this; + + wl_resource_set_implementation(handle, &m_tizen_launch_image_interface, resource, destroy_func); + resource->handle = handle; + tizen_launch_image_bind_resource(resource); + return resource; + } + tizen_launch_image::Resource *tizen_launch_image::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_launch_image_interface, &m_tizen_launch_image_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_launch_image_interface tizen_launch_image::m_tizen_launch_image_interface = { + tizen_launch_image::handle_destroy, + tizen_launch_image::handle_launch, + tizen_launch_image::handle_owner, + tizen_launch_image::handle_show, + tizen_launch_image::handle_hide + }; + + void tizen_launch_image::tizen_launch_image_destroy(Resource *) + { + } + + void tizen_launch_image::tizen_launch_image_launch(Resource *, const std::string &, uint32_t , uint32_t , uint32_t , uint32_t , wl_array *) + { + } + + void tizen_launch_image::tizen_launch_image_owner(Resource *, uint32_t ) + { + } + + void tizen_launch_image::tizen_launch_image_show(Resource *) + { + } + + void tizen_launch_image::tizen_launch_image_hide(Resource *) + { + } + + + void tizen_launch_image::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_image_object)->tizen_launch_image_destroy( + r); + } + + void tizen_launch_image::handle_launch( + ::wl_client *client, + struct wl_resource *resource, + const char *file, + uint32_t file_type, + uint32_t color_depth, + uint32_t rotation, + uint32_t indicator, + wl_array *options) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_image_object)->tizen_launch_image_launch( + r, + std::string(file), + file_type, + color_depth, + rotation, + indicator, + options); + } + + void tizen_launch_image::handle_owner( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_image_object)->tizen_launch_image_owner( + r, + pid); + } + + void tizen_launch_image::handle_show( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_image_object)->tizen_launch_image_show( + r); + } + + void tizen_launch_image::handle_hide( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_image_object)->tizen_launch_image_hide( + r); + } + + tizen_effect::tizen_effect(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_effect::tizen_effect(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_effect::tizen_effect(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_effect::tizen_effect() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_effect::~tizen_effect() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_effect::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_effect::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_effect::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_effect::Resource *tizen_effect::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_effect::Resource *tizen_effect::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_effect::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_effect_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_effect::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_effect::interface() + { + return &::tizen_effect_interface; + } + + tizen_effect::Resource *tizen_effect::tizen_effect_allocate() + { + return new Resource; + } + + void tizen_effect::tizen_effect_bind_resource(Resource *) + { + } + + void tizen_effect::tizen_effect_destroy_resource(Resource *) + { + } + + void tizen_effect::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_effect *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_effect::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_effect *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_effect::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_effect *that = resource->tizen_effect_object; + that->m_resource_map.erase(resource->client()); + that->tizen_effect_destroy_resource(resource); + delete resource; + } + + tizen_effect::Resource *tizen_effect::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_effect_interface, version, id); + return bind(handle); + } + + tizen_effect::Resource *tizen_effect::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_effect_allocate(); + resource->tizen_effect_object = this; + + wl_resource_set_implementation(handle, &m_tizen_effect_interface, resource, destroy_func); + resource->handle = handle; + tizen_effect_bind_resource(resource); + return resource; + } + tizen_effect::Resource *tizen_effect::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_effect_interface, &m_tizen_effect_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_effect_interface tizen_effect::m_tizen_effect_interface = { + tizen_effect::handle_destroy + }; + + void tizen_effect::tizen_effect_destroy(Resource *) + { + } + + + void tizen_effect::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_effect_object)->tizen_effect_destroy( + r); + } + + void tizen_effect::send_start(struct ::wl_resource *surface, uint32_t type) + { + DS_ASSERT_X(m_resource, "tizen_effect::start", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_effect::start as it's not initialised"); + return; + } + send_start( + m_resource->handle, + surface, + type); + } + + void tizen_effect::send_start(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type) + { + tizen_effect_send_start( + resource, + surface, + type); + } + + + void tizen_effect::send_end(struct ::wl_resource *surface, uint32_t type) + { + DS_ASSERT_X(m_resource, "tizen_effect::end", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_effect::end as it's not initialised"); + return; + } + send_end( + m_resource->handle, + surface, + type); + } + + void tizen_effect::send_end(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type) + { + tizen_effect_send_end( + resource, + surface, + type); + } + + + tizen_display_policy::tizen_display_policy(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_display_policy::tizen_display_policy(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_display_policy::tizen_display_policy(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_display_policy::tizen_display_policy() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_display_policy::~tizen_display_policy() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_display_policy::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_display_policy::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_display_policy::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_display_policy::Resource *tizen_display_policy::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_display_policy::Resource *tizen_display_policy::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_display_policy::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_display_policy_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_display_policy::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_display_policy::interface() + { + return &::tizen_display_policy_interface; + } + + tizen_display_policy::Resource *tizen_display_policy::tizen_display_policy_allocate() + { + return new Resource; + } + + void tizen_display_policy::tizen_display_policy_bind_resource(Resource *) + { + } + + void tizen_display_policy::tizen_display_policy_destroy_resource(Resource *) + { + } + + void tizen_display_policy::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_display_policy *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_display_policy::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_display_policy *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_display_policy::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_display_policy *that = resource->tizen_display_policy_object; + that->m_resource_map.erase(resource->client()); + that->tizen_display_policy_destroy_resource(resource); + delete resource; + } + + tizen_display_policy::Resource *tizen_display_policy::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_display_policy_interface, version, id); + return bind(handle); + } + + tizen_display_policy::Resource *tizen_display_policy::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_display_policy_allocate(); + resource->tizen_display_policy_object = this; + + wl_resource_set_implementation(handle, &m_tizen_display_policy_interface, resource, destroy_func); + resource->handle = handle; + tizen_display_policy_bind_resource(resource); + return resource; + } + tizen_display_policy::Resource *tizen_display_policy::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_display_policy_interface, &m_tizen_display_policy_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_display_policy_interface tizen_display_policy::m_tizen_display_policy_interface = { + tizen_display_policy::handle_set_window_brightness, + tizen_display_policy::handle_destroy + }; + + void tizen_display_policy::tizen_display_policy_set_window_brightness(Resource *, struct ::wl_resource *, int32_t ) + { + } + + void tizen_display_policy::tizen_display_policy_destroy(Resource *) + { + } + + + void tizen_display_policy::handle_set_window_brightness( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t brightness) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_display_policy_object)->tizen_display_policy_set_window_brightness( + r, + surface, + brightness); + } + + void tizen_display_policy::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_display_policy_object)->tizen_display_policy_destroy( + r); + } + + void tizen_display_policy::send_window_brightness_done(struct ::wl_resource *surface, int32_t brightness, uint32_t error_state) + { + DS_ASSERT_X(m_resource, "tizen_display_policy::window_brightness_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_display_policy::window_brightness_done as it's not initialised"); + return; + } + send_window_brightness_done( + m_resource->handle, + surface, + brightness, + error_state); + } + + void tizen_display_policy::send_window_brightness_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t brightness, uint32_t error_state) + { + tizen_display_policy_send_window_brightness_done( + resource, + surface, + brightness, + error_state); + } + + + tizen_indicator::tizen_indicator(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_indicator::tizen_indicator(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_indicator::tizen_indicator(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_indicator::tizen_indicator() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_indicator::~tizen_indicator() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_indicator::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_indicator::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_indicator::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_indicator::Resource *tizen_indicator::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_indicator::Resource *tizen_indicator::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_indicator::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_indicator_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_indicator::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_indicator::interface() + { + return &::tizen_indicator_interface; + } + + tizen_indicator::Resource *tizen_indicator::tizen_indicator_allocate() + { + return new Resource; + } + + void tizen_indicator::tizen_indicator_bind_resource(Resource *) + { + } + + void tizen_indicator::tizen_indicator_destroy_resource(Resource *) + { + } + + void tizen_indicator::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_indicator *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_indicator::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_indicator *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_indicator::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_indicator *that = resource->tizen_indicator_object; + that->m_resource_map.erase(resource->client()); + that->tizen_indicator_destroy_resource(resource); + delete resource; + } + + tizen_indicator::Resource *tizen_indicator::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_indicator_interface, version, id); + return bind(handle); + } + + tizen_indicator::Resource *tizen_indicator::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_indicator_allocate(); + resource->tizen_indicator_object = this; + + wl_resource_set_implementation(handle, &m_tizen_indicator_interface, resource, destroy_func); + resource->handle = handle; + tizen_indicator_bind_resource(resource); + return resource; + } + tizen_indicator::Resource *tizen_indicator::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_indicator_interface, &m_tizen_indicator_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_indicator_interface tizen_indicator::m_tizen_indicator_interface = { + tizen_indicator::handle_destroy, + tizen_indicator::handle_set_state, + tizen_indicator::handle_set_opacity_mode, + tizen_indicator::handle_set_visible_type + }; + + void tizen_indicator::tizen_indicator_destroy(Resource *) + { + } + + void tizen_indicator::tizen_indicator_set_state(Resource *, struct ::wl_resource *, int32_t ) + { + } + + void tizen_indicator::tizen_indicator_set_opacity_mode(Resource *, struct ::wl_resource *, int32_t ) + { + } + + void tizen_indicator::tizen_indicator_set_visible_type(Resource *, struct ::wl_resource *, int32_t ) + { + } + + + void tizen_indicator::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_indicator_object)->tizen_indicator_destroy( + r); + } + + void tizen_indicator::handle_set_state( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t state) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_indicator_object)->tizen_indicator_set_state( + r, + surface, + state); + } + + void tizen_indicator::handle_set_opacity_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t mode) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_indicator_object)->tizen_indicator_set_opacity_mode( + r, + surface, + mode); + } + + void tizen_indicator::handle_set_visible_type( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t type) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_indicator_object)->tizen_indicator_set_visible_type( + r, + surface, + type); + } + + void tizen_indicator::send_flick(struct ::wl_resource *surface, int32_t type) + { + DS_ASSERT_X(m_resource, "tizen_indicator::flick", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_indicator::flick as it's not initialised"); + return; + } + send_flick( + m_resource->handle, + surface, + type); + } + + void tizen_indicator::send_flick(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t type) + { + tizen_indicator_send_flick( + resource, + surface, + type); + } + + + tizen_clipboard::tizen_clipboard(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_clipboard::tizen_clipboard(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_clipboard::tizen_clipboard(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_clipboard::tizen_clipboard() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_clipboard::~tizen_clipboard() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_clipboard::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_clipboard::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_clipboard::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_clipboard::Resource *tizen_clipboard::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_clipboard::Resource *tizen_clipboard::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_clipboard::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_clipboard_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_clipboard::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_clipboard::interface() + { + return &::tizen_clipboard_interface; + } + + tizen_clipboard::Resource *tizen_clipboard::tizen_clipboard_allocate() + { + return new Resource; + } + + void tizen_clipboard::tizen_clipboard_bind_resource(Resource *) + { + } + + void tizen_clipboard::tizen_clipboard_destroy_resource(Resource *) + { + } + + void tizen_clipboard::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_clipboard *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_clipboard::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_clipboard *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_clipboard::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_clipboard *that = resource->tizen_clipboard_object; + that->m_resource_map.erase(resource->client()); + that->tizen_clipboard_destroy_resource(resource); + delete resource; + } + + tizen_clipboard::Resource *tizen_clipboard::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_clipboard_interface, version, id); + return bind(handle); + } + + tizen_clipboard::Resource *tizen_clipboard::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_clipboard_allocate(); + resource->tizen_clipboard_object = this; + + wl_resource_set_implementation(handle, &m_tizen_clipboard_interface, resource, destroy_func); + resource->handle = handle; + tizen_clipboard_bind_resource(resource); + return resource; + } + tizen_clipboard::Resource *tizen_clipboard::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_clipboard_interface, &m_tizen_clipboard_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_clipboard_interface tizen_clipboard::m_tizen_clipboard_interface = { + tizen_clipboard::handle_destroy, + tizen_clipboard::handle_show, + tizen_clipboard::handle_hide, + tizen_clipboard::handle_set_data_only + }; + + void tizen_clipboard::tizen_clipboard_destroy(Resource *) + { + } + + void tizen_clipboard::tizen_clipboard_show(Resource *, struct ::wl_resource *) + { + } + + void tizen_clipboard::tizen_clipboard_hide(Resource *, struct ::wl_resource *) + { + } + + void tizen_clipboard::tizen_clipboard_set_data_only(Resource *, uint32_t ) + { + } + + + void tizen_clipboard::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_clipboard_object)->tizen_clipboard_destroy( + r); + } + + void tizen_clipboard::handle_show( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_clipboard_object)->tizen_clipboard_show( + r, + surface); + } + + void tizen_clipboard::handle_hide( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_clipboard_object)->tizen_clipboard_hide( + r, + surface); + } + + void tizen_clipboard::handle_set_data_only( + ::wl_client *client, + struct wl_resource *resource, + uint32_t set) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_clipboard_object)->tizen_clipboard_set_data_only( + r, + set); + } + + void tizen_clipboard::send_data_selected(struct ::wl_resource *surface) + { + DS_ASSERT_X(m_resource, "tizen_clipboard::data_selected", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_clipboard::data_selected as it's not initialised"); + return; + } + send_data_selected( + m_resource->handle, + surface); + } + + void tizen_clipboard::send_data_selected(struct ::wl_resource *resource, struct ::wl_resource *surface) + { + tizen_clipboard_send_data_selected( + resource, + surface); + } + + + void tizen_clipboard::send_allowed_data_only(uint32_t allowed) + { + DS_ASSERT_X(m_resource, "tizen_clipboard::allowed_data_only", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_clipboard::allowed_data_only as it's not initialised"); + return; + } + send_allowed_data_only( + m_resource->handle, + allowed); + } + + void tizen_clipboard::send_allowed_data_only(struct ::wl_resource *resource, uint32_t allowed) + { + tizen_clipboard_send_allowed_data_only( + resource, + allowed); + } + + + tizen_screen_rotation::tizen_screen_rotation(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_screen_rotation::tizen_screen_rotation(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_screen_rotation::tizen_screen_rotation(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_screen_rotation::tizen_screen_rotation() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_screen_rotation::~tizen_screen_rotation() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_screen_rotation::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_screen_rotation::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_screen_rotation::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_screen_rotation::Resource *tizen_screen_rotation::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_screen_rotation::Resource *tizen_screen_rotation::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_screen_rotation::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_screen_rotation_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_screen_rotation::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_screen_rotation::interface() + { + return &::tizen_screen_rotation_interface; + } + + tizen_screen_rotation::Resource *tizen_screen_rotation::tizen_screen_rotation_allocate() + { + return new Resource; + } + + void tizen_screen_rotation::tizen_screen_rotation_bind_resource(Resource *) + { + } + + void tizen_screen_rotation::tizen_screen_rotation_destroy_resource(Resource *) + { + } + + void tizen_screen_rotation::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_screen_rotation *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_screen_rotation::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_screen_rotation *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_screen_rotation::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_screen_rotation *that = resource->tizen_screen_rotation_object; + that->m_resource_map.erase(resource->client()); + that->tizen_screen_rotation_destroy_resource(resource); + delete resource; + } + + tizen_screen_rotation::Resource *tizen_screen_rotation::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_screen_rotation_interface, version, id); + return bind(handle); + } + + tizen_screen_rotation::Resource *tizen_screen_rotation::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_screen_rotation_allocate(); + resource->tizen_screen_rotation_object = this; + + wl_resource_set_implementation(handle, &m_tizen_screen_rotation_interface, resource, destroy_func); + resource->handle = handle; + tizen_screen_rotation_bind_resource(resource); + return resource; + } + tizen_screen_rotation::Resource *tizen_screen_rotation::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_screen_rotation_interface, &m_tizen_screen_rotation_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_screen_rotation_interface tizen_screen_rotation::m_tizen_screen_rotation_interface = { + tizen_screen_rotation::handle_get_ignore_output_transform, + tizen_screen_rotation::handle_destroy + }; + + void tizen_screen_rotation::tizen_screen_rotation_get_ignore_output_transform(Resource *, struct ::wl_resource *) + { + } + + void tizen_screen_rotation::tizen_screen_rotation_destroy(Resource *) + { + } + + + void tizen_screen_rotation::handle_get_ignore_output_transform( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screen_rotation_object)->tizen_screen_rotation_get_ignore_output_transform( + r, + surface); + } + + void tizen_screen_rotation::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_screen_rotation_object)->tizen_screen_rotation_destroy( + r); + } + + void tizen_screen_rotation::send_ignore_output_transform(struct ::wl_resource *surface, uint32_t ignore) + { + DS_ASSERT_X(m_resource, "tizen_screen_rotation::ignore_output_transform", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_screen_rotation::ignore_output_transform as it's not initialised"); + return; + } + send_ignore_output_transform( + m_resource->handle, + surface, + ignore); + } + + void tizen_screen_rotation::send_ignore_output_transform(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t ignore) + { + tizen_screen_rotation_send_ignore_output_transform( + resource, + surface, + ignore); + } + +} + diff --git a/src/DSWaylandServer/dswayland-server-tizen-extension.h b/src/DSWaylandServer/dswayland-server-tizen-extension.h new file mode 100644 index 0000000..e605687 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-extension.h @@ -0,0 +1,3192 @@ +/* Protocol XML file : wayland-extension/tizen-extension.xml */ + +#ifndef __DS_TIZEN_EXTENSION_PROTOCOL_H__ +#define __DS_TIZEN_EXTENSION_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "tizen-extension-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class tizen_surface + { + public: + tizen_surface(struct ::wl_client *client, int id, int version); + tizen_surface(struct ::wl_display *display, int version); + tizen_surface(struct ::wl_resource *resource); + tizen_surface(); + + virtual ~tizen_surface(); + + class Resource + { + public: + Resource() : tizen_surface_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_surface *tizen_surface_object; + tizen_surface *object() { return tizen_surface_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *tizen_surface_allocate(); + + virtual void tizen_surface_bind_resource(Resource *resource); + virtual void tizen_surface_destroy_resource(Resource *resource); + + virtual void tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface); + virtual void tizen_surface_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_surface_interface m_tizen_surface_interface; + + static void handle_get_tizen_resource( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_surface *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_resource + { + public: + tizen_resource(struct ::wl_client *client, int id, int version); + tizen_resource(struct ::wl_display *display, int version); + tizen_resource(struct ::wl_resource *resource); + tizen_resource(); + + virtual ~tizen_resource(); + + class Resource + { + public: + Resource() : tizen_resource_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_resource *tizen_resource_object; + tizen_resource *object() { return tizen_resource_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_resource_id(uint32_t id); + void send_resource_id(struct ::wl_resource *resource, uint32_t id); + + protected: + virtual Resource *tizen_resource_allocate(); + + virtual void tizen_resource_bind_resource(Resource *resource); + virtual void tizen_resource_destroy_resource(Resource *resource); + + virtual void tizen_resource_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_resource_interface m_tizen_resource_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_resource *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_policy + { + public: + tizen_policy(struct ::wl_client *client, int id, int version); + tizen_policy(struct ::wl_display *display, int version); + tizen_policy(struct ::wl_resource *resource); + tizen_policy(); + + virtual ~tizen_policy(); + + class Resource + { + public: + Resource() : tizen_policy_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_policy *tizen_policy_object; + tizen_policy *object() { return tizen_policy_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum win_type { + win_type_none = 0, + win_type_toplevel = 1, + win_type_fullscreen = 2, + win_type_maximized = 3, + win_type_transient = 4, + win_type_menu = 5, + win_type_dnd = 6, + win_type_custom = 7, + win_type_notification = 8, + win_type_utility = 9, + win_type_dialog = 10, + win_type_dock = 11, + win_type_splash = 12, + }; + + enum conformant_part { + conformant_part_indicator = 0, + conformant_part_keyboard = 1, + conformant_part_clipboard = 2, + }; + + enum error_state { + error_state_none = 0, + error_state_permission_denied = 1, + }; + + enum level { + level_1 = 0, + level_2 = 1, + level_3 = 2, + level_none = -1, + level_default = 10, + level_medium = 20, + level_high = 30, + level_top = 40, + }; + + enum mode { + mode_default = 0, + mode_always_on = 1, + }; + + enum stack_mode { + stack_mode_none = 0, + stack_mode_above = 1, + stack_mode_below = 2, + }; + + void send_conformant(struct ::wl_resource *surface, uint32_t is_conformant); + void send_conformant(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t is_conformant); + void send_conformant_area(struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h); + void send_conformant_area(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h); + void send_notification_done(struct ::wl_resource *surface, int32_t level, uint32_t error_state); + void send_notification_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t level, uint32_t error_state); + void send_transient_for_done(uint32_t child_id); + void send_transient_for_done(struct ::wl_resource *resource, uint32_t child_id); + void send_window_screen_mode_done(struct ::wl_resource *surface, uint32_t mode, uint32_t error_state); + void send_window_screen_mode_done(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode, uint32_t error_state); + void send_iconify_state_changed(struct ::wl_resource *surface, uint32_t iconified, uint32_t force); + void send_iconify_state_changed(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t iconified, uint32_t force); + void send_supported_aux_hints(struct ::wl_resource *surface, const std::string &hints, uint32_t num_hints); + void send_supported_aux_hints(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &hints, uint32_t num_hints); + void send_allowed_aux_hint(struct ::wl_resource *surface, int32_t id); + void send_allowed_aux_hint(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t id); + void send_aux_message(struct ::wl_resource *surface, const std::string &key, const std::string &value, const std::string &options); + void send_aux_message(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &key, const std::string &value, const std::string &options); + void send_conformant_region(struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial); + void send_conformant_region(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial); + + protected: + virtual Resource *tizen_policy_allocate(); + + virtual void tizen_policy_bind_resource(Resource *resource); + virtual void tizen_policy_destroy_resource(Resource *resource); + + virtual void tizen_policy_get_visibility(Resource *resource, uint32_t id, struct ::wl_resource *surface); + virtual void tizen_policy_get_position(Resource *resource, uint32_t id, struct ::wl_resource *surface); + virtual void tizen_policy_activate(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_activate_below_by_res_id(Resource *resource, uint32_t res_id, uint32_t below_res_id); + virtual void tizen_policy_raise(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_lower(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_lower_by_res_id(Resource *resource, uint32_t res_id); + virtual void tizen_policy_set_focus_skip(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_unset_focus_skip(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_set_role(Resource *resource, struct ::wl_resource *surface, const std::string &role); + virtual void tizen_policy_set_type(Resource *resource, struct ::wl_resource *surface, uint32_t win_type); + virtual void tizen_policy_set_conformant(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_unset_conformant(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_get_conformant(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_set_notification_level(Resource *resource, struct ::wl_resource *surface, int32_t level); + virtual void tizen_policy_set_transient_for(Resource *resource, uint32_t child_id, uint32_t parent_id); + virtual void tizen_policy_unset_transient_for(Resource *resource, uint32_t child_id); + virtual void tizen_policy_set_window_screen_mode(Resource *resource, struct ::wl_resource *surface, uint32_t mode); + virtual void tizen_policy_place_subsurface_below_parent(Resource *resource, struct ::wl_resource *subsurface); + virtual void tizen_policy_set_subsurface_stand_alone(Resource *resource, struct ::wl_resource *subsurface); + virtual void tizen_policy_get_subsurface(Resource *resource, uint32_t id, struct ::wl_resource *surface, uint32_t parent_id); + virtual void tizen_policy_set_opaque_state(Resource *resource, struct ::wl_resource *surface, int32_t state); + virtual void tizen_policy_iconify(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_uniconify(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_add_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &name, const std::string &value); + virtual void tizen_policy_change_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &value); + virtual void tizen_policy_del_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id); + virtual void tizen_policy_get_supported_aux_hints(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_set_background_state(Resource *resource, uint32_t pid); + virtual void tizen_policy_unset_background_state(Resource *resource, uint32_t pid); + virtual void tizen_policy_set_floating_mode(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_unset_floating_mode(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_policy_set_stack_mode(Resource *resource, struct ::wl_resource *surface, uint32_t mode); + virtual void tizen_policy_activate_above_by_res_id(Resource *resource, uint32_t res_id, uint32_t above_res_id); + virtual void tizen_policy_get_subsurface_watcher(Resource *resource, uint32_t id, struct ::wl_resource *surface); + virtual void tizen_policy_set_parent(Resource *resource, struct ::wl_resource *child, struct ::wl_resource *parent); + virtual void tizen_policy_ack_conformant_region(Resource *resource, struct ::wl_resource *surface, uint32_t serial); + virtual void tizen_policy_destroy(Resource *resource); + virtual void tizen_policy_has_video(Resource *resource, struct ::wl_resource *surface, uint32_t has); + virtual void tizen_policy_set_appid(Resource *resource, int32_t pid, const std::string &appid); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_policy_interface m_tizen_policy_interface; + + static void handle_get_visibility( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + static void handle_get_position( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + static void handle_activate( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_activate_below_by_res_id( + ::wl_client *client, + struct wl_resource *resource, + uint32_t res_id, + uint32_t below_res_id); + static void handle_raise( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_lower( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_lower_by_res_id( + ::wl_client *client, + struct wl_resource *resource, + uint32_t res_id); + static void handle_set_focus_skip( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_unset_focus_skip( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_set_role( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + const char *role); + static void handle_set_type( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t win_type); + static void handle_set_conformant( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_unset_conformant( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_get_conformant( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_set_notification_level( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t level); + static void handle_set_transient_for( + ::wl_client *client, + struct wl_resource *resource, + uint32_t child_id, + uint32_t parent_id); + static void handle_unset_transient_for( + ::wl_client *client, + struct wl_resource *resource, + uint32_t child_id); + static void handle_set_window_screen_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t mode); + static void handle_place_subsurface_below_parent( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *subsurface); + static void handle_set_subsurface_stand_alone( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *subsurface); + static void handle_get_subsurface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface, + uint32_t parent_id); + static void handle_set_opaque_state( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t state); + static void handle_iconify( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_uniconify( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_add_aux_hint( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t id, + const char *name, + const char *value); + static void handle_change_aux_hint( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t id, + const char *value); + static void handle_del_aux_hint( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t id); + static void handle_get_supported_aux_hints( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_set_background_state( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid); + static void handle_unset_background_state( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid); + static void handle_set_floating_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_unset_floating_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_set_stack_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t mode); + static void handle_activate_above_by_res_id( + ::wl_client *client, + struct wl_resource *resource, + uint32_t res_id, + uint32_t above_res_id); + static void handle_get_subsurface_watcher( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + static void handle_set_parent( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *child, + struct ::wl_resource *parent); + static void handle_ack_conformant_region( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t serial); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_has_video( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t has); + static void handle_set_appid( + ::wl_client *client, + struct wl_resource *resource, + int32_t pid, + const char *appid); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_policy *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_visibility + { + public: + tizen_visibility(struct ::wl_client *client, int id, int version); + tizen_visibility(struct ::wl_display *display, int version); + tizen_visibility(struct ::wl_resource *resource); + tizen_visibility(); + + virtual ~tizen_visibility(); + + class Resource + { + public: + Resource() : tizen_visibility_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_visibility *tizen_visibility_object; + tizen_visibility *object() { return tizen_visibility_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum visibility { + visibility_unobscured = 0, + visibility_partially_obscured = 1, + visibility_fully_obscured = 2, + visibility_pre_unobscured = 3, + }; + + void send_notify(uint32_t visibility); + void send_notify(struct ::wl_resource *resource, uint32_t visibility); + void send_changed(uint32_t type, uint32_t option); + void send_changed(struct ::wl_resource *resource, uint32_t type, uint32_t option); + + protected: + virtual Resource *tizen_visibility_allocate(); + + virtual void tizen_visibility_bind_resource(Resource *resource); + virtual void tizen_visibility_destroy_resource(Resource *resource); + + virtual void tizen_visibility_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_visibility_interface m_tizen_visibility_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_visibility *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_position + { + public: + tizen_position(struct ::wl_client *client, int id, int version); + tizen_position(struct ::wl_display *display, int version); + tizen_position(struct ::wl_resource *resource); + tizen_position(); + + virtual ~tizen_position(); + + class Resource + { + public: + Resource() : tizen_position_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_position *tizen_position_object; + tizen_position *object() { return tizen_position_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_changed(int32_t x, int32_t y); + void send_changed(struct ::wl_resource *resource, int32_t x, int32_t y); + + protected: + virtual Resource *tizen_position_allocate(); + + virtual void tizen_position_bind_resource(Resource *resource); + virtual void tizen_position_destroy_resource(Resource *resource); + + virtual void tizen_position_destroy(Resource *resource); + virtual void tizen_position_set(Resource *resource, int32_t x, int32_t y); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_position_interface m_tizen_position_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_position *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_move_resize + { + public: + tizen_move_resize(struct ::wl_client *client, int id, int version); + tizen_move_resize(struct ::wl_display *display, int version); + tizen_move_resize(struct ::wl_resource *resource); + tizen_move_resize(); + + virtual ~tizen_move_resize(); + + class Resource + { + public: + Resource() : tizen_move_resize_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_move_resize *tizen_move_resize_object; + tizen_move_resize *object() { return tizen_move_resize_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error_state { + error_state_none = 0, + error_state_invalid_buffer = 1, + error_state_not_supported = 2, + }; + + void send_geometry_done(struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t error_state); + void send_geometry_done(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t error_state); + + protected: + virtual Resource *tizen_move_resize_allocate(); + + virtual void tizen_move_resize_bind_resource(Resource *resource); + virtual void tizen_move_resize_destroy_resource(Resource *resource); + + virtual void tizen_move_resize_destroy(Resource *resource); + virtual void tizen_move_resize_set_geometry(Resource *resource, struct ::wl_resource *surface, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_move_resize_interface m_tizen_move_resize_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_geometry( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t serial, + int32_t x, + int32_t y, + int32_t w, + int32_t h); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_move_resize *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_gesture + { + public: + tizen_gesture(struct ::wl_client *client, int id, int version); + tizen_gesture(struct ::wl_display *display, int version); + tizen_gesture(struct ::wl_resource *resource); + tizen_gesture(); + + virtual ~tizen_gesture(); + + class Resource + { + public: + Resource() : tizen_gesture_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_gesture *tizen_gesture_object; + tizen_gesture *object() { return tizen_gesture_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_none = 0, + error_invalid_data = 1, + error_no_permission = 2, + error_no_system_resources = 3, + error_grabbed_already = 4, + error_not_supported = 5, + }; + + enum type { + type_edge_swipe = 1, + type_edge_drag = 2, + type_tap = 4, + type_palm_cover = 8, + type_pan = 16, + type_pinch = 32, + type_palm_swipe = 64, + }; + + enum mode { + mode_begin = 1, + mode_update = 2, + mode_end = 3, + mode_done = 4, + }; + + enum edge { + edge_top = 1, + edge_right = 2, + edge_bottom = 3, + edge_left = 4, + }; + + enum edge_size { + edge_size_none = 0, + edge_size_full = 1, + edge_size_partial = 2, + }; + + void send_grab_edge_swipe_notify(uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error); + void send_grab_edge_swipe_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error); + void send_edge_swipe(uint32_t mode, uint32_t fingers, int32_t sx, int32_t sy, uint32_t edge); + void send_edge_swipe(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, int32_t sx, int32_t sy, uint32_t edge); + void send_edge_drag_notify(uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error); + void send_edge_drag_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point, uint32_t error); + void send_edge_drag(uint32_t mode, uint32_t fingers, int32_t cx, int32_t cy, uint32_t edge); + void send_edge_drag(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, int32_t cx, int32_t cy, uint32_t edge); + void send_tap_notify(uint32_t fingers, uint32_t repeats, uint32_t error); + void send_tap_notify(struct ::wl_resource *resource, uint32_t fingers, uint32_t repeats, uint32_t error); + void send_tap(uint32_t mode, uint32_t fingers, uint32_t repeats); + void send_tap(struct ::wl_resource *resource, uint32_t mode, uint32_t fingers, uint32_t repeats); + void send_palm_cover_notify(struct ::wl_resource *surface, uint32_t error); + void send_palm_cover_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t error); + void send_palm_cover(struct ::wl_resource *surface, uint32_t mode, uint32_t duration, int32_t cx, int32_t cy, uint32_t size, wl_fixed_t pressure); + void send_palm_cover(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode, uint32_t duration, int32_t cx, int32_t cy, uint32_t size, wl_fixed_t pressure); + void send_activate_notify(struct ::wl_resource *surface, uint32_t type, uint32_t active, uint32_t error); + void send_activate_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type, uint32_t active, uint32_t error); + + protected: + virtual Resource *tizen_gesture_allocate(); + + virtual void tizen_gesture_bind_resource(Resource *resource); + virtual void tizen_gesture_destroy_resource(Resource *resource); + + virtual void tizen_gesture_grab_edge_swipe(Resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point); + virtual void tizen_gesture_ungrab_edge_swipe(Resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point); + virtual void tizen_gesture_grab_edge_drag(Resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point); + virtual void tizen_gesture_ungrab_edge_drag(Resource *resource, uint32_t fingers, uint32_t edge, uint32_t edge_size, uint32_t start_point, uint32_t end_point); + virtual void tizen_gesture_grab_tap(Resource *resource, uint32_t fingers, uint32_t repeats); + virtual void tizen_gesture_ungrab_tap(Resource *resource, uint32_t fingers, uint32_t repeats); + virtual void tizen_gesture_grab_palm_cover(Resource *resource); + virtual void tizen_gesture_ungrab_palm_cover(Resource *resource); + virtual void tizen_gesture_select_palm_cover(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_gesture_deselect_palm_cover(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_gesture_activate_set(Resource *resource, struct ::wl_resource *surface, uint32_t type, uint32_t active); + virtual void tizen_gesture_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_gesture_interface m_tizen_gesture_interface; + + static void handle_grab_edge_swipe( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t edge, + uint32_t edge_size, + uint32_t start_point, + uint32_t end_point); + static void handle_ungrab_edge_swipe( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t edge, + uint32_t edge_size, + uint32_t start_point, + uint32_t end_point); + static void handle_grab_edge_drag( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t edge, + uint32_t edge_size, + uint32_t start_point, + uint32_t end_point); + static void handle_ungrab_edge_drag( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t edge, + uint32_t edge_size, + uint32_t start_point, + uint32_t end_point); + static void handle_grab_tap( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t repeats); + static void handle_ungrab_tap( + ::wl_client *client, + struct wl_resource *resource, + uint32_t fingers, + uint32_t repeats); + static void handle_grab_palm_cover( + ::wl_client *client, + struct wl_resource *resource); + static void handle_ungrab_palm_cover( + ::wl_client *client, + struct wl_resource *resource); + static void handle_select_palm_cover( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_deselect_palm_cover( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_activate_set( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t type, + uint32_t active); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_gesture *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_keyrouter + { + public: + tizen_keyrouter(struct ::wl_client *client, int id, int version); + tizen_keyrouter(struct ::wl_display *display, int version); + tizen_keyrouter(struct ::wl_resource *resource); + tizen_keyrouter(); + + virtual ~tizen_keyrouter(); + + class Resource + { + public: + Resource() : tizen_keyrouter_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_keyrouter *tizen_keyrouter_object; + tizen_keyrouter *object() { return tizen_keyrouter_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_none = 0, // no error + error_invalid_surface = 1, // Given surface is invalid. + error_invalid_key = 2, // Given key is invalid. + error_invalid_mode = 3, // Given mode is invalid. + error_grabbed_already = 4, // The key has been grabbed already. + error_no_permission = 5, // The wl client has no permission to grab the key. + error_no_system_resources = 6, // System resources are insufficient. + error_invalid_array = 7, // Given array has invalid pairs or data type. + }; + + enum mode { + mode_none = 0, // none + mode_shared = 1, // mode to get a key grab with the other client surfaces when the focused client surface gets the key + mode_topmost = 2, // mode to get a key grab when the client surface is the top most surface + mode_overridable_exclusive = 3, // mode to get a key grab exclusively, overridably regardless of the order in the surface stack + mode_exclusive = 4, // mode to get a key grab exclusively regardless of the order in surface stack + mode_registered = 5, // mode to get a key grab only when a requesting surface is on top among the registering surfaces for the key + }; + + enum config_mode { + config_mode_none = 0, // none + config_mode_invisible_set = 1, // mode to set window to enable send event to invisible window below in stack + config_mode_invisible_get = 2, // mode to set window to get event to invisible state if any top window has set register_set + config_mode_num_key_focus = 3, // mode to register for num keys for focus window + config_mode_picture_off = 4, // mode to set picture off for particular key + }; + + void send_keygrab_notify(struct ::wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error); + void send_keygrab_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error); + void send_keygrab_notify_list(struct ::wl_resource *surface, const std::string &grab_result); + void send_keygrab_notify_list(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &grab_result); + void send_getgrab_notify_list(struct ::wl_resource *surface, const std::string &grab_result); + void send_getgrab_notify_list(struct ::wl_resource *resource, struct ::wl_resource *surface, const std::string &grab_result); + void send_set_register_none_key_notify(struct ::wl_resource *surface, uint32_t mode); + void send_set_register_none_key_notify(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t mode); + void send_keyregister_notify(uint32_t status); + void send_keyregister_notify(struct ::wl_resource *resource, uint32_t status); + void send_set_input_config_notify(uint32_t status); + void send_set_input_config_notify(struct ::wl_resource *resource, uint32_t status); + void send_key_cancel(uint32_t key); + void send_key_cancel(struct ::wl_resource *resource, uint32_t key); + void send_event_surface(struct ::wl_resource *surface, uint32_t key, uint32_t mode); + void send_event_surface(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode); + + protected: + virtual Resource *tizen_keyrouter_allocate(); + + virtual void tizen_keyrouter_bind_resource(Resource *resource); + virtual void tizen_keyrouter_destroy_resource(Resource *resource); + + virtual void tizen_keyrouter_set_keygrab(Resource *resource, struct ::wl_resource *surface, uint32_t key, uint32_t mode); + virtual void tizen_keyrouter_unset_keygrab(Resource *resource, struct ::wl_resource *surface, uint32_t key); + virtual void tizen_keyrouter_get_keygrab_status(Resource *resource, struct ::wl_resource *surface, uint32_t key); + virtual void tizen_keyrouter_set_keygrab_list(Resource *resource, struct ::wl_resource *surface, wl_array *grab_list); + virtual void tizen_keyrouter_unset_keygrab_list(Resource *resource, struct ::wl_resource *surface, wl_array *ungrab_list); + virtual void tizen_keyrouter_get_keygrab_list(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_keyrouter_set_register_none_key(Resource *resource, struct ::wl_resource *surface, uint32_t data); + virtual void tizen_keyrouter_get_keyregister_status(Resource *resource, uint32_t data); + virtual void tizen_keyrouter_set_input_config(Resource *resource, struct ::wl_resource *surface, uint32_t config_mode, uint32_t value); + virtual void tizen_keyrouter_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_keyrouter_interface m_tizen_keyrouter_interface; + + static void handle_set_keygrab( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t key, + uint32_t mode); + static void handle_unset_keygrab( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t key); + static void handle_get_keygrab_status( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t key); + static void handle_set_keygrab_list( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + wl_array *grab_list); + static void handle_unset_keygrab_list( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + wl_array *ungrab_list); + static void handle_get_keygrab_list( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_set_register_none_key( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t data); + static void handle_get_keyregister_status( + ::wl_client *client, + struct wl_resource *resource, + uint32_t data); + static void handle_set_input_config( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t config_mode, + uint32_t value); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_keyrouter *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_screenshooter + { + public: + tizen_screenshooter(struct ::wl_client *client, int id, int version); + tizen_screenshooter(struct ::wl_display *display, int version); + tizen_screenshooter(struct ::wl_resource *resource); + tizen_screenshooter(); + + virtual ~tizen_screenshooter(); + + class Resource + { + public: + Resource() : tizen_screenshooter_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_screenshooter *tizen_screenshooter_object; + tizen_screenshooter *object() { return tizen_screenshooter_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_format(uint32_t format); + void send_format(struct ::wl_resource *resource, uint32_t format); + void send_screenshooter_notify(uint32_t noti); + void send_screenshooter_notify(struct ::wl_resource *resource, uint32_t noti); + + protected: + virtual Resource *tizen_screenshooter_allocate(); + + virtual void tizen_screenshooter_bind_resource(Resource *resource); + virtual void tizen_screenshooter_destroy_resource(Resource *resource); + + virtual void tizen_screenshooter_get_screenmirror(Resource *resource, uint32_t id, struct ::wl_resource *output); + virtual void tizen_screenshooter_set_oneshot_auto_rotation(Resource *resource, uint32_t set); + virtual void tizen_screenshooter_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_screenshooter_interface m_tizen_screenshooter_interface; + + static void handle_get_screenmirror( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *output); + static void handle_set_oneshot_auto_rotation( + ::wl_client *client, + struct wl_resource *resource, + uint32_t set); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_screenshooter *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_screenmirror + { + public: + tizen_screenmirror(struct ::wl_client *client, int id, int version); + tizen_screenmirror(struct ::wl_display *display, int version); + tizen_screenmirror(struct ::wl_resource *resource); + tizen_screenmirror(); + + virtual ~tizen_screenmirror(); + + class Resource + { + public: + Resource() : tizen_screenmirror_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_screenmirror *tizen_screenmirror_object; + tizen_screenmirror *object() { return tizen_screenmirror_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum content { + content_normal = 0, + content_video = 1, + }; + + enum stretch { + stretch_keep_ratio = 0, + stretch_fully = 1, + }; + + void send_dequeued(struct ::wl_resource *buffer); + void send_dequeued(struct ::wl_resource *resource, struct ::wl_resource *buffer); + void send_content(uint32_t content); + void send_content(struct ::wl_resource *resource, uint32_t content); + void send_stop(); + void send_stop(struct ::wl_resource *resource); + + protected: + virtual Resource *tizen_screenmirror_allocate(); + + virtual void tizen_screenmirror_bind_resource(Resource *resource); + virtual void tizen_screenmirror_destroy_resource(Resource *resource); + + virtual void tizen_screenmirror_destroy(Resource *resource); + virtual void tizen_screenmirror_set_stretch(Resource *resource, uint32_t stretch); + virtual void tizen_screenmirror_queue(Resource *resource, struct ::wl_resource *buffer); + virtual void tizen_screenmirror_dequeue(Resource *resource, struct ::wl_resource *buffer); + virtual void tizen_screenmirror_start(Resource *resource); + virtual void tizen_screenmirror_stop(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_screenmirror_interface m_tizen_screenmirror_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_stretch( + ::wl_client *client, + struct wl_resource *resource, + uint32_t stretch); + static void handle_queue( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *buffer); + static void handle_dequeue( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *buffer); + static void handle_start( + ::wl_client *client, + struct wl_resource *resource); + static void handle_stop( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_screenmirror *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_video + { + public: + tizen_video(struct ::wl_client *client, int id, int version); + tizen_video(struct ::wl_display *display, int version); + tizen_video(struct ::wl_resource *resource); + tizen_video(); + + virtual ~tizen_video(); + + class Resource + { + public: + Resource() : tizen_video_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_video *tizen_video_object; + tizen_video *object() { return tizen_video_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_none = 0, + error_object_exists = 1, + error_viewport_exists = 2, + }; + + void send_format(uint32_t format); + void send_format(struct ::wl_resource *resource, uint32_t format); + + protected: + virtual Resource *tizen_video_allocate(); + + virtual void tizen_video_bind_resource(Resource *resource); + virtual void tizen_video_destroy_resource(Resource *resource); + + virtual void tizen_video_get_object(Resource *resource, uint32_t id, struct ::wl_resource *surface); + virtual void tizen_video_get_viewport(Resource *resource, uint32_t id, struct ::wl_resource *surface); + virtual void tizen_video_destroy(Resource *resource); + virtual void tizen_video_get_surface_provider(Resource *resource, uint32_t id, struct ::wl_resource *surface); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_video_interface m_tizen_video_interface; + + static void handle_get_object( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + static void handle_get_viewport( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_get_surface_provider( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_video *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_video_surface_provider + { + public: + tizen_video_surface_provider(struct ::wl_client *client, int id, int version); + tizen_video_surface_provider(struct ::wl_display *display, int version); + tizen_video_surface_provider(struct ::wl_resource *resource); + tizen_video_surface_provider(); + + virtual ~tizen_video_surface_provider(); + + class Resource + { + public: + Resource() : tizen_video_surface_provider_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_video_surface_provider *tizen_video_surface_provider_object; + tizen_video_surface_provider *object() { return tizen_video_surface_provider_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_sync_done(uint32_t serial); + void send_sync_done(struct ::wl_resource *resource, uint32_t serial); + + protected: + virtual Resource *tizen_video_surface_provider_allocate(); + + virtual void tizen_video_surface_provider_bind_resource(Resource *resource); + virtual void tizen_video_surface_provider_destroy_resource(Resource *resource); + + virtual void tizen_video_surface_provider_destroy(Resource *resource); + virtual void tizen_video_surface_provider_set_sync_serial(Resource *resource, uint32_t serial); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_video_surface_provider_interface m_tizen_video_surface_provider_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_sync_serial( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_video_surface_provider *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_video_object + { + public: + tizen_video_object(struct ::wl_client *client, int id, int version); + tizen_video_object(struct ::wl_display *display, int version); + tizen_video_object(struct ::wl_resource *resource); + tizen_video_object(); + + virtual ~tizen_video_object(); + + class Resource + { + public: + Resource() : tizen_video_object_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_video_object *tizen_video_object_object; + tizen_video_object *object() { return tizen_video_object_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_attribute(const std::string &name, uint32_t value); + void send_attribute(struct ::wl_resource *resource, const std::string &name, uint32_t value); + void send_size(int32_t min_w, int32_t min_h, int32_t max_w, int32_t max_h, int32_t prefer_align); + void send_size(struct ::wl_resource *resource, int32_t min_w, int32_t min_h, int32_t max_w, int32_t max_h, int32_t prefer_align); + + protected: + virtual Resource *tizen_video_object_allocate(); + + virtual void tizen_video_object_bind_resource(Resource *resource); + virtual void tizen_video_object_destroy_resource(Resource *resource); + + virtual void tizen_video_object_destroy(Resource *resource); + virtual void tizen_video_object_set_attribute(Resource *resource, const std::string &name, int32_t value); + virtual void tizen_video_object_follow_topmost_visibility(Resource *resource); + virtual void tizen_video_object_unfollow_topmost_visibility(Resource *resource); + virtual void tizen_video_object_allowed_attribute(Resource *resource); + virtual void tizen_video_object_disallowed_attribute(Resource *resource); + virtual void tizen_video_object_set_sync_serial(Resource *resource, uint32_t serial); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_video_object_interface m_tizen_video_object_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_attribute( + ::wl_client *client, + struct wl_resource *resource, + const char *name, + int32_t value); + static void handle_follow_topmost_visibility( + ::wl_client *client, + struct wl_resource *resource); + static void handle_unfollow_topmost_visibility( + ::wl_client *client, + struct wl_resource *resource); + static void handle_allowed_attribute( + ::wl_client *client, + struct wl_resource *resource); + static void handle_disallowed_attribute( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_sync_serial( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_video_object *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_subsurface_watcher + { + public: + tizen_subsurface_watcher(struct ::wl_client *client, int id, int version); + tizen_subsurface_watcher(struct ::wl_display *display, int version); + tizen_subsurface_watcher(struct ::wl_resource *resource); + tizen_subsurface_watcher(); + + virtual ~tizen_subsurface_watcher(); + + class Resource + { + public: + Resource() : tizen_subsurface_watcher_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_subsurface_watcher *tizen_subsurface_watcher_object; + tizen_subsurface_watcher *object() { return tizen_subsurface_watcher_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum msg { + msg_success = 0, + msg_parent_id_invalid = 1, + msg_parent_id_destroyed = 2, + }; + + void send_message(uint32_t value); + void send_message(struct ::wl_resource *resource, uint32_t value); + + protected: + virtual Resource *tizen_subsurface_watcher_allocate(); + + virtual void tizen_subsurface_watcher_bind_resource(Resource *resource); + virtual void tizen_subsurface_watcher_destroy_resource(Resource *resource); + + virtual void tizen_subsurface_watcher_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_subsurface_watcher_interface m_tizen_subsurface_watcher_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_subsurface_watcher *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_viewport + { + public: + tizen_viewport(struct ::wl_client *client, int id, int version); + tizen_viewport(struct ::wl_display *display, int version); + tizen_viewport(struct ::wl_resource *resource); + tizen_viewport(); + + virtual ~tizen_viewport(); + + class Resource + { + public: + Resource() : tizen_viewport_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_viewport *tizen_viewport_object; + tizen_viewport *object() { return tizen_viewport_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_destination_changed(uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height); + void send_destination_changed(struct ::wl_resource *resource, uint32_t transform, int32_t x, int32_t y, uint32_t width, uint32_t height); + void send_parent_size(uint32_t width, uint32_t height); + void send_parent_size(struct ::wl_resource *resource, uint32_t width, uint32_t height); + + protected: + virtual Resource *tizen_viewport_allocate(); + + virtual void tizen_viewport_bind_resource(Resource *resource); + virtual void tizen_viewport_destroy_resource(Resource *resource); + + virtual void tizen_viewport_destroy(Resource *resource); + virtual void tizen_viewport_set_transform(Resource *resource, uint32_t transform); + virtual void tizen_viewport_set_source(Resource *resource, uint32_t x, uint32_t y, uint32_t width, uint32_t height); + virtual void tizen_viewport_set_destination(Resource *resource, int32_t x, int32_t y, uint32_t width, uint32_t height); + virtual void tizen_viewport_set_destination_ratio(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height); + virtual void tizen_viewport_get_destination_mode(Resource *resource, uint32_t id); + virtual void tizen_viewport_query_parent_size(Resource *resource); + virtual void tizen_viewport_follow_parent_transform(Resource *resource); + virtual void tizen_viewport_unfollow_parent_transform(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_viewport_interface m_tizen_viewport_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_transform( + ::wl_client *client, + struct wl_resource *resource, + uint32_t transform); + static void handle_set_source( + ::wl_client *client, + struct wl_resource *resource, + uint32_t x, + uint32_t y, + uint32_t width, + uint32_t height); + static void handle_set_destination( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + uint32_t width, + uint32_t height); + static void handle_set_destination_ratio( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t x, + wl_fixed_t y, + wl_fixed_t width, + wl_fixed_t height); + static void handle_get_destination_mode( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_query_parent_size( + ::wl_client *client, + struct wl_resource *resource); + static void handle_follow_parent_transform( + ::wl_client *client, + struct wl_resource *resource); + static void handle_unfollow_parent_transform( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_viewport *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_destination_mode + { + public: + tizen_destination_mode(struct ::wl_client *client, int id, int version); + tizen_destination_mode(struct ::wl_display *display, int version); + tizen_destination_mode(struct ::wl_resource *resource); + tizen_destination_mode(); + + virtual ~tizen_destination_mode(); + + class Resource + { + public: + Resource() : tizen_destination_mode_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_destination_mode *tizen_destination_mode_object; + tizen_destination_mode *object() { return tizen_destination_mode_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_invalid_type = 0, + }; + + enum type { + type_none = 0, + type_letter_box = 1, + type_origin = 2, + type_full = 3, + type_cropped_full = 4, + type_origin_or_letter = 5, + }; + + protected: + virtual Resource *tizen_destination_mode_allocate(); + + virtual void tizen_destination_mode_bind_resource(Resource *resource); + virtual void tizen_destination_mode_destroy_resource(Resource *resource); + + virtual void tizen_destination_mode_destroy(Resource *resource); + virtual void tizen_destination_mode_follow_parent_transform(Resource *resource); + virtual void tizen_destination_mode_unfollow_parent_transform(Resource *resource); + virtual void tizen_destination_mode_set(Resource *resource, uint32_t mode); + virtual void tizen_destination_mode_set_ratio(Resource *resource, wl_fixed_t horizontal, wl_fixed_t vertical); + virtual void tizen_destination_mode_set_scale(Resource *resource, wl_fixed_t horizontal, wl_fixed_t vertical); + virtual void tizen_destination_mode_set_align(Resource *resource, wl_fixed_t horizontal, wl_fixed_t vertical); + virtual void tizen_destination_mode_set_offset(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_destination_mode_interface m_tizen_destination_mode_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_follow_parent_transform( + ::wl_client *client, + struct wl_resource *resource); + static void handle_unfollow_parent_transform( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set( + ::wl_client *client, + struct wl_resource *resource, + uint32_t mode); + static void handle_set_ratio( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t horizontal, + wl_fixed_t vertical); + static void handle_set_scale( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t horizontal, + wl_fixed_t vertical); + static void handle_set_align( + ::wl_client *client, + struct wl_resource *resource, + wl_fixed_t horizontal, + wl_fixed_t vertical); + static void handle_set_offset( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t w, + int32_t h); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_destination_mode *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_embedded_compositor + { + public: + tizen_embedded_compositor(struct ::wl_client *client, int id, int version); + tizen_embedded_compositor(struct ::wl_display *display, int version); + tizen_embedded_compositor(struct ::wl_resource *resource); + tizen_embedded_compositor(); + + virtual ~tizen_embedded_compositor(); + + class Resource + { + public: + Resource() : tizen_embedded_compositor_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_embedded_compositor *tizen_embedded_compositor_object; + tizen_embedded_compositor *object() { return tizen_embedded_compositor_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_socket(int32_t sock_fd); + void send_socket(struct ::wl_resource *resource, int32_t sock_fd); + + protected: + virtual Resource *tizen_embedded_compositor_allocate(); + + virtual void tizen_embedded_compositor_bind_resource(Resource *resource); + virtual void tizen_embedded_compositor_destroy_resource(Resource *resource); + + virtual void tizen_embedded_compositor_get_socket(Resource *resource); + virtual void tizen_embedded_compositor_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_embedded_compositor_interface m_tizen_embedded_compositor_interface; + + static void handle_get_socket( + ::wl_client *client, + struct wl_resource *resource); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_embedded_compositor *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_input_device_manager + { + public: + tizen_input_device_manager(struct ::wl_client *client, int id, int version); + tizen_input_device_manager(struct ::wl_display *display, int version); + tizen_input_device_manager(struct ::wl_resource *resource); + tizen_input_device_manager(); + + virtual ~tizen_input_device_manager(); + + class Resource + { + public: + Resource() : tizen_input_device_manager_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_input_device_manager *tizen_input_device_manager_object; + tizen_input_device_manager *object() { return tizen_input_device_manager_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum clas { + clas_none = 0, // none of class + clas_mouse = 1, // mouse class + clas_keyboard = 2, // keyboard class + clas_touchscreen = 4, // touchscreen class + }; + + enum error { + error_none = 0, // no error + error_no_permission = 1, // no permission + error_invalid_class = 2, // invalid class + error_blocked_already = 3, // blocked already by the other client + error_no_system_resources = 4, // no system resources such as memory lack + error_invalid_parameter = 5, // argument is invalid + error_invalid_surface = 6, // the given surface is not visible or pointer is not on the given surface + error_no_pointer_available = 7, // there is no pointer available to warp + }; + + enum pointer_event_type { + pointer_event_type_begin = 0, + pointer_event_type_update = 1, + pointer_event_type_end = 2, + }; + + enum axis_type { + axis_type_none = 0, // no axis type + axis_type_wheel = 1, // pointer vertical wheel axis + axis_type_hwheel = 2, // pointer horizental wheel axis + axis_type_radius_x = 3, // touch radius of x axis of an event area e.g. touching area with a finger or a pen + axis_type_radius_y = 4, // touch radius of y axis of an event area e.g. touching area with a finger or a pen + axis_type_pressure = 5, // touch pressure in an event area e.g. touching area with a finger or a pen + axis_type_angle = 6, // touch angle in an event area e.g. touching area with a finger or a pen + axis_type_palm = 7, // touch palm in an event area e.g. touching area with a finger or a pen + }; + + void send_device_add(uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat); + void send_device_add(struct ::wl_resource *resource, uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat); + void send_device_remove(uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat); + void send_device_remove(struct ::wl_resource *resource, uint32_t serial, const std::string &identifier, struct ::wl_resource *device, struct ::wl_resource *seat); + void send_error(uint32_t errorcode); + void send_error(struct ::wl_resource *resource, uint32_t errorcode); + void send_block_expired(); + void send_block_expired(struct ::wl_resource *resource); + + protected: + virtual Resource *tizen_input_device_manager_allocate(); + + virtual void tizen_input_device_manager_bind_resource(Resource *resource); + virtual void tizen_input_device_manager_destroy_resource(Resource *resource); + + virtual void tizen_input_device_manager_block_events(Resource *resource, uint32_t serial, uint32_t clas, uint32_t duration); + virtual void tizen_input_device_manager_unblock_events(Resource *resource, uint32_t serial); + virtual void tizen_input_device_manager_init_generator(Resource *resource, uint32_t clas); + virtual void tizen_input_device_manager_deinit_generator(Resource *resource, uint32_t clas); + virtual void tizen_input_device_manager_generate_key(Resource *resource, const std::string &keyname, uint32_t pressed); + virtual void tizen_input_device_manager_generate_pointer(Resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t button); + virtual void tizen_input_device_manager_generate_touch(Resource *resource, uint32_t type, uint32_t x, uint32_t y, uint32_t finger); + virtual void tizen_input_device_manager_pointer_warp(Resource *resource, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y); + virtual void tizen_input_device_manager_init_generator_with_name(Resource *resource, uint32_t clas, const std::string &name); + virtual void tizen_input_device_manager_destroy(Resource *resource); + virtual void tizen_input_device_manager_generate_axis(Resource *resource, uint32_t type, wl_fixed_t value); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_input_device_manager_interface m_tizen_input_device_manager_interface; + + static void handle_block_events( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + uint32_t clas, + uint32_t duration); + static void handle_unblock_events( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial); + static void handle_init_generator( + ::wl_client *client, + struct wl_resource *resource, + uint32_t clas); + static void handle_deinit_generator( + ::wl_client *client, + struct wl_resource *resource, + uint32_t clas); + static void handle_generate_key( + ::wl_client *client, + struct wl_resource *resource, + const char *keyname, + uint32_t pressed); + static void handle_generate_pointer( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type, + uint32_t x, + uint32_t y, + uint32_t button); + static void handle_generate_touch( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type, + uint32_t x, + uint32_t y, + uint32_t finger); + static void handle_pointer_warp( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + wl_fixed_t x, + wl_fixed_t y); + static void handle_init_generator_with_name( + ::wl_client *client, + struct wl_resource *resource, + uint32_t clas, + const char *name); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_generate_axis( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type, + wl_fixed_t value); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_input_device_manager *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_input_device + { + public: + tizen_input_device(struct ::wl_client *client, int id, int version); + tizen_input_device(struct ::wl_display *display, int version); + tizen_input_device(struct ::wl_resource *resource); + tizen_input_device(); + + virtual ~tizen_input_device(); + + class Resource + { + public: + Resource() : tizen_input_device_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_input_device *tizen_input_device_object; + tizen_input_device *object() { return tizen_input_device_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum clas { + clas_none = 0, // none of class + clas_keyboard = 2, // keyboard class + clas_mouse = 3, // mouse class + clas_touchscreen = 4, // touchscreen class + }; + + enum subclas { + subclas_none = 0, // none of subclass + }; + + enum axis_type { + axis_type_none = 0, // radius of x axis of an event area e.g. touching area with a finger or a pen + axis_type_radius_x = 1, // radius of x axis of an event area e.g. touching area with a finger or a pen + axis_type_radius_y = 2, // radius of y axis of an event area e.g. touching area with a finger or a pen + axis_type_pressure = 3, // pressure in an event area e.g. touching area with a finger or a pen + axis_type_angle = 4, // angle in an event area e.g. touching area with a finger or a pen + axis_type_detent = 5, // detent value e.g. moved distance with a rotary device + }; + + void send_device_info(const std::string &name, uint32_t clas, uint32_t subclas, const std::string &axes); + void send_device_info(struct ::wl_resource *resource, const std::string &name, uint32_t clas, uint32_t subclas, const std::string &axes); + void send_event_device(uint32_t serial, const std::string &name, uint32_t time); + void send_event_device(struct ::wl_resource *resource, uint32_t serial, const std::string &name, uint32_t time); + void send_axis(uint32_t axis_type, wl_fixed_t value); + void send_axis(struct ::wl_resource *resource, uint32_t axis_type, wl_fixed_t value); + + protected: + virtual Resource *tizen_input_device_allocate(); + + virtual void tizen_input_device_bind_resource(Resource *resource); + virtual void tizen_input_device_destroy_resource(Resource *resource); + + virtual void tizen_input_device_select_axes(Resource *resource, wl_array *axes); + virtual void tizen_input_device_release(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_input_device_interface m_tizen_input_device_interface; + + static void handle_select_axes( + ::wl_client *client, + struct wl_resource *resource, + wl_array *axes); + static void handle_release( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_input_device *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_launchscreen + { + public: + tizen_launchscreen(struct ::wl_client *client, int id, int version); + tizen_launchscreen(struct ::wl_display *display, int version); + tizen_launchscreen(struct ::wl_resource *resource); + tizen_launchscreen(); + + virtual ~tizen_launchscreen(); + + class Resource + { + public: + Resource() : tizen_launchscreen_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_launchscreen *tizen_launchscreen_object; + tizen_launchscreen *object() { return tizen_launchscreen_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *tizen_launchscreen_allocate(); + + virtual void tizen_launchscreen_bind_resource(Resource *resource); + virtual void tizen_launchscreen_destroy_resource(Resource *resource); + + virtual void tizen_launchscreen_create_img(Resource *resource, uint32_t id); + virtual void tizen_launchscreen_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_launchscreen_interface m_tizen_launchscreen_interface; + + static void handle_create_img( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_launchscreen *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_launch_image + { + public: + tizen_launch_image(struct ::wl_client *client, int id, int version); + tizen_launch_image(struct ::wl_display *display, int version); + tizen_launch_image(struct ::wl_resource *resource); + tizen_launch_image(); + + virtual ~tizen_launch_image(); + + class Resource + { + public: + Resource() : tizen_launch_image_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_launch_image *tizen_launch_image_object; + tizen_launch_image *object() { return tizen_launch_image_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum file_type { + file_type_img = 0, // splash image file path + file_type_edj = 1, // splash edj file path + }; + + enum indicator { + indicator_off = 0, // splash hide indicator + indicator_on = 1, // splash show indicator + }; + + enum rotation { + rotation_0 = 0, // rotation angle 0 degree + rotation_90 = 90, // rotation angle 90 degree + rotation_180 = 180, // rotation angle 180 degree + rotation_270 = 270, // rotation angle 270 degree + }; + + protected: + virtual Resource *tizen_launch_image_allocate(); + + virtual void tizen_launch_image_bind_resource(Resource *resource); + virtual void tizen_launch_image_destroy_resource(Resource *resource); + + virtual void tizen_launch_image_destroy(Resource *resource); + virtual void tizen_launch_image_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, wl_array *options); + virtual void tizen_launch_image_owner(Resource *resource, uint32_t pid); + virtual void tizen_launch_image_show(Resource *resource); + virtual void tizen_launch_image_hide(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_launch_image_interface m_tizen_launch_image_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_launch( + ::wl_client *client, + struct wl_resource *resource, + const char *file, + uint32_t file_type, + uint32_t color_depth, + uint32_t rotation, + uint32_t indicator, + wl_array *options); + static void handle_owner( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid); + static void handle_show( + ::wl_client *client, + struct wl_resource *resource); + static void handle_hide( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_launch_image *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_effect + { + public: + tizen_effect(struct ::wl_client *client, int id, int version); + tizen_effect(struct ::wl_display *display, int version); + tizen_effect(struct ::wl_resource *resource); + tizen_effect(); + + virtual ~tizen_effect(); + + class Resource + { + public: + Resource() : tizen_effect_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_effect *tizen_effect_object; + tizen_effect *object() { return tizen_effect_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum type { + type_none = 0, // none + type_show = 1, // show effect of window + type_hide = 2, // hide effect of window + type_restack = 3, // restack effect of window + }; + + void send_start(struct ::wl_resource *surface, uint32_t type); + void send_start(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type); + void send_end(struct ::wl_resource *surface, uint32_t type); + void send_end(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t type); + + protected: + virtual Resource *tizen_effect_allocate(); + + virtual void tizen_effect_bind_resource(Resource *resource); + virtual void tizen_effect_destroy_resource(Resource *resource); + + virtual void tizen_effect_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_effect_interface m_tizen_effect_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_effect *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_display_policy + { + public: + tizen_display_policy(struct ::wl_client *client, int id, int version); + tizen_display_policy(struct ::wl_display *display, int version); + tizen_display_policy(struct ::wl_resource *resource); + tizen_display_policy(); + + virtual ~tizen_display_policy(); + + class Resource + { + public: + Resource() : tizen_display_policy_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_display_policy *tizen_display_policy_object; + tizen_display_policy *object() { return tizen_display_policy_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error_state { + error_state_none = 0, + error_state_permission_denied = 1, + }; + + void send_window_brightness_done(struct ::wl_resource *surface, int32_t brightness, uint32_t error_state); + void send_window_brightness_done(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t brightness, uint32_t error_state); + + protected: + virtual Resource *tizen_display_policy_allocate(); + + virtual void tizen_display_policy_bind_resource(Resource *resource); + virtual void tizen_display_policy_destroy_resource(Resource *resource); + + virtual void tizen_display_policy_set_window_brightness(Resource *resource, struct ::wl_resource *surface, int32_t brightness); + virtual void tizen_display_policy_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_display_policy_interface m_tizen_display_policy_interface; + + static void handle_set_window_brightness( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t brightness); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_display_policy *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_indicator + { + public: + tizen_indicator(struct ::wl_client *client, int id, int version); + tizen_indicator(struct ::wl_display *display, int version); + tizen_indicator(struct ::wl_resource *resource); + tizen_indicator(); + + virtual ~tizen_indicator(); + + class Resource + { + public: + Resource() : tizen_indicator_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_indicator *tizen_indicator_object; + tizen_indicator *object() { return tizen_indicator_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum state { + state_unknown = 0, // unknown + state_off = 1, // can not show indicator + state_on = 2, // can show indicator + }; + + enum opacity_mode { + opacity_mode_unknown = 0, // unknown + opacity_mode_opaque = 1, // opaque mode + opacity_mode_translucent = 2, // translucent mode + opacity_mode_transparent = 3, // transparent all mode + opacity_mode_bg_transparent = 4, // transparent only background mode + }; + + enum visible_type { + visible_type_hidden = 0, // hidden type indicator + visible_type_shown = 1, // shown type indicator + }; + + void send_flick(struct ::wl_resource *surface, int32_t type); + void send_flick(struct ::wl_resource *resource, struct ::wl_resource *surface, int32_t type); + + protected: + virtual Resource *tizen_indicator_allocate(); + + virtual void tizen_indicator_bind_resource(Resource *resource); + virtual void tizen_indicator_destroy_resource(Resource *resource); + + virtual void tizen_indicator_destroy(Resource *resource); + virtual void tizen_indicator_set_state(Resource *resource, struct ::wl_resource *surface, int32_t state); + virtual void tizen_indicator_set_opacity_mode(Resource *resource, struct ::wl_resource *surface, int32_t mode); + virtual void tizen_indicator_set_visible_type(Resource *resource, struct ::wl_resource *surface, int32_t type); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_indicator_interface m_tizen_indicator_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_state( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t state); + static void handle_set_opacity_mode( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t mode); + static void handle_set_visible_type( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + int32_t type); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_indicator *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_clipboard + { + public: + tizen_clipboard(struct ::wl_client *client, int id, int version); + tizen_clipboard(struct ::wl_display *display, int version); + tizen_clipboard(struct ::wl_resource *resource); + tizen_clipboard(); + + virtual ~tizen_clipboard(); + + class Resource + { + public: + Resource() : tizen_clipboard_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_clipboard *tizen_clipboard_object; + tizen_clipboard *object() { return tizen_clipboard_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_data_selected(struct ::wl_resource *surface); + void send_data_selected(struct ::wl_resource *resource, struct ::wl_resource *surface); + void send_allowed_data_only(uint32_t allowed); + void send_allowed_data_only(struct ::wl_resource *resource, uint32_t allowed); + + protected: + virtual Resource *tizen_clipboard_allocate(); + + virtual void tizen_clipboard_bind_resource(Resource *resource); + virtual void tizen_clipboard_destroy_resource(Resource *resource); + + virtual void tizen_clipboard_destroy(Resource *resource); + virtual void tizen_clipboard_show(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_clipboard_hide(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_clipboard_set_data_only(Resource *resource, uint32_t set); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_clipboard_interface m_tizen_clipboard_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_show( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_hide( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_set_data_only( + ::wl_client *client, + struct wl_resource *resource, + uint32_t set); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_clipboard *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_screen_rotation + { + public: + tizen_screen_rotation(struct ::wl_client *client, int id, int version); + tizen_screen_rotation(struct ::wl_display *display, int version); + tizen_screen_rotation(struct ::wl_resource *resource); + tizen_screen_rotation(); + + virtual ~tizen_screen_rotation(); + + class Resource + { + public: + Resource() : tizen_screen_rotation_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_screen_rotation *tizen_screen_rotation_object; + tizen_screen_rotation *object() { return tizen_screen_rotation_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_ignore_output_transform(struct ::wl_resource *surface, uint32_t ignore); + void send_ignore_output_transform(struct ::wl_resource *resource, struct ::wl_resource *surface, uint32_t ignore); + + protected: + virtual Resource *tizen_screen_rotation_allocate(); + + virtual void tizen_screen_rotation_bind_resource(Resource *resource); + virtual void tizen_screen_rotation_destroy_resource(Resource *resource); + + virtual void tizen_screen_rotation_get_ignore_output_transform(Resource *resource, struct ::wl_resource *surface); + virtual void tizen_screen_rotation_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_screen_rotation_interface m_tizen_screen_rotation_interface; + + static void handle_get_ignore_output_transform( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_screen_rotation *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-tizen-hwc.cpp b/src/DSWaylandServer/dswayland-server-tizen-hwc.cpp new file mode 100644 index 0000000..ed6485c --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-hwc.cpp @@ -0,0 +1,399 @@ +/* Protocol XML file : wayland-extension/tizen-hwc.xml */ + +#include "dswayland-server-tizen-hwc.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + tizen_hwc::tizen_hwc(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_hwc::tizen_hwc(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_hwc::tizen_hwc(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_hwc::tizen_hwc() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_hwc::~tizen_hwc() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_hwc::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_hwc::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_hwc::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_hwc::Resource *tizen_hwc::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_hwc::Resource *tizen_hwc::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_hwc::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_hwc_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_hwc::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_hwc::interface() + { + return &::tizen_hwc_interface; + } + + tizen_hwc::Resource *tizen_hwc::tizen_hwc_allocate() + { + return new Resource; + } + + void tizen_hwc::tizen_hwc_bind_resource(Resource *) + { + } + + void tizen_hwc::tizen_hwc_destroy_resource(Resource *) + { + } + + void tizen_hwc::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_hwc *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_hwc::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_hwc *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_hwc::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_hwc *that = resource->tizen_hwc_object; + that->m_resource_map.erase(resource->client()); + that->tizen_hwc_destroy_resource(resource); + delete resource; + } + + tizen_hwc::Resource *tizen_hwc::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_hwc_interface, version, id); + return bind(handle); + } + + tizen_hwc::Resource *tizen_hwc::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_hwc_allocate(); + resource->tizen_hwc_object = this; + + wl_resource_set_implementation(handle, &m_tizen_hwc_interface, resource, destroy_func); + resource->handle = handle; + tizen_hwc_bind_resource(resource); + return resource; + } + tizen_hwc::Resource *tizen_hwc::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_hwc_interface, &m_tizen_hwc_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_hwc_interface tizen_hwc::m_tizen_hwc_interface = { + tizen_hwc::handle_destroy, + tizen_hwc::handle_commit_feedback + }; + + void tizen_hwc::tizen_hwc_destroy(Resource *) + { + } + + void tizen_hwc::tizen_hwc_commit_feedback(Resource *, struct ::wl_resource *, uint32_t, uint32_t ) + { + } + + + void tizen_hwc::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_hwc_object)->tizen_hwc_destroy( + r); + } + + void tizen_hwc::handle_commit_feedback( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t id, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_hwc_object)->tizen_hwc_commit_feedback( + r, + surface, + id, + serial); + } + + tizen_hwc_commit_feedback::tizen_hwc_commit_feedback(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_hwc_commit_feedback::tizen_hwc_commit_feedback(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_hwc_commit_feedback::tizen_hwc_commit_feedback(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_hwc_commit_feedback::tizen_hwc_commit_feedback() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_hwc_commit_feedback::~tizen_hwc_commit_feedback() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_hwc_commit_feedback::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_hwc_commit_feedback::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_hwc_commit_feedback::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_hwc_commit_feedback::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_hwc_commit_feedback_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_hwc_commit_feedback::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_hwc_commit_feedback::interface() + { + return &::tizen_hwc_commit_feedback_interface; + } + + tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::tizen_hwc_commit_feedback_allocate() + { + return new Resource; + } + + void tizen_hwc_commit_feedback::tizen_hwc_commit_feedback_bind_resource(Resource *) + { + } + + void tizen_hwc_commit_feedback::tizen_hwc_commit_feedback_destroy_resource(Resource *) + { + } + + void tizen_hwc_commit_feedback::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_hwc_commit_feedback *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_hwc_commit_feedback::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_hwc_commit_feedback *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_hwc_commit_feedback::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_hwc_commit_feedback *that = resource->tizen_hwc_commit_feedback_object; + that->m_resource_map.erase(resource->client()); + that->tizen_hwc_commit_feedback_destroy_resource(resource); + delete resource; + } + + tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_hwc_commit_feedback_interface, version, id); + return bind(handle); + } + + tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_hwc_commit_feedback_allocate(); + resource->tizen_hwc_commit_feedback_object = this; + + wl_resource_set_implementation(handle, NULL, resource, destroy_func); + resource->handle = handle; + tizen_hwc_commit_feedback_bind_resource(resource); + return resource; + } + tizen_hwc_commit_feedback::Resource *tizen_hwc_commit_feedback::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_hwc_commit_feedback_interface, NULL)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + void tizen_hwc_commit_feedback::send_committed(uint32_t serial) + { + DS_ASSERT_X(m_resource, "tizen_hwc_commit_feedback::committed", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_hwc_commit_feedback::committed as it's not initialised"); + return; + } + send_committed( + m_resource->handle, + serial); + } + + void tizen_hwc_commit_feedback::send_committed(struct ::wl_resource *resource, uint32_t serial) + { + tizen_hwc_commit_feedback_send_committed( + resource, + serial); + } + + + void tizen_hwc_commit_feedback::send_discarded(uint32_t serial) + { + DS_ASSERT_X(m_resource, "tizen_hwc_commit_feedback::discarded", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_hwc_commit_feedback::discarded as it's not initialised"); + return; + } + send_discarded( + m_resource->handle, + serial); + } + + void tizen_hwc_commit_feedback::send_discarded(struct ::wl_resource *resource, uint32_t serial) + { + tizen_hwc_commit_feedback_send_discarded( + resource, + serial); + } + +} + diff --git a/src/DSWaylandServer/dswayland-server-tizen-hwc.h b/src/DSWaylandServer/dswayland-server-tizen-hwc.h new file mode 100644 index 0000000..0f7d73f --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-hwc.h @@ -0,0 +1,188 @@ +/* Protocol XML file : wayland-extension/tizen-hwc.xml */ + +#ifndef __DS_TIZEN_HWC_PROTOCOL_H__ +#define __DS_TIZEN_HWC_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "tizen-hwc-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class tizen_hwc + { + public: + tizen_hwc(struct ::wl_client *client, int id, int version); + tizen_hwc(struct ::wl_display *display, int version); + tizen_hwc(struct ::wl_resource *resource); + tizen_hwc(); + + virtual ~tizen_hwc(); + + class Resource + { + public: + Resource() : tizen_hwc_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_hwc *tizen_hwc_object; + tizen_hwc *object() { return tizen_hwc_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *tizen_hwc_allocate(); + + virtual void tizen_hwc_bind_resource(Resource *resource); + virtual void tizen_hwc_destroy_resource(Resource *resource); + + virtual void tizen_hwc_destroy(Resource *resource); + virtual void tizen_hwc_commit_feedback(Resource *resource, struct ::wl_resource *surface, uint32_t id, uint32_t serial); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_hwc_interface m_tizen_hwc_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_commit_feedback( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + uint32_t id, + uint32_t serial); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_hwc *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_hwc_commit_feedback + { + public: + tizen_hwc_commit_feedback(struct ::wl_client *client, int id, int version); + tizen_hwc_commit_feedback(struct ::wl_display *display, int version); + tizen_hwc_commit_feedback(struct ::wl_resource *resource); + tizen_hwc_commit_feedback(); + + virtual ~tizen_hwc_commit_feedback(); + + class Resource + { + public: + Resource() : tizen_hwc_commit_feedback_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_hwc_commit_feedback *tizen_hwc_commit_feedback_object; + tizen_hwc_commit_feedback *object() { return tizen_hwc_commit_feedback_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_committed(uint32_t serial); + void send_committed(struct ::wl_resource *resource, uint32_t serial); + void send_discarded(uint32_t serial); + void send_discarded(struct ::wl_resource *resource, uint32_t serial); + + protected: + virtual Resource *tizen_hwc_commit_feedback_allocate(); + + virtual void tizen_hwc_commit_feedback_bind_resource(Resource *resource); + virtual void tizen_hwc_commit_feedback_destroy_resource(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_hwc_commit_feedback *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-tizen-launch.cpp b/src/DSWaylandServer/dswayland-server-tizen-launch.cpp new file mode 100644 index 0000000..9cd999c --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-launch.cpp @@ -0,0 +1,823 @@ +/* Protocol XML file : wayland-extension/tizen-launch.xml */ + +#include "dswayland-server-tizen-launch.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + tizen_launch_effect::tizen_launch_effect(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_launch_effect::tizen_launch_effect(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_launch_effect::tizen_launch_effect(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_launch_effect::tizen_launch_effect() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_launch_effect::~tizen_launch_effect() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_launch_effect::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_launch_effect::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_launch_effect::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_launch_effect::Resource *tizen_launch_effect::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_launch_effect::Resource *tizen_launch_effect::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_launch_effect::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_launch_effect_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_launch_effect::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_launch_effect::interface() + { + return &::tizen_launch_effect_interface; + } + + tizen_launch_effect::Resource *tizen_launch_effect::tizen_launch_effect_allocate() + { + return new Resource; + } + + void tizen_launch_effect::tizen_launch_effect_bind_resource(Resource *) + { + } + + void tizen_launch_effect::tizen_launch_effect_destroy_resource(Resource *) + { + } + + void tizen_launch_effect::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_launch_effect *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_launch_effect::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_launch_effect *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_launch_effect::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_launch_effect *that = resource->tizen_launch_effect_object; + that->m_resource_map.erase(resource->client()); + that->tizen_launch_effect_destroy_resource(resource); + delete resource; + } + + tizen_launch_effect::Resource *tizen_launch_effect::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launch_effect_interface, version, id); + return bind(handle); + } + + tizen_launch_effect::Resource *tizen_launch_effect::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_launch_effect_allocate(); + resource->tizen_launch_effect_object = this; + + wl_resource_set_implementation(handle, &m_tizen_launch_effect_interface, resource, destroy_func); + resource->handle = handle; + tizen_launch_effect_bind_resource(resource); + return resource; + } + tizen_launch_effect::Resource *tizen_launch_effect::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_launch_effect_interface, &m_tizen_launch_effect_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_launch_effect_interface tizen_launch_effect::m_tizen_launch_effect_interface = { + tizen_launch_effect::handle_create_splash_img, + tizen_launch_effect::handle_type_set, + tizen_launch_effect::handle_type_unset, + tizen_launch_effect::handle_destroy + }; + + void tizen_launch_effect::tizen_launch_effect_create_splash_img(Resource *, uint32_t) + { + } + + void tizen_launch_effect::tizen_launch_effect_type_set(Resource *, const std::string &, uint32_t , wl_array *) + { + } + + void tizen_launch_effect::tizen_launch_effect_type_unset(Resource *, uint32_t ) + { + } + + void tizen_launch_effect::tizen_launch_effect_destroy(Resource *) + { + } + + + void tizen_launch_effect::handle_create_splash_img( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_effect_object)->tizen_launch_effect_create_splash_img( + r, + id); + } + + void tizen_launch_effect::handle_type_set( + ::wl_client *client, + struct wl_resource *resource, + const char *effect_type, + uint32_t pid, + wl_array *options) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_effect_object)->tizen_launch_effect_type_set( + r, + std::string(effect_type), + pid, + options); + } + + void tizen_launch_effect::handle_type_unset( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_effect_object)->tizen_launch_effect_type_unset( + r, + pid); + } + + void tizen_launch_effect::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_effect_object)->tizen_launch_effect_destroy( + r); + } + + tizen_launch_splash::tizen_launch_splash(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_launch_splash::tizen_launch_splash(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_launch_splash::tizen_launch_splash(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_launch_splash::tizen_launch_splash() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_launch_splash::~tizen_launch_splash() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_launch_splash::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_launch_splash::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_launch_splash::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_launch_splash::Resource *tizen_launch_splash::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_launch_splash::Resource *tizen_launch_splash::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_launch_splash::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_launch_splash_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_launch_splash::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_launch_splash::interface() + { + return &::tizen_launch_splash_interface; + } + + tizen_launch_splash::Resource *tizen_launch_splash::tizen_launch_splash_allocate() + { + return new Resource; + } + + void tizen_launch_splash::tizen_launch_splash_bind_resource(Resource *) + { + } + + void tizen_launch_splash::tizen_launch_splash_destroy_resource(Resource *) + { + } + + void tizen_launch_splash::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_launch_splash *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_launch_splash::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_launch_splash *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_launch_splash::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_launch_splash *that = resource->tizen_launch_splash_object; + that->m_resource_map.erase(resource->client()); + that->tizen_launch_splash_destroy_resource(resource); + delete resource; + } + + tizen_launch_splash::Resource *tizen_launch_splash::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launch_splash_interface, version, id); + return bind(handle); + } + + tizen_launch_splash::Resource *tizen_launch_splash::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_launch_splash_allocate(); + resource->tizen_launch_splash_object = this; + + wl_resource_set_implementation(handle, &m_tizen_launch_splash_interface, resource, destroy_func); + resource->handle = handle; + tizen_launch_splash_bind_resource(resource); + return resource; + } + tizen_launch_splash::Resource *tizen_launch_splash::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_launch_splash_interface, &m_tizen_launch_splash_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_launch_splash_interface tizen_launch_splash::m_tizen_launch_splash_interface = { + tizen_launch_splash::handle_destroy, + tizen_launch_splash::handle_launch, + tizen_launch_splash::handle_owner, + tizen_launch_splash::handle_launch_v2 + }; + + void tizen_launch_splash::tizen_launch_splash_destroy(Resource *) + { + } + + void tizen_launch_splash::tizen_launch_splash_launch(Resource *, const std::string &, uint32_t , uint32_t , uint32_t , uint32_t , const std::string &, const std::string &, wl_array *) + { + } + + void tizen_launch_splash::tizen_launch_splash_owner(Resource *, uint32_t ) + { + } + + void tizen_launch_splash::tizen_launch_splash_launch_v2(Resource *, const std::string &, uint32_t , uint32_t , uint32_t , uint32_t , const std::string &, const std::string &, wl_array *, wl_array *) + { + } + + + void tizen_launch_splash::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_splash_object)->tizen_launch_splash_destroy( + r); + } + + void tizen_launch_splash::handle_launch( + ::wl_client *client, + struct wl_resource *resource, + const char *file, + uint32_t file_type, + uint32_t color_depth, + uint32_t rotation, + uint32_t indicator, + const char *effect_type, + const char *theme_type, + wl_array *options) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_splash_object)->tizen_launch_splash_launch( + r, + std::string(file), + file_type, + color_depth, + rotation, + indicator, + std::string(effect_type), + std::string(theme_type), + options); + } + + void tizen_launch_splash::handle_owner( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_splash_object)->tizen_launch_splash_owner( + r, + pid); + } + + void tizen_launch_splash::handle_launch_v2( + ::wl_client *client, + struct wl_resource *resource, + const char *file, + uint32_t file_type, + uint32_t color_depth, + uint32_t rotation, + uint32_t indicator, + const char *effect_type, + const char *theme_type, + wl_array *options, + wl_array *extra_config) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_splash_object)->tizen_launch_splash_launch_v2( + r, + std::string(file), + file_type, + color_depth, + rotation, + indicator, + std::string(effect_type), + std::string(theme_type), + options, + extra_config); + } + + tizen_launch_appinfo::tizen_launch_appinfo(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_launch_appinfo::tizen_launch_appinfo(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_launch_appinfo::tizen_launch_appinfo(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_launch_appinfo::tizen_launch_appinfo() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_launch_appinfo::~tizen_launch_appinfo() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_launch_appinfo::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_launch_appinfo::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_launch_appinfo::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_launch_appinfo::Resource *tizen_launch_appinfo::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_launch_appinfo::Resource *tizen_launch_appinfo::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_launch_appinfo::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_launch_appinfo_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_launch_appinfo::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_launch_appinfo::interface() + { + return &::tizen_launch_appinfo_interface; + } + + tizen_launch_appinfo::Resource *tizen_launch_appinfo::tizen_launch_appinfo_allocate() + { + return new Resource; + } + + void tizen_launch_appinfo::tizen_launch_appinfo_bind_resource(Resource *) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_destroy_resource(Resource *) + { + } + + void tizen_launch_appinfo::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_launch_appinfo *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_launch_appinfo::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_launch_appinfo *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_launch_appinfo::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_launch_appinfo *that = resource->tizen_launch_appinfo_object; + that->m_resource_map.erase(resource->client()); + that->tizen_launch_appinfo_destroy_resource(resource); + delete resource; + } + + tizen_launch_appinfo::Resource *tizen_launch_appinfo::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_launch_appinfo_interface, version, id); + return bind(handle); + } + + tizen_launch_appinfo::Resource *tizen_launch_appinfo::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_launch_appinfo_allocate(); + resource->tizen_launch_appinfo_object = this; + + wl_resource_set_implementation(handle, &m_tizen_launch_appinfo_interface, resource, destroy_func); + resource->handle = handle; + tizen_launch_appinfo_bind_resource(resource); + return resource; + } + tizen_launch_appinfo::Resource *tizen_launch_appinfo::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_launch_appinfo_interface, &m_tizen_launch_appinfo_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_launch_appinfo_interface tizen_launch_appinfo::m_tizen_launch_appinfo_interface = { + tizen_launch_appinfo::handle_destroy, + tizen_launch_appinfo::handle_register_pid, + tizen_launch_appinfo::handle_deregister_pid, + tizen_launch_appinfo::handle_set_appid, + tizen_launch_appinfo::handle_get_base_output_resolution, + tizen_launch_appinfo::handle_register_appid, + tizen_launch_appinfo::handle_deregister_appid, + tizen_launch_appinfo::handle_set_pid, + tizen_launch_appinfo::handle_ready_metadata + }; + + void tizen_launch_appinfo::tizen_launch_appinfo_destroy(Resource *) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_register_pid(Resource *, uint32_t ) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_deregister_pid(Resource *, uint32_t ) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_set_appid(Resource *, uint32_t , const std::string &) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_get_base_output_resolution(Resource *, uint32_t ) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_register_appid(Resource *, const std::string &) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_deregister_appid(Resource *, const std::string &) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_set_pid(Resource *, const std::string &, uint32_t ) + { + } + + void tizen_launch_appinfo::tizen_launch_appinfo_ready_metadata(Resource *, const std::string &, uint32_t ) + { + } + + + void tizen_launch_appinfo::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_destroy( + r); + } + + void tizen_launch_appinfo::handle_register_pid( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_register_pid( + r, + pid); + } + + void tizen_launch_appinfo::handle_deregister_pid( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_deregister_pid( + r, + pid); + } + + void tizen_launch_appinfo::handle_set_appid( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid, + const char *appid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_set_appid( + r, + pid, + std::string(appid)); + } + + void tizen_launch_appinfo::handle_get_base_output_resolution( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_get_base_output_resolution( + r, + pid); + } + + void tizen_launch_appinfo::handle_register_appid( + ::wl_client *client, + struct wl_resource *resource, + const char *appid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_register_appid( + r, + std::string(appid)); + } + + void tizen_launch_appinfo::handle_deregister_appid( + ::wl_client *client, + struct wl_resource *resource, + const char *appid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_deregister_appid( + r, + std::string(appid)); + } + + void tizen_launch_appinfo::handle_set_pid( + ::wl_client *client, + struct wl_resource *resource, + const char *appid, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_set_pid( + r, + std::string(appid), + pid); + } + + void tizen_launch_appinfo::handle_ready_metadata( + ::wl_client *client, + struct wl_resource *resource, + const char *appid, + uint32_t pid) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_launch_appinfo_object)->tizen_launch_appinfo_ready_metadata( + r, + std::string(appid), + pid); + } + + void tizen_launch_appinfo::send_base_output_resolution_done(uint32_t pid, uint32_t width, uint32_t height) + { + DS_ASSERT_X(m_resource, "tizen_launch_appinfo::base_output_resolution_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_launch_appinfo::base_output_resolution_done as it's not initialised"); + return; + } + send_base_output_resolution_done( + m_resource->handle, + pid, + width, + height); + } + + void tizen_launch_appinfo::send_base_output_resolution_done(struct ::wl_resource *resource, uint32_t pid, uint32_t width, uint32_t height) + { + tizen_launch_appinfo_send_base_output_resolution_done( + resource, + pid, + width, + height); + } + +} + diff --git a/src/DSWaylandServer/dswayland-server-tizen-launch.h b/src/DSWaylandServer/dswayland-server-tizen-launch.h new file mode 100644 index 0000000..190d1de --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-launch.h @@ -0,0 +1,374 @@ +/* Protocol XML file : wayland-extension/tizen-launch.xml */ + +#ifndef __DS_TIZEN_LAUNCH_PROTOCOL_H__ +#define __DS_TIZEN_LAUNCH_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "tizen-launch-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class tizen_launch_effect + { + public: + tizen_launch_effect(struct ::wl_client *client, int id, int version); + tizen_launch_effect(struct ::wl_display *display, int version); + tizen_launch_effect(struct ::wl_resource *resource); + tizen_launch_effect(); + + virtual ~tizen_launch_effect(); + + class Resource + { + public: + Resource() : tizen_launch_effect_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_launch_effect *tizen_launch_effect_object; + tizen_launch_effect *object() { return tizen_launch_effect_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *tizen_launch_effect_allocate(); + + virtual void tizen_launch_effect_bind_resource(Resource *resource); + virtual void tizen_launch_effect_destroy_resource(Resource *resource); + + virtual void tizen_launch_effect_create_splash_img(Resource *resource, uint32_t id); + virtual void tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, wl_array *options); + virtual void tizen_launch_effect_type_unset(Resource *resource, uint32_t pid); + virtual void tizen_launch_effect_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_launch_effect_interface m_tizen_launch_effect_interface; + + static void handle_create_splash_img( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_type_set( + ::wl_client *client, + struct wl_resource *resource, + const char *effect_type, + uint32_t pid, + wl_array *options); + static void handle_type_unset( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_launch_effect *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_launch_splash + { + public: + tizen_launch_splash(struct ::wl_client *client, int id, int version); + tizen_launch_splash(struct ::wl_display *display, int version); + tizen_launch_splash(struct ::wl_resource *resource); + tizen_launch_splash(); + + virtual ~tizen_launch_splash(); + + class Resource + { + public: + Resource() : tizen_launch_splash_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_launch_splash *tizen_launch_splash_object; + tizen_launch_splash *object() { return tizen_launch_splash_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum file_type { + file_type_img = 0, // splash image file path + file_type_edj = 1, // splash edj file path + }; + + enum indicator { + indicator_off = 0, // splash hide indicator + indicator_on = 1, // splash show indicator + }; + + enum rotation { + rotation_0 = 0, // rotation angle 0 degree + rotation_90 = 90, // rotation angle 90 degree + rotation_180 = 180, // rotation angle 180 degree + rotation_270 = 270, // rotation angle 270 degree + }; + + protected: + virtual Resource *tizen_launch_splash_allocate(); + + virtual void tizen_launch_splash_bind_resource(Resource *resource); + virtual void tizen_launch_splash_destroy_resource(Resource *resource); + + virtual void tizen_launch_splash_destroy(Resource *resource); + virtual void tizen_launch_splash_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, wl_array *options); + virtual void tizen_launch_splash_owner(Resource *resource, uint32_t pid); + virtual void tizen_launch_splash_launch_v2(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, wl_array *options, wl_array *extra_config); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_launch_splash_interface m_tizen_launch_splash_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_launch( + ::wl_client *client, + struct wl_resource *resource, + const char *file, + uint32_t file_type, + uint32_t color_depth, + uint32_t rotation, + uint32_t indicator, + const char *effect_type, + const char *theme_type, + wl_array *options); + static void handle_owner( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid); + static void handle_launch_v2( + ::wl_client *client, + struct wl_resource *resource, + const char *file, + uint32_t file_type, + uint32_t color_depth, + uint32_t rotation, + uint32_t indicator, + const char *effect_type, + const char *theme_type, + wl_array *options, + wl_array *extra_config); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_launch_splash *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_launch_appinfo + { + public: + tizen_launch_appinfo(struct ::wl_client *client, int id, int version); + tizen_launch_appinfo(struct ::wl_display *display, int version); + tizen_launch_appinfo(struct ::wl_resource *resource); + tizen_launch_appinfo(); + + virtual ~tizen_launch_appinfo(); + + class Resource + { + public: + Resource() : tizen_launch_appinfo_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_launch_appinfo *tizen_launch_appinfo_object; + tizen_launch_appinfo *object() { return tizen_launch_appinfo_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_base_output_resolution_done(uint32_t pid, uint32_t width, uint32_t height); + void send_base_output_resolution_done(struct ::wl_resource *resource, uint32_t pid, uint32_t width, uint32_t height); + + protected: + virtual Resource *tizen_launch_appinfo_allocate(); + + virtual void tizen_launch_appinfo_bind_resource(Resource *resource); + virtual void tizen_launch_appinfo_destroy_resource(Resource *resource); + + virtual void tizen_launch_appinfo_destroy(Resource *resource); + virtual void tizen_launch_appinfo_register_pid(Resource *resource, uint32_t pid); + virtual void tizen_launch_appinfo_deregister_pid(Resource *resource, uint32_t pid); + virtual void tizen_launch_appinfo_set_appid(Resource *resource, uint32_t pid, const std::string &appid); + virtual void tizen_launch_appinfo_get_base_output_resolution(Resource *resource, uint32_t pid); + virtual void tizen_launch_appinfo_register_appid(Resource *resource, const std::string &appid); + virtual void tizen_launch_appinfo_deregister_appid(Resource *resource, const std::string &appid); + virtual void tizen_launch_appinfo_set_pid(Resource *resource, const std::string &appid, uint32_t pid); + virtual void tizen_launch_appinfo_ready_metadata(Resource *resource, const std::string &appid, uint32_t pid); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_launch_appinfo_interface m_tizen_launch_appinfo_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_register_pid( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid); + static void handle_deregister_pid( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid); + static void handle_set_appid( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid, + const char *appid); + static void handle_get_base_output_resolution( + ::wl_client *client, + struct wl_resource *resource, + uint32_t pid); + static void handle_register_appid( + ::wl_client *client, + struct wl_resource *resource, + const char *appid); + static void handle_deregister_appid( + ::wl_client *client, + struct wl_resource *resource, + const char *appid); + static void handle_set_pid( + ::wl_client *client, + struct wl_resource *resource, + const char *appid, + uint32_t pid); + static void handle_ready_metadata( + ::wl_client *client, + struct wl_resource *resource, + const char *appid, + uint32_t pid); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_launch_appinfo *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-tizen-remote-surface.cpp b/src/DSWaylandServer/dswayland-server-tizen-remote-surface.cpp new file mode 100644 index 0000000..9464aaa --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-remote-surface.cpp @@ -0,0 +1,1261 @@ +/* Protocol XML file : wayland-extension/tizen-remote-surface.xml */ + +#include "dswayland-server-tizen-remote-surface.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + tizen_remote_surface_manager::tizen_remote_surface_manager(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_remote_surface_manager::tizen_remote_surface_manager(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_remote_surface_manager::tizen_remote_surface_manager(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_remote_surface_manager::tizen_remote_surface_manager() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_remote_surface_manager::~tizen_remote_surface_manager() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_remote_surface_manager::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_remote_surface_manager::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_remote_surface_manager::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_remote_surface_manager::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_remote_surface_manager_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_remote_surface_manager::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_remote_surface_manager::interface() + { + return &::tizen_remote_surface_manager_interface; + } + + tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::tizen_remote_surface_manager_allocate() + { + return new Resource; + } + + void tizen_remote_surface_manager::tizen_remote_surface_manager_bind_resource(Resource *) + { + } + + void tizen_remote_surface_manager::tizen_remote_surface_manager_destroy_resource(Resource *) + { + } + + void tizen_remote_surface_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_remote_surface_manager *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_remote_surface_manager::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_remote_surface_manager *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_remote_surface_manager::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_remote_surface_manager *that = resource->tizen_remote_surface_manager_object; + that->m_resource_map.erase(resource->client()); + that->tizen_remote_surface_manager_destroy_resource(resource); + delete resource; + } + + tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_remote_surface_manager_interface, version, id); + return bind(handle); + } + + tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_remote_surface_manager_allocate(); + resource->tizen_remote_surface_manager_object = this; + + wl_resource_set_implementation(handle, &m_tizen_remote_surface_manager_interface, resource, destroy_func); + resource->handle = handle; + tizen_remote_surface_manager_bind_resource(resource); + return resource; + } + tizen_remote_surface_manager::Resource *tizen_remote_surface_manager::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_remote_surface_manager_interface, &m_tizen_remote_surface_manager_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_remote_surface_manager_interface tizen_remote_surface_manager::m_tizen_remote_surface_manager_interface = { + tizen_remote_surface_manager::handle_create_provider, + tizen_remote_surface_manager::handle_create_surface, + tizen_remote_surface_manager::handle_bind_surface, + tizen_remote_surface_manager::handle_destroy, + tizen_remote_surface_manager::handle_create_surface_with_wl_surface + }; + + void tizen_remote_surface_manager::tizen_remote_surface_manager_create_provider(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_remote_surface_manager::tizen_remote_surface_manager_create_surface(Resource *, uint32_t, uint32_t , struct ::wl_resource *) + { + } + + void tizen_remote_surface_manager::tizen_remote_surface_manager_bind_surface(Resource *, struct ::wl_resource *, struct ::wl_resource *) + { + } + + void tizen_remote_surface_manager::tizen_remote_surface_manager_destroy(Resource *) + { + } + + void tizen_remote_surface_manager::tizen_remote_surface_manager_create_surface_with_wl_surface(Resource *, uint32_t, uint32_t , struct ::wl_resource *, struct ::wl_resource *) + { + } + + + void tizen_remote_surface_manager::handle_create_provider( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_create_provider( + r, + id, + surface); + } + + void tizen_remote_surface_manager::handle_create_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + uint32_t resource_id, + struct ::wl_resource *tbm) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_create_surface( + r, + id, + resource_id, + tbm); + } + + void tizen_remote_surface_manager::handle_bind_surface( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + struct ::wl_resource *remote_surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_bind_surface( + r, + surface, + remote_surface); + } + + void tizen_remote_surface_manager::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_destroy( + r); + } + + void tizen_remote_surface_manager::handle_create_surface_with_wl_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + uint32_t resource_id, + struct ::wl_resource *tbm, + struct ::wl_resource *wayland_surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_manager_object)->tizen_remote_surface_manager_create_surface_with_wl_surface( + r, + id, + resource_id, + tbm, + wayland_surface); + } + + tizen_remote_surface_provider::tizen_remote_surface_provider(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_remote_surface_provider::tizen_remote_surface_provider(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_remote_surface_provider::tizen_remote_surface_provider(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_remote_surface_provider::tizen_remote_surface_provider() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_remote_surface_provider::~tizen_remote_surface_provider() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_remote_surface_provider::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_remote_surface_provider::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_remote_surface_provider::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_remote_surface_provider::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_remote_surface_provider_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_remote_surface_provider::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_remote_surface_provider::interface() + { + return &::tizen_remote_surface_provider_interface; + } + + tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::tizen_remote_surface_provider_allocate() + { + return new Resource; + } + + void tizen_remote_surface_provider::tizen_remote_surface_provider_bind_resource(Resource *) + { + } + + void tizen_remote_surface_provider::tizen_remote_surface_provider_destroy_resource(Resource *) + { + } + + void tizen_remote_surface_provider::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_remote_surface_provider *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_remote_surface_provider::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_remote_surface_provider *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_remote_surface_provider::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_remote_surface_provider *that = resource->tizen_remote_surface_provider_object; + that->m_resource_map.erase(resource->client()); + that->tizen_remote_surface_provider_destroy_resource(resource); + delete resource; + } + + tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_remote_surface_provider_interface, version, id); + return bind(handle); + } + + tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_remote_surface_provider_allocate(); + resource->tizen_remote_surface_provider_object = this; + + wl_resource_set_implementation(handle, &m_tizen_remote_surface_provider_interface, resource, destroy_func); + resource->handle = handle; + tizen_remote_surface_provider_bind_resource(resource); + return resource; + } + tizen_remote_surface_provider::Resource *tizen_remote_surface_provider::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_remote_surface_provider_interface, &m_tizen_remote_surface_provider_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_remote_surface_provider_interface tizen_remote_surface_provider::m_tizen_remote_surface_provider_interface = { + tizen_remote_surface_provider::handle_destroy, + tizen_remote_surface_provider::handle_offscreen_set, + tizen_remote_surface_provider::handle_set_input_event_filter + }; + + void tizen_remote_surface_provider::tizen_remote_surface_provider_destroy(Resource *) + { + } + + void tizen_remote_surface_provider::tizen_remote_surface_provider_offscreen_set(Resource *, uint32_t ) + { + } + + void tizen_remote_surface_provider::tizen_remote_surface_provider_set_input_event_filter(Resource *, uint32_t ) + { + } + + + void tizen_remote_surface_provider::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_provider_object)->tizen_remote_surface_provider_destroy( + r); + } + + void tizen_remote_surface_provider::handle_offscreen_set( + ::wl_client *client, + struct wl_resource *resource, + uint32_t set) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_provider_object)->tizen_remote_surface_provider_offscreen_set( + r, + set); + } + + void tizen_remote_surface_provider::handle_set_input_event_filter( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_filter) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_provider_object)->tizen_remote_surface_provider_set_input_event_filter( + r, + event_filter); + } + + void tizen_remote_surface_provider::send_resource_id(uint32_t resource_id) + { + DS_ASSERT_X(m_resource, "tizen_remote_surface_provider::resource_id", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_remote_surface_provider::resource_id as it's not initialised"); + return; + } + send_resource_id( + m_resource->handle, + resource_id); + } + + void tizen_remote_surface_provider::send_resource_id(struct ::wl_resource *resource, uint32_t resource_id) + { + tizen_remote_surface_provider_send_resource_id( + resource, + resource_id); + } + + + void tizen_remote_surface_provider::send_visibility(uint32_t visibility) + { + DS_ASSERT_X(m_resource, "tizen_remote_surface_provider::visibility", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_remote_surface_provider::visibility as it's not initialised"); + return; + } + send_visibility( + m_resource->handle, + visibility); + } + + void tizen_remote_surface_provider::send_visibility(struct ::wl_resource *resource, uint32_t visibility) + { + tizen_remote_surface_provider_send_visibility( + resource, + visibility); + } + + + tizen_remote_surface::tizen_remote_surface(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_remote_surface::tizen_remote_surface(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_remote_surface::tizen_remote_surface(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_remote_surface::tizen_remote_surface() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_remote_surface::~tizen_remote_surface() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_remote_surface::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_remote_surface::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_remote_surface::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_remote_surface::Resource *tizen_remote_surface::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_remote_surface::Resource *tizen_remote_surface::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_remote_surface::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_remote_surface_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_remote_surface::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_remote_surface::interface() + { + return &::tizen_remote_surface_interface; + } + + tizen_remote_surface::Resource *tizen_remote_surface::tizen_remote_surface_allocate() + { + return new Resource; + } + + void tizen_remote_surface::tizen_remote_surface_bind_resource(Resource *) + { + } + + void tizen_remote_surface::tizen_remote_surface_destroy_resource(Resource *) + { + } + + void tizen_remote_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_remote_surface *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_remote_surface::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_remote_surface *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_remote_surface::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_remote_surface *that = resource->tizen_remote_surface_object; + that->m_resource_map.erase(resource->client()); + that->tizen_remote_surface_destroy_resource(resource); + delete resource; + } + + tizen_remote_surface::Resource *tizen_remote_surface::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_remote_surface_interface, version, id); + return bind(handle); + } + + tizen_remote_surface::Resource *tizen_remote_surface::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_remote_surface_allocate(); + resource->tizen_remote_surface_object = this; + + wl_resource_set_implementation(handle, &m_tizen_remote_surface_interface, resource, destroy_func); + resource->handle = handle; + tizen_remote_surface_bind_resource(resource); + return resource; + } + tizen_remote_surface::Resource *tizen_remote_surface::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_remote_surface_interface, &m_tizen_remote_surface_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_remote_surface_interface tizen_remote_surface::m_tizen_remote_surface_interface = { + tizen_remote_surface::handle_destroy, + tizen_remote_surface::handle_redirect, + tizen_remote_surface::handle_unredirect, + tizen_remote_surface::handle_transfer_mouse_event, + tizen_remote_surface::handle_transfer_mouse_wheel, + tizen_remote_surface::handle_transfer_touch_event, + tizen_remote_surface::handle_transfer_touch_cancel, + tizen_remote_surface::handle_transfer_key_event, + tizen_remote_surface::handle_transfer_visibility, + tizen_remote_surface::handle_set_owner, + tizen_remote_surface::handle_create_region, + tizen_remote_surface::handle_release, + tizen_remote_surface::handle_set_remote_render, + tizen_remote_surface::handle_set_changed_buffer_event_filter, + tizen_remote_surface::handle_get_current_buffer + }; + + void tizen_remote_surface::tizen_remote_surface_destroy(Resource *) + { + } + + void tizen_remote_surface::tizen_remote_surface_redirect(Resource *) + { + } + + void tizen_remote_surface::tizen_remote_surface_unredirect(Resource *) + { + } + + void tizen_remote_surface::tizen_remote_surface_transfer_mouse_event(Resource *, uint32_t , int32_t , int32_t , int32_t , int32_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , uint32_t , uint32_t , const std::string &, uint32_t ) + { + } + + void tizen_remote_surface::tizen_remote_surface_transfer_mouse_wheel(Resource *, uint32_t , int32_t , uint32_t , uint32_t , const std::string &, uint32_t ) + { + } + + void tizen_remote_surface::tizen_remote_surface_transfer_touch_event(Resource *, uint32_t , int32_t , int32_t , int32_t , int32_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , wl_fixed_t , uint32_t , uint32_t , const std::string &, uint32_t ) + { + } + + void tizen_remote_surface::tizen_remote_surface_transfer_touch_cancel(Resource *) + { + } + + void tizen_remote_surface::tizen_remote_surface_transfer_key_event(Resource *, uint32_t , int32_t , uint32_t , uint32_t , const std::string &, uint32_t ) + { + } + + void tizen_remote_surface::tizen_remote_surface_transfer_visibility(Resource *, uint32_t ) + { + } + + void tizen_remote_surface::tizen_remote_surface_set_owner(Resource *, struct ::wl_resource *) + { + } + + void tizen_remote_surface::tizen_remote_surface_create_region(Resource *, uint32_t) + { + } + + void tizen_remote_surface::tizen_remote_surface_release(Resource *, struct ::wl_resource *) + { + } + + void tizen_remote_surface::tizen_remote_surface_set_remote_render(Resource *, uint32_t ) + { + } + + void tizen_remote_surface::tizen_remote_surface_set_changed_buffer_event_filter(Resource *, uint32_t ) + { + } + + void tizen_remote_surface::tizen_remote_surface_get_current_buffer(Resource *, uint32_t , uint32_t ) + { + } + + + void tizen_remote_surface::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_destroy( + r); + } + + void tizen_remote_surface::handle_redirect( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_redirect( + r); + } + + void tizen_remote_surface::handle_unredirect( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_unredirect( + r); + } + + void tizen_remote_surface::handle_transfer_mouse_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_type, + int32_t device, + int32_t button, + int32_t x, + int32_t y, + wl_fixed_t radius_x, + wl_fixed_t radius_y, + wl_fixed_t pressure, + wl_fixed_t angle, + uint32_t clas, + uint32_t subclas, + const char *identifier, + uint32_t time) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_mouse_event( + r, + event_type, + device, + button, + x, + y, + radius_x, + radius_y, + pressure, + angle, + clas, + subclas, + std::string(identifier), + time); + } + + void tizen_remote_surface::handle_transfer_mouse_wheel( + ::wl_client *client, + struct wl_resource *resource, + uint32_t direction, + int32_t z, + uint32_t clas, + uint32_t subclas, + const char *identifier, + uint32_t time) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_mouse_wheel( + r, + direction, + z, + clas, + subclas, + std::string(identifier), + time); + } + + void tizen_remote_surface::handle_transfer_touch_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_type, + int32_t device, + int32_t button, + int32_t x, + int32_t y, + wl_fixed_t radius_x, + wl_fixed_t radius_y, + wl_fixed_t pressure, + wl_fixed_t angle, + uint32_t clas, + uint32_t subclas, + const char *identifier, + uint32_t time) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_touch_event( + r, + event_type, + device, + button, + x, + y, + radius_x, + radius_y, + pressure, + angle, + clas, + subclas, + std::string(identifier), + time); + } + + void tizen_remote_surface::handle_transfer_touch_cancel( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_touch_cancel( + r); + } + + void tizen_remote_surface::handle_transfer_key_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_type, + int32_t keycode, + uint32_t clas, + uint32_t subclas, + const char *identifier, + uint32_t time) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_key_event( + r, + event_type, + keycode, + clas, + subclas, + std::string(identifier), + time); + } + + void tizen_remote_surface::handle_transfer_visibility( + ::wl_client *client, + struct wl_resource *resource, + uint32_t visibility) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_transfer_visibility( + r, + visibility); + } + + void tizen_remote_surface::handle_set_owner( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *owner) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_set_owner( + r, + owner); + } + + void tizen_remote_surface::handle_create_region( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_create_region( + r, + id); + } + + void tizen_remote_surface::handle_release( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *buffer) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_release( + r, + buffer); + } + + void tizen_remote_surface::handle_set_remote_render( + ::wl_client *client, + struct wl_resource *resource, + uint32_t set) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_set_remote_render( + r, + set); + } + + void tizen_remote_surface::handle_set_changed_buffer_event_filter( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_set_changed_buffer_event_filter( + r, + type); + } + + void tizen_remote_surface::handle_get_current_buffer( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_object)->tizen_remote_surface_get_current_buffer( + r, + type, + serial); + } + + void tizen_remote_surface::send_update_buffer(struct ::wl_resource *buffer, uint32_t time) + { + DS_ASSERT_X(m_resource, "tizen_remote_surface::update_buffer", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_remote_surface::update_buffer as it's not initialised"); + return; + } + send_update_buffer( + m_resource->handle, + buffer, + time); + } + + void tizen_remote_surface::send_update_buffer(struct ::wl_resource *resource, struct ::wl_resource *buffer, uint32_t time) + { + tizen_remote_surface_send_update_buffer( + resource, + buffer, + time); + } + + + void tizen_remote_surface::send_missing() + { + DS_ASSERT_X(m_resource, "tizen_remote_surface::missing", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_remote_surface::missing as it's not initialised"); + return; + } + send_missing( + m_resource->handle); + } + + void tizen_remote_surface::send_missing(struct ::wl_resource *resource) + { + tizen_remote_surface_send_missing( + resource); + } + + + void tizen_remote_surface::send_changed_buffer(uint32_t type, struct ::wl_resource *tbm, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, const std::string &options) + { + DS_ASSERT_X(m_resource, "tizen_remote_surface::changed_buffer", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_remote_surface::changed_buffer as it's not initialised"); + return; + } + send_changed_buffer( + m_resource->handle, + type, + tbm, + img_file_fd, + img_file_size, + time, + options); + } + + void tizen_remote_surface::send_changed_buffer(struct ::wl_resource *resource, uint32_t type, struct ::wl_resource *tbm, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, const std::string &options) + { + struct wl_array options_data; + options_data.size = options.size(); + options_data.data = static_cast(const_cast(options.c_str())); + options_data.alloc = 0; + + tizen_remote_surface_send_changed_buffer( + resource, + type, + tbm, + img_file_fd, + img_file_size, + time, + &options_data); + } + + + void tizen_remote_surface::send_input_event_filter(uint32_t event_filter) + { + DS_ASSERT_X(m_resource, "tizen_remote_surface::input_event_filter", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_remote_surface::input_event_filter as it's not initialised"); + return; + } + send_input_event_filter( + m_resource->handle, + event_filter); + } + + void tizen_remote_surface::send_input_event_filter(struct ::wl_resource *resource, uint32_t event_filter) + { + tizen_remote_surface_send_input_event_filter( + resource, + event_filter); + } + + + tizen_remote_surface_region::tizen_remote_surface_region(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_remote_surface_region::tizen_remote_surface_region(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_remote_surface_region::tizen_remote_surface_region(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_remote_surface_region::tizen_remote_surface_region() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_remote_surface_region::~tizen_remote_surface_region() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_remote_surface_region::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_remote_surface_region::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_remote_surface_region::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_remote_surface_region::Resource *tizen_remote_surface_region::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_remote_surface_region::Resource *tizen_remote_surface_region::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_remote_surface_region::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_remote_surface_region_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_remote_surface_region::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_remote_surface_region::interface() + { + return &::tizen_remote_surface_region_interface; + } + + tizen_remote_surface_region::Resource *tizen_remote_surface_region::tizen_remote_surface_region_allocate() + { + return new Resource; + } + + void tizen_remote_surface_region::tizen_remote_surface_region_bind_resource(Resource *) + { + } + + void tizen_remote_surface_region::tizen_remote_surface_region_destroy_resource(Resource *) + { + } + + void tizen_remote_surface_region::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_remote_surface_region *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_remote_surface_region::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_remote_surface_region *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_remote_surface_region::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_remote_surface_region *that = resource->tizen_remote_surface_region_object; + that->m_resource_map.erase(resource->client()); + that->tizen_remote_surface_region_destroy_resource(resource); + delete resource; + } + + tizen_remote_surface_region::Resource *tizen_remote_surface_region::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_remote_surface_region_interface, version, id); + return bind(handle); + } + + tizen_remote_surface_region::Resource *tizen_remote_surface_region::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_remote_surface_region_allocate(); + resource->tizen_remote_surface_region_object = this; + + wl_resource_set_implementation(handle, &m_tizen_remote_surface_region_interface, resource, destroy_func); + resource->handle = handle; + tizen_remote_surface_region_bind_resource(resource); + return resource; + } + tizen_remote_surface_region::Resource *tizen_remote_surface_region::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_remote_surface_region_interface, &m_tizen_remote_surface_region_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_remote_surface_region_interface tizen_remote_surface_region::m_tizen_remote_surface_region_interface = { + tizen_remote_surface_region::handle_destroy, + tizen_remote_surface_region::handle_set_geometry + }; + + void tizen_remote_surface_region::tizen_remote_surface_region_destroy(Resource *) + { + } + + void tizen_remote_surface_region::tizen_remote_surface_region_set_geometry(Resource *, int32_t , int32_t , int32_t , int32_t ) + { + } + + + void tizen_remote_surface_region::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_region_object)->tizen_remote_surface_region_destroy( + r); + } + + void tizen_remote_surface_region::handle_set_geometry( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t w, + int32_t h) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_remote_surface_region_object)->tizen_remote_surface_region_set_geometry( + r, + x, + y, + w, + h); + } +} + diff --git a/src/DSWaylandServer/dswayland-server-tizen-remote-surface.h b/src/DSWaylandServer/dswayland-server-tizen-remote-surface.h new file mode 100644 index 0000000..a129973 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-remote-surface.h @@ -0,0 +1,573 @@ +/* Protocol XML file : wayland-extension/tizen-remote-surface.xml */ + +#ifndef __DS_TIZEN_REMOTE_SURFACE_PROTOCOL_H__ +#define __DS_TIZEN_REMOTE_SURFACE_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "tizen-remote-surface-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class tizen_remote_surface_manager + { + public: + tizen_remote_surface_manager(struct ::wl_client *client, int id, int version); + tizen_remote_surface_manager(struct ::wl_display *display, int version); + tizen_remote_surface_manager(struct ::wl_resource *resource); + tizen_remote_surface_manager(); + + virtual ~tizen_remote_surface_manager(); + + class Resource + { + public: + Resource() : tizen_remote_surface_manager_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_remote_surface_manager *tizen_remote_surface_manager_object; + tizen_remote_surface_manager *object() { return tizen_remote_surface_manager_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *tizen_remote_surface_manager_allocate(); + + virtual void tizen_remote_surface_manager_bind_resource(Resource *resource); + virtual void tizen_remote_surface_manager_destroy_resource(Resource *resource); + + virtual void tizen_remote_surface_manager_create_provider(Resource *resource, uint32_t id, struct ::wl_resource *surface); + virtual void tizen_remote_surface_manager_create_surface(Resource *resource, uint32_t id, uint32_t resource_id, struct ::wl_resource *tbm); + virtual void tizen_remote_surface_manager_bind_surface(Resource *resource, struct ::wl_resource *surface, struct ::wl_resource *remote_surface); + virtual void tizen_remote_surface_manager_destroy(Resource *resource); + virtual void tizen_remote_surface_manager_create_surface_with_wl_surface(Resource *resource, uint32_t id, uint32_t resource_id, struct ::wl_resource *tbm, struct ::wl_resource *wayland_surface); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_remote_surface_manager_interface m_tizen_remote_surface_manager_interface; + + static void handle_create_provider( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + static void handle_create_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + uint32_t resource_id, + struct ::wl_resource *tbm); + static void handle_bind_surface( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *surface, + struct ::wl_resource *remote_surface); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_create_surface_with_wl_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + uint32_t resource_id, + struct ::wl_resource *tbm, + struct ::wl_resource *wayland_surface); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_remote_surface_manager *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_remote_surface_provider + { + public: + tizen_remote_surface_provider(struct ::wl_client *client, int id, int version); + tizen_remote_surface_provider(struct ::wl_display *display, int version); + tizen_remote_surface_provider(struct ::wl_resource *resource); + tizen_remote_surface_provider(); + + virtual ~tizen_remote_surface_provider(); + + class Resource + { + public: + Resource() : tizen_remote_surface_provider_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_remote_surface_provider *tizen_remote_surface_provider_object; + tizen_remote_surface_provider *object() { return tizen_remote_surface_provider_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum visibility_type { + visibility_type_visible = 0, + visibility_type_invisible = 1, + }; + + void send_resource_id(uint32_t resource_id); + void send_resource_id(struct ::wl_resource *resource, uint32_t resource_id); + void send_visibility(uint32_t visibility); + void send_visibility(struct ::wl_resource *resource, uint32_t visibility); + + protected: + virtual Resource *tizen_remote_surface_provider_allocate(); + + virtual void tizen_remote_surface_provider_bind_resource(Resource *resource); + virtual void tizen_remote_surface_provider_destroy_resource(Resource *resource); + + virtual void tizen_remote_surface_provider_destroy(Resource *resource); + virtual void tizen_remote_surface_provider_offscreen_set(Resource *resource, uint32_t set); + virtual void tizen_remote_surface_provider_set_input_event_filter(Resource *resource, uint32_t event_filter); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_remote_surface_provider_interface m_tizen_remote_surface_provider_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_offscreen_set( + ::wl_client *client, + struct wl_resource *resource, + uint32_t set); + static void handle_set_input_event_filter( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_filter); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_remote_surface_provider *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_remote_surface + { + public: + tizen_remote_surface(struct ::wl_client *client, int id, int version); + tizen_remote_surface(struct ::wl_display *display, int version); + tizen_remote_surface(struct ::wl_resource *resource); + tizen_remote_surface(); + + virtual ~tizen_remote_surface(); + + class Resource + { + public: + Resource() : tizen_remote_surface_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_remote_surface *tizen_remote_surface_object; + tizen_remote_surface *object() { return tizen_remote_surface_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum event_type { + event_type_none = 0, + event_type_mouse_down = 1, + event_type_mouse_up = 2, + event_type_mouse_move = 3, + event_type_touch_down = 4, + event_type_touch_up = 5, + event_type_touch_move = 6, + event_type_key_down = 7, + event_type_key_up = 8, + event_type_mouse_in = 9, + event_type_mouse_out = 10, + event_type_key_cancel = 11, + }; + + enum visibility_type { + visibility_type_visible = 0, + visibility_type_invisible = 1, + }; + + enum buffer_type { + buffer_type_tbm = 0, // tbm type + buffer_type_image_file = 1, // image file type + }; + + enum input_event_filter { + input_event_filter_mouse_none = 0x00000001, + input_event_filter_mouse_up_down = 0x00000002, + input_event_filter_mouse_move_x = 0x00000003, + input_event_filter_mouse_move_y = 0x00000004, + input_event_filter_mouse_move_x_y = 0x00000005, + input_event_filter_mouse_up_down_move_x = 0x00000006, + input_event_filter_mouse_up_down_move_y = 0x00000007, + input_event_filter_mouse_up_down_move_x_y = 0x00000008, + input_event_filter_mouse_all = 0x0000000e, + input_event_filter_mouse_flag = 0x0000000f, + input_event_filter_mouse_wheel_none = 0x00000010, + input_event_filter_mouse_wheel_all = 0x000000e0, + input_event_filter_mouse_wheel_flag = 0x000000f0, + input_event_filter_touch_none = 0x00000100, + input_event_filter_touch_up_down = 0x00000200, + input_event_filter_touch_move_x = 0x00000300, + input_event_filter_touch_move_y = 0x00000400, + input_event_filter_touch_move_x_y = 0x00000500, + input_event_filter_touch_up_down_move_x = 0x00000600, + input_event_filter_touch_up_down_move_y = 0x00000700, + input_event_filter_touch_up_down_move_x_y = 0x00000800, + input_event_filter_touch_all = 0x00000e00, + input_event_filter_touch_flag = 0x00000f00, + input_event_filter_touch_cancel_none = 0x00001000, + input_event_filter_touch_cancel_all = 0x0000e000, + input_event_filter_touch_cancel_flag = 0x0000f000, + input_event_filter_key_none = 0x00010000, + input_event_filter_key_all = 0x000e0000, + input_event_filter_key_flag = 0x000f0000, + }; + + enum changed_buffer_event_filter { + changed_buffer_event_filter_none = 0x00000000, // none + changed_buffer_event_filter_tbm = 0x00000001, // tbm type filter + changed_buffer_event_filter_image_file = 0x00000002, // image file type filter + }; + + void send_update_buffer(struct ::wl_resource *buffer, uint32_t time); + void send_update_buffer(struct ::wl_resource *resource, struct ::wl_resource *buffer, uint32_t time); + void send_missing(); + void send_missing(struct ::wl_resource *resource); + void send_changed_buffer(uint32_t type, struct ::wl_resource *tbm, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, const std::string &options); + void send_changed_buffer(struct ::wl_resource *resource, uint32_t type, struct ::wl_resource *tbm, int32_t img_file_fd, uint32_t img_file_size, uint32_t time, const std::string &options); + void send_input_event_filter(uint32_t event_filter); + void send_input_event_filter(struct ::wl_resource *resource, uint32_t event_filter); + + protected: + virtual Resource *tizen_remote_surface_allocate(); + + virtual void tizen_remote_surface_bind_resource(Resource *resource); + virtual void tizen_remote_surface_destroy_resource(Resource *resource); + + virtual void tizen_remote_surface_destroy(Resource *resource); + virtual void tizen_remote_surface_redirect(Resource *resource); + virtual void tizen_remote_surface_unredirect(Resource *resource); + virtual void tizen_remote_surface_transfer_mouse_event(Resource *resource, uint32_t event_type, int32_t device, int32_t button, int32_t x, int32_t y, wl_fixed_t radius_x, wl_fixed_t radius_y, wl_fixed_t pressure, wl_fixed_t angle, uint32_t clas, uint32_t subclas, const std::string &identifier, uint32_t time); + virtual void tizen_remote_surface_transfer_mouse_wheel(Resource *resource, uint32_t direction, int32_t z, uint32_t clas, uint32_t subclas, const std::string &identifier, uint32_t time); + virtual void tizen_remote_surface_transfer_touch_event(Resource *resource, uint32_t event_type, int32_t device, int32_t button, int32_t x, int32_t y, wl_fixed_t radius_x, wl_fixed_t radius_y, wl_fixed_t pressure, wl_fixed_t angle, uint32_t clas, uint32_t subclas, const std::string &identifier, uint32_t time); + virtual void tizen_remote_surface_transfer_touch_cancel(Resource *resource); + virtual void tizen_remote_surface_transfer_key_event(Resource *resource, uint32_t event_type, int32_t keycode, uint32_t clas, uint32_t subclas, const std::string &identifier, uint32_t time); + virtual void tizen_remote_surface_transfer_visibility(Resource *resource, uint32_t visibility); + virtual void tizen_remote_surface_set_owner(Resource *resource, struct ::wl_resource *owner); + virtual void tizen_remote_surface_create_region(Resource *resource, uint32_t id); + virtual void tizen_remote_surface_release(Resource *resource, struct ::wl_resource *buffer); + virtual void tizen_remote_surface_set_remote_render(Resource *resource, uint32_t set); + virtual void tizen_remote_surface_set_changed_buffer_event_filter(Resource *resource, uint32_t type); + virtual void tizen_remote_surface_get_current_buffer(Resource *resource, uint32_t type, uint32_t serial); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_remote_surface_interface m_tizen_remote_surface_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_redirect( + ::wl_client *client, + struct wl_resource *resource); + static void handle_unredirect( + ::wl_client *client, + struct wl_resource *resource); + static void handle_transfer_mouse_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_type, + int32_t device, + int32_t button, + int32_t x, + int32_t y, + wl_fixed_t radius_x, + wl_fixed_t radius_y, + wl_fixed_t pressure, + wl_fixed_t angle, + uint32_t clas, + uint32_t subclas, + const char *identifier, + uint32_t time); + static void handle_transfer_mouse_wheel( + ::wl_client *client, + struct wl_resource *resource, + uint32_t direction, + int32_t z, + uint32_t clas, + uint32_t subclas, + const char *identifier, + uint32_t time); + static void handle_transfer_touch_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_type, + int32_t device, + int32_t button, + int32_t x, + int32_t y, + wl_fixed_t radius_x, + wl_fixed_t radius_y, + wl_fixed_t pressure, + wl_fixed_t angle, + uint32_t clas, + uint32_t subclas, + const char *identifier, + uint32_t time); + static void handle_transfer_touch_cancel( + ::wl_client *client, + struct wl_resource *resource); + static void handle_transfer_key_event( + ::wl_client *client, + struct wl_resource *resource, + uint32_t event_type, + int32_t keycode, + uint32_t clas, + uint32_t subclas, + const char *identifier, + uint32_t time); + static void handle_transfer_visibility( + ::wl_client *client, + struct wl_resource *resource, + uint32_t visibility); + static void handle_set_owner( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *owner); + static void handle_create_region( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_release( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *buffer); + static void handle_set_remote_render( + ::wl_client *client, + struct wl_resource *resource, + uint32_t set); + static void handle_set_changed_buffer_event_filter( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type); + static void handle_get_current_buffer( + ::wl_client *client, + struct wl_resource *resource, + uint32_t type, + uint32_t serial); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_remote_surface *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_remote_surface_region + { + public: + tizen_remote_surface_region(struct ::wl_client *client, int id, int version); + tizen_remote_surface_region(struct ::wl_display *display, int version); + tizen_remote_surface_region(struct ::wl_resource *resource); + tizen_remote_surface_region(); + + virtual ~tizen_remote_surface_region(); + + class Resource + { + public: + Resource() : tizen_remote_surface_region_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_remote_surface_region *tizen_remote_surface_region_object; + tizen_remote_surface_region *object() { return tizen_remote_surface_region_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *tizen_remote_surface_region_allocate(); + + virtual void tizen_remote_surface_region_bind_resource(Resource *resource); + virtual void tizen_remote_surface_region_destroy_resource(Resource *resource); + + virtual void tizen_remote_surface_region_destroy(Resource *resource); + virtual void tizen_remote_surface_region_set_geometry(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_remote_surface_region_interface m_tizen_remote_surface_region_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_geometry( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t w, + int32_t h); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_remote_surface_region *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-tizen-surface.cpp b/src/DSWaylandServer/dswayland-server-tizen-surface.cpp new file mode 100644 index 0000000..e8015aa --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-surface.cpp @@ -0,0 +1,412 @@ +/* Protocol XML file : wayland-extension/tizen-surface.xml */ + +#include "dswayland-server-tizen-surface.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + tizen_surface_shm::tizen_surface_shm(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_surface_shm::tizen_surface_shm(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_surface_shm::tizen_surface_shm(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_surface_shm::tizen_surface_shm() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_surface_shm::~tizen_surface_shm() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_surface_shm::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_surface_shm::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_surface_shm::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_surface_shm::Resource *tizen_surface_shm::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_surface_shm::Resource *tizen_surface_shm::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_surface_shm::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_surface_shm_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_surface_shm::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_surface_shm::interface() + { + return &::tizen_surface_shm_interface; + } + + tizen_surface_shm::Resource *tizen_surface_shm::tizen_surface_shm_allocate() + { + return new Resource; + } + + void tizen_surface_shm::tizen_surface_shm_bind_resource(Resource *) + { + } + + void tizen_surface_shm::tizen_surface_shm_destroy_resource(Resource *) + { + } + + void tizen_surface_shm::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_surface_shm *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_surface_shm::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_surface_shm *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_surface_shm::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_surface_shm *that = resource->tizen_surface_shm_object; + that->m_resource_map.erase(resource->client()); + that->tizen_surface_shm_destroy_resource(resource); + delete resource; + } + + tizen_surface_shm::Resource *tizen_surface_shm::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_surface_shm_interface, version, id); + return bind(handle); + } + + tizen_surface_shm::Resource *tizen_surface_shm::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_surface_shm_allocate(); + resource->tizen_surface_shm_object = this; + + wl_resource_set_implementation(handle, &m_tizen_surface_shm_interface, resource, destroy_func); + resource->handle = handle; + tizen_surface_shm_bind_resource(resource); + return resource; + } + tizen_surface_shm::Resource *tizen_surface_shm::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_surface_shm_interface, &m_tizen_surface_shm_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_surface_shm_interface tizen_surface_shm::m_tizen_surface_shm_interface = { + tizen_surface_shm::handle_get_flusher, + tizen_surface_shm::handle_destroy + }; + + void tizen_surface_shm::tizen_surface_shm_get_flusher(Resource *, uint32_t, struct ::wl_resource *) + { + } + + void tizen_surface_shm::tizen_surface_shm_destroy(Resource *) + { + } + + + void tizen_surface_shm::handle_get_flusher( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_surface_shm_object)->tizen_surface_shm_get_flusher( + r, + id, + surface); + } + + void tizen_surface_shm::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_surface_shm_object)->tizen_surface_shm_destroy( + r); + } + + tizen_surface_shm_flusher::tizen_surface_shm_flusher(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + tizen_surface_shm_flusher::tizen_surface_shm_flusher(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + tizen_surface_shm_flusher::tizen_surface_shm_flusher(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + tizen_surface_shm_flusher::tizen_surface_shm_flusher() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + tizen_surface_shm_flusher::~tizen_surface_shm_flusher() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + tizen_surface_shm_flusher::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void tizen_surface_shm_flusher::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void tizen_surface_shm_flusher::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void tizen_surface_shm_flusher::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::tizen_surface_shm_flusher_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = tizen_surface_shm_flusher::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *tizen_surface_shm_flusher::interface() + { + return &::tizen_surface_shm_flusher_interface; + } + + tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::tizen_surface_shm_flusher_allocate() + { + return new Resource; + } + + void tizen_surface_shm_flusher::tizen_surface_shm_flusher_bind_resource(Resource *) + { + } + + void tizen_surface_shm_flusher::tizen_surface_shm_flusher_destroy_resource(Resource *) + { + } + + void tizen_surface_shm_flusher::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + tizen_surface_shm_flusher *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void tizen_surface_shm_flusher::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + tizen_surface_shm_flusher *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void tizen_surface_shm_flusher::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + tizen_surface_shm_flusher *that = resource->tizen_surface_shm_flusher_object; + that->m_resource_map.erase(resource->client()); + that->tizen_surface_shm_flusher_destroy_resource(resource); + delete resource; + } + + tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_surface_shm_flusher_interface, version, id); + return bind(handle); + } + + tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::bind(struct ::wl_resource *handle) + { + Resource *resource = tizen_surface_shm_flusher_allocate(); + resource->tizen_surface_shm_flusher_object = this; + + wl_resource_set_implementation(handle, &m_tizen_surface_shm_flusher_interface, resource, destroy_func); + resource->handle = handle; + tizen_surface_shm_flusher_bind_resource(resource); + return resource; + } + tizen_surface_shm_flusher::Resource *tizen_surface_shm_flusher::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::tizen_surface_shm_flusher_interface, &m_tizen_surface_shm_flusher_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::tizen_surface_shm_flusher_interface tizen_surface_shm_flusher::m_tizen_surface_shm_flusher_interface = { + tizen_surface_shm_flusher::handle_destroy + }; + + void tizen_surface_shm_flusher::tizen_surface_shm_flusher_destroy(Resource *) + { + } + + + void tizen_surface_shm_flusher::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->tizen_surface_shm_flusher_object)->tizen_surface_shm_flusher_destroy( + r); + } + + void tizen_surface_shm_flusher::send_flush() + { + DS_ASSERT_X(m_resource, "tizen_surface_shm_flusher::flush", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_surface_shm_flusher::flush as it's not initialised"); + return; + } + send_flush( + m_resource->handle); + } + + void tizen_surface_shm_flusher::send_flush(struct ::wl_resource *resource) + { + tizen_surface_shm_flusher_send_flush( + resource); + } + + + void tizen_surface_shm_flusher::send_free_flush() + { + DS_ASSERT_X(m_resource, "tizen_surface_shm_flusher::free_flush", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call tizen_surface_shm_flusher::free_flush as it's not initialised"); + return; + } + send_free_flush( + m_resource->handle); + } + + void tizen_surface_shm_flusher::send_free_flush(struct ::wl_resource *resource) + { + tizen_surface_shm_flusher_send_free_flush( + resource); + } + +} + diff --git a/src/DSWaylandServer/dswayland-server-tizen-surface.h b/src/DSWaylandServer/dswayland-server-tizen-surface.h new file mode 100644 index 0000000..1245b6b --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-tizen-surface.h @@ -0,0 +1,195 @@ +/* Protocol XML file : wayland-extension/tizen-surface.xml */ + +#ifndef __DS_TIZEN_SURFACE_PROTOCOL_H__ +#define __DS_TIZEN_SURFACE_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "tizen-surface-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class tizen_surface_shm + { + public: + tizen_surface_shm(struct ::wl_client *client, int id, int version); + tizen_surface_shm(struct ::wl_display *display, int version); + tizen_surface_shm(struct ::wl_resource *resource); + tizen_surface_shm(); + + virtual ~tizen_surface_shm(); + + class Resource + { + public: + Resource() : tizen_surface_shm_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_surface_shm *tizen_surface_shm_object; + tizen_surface_shm *object() { return tizen_surface_shm_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *tizen_surface_shm_allocate(); + + virtual void tizen_surface_shm_bind_resource(Resource *resource); + virtual void tizen_surface_shm_destroy_resource(Resource *resource); + + virtual void tizen_surface_shm_get_flusher(Resource *resource, uint32_t id, struct ::wl_resource *surface); + virtual void tizen_surface_shm_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_surface_shm_interface m_tizen_surface_shm_interface; + + static void handle_get_flusher( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_surface_shm *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class tizen_surface_shm_flusher + { + public: + tizen_surface_shm_flusher(struct ::wl_client *client, int id, int version); + tizen_surface_shm_flusher(struct ::wl_display *display, int version); + tizen_surface_shm_flusher(struct ::wl_resource *resource); + tizen_surface_shm_flusher(); + + virtual ~tizen_surface_shm_flusher(); + + class Resource + { + public: + Resource() : tizen_surface_shm_flusher_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + tizen_surface_shm_flusher *tizen_surface_shm_flusher_object; + tizen_surface_shm_flusher *object() { return tizen_surface_shm_flusher_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_flush(); + void send_flush(struct ::wl_resource *resource); + void send_free_flush(); + void send_free_flush(struct ::wl_resource *resource); + + protected: + virtual Resource *tizen_surface_shm_flusher_allocate(); + + virtual void tizen_surface_shm_flusher_bind_resource(Resource *resource); + virtual void tizen_surface_shm_flusher_destroy_resource(Resource *resource); + + virtual void tizen_surface_shm_flusher_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::tizen_surface_shm_flusher_interface m_tizen_surface_shm_flusher_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + tizen_surface_shm_flusher *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-transform.cpp b/src/DSWaylandServer/dswayland-server-transform.cpp new file mode 100644 index 0000000..9662754 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-transform.cpp @@ -0,0 +1,406 @@ +/* Protocol XML file : wayland-extension/transform.xml */ + +#include "dswayland-server-transform.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + wl_transform::wl_transform(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_transform::wl_transform(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_transform::wl_transform(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_transform::wl_transform() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_transform::~wl_transform() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_transform::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_transform::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_transform::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_transform::Resource *wl_transform::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_transform::Resource *wl_transform::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_transform::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_transform_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_transform::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_transform::interface() + { + return &::wl_transform_interface; + } + + wl_transform::Resource *wl_transform::transform_allocate() + { + return new Resource; + } + + void wl_transform::transform_bind_resource(Resource *) + { + } + + void wl_transform::transform_destroy_resource(Resource *) + { + } + + void wl_transform::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_transform *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_transform::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_transform *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_transform::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_transform *that = resource->transform_object; + that->m_resource_map.erase(resource->client()); + that->transform_destroy_resource(resource); + delete resource; + } + + wl_transform::Resource *wl_transform::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_transform_interface, version, id); + return bind(handle); + } + + wl_transform::Resource *wl_transform::bind(struct ::wl_resource *handle) + { + Resource *resource = transform_allocate(); + resource->transform_object = this; + + wl_resource_set_implementation(handle, &m_wl_transform_interface, resource, destroy_func); + resource->handle = handle; + transform_bind_resource(resource); + return resource; + } + wl_transform::Resource *wl_transform::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_transform_interface, &m_wl_transform_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_transform_interface wl_transform::m_wl_transform_interface = { + wl_transform::handle_destroy, + wl_transform::handle_get_rotator + }; + + void wl_transform::transform_destroy(Resource *) + { + } + + void wl_transform::transform_get_rotator(Resource *, uint32_t, struct ::wl_resource *) + { + } + + + void wl_transform::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->transform_object)->transform_destroy( + r); + } + + void wl_transform::handle_get_rotator( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->transform_object)->transform_get_rotator( + r, + id, + surface); + } + + wl_rotator::wl_rotator(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_rotator::wl_rotator(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_rotator::wl_rotator(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_rotator::wl_rotator() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_rotator::~wl_rotator() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_rotator::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_rotator::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_rotator::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_rotator::Resource *wl_rotator::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_rotator::Resource *wl_rotator::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_rotator::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_rotator_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_rotator::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_rotator::interface() + { + return &::wl_rotator_interface; + } + + wl_rotator::Resource *wl_rotator::rotator_allocate() + { + return new Resource; + } + + void wl_rotator::rotator_bind_resource(Resource *) + { + } + + void wl_rotator::rotator_destroy_resource(Resource *) + { + } + + void wl_rotator::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_rotator *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_rotator::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_rotator *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_rotator::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_rotator *that = resource->rotator_object; + that->m_resource_map.erase(resource->client()); + that->rotator_destroy_resource(resource); + delete resource; + } + + wl_rotator::Resource *wl_rotator::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_rotator_interface, version, id); + return bind(handle); + } + + wl_rotator::Resource *wl_rotator::bind(struct ::wl_resource *handle) + { + Resource *resource = rotator_allocate(); + resource->rotator_object = this; + + wl_resource_set_implementation(handle, &m_wl_rotator_interface, resource, destroy_func); + resource->handle = handle; + rotator_bind_resource(resource); + return resource; + } + wl_rotator::Resource *wl_rotator::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_rotator_interface, &m_wl_rotator_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_rotator_interface wl_rotator::m_wl_rotator_interface = { + wl_rotator::handle_destroy, + wl_rotator::handle_set, + wl_rotator::handle_unset + }; + + void wl_rotator::rotator_destroy(Resource *) + { + } + + void wl_rotator::rotator_set(Resource *) + { + } + + void wl_rotator::rotator_unset(Resource *) + { + } + + + void wl_rotator::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->rotator_object)->rotator_destroy( + r); + } + + void wl_rotator::handle_set( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->rotator_object)->rotator_set( + r); + } + + void wl_rotator::handle_unset( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->rotator_object)->rotator_unset( + r); + } +} + diff --git a/src/DSWaylandServer/dswayland-server-transform.h b/src/DSWaylandServer/dswayland-server-transform.h new file mode 100644 index 0000000..35b16d8 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-transform.h @@ -0,0 +1,202 @@ +/* Protocol XML file : wayland-extension/transform.xml */ + +#ifndef __DS_TRANSFORM_PROTOCOL_H__ +#define __DS_TRANSFORM_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "transform-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class wl_transform + { + public: + wl_transform(struct ::wl_client *client, int id, int version); + wl_transform(struct ::wl_display *display, int version); + wl_transform(struct ::wl_resource *resource); + wl_transform(); + + virtual ~wl_transform(); + + class Resource + { + public: + Resource() : transform_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_transform *transform_object; + wl_transform *object() { return transform_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *transform_allocate(); + + virtual void transform_bind_resource(Resource *resource); + virtual void transform_destroy_resource(Resource *resource); + + virtual void transform_destroy(Resource *resource); + virtual void transform_get_rotator(Resource *resource, uint32_t id, struct ::wl_resource *surface); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_transform_interface m_wl_transform_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_get_rotator( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_transform *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_rotator + { + public: + wl_rotator(struct ::wl_client *client, int id, int version); + wl_rotator(struct ::wl_display *display, int version); + wl_rotator(struct ::wl_resource *resource); + wl_rotator(); + + virtual ~wl_rotator(); + + class Resource + { + public: + Resource() : rotator_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_rotator *rotator_object; + wl_rotator *object() { return rotator_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_bad_value = 0, // negative or zero values in width or height + }; + + protected: + virtual Resource *rotator_allocate(); + + virtual void rotator_bind_resource(Resource *resource); + virtual void rotator_destroy_resource(Resource *resource); + + virtual void rotator_destroy(Resource *resource); + virtual void rotator_set(Resource *resource); + virtual void rotator_unset(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_rotator_interface m_wl_rotator_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set( + ::wl_client *client, + struct wl_resource *resource); + static void handle_unset( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_rotator *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif diff --git a/src/DSWaylandServer/dswayland-server-wayland.cpp b/src/DSWaylandServer/dswayland-server-wayland.cpp new file mode 100644 index 0000000..108f45d --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-wayland.cpp @@ -0,0 +1,5221 @@ +/* Protocol XML file : wayland/wayland.xml */ + +#include "dswayland-server-wayland.h" + +#ifndef DS_UNLIKELY +#define DS_UNLIKELY(X) X +#endif +#ifndef DS_UNUSED +#define DS_UNUSED(X) X +#endif +#ifndef DS_ASSERT +#define DS_ASSERT(COND) assert(COND) +#endif +#ifndef DS_ASSERT_X +#define DS_ASSERT_X(COND, ERR_TAG, ERR_MSG, X...) \ + do {\ + if (! (COND))\ + {\ + fprintf(stderr, "%s :: "#ERR_MSG, ERR_TAG, ##X);\ + assert(COND);\ + }\ + } while(0) +#endif +#ifndef WRN +#define WRN(X...) fprintf(stderr,##X) +#endif + +namespace DSWaylandServer { + wl_callback::wl_callback(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_callback::wl_callback(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_callback::wl_callback(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_callback::wl_callback() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_callback::~wl_callback() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_callback::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_callback::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_callback::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_callback::Resource *wl_callback::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_callback::Resource *wl_callback::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_callback::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_callback_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_callback::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_callback::interface() + { + return &::wl_callback_interface; + } + + wl_callback::Resource *wl_callback::callback_allocate() + { + return new Resource; + } + + void wl_callback::callback_bind_resource(Resource *) + { + } + + void wl_callback::callback_destroy_resource(Resource *) + { + } + + void wl_callback::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_callback *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_callback::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_callback *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_callback::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_callback *that = resource->callback_object; + that->m_resource_map.erase(resource->client()); + that->callback_destroy_resource(resource); + delete resource; + } + + wl_callback::Resource *wl_callback::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_callback_interface, version, id); + return bind(handle); + } + + wl_callback::Resource *wl_callback::bind(struct ::wl_resource *handle) + { + Resource *resource = callback_allocate(); + resource->callback_object = this; + + wl_resource_set_implementation(handle, NULL, resource, destroy_func); + resource->handle = handle; + callback_bind_resource(resource); + return resource; + } + wl_callback::Resource *wl_callback::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_callback_interface, NULL)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + void wl_callback::send_done(uint32_t callback_data) + { + DS_ASSERT_X(m_resource, "wl_callback::done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_callback::done as it's not initialised"); + return; + } + send_done( + m_resource->handle, + callback_data); + } + + void wl_callback::send_done(struct ::wl_resource *resource, uint32_t callback_data) + { + wl_callback_send_done( + resource, + callback_data); + } + + + wl_compositor::wl_compositor(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_compositor::wl_compositor(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_compositor::wl_compositor(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_compositor::wl_compositor() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_compositor::~wl_compositor() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_compositor::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_compositor::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_compositor::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_compositor::Resource *wl_compositor::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_compositor::Resource *wl_compositor::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_compositor::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_compositor_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_compositor::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_compositor::interface() + { + return &::wl_compositor_interface; + } + + wl_compositor::Resource *wl_compositor::compositor_allocate() + { + return new Resource; + } + + void wl_compositor::compositor_bind_resource(Resource *) + { + } + + void wl_compositor::compositor_destroy_resource(Resource *) + { + } + + void wl_compositor::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_compositor *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_compositor::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_compositor *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_compositor::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_compositor *that = resource->compositor_object; + that->m_resource_map.erase(resource->client()); + that->compositor_destroy_resource(resource); + delete resource; + } + + wl_compositor::Resource *wl_compositor::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_compositor_interface, version, id); + return bind(handle); + } + + wl_compositor::Resource *wl_compositor::bind(struct ::wl_resource *handle) + { + Resource *resource = compositor_allocate(); + resource->compositor_object = this; + + wl_resource_set_implementation(handle, &m_wl_compositor_interface, resource, destroy_func); + resource->handle = handle; + compositor_bind_resource(resource); + return resource; + } + wl_compositor::Resource *wl_compositor::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_compositor_interface, &m_wl_compositor_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_compositor_interface wl_compositor::m_wl_compositor_interface = { + wl_compositor::handle_create_surface, + wl_compositor::handle_create_region + }; + + void wl_compositor::compositor_create_surface(Resource *, uint32_t) + { + } + + void wl_compositor::compositor_create_region(Resource *, uint32_t) + { + } + + + void wl_compositor::handle_create_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->compositor_object)->compositor_create_surface( + r, + id); + } + + void wl_compositor::handle_create_region( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->compositor_object)->compositor_create_region( + r, + id); + } + + wl_shm_pool::wl_shm_pool(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_shm_pool::wl_shm_pool(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_shm_pool::wl_shm_pool(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_shm_pool::wl_shm_pool() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_shm_pool::~wl_shm_pool() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_shm_pool::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_shm_pool::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_shm_pool::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_shm_pool::Resource *wl_shm_pool::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_shm_pool::Resource *wl_shm_pool::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_shm_pool::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_shm_pool_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_shm_pool::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_shm_pool::interface() + { + return &::wl_shm_pool_interface; + } + + wl_shm_pool::Resource *wl_shm_pool::shm_pool_allocate() + { + return new Resource; + } + + void wl_shm_pool::shm_pool_bind_resource(Resource *) + { + } + + void wl_shm_pool::shm_pool_destroy_resource(Resource *) + { + } + + void wl_shm_pool::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_shm_pool *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_shm_pool::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_shm_pool *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_shm_pool::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_shm_pool *that = resource->shm_pool_object; + that->m_resource_map.erase(resource->client()); + that->shm_pool_destroy_resource(resource); + delete resource; + } + + wl_shm_pool::Resource *wl_shm_pool::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_shm_pool_interface, version, id); + return bind(handle); + } + + wl_shm_pool::Resource *wl_shm_pool::bind(struct ::wl_resource *handle) + { + Resource *resource = shm_pool_allocate(); + resource->shm_pool_object = this; + + wl_resource_set_implementation(handle, &m_wl_shm_pool_interface, resource, destroy_func); + resource->handle = handle; + shm_pool_bind_resource(resource); + return resource; + } + wl_shm_pool::Resource *wl_shm_pool::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_shm_pool_interface, &m_wl_shm_pool_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_shm_pool_interface wl_shm_pool::m_wl_shm_pool_interface = { + wl_shm_pool::handle_create_buffer, + wl_shm_pool::handle_destroy, + wl_shm_pool::handle_resize + }; + + void wl_shm_pool::shm_pool_create_buffer(Resource *, uint32_t, int32_t , int32_t , int32_t , int32_t , uint32_t ) + { + } + + void wl_shm_pool::shm_pool_destroy(Resource *) + { + } + + void wl_shm_pool::shm_pool_resize(Resource *, int32_t ) + { + } + + + void wl_shm_pool::handle_create_buffer( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + int32_t offset, + int32_t width, + int32_t height, + int32_t stride, + uint32_t format) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shm_pool_object)->shm_pool_create_buffer( + r, + id, + offset, + width, + height, + stride, + format); + } + + void wl_shm_pool::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shm_pool_object)->shm_pool_destroy( + r); + } + + void wl_shm_pool::handle_resize( + ::wl_client *client, + struct wl_resource *resource, + int32_t size) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shm_pool_object)->shm_pool_resize( + r, + size); + } + + wl_shm::wl_shm(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_shm::wl_shm(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_shm::wl_shm(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_shm::wl_shm() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_shm::~wl_shm() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_shm::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_shm::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_shm::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_shm::Resource *wl_shm::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_shm::Resource *wl_shm::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_shm::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_shm_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_shm::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_shm::interface() + { + return &::wl_shm_interface; + } + + wl_shm::Resource *wl_shm::shm_allocate() + { + return new Resource; + } + + void wl_shm::shm_bind_resource(Resource *) + { + } + + void wl_shm::shm_destroy_resource(Resource *) + { + } + + void wl_shm::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_shm *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_shm::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_shm *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_shm::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_shm *that = resource->shm_object; + that->m_resource_map.erase(resource->client()); + that->shm_destroy_resource(resource); + delete resource; + } + + wl_shm::Resource *wl_shm::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_shm_interface, version, id); + return bind(handle); + } + + wl_shm::Resource *wl_shm::bind(struct ::wl_resource *handle) + { + Resource *resource = shm_allocate(); + resource->shm_object = this; + + wl_resource_set_implementation(handle, &m_wl_shm_interface, resource, destroy_func); + resource->handle = handle; + shm_bind_resource(resource); + return resource; + } + wl_shm::Resource *wl_shm::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_shm_interface, &m_wl_shm_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_shm_interface wl_shm::m_wl_shm_interface = { + wl_shm::handle_create_pool + }; + + void wl_shm::shm_create_pool(Resource *, uint32_t, int32_t , int32_t ) + { + } + + + void wl_shm::handle_create_pool( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + int32_t fd, + int32_t size) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shm_object)->shm_create_pool( + r, + id, + fd, + size); + } + + void wl_shm::send_format(uint32_t format) + { + DS_ASSERT_X(m_resource, "wl_shm::format", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_shm::format as it's not initialised"); + return; + } + send_format( + m_resource->handle, + format); + } + + void wl_shm::send_format(struct ::wl_resource *resource, uint32_t format) + { + wl_shm_send_format( + resource, + format); + } + + + wl_buffer::wl_buffer(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_buffer::wl_buffer(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_buffer::wl_buffer(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_buffer::wl_buffer() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_buffer::~wl_buffer() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_buffer::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_buffer::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_buffer::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_buffer::Resource *wl_buffer::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_buffer::Resource *wl_buffer::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_buffer::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_buffer_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_buffer::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_buffer::interface() + { + return &::wl_buffer_interface; + } + + wl_buffer::Resource *wl_buffer::buffer_allocate() + { + return new Resource; + } + + void wl_buffer::buffer_bind_resource(Resource *) + { + } + + void wl_buffer::buffer_destroy_resource(Resource *) + { + } + + void wl_buffer::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_buffer *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_buffer::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_buffer *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_buffer::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_buffer *that = resource->buffer_object; + that->m_resource_map.erase(resource->client()); + that->buffer_destroy_resource(resource); + delete resource; + } + + wl_buffer::Resource *wl_buffer::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_buffer_interface, version, id); + return bind(handle); + } + + wl_buffer::Resource *wl_buffer::bind(struct ::wl_resource *handle) + { + Resource *resource = buffer_allocate(); + resource->buffer_object = this; + + wl_resource_set_implementation(handle, &m_wl_buffer_interface, resource, destroy_func); + resource->handle = handle; + buffer_bind_resource(resource); + return resource; + } + wl_buffer::Resource *wl_buffer::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_buffer_interface, &m_wl_buffer_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_buffer_interface wl_buffer::m_wl_buffer_interface = { + wl_buffer::handle_destroy + }; + + void wl_buffer::buffer_destroy(Resource *) + { + } + + + void wl_buffer::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->buffer_object)->buffer_destroy( + r); + } + + void wl_buffer::send_release() + { + DS_ASSERT_X(m_resource, "wl_buffer::release", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_buffer::release as it's not initialised"); + return; + } + send_release( + m_resource->handle); + } + + void wl_buffer::send_release(struct ::wl_resource *resource) + { + wl_buffer_send_release( + resource); + } + + + wl_data_offer::wl_data_offer(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_data_offer::wl_data_offer(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_data_offer::wl_data_offer(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_data_offer::wl_data_offer() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_data_offer::~wl_data_offer() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_data_offer::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_data_offer::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_data_offer::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_data_offer::Resource *wl_data_offer::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_data_offer::Resource *wl_data_offer::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_data_offer::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_data_offer_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_data_offer::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_data_offer::interface() + { + return &::wl_data_offer_interface; + } + + wl_data_offer::Resource *wl_data_offer::data_offer_allocate() + { + return new Resource; + } + + void wl_data_offer::data_offer_bind_resource(Resource *) + { + } + + void wl_data_offer::data_offer_destroy_resource(Resource *) + { + } + + void wl_data_offer::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_data_offer *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_data_offer::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_data_offer *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_data_offer::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_data_offer *that = resource->data_offer_object; + that->m_resource_map.erase(resource->client()); + that->data_offer_destroy_resource(resource); + delete resource; + } + + wl_data_offer::Resource *wl_data_offer::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_data_offer_interface, version, id); + return bind(handle); + } + + wl_data_offer::Resource *wl_data_offer::bind(struct ::wl_resource *handle) + { + Resource *resource = data_offer_allocate(); + resource->data_offer_object = this; + + wl_resource_set_implementation(handle, &m_wl_data_offer_interface, resource, destroy_func); + resource->handle = handle; + data_offer_bind_resource(resource); + return resource; + } + wl_data_offer::Resource *wl_data_offer::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_data_offer_interface, &m_wl_data_offer_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_data_offer_interface wl_data_offer::m_wl_data_offer_interface = { + wl_data_offer::handle_accept, + wl_data_offer::handle_receive, + wl_data_offer::handle_destroy, + wl_data_offer::handle_finish, + wl_data_offer::handle_set_actions + }; + + void wl_data_offer::data_offer_accept(Resource *, uint32_t , const std::string &) + { + } + + void wl_data_offer::data_offer_receive(Resource *, const std::string &, int32_t ) + { + } + + void wl_data_offer::data_offer_destroy(Resource *) + { + } + + void wl_data_offer::data_offer_finish(Resource *) + { + } + + void wl_data_offer::data_offer_set_actions(Resource *, uint32_t , uint32_t ) + { + } + + + void wl_data_offer::handle_accept( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *mime_type) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_offer_object)->data_offer_accept( + r, + serial, + std::string(mime_type)); + } + + void wl_data_offer::handle_receive( + ::wl_client *client, + struct wl_resource *resource, + const char *mime_type, + int32_t fd) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_offer_object)->data_offer_receive( + r, + std::string(mime_type), + fd); + } + + void wl_data_offer::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_offer_object)->data_offer_destroy( + r); + } + + void wl_data_offer::handle_finish( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_offer_object)->data_offer_finish( + r); + } + + void wl_data_offer::handle_set_actions( + ::wl_client *client, + struct wl_resource *resource, + uint32_t dnd_actions, + uint32_t preferred_action) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_offer_object)->data_offer_set_actions( + r, + dnd_actions, + preferred_action); + } + + void wl_data_offer::send_offer(const std::string &mime_type) + { + DS_ASSERT_X(m_resource, "wl_data_offer::offer", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_offer::offer as it's not initialised"); + return; + } + send_offer( + m_resource->handle, + mime_type); + } + + void wl_data_offer::send_offer(struct ::wl_resource *resource, const std::string &mime_type) + { + wl_data_offer_send_offer( + resource, + mime_type.c_str()); + } + + + void wl_data_offer::send_source_actions(uint32_t source_actions) + { + DS_ASSERT_X(m_resource, "wl_data_offer::source_actions", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_offer::source_actions as it's not initialised"); + return; + } + send_source_actions( + m_resource->handle, + source_actions); + } + + void wl_data_offer::send_source_actions(struct ::wl_resource *resource, uint32_t source_actions) + { + wl_data_offer_send_source_actions( + resource, + source_actions); + } + + + void wl_data_offer::send_action(uint32_t dnd_action) + { + DS_ASSERT_X(m_resource, "wl_data_offer::action", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_offer::action as it's not initialised"); + return; + } + send_action( + m_resource->handle, + dnd_action); + } + + void wl_data_offer::send_action(struct ::wl_resource *resource, uint32_t dnd_action) + { + wl_data_offer_send_action( + resource, + dnd_action); + } + + + wl_data_source::wl_data_source(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_data_source::wl_data_source(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_data_source::wl_data_source(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_data_source::wl_data_source() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_data_source::~wl_data_source() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_data_source::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_data_source::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_data_source::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_data_source::Resource *wl_data_source::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_data_source::Resource *wl_data_source::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_data_source::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_data_source_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_data_source::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_data_source::interface() + { + return &::wl_data_source_interface; + } + + wl_data_source::Resource *wl_data_source::data_source_allocate() + { + return new Resource; + } + + void wl_data_source::data_source_bind_resource(Resource *) + { + } + + void wl_data_source::data_source_destroy_resource(Resource *) + { + } + + void wl_data_source::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_data_source *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_data_source::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_data_source *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_data_source::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_data_source *that = resource->data_source_object; + that->m_resource_map.erase(resource->client()); + that->data_source_destroy_resource(resource); + delete resource; + } + + wl_data_source::Resource *wl_data_source::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_data_source_interface, version, id); + return bind(handle); + } + + wl_data_source::Resource *wl_data_source::bind(struct ::wl_resource *handle) + { + Resource *resource = data_source_allocate(); + resource->data_source_object = this; + + wl_resource_set_implementation(handle, &m_wl_data_source_interface, resource, destroy_func); + resource->handle = handle; + data_source_bind_resource(resource); + return resource; + } + wl_data_source::Resource *wl_data_source::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_data_source_interface, &m_wl_data_source_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_data_source_interface wl_data_source::m_wl_data_source_interface = { + wl_data_source::handle_offer, + wl_data_source::handle_destroy, + wl_data_source::handle_set_actions + }; + + void wl_data_source::data_source_offer(Resource *, const std::string &) + { + } + + void wl_data_source::data_source_destroy(Resource *) + { + } + + void wl_data_source::data_source_set_actions(Resource *, uint32_t ) + { + } + + + void wl_data_source::handle_offer( + ::wl_client *client, + struct wl_resource *resource, + const char *mime_type) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_source_object)->data_source_offer( + r, + std::string(mime_type)); + } + + void wl_data_source::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_source_object)->data_source_destroy( + r); + } + + void wl_data_source::handle_set_actions( + ::wl_client *client, + struct wl_resource *resource, + uint32_t dnd_actions) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_source_object)->data_source_set_actions( + r, + dnd_actions); + } + + void wl_data_source::send_target(const std::string &mime_type) + { + DS_ASSERT_X(m_resource, "wl_data_source::target", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_source::target as it's not initialised"); + return; + } + send_target( + m_resource->handle, + mime_type); + } + + void wl_data_source::send_target(struct ::wl_resource *resource, const std::string &mime_type) + { + wl_data_source_send_target( + resource, + mime_type.c_str()); + } + + + void wl_data_source::send_send(const std::string &mime_type, int32_t fd) + { + DS_ASSERT_X(m_resource, "wl_data_source::send", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_source::send as it's not initialised"); + return; + } + send_send( + m_resource->handle, + mime_type, + fd); + } + + void wl_data_source::send_send(struct ::wl_resource *resource, const std::string &mime_type, int32_t fd) + { + wl_data_source_send_send( + resource, + mime_type.c_str(), + fd); + } + + + void wl_data_source::send_cancelled() + { + DS_ASSERT_X(m_resource, "wl_data_source::cancelled", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_source::cancelled as it's not initialised"); + return; + } + send_cancelled( + m_resource->handle); + } + + void wl_data_source::send_cancelled(struct ::wl_resource *resource) + { + wl_data_source_send_cancelled( + resource); + } + + + void wl_data_source::send_dnd_drop_performed() + { + DS_ASSERT_X(m_resource, "wl_data_source::dnd_drop_performed", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_source::dnd_drop_performed as it's not initialised"); + return; + } + send_dnd_drop_performed( + m_resource->handle); + } + + void wl_data_source::send_dnd_drop_performed(struct ::wl_resource *resource) + { + wl_data_source_send_dnd_drop_performed( + resource); + } + + + void wl_data_source::send_dnd_finished() + { + DS_ASSERT_X(m_resource, "wl_data_source::dnd_finished", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_source::dnd_finished as it's not initialised"); + return; + } + send_dnd_finished( + m_resource->handle); + } + + void wl_data_source::send_dnd_finished(struct ::wl_resource *resource) + { + wl_data_source_send_dnd_finished( + resource); + } + + + void wl_data_source::send_action(uint32_t dnd_action) + { + DS_ASSERT_X(m_resource, "wl_data_source::action", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_source::action as it's not initialised"); + return; + } + send_action( + m_resource->handle, + dnd_action); + } + + void wl_data_source::send_action(struct ::wl_resource *resource, uint32_t dnd_action) + { + wl_data_source_send_action( + resource, + dnd_action); + } + + + wl_data_device::wl_data_device(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_data_device::wl_data_device(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_data_device::wl_data_device(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_data_device::wl_data_device() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_data_device::~wl_data_device() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_data_device::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_data_device::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_data_device::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_data_device::Resource *wl_data_device::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_data_device::Resource *wl_data_device::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_data_device::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_data_device_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_data_device::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_data_device::interface() + { + return &::wl_data_device_interface; + } + + wl_data_device::Resource *wl_data_device::data_device_allocate() + { + return new Resource; + } + + void wl_data_device::data_device_bind_resource(Resource *) + { + } + + void wl_data_device::data_device_destroy_resource(Resource *) + { + } + + void wl_data_device::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_data_device *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_data_device::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_data_device *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_data_device::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_data_device *that = resource->data_device_object; + that->m_resource_map.erase(resource->client()); + that->data_device_destroy_resource(resource); + delete resource; + } + + wl_data_device::Resource *wl_data_device::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_data_device_interface, version, id); + return bind(handle); + } + + wl_data_device::Resource *wl_data_device::bind(struct ::wl_resource *handle) + { + Resource *resource = data_device_allocate(); + resource->data_device_object = this; + + wl_resource_set_implementation(handle, &m_wl_data_device_interface, resource, destroy_func); + resource->handle = handle; + data_device_bind_resource(resource); + return resource; + } + wl_data_device::Resource *wl_data_device::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_data_device_interface, &m_wl_data_device_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_data_device_interface wl_data_device::m_wl_data_device_interface = { + wl_data_device::handle_start_drag, + wl_data_device::handle_set_selection, + wl_data_device::handle_release + }; + + void wl_data_device::data_device_start_drag(Resource *, struct ::wl_resource *, struct ::wl_resource *, struct ::wl_resource *, uint32_t ) + { + } + + void wl_data_device::data_device_set_selection(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void wl_data_device::data_device_release(Resource *) + { + } + + + void wl_data_device::handle_start_drag( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *source, + struct ::wl_resource *origin, + struct ::wl_resource *icon, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_device_object)->data_device_start_drag( + r, + source, + origin, + icon, + serial); + } + + void wl_data_device::handle_set_selection( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *source, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_device_object)->data_device_set_selection( + r, + source, + serial); + } + + void wl_data_device::handle_release( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_device_object)->data_device_release( + r); + } + + void wl_data_device::send_data_offer(struct ::wl_resource *id) + { + DS_ASSERT_X(m_resource, "wl_data_device::data_offer", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_device::data_offer as it's not initialised"); + return; + } + send_data_offer( + m_resource->handle, + id); + } + + void wl_data_device::send_data_offer(struct ::wl_resource *resource, struct ::wl_resource *id) + { + wl_data_device_send_data_offer( + resource, + id); + } + + + void wl_data_device::send_enter(uint32_t serial, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_resource *id) + { + DS_ASSERT_X(m_resource, "wl_data_device::enter", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_device::enter as it's not initialised"); + return; + } + send_enter( + m_resource->handle, + serial, + surface, + x, + y, + id); + } + + void wl_data_device::send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_resource *id) + { + wl_data_device_send_enter( + resource, + serial, + surface, + x, + y, + id); + } + + + void wl_data_device::send_leave() + { + DS_ASSERT_X(m_resource, "wl_data_device::leave", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_device::leave as it's not initialised"); + return; + } + send_leave( + m_resource->handle); + } + + void wl_data_device::send_leave(struct ::wl_resource *resource) + { + wl_data_device_send_leave( + resource); + } + + + void wl_data_device::send_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) + { + DS_ASSERT_X(m_resource, "wl_data_device::motion", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_device::motion as it's not initialised"); + return; + } + send_motion( + m_resource->handle, + time, + x, + y); + } + + void wl_data_device::send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t x, wl_fixed_t y) + { + wl_data_device_send_motion( + resource, + time, + x, + y); + } + + + void wl_data_device::send_drop() + { + DS_ASSERT_X(m_resource, "wl_data_device::drop", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_device::drop as it's not initialised"); + return; + } + send_drop( + m_resource->handle); + } + + void wl_data_device::send_drop(struct ::wl_resource *resource) + { + wl_data_device_send_drop( + resource); + } + + + void wl_data_device::send_selection(struct ::wl_resource *id) + { + DS_ASSERT_X(m_resource, "wl_data_device::selection", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_data_device::selection as it's not initialised"); + return; + } + send_selection( + m_resource->handle, + id); + } + + void wl_data_device::send_selection(struct ::wl_resource *resource, struct ::wl_resource *id) + { + wl_data_device_send_selection( + resource, + id); + } + + + wl_data_device_manager::wl_data_device_manager(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_data_device_manager::wl_data_device_manager(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_data_device_manager::wl_data_device_manager(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_data_device_manager::wl_data_device_manager() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_data_device_manager::~wl_data_device_manager() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_data_device_manager::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_data_device_manager::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_data_device_manager::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_data_device_manager::Resource *wl_data_device_manager::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_data_device_manager::Resource *wl_data_device_manager::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_data_device_manager::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_data_device_manager_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_data_device_manager::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_data_device_manager::interface() + { + return &::wl_data_device_manager_interface; + } + + wl_data_device_manager::Resource *wl_data_device_manager::data_device_manager_allocate() + { + return new Resource; + } + + void wl_data_device_manager::data_device_manager_bind_resource(Resource *) + { + } + + void wl_data_device_manager::data_device_manager_destroy_resource(Resource *) + { + } + + void wl_data_device_manager::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_data_device_manager *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_data_device_manager::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_data_device_manager *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_data_device_manager::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_data_device_manager *that = resource->data_device_manager_object; + that->m_resource_map.erase(resource->client()); + that->data_device_manager_destroy_resource(resource); + delete resource; + } + + wl_data_device_manager::Resource *wl_data_device_manager::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_data_device_manager_interface, version, id); + return bind(handle); + } + + wl_data_device_manager::Resource *wl_data_device_manager::bind(struct ::wl_resource *handle) + { + Resource *resource = data_device_manager_allocate(); + resource->data_device_manager_object = this; + + wl_resource_set_implementation(handle, &m_wl_data_device_manager_interface, resource, destroy_func); + resource->handle = handle; + data_device_manager_bind_resource(resource); + return resource; + } + wl_data_device_manager::Resource *wl_data_device_manager::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_data_device_manager_interface, &m_wl_data_device_manager_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_data_device_manager_interface wl_data_device_manager::m_wl_data_device_manager_interface = { + wl_data_device_manager::handle_create_data_source, + wl_data_device_manager::handle_get_data_device + }; + + void wl_data_device_manager::data_device_manager_create_data_source(Resource *, uint32_t) + { + } + + void wl_data_device_manager::data_device_manager_get_data_device(Resource *, uint32_t, struct ::wl_resource *) + { + } + + + void wl_data_device_manager::handle_create_data_source( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_device_manager_object)->data_device_manager_create_data_source( + r, + id); + } + + void wl_data_device_manager::handle_get_data_device( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *seat) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->data_device_manager_object)->data_device_manager_get_data_device( + r, + id, + seat); + } + + wl_shell::wl_shell(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_shell::wl_shell(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_shell::wl_shell(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_shell::wl_shell() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_shell::~wl_shell() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_shell::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_shell::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_shell::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_shell::Resource *wl_shell::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_shell::Resource *wl_shell::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_shell::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_shell_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_shell::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_shell::interface() + { + return &::wl_shell_interface; + } + + wl_shell::Resource *wl_shell::shell_allocate() + { + return new Resource; + } + + void wl_shell::shell_bind_resource(Resource *) + { + } + + void wl_shell::shell_destroy_resource(Resource *) + { + } + + void wl_shell::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_shell *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_shell::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_shell *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_shell::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_shell *that = resource->shell_object; + that->m_resource_map.erase(resource->client()); + that->shell_destroy_resource(resource); + delete resource; + } + + wl_shell::Resource *wl_shell::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_shell_interface, version, id); + return bind(handle); + } + + wl_shell::Resource *wl_shell::bind(struct ::wl_resource *handle) + { + Resource *resource = shell_allocate(); + resource->shell_object = this; + + wl_resource_set_implementation(handle, &m_wl_shell_interface, resource, destroy_func); + resource->handle = handle; + shell_bind_resource(resource); + return resource; + } + wl_shell::Resource *wl_shell::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_shell_interface, &m_wl_shell_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_shell_interface wl_shell::m_wl_shell_interface = { + wl_shell::handle_get_shell_surface + }; + + void wl_shell::shell_get_shell_surface(Resource *, uint32_t, struct ::wl_resource *) + { + } + + + void wl_shell::handle_get_shell_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_object)->shell_get_shell_surface( + r, + id, + surface); + } + + wl_shell_surface::wl_shell_surface(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_shell_surface::wl_shell_surface(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_shell_surface::wl_shell_surface(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_shell_surface::wl_shell_surface() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_shell_surface::~wl_shell_surface() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_shell_surface::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_shell_surface::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_shell_surface::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_shell_surface::Resource *wl_shell_surface::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_shell_surface::Resource *wl_shell_surface::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_shell_surface::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_shell_surface_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_shell_surface::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_shell_surface::interface() + { + return &::wl_shell_surface_interface; + } + + wl_shell_surface::Resource *wl_shell_surface::shell_surface_allocate() + { + return new Resource; + } + + void wl_shell_surface::shell_surface_bind_resource(Resource *) + { + } + + void wl_shell_surface::shell_surface_destroy_resource(Resource *) + { + } + + void wl_shell_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_shell_surface *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_shell_surface::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_shell_surface *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_shell_surface::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_shell_surface *that = resource->shell_surface_object; + that->m_resource_map.erase(resource->client()); + that->shell_surface_destroy_resource(resource); + delete resource; + } + + wl_shell_surface::Resource *wl_shell_surface::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_shell_surface_interface, version, id); + return bind(handle); + } + + wl_shell_surface::Resource *wl_shell_surface::bind(struct ::wl_resource *handle) + { + Resource *resource = shell_surface_allocate(); + resource->shell_surface_object = this; + + wl_resource_set_implementation(handle, &m_wl_shell_surface_interface, resource, destroy_func); + resource->handle = handle; + shell_surface_bind_resource(resource); + return resource; + } + wl_shell_surface::Resource *wl_shell_surface::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_shell_surface_interface, &m_wl_shell_surface_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_shell_surface_interface wl_shell_surface::m_wl_shell_surface_interface = { + wl_shell_surface::handle_pong, + wl_shell_surface::handle_move, + wl_shell_surface::handle_resize, + wl_shell_surface::handle_set_toplevel, + wl_shell_surface::handle_set_transient, + wl_shell_surface::handle_set_fullscreen, + wl_shell_surface::handle_set_popup, + wl_shell_surface::handle_set_maximized, + wl_shell_surface::handle_set_title, + wl_shell_surface::handle_set_class + }; + + void wl_shell_surface::shell_surface_pong(Resource *, uint32_t ) + { + } + + void wl_shell_surface::shell_surface_move(Resource *, struct ::wl_resource *, uint32_t ) + { + } + + void wl_shell_surface::shell_surface_resize(Resource *, struct ::wl_resource *, uint32_t , uint32_t ) + { + } + + void wl_shell_surface::shell_surface_set_toplevel(Resource *) + { + } + + void wl_shell_surface::shell_surface_set_transient(Resource *, struct ::wl_resource *, int32_t , int32_t , uint32_t ) + { + } + + void wl_shell_surface::shell_surface_set_fullscreen(Resource *, uint32_t , uint32_t , struct ::wl_resource *) + { + } + + void wl_shell_surface::shell_surface_set_popup(Resource *, struct ::wl_resource *, uint32_t , struct ::wl_resource *, int32_t , int32_t , uint32_t ) + { + } + + void wl_shell_surface::shell_surface_set_maximized(Resource *, struct ::wl_resource *) + { + } + + void wl_shell_surface::shell_surface_set_title(Resource *, const std::string &) + { + } + + void wl_shell_surface::shell_surface_set_class(Resource *, const std::string &) + { + } + + + void wl_shell_surface::handle_pong( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_pong( + r, + serial); + } + + void wl_shell_surface::handle_move( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat, + uint32_t serial) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_move( + r, + seat, + serial); + } + + void wl_shell_surface::handle_resize( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat, + uint32_t serial, + uint32_t edges) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_resize( + r, + seat, + serial, + edges); + } + + void wl_shell_surface::handle_set_toplevel( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_set_toplevel( + r); + } + + void wl_shell_surface::handle_set_transient( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *parent, + int32_t x, + int32_t y, + uint32_t flags) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_set_transient( + r, + parent, + x, + y, + flags); + } + + void wl_shell_surface::handle_set_fullscreen( + ::wl_client *client, + struct wl_resource *resource, + uint32_t method, + uint32_t framerate, + struct ::wl_resource *output) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_set_fullscreen( + r, + method, + framerate, + output); + } + + void wl_shell_surface::handle_set_popup( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat, + uint32_t serial, + struct ::wl_resource *parent, + int32_t x, + int32_t y, + uint32_t flags) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_set_popup( + r, + seat, + serial, + parent, + x, + y, + flags); + } + + void wl_shell_surface::handle_set_maximized( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_set_maximized( + r, + output); + } + + void wl_shell_surface::handle_set_title( + ::wl_client *client, + struct wl_resource *resource, + const char *title) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_set_title( + r, + std::string(title)); + } + + void wl_shell_surface::handle_set_class( + ::wl_client *client, + struct wl_resource *resource, + const char *class_) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->shell_surface_object)->shell_surface_set_class( + r, + std::string(class_)); + } + + void wl_shell_surface::send_ping(uint32_t serial) + { + DS_ASSERT_X(m_resource, "wl_shell_surface::ping", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_shell_surface::ping as it's not initialised"); + return; + } + send_ping( + m_resource->handle, + serial); + } + + void wl_shell_surface::send_ping(struct ::wl_resource *resource, uint32_t serial) + { + wl_shell_surface_send_ping( + resource, + serial); + } + + + void wl_shell_surface::send_configure(uint32_t edges, int32_t width, int32_t height) + { + DS_ASSERT_X(m_resource, "wl_shell_surface::configure", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_shell_surface::configure as it's not initialised"); + return; + } + send_configure( + m_resource->handle, + edges, + width, + height); + } + + void wl_shell_surface::send_configure(struct ::wl_resource *resource, uint32_t edges, int32_t width, int32_t height) + { + wl_shell_surface_send_configure( + resource, + edges, + width, + height); + } + + + void wl_shell_surface::send_popup_done() + { + DS_ASSERT_X(m_resource, "wl_shell_surface::popup_done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_shell_surface::popup_done as it's not initialised"); + return; + } + send_popup_done( + m_resource->handle); + } + + void wl_shell_surface::send_popup_done(struct ::wl_resource *resource) + { + wl_shell_surface_send_popup_done( + resource); + } + + + wl_surface::wl_surface(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_surface::wl_surface(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_surface::wl_surface(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_surface::wl_surface() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_surface::~wl_surface() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_surface::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_surface::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_surface::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_surface::Resource *wl_surface::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_surface::Resource *wl_surface::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_surface::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_surface_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_surface::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_surface::interface() + { + return &::wl_surface_interface; + } + + wl_surface::Resource *wl_surface::surface_allocate() + { + return new Resource; + } + + void wl_surface::surface_bind_resource(Resource *) + { + } + + void wl_surface::surface_destroy_resource(Resource *) + { + } + + void wl_surface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_surface *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_surface::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_surface *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_surface::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_surface *that = resource->surface_object; + that->m_resource_map.erase(resource->client()); + that->surface_destroy_resource(resource); + delete resource; + } + + wl_surface::Resource *wl_surface::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_surface_interface, version, id); + return bind(handle); + } + + wl_surface::Resource *wl_surface::bind(struct ::wl_resource *handle) + { + Resource *resource = surface_allocate(); + resource->surface_object = this; + + wl_resource_set_implementation(handle, &m_wl_surface_interface, resource, destroy_func); + resource->handle = handle; + surface_bind_resource(resource); + return resource; + } + wl_surface::Resource *wl_surface::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_surface_interface, &m_wl_surface_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_surface_interface wl_surface::m_wl_surface_interface = { + wl_surface::handle_destroy, + wl_surface::handle_attach, + wl_surface::handle_damage, + wl_surface::handle_frame, + wl_surface::handle_set_opaque_region, + wl_surface::handle_set_input_region, + wl_surface::handle_commit, + wl_surface::handle_set_buffer_transform, + wl_surface::handle_set_buffer_scale, + wl_surface::handle_damage_buffer + }; + + void wl_surface::surface_destroy(Resource *) + { + } + + void wl_surface::surface_attach(Resource *, struct ::wl_resource *, int32_t , int32_t ) + { + } + + void wl_surface::surface_damage(Resource *, int32_t , int32_t , int32_t , int32_t ) + { + } + + void wl_surface::surface_frame(Resource *, uint32_t) + { + } + + void wl_surface::surface_set_opaque_region(Resource *, struct ::wl_resource *) + { + } + + void wl_surface::surface_set_input_region(Resource *, struct ::wl_resource *) + { + } + + void wl_surface::surface_commit(Resource *) + { + } + + void wl_surface::surface_set_buffer_transform(Resource *, int32_t ) + { + } + + void wl_surface::surface_set_buffer_scale(Resource *, int32_t ) + { + } + + void wl_surface::surface_damage_buffer(Resource *, int32_t , int32_t , int32_t , int32_t ) + { + } + + + void wl_surface::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_destroy( + r); + } + + void wl_surface::handle_attach( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *buffer, + int32_t x, + int32_t y) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_attach( + r, + buffer, + x, + y); + } + + void wl_surface::handle_damage( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_damage( + r, + x, + y, + width, + height); + } + + void wl_surface::handle_frame( + ::wl_client *client, + struct wl_resource *resource, + uint32_t callback) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_frame( + r, + callback); + } + + void wl_surface::handle_set_opaque_region( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *region) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_set_opaque_region( + r, + region); + } + + void wl_surface::handle_set_input_region( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *region) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_set_input_region( + r, + region); + } + + void wl_surface::handle_commit( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_commit( + r); + } + + void wl_surface::handle_set_buffer_transform( + ::wl_client *client, + struct wl_resource *resource, + int32_t transform) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_set_buffer_transform( + r, + transform); + } + + void wl_surface::handle_set_buffer_scale( + ::wl_client *client, + struct wl_resource *resource, + int32_t scale) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_set_buffer_scale( + r, + scale); + } + + void wl_surface::handle_damage_buffer( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->surface_object)->surface_damage_buffer( + r, + x, + y, + width, + height); + } + + void wl_surface::send_enter(struct ::wl_resource *output) + { + DS_ASSERT_X(m_resource, "wl_surface::enter", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_surface::enter as it's not initialised"); + return; + } + send_enter( + m_resource->handle, + output); + } + + void wl_surface::send_enter(struct ::wl_resource *resource, struct ::wl_resource *output) + { + wl_surface_send_enter( + resource, + output); + } + + + void wl_surface::send_leave(struct ::wl_resource *output) + { + DS_ASSERT_X(m_resource, "wl_surface::leave", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_surface::leave as it's not initialised"); + return; + } + send_leave( + m_resource->handle, + output); + } + + void wl_surface::send_leave(struct ::wl_resource *resource, struct ::wl_resource *output) + { + wl_surface_send_leave( + resource, + output); + } + + + wl_seat::wl_seat(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_seat::wl_seat(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_seat::wl_seat(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_seat::wl_seat() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_seat::~wl_seat() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_seat::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_seat::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_seat::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_seat::Resource *wl_seat::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_seat::Resource *wl_seat::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_seat::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_seat_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_seat::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_seat::interface() + { + return &::wl_seat_interface; + } + + wl_seat::Resource *wl_seat::seat_allocate() + { + return new Resource; + } + + void wl_seat::seat_bind_resource(Resource *) + { + } + + void wl_seat::seat_destroy_resource(Resource *) + { + } + + void wl_seat::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_seat *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_seat::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_seat *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_seat::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_seat *that = resource->seat_object; + that->m_resource_map.erase(resource->client()); + that->seat_destroy_resource(resource); + delete resource; + } + + wl_seat::Resource *wl_seat::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_seat_interface, version, id); + return bind(handle); + } + + wl_seat::Resource *wl_seat::bind(struct ::wl_resource *handle) + { + Resource *resource = seat_allocate(); + resource->seat_object = this; + + wl_resource_set_implementation(handle, &m_wl_seat_interface, resource, destroy_func); + resource->handle = handle; + seat_bind_resource(resource); + return resource; + } + wl_seat::Resource *wl_seat::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_seat_interface, &m_wl_seat_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_seat_interface wl_seat::m_wl_seat_interface = { + wl_seat::handle_get_pointer, + wl_seat::handle_get_keyboard, + wl_seat::handle_get_touch, + wl_seat::handle_release + }; + + void wl_seat::seat_get_pointer(Resource *, uint32_t) + { + } + + void wl_seat::seat_get_keyboard(Resource *, uint32_t) + { + } + + void wl_seat::seat_get_touch(Resource *, uint32_t) + { + } + + void wl_seat::seat_release(Resource *) + { + } + + + void wl_seat::handle_get_pointer( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->seat_object)->seat_get_pointer( + r, + id); + } + + void wl_seat::handle_get_keyboard( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->seat_object)->seat_get_keyboard( + r, + id); + } + + void wl_seat::handle_get_touch( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->seat_object)->seat_get_touch( + r, + id); + } + + void wl_seat::handle_release( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->seat_object)->seat_release( + r); + } + + void wl_seat::send_capabilities(uint32_t capabilities) + { + DS_ASSERT_X(m_resource, "wl_seat::capabilities", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_seat::capabilities as it's not initialised"); + return; + } + send_capabilities( + m_resource->handle, + capabilities); + } + + void wl_seat::send_capabilities(struct ::wl_resource *resource, uint32_t capabilities) + { + wl_seat_send_capabilities( + resource, + capabilities); + } + + + void wl_seat::send_name(const std::string &name) + { + DS_ASSERT_X(m_resource, "wl_seat::name", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_seat::name as it's not initialised"); + return; + } + send_name( + m_resource->handle, + name); + } + + void wl_seat::send_name(struct ::wl_resource *resource, const std::string &name) + { + wl_seat_send_name( + resource, + name.c_str()); + } + + + wl_pointer::wl_pointer(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_pointer::wl_pointer(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_pointer::wl_pointer(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_pointer::wl_pointer() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_pointer::~wl_pointer() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_pointer::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_pointer::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_pointer::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_pointer::Resource *wl_pointer::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_pointer::Resource *wl_pointer::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_pointer::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_pointer_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_pointer::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_pointer::interface() + { + return &::wl_pointer_interface; + } + + wl_pointer::Resource *wl_pointer::pointer_allocate() + { + return new Resource; + } + + void wl_pointer::pointer_bind_resource(Resource *) + { + } + + void wl_pointer::pointer_destroy_resource(Resource *) + { + } + + void wl_pointer::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_pointer *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_pointer::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_pointer *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_pointer::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_pointer *that = resource->pointer_object; + that->m_resource_map.erase(resource->client()); + that->pointer_destroy_resource(resource); + delete resource; + } + + wl_pointer::Resource *wl_pointer::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_pointer_interface, version, id); + return bind(handle); + } + + wl_pointer::Resource *wl_pointer::bind(struct ::wl_resource *handle) + { + Resource *resource = pointer_allocate(); + resource->pointer_object = this; + + wl_resource_set_implementation(handle, &m_wl_pointer_interface, resource, destroy_func); + resource->handle = handle; + pointer_bind_resource(resource); + return resource; + } + wl_pointer::Resource *wl_pointer::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_pointer_interface, &m_wl_pointer_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_pointer_interface wl_pointer::m_wl_pointer_interface = { + wl_pointer::handle_set_cursor, + wl_pointer::handle_release + }; + + void wl_pointer::pointer_set_cursor(Resource *, uint32_t , struct ::wl_resource *, int32_t , int32_t ) + { + } + + void wl_pointer::pointer_release(Resource *) + { + } + + + void wl_pointer::handle_set_cursor( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + struct ::wl_resource *surface, + int32_t hotspot_x, + int32_t hotspot_y) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->pointer_object)->pointer_set_cursor( + r, + serial, + surface, + hotspot_x, + hotspot_y); + } + + void wl_pointer::handle_release( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->pointer_object)->pointer_release( + r); + } + + void wl_pointer::send_enter(uint32_t serial, struct ::wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y) + { + DS_ASSERT_X(m_resource, "wl_pointer::enter", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::enter as it's not initialised"); + return; + } + send_enter( + m_resource->handle, + serial, + surface, + surface_x, + surface_y); + } + + void wl_pointer::send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y) + { + wl_pointer_send_enter( + resource, + serial, + surface, + surface_x, + surface_y); + } + + + void wl_pointer::send_leave(uint32_t serial, struct ::wl_resource *surface) + { + DS_ASSERT_X(m_resource, "wl_pointer::leave", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::leave as it's not initialised"); + return; + } + send_leave( + m_resource->handle, + serial, + surface); + } + + void wl_pointer::send_leave(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface) + { + wl_pointer_send_leave( + resource, + serial, + surface); + } + + + void wl_pointer::send_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) + { + DS_ASSERT_X(m_resource, "wl_pointer::motion", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::motion as it's not initialised"); + return; + } + send_motion( + m_resource->handle, + time, + surface_x, + surface_y); + } + + void wl_pointer::send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) + { + wl_pointer_send_motion( + resource, + time, + surface_x, + surface_y); + } + + + void wl_pointer::send_button(uint32_t serial, uint32_t time, uint32_t button, uint32_t state) + { + DS_ASSERT_X(m_resource, "wl_pointer::button", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::button as it's not initialised"); + return; + } + send_button( + m_resource->handle, + serial, + time, + button, + state); + } + + void wl_pointer::send_button(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t button, uint32_t state) + { + wl_pointer_send_button( + resource, + serial, + time, + button, + state); + } + + + void wl_pointer::send_axis(uint32_t time, uint32_t axis, wl_fixed_t value) + { + DS_ASSERT_X(m_resource, "wl_pointer::axis", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::axis as it's not initialised"); + return; + } + send_axis( + m_resource->handle, + time, + axis, + value); + } + + void wl_pointer::send_axis(struct ::wl_resource *resource, uint32_t time, uint32_t axis, wl_fixed_t value) + { + wl_pointer_send_axis( + resource, + time, + axis, + value); + } + + + void wl_pointer::send_frame() + { + DS_ASSERT_X(m_resource, "wl_pointer::frame", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::frame as it's not initialised"); + return; + } + send_frame( + m_resource->handle); + } + + void wl_pointer::send_frame(struct ::wl_resource *resource) + { + wl_pointer_send_frame( + resource); + } + + + void wl_pointer::send_axis_source(uint32_t axis_source) + { + DS_ASSERT_X(m_resource, "wl_pointer::axis_source", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::axis_source as it's not initialised"); + return; + } + send_axis_source( + m_resource->handle, + axis_source); + } + + void wl_pointer::send_axis_source(struct ::wl_resource *resource, uint32_t axis_source) + { + wl_pointer_send_axis_source( + resource, + axis_source); + } + + + void wl_pointer::send_axis_stop(uint32_t time, uint32_t axis) + { + DS_ASSERT_X(m_resource, "wl_pointer::axis_stop", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::axis_stop as it's not initialised"); + return; + } + send_axis_stop( + m_resource->handle, + time, + axis); + } + + void wl_pointer::send_axis_stop(struct ::wl_resource *resource, uint32_t time, uint32_t axis) + { + wl_pointer_send_axis_stop( + resource, + time, + axis); + } + + + void wl_pointer::send_axis_discrete(uint32_t axis, int32_t discrete) + { + DS_ASSERT_X(m_resource, "wl_pointer::axis_discrete", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_pointer::axis_discrete as it's not initialised"); + return; + } + send_axis_discrete( + m_resource->handle, + axis, + discrete); + } + + void wl_pointer::send_axis_discrete(struct ::wl_resource *resource, uint32_t axis, int32_t discrete) + { + wl_pointer_send_axis_discrete( + resource, + axis, + discrete); + } + + + wl_keyboard::wl_keyboard(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_keyboard::wl_keyboard(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_keyboard::wl_keyboard(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_keyboard::wl_keyboard() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_keyboard::~wl_keyboard() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_keyboard::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_keyboard::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_keyboard::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_keyboard::Resource *wl_keyboard::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_keyboard::Resource *wl_keyboard::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_keyboard::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_keyboard_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_keyboard::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_keyboard::interface() + { + return &::wl_keyboard_interface; + } + + wl_keyboard::Resource *wl_keyboard::keyboard_allocate() + { + return new Resource; + } + + void wl_keyboard::keyboard_bind_resource(Resource *) + { + } + + void wl_keyboard::keyboard_destroy_resource(Resource *) + { + } + + void wl_keyboard::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_keyboard *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_keyboard::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_keyboard *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_keyboard::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_keyboard *that = resource->keyboard_object; + that->m_resource_map.erase(resource->client()); + that->keyboard_destroy_resource(resource); + delete resource; + } + + wl_keyboard::Resource *wl_keyboard::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_keyboard_interface, version, id); + return bind(handle); + } + + wl_keyboard::Resource *wl_keyboard::bind(struct ::wl_resource *handle) + { + Resource *resource = keyboard_allocate(); + resource->keyboard_object = this; + + wl_resource_set_implementation(handle, &m_wl_keyboard_interface, resource, destroy_func); + resource->handle = handle; + keyboard_bind_resource(resource); + return resource; + } + wl_keyboard::Resource *wl_keyboard::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_keyboard_interface, &m_wl_keyboard_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_keyboard_interface wl_keyboard::m_wl_keyboard_interface = { + wl_keyboard::handle_release + }; + + void wl_keyboard::keyboard_release(Resource *) + { + } + + + void wl_keyboard::handle_release( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->keyboard_object)->keyboard_release( + r); + } + + void wl_keyboard::send_keymap(uint32_t format, int32_t fd, uint32_t size) + { + DS_ASSERT_X(m_resource, "wl_keyboard::keymap", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_keyboard::keymap as it's not initialised"); + return; + } + send_keymap( + m_resource->handle, + format, + fd, + size); + } + + void wl_keyboard::send_keymap(struct ::wl_resource *resource, uint32_t format, int32_t fd, uint32_t size) + { + wl_keyboard_send_keymap( + resource, + format, + fd, + size); + } + + + void wl_keyboard::send_enter(uint32_t serial, struct ::wl_resource *surface, const std::string &keys) + { + DS_ASSERT_X(m_resource, "wl_keyboard::enter", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_keyboard::enter as it's not initialised"); + return; + } + send_enter( + m_resource->handle, + serial, + surface, + keys); + } + + void wl_keyboard::send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, const std::string &keys) + { + struct wl_array keys_data; + keys_data.size = keys.size(); + keys_data.data = static_cast(const_cast(keys.c_str())); + keys_data.alloc = 0; + + wl_keyboard_send_enter( + resource, + serial, + surface, + &keys_data); + } + + + void wl_keyboard::send_leave(uint32_t serial, struct ::wl_resource *surface) + { + DS_ASSERT_X(m_resource, "wl_keyboard::leave", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_keyboard::leave as it's not initialised"); + return; + } + send_leave( + m_resource->handle, + serial, + surface); + } + + void wl_keyboard::send_leave(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface) + { + wl_keyboard_send_leave( + resource, + serial, + surface); + } + + + void wl_keyboard::send_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) + { + DS_ASSERT_X(m_resource, "wl_keyboard::key", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_keyboard::key as it's not initialised"); + return; + } + send_key( + m_resource->handle, + serial, + time, + key, + state); + } + + void wl_keyboard::send_key(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) + { + wl_keyboard_send_key( + resource, + serial, + time, + key, + state); + } + + + void wl_keyboard::send_modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) + { + DS_ASSERT_X(m_resource, "wl_keyboard::modifiers", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_keyboard::modifiers as it's not initialised"); + return; + } + send_modifiers( + m_resource->handle, + serial, + mods_depressed, + mods_latched, + mods_locked, + group); + } + + void wl_keyboard::send_modifiers(struct ::wl_resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) + { + wl_keyboard_send_modifiers( + resource, + serial, + mods_depressed, + mods_latched, + mods_locked, + group); + } + + + void wl_keyboard::send_repeat_info(int32_t rate, int32_t delay) + { + DS_ASSERT_X(m_resource, "wl_keyboard::repeat_info", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_keyboard::repeat_info as it's not initialised"); + return; + } + send_repeat_info( + m_resource->handle, + rate, + delay); + } + + void wl_keyboard::send_repeat_info(struct ::wl_resource *resource, int32_t rate, int32_t delay) + { + wl_keyboard_send_repeat_info( + resource, + rate, + delay); + } + + + wl_touch::wl_touch(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_touch::wl_touch(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_touch::wl_touch(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_touch::wl_touch() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_touch::~wl_touch() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_touch::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_touch::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_touch::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_touch::Resource *wl_touch::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_touch::Resource *wl_touch::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_touch::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_touch_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_touch::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_touch::interface() + { + return &::wl_touch_interface; + } + + wl_touch::Resource *wl_touch::touch_allocate() + { + return new Resource; + } + + void wl_touch::touch_bind_resource(Resource *) + { + } + + void wl_touch::touch_destroy_resource(Resource *) + { + } + + void wl_touch::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_touch *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_touch::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_touch *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_touch::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_touch *that = resource->touch_object; + that->m_resource_map.erase(resource->client()); + that->touch_destroy_resource(resource); + delete resource; + } + + wl_touch::Resource *wl_touch::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_touch_interface, version, id); + return bind(handle); + } + + wl_touch::Resource *wl_touch::bind(struct ::wl_resource *handle) + { + Resource *resource = touch_allocate(); + resource->touch_object = this; + + wl_resource_set_implementation(handle, &m_wl_touch_interface, resource, destroy_func); + resource->handle = handle; + touch_bind_resource(resource); + return resource; + } + wl_touch::Resource *wl_touch::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_touch_interface, &m_wl_touch_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_touch_interface wl_touch::m_wl_touch_interface = { + wl_touch::handle_release + }; + + void wl_touch::touch_release(Resource *) + { + } + + + void wl_touch::handle_release( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->touch_object)->touch_release( + r); + } + + void wl_touch::send_down(uint32_t serial, uint32_t time, struct ::wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y) + { + DS_ASSERT_X(m_resource, "wl_touch::down", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_touch::down as it's not initialised"); + return; + } + send_down( + m_resource->handle, + serial, + time, + surface, + id, + x, + y); + } + + void wl_touch::send_down(struct ::wl_resource *resource, uint32_t serial, uint32_t time, struct ::wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y) + { + wl_touch_send_down( + resource, + serial, + time, + surface, + id, + x, + y); + } + + + void wl_touch::send_up(uint32_t serial, uint32_t time, int32_t id) + { + DS_ASSERT_X(m_resource, "wl_touch::up", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_touch::up as it's not initialised"); + return; + } + send_up( + m_resource->handle, + serial, + time, + id); + } + + void wl_touch::send_up(struct ::wl_resource *resource, uint32_t serial, uint32_t time, int32_t id) + { + wl_touch_send_up( + resource, + serial, + time, + id); + } + + + void wl_touch::send_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) + { + DS_ASSERT_X(m_resource, "wl_touch::motion", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_touch::motion as it's not initialised"); + return; + } + send_motion( + m_resource->handle, + time, + id, + x, + y); + } + + void wl_touch::send_motion(struct ::wl_resource *resource, uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) + { + wl_touch_send_motion( + resource, + time, + id, + x, + y); + } + + + void wl_touch::send_frame() + { + DS_ASSERT_X(m_resource, "wl_touch::frame", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_touch::frame as it's not initialised"); + return; + } + send_frame( + m_resource->handle); + } + + void wl_touch::send_frame(struct ::wl_resource *resource) + { + wl_touch_send_frame( + resource); + } + + + void wl_touch::send_cancel() + { + DS_ASSERT_X(m_resource, "wl_touch::cancel", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_touch::cancel as it's not initialised"); + return; + } + send_cancel( + m_resource->handle); + } + + void wl_touch::send_cancel(struct ::wl_resource *resource) + { + wl_touch_send_cancel( + resource); + } + + + void wl_touch::send_shape(int32_t id, wl_fixed_t major, wl_fixed_t minor) + { + DS_ASSERT_X(m_resource, "wl_touch::shape", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_touch::shape as it's not initialised"); + return; + } + send_shape( + m_resource->handle, + id, + major, + minor); + } + + void wl_touch::send_shape(struct ::wl_resource *resource, int32_t id, wl_fixed_t major, wl_fixed_t minor) + { + wl_touch_send_shape( + resource, + id, + major, + minor); + } + + + void wl_touch::send_orientation(int32_t id, wl_fixed_t orientation) + { + DS_ASSERT_X(m_resource, "wl_touch::orientation", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_touch::orientation as it's not initialised"); + return; + } + send_orientation( + m_resource->handle, + id, + orientation); + } + + void wl_touch::send_orientation(struct ::wl_resource *resource, int32_t id, wl_fixed_t orientation) + { + wl_touch_send_orientation( + resource, + id, + orientation); + } + + + wl_output::wl_output(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_output::wl_output(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_output::wl_output(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_output::wl_output() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_output::~wl_output() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_output::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_output::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_output::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_output::Resource *wl_output::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_output::Resource *wl_output::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_output::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_output_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_output::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_output::interface() + { + return &::wl_output_interface; + } + + wl_output::Resource *wl_output::output_allocate() + { + return new Resource; + } + + void wl_output::output_bind_resource(Resource *) + { + } + + void wl_output::output_destroy_resource(Resource *) + { + } + + void wl_output::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_output *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_output::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_output *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_output::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_output *that = resource->output_object; + that->m_resource_map.erase(resource->client()); + that->output_destroy_resource(resource); + delete resource; + } + + wl_output::Resource *wl_output::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_output_interface, version, id); + return bind(handle); + } + + wl_output::Resource *wl_output::bind(struct ::wl_resource *handle) + { + Resource *resource = output_allocate(); + resource->output_object = this; + + wl_resource_set_implementation(handle, &m_wl_output_interface, resource, destroy_func); + resource->handle = handle; + output_bind_resource(resource); + return resource; + } + wl_output::Resource *wl_output::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_output_interface, &m_wl_output_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_output_interface wl_output::m_wl_output_interface = { + wl_output::handle_release + }; + + void wl_output::output_release(Resource *) + { + } + + + void wl_output::handle_release( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->output_object)->output_release( + r); + } + + void wl_output::send_geometry(int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const std::string &make, const std::string &model, int32_t transform) + { + DS_ASSERT_X(m_resource, "wl_output::geometry", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_output::geometry as it's not initialised"); + return; + } + send_geometry( + m_resource->handle, + x, + y, + physical_width, + physical_height, + subpixel, + make, + model, + transform); + } + + void wl_output::send_geometry(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const std::string &make, const std::string &model, int32_t transform) + { + wl_output_send_geometry( + resource, + x, + y, + physical_width, + physical_height, + subpixel, + make.c_str(), + model.c_str(), + transform); + } + + + void wl_output::send_mode(uint32_t flags, int32_t width, int32_t height, int32_t refresh) + { + DS_ASSERT_X(m_resource, "wl_output::mode", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_output::mode as it's not initialised"); + return; + } + send_mode( + m_resource->handle, + flags, + width, + height, + refresh); + } + + void wl_output::send_mode(struct ::wl_resource *resource, uint32_t flags, int32_t width, int32_t height, int32_t refresh) + { + wl_output_send_mode( + resource, + flags, + width, + height, + refresh); + } + + + void wl_output::send_done() + { + DS_ASSERT_X(m_resource, "wl_output::done", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_output::done as it's not initialised"); + return; + } + send_done( + m_resource->handle); + } + + void wl_output::send_done(struct ::wl_resource *resource) + { + wl_output_send_done( + resource); + } + + + void wl_output::send_scale(int32_t factor) + { + DS_ASSERT_X(m_resource, "wl_output::scale", "Uninitialised resource"); + if (DS_UNLIKELY(!m_resource)) { + WRN("could not call wl_output::scale as it's not initialised"); + return; + } + send_scale( + m_resource->handle, + factor); + } + + void wl_output::send_scale(struct ::wl_resource *resource, int32_t factor) + { + wl_output_send_scale( + resource, + factor); + } + + + wl_region::wl_region(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_region::wl_region(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_region::wl_region(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_region::wl_region() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_region::~wl_region() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_region::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_region::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_region::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_region::Resource *wl_region::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_region::Resource *wl_region::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_region::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_region_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_region::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_region::interface() + { + return &::wl_region_interface; + } + + wl_region::Resource *wl_region::region_allocate() + { + return new Resource; + } + + void wl_region::region_bind_resource(Resource *) + { + } + + void wl_region::region_destroy_resource(Resource *) + { + } + + void wl_region::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_region *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_region::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_region *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_region::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_region *that = resource->region_object; + that->m_resource_map.erase(resource->client()); + that->region_destroy_resource(resource); + delete resource; + } + + wl_region::Resource *wl_region::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_region_interface, version, id); + return bind(handle); + } + + wl_region::Resource *wl_region::bind(struct ::wl_resource *handle) + { + Resource *resource = region_allocate(); + resource->region_object = this; + + wl_resource_set_implementation(handle, &m_wl_region_interface, resource, destroy_func); + resource->handle = handle; + region_bind_resource(resource); + return resource; + } + wl_region::Resource *wl_region::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_region_interface, &m_wl_region_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_region_interface wl_region::m_wl_region_interface = { + wl_region::handle_destroy, + wl_region::handle_add, + wl_region::handle_subtract + }; + + void wl_region::region_destroy(Resource *) + { + } + + void wl_region::region_add(Resource *, int32_t , int32_t , int32_t , int32_t ) + { + } + + void wl_region::region_subtract(Resource *, int32_t , int32_t , int32_t , int32_t ) + { + } + + + void wl_region::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->region_object)->region_destroy( + r); + } + + void wl_region::handle_add( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->region_object)->region_add( + r, + x, + y, + width, + height); + } + + void wl_region::handle_subtract( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->region_object)->region_subtract( + r, + x, + y, + width, + height); + } + + wl_subcompositor::wl_subcompositor(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_subcompositor::wl_subcompositor(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_subcompositor::wl_subcompositor(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_subcompositor::wl_subcompositor() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_subcompositor::~wl_subcompositor() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_subcompositor::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_subcompositor::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_subcompositor::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_subcompositor::Resource *wl_subcompositor::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_subcompositor::Resource *wl_subcompositor::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_subcompositor::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_subcompositor_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_subcompositor::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_subcompositor::interface() + { + return &::wl_subcompositor_interface; + } + + wl_subcompositor::Resource *wl_subcompositor::subcompositor_allocate() + { + return new Resource; + } + + void wl_subcompositor::subcompositor_bind_resource(Resource *) + { + } + + void wl_subcompositor::subcompositor_destroy_resource(Resource *) + { + } + + void wl_subcompositor::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_subcompositor *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_subcompositor::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_subcompositor *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_subcompositor::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_subcompositor *that = resource->subcompositor_object; + that->m_resource_map.erase(resource->client()); + that->subcompositor_destroy_resource(resource); + delete resource; + } + + wl_subcompositor::Resource *wl_subcompositor::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_subcompositor_interface, version, id); + return bind(handle); + } + + wl_subcompositor::Resource *wl_subcompositor::bind(struct ::wl_resource *handle) + { + Resource *resource = subcompositor_allocate(); + resource->subcompositor_object = this; + + wl_resource_set_implementation(handle, &m_wl_subcompositor_interface, resource, destroy_func); + resource->handle = handle; + subcompositor_bind_resource(resource); + return resource; + } + wl_subcompositor::Resource *wl_subcompositor::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_subcompositor_interface, &m_wl_subcompositor_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_subcompositor_interface wl_subcompositor::m_wl_subcompositor_interface = { + wl_subcompositor::handle_destroy, + wl_subcompositor::handle_get_subsurface + }; + + void wl_subcompositor::subcompositor_destroy(Resource *) + { + } + + void wl_subcompositor::subcompositor_get_subsurface(Resource *, uint32_t, struct ::wl_resource *, struct ::wl_resource *) + { + } + + + void wl_subcompositor::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->subcompositor_object)->subcompositor_destroy( + r); + } + + void wl_subcompositor::handle_get_subsurface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface, + struct ::wl_resource *parent) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->subcompositor_object)->subcompositor_get_subsurface( + r, + id, + surface, + parent); + } + + wl_subsurface::wl_subsurface(struct ::wl_client *client, int id, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(client, id, version); + } + + wl_subsurface::wl_subsurface(struct ::wl_display *display, int version) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(display, version); + } + + wl_subsurface::wl_subsurface(struct ::wl_resource *resource) + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + init(resource); + } + + wl_subsurface::wl_subsurface() + : m_resource_map() + , m_resource(NULL) + , m_global(NULL) + { + } + + wl_subsurface::~wl_subsurface() + { + std::multimap::iterator it; + for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) { + wl_subsurface::Resource *resource = (*it).second; + wl_resource_set_implementation(resource->handle, NULL, NULL, NULL); + } + + if (m_global) { + wl_global_destroy(m_global); + wl_list_remove(&m_displayDestroyedListener.link); + } + } + + void wl_subsurface::init(struct ::wl_client *client, int id, int version) + { + m_resource = bind(client, id, version); + } + + void wl_subsurface::init(struct ::wl_resource *resource) + { + m_resource = bind(resource); + } + + wl_subsurface::Resource *wl_subsurface::add(struct ::wl_client *client, int version) + { + Resource *resource = bind(client, 0, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + wl_subsurface::Resource *wl_subsurface::add(struct ::wl_client *client, int id, int version) + { + Resource *resource = bind(client, id, version); + m_resource_map.insert(std::pair(client, resource)); + return resource; + } + + void wl_subsurface::init(struct ::wl_display *display, int version) + { + m_global = wl_global_create(display, &::wl_subsurface_interface, version, this, bind_func); + m_globalVersion = version; + m_displayDestroyedListener.notify = wl_subsurface::display_destroy_func; + m_displayDestroyedListener.parent = this; + wl_display_add_destroy_listener(display, &m_displayDestroyedListener); + } + + const struct wl_interface *wl_subsurface::interface() + { + return &::wl_subsurface_interface; + } + + wl_subsurface::Resource *wl_subsurface::subsurface_allocate() + { + return new Resource; + } + + void wl_subsurface::subsurface_bind_resource(Resource *) + { + } + + void wl_subsurface::subsurface_destroy_resource(Resource *) + { + } + + void wl_subsurface::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) + { + wl_subsurface *that = static_cast(data); + that->add(client, id, std::min(that->m_globalVersion, version)); + } + + void wl_subsurface::display_destroy_func(struct ::wl_listener *listener, void *data) + { + DS_UNUSED(data); + wl_subsurface *that = static_cast(listener)->parent; + that->m_global = NULL; + } + + void wl_subsurface::destroy_func(struct ::wl_resource *client_resource) + { + Resource *resource = Resource::fromResource(client_resource); + DS_ASSERT(resource); + wl_subsurface *that = resource->subsurface_object; + that->m_resource_map.erase(resource->client()); + that->subsurface_destroy_resource(resource); + delete resource; + } + + wl_subsurface::Resource *wl_subsurface::bind(struct ::wl_client *client, uint32_t id, int version) + { + DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); + struct ::wl_resource *handle = wl_resource_create(client, &::wl_subsurface_interface, version, id); + return bind(handle); + } + + wl_subsurface::Resource *wl_subsurface::bind(struct ::wl_resource *handle) + { + Resource *resource = subsurface_allocate(); + resource->subsurface_object = this; + + wl_resource_set_implementation(handle, &m_wl_subsurface_interface, resource, destroy_func); + resource->handle = handle; + subsurface_bind_resource(resource); + return resource; + } + wl_subsurface::Resource *wl_subsurface::Resource::fromResource(struct ::wl_resource *resource) + { + if (DS_UNLIKELY(!resource)) + return NULL; + if (wl_resource_instance_of(resource, &::wl_subsurface_interface, &m_wl_subsurface_interface)) + return static_cast(wl_resource_get_user_data(resource)); + return NULL; + } + + const struct ::wl_subsurface_interface wl_subsurface::m_wl_subsurface_interface = { + wl_subsurface::handle_destroy, + wl_subsurface::handle_set_position, + wl_subsurface::handle_place_above, + wl_subsurface::handle_place_below, + wl_subsurface::handle_set_sync, + wl_subsurface::handle_set_desync + }; + + void wl_subsurface::subsurface_destroy(Resource *) + { + } + + void wl_subsurface::subsurface_set_position(Resource *, int32_t , int32_t ) + { + } + + void wl_subsurface::subsurface_place_above(Resource *, struct ::wl_resource *) + { + } + + void wl_subsurface::subsurface_place_below(Resource *, struct ::wl_resource *) + { + } + + void wl_subsurface::subsurface_set_sync(Resource *) + { + } + + void wl_subsurface::subsurface_set_desync(Resource *) + { + } + + + void wl_subsurface::handle_destroy( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->subsurface_object)->subsurface_destroy( + r); + } + + void wl_subsurface::handle_set_position( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->subsurface_object)->subsurface_set_position( + r, + x, + y); + } + + void wl_subsurface::handle_place_above( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *sibling) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->subsurface_object)->subsurface_place_above( + r, + sibling); + } + + void wl_subsurface::handle_place_below( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *sibling) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->subsurface_object)->subsurface_place_below( + r, + sibling); + } + + void wl_subsurface::handle_set_sync( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->subsurface_object)->subsurface_set_sync( + r); + } + + void wl_subsurface::handle_set_desync( + ::wl_client *client, + struct wl_resource *resource) + { + DS_UNUSED(client); + Resource *r = Resource::fromResource(resource); + static_cast(r->subsurface_object)->subsurface_set_desync( + r); + } +} + diff --git a/src/DSWaylandServer/dswayland-server-wayland.h b/src/DSWaylandServer/dswayland-server-wayland.h new file mode 100644 index 0000000..489d063 --- /dev/null +++ b/src/DSWaylandServer/dswayland-server-wayland.h @@ -0,0 +1,2224 @@ +/* Protocol XML file : wayland/wayland.xml */ + +#ifndef __DS_WAYLAND_PROTOCOL_H__ +#define __DS_WAYLAND_PROTOCOL_H__ + +#include "wayland-server-core.h" +#include "wayland-server-protocol.h" +#include +#include +#include +#include +#include + +#ifndef WAYLAND_VERSION_CHECK +#define WAYLAND_VERSION_CHECK(major, minor, micro) \ + ((WAYLAND_VERSION_MAJOR > (major)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ + (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) +#endif + + +namespace DSWaylandServer { + class wl_callback + { + public: + wl_callback(struct ::wl_client *client, int id, int version); + wl_callback(struct ::wl_display *display, int version); + wl_callback(struct ::wl_resource *resource); + wl_callback(); + + virtual ~wl_callback(); + + class Resource + { + public: + Resource() : callback_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_callback *callback_object; + wl_callback *object() { return callback_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_done(uint32_t callback_data); + void send_done(struct ::wl_resource *resource, uint32_t callback_data); + + protected: + virtual Resource *callback_allocate(); + + virtual void callback_bind_resource(Resource *resource); + virtual void callback_destroy_resource(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_callback *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_compositor + { + public: + wl_compositor(struct ::wl_client *client, int id, int version); + wl_compositor(struct ::wl_display *display, int version); + wl_compositor(struct ::wl_resource *resource); + wl_compositor(); + + virtual ~wl_compositor(); + + class Resource + { + public: + Resource() : compositor_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_compositor *compositor_object; + wl_compositor *object() { return compositor_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *compositor_allocate(); + + virtual void compositor_bind_resource(Resource *resource); + virtual void compositor_destroy_resource(Resource *resource); + + virtual void compositor_create_surface(Resource *resource, uint32_t id); + virtual void compositor_create_region(Resource *resource, uint32_t id); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_compositor_interface m_wl_compositor_interface; + + static void handle_create_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_create_region( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_compositor *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_shm_pool + { + public: + wl_shm_pool(struct ::wl_client *client, int id, int version); + wl_shm_pool(struct ::wl_display *display, int version); + wl_shm_pool(struct ::wl_resource *resource); + wl_shm_pool(); + + virtual ~wl_shm_pool(); + + class Resource + { + public: + Resource() : shm_pool_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_shm_pool *shm_pool_object; + wl_shm_pool *object() { return shm_pool_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *shm_pool_allocate(); + + virtual void shm_pool_bind_resource(Resource *resource); + virtual void shm_pool_destroy_resource(Resource *resource); + + virtual void shm_pool_create_buffer(Resource *resource, uint32_t id, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format); + virtual void shm_pool_destroy(Resource *resource); + virtual void shm_pool_resize(Resource *resource, int32_t size); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_shm_pool_interface m_wl_shm_pool_interface; + + static void handle_create_buffer( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + int32_t offset, + int32_t width, + int32_t height, + int32_t stride, + uint32_t format); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_resize( + ::wl_client *client, + struct wl_resource *resource, + int32_t size); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_shm_pool *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_shm + { + public: + wl_shm(struct ::wl_client *client, int id, int version); + wl_shm(struct ::wl_display *display, int version); + wl_shm(struct ::wl_resource *resource); + wl_shm(); + + virtual ~wl_shm(); + + class Resource + { + public: + Resource() : shm_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_shm *shm_object; + wl_shm *object() { return shm_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_invalid_format = 0, // buffer format is not known + error_invalid_stride = 1, // invalid size or stride during pool or buffer creation + error_invalid_fd = 2, // mmapping the file descriptor failed + }; + + enum format { + format_argb8888 = 0, // 32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian + format_xrgb8888 = 1, // 32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian + format_c8 = 0x20203843, // 8-bit color index format, [7:0] C + format_rgb332 = 0x38424752, // 8-bit RGB format, [7:0] R:G:B 3:3:2 + format_bgr233 = 0x38524742, // 8-bit BGR format, [7:0] B:G:R 2:3:3 + format_xrgb4444 = 0x32315258, // 16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian + format_xbgr4444 = 0x32314258, // 16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian + format_rgbx4444 = 0x32315852, // 16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian + format_bgrx4444 = 0x32315842, // 16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian + format_argb4444 = 0x32315241, // 16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian + format_abgr4444 = 0x32314241, // 16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian + format_rgba4444 = 0x32314152, // 16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian + format_bgra4444 = 0x32314142, // 16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian + format_xrgb1555 = 0x35315258, // 16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian + format_xbgr1555 = 0x35314258, // 16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian + format_rgbx5551 = 0x35315852, // 16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian + format_bgrx5551 = 0x35315842, // 16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian + format_argb1555 = 0x35315241, // 16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian + format_abgr1555 = 0x35314241, // 16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian + format_rgba5551 = 0x35314152, // 16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian + format_bgra5551 = 0x35314142, // 16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian + format_rgb565 = 0x36314752, // 16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian + format_bgr565 = 0x36314742, // 16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian + format_rgb888 = 0x34324752, // 24-bit RGB format, [23:0] R:G:B little endian + format_bgr888 = 0x34324742, // 24-bit BGR format, [23:0] B:G:R little endian + format_xbgr8888 = 0x34324258, // 32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian + format_rgbx8888 = 0x34325852, // 32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian + format_bgrx8888 = 0x34325842, // 32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian + format_abgr8888 = 0x34324241, // 32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian + format_rgba8888 = 0x34324152, // 32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian + format_bgra8888 = 0x34324142, // 32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian + format_xrgb2101010 = 0x30335258, // 32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian + format_xbgr2101010 = 0x30334258, // 32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian + format_rgbx1010102 = 0x30335852, // 32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian + format_bgrx1010102 = 0x30335842, // 32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian + format_argb2101010 = 0x30335241, // 32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian + format_abgr2101010 = 0x30334241, // 32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian + format_rgba1010102 = 0x30334152, // 32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian + format_bgra1010102 = 0x30334142, // 32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian + format_yuyv = 0x56595559, // packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian + format_yvyu = 0x55595659, // packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian + format_uyvy = 0x59565955, // packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian + format_vyuy = 0x59555956, // packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian + format_ayuv = 0x56555941, // packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian + format_nv12 = 0x3231564e, // 2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane + format_nv21 = 0x3132564e, // 2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane + format_nv16 = 0x3631564e, // 2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane + format_nv61 = 0x3136564e, // 2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane + format_yuv410 = 0x39565559, // 3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes + format_yvu410 = 0x39555659, // 3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes + format_yuv411 = 0x31315559, // 3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes + format_yvu411 = 0x31315659, // 3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes + format_yuv420 = 0x32315559, // 3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes + format_yvu420 = 0x32315659, // 3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes + format_yuv422 = 0x36315559, // 3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes + format_yvu422 = 0x36315659, // 3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes + format_yuv444 = 0x34325559, // 3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes + format_yvu444 = 0x34325659, // 3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes + format_r8 = 0x20203852, // [7:0] R + format_r16 = 0x20363152, // [15:0] R little endian + format_rg88 = 0x38384752, // [15:0] R:G 8:8 little endian + format_gr88 = 0x38385247, // [15:0] G:R 8:8 little endian + format_rg1616 = 0x32334752, // [31:0] R:G 16:16 little endian + format_gr1616 = 0x32335247, // [31:0] G:R 16:16 little endian + format_xrgb16161616f = 0x48345258, // [63:0] x:R:G:B 16:16:16:16 little endian + format_xbgr16161616f = 0x48344258, // [63:0] x:B:G:R 16:16:16:16 little endian + format_argb16161616f = 0x48345241, // [63:0] A:R:G:B 16:16:16:16 little endian + format_abgr16161616f = 0x48344241, // [63:0] A:B:G:R 16:16:16:16 little endian + format_xyuv8888 = 0x56555958, // [31:0] X:Y:Cb:Cr 8:8:8:8 little endian + format_vuy888 = 0x34325556, // [23:0] Cr:Cb:Y 8:8:8 little endian + format_vuy101010 = 0x30335556, // Y followed by U then V, 10:10:10. Non-linear modifier only + format_y210 = 0x30313259, // [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels + format_y212 = 0x32313259, // [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels + format_y216 = 0x36313259, // [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels + format_y410 = 0x30313459, // [31:0] A:Cr:Y:Cb 2:10:10:10 little endian + format_y412 = 0x32313459, // [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian + format_y416 = 0x36313459, // [63:0] A:Cr:Y:Cb 16:16:16:16 little endian + format_xvyu2101010 = 0x30335658, // [31:0] X:Cr:Y:Cb 2:10:10:10 little endian + format_xvyu12_16161616 = 0x36335658, // [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian + format_xvyu16161616 = 0x38345658, // [63:0] X:Cr:Y:Cb 16:16:16:16 little endian + format_y0l0 = 0x304c3059, // [63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian + format_x0l0 = 0x304c3058, // [63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian + format_y0l2 = 0x324c3059, // [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian + format_x0l2 = 0x324c3058, // [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian + format_yuv420_8bit = 0x38305559, + format_yuv420_10bit = 0x30315559, + format_xrgb8888_a8 = 0x38415258, + format_xbgr8888_a8 = 0x38414258, + format_rgbx8888_a8 = 0x38415852, + format_bgrx8888_a8 = 0x38415842, + format_rgb888_a8 = 0x38413852, + format_bgr888_a8 = 0x38413842, + format_rgb565_a8 = 0x38413552, + format_bgr565_a8 = 0x38413542, + format_nv24 = 0x3432564e, // non-subsampled Cr:Cb plane + format_nv42 = 0x3234564e, // non-subsampled Cb:Cr plane + format_p210 = 0x30313250, // 2x1 subsampled Cr:Cb plane, 10 bit per channel + format_p010 = 0x30313050, // 2x2 subsampled Cr:Cb plane 10 bits per channel + format_p012 = 0x32313050, // 2x2 subsampled Cr:Cb plane 12 bits per channel + format_p016 = 0x36313050, // 2x2 subsampled Cr:Cb plane 16 bits per channel + }; + + void send_format(uint32_t format); + void send_format(struct ::wl_resource *resource, uint32_t format); + + protected: + virtual Resource *shm_allocate(); + + virtual void shm_bind_resource(Resource *resource); + virtual void shm_destroy_resource(Resource *resource); + + virtual void shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_shm_interface m_wl_shm_interface; + + static void handle_create_pool( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + int32_t fd, + int32_t size); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_shm *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_buffer + { + public: + wl_buffer(struct ::wl_client *client, int id, int version); + wl_buffer(struct ::wl_display *display, int version); + wl_buffer(struct ::wl_resource *resource); + wl_buffer(); + + virtual ~wl_buffer(); + + class Resource + { + public: + Resource() : buffer_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_buffer *buffer_object; + wl_buffer *object() { return buffer_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_release(); + void send_release(struct ::wl_resource *resource); + + protected: + virtual Resource *buffer_allocate(); + + virtual void buffer_bind_resource(Resource *resource); + virtual void buffer_destroy_resource(Resource *resource); + + virtual void buffer_destroy(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_buffer_interface m_wl_buffer_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_buffer *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_data_offer + { + public: + wl_data_offer(struct ::wl_client *client, int id, int version); + wl_data_offer(struct ::wl_display *display, int version); + wl_data_offer(struct ::wl_resource *resource); + wl_data_offer(); + + virtual ~wl_data_offer(); + + class Resource + { + public: + Resource() : data_offer_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_data_offer *data_offer_object; + wl_data_offer *object() { return data_offer_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_invalid_finish = 0, // finish request was called untimely + error_invalid_action_mask = 1, // action mask contains invalid values + error_invalid_action = 2, // action argument has an invalid value + error_invalid_offer = 3, // offer doesn't accept this request + }; + + void send_offer(const std::string &mime_type); + void send_offer(struct ::wl_resource *resource, const std::string &mime_type); + void send_source_actions(uint32_t source_actions); + void send_source_actions(struct ::wl_resource *resource, uint32_t source_actions); + void send_action(uint32_t dnd_action); + void send_action(struct ::wl_resource *resource, uint32_t dnd_action); + + protected: + virtual Resource *data_offer_allocate(); + + virtual void data_offer_bind_resource(Resource *resource); + virtual void data_offer_destroy_resource(Resource *resource); + + virtual void data_offer_accept(Resource *resource, uint32_t serial, const std::string &mime_type); + virtual void data_offer_receive(Resource *resource, const std::string &mime_type, int32_t fd); + virtual void data_offer_destroy(Resource *resource); + virtual void data_offer_finish(Resource *resource); + virtual void data_offer_set_actions(Resource *resource, uint32_t dnd_actions, uint32_t preferred_action); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_data_offer_interface m_wl_data_offer_interface; + + static void handle_accept( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + const char *mime_type); + static void handle_receive( + ::wl_client *client, + struct wl_resource *resource, + const char *mime_type, + int32_t fd); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_finish( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_actions( + ::wl_client *client, + struct wl_resource *resource, + uint32_t dnd_actions, + uint32_t preferred_action); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_data_offer *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_data_source + { + public: + wl_data_source(struct ::wl_client *client, int id, int version); + wl_data_source(struct ::wl_display *display, int version); + wl_data_source(struct ::wl_resource *resource); + wl_data_source(); + + virtual ~wl_data_source(); + + class Resource + { + public: + Resource() : data_source_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_data_source *data_source_object; + wl_data_source *object() { return data_source_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_invalid_action_mask = 0, // action mask contains invalid values + error_invalid_source = 1, // source doesn't accept this request + }; + + void send_target(const std::string &mime_type); + void send_target(struct ::wl_resource *resource, const std::string &mime_type); + void send_send(const std::string &mime_type, int32_t fd); + void send_send(struct ::wl_resource *resource, const std::string &mime_type, int32_t fd); + void send_cancelled(); + void send_cancelled(struct ::wl_resource *resource); + void send_dnd_drop_performed(); + void send_dnd_drop_performed(struct ::wl_resource *resource); + void send_dnd_finished(); + void send_dnd_finished(struct ::wl_resource *resource); + void send_action(uint32_t dnd_action); + void send_action(struct ::wl_resource *resource, uint32_t dnd_action); + + protected: + virtual Resource *data_source_allocate(); + + virtual void data_source_bind_resource(Resource *resource); + virtual void data_source_destroy_resource(Resource *resource); + + virtual void data_source_offer(Resource *resource, const std::string &mime_type); + virtual void data_source_destroy(Resource *resource); + virtual void data_source_set_actions(Resource *resource, uint32_t dnd_actions); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_data_source_interface m_wl_data_source_interface; + + static void handle_offer( + ::wl_client *client, + struct wl_resource *resource, + const char *mime_type); + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_actions( + ::wl_client *client, + struct wl_resource *resource, + uint32_t dnd_actions); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_data_source *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_data_device + { + public: + wl_data_device(struct ::wl_client *client, int id, int version); + wl_data_device(struct ::wl_display *display, int version); + wl_data_device(struct ::wl_resource *resource); + wl_data_device(); + + virtual ~wl_data_device(); + + class Resource + { + public: + Resource() : data_device_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_data_device *data_device_object; + wl_data_device *object() { return data_device_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_role = 0, // given wl_surface has another role + }; + + void send_data_offer(struct ::wl_resource *id); + void send_data_offer(struct ::wl_resource *resource, struct ::wl_resource *id); + void send_enter(uint32_t serial, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_resource *id); + void send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct ::wl_resource *id); + void send_leave(); + void send_leave(struct ::wl_resource *resource); + void send_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y); + void send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t x, wl_fixed_t y); + void send_drop(); + void send_drop(struct ::wl_resource *resource); + void send_selection(struct ::wl_resource *id); + void send_selection(struct ::wl_resource *resource, struct ::wl_resource *id); + + protected: + virtual Resource *data_device_allocate(); + + virtual void data_device_bind_resource(Resource *resource); + virtual void data_device_destroy_resource(Resource *resource); + + virtual void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial); + virtual void data_device_set_selection(Resource *resource, struct ::wl_resource *source, uint32_t serial); + virtual void data_device_release(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_data_device_interface m_wl_data_device_interface; + + static void handle_start_drag( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *source, + struct ::wl_resource *origin, + struct ::wl_resource *icon, + uint32_t serial); + static void handle_set_selection( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *source, + uint32_t serial); + static void handle_release( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_data_device *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_data_device_manager + { + public: + wl_data_device_manager(struct ::wl_client *client, int id, int version); + wl_data_device_manager(struct ::wl_display *display, int version); + wl_data_device_manager(struct ::wl_resource *resource); + wl_data_device_manager(); + + virtual ~wl_data_device_manager(); + + class Resource + { + public: + Resource() : data_device_manager_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_data_device_manager *data_device_manager_object; + wl_data_device_manager *object() { return data_device_manager_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum dnd_action { + dnd_action_none = 0, // no action + dnd_action_copy = 1, // copy action + dnd_action_move = 2, // move action + dnd_action_ask = 4, // ask action + }; + + protected: + virtual Resource *data_device_manager_allocate(); + + virtual void data_device_manager_bind_resource(Resource *resource); + virtual void data_device_manager_destroy_resource(Resource *resource); + + virtual void data_device_manager_create_data_source(Resource *resource, uint32_t id); + virtual void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_data_device_manager_interface m_wl_data_device_manager_interface; + + static void handle_create_data_source( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_get_data_device( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *seat); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_data_device_manager *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_shell + { + public: + wl_shell(struct ::wl_client *client, int id, int version); + wl_shell(struct ::wl_display *display, int version); + wl_shell(struct ::wl_resource *resource); + wl_shell(); + + virtual ~wl_shell(); + + class Resource + { + public: + Resource() : shell_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_shell *shell_object; + wl_shell *object() { return shell_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_role = 0, // given wl_surface has another role + }; + + protected: + virtual Resource *shell_allocate(); + + virtual void shell_bind_resource(Resource *resource); + virtual void shell_destroy_resource(Resource *resource); + + virtual void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_shell_interface m_wl_shell_interface; + + static void handle_get_shell_surface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_shell *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_shell_surface + { + public: + wl_shell_surface(struct ::wl_client *client, int id, int version); + wl_shell_surface(struct ::wl_display *display, int version); + wl_shell_surface(struct ::wl_resource *resource); + wl_shell_surface(); + + virtual ~wl_shell_surface(); + + class Resource + { + public: + Resource() : shell_surface_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_shell_surface *shell_surface_object; + wl_shell_surface *object() { return shell_surface_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum resize { + resize_none = 0, // no edge + resize_top = 1, // top edge + resize_bottom = 2, // bottom edge + resize_left = 4, // left edge + resize_top_left = 5, // top and left edges + resize_bottom_left = 6, // bottom and left edges + resize_right = 8, // right edge + resize_top_right = 9, // top and right edges + resize_bottom_right = 10, // bottom and right edges + }; + + enum transient { + transient_inactive = 0x1, // do not set keyboard focus + }; + + enum fullscreen_method { + fullscreen_method_default = 0, // no preference, apply default policy + fullscreen_method_scale = 1, // scale, preserve the surface's aspect ratio and center on output + fullscreen_method_driver = 2, // switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch + fullscreen_method_fill = 3, // no upscaling, center on output and add black borders to compensate size mismatch + }; + + void send_ping(uint32_t serial); + void send_ping(struct ::wl_resource *resource, uint32_t serial); + void send_configure(uint32_t edges, int32_t width, int32_t height); + void send_configure(struct ::wl_resource *resource, uint32_t edges, int32_t width, int32_t height); + void send_popup_done(); + void send_popup_done(struct ::wl_resource *resource); + + protected: + virtual Resource *shell_surface_allocate(); + + virtual void shell_surface_bind_resource(Resource *resource); + virtual void shell_surface_destroy_resource(Resource *resource); + + virtual void shell_surface_pong(Resource *resource, uint32_t serial); + virtual void shell_surface_move(Resource *resource, struct ::wl_resource *seat, uint32_t serial); + virtual void shell_surface_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges); + virtual void shell_surface_set_toplevel(Resource *resource); + virtual void shell_surface_set_transient(Resource *resource, struct ::wl_resource *parent, int32_t x, int32_t y, uint32_t flags); + virtual void shell_surface_set_fullscreen(Resource *resource, uint32_t method, uint32_t framerate, struct ::wl_resource *output); + virtual void shell_surface_set_popup(Resource *resource, struct ::wl_resource *seat, uint32_t serial, struct ::wl_resource *parent, int32_t x, int32_t y, uint32_t flags); + virtual void shell_surface_set_maximized(Resource *resource, struct ::wl_resource *output); + virtual void shell_surface_set_title(Resource *resource, const std::string &title); + virtual void shell_surface_set_class(Resource *resource, const std::string &class_); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_shell_surface_interface m_wl_shell_surface_interface; + + static void handle_pong( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial); + static void handle_move( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat, + uint32_t serial); + static void handle_resize( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat, + uint32_t serial, + uint32_t edges); + static void handle_set_toplevel( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_transient( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *parent, + int32_t x, + int32_t y, + uint32_t flags); + static void handle_set_fullscreen( + ::wl_client *client, + struct wl_resource *resource, + uint32_t method, + uint32_t framerate, + struct ::wl_resource *output); + static void handle_set_popup( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *seat, + uint32_t serial, + struct ::wl_resource *parent, + int32_t x, + int32_t y, + uint32_t flags); + static void handle_set_maximized( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *output); + static void handle_set_title( + ::wl_client *client, + struct wl_resource *resource, + const char *title); + static void handle_set_class( + ::wl_client *client, + struct wl_resource *resource, + const char *class_); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_shell_surface *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_surface + { + public: + wl_surface(struct ::wl_client *client, int id, int version); + wl_surface(struct ::wl_display *display, int version); + wl_surface(struct ::wl_resource *resource); + wl_surface(); + + virtual ~wl_surface(); + + class Resource + { + public: + Resource() : surface_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_surface *surface_object; + wl_surface *object() { return surface_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_invalid_scale = 0, // buffer scale value is invalid + error_invalid_transform = 1, // buffer transform value is invalid + }; + + void send_enter(struct ::wl_resource *output); + void send_enter(struct ::wl_resource *resource, struct ::wl_resource *output); + void send_leave(struct ::wl_resource *output); + void send_leave(struct ::wl_resource *resource, struct ::wl_resource *output); + + protected: + virtual Resource *surface_allocate(); + + virtual void surface_bind_resource(Resource *resource); + virtual void surface_destroy_resource(Resource *resource); + + virtual void surface_destroy(Resource *resource); + virtual void surface_attach(Resource *resource, struct ::wl_resource *buffer, int32_t x, int32_t y); + virtual void surface_damage(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); + virtual void surface_frame(Resource *resource, uint32_t callback); + virtual void surface_set_opaque_region(Resource *resource, struct ::wl_resource *region); + virtual void surface_set_input_region(Resource *resource, struct ::wl_resource *region); + virtual void surface_commit(Resource *resource); + virtual void surface_set_buffer_transform(Resource *resource, int32_t transform); + virtual void surface_set_buffer_scale(Resource *resource, int32_t scale); + virtual void surface_damage_buffer(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_surface_interface m_wl_surface_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_attach( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *buffer, + int32_t x, + int32_t y); + static void handle_damage( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height); + static void handle_frame( + ::wl_client *client, + struct wl_resource *resource, + uint32_t callback); + static void handle_set_opaque_region( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *region); + static void handle_set_input_region( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *region); + static void handle_commit( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_buffer_transform( + ::wl_client *client, + struct wl_resource *resource, + int32_t transform); + static void handle_set_buffer_scale( + ::wl_client *client, + struct wl_resource *resource, + int32_t scale); + static void handle_damage_buffer( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_surface *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_seat + { + public: + wl_seat(struct ::wl_client *client, int id, int version); + wl_seat(struct ::wl_display *display, int version); + wl_seat(struct ::wl_resource *resource); + wl_seat(); + + virtual ~wl_seat(); + + class Resource + { + public: + Resource() : seat_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_seat *seat_object; + wl_seat *object() { return seat_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum capability { + capability_pointer = 1, // the seat has pointer devices + capability_keyboard = 2, // the seat has one or more keyboards + capability_touch = 4, // the seat has touch devices + }; + + void send_capabilities(uint32_t capabilities); + void send_capabilities(struct ::wl_resource *resource, uint32_t capabilities); + void send_name(const std::string &name); + void send_name(struct ::wl_resource *resource, const std::string &name); + + protected: + virtual Resource *seat_allocate(); + + virtual void seat_bind_resource(Resource *resource); + virtual void seat_destroy_resource(Resource *resource); + + virtual void seat_get_pointer(Resource *resource, uint32_t id); + virtual void seat_get_keyboard(Resource *resource, uint32_t id); + virtual void seat_get_touch(Resource *resource, uint32_t id); + virtual void seat_release(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_seat_interface m_wl_seat_interface; + + static void handle_get_pointer( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_get_keyboard( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_get_touch( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id); + static void handle_release( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_seat *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_pointer + { + public: + wl_pointer(struct ::wl_client *client, int id, int version); + wl_pointer(struct ::wl_display *display, int version); + wl_pointer(struct ::wl_resource *resource); + wl_pointer(); + + virtual ~wl_pointer(); + + class Resource + { + public: + Resource() : pointer_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_pointer *pointer_object; + wl_pointer *object() { return pointer_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_role = 0, // given wl_surface has another role + }; + + enum button_state { + button_state_released = 0, // the button is not pressed + button_state_pressed = 1, // the button is pressed + }; + + enum axis { + axis_vertical_scroll = 0, // vertical axis + axis_horizontal_scroll = 1, // horizontal axis + }; + + enum axis_source { + axis_source_wheel = 0, // a physical wheel rotation + axis_source_finger = 1, // finger on a touch surface + axis_source_continuous = 2, // continuous coordinate space + axis_source_wheel_tilt = 3, // a physical wheel tilt + }; + + void send_enter(uint32_t serial, struct ::wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y); + void send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y); + void send_leave(uint32_t serial, struct ::wl_resource *surface); + void send_leave(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface); + void send_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y); + void send_motion(struct ::wl_resource *resource, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y); + void send_button(uint32_t serial, uint32_t time, uint32_t button, uint32_t state); + void send_button(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t button, uint32_t state); + void send_axis(uint32_t time, uint32_t axis, wl_fixed_t value); + void send_axis(struct ::wl_resource *resource, uint32_t time, uint32_t axis, wl_fixed_t value); + void send_frame(); + void send_frame(struct ::wl_resource *resource); + void send_axis_source(uint32_t axis_source); + void send_axis_source(struct ::wl_resource *resource, uint32_t axis_source); + void send_axis_stop(uint32_t time, uint32_t axis); + void send_axis_stop(struct ::wl_resource *resource, uint32_t time, uint32_t axis); + void send_axis_discrete(uint32_t axis, int32_t discrete); + void send_axis_discrete(struct ::wl_resource *resource, uint32_t axis, int32_t discrete); + + protected: + virtual Resource *pointer_allocate(); + + virtual void pointer_bind_resource(Resource *resource); + virtual void pointer_destroy_resource(Resource *resource); + + virtual void pointer_set_cursor(Resource *resource, uint32_t serial, struct ::wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y); + virtual void pointer_release(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_pointer_interface m_wl_pointer_interface; + + static void handle_set_cursor( + ::wl_client *client, + struct wl_resource *resource, + uint32_t serial, + struct ::wl_resource *surface, + int32_t hotspot_x, + int32_t hotspot_y); + static void handle_release( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_pointer *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_keyboard + { + public: + wl_keyboard(struct ::wl_client *client, int id, int version); + wl_keyboard(struct ::wl_display *display, int version); + wl_keyboard(struct ::wl_resource *resource); + wl_keyboard(); + + virtual ~wl_keyboard(); + + class Resource + { + public: + Resource() : keyboard_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_keyboard *keyboard_object; + wl_keyboard *object() { return keyboard_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum keymap_format { + keymap_format_no_keymap = 0, // no keymap; client must understand how to interpret the raw keycode + keymap_format_xkb_v1 = 1, // libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode + }; + + enum key_state { + key_state_released = 0, // key is not pressed + key_state_pressed = 1, // key is pressed + }; + + void send_keymap(uint32_t format, int32_t fd, uint32_t size); + void send_keymap(struct ::wl_resource *resource, uint32_t format, int32_t fd, uint32_t size); + void send_enter(uint32_t serial, struct ::wl_resource *surface, const std::string &keys); + void send_enter(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface, const std::string &keys); + void send_leave(uint32_t serial, struct ::wl_resource *surface); + void send_leave(struct ::wl_resource *resource, uint32_t serial, struct ::wl_resource *surface); + void send_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state); + void send_key(struct ::wl_resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state); + void send_modifiers(uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group); + void send_modifiers(struct ::wl_resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group); + void send_repeat_info(int32_t rate, int32_t delay); + void send_repeat_info(struct ::wl_resource *resource, int32_t rate, int32_t delay); + + protected: + virtual Resource *keyboard_allocate(); + + virtual void keyboard_bind_resource(Resource *resource); + virtual void keyboard_destroy_resource(Resource *resource); + + virtual void keyboard_release(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_keyboard_interface m_wl_keyboard_interface; + + static void handle_release( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_keyboard *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_touch + { + public: + wl_touch(struct ::wl_client *client, int id, int version); + wl_touch(struct ::wl_display *display, int version); + wl_touch(struct ::wl_resource *resource); + wl_touch(); + + virtual ~wl_touch(); + + class Resource + { + public: + Resource() : touch_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_touch *touch_object; + wl_touch *object() { return touch_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + void send_down(uint32_t serial, uint32_t time, struct ::wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y); + void send_down(struct ::wl_resource *resource, uint32_t serial, uint32_t time, struct ::wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y); + void send_up(uint32_t serial, uint32_t time, int32_t id); + void send_up(struct ::wl_resource *resource, uint32_t serial, uint32_t time, int32_t id); + void send_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y); + void send_motion(struct ::wl_resource *resource, uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y); + void send_frame(); + void send_frame(struct ::wl_resource *resource); + void send_cancel(); + void send_cancel(struct ::wl_resource *resource); + void send_shape(int32_t id, wl_fixed_t major, wl_fixed_t minor); + void send_shape(struct ::wl_resource *resource, int32_t id, wl_fixed_t major, wl_fixed_t minor); + void send_orientation(int32_t id, wl_fixed_t orientation); + void send_orientation(struct ::wl_resource *resource, int32_t id, wl_fixed_t orientation); + + protected: + virtual Resource *touch_allocate(); + + virtual void touch_bind_resource(Resource *resource); + virtual void touch_destroy_resource(Resource *resource); + + virtual void touch_release(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_touch_interface m_wl_touch_interface; + + static void handle_release( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_touch *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_output + { + public: + wl_output(struct ::wl_client *client, int id, int version); + wl_output(struct ::wl_display *display, int version); + wl_output(struct ::wl_resource *resource); + wl_output(); + + virtual ~wl_output(); + + class Resource + { + public: + Resource() : output_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_output *output_object; + wl_output *object() { return output_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum subpixel { + subpixel_unknown = 0, // unknown geometry + subpixel_none = 1, // no geometry + subpixel_horizontal_rgb = 2, // horizontal RGB + subpixel_horizontal_bgr = 3, // horizontal BGR + subpixel_vertical_rgb = 4, // vertical RGB + subpixel_vertical_bgr = 5, // vertical BGR + }; + + enum transform { + transform_normal = 0, // no transform + transform_90 = 1, // 90 degrees counter-clockwise + transform_180 = 2, // 180 degrees counter-clockwise + transform_270 = 3, // 270 degrees counter-clockwise + transform_flipped = 4, // 180 degree flip around a vertical axis + transform_flipped_90 = 5, // flip and rotate 90 degrees counter-clockwise + transform_flipped_180 = 6, // flip and rotate 180 degrees counter-clockwise + transform_flipped_270 = 7, // flip and rotate 270 degrees counter-clockwise + }; + + enum mode { + mode_current = 0x1, // indicates this is the current mode + mode_preferred = 0x2, // indicates this is the preferred mode + }; + + void send_geometry(int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const std::string &make, const std::string &model, int32_t transform); + void send_geometry(struct ::wl_resource *resource, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const std::string &make, const std::string &model, int32_t transform); + void send_mode(uint32_t flags, int32_t width, int32_t height, int32_t refresh); + void send_mode(struct ::wl_resource *resource, uint32_t flags, int32_t width, int32_t height, int32_t refresh); + void send_done(); + void send_done(struct ::wl_resource *resource); + void send_scale(int32_t factor); + void send_scale(struct ::wl_resource *resource, int32_t factor); + + protected: + virtual Resource *output_allocate(); + + virtual void output_bind_resource(Resource *resource); + virtual void output_destroy_resource(Resource *resource); + + virtual void output_release(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_output_interface m_wl_output_interface; + + static void handle_release( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_output *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_region + { + public: + wl_region(struct ::wl_client *client, int id, int version); + wl_region(struct ::wl_display *display, int version); + wl_region(struct ::wl_resource *resource); + wl_region(); + + virtual ~wl_region(); + + class Resource + { + public: + Resource() : region_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_region *region_object; + wl_region *object() { return region_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + protected: + virtual Resource *region_allocate(); + + virtual void region_bind_resource(Resource *resource); + virtual void region_destroy_resource(Resource *resource); + + virtual void region_destroy(Resource *resource); + virtual void region_add(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); + virtual void region_subtract(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_region_interface m_wl_region_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_add( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height); + static void handle_subtract( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_region *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_subcompositor + { + public: + wl_subcompositor(struct ::wl_client *client, int id, int version); + wl_subcompositor(struct ::wl_display *display, int version); + wl_subcompositor(struct ::wl_resource *resource); + wl_subcompositor(); + + virtual ~wl_subcompositor(); + + class Resource + { + public: + Resource() : subcompositor_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_subcompositor *subcompositor_object; + wl_subcompositor *object() { return subcompositor_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_bad_surface = 0, // the to-be sub-surface is invalid + }; + + protected: + virtual Resource *subcompositor_allocate(); + + virtual void subcompositor_bind_resource(Resource *resource); + virtual void subcompositor_destroy_resource(Resource *resource); + + virtual void subcompositor_destroy(Resource *resource); + virtual void subcompositor_get_subsurface(Resource *resource, uint32_t id, struct ::wl_resource *surface, struct ::wl_resource *parent); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_subcompositor_interface m_wl_subcompositor_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_get_subsurface( + ::wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct ::wl_resource *surface, + struct ::wl_resource *parent); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_subcompositor *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; + + class wl_subsurface + { + public: + wl_subsurface(struct ::wl_client *client, int id, int version); + wl_subsurface(struct ::wl_display *display, int version); + wl_subsurface(struct ::wl_resource *resource); + wl_subsurface(); + + virtual ~wl_subsurface(); + + class Resource + { + public: + Resource() : subsurface_object(NULL), handle(NULL) {} + virtual ~Resource() {} + + wl_subsurface *subsurface_object; + wl_subsurface *object() { return subsurface_object; } + struct ::wl_resource *handle; + + struct ::wl_client *client() const { return wl_resource_get_client(handle); } + int version() const { return wl_resource_get_version(handle); } + + static Resource *fromResource(struct ::wl_resource *resource); + }; + + void init(struct ::wl_client *client, int id, int version); + void init(struct ::wl_display *display, int version); + void init(struct ::wl_resource *resource); + + Resource *add(struct ::wl_client *client, int version); + Resource *add(struct ::wl_client *client, int id, int version); + Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); + + Resource *resource() { return m_resource; } + const Resource *resource() const { return m_resource; } + + std::multimap resourceMap() { return m_resource_map; } + const std::multimap resourceMap() const { return m_resource_map; } + + bool isGlobal() const { return m_global != NULL; } + bool isResource() const { return m_resource != NULL; } + + static const struct ::wl_interface *interface(); + static std::string interfaceName() { return interface()->name; } + static int interfaceVersion() { return interface()->version; } + + + enum error { + error_bad_surface = 0, // wl_surface is not a sibling or the parent + }; + + protected: + virtual Resource *subsurface_allocate(); + + virtual void subsurface_bind_resource(Resource *resource); + virtual void subsurface_destroy_resource(Resource *resource); + + virtual void subsurface_destroy(Resource *resource); + virtual void subsurface_set_position(Resource *resource, int32_t x, int32_t y); + virtual void subsurface_place_above(Resource *resource, struct ::wl_resource *sibling); + virtual void subsurface_place_below(Resource *resource, struct ::wl_resource *sibling); + virtual void subsurface_set_sync(Resource *resource); + virtual void subsurface_set_desync(Resource *resource); + + private: + static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); + static void destroy_func(struct ::wl_resource *client_resource); + static void display_destroy_func(struct ::wl_listener *listener, void *data); + + Resource *bind(struct ::wl_client *client, uint32_t id, int version); + Resource *bind(struct ::wl_resource *handle); + + static const struct ::wl_subsurface_interface m_wl_subsurface_interface; + + static void handle_destroy( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_position( + ::wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y); + static void handle_place_above( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *sibling); + static void handle_place_below( + ::wl_client *client, + struct wl_resource *resource, + struct ::wl_resource *sibling); + static void handle_set_sync( + ::wl_client *client, + struct wl_resource *resource); + static void handle_set_desync( + ::wl_client *client, + struct wl_resource *resource); + + std::multimap m_resource_map; + Resource *m_resource; + struct ::wl_global *m_global; + uint32_t m_globalVersion; + struct DisplayDestroyedListener : ::wl_listener { + wl_subsurface *parent; + }; + DisplayDestroyedListener m_displayDestroyedListener; + }; +} + +#endif -- 2.7.4 From c8dbcab463cfd488f383dc5e1ce5e321e68714aa Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 11 Jun 2020 12:59:18 +0900 Subject: [PATCH 15/16] implement DSDispalyDevice class and TDM implementations Change-Id: Ia12f8c0be76779d47898939ad06451692675eb41 --- packaging/libds.spec | 1 + src/DSDebug/DSDebugLog.cpp | 4 +- src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp | 130 +++++++++++ src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.h | 26 +++ .../DSDisplayDeviceHWCWindowTDMImpl.cpp | 16 ++ .../DSDisplayDeviceHWCWindowTDMImpl.h | 20 ++ .../DSDisplayDeviceOutputTDMImpl.cpp | 237 +++++++++++++++++++++ src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.h | 56 +++++ src/DSDisplayDevice/DSDisplayDeviceTDMImpl.cpp | 49 +++++ src/DSDisplayDevice/DSDisplayDeviceTDMImpl.h | 24 +++ src/DSDisplayDevice/IDSDisplayDevice.h | 18 ++ src/DSDisplayDevice/IDSDisplayDeviceHWC.h | 19 ++ src/DSDisplayDevice/IDSDisplayDeviceHWCWindow.h | 13 ++ src/DSDisplayDevice/IDSDisplayDeviceOutput.h | 85 ++++++++ src/meson.build | 8 +- tests/DSDisplayDeviceTDMImpl-test.cpp | 181 ++++++++++++++++ tests/meson.build | 1 + 17 files changed, 885 insertions(+), 3 deletions(-) create mode 100644 src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp create mode 100644 src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.h create mode 100644 src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.cpp create mode 100644 src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.h create mode 100644 src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.cpp create mode 100644 src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.h create mode 100644 src/DSDisplayDevice/DSDisplayDeviceTDMImpl.cpp create mode 100644 src/DSDisplayDevice/DSDisplayDeviceTDMImpl.h create mode 100644 src/DSDisplayDevice/IDSDisplayDevice.h create mode 100644 src/DSDisplayDevice/IDSDisplayDeviceHWC.h create mode 100644 src/DSDisplayDevice/IDSDisplayDeviceHWCWindow.h create mode 100644 src/DSDisplayDevice/IDSDisplayDeviceOutput.h create mode 100644 tests/DSDisplayDeviceTDMImpl-test.cpp diff --git a/packaging/libds.spec b/packaging/libds.spec index 9b1a70a..7f26b50 100644 --- a/packaging/libds.spec +++ b/packaging/libds.spec @@ -11,6 +11,7 @@ BuildRequires: meson BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gmock) BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(libtdm) %description diff --git a/src/DSDebug/DSDebugLog.cpp b/src/DSDebug/DSDebugLog.cpp index 12255ce..21c26d3 100644 --- a/src/DSDebug/DSDebugLog.cpp +++ b/src/DSDebug/DSDebugLog.cpp @@ -37,8 +37,8 @@ void DSDebugLog::printLog(int logLevel, const char *fmt, ...) //TODO: use dlog or stdout //TODO: use dlog filters va_list arg; - char *lvl_str[] = { "DS_DBG", "DS_INF", "DS_WRN", "DS_ERR" }; - char *color[] = { COLOR_RESET, COLOR_GREEN, COLOR_YELLOW, COLOR_RED }; + const char *lvl_str[] = { "DS_DBG", "DS_INF", "DS_WRN", "DS_ERR" }; + const char *color[] = { COLOR_RESET, COLOR_GREEN, COLOR_YELLOW, COLOR_RED }; va_start(arg, fmt); printf("%s", color[logLevel]); diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp new file mode 100644 index 0000000..d8b17c7 --- /dev/null +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp @@ -0,0 +1,130 @@ + +#include "DSDisplayDeviceHWCTDMImpl.h" +#include "DSDisplayDeviceHWCWindowTDMImpl.h" +#include "DSDebugLog.h" + +namespace display_server +{ +DSDisplayDeviceHWCTDMImpl::DSDisplayDeviceHWCTDMImpl(tdm_hwc *thwc) + : __thwc(thwc) +{ + +} +DSDisplayDeviceHWCTDMImpl::~DSDisplayDeviceHWCTDMImpl() +{ + +} + +IDSDisplayDeviceHWCWindow *DSDisplayDeviceHWCTDMImpl::createHWCWindow() +{ + tdm_error terror; + tdm_hwc_window *twindow; + IDSDisplayDeviceHWCWindow *deviceHWCWindow; + + twindow = tdm_hwc_create_window(__thwc, &terror); + if (!twindow) { + DSLOG_ERR("TDM HWCWindow", "tdm_hwc_create_window fails.\n"); + return nullptr; + } + + deviceHWCWindow = new DSDisplayDeviceHWCWindowTDMImpl(twindow); + if (!deviceHWCWindow) { + DSLOG_ERR("TDM HWCWindow", "new DSDisplayDeviceHWCWindowTDMImpl fails.\n"); + return nullptr; + } + + __deviceHWCWindowList.push_back(deviceHWCWindow); + + return deviceHWCWindow; +} + +void DSDisplayDeviceHWCTDMImpl::destroyHWCWindow(IDSDisplayDeviceHWCWindow *deviceHWCWindow) +{ + delete deviceHWCWindow; + __deviceHWCWindowList.remove(deviceHWCWindow); +} + +bool DSDisplayDeviceHWCTDMImpl::commit() +{ + tdm_error terror; + int numVisibleHWCWins = __deviceHWCWindowList.size(); //TODO: need to fix. change it to visible windows list. __deviceHWCWindowList is not the visible window list. + DSDisplayDeviceHWCWindowTDMImpl *hwcWinsImpl; + uint32_t numTypes; + + // get the thwc_windows to request validate. + tdm_hwc_window **thwc_windows; + thwc_windows = (tdm_hwc_window **)calloc(numVisibleHWCWins, sizeof(tdm_hwc_window *)); + if (thwc_windows == nullptr) { + DSLOG_ERR("TDM_HWC", "calloc thwc_windows fails."); + return false; + } + + int i = 0; + for (auto *hwcwins : __deviceHWCWindowList) { + hwcWinsImpl = (DSDisplayDeviceHWCWindowTDMImpl *)hwcwins; + thwc_windows[i++] = hwcWinsImpl->getTDMHWCWindow(); + } + + // validate thwc_windows + terror = tdm_hwc_validate(__thwc, thwc_windows, numVisibleHWCWins, &numTypes); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM_HWC", "tdm_hwc_validate fails."); + free(thwc_windows); + return false; + } + + free(thwc_windows); + + // get changed_types + tdm_hwc_window **changed_thwc_window = NULL; + tdm_hwc_window_composition *tcomposition_types = NULL; + uint32_t numChanges = 0; + if (numTypes > 0) { + changed_thwc_window = (tdm_hwc_window **)calloc(numTypes, sizeof(tdm_hwc_window *)); + if (changed_thwc_window == nullptr) { + DSLOG_ERR("TDM_HWC", "calloc changed_thwc_window fails."); + return false; + } + + tcomposition_types = (tdm_hwc_window_composition *)calloc(numTypes, sizeof(tdm_hwc_window_composition)); + if (tcomposition_types == nullptr) { + DSLOG_ERR("TDM_HWC", "calloc changed_thwc_window fails."); + free(changed_thwc_window); + return false; + } + + terror = tdm_hwc_get_changed_composition_types(__thwc, &numChanges, changed_thwc_window, tcomposition_types); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM_HWC", "tdm_hwc_get_changed_composition_types fails."); + free(tcomposition_types); + free(changed_thwc_window); + return false; + } + + for (i = 0; i < (int)numChanges; ++i) { + //TODO: change the TYPES of HWCWindows + } + + // TODO: accept_validation is depending on the transitions. + terror = tdm_hwc_accept_validation(__thwc); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM_HWC", "tdm_hwc_accept_validation fails."); + free(tcomposition_types); + free(changed_thwc_window); + return false; + } + + free(tcomposition_types); + free(changed_thwc_window); + } + + //TODO: tdm_hwc_commit + terror = tdm_hwc_commit(__thwc, 0, NULL, NULL); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM_HWC", "tdm_hwc_commit fails."); + return false; + } + + return true; +} +} \ No newline at end of file diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.h b/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.h new file mode 100644 index 0000000..cd266e7 --- /dev/null +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.h @@ -0,0 +1,26 @@ +#ifndef _DS_DISPLAY_DEVICE_HWC_TDM_IMPL_H_ +#define _DS_DISPLAY_DEVICE_HWC_TDM_IMPL_H_ + +#include "IDSDisplayDeviceHWC.h" +#include +#include + +namespace display_server +{ +class DSDisplayDeviceHWCTDMImpl : public IDSDisplayDeviceHWC +{ +public: + DSDisplayDeviceHWCTDMImpl(tdm_hwc *thwc); + ~DSDisplayDeviceHWCTDMImpl(); + + IDSDisplayDeviceHWCWindow *createHWCWindow() override; + void destroyHWCWindow(IDSDisplayDeviceHWCWindow *deviceHWCWindow) override; + bool commit() override; + +private: + tdm_hwc *__thwc; + std::list __deviceHWCWindowList; +}; +} + +#endif \ No newline at end of file diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.cpp new file mode 100644 index 0000000..7fcf260 --- /dev/null +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.cpp @@ -0,0 +1,16 @@ + +#include "DSDisplayDeviceHWCWindowTDMImpl.h" +#include "DSDebugLog.h" + +namespace display_server +{ +DSDisplayDeviceHWCWindowTDMImpl::DSDisplayDeviceHWCWindowTDMImpl(tdm_hwc_window *twindow) + : __twindow(twindow) +{} +DSDisplayDeviceHWCWindowTDMImpl::~DSDisplayDeviceHWCWindowTDMImpl() +{} +tdm_hwc_window *DSDisplayDeviceHWCWindowTDMImpl::getTDMHWCWindow() +{ + return __twindow; +} +} \ No newline at end of file diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.h b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.h new file mode 100644 index 0000000..43facd9 --- /dev/null +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.h @@ -0,0 +1,20 @@ +#ifndef _I_DS_DISPLAY_DEVICE_HWC_WINDOW_TDM_IMPL_H_ +#define _I_DS_DISPLAY_DEVICE_HWC_WINDOW_TDM_IMPL_H_ + +#include "IDSDisplayDeviceHWCWindow.h" +#include + +namespace display_server +{ +class DSDisplayDeviceHWCWindowTDMImpl : public IDSDisplayDeviceHWCWindow +{ +public: + DSDisplayDeviceHWCWindowTDMImpl(tdm_hwc_window *twindow); + ~DSDisplayDeviceHWCWindowTDMImpl(); + tdm_hwc_window *getTDMHWCWindow(); +private: + tdm_hwc_window* __twindow; +}; +} + +#endif diff --git a/src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.cpp new file mode 100644 index 0000000..6032cc5 --- /dev/null +++ b/src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.cpp @@ -0,0 +1,237 @@ +#include "DSDisplayDeviceOutputTDMImpl.h" +#include "DSDisplayDeviceHWCTDMImpl.h" +#include "DSDebugLog.h" +#include + +namespace display_server +{ +DSDisplayDeviceOutputTDMImpl::DSDisplayDeviceOutputTDMImpl(tdm_output *toutput) + : __toutput(toutput), + __resolutionWidth(0), + __resolutionHeight(0), + __physicalMMWidth(0), + __physicalMMHeight(0), + __mode(nullptr), + __dpmsMode(IDSDisplayDeviceOutput::DPMS_OFF), + __displayDeviceHWC(nullptr) +{ + tdm_error terror; + tdm_hwc *thwc; + + __initializeConnectorType(); + __updateConnectState(); + if (__connectState != IDSDisplayDeviceOutput::STATE_DISCONNECTED) { + __updatePhysicalMMSize(); + __updateAvailableModeList(); + } + + thwc = tdm_output_get_hwc(toutput, &terror); + if (thwc) { + __displayDeviceHWC = new DSDisplayDeviceHWCTDMImpl(thwc); + } else { + //TODO: need fallback for HWC + DSLOG_WRN("TDM OUTPUT", "tdm_output_get_hwc fails.\n"); + } + +} + +DSDisplayDeviceOutputTDMImpl::~DSDisplayDeviceOutputTDMImpl() +{ + delete __displayDeviceHWC; + __deleteAvailableModeList(); +} + +IDSDisplayDeviceOutput::ConnectorType DSDisplayDeviceOutputTDMImpl::getConnectType() +{ + return __connectorType; +} + +IDSDisplayDeviceOutput::ConnectState DSDisplayDeviceOutputTDMImpl::getConnectState() +{ + return __connectState; +} + +std::list DSDisplayDeviceOutputTDMImpl::getAvailableModes() +{ + return __availableModeList; +} + +int DSDisplayDeviceOutputTDMImpl::getResolutionWidth() +{ + return __resolutionWidth; +} + +int DSDisplayDeviceOutputTDMImpl::getResolutionHeight() +{ + return __resolutionHeight; +} + +int DSDisplayDeviceOutputTDMImpl::getPhysicalMMWidth() +{ + return __physicalMMWidth; +} + +int DSDisplayDeviceOutputTDMImpl::getPhysicalMMHeight() +{ + return __physicalMMHeight; +} + +bool DSDisplayDeviceOutputTDMImpl::setMode(DSDisplayDeviceOutputMode *mode) +{ + tdm_error terror; + const tdm_output_mode *ttmode = (tdm_output_mode *)mode->private_mode; + + terror = tdm_output_set_mode(__toutput, ttmode); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM OUTPUT", "tdm_output_set_mode fails.\n"); + return false; + } + + __mode = mode; + + return true; +} + +DSDisplayDeviceOutputMode *DSDisplayDeviceOutputTDMImpl::getMode() +{ + return __mode; +} + +bool DSDisplayDeviceOutputTDMImpl::setDPMSMode(DPMSMode dpmsMode) +{ + return false; +} + +IDSDisplayDeviceOutput::DPMSMode DSDisplayDeviceOutputTDMImpl::getDPMSMode() +{ + return __dpmsMode; +} + +IDSDisplayDeviceHWC *DSDisplayDeviceOutputTDMImpl::getHWC() +{ + return __displayDeviceHWC; +} + +void DSDisplayDeviceOutputTDMImpl::__initializeConnectorType() +{ + tdm_error terror; + tdm_output_type ttype; + + terror = tdm_output_get_output_type(__toutput, &ttype); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM OUTPUT", "tdm_output_get_output_type fails.\n"); + return; + } + + if (ttype == TDM_OUTPUT_TYPE_Unknown) + __connectorType = IDSDisplayDeviceOutput::TYPE_UNKNOWN; + else if (ttype == TDM_OUTPUT_TYPE_VGA) + __connectorType = IDSDisplayDeviceOutput::TYPE_VGA; + else if (ttype == TDM_OUTPUT_TYPE_DVII) + __connectorType = IDSDisplayDeviceOutput::TYPE_DVII; + if (ttype == TDM_OUTPUT_TYPE_DVID) + __connectorType = IDSDisplayDeviceOutput::TYPE_DVID; + if (ttype == TDM_OUTPUT_TYPE_DVIA) + __connectorType = IDSDisplayDeviceOutput::TYPE_DVIA; + if (ttype == TDM_OUTPUT_TYPE_Composite) + __connectorType = IDSDisplayDeviceOutput::TYPE_COMPOSITE; + if (ttype == TDM_OUTPUT_TYPE_SVIDEO) + __connectorType = IDSDisplayDeviceOutput::TYPE_SVIDEO; + if (ttype == TDM_OUTPUT_TYPE_LVDS) + __connectorType = IDSDisplayDeviceOutput::TYPE_LVDS; + if (ttype == TDM_OUTPUT_TYPE_Component) + __connectorType = IDSDisplayDeviceOutput::TYPE_COMPONENT; + if (ttype == TDM_OUTPUT_TYPE_9PinDIN) + __connectorType = IDSDisplayDeviceOutput::TYPE_9PinDIN; + if (ttype == TDM_OUTPUT_TYPE_DisplayPort) + __connectorType = IDSDisplayDeviceOutput::TYPE_DISPLAYPORT; + if (ttype == TDM_OUTPUT_TYPE_HDMIA) + __connectorType = IDSDisplayDeviceOutput::TYPE_HDMIA; + if (ttype == TDM_OUTPUT_TYPE_HDMIB) + __connectorType = IDSDisplayDeviceOutput::TYPE_HDMIB; + if (ttype == TDM_OUTPUT_TYPE_TV) + __connectorType = IDSDisplayDeviceOutput::TYPE_TV; + if (ttype == TDM_OUTPUT_TYPE_eDP) + __connectorType = IDSDisplayDeviceOutput::TYPE_EDP; + if (ttype == TDM_OUTPUT_TYPE_VIRTUAL) + __connectorType = IDSDisplayDeviceOutput::TYPE_VIRTUAL; + if (ttype == TDM_OUTPUT_TYPE_DSI) + __connectorType = IDSDisplayDeviceOutput::TYPE_DSI; + else + __connectorType = IDSDisplayDeviceOutput::TYPE_UNKNOWN; +} + +void DSDisplayDeviceOutputTDMImpl::__updateConnectState() +{ + tdm_error terror; + tdm_output_conn_status tstatus; + + terror = tdm_output_get_conn_status(__toutput, &tstatus); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM OUTPUT", "tdm_output_get_conn_status fails.\n"); + return; + } + + if (tstatus == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) + __connectState = IDSDisplayDeviceOutput::STATE_DISCONNECTED; + else if (tstatus == TDM_OUTPUT_CONN_STATUS_CONNECTED) + __connectState = IDSDisplayDeviceOutput::STATE_CONNECTED; + else if (tstatus == TDM_OUTPUT_CONN_STATUS_MODE_SETTED) + __connectState = IDSDisplayDeviceOutput::STATE_MODESET; + else + __connectState = IDSDisplayDeviceOutput::STATE_NONE; +} + + +void DSDisplayDeviceOutputTDMImpl::__updatePhysicalMMSize() +{ + tdm_error terror; + + terror = tdm_output_get_physical_size(__toutput, &__physicalMMWidth, &__physicalMMHeight); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM OUTPUT", "tdm_output_get_physical_size fails.\n"); + __physicalMMWidth = 0; + __physicalMMHeight = 0; + } +} + +void DSDisplayDeviceOutputTDMImpl::__deleteAvailableModeList() +{ + for (auto mode : __availableModeList) { + delete mode; + } + __availableModeList.clear(); +} + +void DSDisplayDeviceOutputTDMImpl::__updateAvailableModeList() +{ + tdm_error terror; + const tdm_output_mode *tmodes, *tmode; + int count = 0; + DSDisplayDeviceOutputMode *outputMode; + + // delete the existing availableModeList. + __deleteAvailableModeList(); + + terror = tdm_output_get_available_modes(__toutput, &tmodes, &count); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM OUTPUT", "tdm_output_get_available_modes fails.\n"); + return; + } + + for (int i = 0; i < count; i++) { + outputMode = new DSDisplayDeviceOutputMode(); + if (outputMode == nullptr) { + DSLOG_ERR("TDM OUTPUT", "allocation of outputMode fails.\n"); + break; + } + + tmode = &tmodes[i]; + memcpy(outputMode, tmode, (size_t)sizeof(tmode)); + outputMode->private_mode = (void *)tmode; + + __availableModeList.push_back(outputMode); + } +} + +} // namespace display_server diff --git a/src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.h b/src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.h new file mode 100644 index 0000000..ba3041a --- /dev/null +++ b/src/DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.h @@ -0,0 +1,56 @@ +#ifndef _I_DS_DISPLAY_DEVICE_OUTPUT_TDM_IMPL_H_ +#define _I_DS_DISPLAY_DEVICE_OUTPUT_TDM_IMPL_H_ + +#include "IDSDisplayDeviceOutput.h" +#include "IDSDisplayDeviceHWC.h" +#include + +namespace display_server +{ +class DSDisplayDeviceOutputTDMImpl : public IDSDisplayDeviceOutput +{ +public: + DSDisplayDeviceOutputTDMImpl(tdm_output *toutput); + ~DSDisplayDeviceOutputTDMImpl(); + + IDSDisplayDeviceOutput::ConnectorType getConnectType() override; + IDSDisplayDeviceOutput::ConnectState getConnectState() override; + std::list getAvailableModes() override; + int getResolutionWidth() override; + int getResolutionHeight() override; + int getPhysicalMMWidth() override; + int getPhysicalMMHeight() override; + bool setMode(DSDisplayDeviceOutputMode *mode) override; + DSDisplayDeviceOutputMode *getMode() override; + bool setDPMSMode(IDSDisplayDeviceOutput::DPMSMode dpmsMode) override; + DPMSMode getDPMSMode() override; + IDSDisplayDeviceHWC *getHWC() override; + + //TODO: int CallbackOutputAdded() override; + //TODO: int CallbackOutputRemoved() override; + //TODO: int CallbackOutputConnected() override; + //TODO: int CallbackOutputDisconnected() override; + //TODO: int CallbackOutputResolutionSet() override; + //TODO: int CallbackOutputVBlankTriggered() override; +private: + void __initializeConnectorType(); + void __updateConnectState(); + void __updatePhysicalMMSize(); + void __deleteAvailableModeList(); + void __updateAvailableModeList(); + + tdm_output *__toutput; + + IDSDisplayDeviceOutput::ConnectState __connectState; + IDSDisplayDeviceOutput::ConnectorType __connectorType; + std::list __availableModeList; + unsigned int __resolutionWidth, __resolutionHeight; + unsigned int __physicalMMWidth, __physicalMMHeight; + DSDisplayDeviceOutputMode *__mode; + IDSDisplayDeviceOutput::DPMSMode __dpmsMode; + + IDSDisplayDeviceHWC *__displayDeviceHWC; +}; +} + +#endif diff --git a/src/DSDisplayDevice/DSDisplayDeviceTDMImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceTDMImpl.cpp new file mode 100644 index 0000000..f79af90 --- /dev/null +++ b/src/DSDisplayDevice/DSDisplayDeviceTDMImpl.cpp @@ -0,0 +1,49 @@ +#include "DSDisplayDeviceTDMImpl.h" +#include "DSDisplayDeviceOutputTDMImpl.h" +#include "DSDebugLog.h" + +namespace display_server +{ + +DSDisplayDeviceTDMImpl::DSDisplayDeviceTDMImpl() + : __numOutputs(0) +{ + tdm_error terror; + + __tdisplay = tdm_display_init(&terror); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM DEVICE", "tdm_display_init fails.\n"); + } +} + +DSDisplayDeviceTDMImpl::~DSDisplayDeviceTDMImpl() +{ + tdm_display_deinit(__tdisplay); +} + +std::list DSDisplayDeviceTDMImpl::getOutputList() +{ + tdm_error terror; + tdm_output *toutput; + IDSDisplayDeviceOutput *deviceOutput; + + terror = tdm_display_get_output_count(__tdisplay, &__numOutputs); + if (__numOutputs <= 0) { + DSLOG_ERR("TDM DEVICE", "tdm_display_get_output_count fails.\n"); + return __outputList; + } + + for (int i = 0; i < __numOutputs; ++i) { + toutput = tdm_display_get_output(__tdisplay, i, &terror); + if (terror != TDM_ERROR_NONE) { + DSLOG_ERR("TDM DEVICE", "tdm_display_get_output fails.(output num: %d)\n", i); + return __outputList; + } + deviceOutput = new DSDisplayDeviceOutputTDMImpl(toutput); + __outputList.emplace_back(deviceOutput); + } + + return __outputList; +} + +} // namespace display_server diff --git a/src/DSDisplayDevice/DSDisplayDeviceTDMImpl.h b/src/DSDisplayDevice/DSDisplayDeviceTDMImpl.h new file mode 100644 index 0000000..8585152 --- /dev/null +++ b/src/DSDisplayDevice/DSDisplayDeviceTDMImpl.h @@ -0,0 +1,24 @@ +#ifndef _DS_DISPLAY_DEVICE_TDM_IMPL_H_ +#define _DS_DISPLAY_DEVICE_TDM_IMPL_H_ + +#include "IDSDisplayDevice.h" +#include + +namespace display_server +{ +class DSDisplayDeviceTDMImpl : public IDSDisplayDevice +{ +public: + DSDisplayDeviceTDMImpl(); + ~DSDisplayDeviceTDMImpl(); + + std::list getOutputList() override; + +private: + tdm_display *__tdisplay; + int __numOutputs; + std::list __outputList; +}; +} + +#endif diff --git a/src/DSDisplayDevice/IDSDisplayDevice.h b/src/DSDisplayDevice/IDSDisplayDevice.h new file mode 100644 index 0000000..cccc9f0 --- /dev/null +++ b/src/DSDisplayDevice/IDSDisplayDevice.h @@ -0,0 +1,18 @@ +#ifndef _I_DS_DISPLAY_DEVICE_H_ +#define _I_DS_DISPLAY_DEVICE_H_ + +#include +#include + +namespace display_server +{ +class IDSDisplayDevice +{ +public: + virtual ~IDSDisplayDevice() = default; + + virtual std::list getOutputList() = 0; +}; +} + +#endif diff --git a/src/DSDisplayDevice/IDSDisplayDeviceHWC.h b/src/DSDisplayDevice/IDSDisplayDeviceHWC.h new file mode 100644 index 0000000..995ee57 --- /dev/null +++ b/src/DSDisplayDevice/IDSDisplayDeviceHWC.h @@ -0,0 +1,19 @@ +#ifndef _I_DS_DISPLAY_DEVICE_HWC_H_ +#define _I_DS_DISPLAY_DEVICE_HWC_H_ + +#include "IDSDisplayDeviceHWCWindow.h" + +namespace display_server +{ +class IDSDisplayDeviceHWC +{ +public: + virtual ~IDSDisplayDeviceHWC() = default; + + virtual IDSDisplayDeviceHWCWindow *createHWCWindow() = 0; + virtual void destroyHWCWindow(IDSDisplayDeviceHWCWindow *deviceHWCWindow) = 0; + virtual bool commit() = 0; +}; +} + +#endif diff --git a/src/DSDisplayDevice/IDSDisplayDeviceHWCWindow.h b/src/DSDisplayDevice/IDSDisplayDeviceHWCWindow.h new file mode 100644 index 0000000..b565032 --- /dev/null +++ b/src/DSDisplayDevice/IDSDisplayDeviceHWCWindow.h @@ -0,0 +1,13 @@ +#ifndef _I_DS_DISPLAY_DEVICE_HWC_WINDOW_H_ +#define _I_DS_DISPLAY_DEVICE_HWC_WINDOW_H_ + +namespace display_server +{ +class IDSDisplayDeviceHWCWindow +{ +public: + virtual ~IDSDisplayDeviceHWCWindow() = default; +}; +} + +#endif diff --git a/src/DSDisplayDevice/IDSDisplayDeviceOutput.h b/src/DSDisplayDevice/IDSDisplayDeviceOutput.h new file mode 100644 index 0000000..4492c1a --- /dev/null +++ b/src/DSDisplayDevice/IDSDisplayDeviceOutput.h @@ -0,0 +1,85 @@ +#ifndef _I_DS_DISPLAY_DEVICE_OUTPUT_H_ +#define _I_DS_DISPLAY_DEVICE_OUTPUT_H_ + +#include +#include +#include "IDSDisplayDeviceHWC.h" + +#define NAME_LEN 64 + +namespace display_server +{ + +typedef struct _DSDisplayDeviceOutputMode { + unsigned int clock; + unsigned int hdisplay, hsync_start, hsync_end, htotal, hskew; + unsigned int vdisplay, vsync_start, vsync_end, vtotal, vscan; + unsigned int vrefresh; + unsigned int flags; + unsigned int type; + char name[NAME_LEN]; + const void *private_mode; +} DSDisplayDeviceOutputMode; + +class IDSDisplayDeviceOutput +{ +public: + enum ConnectState { + STATE_NONE, + STATE_DISCONNECTED, + STATE_CONNECTED, + STATE_MODESET + }; + enum ConnectorType { + TYPE_UNKNOWN, /**< unknown */ + TYPE_VGA, /**< VGA connection */ + TYPE_DVII, /**< DVII connection */ + TYPE_DVID, /**< DVID connection */ + TYPE_DVIA, /**< DVIA connection */ + TYPE_COMPOSITE, /**< Composite connection */ + TYPE_SVIDEO, /**< SVIDEO connection */ + TYPE_LVDS, /**< LVDS connection */ + TYPE_COMPONENT, /**< Component connection */ + TYPE_9PinDIN, /**< 9PinDIN connection */ + TYPE_DISPLAYPORT, /**< DisplayPort connection */ + TYPE_HDMIA, /**< HDMIA connection */ + TYPE_HDMIB, /**< HDMIB connection */ + TYPE_TV, /**< TV connection */ + TYPE_EDP, /**< eDP connection */ + TYPE_VIRTUAL, /**< Virtual connection for WiFi Display */ + TYPE_DSI /**< DSI connection */ + }; + enum DPMSMode { + DPMS_ON, + DPMS_STANDBY, + DPMS_SUSPEND, + DPMS_OFF + }; + +public: + virtual ~IDSDisplayDeviceOutput() = default; + + + virtual ConnectorType getConnectType() = 0; + virtual ConnectState getConnectState() = 0; + virtual std::list getAvailableModes() = 0; + virtual int getResolutionWidth() = 0; + virtual int getResolutionHeight() = 0; + virtual int getPhysicalMMWidth() = 0; + virtual int getPhysicalMMHeight() = 0; + virtual bool setMode(DSDisplayDeviceOutputMode *mode) = 0; + virtual DSDisplayDeviceOutputMode *getMode() = 0; + virtual bool setDPMSMode(DPMSMode dpmsMode) = 0; + virtual DPMSMode getDPMSMode() = 0; + virtual IDSDisplayDeviceHWC *getHWC() = 0; + + //TODO: virtual int CallbackOutputAdded() = 0; + //TODO: virtual int CallbackOutputRemoved() = 0; + //TODO: virtual int CallbackOutputConnected() = 0; + //TODO: virtual int CallbackOutputDisconnected() = 0; + //TODO: virtual int CallbackOutputResolutionSet() = 0; + //TODO: virtual int CallbackOutputVBlankTriggered() = 0; +}; +} + +#endif diff --git a/src/meson.build b/src/meson.build index b78b54c..353dec0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -9,6 +9,10 @@ libds_srcs = [ 'DSCompositor/DSCompositor.cpp', 'DSDebug/DSDebugLog.cpp', 'DSDisplayArea/DSDisplayArea.cpp', + 'DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp', + 'DSDisplayDevice/DSDisplayDeviceHWCWindowTDMImpl.cpp', + 'DSDisplayDevice/DSDisplayDeviceOutputTDMImpl.cpp', + 'DSDisplayDevice/DSDisplayDeviceTDMImpl.cpp', 'DSInput/DSInput.cpp', 'DSObject/DSObject.cpp', 'DSObject/DSObject.h', @@ -44,6 +48,7 @@ install_headers( pkgconfig = import('pkgconfig') dlog_dep = dependency('dlog') +libtdm_dep = dependency('libtdm') libds_deps = [] libds_include_dirs = include_directories( @@ -55,6 +60,7 @@ libds_include_dirs = include_directories( './DSCompositor', './DSDebug', './DSDisplayArea', + './DSDisplayDevice', './DSHWC', './DSInput', './DSObject', @@ -69,7 +75,7 @@ libds_include_dirs = include_directories( libds_lib = shared_library( 'libds', libds_srcs, - dependencies : dlog_dep, + dependencies : [dlog_dep, libtdm_dep], include_directories : [libds_include_dirs], version : meson.project_version(), install : true diff --git a/tests/DSDisplayDeviceTDMImpl-test.cpp b/tests/DSDisplayDeviceTDMImpl-test.cpp new file mode 100644 index 0000000..286282a --- /dev/null +++ b/tests/DSDisplayDeviceTDMImpl-test.cpp @@ -0,0 +1,181 @@ +#include "libds-tests.h" +#include "DSDisplayDeviceTDMImpl.h" + +using namespace display_server; + +class DSDisplayDeviceTDMImplTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + // for wl_display_add_socket(private_loop->wl_display, "tdm-socket") at tdm_server_init + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +// DSDisplayDeviceTDMImpl + +TEST_F(DSDisplayDeviceTDMImplTest, Device_New) +{ + DSDisplayDeviceTDMImpl *dispayDeviceTDM = new DSDisplayDeviceTDMImpl; + EXPECT_TRUE(dispayDeviceTDM != nullptr); + + delete dispayDeviceTDM; +} + +TEST_F(DSDisplayDeviceTDMImplTest, Device_getOutputList) +{ + IDSDisplayDevice *dispayDevice = new DSDisplayDeviceTDMImpl; + std::list outputList = dispayDevice->getOutputList(); + EXPECT_TRUE(outputList.size() != 0); + + delete dispayDevice; +} + +// DSDisplayDeviceTDMOutputImpl + +TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_getInitialValues) +{ + IDSDisplayDevice *dispayDevice = new DSDisplayDeviceTDMImpl; + std::list outputList = dispayDevice->getOutputList(); + EXPECT_TRUE(outputList.size() != 0); + + IDSDisplayDeviceOutput::ConnectorType connType; + IDSDisplayDeviceOutput::ConnectState connState; + + for (IDSDisplayDeviceOutput *output : outputList) { + connType = output->getConnectType(); + EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI); + connState = output->getConnectState(); + EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET); + if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED) { + EXPECT_TRUE((output->getAvailableModes()).size() != 0); + EXPECT_TRUE(output->getResolutionWidth() == 0); + EXPECT_TRUE(output->getResolutionHeight() == 0); + EXPECT_TRUE(output->getPhysicalMMWidth() == 0); + EXPECT_TRUE(output->getPhysicalMMHeight() == 0); + EXPECT_TRUE(output->getMode() == nullptr); + EXPECT_TRUE(output->getDPMSMode() == IDSDisplayDeviceOutput::DPMS_OFF); + EXPECT_TRUE(output->getHWC() != nullptr); + } else { // IDSDisplayDeviceOutput::STATE_CONNECTED and IDSDisplayDeviceOutput::STATE_MODESET + EXPECT_TRUE((output->getAvailableModes()).size() != 0); + EXPECT_TRUE(output->getResolutionWidth() == 0); + EXPECT_TRUE(output->getResolutionHeight() == 0); + EXPECT_TRUE(output->getPhysicalMMWidth() > 0); + EXPECT_TRUE(output->getPhysicalMMHeight() > 0); + EXPECT_TRUE(output->getMode() == nullptr); + EXPECT_TRUE(output->getDPMSMode() == IDSDisplayDeviceOutput::DPMS_OFF); + EXPECT_TRUE(output->getHWC() != nullptr); + } + } + + delete dispayDevice; +} + +TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_setModeBestResolution) +{ + IDSDisplayDevice *dispayDevice = new DSDisplayDeviceTDMImpl; + std::list outputList = dispayDevice->getOutputList(); + EXPECT_TRUE(outputList.size() != 0); + + IDSDisplayDeviceOutput::ConnectorType connType; + IDSDisplayDeviceOutput::ConnectState connState; + DSDisplayDeviceOutputMode *bestMode; + + for (IDSDisplayDeviceOutput *output : outputList) { + connType = output->getConnectType(); + EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI); + connState = output->getConnectState(); + EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET); + if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED) continue; + + bestMode = nullptr; + + for (DSDisplayDeviceOutputMode *mode : output->getAvailableModes()) { + if (bestMode == nullptr) { + bestMode = mode; + continue; + } + + int resSize = mode->hdisplay * mode->vdisplay; + int resSizeBest = bestMode->hdisplay *bestMode->vdisplay; + if (resSize > resSizeBest) { + bestMode = mode; + } + } + + EXPECT_TRUE(output->setMode(bestMode) == true); + EXPECT_TRUE(output->getMode() == bestMode); + } + + delete dispayDevice; +} + +// DSDisplayDeviceTDMHWC + +TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_createHWCWindow) +{ + IDSDisplayDevice *dispayDevice = new DSDisplayDeviceTDMImpl; + std::list outputList = dispayDevice->getOutputList(); + EXPECT_TRUE(outputList.size() != 0); + + IDSDisplayDeviceOutput::ConnectorType connType; + IDSDisplayDeviceOutput::ConnectState connState; + IDSDisplayDeviceHWC *deviceHWC; + IDSDisplayDeviceHWCWindow *deviceHWCWindow; + + for (IDSDisplayDeviceOutput *output : outputList) { + connType = output->getConnectType(); + EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI); + connState = output->getConnectState(); + EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET); + if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED) continue; + + deviceHWC = output->getHWC(); + EXPECT_TRUE(deviceHWC != nullptr); + + deviceHWCWindow = deviceHWC->createHWCWindow(); + EXPECT_TRUE(deviceHWC != nullptr); + + deviceHWC->destroyHWCWindow(deviceHWCWindow); + } + + delete dispayDevice; +} + +TEST_F(DSDisplayDeviceTDMImplTest, DeviceHWC_commit) +{ + IDSDisplayDevice *dispayDevice = new DSDisplayDeviceTDMImpl; + std::list outputList = dispayDevice->getOutputList(); + EXPECT_TRUE(outputList.size() != 0); + + IDSDisplayDeviceOutput::ConnectorType connType; + IDSDisplayDeviceOutput::ConnectState connState; + IDSDisplayDeviceHWC *deviceHWC; + IDSDisplayDeviceHWCWindow *deviceHWCWindow; + + for (IDSDisplayDeviceOutput *output : outputList) { + connType = output->getConnectType(); + EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI); + connState = output->getConnectState(); + EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET); + if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED) continue; + + deviceHWC = output->getHWC(); + EXPECT_TRUE(deviceHWC != nullptr); + + deviceHWCWindow = deviceHWC->createHWCWindow(); + EXPECT_TRUE(deviceHWC != nullptr); + + // commit + deviceHWC->commit(); + + deviceHWC->destroyHWCWindow(deviceHWCWindow); + } + + delete dispayDevice; +} \ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build index 7aa3b8d..7ae68c0 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -13,6 +13,7 @@ libds_unittests_srcs = [ 'DSPolicyArea-test.cpp', 'DSDisplayArea-test.cpp', 'DSDebugLog-test.cpp', + 'DSDisplayDeviceTDMImpl-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From a2b65a9bcc9eafd8299f485f4d92ce65c825f92f Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 16 Jun 2020 13:41:18 +0900 Subject: [PATCH 16/16] use the namespace display_server at samples and tests Change-Id: I1f2278d6a6fea0ce683db41829ec0e3b3ad16869 --- samples/exampleObjectPimpl.cpp | 128 +++++++++++++++++----------------- samples/exampleProperty.cpp | 153 ++++++++++++++++++++--------------------- samples/exampleSignalSlot.cpp | 147 +++++++++++++++++++-------------------- tests/DSProperty-test.cpp | 20 +++--- tests/DSRefBase-test.cpp | 4 +- 5 files changed, 223 insertions(+), 229 deletions(-) diff --git a/samples/exampleObjectPimpl.cpp b/samples/exampleObjectPimpl.cpp index d098b6b..c06242f 100644 --- a/samples/exampleObjectPimpl.cpp +++ b/samples/exampleObjectPimpl.cpp @@ -5,91 +5,91 @@ /* RESULT === ObjectPimpl *myobj = new ObjectPimpl() === -Constructor 'ObjectPimplPrivate' : example::ObjectPimplPrivate::ObjectPimplPrivate(example::ObjectPimpl*) -Constructor 'ObjectPimpl' : example::ObjectPimpl::ObjectPimpl() +Constructor 'ObjectPimplPrivate' : ObjectPimplPrivate::ObjectPimplPrivate(ObjectPimpl*) +Constructor 'ObjectPimpl' : ObjectPimpl::ObjectPimpl() === ObjectPimpl *myobj2 = new ObjectPimpl() === -Constructor 'ObjectPimplPrivate' : example::ObjectPimplPrivate::ObjectPimplPrivate(example::ObjectPimpl*) -Constructor 'ObjectPimpl' : example::ObjectPimpl::ObjectPimpl() +Constructor 'ObjectPimplPrivate' : ObjectPimplPrivate::ObjectPimplPrivate(ObjectPimpl*) +Constructor 'ObjectPimpl' : ObjectPimpl::ObjectPimpl() === delete myobj === -Destructor 'ObjectPimpl' : virtual example::ObjectPimpl::~ObjectPimpl() -Destructor 'ObjectPimplPrivate' : virtual example::ObjectPimplPrivate::~ObjectPimplPrivate() +Destructor 'ObjectPimpl' : virtual ObjectPimpl::~ObjectPimpl() +Destructor 'ObjectPimplPrivate' : virtual ObjectPimplPrivate::~ObjectPimplPrivate() === delete myobj2 === -Destructor 'ObjectPimpl' : virtual example::ObjectPimpl::~ObjectPimpl() -Destructor 'ObjectPimplPrivate' : virtual example::ObjectPimplPrivate::~ObjectPimplPrivate() +Destructor 'ObjectPimpl' : virtual ObjectPimpl::~ObjectPimpl() +Destructor 'ObjectPimplPrivate' : virtual ObjectPimplPrivate::~ObjectPimplPrivate() */ -namespace example { - class ObjectPimpl; - - class ObjectPimplPrivate : public display_server::DSObjectPrivate { - public: - ObjectPimplPrivate() = delete; - ObjectPimplPrivate(ObjectPimpl *p_ptr); - ~ObjectPimplPrivate(); - }; - - class ObjectPimpl : public display_server::DSObject { - public: - explicit ObjectPimpl(); - virtual ~ObjectPimpl(); - - private: - inline ObjectPimplPrivate *d_func() - { - return reinterpret_cast(__d_ptr.get()); - } - inline const ObjectPimplPrivate *d_func() const - { - return reinterpret_cast(__d_ptr.get()); - } - friend class ObjectPimplPrivate; - }; - - ObjectPimplPrivate::ObjectPimplPrivate(ObjectPimpl *p_ptr) : - display_server::DSObjectPrivate(p_ptr) - { - std::cout << "Constructor 'ObjectPimplPrivate' : " << __PRETTY_FUNCTION__ << std::endl; - } +using namespace display_server; - ObjectPimplPrivate::~ObjectPimplPrivate() - { - std::cout << "Destructor 'ObjectPimplPrivate' : " << __PRETTY_FUNCTION__ << std::endl; - } +class ObjectPimpl; + +class ObjectPimplPrivate : public DSObjectPrivate { +public: + ObjectPimplPrivate() = delete; + ObjectPimplPrivate(ObjectPimpl *p_ptr); + ~ObjectPimplPrivate(); +}; + +class ObjectPimpl : public DSObject { +public: + explicit ObjectPimpl(); + virtual ~ObjectPimpl(); - ObjectPimpl::ObjectPimpl() : - display_server::DSObject(std::make_unique(this)) +private: + inline ObjectPimplPrivate *d_func() { - std::cout << "Constructor 'ObjectPimpl' : " << __PRETTY_FUNCTION__ << std::endl; + return reinterpret_cast(__d_ptr.get()); } - - ObjectPimpl::~ObjectPimpl() + inline const ObjectPimplPrivate *d_func() const { - std::cout << "Destructor 'ObjectPimpl' : " << __PRETTY_FUNCTION__ << std::endl; + return reinterpret_cast(__d_ptr.get()); } + friend class ObjectPimplPrivate; +}; - int exampleObjectPimpl(void) - { - std::cout << "\n=== ObjectPimpl *myobj = new ObjectPimpl() ===" << std::endl; - ObjectPimpl *myobj = new ObjectPimpl(); +ObjectPimplPrivate::ObjectPimplPrivate(ObjectPimpl *p_ptr) : + DSObjectPrivate(p_ptr) +{ + std::cout << "Constructor 'ObjectPimplPrivate' : " << __PRETTY_FUNCTION__ << std::endl; +} - std::cout << "\n=== ObjectPimpl *myobj2 = new ObjectPimpl() ===" << std::endl; - ObjectPimpl *myobj2 = new ObjectPimpl(); +ObjectPimplPrivate::~ObjectPimplPrivate() +{ + std::cout << "Destructor 'ObjectPimplPrivate' : " << __PRETTY_FUNCTION__ << std::endl; +} - std::cout << "\n=== delete myobj ===" << std::endl; - delete myobj; +ObjectPimpl::ObjectPimpl() : + DSObject(std::make_unique(this)) +{ + std::cout << "Constructor 'ObjectPimpl' : " << __PRETTY_FUNCTION__ << std::endl; +} - std::cout << "\n=== delete myobj2 ===" << std::endl; - delete myobj2; +ObjectPimpl::~ObjectPimpl() +{ + std::cout << "Destructor 'ObjectPimpl' : " << __PRETTY_FUNCTION__ << std::endl; +} - return 0; - } -} // namespace example +int exampleObjectPimpl(void) +{ + std::cout << "\n=== ObjectPimpl *myobj = new ObjectPimpl() ===" << std::endl; + ObjectPimpl *myobj = new ObjectPimpl(); + + std::cout << "\n=== ObjectPimpl *myobj2 = new ObjectPimpl() ===" << std::endl; + ObjectPimpl *myobj2 = new ObjectPimpl(); + + std::cout << "\n=== delete myobj ===" << std::endl; + delete myobj; + + std::cout << "\n=== delete myobj2 ===" << std::endl; + delete myobj2; + + return 0; +} int main() { - return example::exampleObjectPimpl(); + return exampleObjectPimpl(); } diff --git a/samples/exampleProperty.cpp b/samples/exampleProperty.cpp index e3520d0..a67d542 100644 --- a/samples/exampleProperty.cpp +++ b/samples/exampleProperty.cpp @@ -4,10 +4,10 @@ /* RESULT === Property *myproperty = new Property() === -Constructor 'Property' : example::Property::Property() +Constructor 'Property' : Property::Property() === Property *myproperty2 = new Property() === -Constructor 'Property' : example::Property::Property() +Constructor 'Property' : Property::Property() === Add Property [myProperty:1234(int)] to myproperty Try get Property (key:"myProperty", type:int) of myproperty @@ -24,92 +24,87 @@ Try get Property (key:"yourProperty", type:DSPropertyVariant&) of myproperty SUCCESS: NOT_EXIST === delete myproperty === -Destructor 'Property' : virtual example::Property::~Property() +Destructor 'Property' : virtual Property::~Property() === delete myproperty2 === -Destructor 'Property' : virtual example::Property::~Property() +Destructor 'Property' : virtual Property::~Property() */ -namespace example { - class Property : public display_server::DSObject { - public: - explicit Property(); - virtual ~Property(); - }; +using namespace display_server; - Property::Property() - { - std::cout << "Constructor 'Property' : " << __PRETTY_FUNCTION__ << std::endl; +class Property : public DSObject { +public: + explicit Property(); + virtual ~Property(); +}; + +Property::Property() +{ + std::cout << "Constructor 'Property' : " << __PRETTY_FUNCTION__ << std::endl; +} + +Property::~Property() +{ + std::cout << "Destructor 'Property' : " << __PRETTY_FUNCTION__ << std::endl; +} + +int main() +{ + std::cout << "\n=== Property *myproperty = new Property() ===" << std::endl; + Property *myproperty = new Property(); + + std::cout << "\n=== Property *myproperty2 = new Property() ===" << std::endl; + Property *myproperty2 = new Property(); + + std::cout << "\n=== Add Property [myProperty:1234(int)] to myproperty ===" << std::endl; + myproperty->setProperty("myProperty", 1234, DSPropertyType::INTEGER); + try { + std::cout << "Try get Property (key:\"myProperty\", type:int) of myproperty" << std::endl; + std::cout << "myProperty: " << std::get(myproperty->getProperty("myProperty")) << std::endl; + } + catch (std::exception &e) { + std::cout << "ERR: " << e.what() << std::endl; + } + try { + std::cout << "Try get Property (key:\"myProperty\", type:float) of myproperty" << std::endl; + std::cout << std::get(myproperty->getProperty("myProperty")) << std::endl; + } + catch (std::exception &e) { + std::cout << "ERR: " << e.what() << std::endl; } - Property::~Property() - { - std::cout << "Destructor 'Property' : " << __PRETTY_FUNCTION__ << std::endl; + std::cout << "\n=== Add Property [myProperty:" << myproperty2 << "(ptr)] to myproperty ===" << std::endl; + myproperty->setProperty("myProperty", static_cast(myproperty2), DSPropertyType::POINTER); + try { + std::cout << "Try get Property (key:\"myProperty\", type:int) of myproperty" << std::endl; + std::cout << std::get(myproperty->getProperty("myProperty")) << std::endl; + } + catch (std::exception &e) { + std::cout << "ERR: " << e.what() << std::endl; + } + try { + std::cout << "Try get Property (key:\"myProperty\", type:void *) of myproperty" << std::endl; + Property *mypropertyptr = static_cast(std::get(myproperty->getProperty("myProperty"))); + std::cout << "myProperty: " << mypropertyptr << std::endl; + } + catch (std::exception &e) { + std::cout << "ERR: " << e.what() << std::endl; } - int exampleProperty(void) - { - std::cout << "\n=== Property *myproperty = new Property() ===" << std::endl; - Property *myproperty = new Property(); - - std::cout << "\n=== Property *myproperty2 = new Property() ===" << std::endl; - Property *myproperty2 = new Property(); - - std::cout << "\n=== Add Property [myProperty:1234(int)] to myproperty ===" << std::endl; - myproperty->setProperty("myProperty", 1234, display_server::DSPropertyType::INTEGER); - try { - std::cout << "Try get Property (key:\"myProperty\", type:int) of myproperty" << std::endl; - std::cout << "myProperty: " << std::get(myproperty->getProperty("myProperty")) << std::endl; - } - catch (std::exception &e) { - std::cout << "ERR: " << e.what() << std::endl; - } - try { - std::cout << "Try get Property (key:\"myProperty\", type:float) of myproperty" << std::endl; - std::cout << std::get(myproperty->getProperty("myProperty")) << std::endl; - } - catch (std::exception &e) { - std::cout << "ERR: " << e.what() << std::endl; - } - - std::cout << "\n=== Add Property [myProperty:" << myproperty2 << "(ptr)] to myproperty ===" << std::endl; - myproperty->setProperty("myProperty", static_cast(myproperty2), display_server::DSPropertyType::POINTER); - try { - std::cout << "Try get Property (key:\"myProperty\", type:int) of myproperty" << std::endl; - std::cout << std::get(myproperty->getProperty("myProperty")) << std::endl; - } - catch (std::exception &e) { - std::cout << "ERR: " << e.what() << std::endl; - } - try { - std::cout << "Try get Property (key:\"myProperty\", type:void *) of myproperty" << std::endl; - Property *mypropertyptr = static_cast(std::get(myproperty->getProperty("myProperty"))); - std::cout << "myProperty: " << mypropertyptr << std::endl; - } - catch (std::exception &e) { - std::cout << "ERR: " << e.what() << std::endl; - } - - try { - std::cout << "Try get Property (key:\"yourProperty\", type:DSPropertyVariant&) of myproperty" << std::endl; - const display_server::DSPropertyVariant &ptr = myproperty->getProperty("yourProperty"); - std::cout << " THIS LINE SHOULD BE NOT PRINTED! yourProperty: " << &ptr << std::endl; - } - catch (std::exception &e) { - std::cout << "SUCCESS: " << e.what() << std::endl; - } - - std::cout << "\n=== delete myproperty ===" << std::endl; - delete myproperty; - - std::cout << "\n=== delete myproperty2 ===" << std::endl; - delete myproperty2; - - return 0; + try { + std::cout << "Try get Property (key:\"yourProperty\", type:DSPropertyVariant&) of myproperty" << std::endl; + const DSPropertyVariant &ptr = myproperty->getProperty("yourProperty"); + std::cout << " THIS LINE SHOULD BE NOT PRINTED! yourProperty: " << &ptr << std::endl; + } + catch (std::exception &e) { + std::cout << "SUCCESS: " << e.what() << std::endl; } -} // namespace example -int main() -{ - return example::exampleProperty(); + std::cout << "\n=== delete myproperty ===" << std::endl; + delete myproperty; + + std::cout << "\n=== delete myproperty2 ===" << std::endl; + delete myproperty2; + + return 0; } diff --git a/samples/exampleSignalSlot.cpp b/samples/exampleSignalSlot.cpp index 42e35f3..7b91bd5 100644 --- a/samples/exampleSignalSlot.cpp +++ b/samples/exampleSignalSlot.cpp @@ -19,98 +19,93 @@ destruct Sender destruct Sender destruct Receiver(ref: 1) */ -namespace example { - using SignalAType = display_server::DSSignal; - using SignalBType = display_server::DSSignal; +using namespace display_server; - class Sender : public display_server::DSObject { - public: - Sender() : - display_server::DSObject() - { - std::cout << "construct Sender" << std::endl; - } - ~Sender() - { - std::cout << "destruct Sender " << getName() << std::endl; - } +using SignalAType = DSSignal; +using SignalBType = DSSignal; - struct SignalA : public SignalAType { - void emit(int val) - { - SignalAType::emit(val); - } - } signalA; - - struct SignalB : public SignalBType { - void emit(double val) - { - SignalBType::emit(val); - } - } signalB; - }; +class Sender : public DSObject { +public: + Sender() : + DSObject() + { + std::cout << "construct Sender" << std::endl; + } + ~Sender() + { + std::cout << "destruct Sender " << getName() << std::endl; + } - class Receiver : public display_server::DSObject, public display_server::DSRefBase { - public: - Receiver() : - display_server::DSObject(), display_server::DSRefBase() - { - std::cout << "construct Receiver" << std::endl; - } - ~Receiver() + struct SignalA : public SignalAType { + void emit(int val) { - std::cout << "destruct Receiver(ref: " << getref() << ") " << getName() << std::endl; + SignalAType::emit(val); } + } signalA; - static void slotA(int a) + struct SignalB : public SignalBType { + void emit(double val) { - std::cout << "slotA invoked! a:" << a << std::endl; - }; - static void slotA2(int a) - { - std::cout << "slotA2 invoked! a:" << a << std::endl; + SignalBType::emit(val); } - static void slotB(double a) - { - std::cout << "slotB invoked! a:" << a << std::endl; - }; - }; + } signalB; +}; - int main(void) +class Receiver : public DSObject, public DSRefBase { +public: + Receiver() : + DSObject(), DSRefBase() { - Sender *sender = new Sender(); - Sender *sender2 = new Sender(); - Receiver *receiver = new Receiver(); - Receiver *receiver2 = new Receiver(); - - sender->signalA.connect(receiver, Receiver::slotA); - sender->signalA.connect(receiver2, Receiver::slotA2); - sender->signalB.connect(receiver, Receiver::slotB); - sender->signalB.connect(receiver2, [](double val) { - std::cout << "Lambda slot invoked! val: " << val << std::endl; - }); + std::cout << "construct Receiver" << std::endl; + } + ~Receiver() + { + std::cout << "destruct Receiver(ref: " << getref() << ") " << getName() << std::endl; + } - sender->signalA.emit(1234); - sender->signalB.emit(45.67); + static void slotA(int a) + { + std::cout << "slotA invoked! a:" << a << std::endl; + }; + static void slotA2(int a) + { + std::cout << "slotA2 invoked! a:" << a << std::endl; + } + static void slotB(double a) + { + std::cout << "slotB invoked! a:" << a << std::endl; + }; +}; - if (receiver2->getref() == 1) { - receiver2->unref(); - receiver2 = nullptr; - } +int main(void) +{ + Sender *sender = new Sender(); + Sender *sender2 = new Sender(); + Receiver *receiver = new Receiver(); + Receiver *receiver2 = new Receiver(); - sender->signalB.emit(5678); - sender->signalA.emit(90.1); + sender->signalA.connect(receiver, Receiver::slotA); + sender->signalA.connect(receiver2, Receiver::slotA2); + sender->signalB.connect(receiver, Receiver::slotB); + sender->signalB.connect(receiver2, [](double val) { + std::cout << "Lambda slot invoked! val: " << val << std::endl; + }); - delete sender; - delete sender2; - delete receiver; + sender->signalA.emit(1234); + sender->signalB.emit(45.67); - return 0; + if (receiver2->getref() == 1) { + receiver2->unref(); + receiver2 = nullptr; } -} // namespace example -int main() -{ - return example::main(); + sender->signalB.emit(5678); + sender->signalA.emit(90.1); + + delete sender; + delete sender2; + delete receiver; + + return 0; } diff --git a/tests/DSProperty-test.cpp b/tests/DSProperty-test.cpp index 9c27f31..700c8a6 100644 --- a/tests/DSProperty-test.cpp +++ b/tests/DSProperty-test.cpp @@ -1,6 +1,8 @@ #include "libds-tests.h" #include "DSProperty.h" +using namespace display_server; + class DSPropertyTest : public ::testing::Test { public: @@ -16,16 +18,16 @@ public: TEST_F(DSPropertyTest, CreateProperty) { - /* display_server::DSProperty::DSProperty()*/ - display_server::DSProperty* pro = new display_server::DSProperty(); + /* DSProperty::DSProperty()*/ + DSProperty* pro = new DSProperty(); ASSERT_NE(pro, nullptr) << "Failed to DSProperty()"; delete pro; - /* display_server::DSProperty::DSProperty(std::__cxx11::string, const DSPropertyVariant&, display_server::DSPropertyType) */ - pro = new display_server::DSProperty("testProperty", 2020, display_server::DSPropertyType::INTEGER); + /* DSProperty::DSProperty(std::__cxx11::string, const DSPropertyVariant&, DSPropertyType) */ + pro = new DSProperty("testProperty", 2020, DSPropertyType::INTEGER); ASSERT_NE(pro, nullptr) << "Failed to DSProperty(key, data, type)"; ASSERT_EQ(pro->getKey(), "testProperty") << "Key value mismatch!"; - ASSERT_EQ(pro->getType(), display_server::DSPropertyType::INTEGER) << "Type mistmatch!!"; + ASSERT_EQ(pro->getType(), DSPropertyType::INTEGER) << "Type mistmatch!!"; try { int data = std::get(pro->getData()); ASSERT_TRUE(data == 2020) << "data value mismatch!!"; @@ -34,12 +36,12 @@ TEST_F(DSPropertyTest, CreateProperty) } delete pro; - /* display_server::DSProperty::DSProperty(display_server::DSProperty&) */ - display_server::DSProperty pro_s("testProperty2", 20.20, display_server::DSPropertyType::DOUBLE); - pro = new display_server::DSProperty(pro_s); + /* DSProperty::DSProperty(DSProperty&) */ + DSProperty pro_s("testProperty2", 20.20, DSPropertyType::DOUBLE); + pro = new DSProperty(pro_s); ASSERT_NE(pro, nullptr) << "Failed to DSProperty(const DSProperty&)"; ASSERT_EQ(pro->getKey(), "testProperty2") << "Key value mismatch!"; - ASSERT_EQ(pro->getType(), display_server::DSPropertyType::DOUBLE) << "Type mistmatch!!"; + ASSERT_EQ(pro->getType(), DSPropertyType::DOUBLE) << "Type mistmatch!!"; try { double data = std::get(pro->getData()); ASSERT_TRUE(data == 20.20) << "data value mismatch!!"; diff --git a/tests/DSRefBase-test.cpp b/tests/DSRefBase-test.cpp index 56853f8..086ea6b 100644 --- a/tests/DSRefBase-test.cpp +++ b/tests/DSRefBase-test.cpp @@ -1,6 +1,8 @@ #include "libds-tests.h" #include "DSRefBase.h" +using namespace display_server; + class DSRefBaseTest : public ::testing::Test { public: @@ -16,7 +18,7 @@ public: TEST_F(DSRefBaseTest, CreateRefBase) { - display_server::DSRefBase *refBase = new display_server::DSRefBase(); + DSRefBase *refBase = new DSRefBase(); int count1; int count2; -- 2.7.4