-
Notifications
You must be signed in to change notification settings - Fork 66
wayland: input method protocol #195
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
base: master
Are you sure you want to change the base?
wayland: input method protocol #195
Conversation
f07a697 to
d92ced5
Compare
|
|
|
I still need to do a couple things - especially documentation. I'll add the popup screen and exposing virtual keyboard in future prs since this one is already quite large. |
b265756 to
7054e2d
Compare
a92879d to
9bb2c04
Compare
|
Sorry I haven't updated in a while. I have a separate branch that I have been working on the adding the popup surface functionality however it looks like I need to use the private qt headers, which I have not yet been able to work out. |
|
Looks like CI is broken here, can you rebase on master? For private qt headers you should just be able to import them if you add a dependency on the private qt module. |
44f8232 to
c7ed0c2
Compare
outfoxxed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed most of it that didn't seem likely to greatly change. It would also be useful if you included a couple tests. They dont have to be complex or automatic, just some QML files we can run to make sure its still working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this protocol included directly instead of from w-p?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is kind of confusing as there are three versions of input-method floating around.
- zwp_input_method_v1 - unstable
- xx_input_method_v1 - experimental
- zwp_input_method_v2 - external
Hyprland uses zwp_input_method_v2 so I went with that one.
zwp_input_method_v2 is not included in Wayland protocols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Might be better to split this
- Include from w-p instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'm unsure what you mean by "split this".
- This protocol is not inside Wayland protocols unfortunately.
CMurtagh-LGTM
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to have a look at adding qml test files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is kind of confusing as there are three versions of input-method floating around.
- zwp_input_method_v1 - unstable
- xx_input_method_v1 - experimental
- zwp_input_method_v2 - external
Hyprland uses zwp_input_method_v2 so I went with that one.
zwp_input_method_v2 is not included in Wayland protocols.
| void InputMethodHandle::zwp_input_method_v2_unavailable() { | ||
| if (!this->mAvailable) return; | ||
| this->mAvailable = false; | ||
| InputMethodManager::instance()->releaseInput(); | ||
| qDebug() | ||
| << "Compositor denied input method request, likely due to one already existing elsewhere"; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know of a better way to report it than a log message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'm unsure what you mean by "split this".
- This protocol is not inside Wayland protocols unfortunately.
| void InputMethodKeyboardGrab::zwp_input_method_keyboard_grab_v2_keymap( | ||
| uint32_t format [[maybe_unused]], | ||
| int32_t fd, | ||
| uint32_t size | ||
| ) { | ||
| // https://wayland-book.com/seat/example.html | ||
| assert(format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1); | ||
|
|
||
| char* mapShm = static_cast<char*>(mmap(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0)); | ||
| assert(mapShm != MAP_FAILED); | ||
|
|
||
| this->mKeyMapState = KeyMapState(mapShm); | ||
|
|
||
| munmap(mapShm, size); | ||
| close(fd); | ||
|
|
||
| this->mVirturalKeyboard = | ||
| VirtualKeyboardManager::instance()->createVirtualKeyboard(this->mKeyMapState); | ||
| this->mKeyState = std::vector<KeyState>( | ||
| this->mKeyMapState.maxKeycode() - this->mKeyMapState.minKeycode() - WAYLAND_KEY_OFFSET, | ||
| KeyState::RELEASED | ||
| ); | ||
|
|
||
| // Tell the text input to release all the keys | ||
| for (xkb_keycode_t key = 0; key < this->mKeyState.size(); ++key) { | ||
| this->mVirturalKeyboard->sendKey( | ||
| key + this->mKeyMapState.minKeycode(), | ||
| WL_KEYBOARD_KEY_STATE_RELEASED | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at the private header QXkbCommon, it doesn't have any functions that would be useful here.
If you think there is a particular function I should be using then please tell me.
Popup surfaceThis PR is already large, will add in future PR.Do we want to also expose the virtual keyboard so people can create their own clients?Popup surface and qml virtual keyboard will be in future PRs.