From 2a61549ae661d476518b54173ad68236a1c14f23 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 17:33:57 +0900 Subject: [PATCH 01/16] DSWindow: add setDisplayDeviceHWCWindow method Change-Id: I6f1ba1e2d08b72e47027d6501eff216f108b59c7 --- src/DSWindow/DSWindow.cpp | 15 ++++++++++++++- src/DSWindow/DSWindow.h | 2 ++ src/DSWindow/DSWindowPrivate.h | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 7ac5334..54f5b42 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -47,7 +47,8 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) __allowUserGeometry(false), __title(""), __vkbd_floating(false), - __renderView(nullptr) + __renderView(nullptr), + __displayDeviceHWCWindow(nullptr) { } @@ -177,6 +178,11 @@ void DSWindowPrivate::setRenderView(std::shared_ptr &renderView) __renderView = renderView; } +void DSWindowPrivate::setDisplayDeviceHWCWindow(std::shared_ptr &displayDeviceHWCWindow) +{ + __displayDeviceHWCWindow = displayDeviceHWCWindow; +} + void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptr waylandSurfaceCommitInfo) { DS_GET_PUB(DSWindow); @@ -441,6 +447,13 @@ void DSWindow::setRenderView(std::shared_ptr &renderView) priv->setRenderView(renderView); } +void DSWindow::setDisplayDeviceHWCWindow(std::shared_ptr &displayDeviceHWCWindow) +{ + DS_GET_PRIV(DSWindow); + + priv->setDisplayDeviceHWCWindow(displayDeviceHWCWindow); +} + void DSWindow::registerCallbackBufferChanged(DSObject *slot, std::function)> func) { __bufferChangedSignal.connect(slot, func); diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 3e807c3..808cc03 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -30,6 +30,7 @@ #include "DSSignal.h" #include "IDSBuffer.h" #include "DSRenderView.h" +#include "IDSDisplayDeviceHWCWindow.h" namespace display_server { @@ -91,6 +92,7 @@ public: DSWaylandSurface *surface(); void setRenderView(std::shared_ptr &renderView); + void setDisplayDeviceHWCWindow(std::shared_ptr &displayDeviceHWCWindow); void registerCallbackBufferChanged(DSObject *slot, std::function)> func); diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 4b03957..68c626c 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -28,6 +28,7 @@ #include "DSObjectPrivate.h" #include "DSWaylandSurface.h" #include "DSRenderView.h" +#include "IDSDisplayDeviceHWCWindow.h" namespace display_server { @@ -74,6 +75,7 @@ public: bool getVkbdFloating(); void setRenderView(std::shared_ptr &renderView); + void setDisplayDeviceHWCWindow(std::shared_ptr &displayDeviceHWCWindow); private: void __onSurfaceCommitted(std::shared_ptr waylandSurfaceCommitInfo); @@ -95,6 +97,7 @@ private: bool __vkbd_floating; std::shared_ptr __renderView; + std::shared_ptr __displayDeviceHWCWindow; }; } -- 2.7.4 From 2979135bd39756214a999981054105f5684de5dc Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 17:34:20 +0900 Subject: [PATCH 02/16] DSDisplayArea: set renderView and HWCWindow at windowCreated Change-Id: I9a39e963e4b3e727f415dcff5446603237bce906 --- src/DSDisplayArea/DSDisplayArea.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp index 33e6fe5..ec84dc0 100644 --- a/src/DSDisplayArea/DSDisplayArea.cpp +++ b/src/DSDisplayArea/DSDisplayArea.cpp @@ -138,9 +138,11 @@ void DSDisplayAreaPrivate::__onWindowCreated(std::shared_ptr window) { // make a render view and set to the window. auto renderView = __renderEngine->makeRenderView(); + window->setRenderView(renderView); // make a hwc window and set to the window. auto displayDeviceHWCWindow = __displayDeviceHWC->makeHWCWindow(); + window->setDisplayDeviceHWCWindow(displayDeviceHWCWindow); } void DSDisplayAreaPrivate::__onEventIdleEnterer(void *data) -- 2.7.4 From 68377ffa9c16460af5a40ccd5564dc8e68f533a0 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 17:36:49 +0900 Subject: [PATCH 03/16] DSWindowPrivate: add raiseToTop method Change-Id: I783b998a52460159cb9610a393074fdcb01bc670 --- src/DSWindow/DSWindow.cpp | 12 ++++++++++++ src/DSWindow/DSWindowPrivate.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 54f5b42..828b964 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -145,6 +145,18 @@ bool DSWindowPrivate::lower(void) return true; } +bool DSWindowPrivate::raiseToTop() +{ + if (__renderView) + __renderView->raiseToTop(); + + // TODO: set raiseToTop to hwc window ??? + // if (__displayDeviceHWCWindow) + // __displayDeviceHWCWindow->raiseToTop(); + + return true; +} + bool DSWindowPrivate::unsetFocus(void) { __hasFocus = false; diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 68c626c..40edda7 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -66,6 +66,7 @@ public: bool setLayer(int layer); bool raise(void); bool lower(void); + bool raiseToTop(); bool unsetFocus(void); bool setFocus(void); -- 2.7.4 From f50a057cd06825dc1dc97608e98d3c3a2af1d875 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 17:37:56 +0900 Subject: [PATCH 04/16] DSWindowPrivate: add lowerToBottom method Change-Id: I86e03028ad0e219e473a5fe974ee45b8c716eca8 --- src/DSWindow/DSWindow.cpp | 12 ++++++++++++ src/DSWindow/DSWindowPrivate.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 828b964..85299f6 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -157,6 +157,18 @@ bool DSWindowPrivate::raiseToTop() return true; } +bool DSWindowPrivate::lowerToBottom() +{ + if (__renderView) + __renderView->lowerToBottom(); + + // TODO: set lowerToBottom to hwc window ??? + // if (__displayDeviceHWCWindow) + // __displayDeviceHWCWindow->lowerToBottom(); + + return true; +} + bool DSWindowPrivate::unsetFocus(void) { __hasFocus = false; diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 40edda7..01382a3 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -67,6 +67,7 @@ public: bool raise(void); bool lower(void); bool raiseToTop(); + bool lowerToBottom(); bool unsetFocus(void); bool setFocus(void); -- 2.7.4 From f75d253e38fd9acdbb3331114543a2107011b65c Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 17:38:42 +0900 Subject: [PATCH 05/16] DSWindowPrivate: add setPosition method Change-Id: I0957e30e7548746a1ad1fff4242ed6738ee16bcc --- src/DSWindow/DSWindow.cpp | 13 +++++++++++++ src/DSWindow/DSWindowPrivate.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 85299f6..24bc607 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -186,6 +186,19 @@ bool DSWindowPrivate::isCreated() return __created; } +void DSWindowPrivate::setPosition(int x, int y) +{ + __x = x; + __y = y; + + if (__renderView) + __renderView->setPosition(x, y); + + // TODO: set lowerToBottom to hwc window ??? + // if (__displayDeviceHWCWindow) + // __displayDeviceHWCWindow->lowerToBottom(); +} + bool DSWindowPrivate::setVkbdFloating(bool set) { __vkbd_floating = set; diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 01382a3..b7e35d5 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -73,6 +73,8 @@ public: bool setFocus(void); bool isCreated(); + void setPosition(int x, int y); + bool setVkbdFloating(bool set); bool getVkbdFloating(); -- 2.7.4 From e4ce31074e65d5bcd6d456754ce8f51b5e3f538d Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 17:39:57 +0900 Subject: [PATCH 06/16] DSWindow: call the private functions at the public functions Change-Id: I56c3822e98d898a6604f8390cfc741de4f16a4c7 --- src/DSWindow/DSWindow.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 24bc607..16b30b3 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -137,11 +137,13 @@ bool DSWindowPrivate::setLayer(int layer) bool DSWindowPrivate::raise(void) { + raiseToTop(); return true; } bool DSWindowPrivate::lower(void) { + lowerToBottom(); return true; } @@ -351,7 +353,6 @@ bool DSWindow::raise(void) { DS_GET_PRIV(DSWindow); - raiseToTop(); return priv->raise(); } @@ -359,20 +360,21 @@ bool DSWindow::lower(void) { DS_GET_PRIV(DSWindow); - lowerToBottom(); return priv->lower(); } bool DSWindow::raiseToTop() { + DS_GET_PRIV(DSWindow); - return true; + return priv->raiseToTop(); } bool DSWindow::lowerToBottom() { + DS_GET_PRIV(DSWindow); - return true; + return priv->lowerToBottom(); } bool DSWindow::unsetFocus(void) @@ -400,8 +402,7 @@ void DSWindow::setPosition(int x, int y) { DS_GET_PRIV(DSWindow); - priv->__x = x; - priv->__y = y; + priv->setPosition(x, y); } stPosition DSWindow::getPosition(void) -- 2.7.4 From 256a8aa6954071f8742c46ed8a96658ad5d30c5a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 17:41:00 +0900 Subject: [PATCH 07/16] DSWindow: code clean Change-Id: I6829a987e074cdb841c6b6a9b753a1369f074a7d --- src/DSWindow/DSWindow.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 16b30b3..eeecad6 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -226,14 +226,24 @@ void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptrbufferChanged()) { - std::shared_ptr buffer = waylandSurfaceCommitInfo->getBuffer(); + if (!waylandSurfaceCommitInfo->bufferChanged()) + return; - // emit a signal of the buffer changed - pub->__bufferChangedSignal.emit(buffer); + std::shared_ptr buffer = waylandSurfaceCommitInfo->getBuffer(); + + if (__renderView) { + __renderView->setBuffer(buffer); } + //TODO: set the buffer to the hwc window + // if (__displayDeviceHWCWindow) { + // __displayDeviceHWCWindow->setBuffer(buffer); + //} + // TODO: get more information from waylandSurfaceCommitInfo. ex) damageSurface, damageBuffer, transform, scale and so on + + // emit a signal of the buffer changed + pub->__bufferChangedSignal.emit(buffer); } DSWindow::DSWindow() -- 2.7.4 From ded0d049e9892d604d336e4608bda9a064bcbddb Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Fri, 28 Aug 2020 17:40:05 +0900 Subject: [PATCH 08/16] DSSeat: fix to set winX/winY for DSInputEvent::TouchMoveEvent Change-Id: Ifb2f9e83c9eae2746805ef360231c4258bdbb762 Signed-off-by: Sung-Jin Park --- src/DSSeat/DSSeat.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/DSSeat/DSSeat.cpp b/src/DSSeat/DSSeat.cpp index 599d32b..ed929fa 100644 --- a/src/DSSeat/DSSeat.cpp +++ b/src/DSSeat/DSSeat.cpp @@ -451,6 +451,10 @@ void DSSeat::__onPointerEvent(DSInputMouseEvent *ev) void DSSeat::__onTouchEvent(DSInputTouchEvent *ev) { + int winX; + int winY; + stPosition pos; + if (__touch == nullptr) { DSLOG_DBG("DSSeat", "No touch device exists. Touch events will be dropped."); @@ -467,10 +471,6 @@ void DSSeat::__onTouchEvent(DSInputTouchEvent *ev) //set the window as touch focus window if (window) { - int winX; - int winY; - stPosition pos; - pos = window->getPosition(); winX = ev->getX() - pos.x; winY = ev->getY() - pos.y; @@ -482,6 +482,19 @@ void DSSeat::__onTouchEvent(DSInputTouchEvent *ev) //TODO : emit touch focus changed signal } + else if (ev->getType() == DSInputEvent::TouchMoveEvent) + { + auto window = __touch->getFocus(); + + if (window) + { + pos = window->getPosition(); + winX = ev->getX() - pos.x; + winY = ev->getY() - pos.y; + ev->setWinX(winX); + ev->setWinY(winY); + } + } __dswlSeat->setCurrentEventTime(ev->getTimestamp()); __touch->processEvent(ev, nullptr); -- 2.7.4 From 5bc85625bb52c97301091844d786d4016ec3c883 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Fri, 28 Aug 2020 17:24:38 +0900 Subject: [PATCH 09/16] packaging: add libds-boot package for booting with exampleCompositor Change-Id: I17d15bd330e620dc316f462bb48638783a5c698f Signed-off-by: Sung-Jin Park --- data/units/display-manager.service | 15 +++++++++++++++ data/units/libds.env | 11 +++++++++++ packaging/libds.spec | 31 ++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 data/units/display-manager.service create mode 100644 data/units/libds.env diff --git a/data/units/display-manager.service b/data/units/display-manager.service new file mode 100644 index 0000000..d171f75 --- /dev/null +++ b/data/units/display-manager.service @@ -0,0 +1,15 @@ +[Unit] +Description=Display manager (libds) + +[Service] +EnvironmentFile=/etc/sysconfig/libds.env +SmackProcessLabel=System +ExecStartPre=-/usr/bin/keymap_update.sh +ExecStart=/usr/bin/bash -c "/usr/bin/exampleCompositor" +ExecStartPost=/usr/bin/bash -c "/usr/bin/touch $XDG_RUNTIME_DIR/.wm_ready;devicectl display start;devicectl display stop" +Restart=always +RestartSec=10 + +[Install] +WantedBy=graphical.target + diff --git a/data/units/libds.env b/data/units/libds.env new file mode 100644 index 0000000..d4d820d --- /dev/null +++ b/data/units/libds.env @@ -0,0 +1,11 @@ +# env for exampleCompositor (libds) +E_CONF_PROFILE=tizen-mobile +XDG_RUNTIME_DIR=/run +XDG_CACHE_HOME=/run +ECORE_EVAS_FORCE_SYNC_RENDER=1 +ELM_PROFILE=mobile +HOME=/var/lib/enlightenment +EINA_LOG_DLOG_ENABLE=1 +LIBINPUT_IGNORE_JOYSTICK=1 +#E_INFO_RULE_FILE=/opt/rule/rule +#E_INFO_TRACE_FILE=/tmp/trace diff --git a/packaging/libds.spec b/packaging/libds.spec index 81ef44d..61324e1 100644 --- a/packaging/libds.spec +++ b/packaging/libds.spec @@ -62,6 +62,13 @@ Group: System/Libraries %description tests Test module for testing libtbm APIs +%package boot +Summary: package for boot with libds-based display server +Group: System/Libraries + +%description boot +Package for boot with libds-based display server + %prep %setup -q cp %{SOURCE1001} . @@ -82,8 +89,24 @@ ninja -C builddir all export DESTDIR=%{buildroot} ninja -C builddir install -%post -p /sbin/ldconfig +%define daemon_user display +%define daemon_group display + +# install service +%__mkdir_p %{buildroot}%{_unitdir} +install -m 644 data/units/display-manager.service %{buildroot}%{_unitdir} + +# install env file for service +%__mkdir_p %{buildroot}%{_sysconfdir}/sysconfig +install -m 0644 data/units/libds.env %{buildroot}%{_sysconfdir}/sysconfig +#%pre +# create groups 'display' +#getent group %{daemon_group} >/dev/null || %{_sbindir}/groupadd -r -o %{daemon_group} +# create user 'display' +#getent passwd %{daemon_user} >/dev/null || %{_sbindir}/useradd -r -g %{daemon_group} -d /run/display -s /bin/false -c "Display daemon" %{daemon_user} + +%post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files @@ -105,3 +128,9 @@ ninja -C builddir install %defattr(-,root,root,-) %license COPYING %{_bindir}/libds-tests + +%files boot +%defattr(-,root,root,-) +%license COPYING +%{_unitdir}/display-manager.service +%config %{_sysconfdir}/sysconfig/libds.env -- 2.7.4 From 2e9329d0be01860400598f8775079727b3df98c7 Mon Sep 17 00:00:00 2001 From: jeon Date: Fri, 28 Aug 2020 18:52:09 +0900 Subject: [PATCH 10/16] DSTextInput: set TextInput window to InputPanel's parent Change-Id: I1e16c37d74e6116b416c9c4afee3395f64b6ee09 --- src/DSWaylandServer/DSWaylandInputPanel.cpp | 38 +++++++---------------------- src/DSWaylandServer/DSWaylandTextInput.cpp | 13 +++++----- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandInputPanel.cpp b/src/DSWaylandServer/DSWaylandInputPanel.cpp index 77c65a0..f8b7d18 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.cpp +++ b/src/DSWaylandServer/DSWaylandInputPanel.cpp @@ -373,34 +373,14 @@ void DSWaylandInputPanelSurfacePrivate::setTransientForSurface(DSWaylandSurface { for (auto it = __dataMap.begin(); it != __dataMap.end(); it++) { - //DSWaylandInputPanelSurfaceData *surfaceData = (*it).second; - /* TODO: - * child = surfaceData->getWlSurface(); - * if child->parent - * { - * if child->parent != parent - * { - * remove child in child->parent->transients list - * child->parent = nullptr - * } - * } - * if parent != child && parent != child->parent - * { - * add child in child->parent->transients list - * child->parent = parent; - * } - * if (parent) - * { - * child->icccm.fetch.transientFor = true; - * child->icccm.transientFor = parent->id; - * } - * else - * { - * child->icccm.fetch.transientFor = false; - * child->icccm.transientFor = 0; - * } - * mark window changedr - */ + DSWaylandInputPanelSurfaceData *surfaceData = (*it).second; + DSWaylandSurface *child = surfaceData->getWlSurface(); + + // TODO: if current child has parent reset this + + DSWindowManager *windowManager = DSWindowManager::getInstance(); + windowManager->setWindowParent(child, parent); + windowManager->releaseInstance(); } } @@ -587,7 +567,7 @@ void DSWaylandInputPanelSurfacePrivate::__appendSurface(Resource *resource, void if (textInputSurface) { - //TODO: transparent set + pub->__inputPanel->setTransientFor(textInputSurface); } if (pub->__inputPanel->getRerunPanelShow()) diff --git a/src/DSWaylandServer/DSWaylandTextInput.cpp b/src/DSWaylandServer/DSWaylandTextInput.cpp index 743d57c..820e8ba 100644 --- a/src/DSWaylandServer/DSWaylandTextInput.cpp +++ b/src/DSWaylandServer/DSWaylandTextInput.cpp @@ -271,15 +271,16 @@ void DSWaylandTextInputPrivate::showInputPanel(void *resource) pub->__dsTextInputPrivate->showInputPanel(pub, id); __showClient = privateResource->client(); pub->__dsTextInputPrivate->updateInputPanelState(true); - if (pub->__dsTextInputPrivate->getInputPanelState() == DSTextInputPrivate::InputPanelStateWillHide) - { - send_private_command(privateResource->handle, 0, "CONFORMANT_RESTORE"); - } - pub->__dsTextInputPrivate->setInputPanelState(DSTextInputPrivate::InputPanelStateWillShow); - /* TODO: pub->__dsTextInputPrivate->setInputPanelTransientFor(getDSWindow(__activatedResource)); */ } + if (pub->__dsTextInputPrivate->getInputPanelState() == DSTextInputPrivate::InputPanelStateWillHide) + { + send_private_command(privateResource->handle, 0, "CONFORMANT_RESTORE"); + } + + pub->__dsTextInputPrivate->setInputPanelState(DSTextInputPrivate::InputPanelStateWillShow); pub->__geometryUpdated = false; + pub->__dsTextInputPrivate->setInputPanelTransientFor(__clientSurface); } void DSWaylandTextInputPrivate::text_input_destroy(Resource *resource) -- 2.7.4 From 5c1b5fad75815a8edb9b103db41cabd8f1d38188 Mon Sep 17 00:00:00 2001 From: jeon Date: Fri, 28 Aug 2020 23:55:02 +0900 Subject: [PATCH 11/16] DSWindowManager: add a API to allow user geometry Change-Id: I5a7698d8c462d3f808dec62cf792dc0203e6a51d --- src/DSWindowManager/DSWindowManager.cpp | 13 +++++++++++++ src/DSWindowManager/DSWindowManager.h | 2 ++ src/DSWindowManager/DSWindowManagerPrivate.h | 2 ++ src/DSWindowShell/DSWindowShell.cpp | 8 ++++++++ src/DSWindowShell/DSWindowShell.h | 2 ++ src/DSWindowShell/DSWindowShellPrivate.cpp | 7 +++++++ src/DSWindowShell/DSWindowShellPrivate.h | 2 ++ src/DSZone/DSZone.cpp | 9 +++++++++ src/DSZone/DSZone.h | 2 ++ 9 files changed, 47 insertions(+) diff --git a/src/DSWindowManager/DSWindowManager.cpp b/src/DSWindowManager/DSWindowManager.cpp index 4e8e32c..a77dcce 100644 --- a/src/DSWindowManager/DSWindowManager.cpp +++ b/src/DSWindowManager/DSWindowManager.cpp @@ -384,6 +384,13 @@ bool DSWindowManagerPrivate::getWindowVkbdFloating(DSWaylandSurface *dswlSurface return false; } +void DSWindowManagerPrivate::setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set) +{ + DSZone *zone = __getZone(dswlSurface); + if (zone) + zone->setWindowAllowUserGeometry(dswlSurface, set); +} + DSWindowManager::DSWindowManager(DSObject *parent) : DS_INIT_PRIVATE_PTR(DSWindowManager) @@ -579,5 +586,11 @@ bool DSWindowManager::getWindowVkbdFloating(DSWaylandSurface *dswlSurface) return priv->getWindowVkbdFloating(dswlSurface); } +void DSWindowManager::setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set) +{ + DS_GET_PRIV(DSWindowManager); + + priv->setWindowAllowUserGeometry(dswlSurface, set); +} } // namespace display_server diff --git a/src/DSWindowManager/DSWindowManager.h b/src/DSWindowManager/DSWindowManager.h index 838b821..730826c 100644 --- a/src/DSWindowManager/DSWindowManager.h +++ b/src/DSWindowManager/DSWindowManager.h @@ -77,6 +77,8 @@ public: bool setWindowVkbdFloating(DSWaylandSurface *dswlSurface, bool set); bool getWindowVkbdFloating(DSWaylandSurface *dswlSurface); + void setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set); + protected: private: diff --git a/src/DSWindowManager/DSWindowManagerPrivate.h b/src/DSWindowManager/DSWindowManagerPrivate.h index e40eadc..956ec03 100644 --- a/src/DSWindowManager/DSWindowManagerPrivate.h +++ b/src/DSWindowManager/DSWindowManagerPrivate.h @@ -71,6 +71,8 @@ public: bool setWindowVkbdFloating(DSWaylandSurface *dswlSurface, bool set); bool getWindowVkbdFloating(DSWaylandSurface *dswlSurface); + void setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set); + private: DSZone *__getZone(DSWindow *window); DSZone *__getZone(DSWaylandSurface *surface); diff --git a/src/DSWindowShell/DSWindowShell.cpp b/src/DSWindowShell/DSWindowShell.cpp index 6798b79..2bbbe33 100644 --- a/src/DSWindowShell/DSWindowShell.cpp +++ b/src/DSWindowShell/DSWindowShell.cpp @@ -372,4 +372,12 @@ bool DSWindowShell::getVkbdFloating() return priv->getVkbdFloating(); } +void DSWindowShell::setAllowUserGeometry(bool set) +{ + DS_GET_PRIV(DSWindowShell); + + priv->setAllowUserGeometry(set); +} + + } // namespace display_server diff --git a/src/DSWindowShell/DSWindowShell.h b/src/DSWindowShell/DSWindowShell.h index f2452f7..84123c5 100644 --- a/src/DSWindowShell/DSWindowShell.h +++ b/src/DSWindowShell/DSWindowShell.h @@ -116,6 +116,8 @@ public: bool setVkbdFloating(bool set); bool getVkbdFloating(); + void setAllowUserGeometry(bool set); + protected: private: diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 7435cbf..4e939d7 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -647,6 +647,13 @@ bool DSWindowShellPrivate::getVkbdFloating() return false; } +void DSWindowShellPrivate::setAllowUserGeometry(bool set) +{ + if (__window) + __window->allowUserGeometry(set); +} + + void DSWindowShellPrivate::__sendConfigure(void) { if (__shellSurface) diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index 1d1924c..d9d864c 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -120,6 +120,8 @@ public: bool setVkbdFloating(bool set); bool getVkbdFloating(); + void setAllowUserGeometry(bool set); + private: bool __create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pWin, DSWindowShell *pParent); bool __findInChildList(DSWindowShell *parentWinShell); diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 2493f8c..610e872 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -548,4 +548,13 @@ bool DSZone::getWindowVkbdFloating(DSWaylandSurface *dswlsurface) return wShell->getVkbdFloating(); } + +void DSZone::setWindowAllowUserGeometry(DSWaylandSurface *dswlsurface, bool set) +{ + DSWindowShell *wShell = __findWindowShell(dswlsurface); + if (!wShell) return; + + wShell->setAllowUserGeometry(set); +} + } // namespace display_server diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 338d070..0fdd351 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -85,6 +85,8 @@ public: bool setWindowVkbdFloating(DSWaylandSurface *dswlSurface, bool set); bool getWindowVkbdFloating(DSWaylandSurface *dswlSurface); + void setWindowAllowUserGeometry(DSWaylandSurface *dswlSurface, bool set); + std::list> getWindowList(); std::list> getWindowShellList(); -- 2.7.4 From 9f4dfc88e7e259b540dde3416ff4bdfea9df7a8c Mon Sep 17 00:00:00 2001 From: jeon Date: Sat, 29 Aug 2020 00:11:55 +0900 Subject: [PATCH 12/16] DSWaylandInputPanel: set keyboard window environment and size Change-Id: I05bf5853ba8de1fbbcf11a7dce5d02ab47403eec --- src/DSWaylandServer/DSWaylandInputPanel.cpp | 41 +++++++++++++++++++++++++++-- src/DSWaylandServer/DSWaylandInputPanel.h | 3 +++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandInputPanel.cpp b/src/DSWaylandServer/DSWaylandInputPanel.cpp index f8b7d18..191fced 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.cpp +++ b/src/DSWaylandServer/DSWaylandInputPanel.cpp @@ -28,6 +28,7 @@ #include "DSWaylandSurface.h" #include "DSStruct.h" #include "DSWindowManager.h" +#include "IDSBuffer.h" namespace display_server { @@ -116,7 +117,8 @@ DSWaylandInputPanel::DSWaylandInputPanel(DSWaylandCompositor *compositor) __dsTextInputPrivate(nullptr), __eventLoop(nullptr), __waitUpdate(false), - __rerunPanelShow(false) + __rerunPanelShow(false), + __wlSurface(nullptr) { __inputPanelSurface = new DSWaylandInputPanelSurface(__compositor, this); __inputPanelFloating = new DSWaylandInputPanelFloating(this); @@ -131,7 +133,8 @@ DSWaylandInputPanel::DSWaylandInputPanel(DSWaylandCompositor *compositor, DSText __dsTextInputPrivate(dsTextInputPrivate), __eventLoop(nullptr), __waitUpdate(false), - __rerunPanelShow(false) + __rerunPanelShow(false), + __wlSurface(nullptr) { __inputPanelSurface = new DSWaylandInputPanelSurface(__compositor, this); __inputPanelFloating = new DSWaylandInputPanelFloating(this); @@ -153,6 +156,21 @@ void DSWaylandInputPanel::createSurface(void *client, void *inputPanelResource, __inputPanelSurface->createGlobal(client, inputPanelResource, id, surface); /* TODO: Find window from surface and set some data */ + DSWaylandSurface *wlSurface = DSWaylandSurface::fromWlResource((struct ::wl_resource *)surface); + __wlSurface = wlSurface; + + if (!wlSurface) + { + DSLOG_WRN("DSWaylandInputPanel", "%p wl_surface has no DSWaylandSurface", surface); + return; + } + + DSWindowManager *windowManager = DSWindowManager::getInstance(); + windowManager->setWindowTitle(wlSurface, "Keyboard"); + windowManager->setWindowAllowUserGeometry(wlSurface, true); + windowManager->releaseInstance(); + + wlSurface->registerCallbackSurfaceCommitted(this, std::bind(&DSWaylandInputPanel::__onSurfaceCommitted, this, std::placeholders::_1)); } void DSWaylandInputPanel::clearSurfaces(void *inputPanelResource) @@ -263,6 +281,25 @@ DSWaylandSurface *DSWaylandInputPanel::getTextInputSurface() return __dsTextInputPrivate->getTextInputSurface(); } +void DSWaylandInputPanel::__onSurfaceCommitted(std::shared_ptr waylandSurfaceCommitInfo) +{ + if (!waylandSurfaceCommitInfo->bufferChanged()) + return; + + std::shared_ptr buffer = waylandSurfaceCommitInfo->getBuffer(); + std::shared_ptr bufferSize = buffer->getSize(); + + DSWindowManager *windowManager = DSWindowManager::getInstance(); + stGeometry geo = windowManager->getWindowGeometry(__wlSurface); + + /* FIXME: This calc is only for 0 angle. Use others calc if window is rotated */ + int nx = geo.x + (geo.w - bufferSize->w) / 2; + int ny = geo.y + geo.h - bufferSize->h; + + windowManager->setWindowGeometry(__wlSurface, nx, ny, bufferSize->w, bufferSize->h); + windowManager->releaseInstance(); +} + void DSWaylandInputPanel::__onEventIdleEnterer(void *data) { } diff --git a/src/DSWaylandServer/DSWaylandInputPanel.h b/src/DSWaylandServer/DSWaylandInputPanel.h index f456580..f9f39fa 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.h +++ b/src/DSWaylandServer/DSWaylandInputPanel.h @@ -38,6 +38,7 @@ class DSWaylandInputPanelPrivate; class DSWaylandInputPanelSurface; class DSWaylandInputPanelFloating; class DSWaylandSurface; +class DSWaylandSurfaceCommitInfo; class DS_DECL_EXPORT DSWaylandInputPanel : public DSObject { @@ -73,7 +74,9 @@ private: DSWaylandInputPanelFloating *__inputPanelFloating; bool __waitUpdate; bool __rerunPanelShow; + DSWaylandSurface *__wlSurface; + void __onSurfaceCommitted(std::shared_ptr waylandSurfaceCommitInfo); void __onEventIdleEnterer(void *data); }; -- 2.7.4 From f184cec2a78125426e0d5b539077a3482c058c19 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 28 Aug 2020 17:42:30 +0900 Subject: [PATCH 13/16] DSWaylandSurface: add unique __tizenResId value Change-Id: I9b491473c2518fd01434aa098519e7eb27686174 Signed-off-by: Junkyeong Kim --- src/DSWaylandServer/DSWaylandSurface.cpp | 20 ++++++++++++++++++-- src/DSWaylandServer/DSWaylandSurface.h | 1 + src/DSWaylandServer/DSWaylandSurfacePrivate.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index 9e180de..d007595 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -73,6 +73,8 @@ bool DSWaylandSurfaceCommitInfo::bufferChanged() } /* DSWaylandSurfacePrivate */ +static uint32_t tizenResIdCnt; + DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr) : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), @@ -81,7 +83,8 @@ DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr) __commitInfo{std::make_shared()}, __waylandClient(nullptr), __bufferManager{DSBufferManager::getInstance()}, - __resId(0) + __resId(0), + __tizenResId(++tizenResIdCnt) {} DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr, DSWaylandClient *waylandClient, uint32_t id) @@ -92,7 +95,8 @@ DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr, DSWayl __commitInfo{std::make_shared()}, __waylandClient(waylandClient), __bufferManager{DSBufferManager::getInstance()}, - __resId(0) + __resId(0), + __tizenResId(++tizenResIdCnt) { if (id > 0) { wl_surface::init(waylandClient->wlClient(), (int)id, 4); @@ -111,6 +115,11 @@ uint32_t DSWaylandSurfacePrivate::getResourceId() return __resId; } +uint32_t DSWaylandSurfacePrivate::getTizenResourceId() +{ + return __tizenResId; +} + void DSWaylandSurfacePrivate::surface_bind_resource(Resource *resource) { } @@ -282,4 +291,11 @@ uint32_t DSWaylandSurface::getResourceId() return priv->getResourceId(); } +uint32_t DSWaylandSurface::getTizenResourceId() +{ + DS_GET_PRIV(DSWaylandSurface); + + return priv->getTizenResourceId(); +} + } /* namespace display_server */ diff --git a/src/DSWaylandServer/DSWaylandSurface.h b/src/DSWaylandServer/DSWaylandSurface.h index f6cf2ca..e715fc7 100644 --- a/src/DSWaylandServer/DSWaylandSurface.h +++ b/src/DSWaylandServer/DSWaylandSurface.h @@ -68,6 +68,7 @@ public: bool hasResource(); uint32_t getResourceId(); + uint32_t getTizenResourceId(); private: // signals diff --git a/src/DSWaylandServer/DSWaylandSurfacePrivate.h b/src/DSWaylandServer/DSWaylandSurfacePrivate.h index 0f09d5b..6e344de 100644 --- a/src/DSWaylandServer/DSWaylandSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandSurfacePrivate.h @@ -92,6 +92,7 @@ public: ~DSWaylandSurfacePrivate() override; uint32_t getResourceId(); + uint32_t getTizenResourceId(); protected: void surface_bind_resource(Resource *resource) override; @@ -118,6 +119,7 @@ private: DSWaylandClient *__waylandClient; DSBufferManager *__bufferManager; uint32_t __resId; + uint32_t __tizenResId; }; } /*namespace display_server */ -- 2.7.4 From f5b41c469d0b39fda6c7e86d7d5e96849751f760 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 28 Aug 2020 17:44:06 +0900 Subject: [PATCH 14/16] DSWaylandSurface: add static __waylandSurfaceList list to manage waylandSurfaces Change-Id: I18f694ad2534894f7817130ec77306371c4ca6c5 Signed-off-by: Junkyeong Kim --- src/DSWaylandServer/DSWaylandSurface.cpp | 12 +++++++++--- src/DSWaylandServer/DSWaylandSurface.h | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index d007595..7df93e1 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -247,14 +247,20 @@ DS_WAYLAND_IMPL_FROM_RESOURCE(DSWaylandSurface); /* DSWaylandSurface */ DSWaylandSurface::DSWaylandSurface() : DS_INIT_PRIVATE_PTR(DSWaylandSurface) -{} +{ + __waylandSurfaceList.push_back(this); +} DSWaylandSurface::DSWaylandSurface(DSWaylandClient *waylandClient, uint32_t id) : _d_ptr(std::make_unique(this, waylandClient, id)) -{} +{ + __waylandSurfaceList.push_back(this); +} DSWaylandSurface::~DSWaylandSurface() -{} +{ + __waylandSurfaceList.remove(this); +} void DSWaylandSurface::registerCallbackSurfaceCommitted(DSObject *slot, std::function commitInfo)> func) { diff --git a/src/DSWaylandServer/DSWaylandSurface.h b/src/DSWaylandServer/DSWaylandSurface.h index e715fc7..7275a4f 100644 --- a/src/DSWaylandServer/DSWaylandSurface.h +++ b/src/DSWaylandServer/DSWaylandSurface.h @@ -75,6 +75,8 @@ private: DSSignal> __surfaceCommittedSignal; }; +static std::list __waylandSurfaceList; + } /* namespace display_server */ #endif /* _DS_WAYLAND_SURFACE_H_ */ -- 2.7.4 From f4fce9d036d5f4de0b2ffa40faf44d2b026e6365 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 28 Aug 2020 17:45:34 +0900 Subject: [PATCH 15/16] DSWaylandTizenSurface: get resource id from DSWaylandSurface's __tizenResourceId Change-Id: I97c6abf78454edf48ee2e0f69e7e0e8ce7fb94b5 Signed-off-by: Junkyeong Kim --- src/DSWaylandServer/DSWaylandTizenSurface.cpp | 28 ++++++++++++++++++---- src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.cpp b/src/DSWaylandServer/DSWaylandTizenSurface.cpp index 0a693cb..a698b2a 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurface.cpp +++ b/src/DSWaylandServer/DSWaylandTizenSurface.cpp @@ -30,8 +30,7 @@ namespace display_server /* DSWaylandTizenSurface */ DSWaylandTizenSurfacePrivate::DSWaylandTizenSurfacePrivate(DSWaylandTizenSurface *p_ptr, DSWaylandCompositor *compositor) : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr), - __resource_id_cnt(0) + __p_ptr(p_ptr) { if (!compositor) return; @@ -54,6 +53,8 @@ void DSWaylandTizenSurfacePrivate::tizen_surface_destroy_resource(Resource *reso void DSWaylandTizenSurfacePrivate::tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface) { DSWaylandTizenResource *tizenResource = nullptr; + DSWaylandSurface *waylandSurface = nullptr; + uint32_t tizenResourceId = 0; for (DSWaylandTizenResource *temp : __resourceList) if (temp->getResourceSurface() == surface) return; @@ -65,8 +66,27 @@ void DSWaylandTizenSurfacePrivate::tizen_surface_get_tizen_resource(Resource *re return; } - __resource_id_cnt++; - tizenResource->setResourceId(__resource_id_cnt); + for (DSWaylandSurface *temp : __waylandSurfaceList) + { + if (temp->hasResource()) + { + if (temp->getWlResource() == surface) + { + waylandSurface = temp; + break; + } + } + } + + if (waylandSurface) + { + tizenResourceId = waylandSurface->getTizenResourceId(); + tizenResource->setResourceId(tizenResourceId); + } + else + { + DSLOG_ERR("DSWaylandTizenSurface", "fail get tizen resource id"); + } __resourceList.push_back(tizenResource); diff --git a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h b/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h index 27ea899..e2e634d 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h @@ -26,6 +26,7 @@ #include "dswayland-server-tizen-extension.h" #include "DSWaylandTizenSurface.h" +#include "DSWaylandSurface.h" namespace display_server { @@ -73,7 +74,6 @@ protected: private: std::list __resourceList; - uint32_t __resource_id_cnt; //TO DO : have to manage more proper class }; } -- 2.7.4 From 943a1b57d1bbaf0b3a123e98ef8e0014ba1ab68e Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 28 Aug 2020 18:56:05 +0900 Subject: [PATCH 16/16] DSWaylandSurface: delete __waylandSurfaceList Change-Id: Icb5e735f961fcf32f92f3d3e836ec64e907ef01c Signed-off-by: Junkyeong Kim --- src/DSWaylandServer/DSWaylandSurface.cpp | 5 +---- src/DSWaylandServer/DSWaylandSurface.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index 7df93e1..1eb9b2d 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -73,7 +73,7 @@ bool DSWaylandSurfaceCommitInfo::bufferChanged() } /* DSWaylandSurfacePrivate */ -static uint32_t tizenResIdCnt; +static uint32_t tizenResIdCnt = 0; DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr) : DSObjectPrivate(p_ptr), @@ -248,18 +248,15 @@ DS_WAYLAND_IMPL_FROM_RESOURCE(DSWaylandSurface); DSWaylandSurface::DSWaylandSurface() : DS_INIT_PRIVATE_PTR(DSWaylandSurface) { - __waylandSurfaceList.push_back(this); } DSWaylandSurface::DSWaylandSurface(DSWaylandClient *waylandClient, uint32_t id) : _d_ptr(std::make_unique(this, waylandClient, id)) { - __waylandSurfaceList.push_back(this); } DSWaylandSurface::~DSWaylandSurface() { - __waylandSurfaceList.remove(this); } void DSWaylandSurface::registerCallbackSurfaceCommitted(DSObject *slot, std::function commitInfo)> func) diff --git a/src/DSWaylandServer/DSWaylandSurface.h b/src/DSWaylandServer/DSWaylandSurface.h index 7275a4f..e715fc7 100644 --- a/src/DSWaylandServer/DSWaylandSurface.h +++ b/src/DSWaylandServer/DSWaylandSurface.h @@ -75,8 +75,6 @@ private: DSSignal> __surfaceCommittedSignal; }; -static std::list __waylandSurfaceList; - } /* namespace display_server */ #endif /* _DS_WAYLAND_SURFACE_H_ */ -- 2.7.4