DSKeyboard: add resetFocus(), fix setFocus() and log 69/241869/1
authorSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 06:03:57 +0000 (15:03 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 10:12:26 +0000 (19:12 +0900)
Change-Id: I5c76e29b4188a88ca88d89afd670322973de59da
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
src/DSSeat/DSKeyboard.cpp
src/DSSeat/DSKeyboard.h

index e9a8345..c97f7e7 100644 (file)
@@ -117,6 +117,9 @@ void DSKeyboard::setFocus(std::shared_ptr<DSWindow> window)
        if (!window)
        {
                DSLOG_ERR("DSKeyboard", "Given window is INVALID. (window : %p)", window);
+               __kbdFocus = window;
+               if (__dswlKeyboard)
+                       __dswlKeyboard->setFocus(nullptr);
                return;
        }
 
@@ -124,11 +127,11 @@ void DSKeyboard::setFocus(std::shared_ptr<DSWindow> window)
 
        if (!waylandSurface)
        {
-               DSLOG_ERR("DSKeyboard", "Wayland surface of the given window is INVALID. (window : %p, surface : %p)", window, waylandSurface);
+               DSLOG_ERR("DSKeyboard", "Wayland surface of the given window is INVALID. (window : %p (%p), surface : %p)", window, window.get(), waylandSurface);
                return;
        }
 
-       DSLOG_INF("DSKeyboard", "focus window has been changed. (%p -> %p)", __kbdFocus, window);
+       DSLOG_INF("DSKeyboard", "focus window has been changed. (%p -> %p)", __kbdFocus ? __kbdFocus.get() : nullptr, window ? window.get() : nullptr);
        __kbdFocus = window;
 
        if (!__dswlKeyboard)
@@ -141,6 +144,18 @@ void DSKeyboard::setFocus(std::shared_ptr<DSWindow> window)
 
 }
 
+void DSKeyboard::resetFocus()
+{
+       if (__kbdFocus)
+       {
+               __kbdFocus = nullptr;
+               DSLOG_INF("DSKeyboard", "kbdFocus has been reset.");
+       }
+
+       if (__dswlKeyboard)
+               __dswlKeyboard->resetFocus();
+}
+
 std::shared_ptr<DSWindow> DSKeyboard::getFocus()
 {
        return __kbdFocus;
index 45c844f..2e6e4dd 100644 (file)
@@ -53,6 +53,7 @@ public:
        void setRepeatDelay(uint32_t delay);
 
        void setFocus(std::shared_ptr<DSWindow> window);
+       void resetFocus();
        std::shared_ptr<DSWindow> getFocus();
 
 private: