__h(1),
__created(false),
__hasFocus(false),
- __waylandSurface(nullptr)
+ __waylandSurface(nullptr),
+ __winShell(nullptr)
{
}
return __created;
}
+bool DSWindowPrivate::setWindowShell(DSWindowShell *winShell)
+{
+ if (__winShell)
+ {
+ DSLOG_ERR("DSWindow", "Already exist DSWindowShell...");
+ return false;
+ }
+
+ __winShell = winShell;
+ return true;
+}
+
+DSWindowShell *DSWindowPrivate::getWindowShell(void)
+{
+ return __winShell;
+}
+
void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo)
{
DS_GET_PUB(DSWindow);
return priv->__waylandSurface.get();
}
+
+bool DSWindow::setWindowShell(DSWindowShell *winShell)
+{
+ DS_GET_PRIV(DSWindow);
+ return priv->setWindowShell(winShell);
+}
+
+DSWindowShell *DSWindow::getWindowShell(void)
+{
+ DS_GET_PRIV(DSWindow);
+ return priv->getWindowShell();
+}
+
void DSWindow::registerCallbackSizeChanged(DSObject *slot, std::function<void(std::shared_ptr<stSize>)> func)
{
__sizeChangedSignal.connect(slot, func);
#include "DSObject.h"
#include "DSSignal.h"
#include "IDSBuffer.h"
+#include "DSWindowShell.h"
namespace display_server
{
DSWaylandSurface *surface();
+ bool setWindowShell(DSWindowShell *winShell);
+ DSWindowShell *getWindowShell(void);
+
void registerCallbackSizeChanged(DSObject *slot, std::function<void(std::shared_ptr<stSize>)> func);
void registerCallbackBufferChanged(DSObject *slot, std::function<void(std::shared_ptr<IDSBuffer>)> func);
#include "DSCore.h"
#include "DSObjectPrivate.h"
#include "DSWaylandSurface.h"
+#include "DSWindowShell.h"
namespace display_server
{
bool setFocus(void);
bool isCreated();
+ bool setWindowShell(DSWindowShell *winShell);
+ DSWindowShell *getWindowShell(void);
+
private:
void __onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo);
bool __created;
bool __hasFocus;
std::shared_ptr<DSWaylandSurface> __waylandSurface;
+ DSWindowShell *__winShell;
};
}
// create DSWindowShell
std::shared_ptr<DSWindowShell> shell = __createWindowShell(window);
+
+ // set DSWindowShell to DSWindow
+ window->setWindowShell(shell.get());
}
void DSZone::__onShellSurfaceCreated(IDSWaylandShellSurface *waylandShellSurface)
#include "libds-tests.h"
#include "DSObject.h"
#include "DSWindow.h"
+#include "DSWindowShell.h"
#include "DSStruct.h"
using namespace display_server;
EXPECT_TRUE(win->setFocus() == true);
EXPECT_TRUE(win->hasFocus() == true);
}
+
+TEST_F(DSWindowTest, WindowShellTest)
+{
+ auto win = new DSWindow();
+ EXPECT_TRUE(win != nullptr);
+
+ auto winShell = new DSWindowShell(win);
+ EXPECT_TRUE(winShell != nullptr);
+
+ EXPECT_TRUE(win->setWindowShell(winShell) == true);
+
+ DSWindowShell *getWinShell = nullptr;
+ getWinShell = win->getWindowShell();
+ EXPECT_TRUE(winShell == getWinShell);
+}
\ No newline at end of file