#include "DSWaylandCompositor.h"
#include "DSWaylandSurface.h"
#include "DSWaylandZxdgShellV6.h"
+#include "DSDebugLog.h"
namespace display_server
{
__windowShellCreatedSignal.emit(nullptr);
}
-void DSZone::__onShellSurfaceCreated(std::shared_ptr<DSWaylandZxdgSurfaceV6> shellSurface)
+std::list<std::shared_ptr<DSWindow>> DSZone::getWindowList()
+{
+ return __windowList;
+}
+
+std::shared_ptr<DSWindow> DSZone::__findWindow(DSWaylandSurface *dswlSurface)
{
- DSWindow *window = nullptr;
+ std::list<std::shared_ptr<DSWindow>> 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<DSWaylandZxdgSurfaceV6> 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<DSWindow> window = __findWindow(dswlSurface);
- std::shared_ptr<DSWindowShell> shell = std::make_shared<DSWindowShell>(window);
+ std::shared_ptr<DSWindowShell> shell = std::make_shared<DSWindowShell>(window.get());
__windowShellList.push_front(shell);
// emit a signal of the shell created
__windowShellCreatedSignal.emit(shell);
}
+
} // namespace display_server
void callCallbackWindowCreated();
void callCallbackWindowShellCreated();
+ std::list<std::shared_ptr<DSWindow>> getWindowList();
+
private:
void onSurfaceCreated(std::shared_ptr<DSWaylandSurface> waylandSurface);
void __onShellSurfaceCreated(std::shared_ptr<DSWaylandZxdgSurfaceV6> shellSurface);
+ std::shared_ptr<DSWindow> __findWindow(DSWaylandSurface *dswlSurface);
stPosition __position;
stSize __size;