File tree Expand file tree Collapse file tree 4 files changed +13
-7
lines changed Expand file tree Collapse file tree 4 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 44#include < wayland-input-method-unstable-v2-client-protocol.h>
55
66#include " keyboard_grab.hpp"
7+ #include " manager.hpp"
78
89namespace qs ::wayland::input_method::impl {
910
@@ -59,7 +60,7 @@ void InputMethodHandle::zwp_input_method_v2_done() {
5960void InputMethodHandle::zwp_input_method_v2_unavailable () {
6061 if (!this ->mAvailable ) return ;
6162 this ->mAvailable = false ;
62- deleteLater ();
63+ InputMethodManager::instance ()-> releaseInput ();
6364 qDebug ()
6465 << " Compositor denied input method request, likely due to one already existing elsewhere" ;
6566}
Original file line number Diff line number Diff line change @@ -25,11 +25,16 @@ wl_seat* getSeat() {
2525} // namespace
2626
2727QPointer<InputMethodHandle> InputMethodManager::acquireInput () {
28- if (inputMethod && inputMethod->isAvailable ()) return inputMethod;
28+ if (this -> inputMethod && this -> inputMethod ->isAvailable ()) return this -> inputMethod ;
2929
30- inputMethod = new InputMethodHandle (this , get_input_method (getSeat ()));
30+ this -> inputMethod = new InputMethodHandle (this , get_input_method (getSeat ()));
3131
32- return inputMethod;
32+ return this ->inputMethod ;
33+ }
34+
35+ void InputMethodManager::releaseInput () {
36+ this ->inputMethod ->deleteLater ();
37+ this ->inputMethod = nullptr ;
3338}
3439
3540VirtualKeyboardManager::VirtualKeyboardManager (): QWaylandClientExtensionTemplate(1 ) {
Original file line number Diff line number Diff line change @@ -24,10 +24,11 @@ class InputMethodManager
2424 static InputMethodManager* instance ();
2525
2626 QPointer<InputMethodHandle> acquireInput ();
27+ void releaseInput ();
2728
2829private:
2930 InputMethodManager ();
30- QPointer< InputMethodHandle> inputMethod = nullptr ;
31+ InputMethodHandle* inputMethod = nullptr ;
3132};
3233
3334class VirtualKeyboardHandle ;
Original file line number Diff line number Diff line change @@ -80,8 +80,7 @@ void InputMethod::getInput() {
8080
8181void InputMethod::releaseInput () {
8282 if (!this ->handle ) return ;
83- this ->handle ->deleteLater ();
84- this ->handle = nullptr ;
83+ InputMethodManager::instance ()->releaseInput ();
8584 emit hasInputChanged ();
8685}
8786
You can’t perform that action at this time.
0 commit comments