DSWindowShell: add APIs for handle aux hint 15/242315/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Mon, 24 Aug 2020 10:59:21 +0000 (19:59 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Tue, 25 Aug 2020 12:36:55 +0000 (21:36 +0900)
Change-Id: I40eb0294e63c70f44b44f3f5d1e745f508b1604e

src/DSWindowShell/DSWindowShell.cpp
src/DSWindowShell/DSWindowShell.h
src/DSWindowShell/DSWindowShellPrivate.cpp
src/DSWindowShell/DSWindowShellPrivate.h

index c6a0e7c..6863736 100644 (file)
@@ -146,6 +146,24 @@ stGeometry DSWindowShell::getGeometry(void)
        return priv->getGeometry();
 }
 
+void DSWindowShell::addAuxHint(int32_t id, const std::string &name, const std::string &value)
+{
+       DS_GET_PRIV(DSWindowShell);
+       priv->addAuxHint(id, name, value);
+}
+
+void DSWindowShell::changeAuxHint(int32_t id, const std::string &value)
+{
+       DS_GET_PRIV(DSWindowShell);
+       priv->changeAuxHint(id, value);
+}
+
+void DSWindowShell::removeAuxHint(int32_t id)
+{
+       DS_GET_PRIV(DSWindowShell);
+       priv->removeAuxHint(id);
+}
+
 bool DSWindowShell::show(void)
 {
        DS_GET_PRIV(DSWindowShell);
index 0fe1f6d..f5a76f2 100644 (file)
@@ -70,6 +70,10 @@ public:
        bool setGeometry(int x, int y, unsigned int w, unsigned int h);
        stGeometry getGeometry(void);
 
+       void addAuxHint(int32_t id, const std::string &name, const std::string &value);
+       void changeAuxHint(int32_t id, const std::string &value);
+       void removeAuxHint(int32_t id);
+
        bool show(void);
        bool hide(bool autoFocus = true);
        int  showState(void);
index 5119f90..928bee4 100644 (file)
 namespace display_server
 {
 
-struct DTWindowShell
-{
+enum _Hint_Type
+{
+   DS_WINDOW_HINT_USER_GEOMETRY = 0,
+   DS_WINDOW_HINT_FIXED_RESIZE = 1,
+   DS_WINDOW_HINT_DEICONIFY_UPDATE = 2,
+   DS_WINDOW_HINT_ICONIFY = 3,
+   DS_WINDOW_HINT_ABOVE_LOCKSCREEN = 4,
+   DS_WINDOW_HINT_GESTURE_DISABLE = 5,
+   DS_WINDOW_HINT_EFFECT_DISABLE = 6,
+   DS_WINDOW_HINT_MSG_USE = 7,
+   DS_WINDOW_HINT_ALWAYS_SELECTIVE = 8,
+   DS_WINDOW_HINT_DEPENDENT_ROTATION = 9,
+   DS_WINDOW_HINT_ROT_RENDER_NOPENDING = 10,
+   DS_WINDOW_HINT_ICONIFY_BUFFER_FLUSH = 11,
+};
+
+static const char *sHintNames[] =
+{
+   "wm.policy.win.user.geometry",
+   "wm.policy.win.fixed.resize",
+   "wm.policy.win.deiconify.update",
+   "wm.policy.win.iconify",
+   "wm.policy.win.above.lock",
+   "wm.policy.win.gesture.disable",
+   "wm.policy.win.effect.disable",
+   "wm.policy.win.msg.use",
+   "wm.comp.win.always.selective.mode",
+   "wm.policy.win.rot.dependent",
+   "wm.policy.win.rot.render.nopending",
+   "wm.policy.win.iconify.buffer.flush",
 };
 
 DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *window)
@@ -46,7 +74,10 @@ DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *windo
 
 DSWindowShellPrivate::~DSWindowShellPrivate()
 {
-
+       for (stWindowAuxHint *hint : __auxHintsList)
+       {
+               delete hint;
+       }
 }
 
 bool DSWindowShellPrivate::__findInChildList(DSWindowShell *parentWinShell)
@@ -99,6 +130,34 @@ bool DSWindowShellPrivate::__setParent(DSWindowShell *parentWinShell)
        return true;
 }
 
+struct stWindowAuxHint *DSWindowShellPrivate::__findAuxHint(int32_t id)
+{
+       for (stWindowAuxHint* hint : __auxHintsList)
+       {
+               if (hint->id == id)
+                       return hint;
+       }
+
+       return nullptr;
+}
+
+void DSWindowShellPrivate::__handleAuxHint(stWindowAuxHint *hint)
+{
+       if (!__window) return;
+
+       // do something for each hints
+       if (hint->name == sHintNames[DS_WINDOW_HINT_USER_GEOMETRY]) // user geometry
+       {
+               bool set;
+
+               if (hint->value == "1")
+                       set = true;
+               else
+                       set = false;
+
+               __window->allowUserGeometry(set);
+       }
+}
 
 bool DSWindowShellPrivate::create(DSWindowShell *pParent)
 {
@@ -244,6 +303,53 @@ stGeometry DSWindowShellPrivate::getGeometry(void)
        return geo;
 }
 
+void DSWindowShellPrivate::addAuxHint(int32_t id, const std::string &name, const std::string &value)
+{
+       stWindowAuxHint *hint;
+       hint = __findAuxHint(id);
+       if (!hint)
+       {
+               hint = new stWindowAuxHint();
+               if (!hint) return;
+
+               __auxHintsList.push_back(hint);
+       }
+
+       hint->id = id;
+       hint->name = name;
+       hint->value = value;
+       hint->changed = true;
+       hint->deleted = false;
+
+       DSLOG_DBG("DSWindowShell", "Add aux hint... id:%d, name:%s, value:%s", id, name.c_str(), value.c_str());
+
+       __handleAuxHint(hint);
+}
+
+void DSWindowShellPrivate::changeAuxHint(int32_t id, const std::string &value)
+{
+       stWindowAuxHint *hint;
+       hint = __findAuxHint(id);
+       if (!hint) return;
+
+       hint->value = value;
+       hint->changed = true;
+
+       __handleAuxHint(hint);
+}
+
+void DSWindowShellPrivate::removeAuxHint(int32_t id)
+{
+       stWindowAuxHint *hint;
+       hint = __findAuxHint(id);
+       if (!hint) return;
+
+       hint->changed = true;
+       hint->deleted = true;
+
+       __auxHintsList.remove(hint);
+}
+
 bool DSWindowShellPrivate::show(void)
 {
        return true;
index 454f23d..df1e9c8 100644 (file)
 namespace display_server
 {
 
+struct stWindowAuxHint
+{
+       int32_t id;
+       std::string name;
+       std::string value;
+       bool changed;
+       bool deleted;
+};
+
 class DSWindowShellPrivate
 {
 DS_PIMPL_USE_PUBLIC(DSWindowShell)
@@ -66,6 +75,10 @@ public:
        bool setGeometry(int x, int y, unsigned int w, unsigned int h);
        stGeometry getGeometry(void);
 
+       void addAuxHint(int32_t id, const std::string &name, const std::string &value);
+       void changeAuxHint(int32_t id, const std::string &value);
+       void removeAuxHint(int32_t id);
+
        bool show(void);
        bool hide(bool autoFocus = true);
        int  showState(void);
@@ -111,6 +124,9 @@ private:
        bool __findInChildList(DSWindowShell *parentWinShell);
        bool __setParent(DSWindowShell *parentWinShell);
 
+       struct stWindowAuxHint* __findAuxHint(int32_t id);
+       void __handleAuxHint(stWindowAuxHint *hint);
+
 private:
        DSWindow *__window;
        IDSWaylandShellSurface *__shellSurface;
@@ -121,6 +137,7 @@ private:
        DSWindowShell *__parent;
        int __layer;
        std::list<DSWindowShell*> __childList;
+       std::list<stWindowAuxHint*> __auxHintsList;
 };
 
 }