From 22ff4c327d44a35fd76728bf25c5911abeb37b21 Mon Sep 17 00:00:00 2001 From: liuyuxiang-bear Date: Mon, 28 Mar 2022 21:23:46 +0800 Subject: [PATCH 1/3] Description: modify code problems IssueNo: https://gitee.com/openharmony/graphic_ui/issues/I5001O Feature or Bugfix: Bugfix Binary Source:No Signed-off-by: liuyuxiang --- services/wms/lite_wm.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/wms/lite_wm.cpp b/services/wms/lite_wm.cpp index bafc3d5..21293aa 100644 --- a/services/wms/lite_wm.cpp +++ b/services/wms/lite_wm.cpp @@ -328,7 +328,7 @@ void LiteWM::InitMouseCursor() LiteWindow* LiteWM::CreateWindow(const LiteWinConfig& config, pid_t pid) { GraphicLocker lock(stackLock_); - if (CheckWinIdIsAvailable() == false) { + if (!CheckWinIdIsAvailable()) { return nullptr; } LiteWindow* window = new LiteWindow(config); @@ -371,7 +371,7 @@ bool LiteWM::CheckWinIdIsAvailable() int32_t LiteWM::GetUniqueWinId() { static uint8_t winId = 0; - if (CheckWinIdIsAvailable() == false) { + if (!CheckWinIdIsAvailable()) { return INVALID_WINDOW_ID; } while (winIdStorage & (1 << winId)) { @@ -566,7 +566,7 @@ void LiteWM::DrawBackground(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { Rect rect(0, 0, layerData_->width - 1, layerData_->height - 1); Rect rectBg(x1, y1, x2, y2); - if (rect.Intersect(rect, rectBg) == false) { + if (!rect.Intersect(rect, rectBg)) { return; } @@ -588,7 +588,7 @@ void LiteWM::DrawBackground(int16_t x1, int16_t y1, int16_t x2, int16_t y2) void LiteWM::DrawMouseCursor() { Rect rect(0, 0, layerData_->width - 1, layerData_->height - 1); - if (rect.Intersect(rect, cursorInfo_.rect) == false) { + if (!rect.Intersect(rect, cursorInfo_.rect)) { return; } @@ -635,6 +635,7 @@ LiteWindow* LiteWM::FindTargetWindow(const RawEvent& event) switch (event.type) { case InputDevType::INDEV_TYPE_MOUSE: + //fall-through case InputDevType::INDEV_TYPE_TOUCH: { auto node = winList_.Begin(); while (node != winList_.End()) { @@ -648,6 +649,7 @@ LiteWindow* LiteWM::FindTargetWindow(const RawEvent& event) break; } case InputDevType::INDEV_TYPE_KEY: + //fall-through case InputDevType::INDEV_TYPE_BUTTON: { targetWindow = winList_.Front(); break; -- Gitee From c7646c15bb6d97fa11a5c532928d9b9eb56bfc89 Mon Sep 17 00:00:00 2001 From: liuyongchang Date: Mon, 21 Mar 2022 16:37:01 +0800 Subject: [PATCH 2/3] Modify some confused variable names. Signed-off-by: liuyongchang --- .../innerkits/input_event_listener_proxy.h | 23 ++++++++++++++++--- services/wms/lite_wm.cpp | 10 ++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/interfaces/innerkits/input_event_listener_proxy.h b/interfaces/innerkits/input_event_listener_proxy.h index eb35669..268a7ad 100644 --- a/interfaces/innerkits/input_event_listener_proxy.h +++ b/interfaces/innerkits/input_event_listener_proxy.h @@ -16,9 +16,9 @@ #ifndef GRAPHIC_LITE_IMS_CLIENT_PROXY_H #define GRAPHIC_LITE_IMS_CLIENT_PROXY_H -#include -#include "liteipc_adapter.h" #include "gfx_utils/input_event_info.h" +#include "liteipc_adapter.h" +#include namespace OHOS { class InputEventListenerProxy { @@ -30,22 +30,39 @@ public: RawEventListener() : alwaysInvoke_(false) {} virtual ~RawEventListener() {} + /** + * @brief Change always-invoke state to enable. + */ void EnableAlwaysInvoke(bool alwaysInvoke) { alwaysInvoke_ = alwaysInvoke; } + /** + * @brief Verify always-invoke state. + */ bool IsAlwaysInvoke() { return alwaysInvoke_; } + + /** + * @brief Do something when raw event comes. + */ virtual void OnRawEvent(const RawEvent& event) = 0; + protected: - bool alwaysInvoke_; + bool alwaysInvoke_; }; + /** + * @brief Regist input event lisener. + */ bool RegisterInputEventListener(RawEventListener* listener); + /** + * @brief Unegist input event lisener. + */ bool UnregisterInputEventListener(); private: diff --git a/services/wms/lite_wm.cpp b/services/wms/lite_wm.cpp index 21293aa..c526c78 100644 --- a/services/wms/lite_wm.cpp +++ b/services/wms/lite_wm.cpp @@ -637,14 +637,14 @@ LiteWindow* LiteWM::FindTargetWindow(const RawEvent& event) case InputDevType::INDEV_TYPE_MOUSE: //fall-through case InputDevType::INDEV_TYPE_TOUCH: { - auto node = winList_.Begin(); - while (node != winList_.End()) { + auto win = winList_.Begin(); + while (win != winList_.End()) { Point p = { event.x, event.y }; - if (node->data_->isShow_ && node->data_->GetConfig().rect.IsContains(p)) { - targetWindow = node->data_; + if (win->data_->isShow_ && win->data_->GetConfig().rect.IsContains(p)) { + targetWindow = win->data_; break; } - node = node->next_; + win = win->next_; } break; } -- Gitee From 2848ca2cb249e1cd2c8468e30fe7d581347121b2 Mon Sep 17 00:00:00 2001 From: liuyongchang Date: Mon, 21 Mar 2022 11:53:13 +0800 Subject: [PATCH 3/3] Fix issues of specification. Signed-off-by: liuyongchang --- README.md | 2 +- frameworks/ims/input_event_client_proxy.h | 2 +- interfaces/innerkits/input_event_listener_proxy.h | 3 ++- services/wms/lite_wm.cpp | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4fd39d2..0cdf37f 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ hb build lite_wms ## Repositories Involved -[Graphic subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/graphics-subsystem.md) +[Graphic subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/graphics.md) **graphic_wms** diff --git a/frameworks/ims/input_event_client_proxy.h b/frameworks/ims/input_event_client_proxy.h index 29fc3cb..17289c8 100644 --- a/frameworks/ims/input_event_client_proxy.h +++ b/frameworks/ims/input_event_client_proxy.h @@ -25,7 +25,7 @@ #include namespace OHOS { -#define MAX_CLIENT_SIZE 1 +constexpr uint8_t MAX_CLIENT_SIZE = 1; class InputEventClientProxy : public InputEventDistributer::RawEventListener { public: static InputEventClientProxy* GetInstance(); diff --git a/interfaces/innerkits/input_event_listener_proxy.h b/interfaces/innerkits/input_event_listener_proxy.h index 268a7ad..1969986 100644 --- a/interfaces/innerkits/input_event_listener_proxy.h +++ b/interfaces/innerkits/input_event_listener_proxy.h @@ -16,9 +16,10 @@ #ifndef GRAPHIC_LITE_IMS_CLIENT_PROXY_H #define GRAPHIC_LITE_IMS_CLIENT_PROXY_H +#include + #include "gfx_utils/input_event_info.h" #include "liteipc_adapter.h" -#include namespace OHOS { class InputEventListenerProxy { diff --git a/services/wms/lite_wm.cpp b/services/wms/lite_wm.cpp index c526c78..b054c04 100644 --- a/services/wms/lite_wm.cpp +++ b/services/wms/lite_wm.cpp @@ -635,7 +635,7 @@ LiteWindow* LiteWM::FindTargetWindow(const RawEvent& event) switch (event.type) { case InputDevType::INDEV_TYPE_MOUSE: - //fall-through + // fall-through case InputDevType::INDEV_TYPE_TOUCH: { auto win = winList_.Begin(); while (win != winList_.End()) { @@ -649,7 +649,7 @@ LiteWindow* LiteWM::FindTargetWindow(const RawEvent& event) break; } case InputDevType::INDEV_TYPE_KEY: - //fall-through + // fall-through case InputDevType::INDEV_TYPE_BUTTON: { targetWindow = winList_.Front(); break; -- Gitee