#include "DSWindow.h"
#include "DSWindowPrivate.h"
#include "DSWaylandSurface.h"
+#include "IDSBuffer.h"
namespace display_server
{
__waylandSurface = waylandSurface;
__created = true;
+ __waylandSurface->registerCallbackSurfaceCommitted(this, std::bind(&DSWindowPrivate::__onSurfaceCommitted, this, std::placeholders::_1));
+
return true;
}
return __created;
}
+void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo)
+{
+ DS_GET_PUB(DSWindow);
+
+ // set the size of window with the size of commit infomation
+ // TODO: It could be changed by DSWindowShell policy later..
+ std::shared_ptr<IDSBuffer> buffer = waylandSurfaceCommitInfo->getBuffer();
+ std::shared_ptr<stSize> bufferSize = buffer->getSize();
+ __w = bufferSize->w;
+ __h = bufferSize->h;
+
+ // emit a signal of the size changed
+ pub->__sizeChangedSignal.emit(bufferSize);
+
+ // TODO: get more information from waylandSurfaceCommitInfo. ex) damageSurface, damageBuffer, transform, scale and so on
+}
+
DSWindow::DSWindow()
: DS_INIT_PRIVATE_PTR(DSWindow)
{}
return priv->__waylandSurface.get();
}
+void DSWindow::registerCallbackSizeChanged(DSObject *slot, std::function<void(std::shared_ptr<stSize>)> func)
+{
+ __sizeChangedSignal.connect(slot, func);
+}
+
} // namespace display_server
\ No newline at end of file
#include "DSCore.h"
#include "DSStruct.h"
#include "DSObject.h"
+#include "DSSignal.h"
namespace display_server
{
DSWaylandSurface *surface();
+ void registerCallbackSizeChanged(DSObject *slot, std::function<void(std::shared_ptr<stSize>)> func);
+
protected:
//virtual bool _onFocus(void);
//virtual bool _onShowStateChange(void);
private:
-
+ // signals
+ DSSignal<std::shared_ptr<stSize>> __sizeChangedSignal;
};
}
#include "DSCore.h"
#include "DSObjectPrivate.h"
+#include "DSWaylandSurface.h"
namespace display_server
{
class DSWindow;
-class DSWindowWaylandSurface;
-class DSWindowPrivate : public DSObjectPrivate
+class DSWindowPrivate : public DSObjectPrivate, public DSObject
{
DS_PIMPL_USE_PUBLIC(DSWindow)
bool isCreated();
private:
+ void __onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo);
+
int __x;
int __y;
unsigned int __w;