From 88ec1669113f1e6e4bc39fc09c92a29a9f871fee Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 24 Aug 2020 14:47:23 +0900 Subject: [PATCH 01/16] DSZone: emit windowStackChanged signal when the stack has been changed Change-Id: I9755c327797fcebc22eac7accab49cd9ba22b331 Signed-off-by: Sung-Jin Park --- src/DSZone/DSZone.cpp | 30 ++++++++++++++++++++++++++++++ src/DSZone/DSZone.h | 3 +++ 2 files changed, 33 insertions(+) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 4823aac..bf2700f 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -113,6 +113,11 @@ void DSZone::registerCallbackWindowShellCreated(DSObject *slot, std::function)> func) +{ + __windowStackChangedSignal.connect(slot, func); +} + void DSZone::registerCallbackWindowDestroy(DSObject *slot, std::function)> func) { __windowDestroySignal.connect(slot, func); @@ -220,6 +225,10 @@ void DSZone::__prependWindowList(std::shared_ptr window) __windowList.push_front(window); __stackChanged = true; + __updateWindowOrder(); + + std::shared_ptr wTop(__windowList.front()); + __windowStackChangedSignal.emit(wTop); } void DSZone::__appendWindowList(std::shared_ptr window) @@ -228,6 +237,10 @@ void DSZone::__appendWindowList(std::shared_ptr window) __windowList.push_back(window); __stackChanged = true; + __updateWindowOrder(); + + std::shared_ptr wTop(__windowList.front()); + __windowStackChangedSignal.emit(wTop); } std::shared_ptr DSZone::__findWindow(DSWaylandSurface *dswlSurface) @@ -278,6 +291,23 @@ void DSZone::__destroyWindow(std::shared_ptr window) { __windowDestroySignal.emit(window); __windowList.remove(window); + + __stackChanged = true; + __updateWindowOrder(); + + std::shared_ptr wTop(__windowList.front()); + __windowStackChangedSignal.emit(wTop); +} + +void DSZone::__updateWindowOrder(void) +{ + uint32_t zOrder = 0; + std::list> wList = getWindowList(); + for (auto w : wList) + { + /* TODO : check if the w is in its visible state */ + w->setZOrder(zOrder++); + } } std::shared_ptr DSZone::__createWindowShell(std::shared_ptr window) diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index f7266fc..acb3a61 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -55,6 +55,7 @@ public: void registerCallbackWindowCreated(DSObject *slot, std::function)> func); void registerCallbackWindowDestroy(DSObject *slot, std::function)> func); void registerCallbackWindowShellCreated(DSObject *slot, std::function)> func); + void registerCallbackWindowStackChanged(DSObject *slot, std::function)> func); // emit functions for testing void callCallbackWindowCreated(); @@ -91,6 +92,7 @@ private: std::shared_ptr __createWindow(std::shared_ptr waylandSurface); void __destroyWindow(std::shared_ptr window); + void __updateWindowOrder(void); std::shared_ptr __createWindowShell(std::shared_ptr window); void __destroyWindowShell(DSWindowShell* windowShell, DSWaylandSurface *surface); @@ -116,6 +118,7 @@ private: // signals DSSignal> __windowCreatedSignal; DSSignal> __windowDestroySignal; + DSSignal> __windowStackChangedSignal; DSSignal> __windowShellCreatedSignal; DSSignal> __windowShellDestroySignal; }; -- 2.7.4 From 84ee6ac1d505a60634a3cd7807385e1f93ed9006 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 24 Aug 2020 14:48:05 +0900 Subject: [PATCH 02/16] DSSeat: add/register slot for windowStackChanged signal Change-Id: Ida868f529c5c9a766b08414da5a269caee525506 Signed-off-by: Sung-Jin Park --- src/DSSeat/DSSeat.cpp | 12 ++++++++++-- src/DSSeat/DSSeat.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/DSSeat/DSSeat.cpp b/src/DSSeat/DSSeat.cpp index 645b45f..0030478 100644 --- a/src/DSSeat/DSSeat.cpp +++ b/src/DSSeat/DSSeat.cpp @@ -58,7 +58,8 @@ DSSeat::DSSeat() __numPointer(0), __numKeyboard(0), __numTouch(0), - __focusWin(nullptr) + __focusWin(nullptr), + __stackChanged(false) { } @@ -75,7 +76,8 @@ DSSeat::DSSeat(DSCompositor *compositor, std::string name) __numPointer(0), __numKeyboard(0), __numTouch(0), - __focusWin(nullptr) + __focusWin(nullptr), + __stackChanged(false) { if (!compositor) return; @@ -138,6 +140,7 @@ bool DSSeat::attachZone(std::shared_ptr zone) __zone = zone; __zone->registerCallbackWindowCreated(this, std::bind(&DSSeat::__onWindowCreated, this, std::placeholders::_1)); + __zone->registerCallbackWindowStackChanged(this, std::bind(&DSSeat::__onWindowStackChanged, this, std::placeholders::_1)); __zone->registerCallbackWindowDestroy(this, std::bind(&DSSeat::__onWindowDestroy, this, std::placeholders::_1)); return true; @@ -460,6 +463,11 @@ void DSSeat::__onTouchEvent(DSInputTouchEvent *ev) __touch->processEvent(ev, nullptr); } +void DSSeat::__onWindowStackChanged(std::shared_ptr topWindow) +{ + __stackChanged = true; +} + void DSSeat::__onWindowCreated(std::shared_ptr window) { DSLOG_INF("DSSeat", "window created : %p (%p)", window, window.get()); diff --git a/src/DSSeat/DSSeat.h b/src/DSSeat/DSSeat.h index a599b50..6b7cc01 100644 --- a/src/DSSeat/DSSeat.h +++ b/src/DSSeat/DSSeat.h @@ -91,6 +91,7 @@ private: uint32_t __numTouch; std::shared_ptr __focusWin; + bool __stackChanged; void __initSlots(); void __initEventHandlers(); @@ -109,6 +110,7 @@ private: void __onKeyEvent(DSInputKeyboardEvent *ev); void __onPointerEvent(DSInputMouseEvent *ev); void __onTouchEvent(DSInputTouchEvent *ev); + void __onWindowStackChanged(std::shared_ptr topWindow); void __onWindowCreated(std::shared_ptr window); void __onWindowDestroy(std::shared_ptr window); }; -- 2.7.4 From 7010f8e37eb145fc10fdabe110cb8f2d9fd32cb4 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 24 Aug 2020 16:55:50 +0900 Subject: [PATCH 03/16] DSWaylandSurface: add bufferChanged method allow to check if buffer is attached. wayland client can attach null buffer resource. Change-Id: I284b186e150e4fa577eb7b451d81f1a14d9e68ea --- src/DSWaylandServer/DSWaylandSurface.cpp | 14 +++++++++++++- src/DSWaylandServer/DSWaylandSurface.h | 1 + src/DSWaylandServer/DSWaylandSurfacePrivate.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index 473e3a0..7e98b10 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -63,6 +63,13 @@ std::shared_ptr DSWaylandSurfaceCommitInfo::getBuffer() return priv->getBuffer(); } +bool DSWaylandSurfaceCommitInfo::bufferChanged() +{ + DS_GET_PRIV(DSWaylandSurfaceCommitInfo); + + return priv->bufferChanged; +} + /* DSWaylandSurfacePrivate */ DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr) : DSObjectPrivate(p_ptr), @@ -131,8 +138,11 @@ void DSWaylandSurfacePrivate::surface_attach(Resource *resource, struct ::wl_res if (buffer) { dsBuffer = __bufferManager->getDSBuffer(buffer); commitInfoPendingPriv->bufferRef = std::make_unique(dsBuffer); - + } else { + commitInfoPendingPriv->bufferRef = nullptr; } + + commitInfoPendingPriv->bufferChanged = true; } void DSWaylandSurfacePrivate::surface_damage(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) @@ -174,6 +184,8 @@ void DSWaylandSurfacePrivate::surface_commit(Resource *resource) commitInfoPriv->scale = commitInfoPendingPriv->scale; commitInfoPriv->damageBuffer = commitInfoPendingPriv->damageBuffer; commitInfoPriv->bufferRef = std::move(commitInfoPendingPriv->bufferRef); + commitInfoPriv->bufferChanged = commitInfoPendingPriv->bufferChanged; + commitInfoPendingPriv->bufferChanged = false; // reset value // emit a signal of the surface committed pub->__surfaceCommittedSignal.emit(__commitInfo); diff --git a/src/DSWaylandServer/DSWaylandSurface.h b/src/DSWaylandServer/DSWaylandSurface.h index 41d1ccb..d9cac4a 100644 --- a/src/DSWaylandServer/DSWaylandSurface.h +++ b/src/DSWaylandServer/DSWaylandSurface.h @@ -48,6 +48,7 @@ public: //TODO: add getter functions. std::shared_ptr getBuffer(); + bool bufferChanged(); }; class DSWaylandSurface : public DSObject diff --git a/src/DSWaylandServer/DSWaylandSurfacePrivate.h b/src/DSWaylandServer/DSWaylandSurfacePrivate.h index abff9c2..4b37613 100644 --- a/src/DSWaylandServer/DSWaylandSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandSurfacePrivate.h @@ -56,6 +56,7 @@ public: }; std::unique_ptr bufferRef; struct _attach attach; + bool bufferChanged; struct damageSurface { int32_t x; -- 2.7.4 From 7b1b82bfa9d99b4074733ad112bc23a5d53755b6 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 24 Aug 2020 16:57:29 +0900 Subject: [PATCH 04/16] DSWindow: client can commit null buffer. Change-Id: I6a7b98d9151f70f68aec0b0ccbb9fd95ab437691 --- src/DSWindow/DSWindow.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 8673000..acf1e07 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -206,22 +206,8 @@ void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptr 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 bufferSize = buffer->getSize(); - __committedW = bufferSize->w; - __committedH = bufferSize->h; - -#if 0 // 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 + if (waylandSurfaceCommitInfo->bufferChanged()) { + std::shared_ptr buffer = waylandSurfaceCommitInfo->getBuffer(); // emit a signal of the buffer changed pub->__bufferChangedSignal.emit(buffer); -- 2.7.4 From 6228bb3eacea64ec0493a74295ed55e3154c5ff7 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 24 Aug 2020 16:59:21 +0900 Subject: [PATCH 05/16] DSRenderViewDaliImpl: change the visibility of the dali actor. when buffer exist, set visible. when buffer is null, set unvisible. Change-Id: I944f99582bde658a7aac9ce6fe602b5f3a9761b4 --- src/DSRender/DSRenderViewDaliImpl.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index b76a004..1b64d5b 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -115,19 +115,28 @@ DSRenderViewDaliImpl::~DSRenderViewDaliImpl() bool DSRenderViewDaliImpl::setBuffer(std::shared_ptr buffer) { - tbm_surface_h nativeBuffer = (tbm_surface_h)buffer->getNativeBuffer(); - std::shared_ptr bufferSize = buffer->getSize(); + if (buffer) { + DSLOG_INF("DSRenderViewDaliImpl", "buffer set."); - __textureViewActor.SetProperty(Actor::Property::SIZE, Vector2(bufferSize->w, bufferSize->h)); + __textureViewActor.SetProperty(Actor::Property::VISIBLE, true); - NativeImageSourcePtr nativeImageSource = NativeImageSource::New(Any(nativeBuffer)); + tbm_surface_h nativeBuffer = (tbm_surface_h)buffer->getNativeBuffer(); + std::shared_ptr bufferSize = buffer->getSize(); - Texture nativeTexture = Texture::New(*nativeImageSource); + __textureViewActor.SetProperty(Actor::Property::SIZE, Vector2(bufferSize->w, bufferSize->h)); - TextureSet textureSet = TextureSet::New(); - textureSet.SetTexture(0u, nativeTexture); + NativeImageSourcePtr nativeImageSource = NativeImageSource::New(Any(nativeBuffer)); - __renderer.SetTextures(textureSet); + Texture nativeTexture = Texture::New(*nativeImageSource); + + TextureSet textureSet = TextureSet::New(); + textureSet.SetTexture(0u, nativeTexture); + + __renderer.SetTextures(textureSet); + } else { + DSLOG_INF("DSRenderViewDaliImpl", "buffer NULL."); + __textureViewActor.SetProperty(Actor::Property::VISIBLE, false); + } return true; } @@ -139,9 +148,12 @@ std::shared_ptr DSRenderViewDaliImpl::getWindow() void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr buffer) { - std::shared_ptr bufferSize = buffer->getSize(); - - DSLOG_INF("DSRenderViewDaliImpl", "Window Buffer changed. buffer(%p) size(%d, %d)", buffer.get(), bufferSize->w, bufferSize->h); + if (buffer) { + std::shared_ptr bufferSize = buffer->getSize(); + DSLOG_INF("DSRenderViewDaliImpl", "Window Buffer changed. buffer(%p) size(%d, %d)", buffer.get(), bufferSize->w, bufferSize->h); + } else { + DSLOG_INF("DSRenderViewDaliImpl", "Window Buffer changed. buffer(nullptr)"); + } if (!setBuffer(buffer)) { DSLOG_ERR("DSRenderViewDaliImpl", "setBuffer fails."); -- 2.7.4 From 81ff4150eb6f6ebe958117a1aa1c5cad5e53edeb Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 24 Aug 2020 19:24:40 +0900 Subject: [PATCH 06/16] DSWaylandSurfaceCommitInfo: initialize bufferChanged to false Change-Id: Iba5d6da7e04512640d8e98ae28cc3da624884418 Signed-off-by: Sung-Jin Park --- src/DSWaylandServer/DSWaylandSurface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index 7e98b10..26afa18 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -33,6 +33,7 @@ DSWaylandSurfaceCommitInfoPrivate::DSWaylandSurfaceCommitInfoPrivate(DSWaylandSu __p_ptr(p_ptr), bufferRef(nullptr), attach({0, 0, nullptr}), + bufferChanged(false), damageSurface({0, 0, 0, 0}), transform(0), scale(0), -- 2.7.4 From fb0ebc19682c5ac2685ef3de133824ec0e48d101 Mon Sep 17 00:00:00 2001 From: jeon Date: Mon, 24 Aug 2020 20:41:59 +0900 Subject: [PATCH 07/16] DSDebug: check environment to use dlog Change-Id: I3d98a8723c33ca96b80bb503a40d21c88b3c12c4 --- src/DSDebug/DSDebugLog.cpp | 51 +++++++++++++++++++++++++++++++++++----------- src/DSDebug/DSDebugLog.h | 1 + 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/DSDebug/DSDebugLog.cpp b/src/DSDebug/DSDebugLog.cpp index 2900668..3966335 100644 --- a/src/DSDebug/DSDebugLog.cpp +++ b/src/DSDebug/DSDebugLog.cpp @@ -24,6 +24,7 @@ #include #include #include "DSDebugLog.h" +#include #define COLOR_RED "\x1b[31m" /* for error */ #define COLOR_YELLOW "\x1b[33m" /* for warning */ @@ -33,7 +34,18 @@ namespace display_server { DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG) -{} +{ + char *tmp = getenv("DSLOG_DLOG_ENABLE"); + char *env = strdup(tmp); + int value = atoi(env); + + free(env); + + if (value == 1) + __enableDlog = true; + else + __enableDlog = false; +} DSDebugLog::~DSDebugLog() {} @@ -59,17 +71,32 @@ void DSDebugLog::printLog(int logLevel, const char *domain, const char *funcName //TODO: use dlog or stdout //TODO: use dlog filters va_list arg; - const char *lvl_str[] = { "DS_DBG", "DS_INF", "DS_WRN", "DS_ERR" }; - const char *color[] = { COLOR_RESET, COLOR_GREEN, COLOR_YELLOW, COLOR_RED }; - - va_start(arg, fmt); - printf("%s", color[logLevel]); - printf("[%s]", lvl_str[logLevel]); - printf("[%s]", domain); - printf(":[%s(%d)]:", funcName, line); - vprintf(fmt, arg); - printf("\n"); - va_end(arg); + + if (__enableDlog) + { + const log_priority dlogLevel[] = { DLOG_DEBUG, DLOG_INFO, DLOG_WARN, DLOG_ERROR }; + char buf[512] = {0,}; + + va_start(arg, fmt); + vsnprintf((char *)buf, sizeof(buf), fmt, arg); + va_end(arg); + + dlog_print(dlogLevel[logLevel], "LIBDS", "[%s][%s:%d] %s", domain, funcName, line, buf); + } + else + { + const char *lvl_str[] = { "DS_DBG", "DS_INF", "DS_WRN", "DS_ERR" }; + const char *color[] = { COLOR_RESET, COLOR_GREEN, COLOR_YELLOW, COLOR_RED }; + + va_start(arg, fmt); + printf( "%s", color[logLevel]); + printf( "[%s]", lvl_str[logLevel]); + printf( "[%s]", domain); + printf( ":[%s(%d)]:", funcName, line); + vprintf( fmt, arg); + printf( "\n"); + va_end(arg); + } } int DSDebugLog::getLogLevel() diff --git a/src/DSDebug/DSDebugLog.h b/src/DSDebug/DSDebugLog.h index 12be42e..a1e8dfd 100644 --- a/src/DSDebug/DSDebugLog.h +++ b/src/DSDebug/DSDebugLog.h @@ -55,6 +55,7 @@ private: static DSDebugLog *mInstance; // singleton instance static std::mutex mMutex; // mutex int mLogLevel; // current log level + bool __enableDlog; }; #define DSLOG_DBG(domain, fmt, args...) \ -- 2.7.4 From f14da1c5d987e3abc1081b4604bb02e9c8fb48bf Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 24 Aug 2020 20:03:39 +0900 Subject: [PATCH 08/16] DSWaylandKeyboard: sendEnter when the focused client binds to wl_keyboard Change-Id: Idd975376e71f7d465152022b7dc02fcb7c6bfe91 Signed-off-by: Sung-Jin Park --- src/DSWaylandServer/DSWaylandKeyboard.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/DSWaylandServer/DSWaylandKeyboard.cpp b/src/DSWaylandServer/DSWaylandKeyboard.cpp index e920198..3ca2388 100644 --- a/src/DSWaylandServer/DSWaylandKeyboard.cpp +++ b/src/DSWaylandServer/DSWaylandKeyboard.cpp @@ -89,6 +89,12 @@ void DSWaylandKeyboardPrivate::keyboard_bind_resource(Resource *resource) sendKeymap(resource); sendRepeatInfo(resource); + + if (__focusSurface && __focusSurface->hasResource()) + { + DSLOG_INF("DSWaylandKeyboardPrivate", "Send enter to focusSurface(%p)", __focusSurface); + sendEnter(__focusSurface->getWlResource()); + } } void DSWaylandKeyboardPrivate::keyboard_destroy_resource(Resource *resource) -- 2.7.4 From 30808f5ed6638559d61f5479cf142b8a7772f807 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 19:49:08 +0900 Subject: [PATCH 09/16] DSWindow: add APIs for allow user geometry Change-Id: I2fe296819d10c3a3ee5ba6c65c298335c5d5dd74 --- src/DSWindow/DSWindow.cpp | 23 +++++++++++++++++++++++ src/DSWindow/DSWindow.h | 3 +++ src/DSWindow/DSWindowPrivate.h | 4 ++++ tests/DSWindow-test.cpp | 11 +++++++++++ 4 files changed, 41 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index acf1e07..3e5597f 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -47,6 +47,7 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) __firstCommit(true), __changedGeometry(false), __acceptsFocus(true), + __allowUserGeometry(false), __title(""), __vkbd_floating(false) { @@ -120,6 +121,16 @@ bool DSWindowPrivate::getSkipFocus(void) return true; } +void DSWindowPrivate::allowUserGeometry(bool set) +{ + __allowUserGeometry = set; +} + +bool DSWindowPrivate::isAllowUserGeometry(void) +{ + return __allowUserGeometry; +} + bool DSWindowPrivate::setLayer(int layer) { return true; @@ -311,6 +322,18 @@ bool DSWindow::getSkipFocus(void) return priv->getSkipFocus(); } +void DSWindow::allowUserGeometry(bool set) +{ + DS_GET_PRIV(DSWindow); + priv->allowUserGeometry(set); +} + +bool DSWindow::isAllowUserGeometry(void) +{ + DS_GET_PRIV(DSWindow); + return priv->isAllowUserGeometry(); +} + bool DSWindow::setLayer(int layer) { DS_GET_PRIV(DSWindow); diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 4f1922a..4426809 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -62,6 +62,9 @@ public: bool setSkipFocus(bool set); bool getSkipFocus(void); + void allowUserGeometry(bool set); + bool isAllowUserGeometry(void); + bool setLayer(int layer); bool raise(void); bool lower(void); diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index f250484..2e6e642 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -59,6 +59,9 @@ public: bool setSkipFocus(bool set); bool getSkipFocus(void); + void allowUserGeometry(bool set); + bool isAllowUserGeometry(void); + bool setLayer(int layer); bool raise(void); bool lower(void); @@ -92,6 +95,7 @@ private: bool __firstCommit; bool __changedGeometry; bool __acceptsFocus; + bool __allowUserGeometry; std::string __title; bool __vkbd_floating; diff --git a/tests/DSWindow-test.cpp b/tests/DSWindow-test.cpp index d591563..88f8b48 100644 --- a/tests/DSWindow-test.cpp +++ b/tests/DSWindow-test.cpp @@ -184,3 +184,14 @@ TEST_F(DSWindowTest, ParentTest) EXPECT_TRUE(child->getParent() == nullptr); } +TEST_F(DSWindowTest, UserGeometryTest) +{ + auto win = std::make_shared(); + EXPECT_TRUE(win != nullptr); + + EXPECT_FALSE(win->isAllowUserGeometry()); + + win->allowUserGeometry(true); + EXPECT_TRUE(win->isAllowUserGeometry()); +} + -- 2.7.4 From bd7b0a3008bc29903df21d93def72b945ff6e3b1 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 19:59:21 +0900 Subject: [PATCH 10/16] DSWindowShell: add APIs for handle aux hint Change-Id: I40eb0294e63c70f44b44f3f5d1e745f508b1604e --- src/DSWindowShell/DSWindowShell.cpp | 18 +++++ src/DSWindowShell/DSWindowShell.h | 4 ++ src/DSWindowShell/DSWindowShellPrivate.cpp | 112 ++++++++++++++++++++++++++++- src/DSWindowShell/DSWindowShellPrivate.h | 17 +++++ 4 files changed, 148 insertions(+), 3 deletions(-) diff --git a/src/DSWindowShell/DSWindowShell.cpp b/src/DSWindowShell/DSWindowShell.cpp index c6a0e7c..6863736 100644 --- a/src/DSWindowShell/DSWindowShell.cpp +++ b/src/DSWindowShell/DSWindowShell.cpp @@ -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); diff --git a/src/DSWindowShell/DSWindowShell.h b/src/DSWindowShell/DSWindowShell.h index 0fe1f6d..f5a76f2 100644 --- a/src/DSWindowShell/DSWindowShell.h +++ b/src/DSWindowShell/DSWindowShell.h @@ -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); diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 5119f90..928bee4 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -27,8 +27,36 @@ 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; diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index 454f23d..df1e9c8 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -29,6 +29,15 @@ 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 __childList; + std::list __auxHintsList; }; } -- 2.7.4 From 75705d9146c8854226401a9771e660f711046a8e Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 20:00:19 +0900 Subject: [PATCH 11/16] DSZone: add APIs for handling window's aux hint Change-Id: Idc4e1173fe05b767a487e3d0600b196ce5d63027 --- src/DSZone/DSZone.cpp | 37 +++++++++++++++++++++++++++++++++++++ src/DSZone/DSZone.h | 8 ++++++++ 2 files changed, 45 insertions(+) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index bf2700f..ebbdae4 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -59,6 +59,8 @@ DSZone::DSZone() if (__waylandShell) __waylandShell->registerCallbackShellSurfaceCreated(this, std::bind(&DSZone::__onShellSurfaceCreated, this, std::placeholders::_1)); } + + __setSupportAuxHints(); } DSZone::~DSZone() @@ -73,6 +75,11 @@ DSZone::~DSZone() DSWaylandCompositor::releaseInstance(); } +void DSZone::__setSupportAuxHints(void) +{ + __supportedAuxHints.push_back("wm.policy.win.user.geometry"); +} + void DSZone::setPosition(stPosition &position) { __position.x = position.x; @@ -413,6 +420,36 @@ bool DSZone::setWindowPosition(DSWaylandSurface *dswSurface, int x, int y) */ } +void DSZone::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) +{ + DSWindowShell *wShell = __findWindowShell(dswlSurface); + if (!wShell) return; + + wShell->addAuxHint(id, name, value); +} + +void DSZone::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value) +{ + DSWindowShell *wShell = __findWindowShell(dswlSurface); + if (!wShell) return; + + wShell->changeAuxHint(id, value); +} + +void DSZone::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id) +{ + DSWindowShell *wShell = __findWindowShell(dswlSurface); + if (!wShell) return; + + wShell->removeAuxHint(id); +} + +std::list DSZone::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface) +{ + // TODO: we have to change code to use DSPolicy instead of DSZone + return __supportedAuxHints; +} + void DSZone::activateWindow(DSWaylandSurface *dswlSurface) { if (!dswlSurface) return; diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index acb3a61..96068bc 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -70,6 +70,11 @@ public: bool setWindowGeometry(DSWaylandSurface *dswSurface, int x, int y, unsigned int w, unsigned h); bool setWindowPosition(DSWaylandSurface *dswSurface, int x, int y); + void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); + void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); + void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id); + std::list getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface); + void activateWindow(DSWaylandSurface *dswlSurface); void raiseWindow(DSWaylandSurface* dswlSurface); void lowerWindow(DSWaylandSurface* dswlSurface); @@ -103,6 +108,8 @@ private: std::shared_ptr __findWindow(DSWaylandSurface *dswlSurface); DSWindowShell* __findWindowShell(DSWaylandSurface *dswlSurface); + void __setSupportAuxHints(void); + stPosition __position; stSize __size; std::list> __windowList; @@ -114,6 +121,7 @@ private: bool __stackChanged; std::map __windowShellMap; + std::list __supportedAuxHints; // signals DSSignal> __windowCreatedSignal; -- 2.7.4 From 6179da647a7f0e825f5421028d2c125475fe63ef Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 20:10:11 +0900 Subject: [PATCH 12/16] DSWindowManager: add APIs for handling window's aux hint Change-Id: I0f80f64f0ce068a2a19693e3512c987bdd195858 --- src/DSWindowManager/DSWindowManager.cpp | 64 ++++++++++++++++++++++++++++ src/DSWindowManager/DSWindowManager.h | 5 +++ src/DSWindowManager/DSWindowManagerPrivate.h | 5 +++ 3 files changed, 74 insertions(+) diff --git a/src/DSWindowManager/DSWindowManager.cpp b/src/DSWindowManager/DSWindowManager.cpp index 3fc3e44..1364b87 100644 --- a/src/DSWindowManager/DSWindowManager.cpp +++ b/src/DSWindowManager/DSWindowManager.cpp @@ -269,6 +269,46 @@ void DSWindowManagerPrivate::setWindowPosition(DSWaylandSurface *dsSurface, int } } +void DSWindowManagerPrivate::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) +{ + // find dsSurface's window + DSZone *zone = __getZone(dswlSurface); + if (!zone) return; + + zone->addWindowAuxHint(dswlSurface, id, name, value); +} + +void DSWindowManagerPrivate::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value) +{ + // find dsSurface's window + DSZone *zone = __getZone(dswlSurface); + if (!zone) return; + + zone->changeWindowAuxHint(dswlSurface, id, value); +} + +void DSWindowManagerPrivate::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id) +{ + // find dsSurface's window + DSZone *zone = __getZone(dswlSurface); + if (!zone) return; + + zone->removeWindowAuxHint(dswlSurface, id); +} + +std::list DSWindowManagerPrivate::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface) +{ + // find dsSurface's window + DSZone *zone = __getZone(dswlSurface); + if (!zone) + { + std::list nullList; + return nullList; + } + + return zone->getWindowSupportedAuxHints(dswlSurface); +} + void DSWindowManagerPrivate::activateWindow(DSWaylandSurface *dswlSurface) { // find dswlSurface's window @@ -462,6 +502,30 @@ void DSWindowManager::setWindowPosition(DSWaylandSurface *dsSurface, int x, int priv->setWindowPosition(dsSurface, x, y); } +void DSWindowManager::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) +{ + DS_GET_PRIV(DSWindowManager); + priv->addWindowAuxHint(dswlSurface, id, name, value); +} + +void DSWindowManager::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value) +{ + DS_GET_PRIV(DSWindowManager); + priv->changeWindowAuxHint(dswlSurface, id, value); +} + +void DSWindowManager::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id) +{ + DS_GET_PRIV(DSWindowManager); + priv->removeWindowAuxHint(dswlSurface, id); +} + +std::list DSWindowManager::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface) +{ + DS_GET_PRIV(DSWindowManager); + return priv->getWindowSupportedAuxHints(dswlSurface); +} + void DSWindowManager::activateWindow(DSWaylandSurface *dswlSurface) { DS_GET_PRIV(DSWindowManager); diff --git a/src/DSWindowManager/DSWindowManager.h b/src/DSWindowManager/DSWindowManager.h index c11a495..79d7893 100644 --- a/src/DSWindowManager/DSWindowManager.h +++ b/src/DSWindowManager/DSWindowManager.h @@ -61,6 +61,11 @@ public: void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h); void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y); + void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); + void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); + void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id); + std::list getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface); + void activateWindow(DSWaylandSurface *dswlSurface); void raiseWindow(DSWaylandSurface *dswlSurface); void lowerWindow(DSWaylandSurface *dswlSurface); diff --git a/src/DSWindowManager/DSWindowManagerPrivate.h b/src/DSWindowManager/DSWindowManagerPrivate.h index 28f6ec2..6b80037 100644 --- a/src/DSWindowManager/DSWindowManagerPrivate.h +++ b/src/DSWindowManager/DSWindowManagerPrivate.h @@ -56,6 +56,11 @@ public: void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h); void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y); + void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); + void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); + void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id); + std::list getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface); + void activateWindow(DSWaylandSurface *dswlSurface); void raiseWindow(DSWaylandSurface *dswlSurface); void lowerWindow(DSWaylandSurface *dswlSurface); -- 2.7.4 From 6a81ee750f1624d1f1ab59d6e97cfd5dbbbbf542 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 20:10:54 +0900 Subject: [PATCH 13/16] DSWaylandTizenPolicy: implements functions for handling aux hint Change-Id: Ia848f749763b4c26b8645c824f7221e8005129f4 --- src/DSWaylandServer/DSWaylandTizenPolicy.cpp | 53 +++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandTizenPolicy.cpp b/src/DSWaylandServer/DSWaylandTizenPolicy.cpp index 2ccef52..6b0f1fa 100644 --- a/src/DSWaylandServer/DSWaylandTizenPolicy.cpp +++ b/src/DSWaylandServer/DSWaylandTizenPolicy.cpp @@ -239,22 +239,67 @@ void DSWaylandTizenPolicyPrivate::tizen_policy_uniconify(Resource *resource, str void DSWaylandTizenPolicyPrivate::tizen_policy_add_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &name, const std::string &value) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "Add aux hint (id:%d, key:%s, value:%s)", id, name.c_str(), value.c_str()); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + __wm->addWindowAuxHint(dswlSurface, id, name, value); } void DSWaylandTizenPolicyPrivate::tizen_policy_change_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &value) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "Change aux hint (id:%d, value:%s)", id, value.c_str()); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + __wm->changeWindowAuxHint(dswlSurface, id, value); } void DSWaylandTizenPolicyPrivate::tizen_policy_del_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "Delete aux hint (id:%d)", id); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + __wm->removeWindowAuxHint(dswlSurface, id); } void DSWaylandTizenPolicyPrivate::tizen_policy_get_supported_aux_hints(Resource *resource, struct ::wl_resource *surface) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "resource:%p, surface:%p", resource, surface); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + struct wl_array hints; + int len; + int numOfHints = 0; + char *p; + std::list hints_list; + + hints_list = __wm->getWindowSupportedAuxHints(dswlSurface); + numOfHints = hints_list.size(); + + wl_array_init(&hints); + for (std::string hintName : hints_list) + { + len = hintName.length() + 1; + p = (char*)wl_array_add(&hints, len); + + if (p == NULL) + break; + hintName.copy(p, len); + } + + send_supported_aux_hints(resource->handle, surface, &hints, numOfHints); + wl_array_release(&hints); } void DSWaylandTizenPolicyPrivate::tizen_policy_set_background_state(Resource *resource, uint32_t pid) -- 2.7.4 From 49059dd16f4f87528a703604070568dd40b0b3dc Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 07:56:44 +0900 Subject: [PATCH 14/16] DSWindowManager: add a API to get window geometry Change-Id: Ide5af8ae79888c2ddcea65d6c7c74fe0b5c6677f --- src/DSWindowManager/DSWindowManager.cpp | 17 +++++++++++++++++ src/DSWindowManager/DSWindowManager.h | 2 ++ src/DSWindowManager/DSWindowManagerPrivate.h | 1 + src/DSZone/DSZone.cpp | 9 +++++++++ src/DSZone/DSZone.h | 1 + 5 files changed, 30 insertions(+) diff --git a/src/DSWindowManager/DSWindowManager.cpp b/src/DSWindowManager/DSWindowManager.cpp index 1364b87..4e8e32c 100644 --- a/src/DSWindowManager/DSWindowManager.cpp +++ b/src/DSWindowManager/DSWindowManager.cpp @@ -269,6 +269,17 @@ void DSWindowManagerPrivate::setWindowPosition(DSWaylandSurface *dsSurface, int } } +stGeometry DSWindowManagerPrivate::getWindowGeometry(DSWaylandSurface *dsSurface) +{ + DSZone *zone = __getZone(dsSurface); + stGeometry geometry = {0, }; + if (zone) + { + return zone->getWindowGeometry(dsSurface); + } + return geometry; +} + void DSWindowManagerPrivate::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { // find dsSurface's window @@ -502,6 +513,12 @@ void DSWindowManager::setWindowPosition(DSWaylandSurface *dsSurface, int x, int priv->setWindowPosition(dsSurface, x, y); } +stGeometry DSWindowManager::getWindowGeometry(DSWaylandSurface *dsSurface) +{ + DS_GET_PRIV(DSWindowManager); + return priv->getWindowGeometry(dsSurface); +} + void DSWindowManager::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { DS_GET_PRIV(DSWindowManager); diff --git a/src/DSWindowManager/DSWindowManager.h b/src/DSWindowManager/DSWindowManager.h index 79d7893..838b821 100644 --- a/src/DSWindowManager/DSWindowManager.h +++ b/src/DSWindowManager/DSWindowManager.h @@ -26,6 +26,7 @@ #include "DSCore.h" #include "DSObject.h" +#include "DSStruct.h" namespace display_server { @@ -60,6 +61,7 @@ public: 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); + stGeometry getWindowGeometry(DSWaylandSurface *dsSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); diff --git a/src/DSWindowManager/DSWindowManagerPrivate.h b/src/DSWindowManager/DSWindowManagerPrivate.h index 6b80037..e40eadc 100644 --- a/src/DSWindowManager/DSWindowManagerPrivate.h +++ b/src/DSWindowManager/DSWindowManagerPrivate.h @@ -55,6 +55,7 @@ public: 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); + stGeometry getWindowGeometry(DSWaylandSurface *dsSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index ebbdae4..9174851 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -420,6 +420,15 @@ bool DSZone::setWindowPosition(DSWaylandSurface *dswSurface, int x, int y) */ } +stGeometry DSZone::getWindowGeometry(DSWaylandSurface *dswSurface) +{ + stGeometry geometry = {0, }; + DSWindowShell *wShell = __findWindowShell(dswSurface); + if (!wShell) return geometry; + + return wShell->getGeometry(); +} + void DSZone::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { DSWindowShell *wShell = __findWindowShell(dswlSurface); diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 96068bc..48df95a 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -69,6 +69,7 @@ public: 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); + stGeometry getWindowGeometry(DSWaylandSurface *dswSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); -- 2.7.4 From 4d82076cda2163cee3414198438b517d44807910 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 10:47:27 +0900 Subject: [PATCH 15/16] DSDebug: null check after getenv and strdup Change-Id: I9f82aa12b71c95b930958be6d30d04d1e9bfa232 --- src/DSDebug/DSDebugLog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DSDebug/DSDebugLog.cpp b/src/DSDebug/DSDebugLog.cpp index 3966335..bd579df 100644 --- a/src/DSDebug/DSDebugLog.cpp +++ b/src/DSDebug/DSDebugLog.cpp @@ -33,18 +33,20 @@ namespace display_server { -DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG) +DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG), __enableDlog(false) { char *tmp = getenv("DSLOG_DLOG_ENABLE"); + if (!tmp) return; + char *env = strdup(tmp); + if (!env) return; + int value = atoi(env); free(env); if (value == 1) __enableDlog = true; - else - __enableDlog = false; } DSDebugLog::~DSDebugLog() -- 2.7.4 From 74a1aaebfc04a67bec100f71265ee04b7f3b4b17 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:45:56 +0900 Subject: [PATCH 16/16] DSWindow: make raiseToTop method and registerCallback method of it. Change-Id: Ife39d0b26c24e244f7da242b9b6a1004b51e9dc0 --- src/DSWindow/DSWindow.cpp | 12 ++++++++++++ src/DSWindow/DSWindow.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 3e5597f..41e5288 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -355,6 +355,13 @@ bool DSWindow::lower(void) return priv->lower(); } +bool DSWindow::raiseToTop() +{ + __windowRaiseToTopSignal.emit(nullptr); + + return true; +} + bool DSWindow::unsetFocus(void) { DS_GET_PRIV(DSWindow); @@ -491,4 +498,9 @@ void DSWindow::registerCallbackWindowDestroyed(DSObject *slot, std::function func) +{ + __windowRaiseToTopSignal.connect(slot, func); +} + } // namespace display_server diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 4426809..21ef2b0 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -68,6 +68,7 @@ public: bool setLayer(int layer); bool raise(void); bool lower(void); + bool raiseToTop(); bool unsetFocus(void); bool setFocus(void); @@ -94,6 +95,7 @@ public: void registerCallbackSizeChanged(DSObject *slot, std::function)> func); void registerCallbackBufferChanged(DSObject *slot, std::function)> func); void registerCallbackWindowDestroyed(DSObject *slot, std::function func); + void registerCallbackWindowRaiseToTop(DSObject *slot, std::function func); protected: //virtual bool _onFocus(void); @@ -104,6 +106,7 @@ private: DSSignal> __sizeChangedSignal; DSSignal> __bufferChangedSignal; DSSignal __windowDestroySignal; + DSSignal __windowRaiseToTopSignal; }; } -- 2.7.4