From: Sung-Jin Park Date: Fri, 31 Jul 2020 11:43:55 +0000 (+0900) Subject: DSZone: add getWindowList(), findWindow() to make a relationship between a shell... X-Git-Tag: accepted/tizen/unified/20200820.213435~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F241710%2F1;p=platform%2Fcore%2Fuifw%2Flibds.git DSZone: add getWindowList(), findWindow() to make a relationship between a shell surface and a window shell instance Change-Id: I7ca938cde5e75a6d1253a30e2830c7885390cf23 Signed-off-by: Sung-Jin Park --- diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 3633131..4b41491 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -2,6 +2,7 @@ #include "DSWaylandCompositor.h" #include "DSWaylandSurface.h" #include "DSWaylandZxdgShellV6.h" +#include "DSDebugLog.h" namespace display_server { @@ -81,20 +82,38 @@ void DSZone::callCallbackWindowShellCreated() __windowShellCreatedSignal.emit(nullptr); } -void DSZone::__onShellSurfaceCreated(std::shared_ptr shellSurface) +std::list> DSZone::getWindowList() +{ + return __windowList; +} + +std::shared_ptr DSZone::__findWindow(DSWaylandSurface *dswlSurface) { - DSWindow *window = nullptr; + std::list> wList = getWindowList(); + for (auto w : wList) + { + if (w->surface() == dswlSurface) + { + DSLOG_INF("DSZone", "Window found (win=%p, surface=%p)", w, dswlSurface); + return w; + } + } + + return nullptr; +} - struct ::wl_resource *surface; - surface = shellSurface->getWlSurface(); +void DSZone::__onShellSurfaceCreated(std::shared_ptr shellSurface) +{ + struct ::wl_resource *surface = shellSurface->getWlSurface(); + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); - // TODO: we need a function to find DSWindow - //window = __findWindow(surface); + std::shared_ptr window = __findWindow(dswlSurface); - std::shared_ptr shell = std::make_shared(window); + std::shared_ptr shell = std::make_shared(window.get()); __windowShellList.push_front(shell); // emit a signal of the shell created __windowShellCreatedSignal.emit(shell); } + } // namespace display_server diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 5bb7550..4a39c0a 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -34,9 +34,12 @@ public: void callCallbackWindowCreated(); void callCallbackWindowShellCreated(); + std::list> getWindowList(); + private: void onSurfaceCreated(std::shared_ptr waylandSurface); void __onShellSurfaceCreated(std::shared_ptr shellSurface); + std::shared_ptr __findWindow(DSWaylandSurface *dswlSurface); stPosition __position; stSize __size;