From b796043fa7fcbe224a0a0cf66880a0c266ab81d4 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 28 Jul 2020 14:23:14 +0900 Subject: [PATCH] DSZone : add registerCallbackWindowCreated method Change-Id: I08b43f97474ba7af8ddc0c083403eabf38fd3b82 --- src/DSZone/DSZone.cpp | 23 +++++++++++++++++++++-- src/DSZone/DSZone.h | 9 +++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 044b003..0e83d01 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -47,10 +47,29 @@ int DSZone::getHeight() return policyAreaPriv->getHeight(); } +void DSZone::registerCallbackWindowCreated(DSObject *slot, std::function)> func) +{ + this->__windowCreatedSignal.connect(slot, func); +} + +void DSZone::callCallbackWindowCreated() +{ + __windowCreatedSignal.emit(nullptr); +} + void DSZone::onSurfaceCreated(std::shared_ptr waylandSurface) { - //TODO: create DSWindow - //TODO: create DSRenderView + // create DSWindow + std::shared_ptr window = std::make_shared(); + __windowList.push_front(window); + + //TODO: fix the vaules of (x, y, w, h) + // DSWindow does not need to provide the interface to set the (x, y, w, h). + // Those values have to be determined by the window manager policy (DSWindowShell). + window->create(0, 0, 720, 1280, NULL); + + // emit a signal of the surface committed + __windowCreatedSignal.emit(window); } } // namespace display_server \ No newline at end of file diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 8fa834f..58bea43 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -20,12 +20,21 @@ public: int getWidth(); int getHeight(); + // Callback methods + void registerCallbackWindowCreated(DSObject *slot, std::function)> func); + + // emit functions for testing + void callCallbackWindowCreated(); + private: void onSurfaceCreated(std::shared_ptr waylandSurface); std::shared_ptr __policyArea; std::list> __windowList; DSWaylandCompositor *__waylandCompositor; + + // signals + DSSignal> __windowCreatedSignal; }; } -- 2.7.4