- DSWindowManager / DSZone / DSWindowShell / DSWindow : add code to handle position/size
- TizenPolicy : add list for tizen_position
- TizenPosition : implement set function
- ZxdgSurface : implement set_window_geometry function
Change-Id: I464017642e31eca791a36b131dab6ff8688acf6f
void DSWaylandTizenPolicyPrivate::tizen_policy_get_visibility(Resource *resource, uint32_t id, struct ::wl_resource *surface)
{
- DSLOG_DBG("TizenPolicyPriv", "");
+ DSLOG_DBG("TizenPolicyPriv", "get_visibility... resource:%p, id:%d", resource, id);
}
void DSWaylandTizenPolicyPrivate::tizen_policy_get_position(Resource *resource, uint32_t id, struct ::wl_resource *surface)
{
- DSLOG_DBG("TizenPolicyPriv", "");
+ DSLOG_DBG("TizenPolicyPriv", "get_position... resource:%p, id:%d", resource, id);
+
+ std::shared_ptr<DSWaylandTizenPosition> tzPos = std::make_shared<DSWaylandTizenPosition>(resource->client(), id, TIZEN_POLICY_VERSION, surface);
+ __tzPosList.push_front(tzPos);
- DSWaylandTizenPosition *tzPos = new DSWaylandTizenPosition(resource->client(), id, TIZEN_POLICY_VERSION, surface);
- // DO something using tzPos
+ // TODO: we have to remove tzPos when it's resource is destroyed
}
void DSWaylandTizenPolicyPrivate::tizen_policy_activate(Resource *resource, struct ::wl_resource *surface)
namespace display_server
{
+class DSWaylandTizenPosition;
+
class DSWaylandTizenPolicyPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_policy
{
DS_PIMPL_USE_PUBLIC(DSWaylandTizenPolicy)
void tizen_policy_set_appid(Resource *resource, int32_t pid, const std::string &appid) override;
private:
-
+ std::list<std::shared_ptr<DSWaylandTizenPosition>> __tzPosList;
};
}
#include "DSWaylandTizenPosition.h"
#include "DSWaylandTizenPositionPrivate.h"
+#include "DSWindowManager.h"
namespace display_server
{
DSWaylandTizenPositionPrivate::DSWaylandTizenPositionPrivate(DSWaylandTizenPosition *p_ptr)
: DSObjectPrivate(p_ptr),
__p_ptr(p_ptr),
- __wlSurface(nullptr)
+ __wlSurface(nullptr),
+ __dswlSurface(nullptr)
{
}
{
tizen_position::init(client, id, version);
__wlSurface = surface;
+ __dswlSurface = DSWaylandSurface::fromWlResource(surface);
}
void DSWaylandTizenPositionPrivate::tizen_position_bind_resource(Resource *resource)
void DSWaylandTizenPositionPrivate::tizen_position_set(Resource *resource, int32_t x, int32_t y)
{
DSLOG_DBG("TIZEN_POSITION", "Requested pos(%d,%d)", x, y);
+
+ DSWindowManager *wm = DSWindowManager::getInstance();
+ wm->setWindowPosition(__dswlSurface, x, y);
+ DSWindowManager::releaseInstance();
}
#include "DSCore.h"
#include "DSObject.h"
+#include "DSWaylandSurface.h"
#include <wayland-server-core.h>
namespace display_server
private:
struct ::wl_resource *__wlSurface;
- //DSWaylandSurface *__waylandSurface;
+ DSWaylandSurface *__dswlSurface;
};
__w = width;
__h = height;
// TODO: needs codes for adjust geometry
+
+ DSLOG_DBG("ZXDG_SURFACE", "Set Window geometry (%d,%d,%d,%d)", x, y, width, height);
+
+ DSWindowManager *wm = DSWindowManager::getInstance();
+ wm->setWindowGeometry(__dsSurface, __x, __y, __w, __h);
+ DSWindowManager::releaseInstance();
}
void DSWaylandZxdgSurfaceV6Private::zxdg_surface_v6_ack_configure(zxdg_surface_v6::Resource *resource, uint32_t serial)
{
__p_ptr(p_ptr),
__x(0),
__y(0),
- __w(1),
- __h(1),
+ __w(0),
+ __h(0),
__committedW(0),
__committedH(0),
__created(false),
__waylandSurface(nullptr),
__winShell(nullptr),
__firstCommit(true),
+ __changedGeometry(false),
__title("")
{
}
if (__firstCommit)
{
- DSLOG_DBG("DSWindow", "First Commit!!! Send Configure...");
+ DSLOG_DBG("DSWindow", "First Commit!!! Send Configure... geo(%d,%d,%d,%d)", __x, __y, __w, __h);
sendConfigure();
__firstCommit = false;
}
+ if (__changedGeometry)
+ {
+ DSLOG_DBG("DSWindow", "Geometry Changed!!! Send Configure... geo(%d,%d,%d,%d) commit(%d,%d)", __x, __y, __w, __h, __committedW, __committedH);
+ sendConfigure();
+ __changedGeometry = false;
+ }
+
std::shared_ptr<IDSBuffer> buffer = waylandSurfaceCommitInfo->getBuffer();
if (buffer) {
// TODO: set the size of window with the size of commit information
priv->__x = x;
priv->__y = y;
+
+ priv->__changedGeometry = true;
}
stPosition DSWindow::getPosition(void)
priv->__w = w;
priv->__h = h;
+
+ priv->__changedGeometry = true;
}
void DSWindow::setSize(stSize size)
priv->__w = size.w;
priv->__h = size.h;
+
+ priv->__changedGeometry = true;
}
DSWaylandSurface *DSWindow::surface()
std::shared_ptr<DSWaylandSurface> __waylandSurface;
DSWindowShell *__winShell;
bool __firstCommit;
+ bool __changedGeometry;
std::string __title;
};
}
}
+void DSWindowManagerPrivate::setWindowType(DSWaylandSurface *dsSurface, int type)
+{
+ // find dsSurface's window
+ DSZone *zone = __getZone(dsSurface);
+ if (zone)
+ {
+ zone->setWindowType(dsSurface, type);
+ }
+ else
+ {
+ // Do something if there is no zone
+ }
+}
+
+void DSWindowManagerPrivate::setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h)
+{
+ // find dsSurface's window
+ DSZone *zone = __getZone(dsSurface);
+ if (zone)
+ {
+ zone->setWindowGeometry(dsSurface, x, y, w, h);
+ }
+ else
+ {
+ // Do something if there is no zone
+ }
+}
+
+void DSWindowManagerPrivate::setWindowPosition(DSWaylandSurface *dsSurface, int x, int y)
+{
+ // find dsSurface's window
+ DSZone *zone = __getZone(dsSurface);
+ if (zone)
+ {
+ zone->setWindowPosition(dsSurface, x, y);
+ }
+ else
+ {
+ // Do something if there is no zone
+ }
+}
DSWindowManager::DSWindowManager(DSObject *parent)
: DS_INIT_PRIVATE_PTR(DSWindowManager)
priv->setWindowTitle(dsSurface, title);
}
+void DSWindowManager::setWindowType(DSWaylandSurface *dsSurface, int type)
+{
+ DS_GET_PRIV(DSWindowManager);
+ priv->setWindowType(dsSurface, type);
+}
+
+void DSWindowManager::setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h)
+{
+ DS_GET_PRIV(DSWindowManager);
+ priv->setWindowGeometry(dsSurface, x, y, w, h);
+}
+
+void DSWindowManager::setWindowPosition(DSWaylandSurface *dsSurface, int x, int y)
+{
+ DS_GET_PRIV(DSWindowManager);
+ priv->setWindowPosition(dsSurface, x, y);
+}
+
} // namespace display_server
DSZone *getZone(DSWaylandSurface *surface);
void setWindowTitle(DSWaylandSurface *dsSurface, const std::string &title);
+ void setWindowType(DSWaylandSurface *dsSurface, int type);
+ void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h);
+ void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y);
protected:
DSZone *getZone(DSWaylandSurface *surface);
void setWindowTitle(DSWaylandSurface *dsSurface, const std::string &title);
+ void setWindowType(DSWaylandSurface *dsSurface, int type);
+ void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h);
+ void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y);
private:
DSZone *__getZone(DSWindow *window);
return priv->getShellSurface();
}
-bool DSWindowShell::setPosition(int x, int y)
+bool DSWindowShell::setTitle(const std::string &title)
{
DS_GET_PRIV(DSWindowShell);
+ return priv->setTitle(title);
+}
+bool DSWindowShell::setPosition(int x, int y)
+{
+ DS_GET_PRIV(DSWindowShell);
return priv->setPosition(x, y);
}
return priv->setSize(w, h);
}
-void DSWindowShell::setGeometry(int x, int y, unsigned int w, unsigned int h)
+bool DSWindowShell::setGeometry(int x, int y, unsigned int w, unsigned int h)
{
+ DSLOG_DBG("DSWindowShell", "Set Geometry (%d, %d, %d, %d)", x, y, w, h);
+
DS_GET_PRIV(DSWindowShell);
return priv->setGeometry(x, y, w, h);
}
void setShellSurface(IDSWaylandShellSurface *zxdgSurface);
IDSWaylandShellSurface *getShellSurface(void);
+ bool setTitle(const std::string &title);
+
bool setPosition(int x, int y);
stPosition getPosition(void);
bool setSize(unsigned int w, unsigned int h);
- void setGeometry(int x, int y, unsigned int w, unsigned int h);
+ bool setGeometry(int x, int y, unsigned int w, unsigned int h);
stGeometry getGeometry(void);
bool show(void);
__window(window),
__shellSurface(nullptr),
__x(0), __y(0),
- __w(1), __h(1)
+ __w(0), __h(0),
+ __reqX(0), __reqY(0),
+ __reqW(0), __reqH(0)
{
}
return __shellSurface;
}
+bool DSWindowShellPrivate::setTitle(const std::string &title)
+{
+ if (__window)
+ {
+ __window->setTitle(title);
+ return true;
+ }
+ else
+ return false;
+}
+
bool DSWindowShellPrivate::setPosition(int x, int y)
{
__x = x;
return true;
}
-void DSWindowShellPrivate::setGeometry(int x, int y, unsigned int w, unsigned int h)
+bool DSWindowShellPrivate::setGeometry(int x, int y, unsigned int w, unsigned int h)
{
__x = x;
__y = y;
__window->setPosition(__x, __y);
__window->setSize(__w, __h);
}
+
+ return true;
}
stGeometry DSWindowShellPrivate::getGeometry(void)
return geo;
}
-
bool DSWindowShellPrivate::show(void)
{
return true;
void setShellSurface(IDSWaylandShellSurface *shellSurface);
IDSWaylandShellSurface *getShellSurface(void);
+ bool setTitle(const std::string &title);
+
bool setPosition(int x, int y);
stPosition getPosition(void);
bool setSize(unsigned int w, unsigned int h);
- void setGeometry(int x, int y, unsigned int w, unsigned int h);
+ bool setGeometry(int x, int y, unsigned int w, unsigned int h);
stGeometry getGeometry(void);
bool show(void);
IDSWaylandShellSurface *__shellSurface;
int __x, __y;
unsigned int __w, __h;
+ int __reqX, __reqY;
+ unsigned int __reqW, __reqH;
};
}
__windowShellMap.insert(std::make_pair(ptrWindow->surface(), shell.get()));
- shell->setGeometry(__position.x, __position.y, __size.w, __size.h);
-
// emit a signal of the shell created
__windowShellCreatedSignal.emit(shell);
bool DSZone::setWindowTitle(DSWaylandSurface *dswSurface, const std::string &title)
{
+ DSWindowShell *wShell = __findWindowShell(dswSurface);
+ if (!wShell) return false;
+
+ return wShell->setTitle(title);
+
+/*
std::shared_ptr<DSWindow> window = __findWindow(dswSurface);
+ if (!window) return false;
+
return window->setTitle(title);
+*/
+}
+
+bool DSZone::setWindowType(DSWaylandSurface *dswSurface, int type)
+{
+ DSWindowShell *wShell = __findWindowShell(dswSurface);
+ if (!wShell) return false;
+
+ return wShell->setType(type);
+
+/*
+ std::shared_ptr<DSWindow> window = __findWindow(dswSurface);
+ if (!window) return false;
+
+ return window->setType(type);
+*/
+}
+
+bool DSZone::setWindowGeometry(DSWaylandSurface *dswSurface, int x, int y, unsigned int w, unsigned h)
+{
+ DSWindowShell *wShell = __findWindowShell(dswSurface);
+ if (!wShell) return false;
+
+ return wShell->setGeometry(x, y, w, h);
+
+/*
+ std::shared_ptr<DSWindow> window = __findWindow(dswSurface);
+ if (!window) return false;
+
+ return window->setGeometry(x, y, w, h);
+*/
}
+bool DSZone::setWindowPosition(DSWaylandSurface *dswSurface, int x, int y)
+{
+ DSWindowShell *wShell = __findWindowShell(dswSurface);
+ if (!wShell) return false;
+
+ return wShell->setPosition(x, y);
+
+/*
+ std::shared_ptr<DSWindow> window = __findWindow(dswSurface);
+ if (!window) return false;
+
+ return window->setPosition(x, y);
+*/
+}
+
+
} // namespace display_server
// for window property
bool setWindowTitle(DSWaylandSurface *dswSurface, const std::string &title);
+ bool setWindowType(DSWaylandSurface *dswSurface, int type);
+ bool setWindowGeometry(DSWaylandSurface *dswSurface, int x, int y, unsigned int w, unsigned h);
+ bool setWindowPosition(DSWaylandSurface *dswSurface, int x, int y);
std::list<std::shared_ptr<DSWindow>> getWindowList();
std::list<std::shared_ptr<DSWindowShell>> getWindowShellList();