IME/TI: Fixes and refactoring

Fixes #5189
This commit is contained in:
Vaxry 2024-03-22 23:08:52 +00:00
parent 8c88689faf
commit 9f2ed02f35
8 changed files with 403 additions and 421 deletions

View file

@ -244,39 +244,3 @@ void SKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) {
xkb_keymap_unref(NEWKEYMAP);
xkb_context_unref(PCONTEXT);
}
void STextInput::setFocusedSurface(wlr_surface* pSurface) {
focusedSurface = pSurface;
hyprListener_surfaceUnmapped.removeCallback();
hyprListener_surfaceDestroyed.removeCallback();
if (!pSurface)
return;
hyprListener_surfaceUnmapped.initCallback(
&pSurface->events.unmap,
[this](void* owner, void* data) {
if (!focusedSurface)
return;
focusedSurface = nullptr;
hyprListener_surfaceUnmapped.removeCallback();
hyprListener_surfaceDestroyed.removeCallback();
g_pInputManager->m_sIMERelay.removeSurfaceToPTI(this);
},
this, "STextInput");
hyprListener_surfaceDestroyed.initCallback(
&pSurface->events.destroy,
[this](void* owner, void* data) {
if (!focusedSurface)
return;
focusedSurface = nullptr;
hyprListener_surfaceUnmapped.removeCallback();
hyprListener_surfaceDestroyed.removeCallback();
g_pInputManager->m_sIMERelay.removeSurfaceToPTI(this);
},
this, "STextInput");
}