Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(indev): support read_preprocess_cb for indev, allow for preproce… #7486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bjsylvia
Copy link
Contributor

…ss or user-customized gesture detection

A clear and concise description of what the bug or new feature is.

Notes

…ss or user-customized gesture detection

Signed-off-by: bjsylvia <[email protected]>
@kisvegabor
Copy link
Member

Could you describe the purpose of this feature in more details?

FYI, we have added a gesture detection system a few weeks ago https://github.com/lvgl/lvgl/tree/master/examples/others/gestures

@bjsylvia
Copy link
Contributor Author

The main consideration of this design is to support the system's ability to prioritize handling system key behaviors or custom gestures before the event is dispatched to the target component.

In this scenario, what the system needs are raw input events, rather than processed gestures or other events.

@kisvegabor
Copy link
Member

So, let's say there is a normal PC keyboard. When a letter is pressed it's forwarded to the widgets normally. However when e.g. a volume up button is pressed something custom should happen. Is it a good example?

If so can it be handled in the normal read_cb like this?

void my_read_cb(lv_indev_t * indev, lv_indev_data_t * data)
{
   bool state;
   int32_t k = key_get(&state) 
   if(is_sys_key_action(k)) {
       sys_key_handle(k);
   } else {
      data.key = k;
      data.state = state;
   }
}

@bjsylvia
Copy link
Contributor Author

The read_cb mainly cannot meet the following requirements:

  1. read_preprocess_cb needs to provide a mechanism to interrupt the subsequent dispatch process to the component when necessary.
  2. In the case of multiple instances, the read_preprocess_cb for each instance maybe different, some need to listen, some do not.
  3. In terms of architecture, the common implementation of read_cb is in the lvgl driver layer, while read_preprocess_cb needs in the business or system layer.

So I introduced the read_preprocess_cb mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants