return priv->getSurface();
}
+void DSWaylandZxdgSurfaceV6::sendConfigure(int x, int y, unsigned int w, unsigned int h)
+{
+ DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
+ priv->sendConfigure(x, y, w, h);
+}
+
void DSWaylandZxdgSurfaceV6::setWindowTitle(const std::string &title)
{
DS_GET_PRIV(DSWaylandZxdgSurfaceV6);
DSWaylandZxdgSurfaceV6Private::DSWaylandZxdgSurfaceV6Private(DSWaylandZxdgSurfaceV6 *p_ptr)
- : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), __x(0), __y(0), __w(0), __h(0),
- __wlSurface(nullptr), __dsSurface(nullptr)
+ : DSObjectPrivate(p_ptr), __p_ptr(p_ptr),
+ __wlSurface(nullptr), __dsSurface(nullptr),
+ __toplevel(nullptr), __popup(nullptr), __role(DSWaylandZxdgSurfaceV6::DS_XDG_SURFACE_ROLE_NONE),
+ __x(0), __y(0), __w(0), __h(0),
+ __title(""), __appId("")
{
}
return __dsSurface;
}
+void DSWaylandZxdgSurfaceV6Private::sendConfigure(int x, int y, unsigned int w, unsigned int h)
+{
+ DSWaylandCompositor *wlCompositor = DSWaylandCompositor::getInstance();
+ if (wlCompositor == nullptr) return;
+
+ uint32_t serial = wlCompositor->nextSerial();
+
+ DSLOG_DBG("ZXDG_SURFACE", "Role:%d, Toplevel:%p, Popup:%p", __role, __toplevel, __popup);
+
+ // TODO: Do we check role (toplevel or popup)
+ if (__toplevel)
+ __toplevel->sendConfigure(w, h);
+
+ if (__popup)
+ __popup->sendConfigure(x, y, w, h);
+
+ DSLOG_DBG("ZXDG_SURFACE", "Send configure... serial:%d", serial);
+ send_configure(serial);
+
+ DSWaylandCompositor::releaseInstance();
+}
+
void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_bind_resource(zxdg_surface_v6::Resource *resource)
{
}
DSWaylandZxdgToplevelV6 *zxdgToplevel = new DSWaylandZxdgToplevelV6(pub, resource->client(), id, ZXDG_TOPLEVEL_V6_VERSION);
__toplevel = zxdgToplevel;
__role = DSWaylandZxdgSurfaceV6::DS_XDG_SURFACE_ROLE_TOPLEVEL;
+
+ DSLOG_DBG("ZXDG_SURFACE", "Get Toplevel. DSWaylandZxdgToplevel:%p", __toplevel);
}
void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_get_popup(zxdg_surface_v6::Resource *resource, uint32_t id, struct ::wl_resource *parent, struct ::wl_resource *positioner)
{
DSWaylandZxdgPopupV6 *zxdgPopup = new DSWaylandZxdgPopupV6(pub, resource->client(), id, ZXDG_TOPLEVEL_V6_VERSION);
__popup = zxdgPopup;
__role = DSWaylandZxdgSurfaceV6::DS_XDG_SURFACE_ROLE_POPUP;
+
+ DSLOG_DBG("ZXDG_SURFACE", "Get Popup. DSWaylandZxdgPopup:%p", __popup);
}
void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_set_window_geometry(zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
{
priv->__zxdgSurface = zxdgSurface;
}
+void DSWaylandZxdgToplevelV6::sendConfigure(unsigned int w, unsigned int h)
+{
+ DS_GET_PRIV(DSWaylandZxdgToplevelV6);
+ priv->sendConfigure(w, h);
+}
DSWaylandZxdgToplevelV6Private::DSWaylandZxdgToplevelV6Private(DSWaylandZxdgToplevelV6 *p_ptr)
: DSObjectPrivate(p_ptr), __p_ptr(p_ptr)
{
}
+void DSWaylandZxdgToplevelV6Private::sendConfigure(unsigned int w, unsigned int h)
+{
+ struct ::wl_array states;
+ wl_array_init(&states);
+
+/*
+ uint32_t *s;
+
+ // if maximized
+ s = wl_array_add(&states, sizeof(uint32_t));
+ if (s)
+ {
+ *s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
+ }
+
+ // if fullscreen
+ s = wl_array_add(&states, sizeof(uint32_t));
+ if (s)
+ {
+ *s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
+ }
+*/
+
+ send_configure((int32_t)w, (int32_t)h, &states);
+
+ wl_array_release(&states);
+}
+
void DSWaylandZxdgToplevelV6Private::zxdg_toplevel_v6_bind_resource(zxdg_toplevel_v6::Resource *resource)
{
}
priv->__zxdgSurface = zxdgSurface;
}
+void DSWaylandZxdgPopupV6::sendConfigure(int x, int y, unsigned int w, unsigned int h)
+{
+ DS_GET_PRIV(DSWaylandZxdgPopupV6);
+ priv->send_configure(x, y, w, h);
+}
DSWaylandZxdgPopupV6Private::DSWaylandZxdgPopupV6Private(DSWaylandZxdgPopupV6 *p_ptr)
: DSObjectPrivate(p_ptr), __p_ptr(p_ptr)
{
}
+void DSWaylandZxdgPopupV6Private::sendConfigure(int x, int y, unsigned int w, unsigned int h)
+{
+ send_configure(x, y, w, h);
+}
+
void DSWaylandZxdgPopupV6Private::zxdg_popup_v6_bind_resource(zxdg_popup_v6::Resource *resource)
{
}
void setSurface(DSWaylandSurface *surface);
DSWaylandSurface *getSurface(void);
+ void sendConfigure(int x, int y, unsigned int w, unsigned int h);
+
protected:
void zxdg_surface_v6_bind_resource(zxdg_surface_v6::Resource *resource) override;
void zxdg_surface_v6_destroy_resource(zxdg_surface_v6::Resource *resource) override;
DSWaylandZxdgPopupV6 *__popup;
DSWaylandZxdgSurfaceV6::Xdg_Surface_Role __role;
- int __x, __y, __w, __h;
+ int __x, __y;
+ unsigned int __w, __h;
std::string __title, __appId;
};
DSWaylandZxdgToplevelV6Private(DSWaylandZxdgToplevelV6 *p_ptr);
~DSWaylandZxdgToplevelV6Private() override;
+ void sendConfigure(unsigned int w, unsigned int h);
+
protected:
void zxdg_toplevel_v6_bind_resource(zxdg_toplevel_v6::Resource *resource) override;
void zxdg_toplevel_v6_destroy_resource(zxdg_toplevel_v6::Resource *resource) override;
DSWaylandZxdgPopupV6Private(DSWaylandZxdgPopupV6 *p_ptr);
~DSWaylandZxdgPopupV6Private() override;
+ void sendConfigure(int x, int y, unsigned int w, unsigned int h);
+
protected:
void zxdg_popup_v6_bind_resource(zxdg_popup_v6::Resource *resource) override;
void zxdg_popup_v6_destroy_resource(zxdg_popup_v6::Resource *resource) override;
__p_ptr(p_ptr),
__w(1),
__h(1),
+ __committedW(0),
+ __committedH(0),
__created(false),
__hasFocus(false),
__waylandSurface(nullptr),
- __winShell(nullptr)
+ __winShell(nullptr),
+ __firstCommit(true)
{
}
return __winShell;
}
+void DSWindowPrivate::sendConfigure(void)
+{
+ if (__winShell)
+ {
+ __winShell->sendConfigure();
+ }
+}
+
void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptr<DSWaylandSurfaceCommitInfo> waylandSurfaceCommitInfo)
{
DS_GET_PUB(DSWindow);
+ if (__firstCommit)
+ {
+ DSLOG_DBG("DSWindow", "First Commit!!! Send Configure...");
+ sendConfigure();
+ __firstCommit = false;
+ }
+
std::shared_ptr<IDSBuffer> buffer = waylandSurfaceCommitInfo->getBuffer();
if (buffer) {
// TODO: set the size of window with the size of commit information
// It could be changed by DSWindowShell policy later..
std::shared_ptr<stSize> bufferSize = buffer->getSize();
- __w = bufferSize->w;
- __h = bufferSize->h;
+ __committedW = bufferSize->w;
+ __committedH = bufferSize->h;
+
+#if 1 // temporary code - we have to use policy to decide window's size.
+ if ((__committedW != __w) ||
+ (__committedH != __h))
+ {
+ DSLOG_ERR("DSWindow", "Committed size (%d,%d) is not same to requested size(%d,%d)", bufferSize->w, bufferSize->h, __w, __h);
+ return;
+ }
+#endif
// emit a signal of the buffer changed
pub->__bufferChangedSignal.emit(buffer);