diff --git a/README.md b/README.md index ece64576eded0424d242e79616eef14843688aac..4fd39d25bc10b8a81b60bb4f2d136d1a6b874036 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,12 @@ hb build lite_wms ## Repositories Involved -/hmf/graphic/surface +[Graphic subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/graphics-subsystem.md) -/hmf/graphic/ui +**graphic_wms** -/hmf/graphic/utils +[graphic_surface](https://gitee.com/openharmony/graphic_surface/blob/master/README.md) +[graphic_ui](https://gitee.com/openharmony/graphic_ui/blob/master/README.md) + +[graphic_utils](https://gitee.com/openharmony/graphic_utils/blob/master/README.md) \ No newline at end of file diff --git a/README_zh.md b/README_zh.md index 603f73416b5da918a485b75ef76867546b899762..595bb6bb13868a8f73780f138640126ec3d1e897 100644 --- a/README_zh.md +++ b/README_zh.md @@ -51,9 +51,12 @@ hb build lite_wms ## 相关仓 -/hmf/graphic/surface +[图形子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%9B%BE%E5%BD%A2%E5%AD%90%E7%B3%BB%E7%BB%9F.md) -/hmf/graphic/ui +**graphic_wms** -/hmf/graphic/utils +[graphic_surface](https://gitee.com/openharmony/graphic_surface/blob/master/README_zh.md) +[graphic_ui](https://gitee.com/openharmony/graphic_ui/blob/master/README_zh.md) + +[graphic_utils](https://gitee.com/openharmony/graphic_utils/blob/master/README_zh.md) \ No newline at end of file diff --git a/frameworks/ims/input_event_client_proxy.h b/frameworks/ims/input_event_client_proxy.h index 5f45063d4e21e27cbe139eacc3d68c9b5ccfb6a0..21fb3becd965065d84471dce604ddf6a6da0814a 100755 --- a/frameworks/ims/input_event_client_proxy.h +++ b/frameworks/ims/input_event_client_proxy.h @@ -51,10 +51,12 @@ private: struct ClientInfo { SvcIdentity svc; uint32_t cdId; + bool alwaysInvoke; }; std::map clientInfoMap_; static pthread_mutex_t lock_; + int16_t lastState_ = 0; InputEventClientProxy(const InputEventClientProxy&) = delete; InputEventClientProxy& operator=(const InputEventClientProxy&) = delete; diff --git a/frameworks/ims/input_event_listener_proxy.cpp b/frameworks/ims/input_event_listener_proxy.cpp index 8456f2b7ac3886c82b4cde9b5f841e4f23621156..55c752e152eb6835f2ebf7187fb73f0698ae1e55 100755 --- a/frameworks/ims/input_event_listener_proxy.cpp +++ b/frameworks/ims/input_event_listener_proxy.cpp @@ -81,6 +81,7 @@ bool InputEventListenerProxy::RegisterInputEventListener(RawEventListener* liste return false; } IpcIoPushSvc(&io, &svc); + IpcIoPushBool(&io, listener->IsAlwaysInvoke()); int32_t ret = proxy_->Invoke(proxy_, LITEIMS_CLIENT_REGISTER, &io, NULL, NULL); if (ret != 0) { GRAPHIC_LOGE("Client register failed, ret=%d", ret); diff --git a/interfaces/innerkits/input_event_listener_proxy.h b/interfaces/innerkits/input_event_listener_proxy.h index 08d4ac2dc21e016fb6342070690e31f20e89d915..56bd73292da6caece70bcec7f11e3d6b5385cad2 100755 --- a/interfaces/innerkits/input_event_listener_proxy.h +++ b/interfaces/innerkits/input_event_listener_proxy.h @@ -31,7 +31,21 @@ public: class RawEventListener { public: + RawEventListener() : alwaysInvoke_(false) {} + virtual ~RawEventListener() {} + + void EnableAlwaysInvoke(bool alwaysInvoke) + { + alwaysInvoke_ = alwaysInvoke; + } + + bool IsAlwaysInvoke() + { + return alwaysInvoke_; + } virtual void OnRawEvent(const RawEvent& event) = 0; + protected: + bool alwaysInvoke_; }; bool RegisterInputEventListener(RawEventListener* listener); diff --git a/services/ims/input_event_client_proxy.cpp b/services/ims/input_event_client_proxy.cpp index b6275796a54b4611b2fde966f3a134dcf53230a7..0a5fa4ab28d11442e53ba71b452e33683404ab8b 100755 --- a/services/ims/input_event_client_proxy.cpp +++ b/services/ims/input_event_client_proxy.cpp @@ -44,6 +44,7 @@ void InputEventClientProxy::AddListener(const void* origin, IpcIo* req, IpcIo* r } pid_t pid = GetCallingPid(origin); SvcIdentity* sid = IpcIoPopSvc(req); + bool alwaysInvoke = IpcIoPopBool(req); if (sid == nullptr) { GRAPHIC_LOGE("Pop Svc failed."); return; @@ -59,7 +60,7 @@ void InputEventClientProxy::AddListener(const void* origin, IpcIo* req, IpcIo* r GRAPHIC_LOGE("Register death callback failed!"); return; } - struct ClientInfo clientInfo = { svc, cbId }; + struct ClientInfo clientInfo = { svc, cbId, alwaysInvoke }; pthread_mutex_lock(&lock_); clientInfoMap_.insert(std::make_pair(pid, clientInfo)); pthread_mutex_unlock(&lock_); @@ -97,8 +98,11 @@ void InputEventClientProxy::OnRawEvent(const RawEvent& event) pthread_mutex_lock(&lock_); std::map::iterator it; for (it = clientInfoMap_.begin(); it != clientInfoMap_.end(); it++) { - SendRequest(nullptr, it->second.svc, 0, &io, nullptr, LITEIPC_FLAG_ONEWAY, nullptr); + if (it->second.alwaysInvoke || (event.state != lastState_)) { + SendRequest(nullptr, it->second.svc, 0, &io, nullptr, LITEIPC_FLAG_ONEWAY, nullptr); + } } + lastState_ = event.state; pthread_mutex_unlock(&lock_); } } // namespace OHOS diff --git a/services/ims/input_event_hub.cpp b/services/ims/input_event_hub.cpp index 9e973dda0bbc760772c0e055bd59bc3e921e6d53..e3daed53c343c988074b02411851b4ae53bb7dcd 100755 --- a/services/ims/input_event_hub.cpp +++ b/services/ims/input_event_hub.cpp @@ -17,9 +17,11 @@ #include "graphic_log.h" namespace OHOS { +namespace { const uint32_t TOUCH_DEV_ID = 1; const uint32_t MOUSE_DEV_ID = 2; const uint32_t UNKNOW_DEV_ID = 32; +} IInputInterface* InputEventHub::inputInterface_ = nullptr; InputReportEventCb InputEventHub::callback_ = { 0 }; InputEventHub::ReadCallback InputEventHub::readCallback_ = nullptr;