From ec9b525190aee08dc5feb6d1fbedfad1c5110118 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 12:58:25 +0900 Subject: [PATCH] DSWindowShell: move wm policy functionalities from DSWindow to DSWindowShell move firstCommit, visible and changedGeometry Change-Id: I75a5805587a93091f274cbc99f7813ff70b695c1 --- src/DSWindow/DSWindow.cpp | 43 ------------------------------ src/DSWindow/DSWindowPrivate.h | 5 ---- src/DSWindowShell/DSWindowShellPrivate.cpp | 36 ++++++++++++++++++++++++- src/DSWindowShell/DSWindowShellPrivate.h | 6 ++++- 4 files changed, 40 insertions(+), 50 deletions(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index e4cf6f1..6267a96 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -41,12 +41,9 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) __committedW(0), __committedH(0), __created(false), - __visible(false), __hasFocus(false), __waylandSurface(nullptr), __winShell(nullptr), - __firstCommit(true), - __changedGeometry(false), __acceptsFocus(true), __allowUserGeometry(false), __title(""), @@ -181,14 +178,6 @@ DSWindowShell *DSWindowPrivate::getWindowShell(void) return __winShell; } -void DSWindowPrivate::sendConfigure(void) -{ - if (__winShell) - { - __winShell->sendConfigure(); - } -} - bool DSWindowPrivate::setVkbdFloating(bool set) { __vkbd_floating = set; @@ -204,34 +193,8 @@ void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptrbufferChanged()) { std::shared_ptr buffer = waylandSurfaceCommitInfo->getBuffer(); - if (buffer) - { - std::shared_ptr bufferSize = buffer->getSize(); - __committedW = bufferSize->w; - __committedH = bufferSize->h; - - if (!__visible) - __visible = true; - } - else - { - __visible = false; - } // emit a signal of the buffer changed pub->__bufferChangedSignal.emit(buffer); @@ -411,8 +374,6 @@ void DSWindow::setPosition(int x, int y) priv->__x = x; priv->__y = y; - priv->__changedGeometry = true; - __windowPositionChangedSignal.emit(nullptr); } @@ -444,8 +405,6 @@ void DSWindow::setSize(unsigned int w, unsigned int h) priv->__w = w; priv->__h = h; - - priv->__changedGeometry = true; } void DSWindow::setSize(stSize size) @@ -454,8 +413,6 @@ void DSWindow::setSize(stSize size) priv->__w = size.w; priv->__h = size.h; - - priv->__changedGeometry = true; } void DSWindow::setZOrder(unsigned int zOrder) diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 3109df7..a6a8200 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -73,8 +73,6 @@ public: bool setWindowShell(DSWindowShell *winShell); DSWindowShell *getWindowShell(void); - void sendConfigure(void); - bool setVkbdFloating(bool set); bool getVkbdFloating(); @@ -89,12 +87,9 @@ private: unsigned int __zOrder; unsigned int __committedW, __committedH; bool __created; - bool __visible; bool __hasFocus; std::shared_ptr __waylandSurface; DSWindowShell *__winShell; - bool __firstCommit; - bool __changedGeometry; bool __acceptsFocus; bool __allowUserGeometry; std::string __title; diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 897f91c..65778c3 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -70,8 +70,12 @@ DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *windo __reqX(0), __reqY(0), __reqW(0), __reqH(0), __parent(nullptr), - __layer(0) + __layer(0), + __firstCommit(true), + __changedGeometry(false), + __visible(false) { + __window->registerCallbackBufferChanged(this, std::bind(&DSWindowShellPrivate::__onWindowBufferChanged, this, std::placeholders::_1)); } DSWindowShellPrivate::~DSWindowShellPrivate() @@ -172,6 +176,7 @@ bool DSWindowShellPrivate::__handleUserGeometryHint(bool setUserGeometry) __x = __y = __w = __h = 0; __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } else { @@ -187,6 +192,7 @@ bool DSWindowShellPrivate::__handleUserGeometryHint(bool setUserGeometry) __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } } @@ -209,6 +215,7 @@ bool DSWindowShellPrivate::create(int x, int y, unsigned int w, unsigned int h, { __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } return true; @@ -245,6 +252,7 @@ bool DSWindowShellPrivate::setZone(DSZone *zone) __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } } else @@ -336,6 +344,7 @@ bool DSWindowShellPrivate::setPosition(int x, int y) __x = x; __y = y; __window->setPosition(__x, __y); + __changedGeometry = true; } } else @@ -397,6 +406,7 @@ bool DSWindowShellPrivate::setGeometry(int x, int y, unsigned int w, unsigned in __h = h; __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } } else @@ -645,4 +655,28 @@ void DSWindowShellPrivate::sendConfigure(void) } } +void DSWindowShellPrivate::__onWindowBufferChanged(std::shared_ptr buffer) +{ + if (__firstCommit) + { + DSLOG_DBG("DSWindow", "First Commit!!! "); + __firstCommit = false; + } + + if (__changedGeometry) + { + std::shared_ptr bufferSize = buffer->getSize(); + DSLOG_DBG("DSWindow", "Geometry Changed!!! Send Configure... geo(%d,%d,%d,%d) commit(%d,%d)", __x, __y, __w, __h, bufferSize->w, bufferSize->h); + sendConfigure(); + __changedGeometry = false; + } + + if (buffer) { + __visible = true; + } else { + __visible = false; + } + +} + } // namespace display_server diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index 25e27ae..5057859 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -38,7 +38,7 @@ struct stWindowAuxHint bool deleted; }; -class DSWindowShellPrivate +class DSWindowShellPrivate : public DSObject { DS_PIMPL_USE_PUBLIC(DSWindowShell) @@ -126,6 +126,7 @@ private: bool __create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pWin, DSWindowShell *pParent); bool __findInChildList(DSWindowShell *parentWinShell); bool __setParent(DSWindowShell *parentWinShell); + void __onWindowBufferChanged(std::shared_ptr buffer); struct stWindowAuxHint* __findAuxHint(int32_t id); void __handleAuxHint(stWindowAuxHint *hint); @@ -141,6 +142,9 @@ private: unsigned int __reqW, __reqH; // requested size by client DSWindowShell *__parent; int __layer; + bool __firstCommit; + bool __changedGeometry; + bool __visible; std::list __childList; std::list __auxHintsList; }; -- 2.7.4