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.
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.
Why is this protocol included directly instead of from w-p?
There was a problem hiding this comment.
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.
I'd gotten it confused with xx-input since they seem pretty similar in most respects. Diffed them and it looks like xx can't grab the keyboard properly and zwp v2 can't position its surface properly. Beautiful.
Fine to vendor it then I guess
There was a problem hiding this comment.
- Might be better to split this
- Include from w-p instead?
There was a problem hiding this comment.
- I'm unsure what you mean by "split this".
- This protocol is not inside Wayland protocols unfortunately.
There was a problem hiding this comment.
- It seems pretty independent from input method and looks like it makes sense to pr separately and not in the input method dir
- Unfortunate, fine to vendor then
CMurtagh-LGTM
left a comment
There was a problem hiding this comment.
I still need to have a look at adding qml test files.
There was a problem hiding this comment.
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.
I don't know of a better way to report it than a log message.
There was a problem hiding this comment.
- 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.
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.
|
Responded inline to the comments above but github seems to have eaten them. They're in the files still |
08c7fc2 to
bcc3d42
Compare
|
This protocol is likely to change in the future, I'd prefer to wait for things to settle down before merging something in. |
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.