Skip to content

Commit

Permalink
virtual-keyboard: destroy on vdestroy event
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed May 2, 2024
1 parent 6aa2d12 commit 7d49819
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/helpers/WLClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "../desktop/Popup.hpp"
#include "AnimatedVariable.hpp"
#include "../desktop/WLSurface.hpp"
#include "signal/Listener.hpp"
#include "Region.hpp"

class CMonitor;
Expand Down Expand Up @@ -92,6 +93,10 @@ struct SKeyboard {

void updateXKBTranslationState(xkb_keymap* const keymap = nullptr);

struct {
CHyprSignalListener destroyVKeyboard;
} listeners;

// For the list lookup
bool operator==(const SKeyboard& rhs) const {
return keyboard == rhs.keyboard;
Expand Down
3 changes: 3 additions & 0 deletions src/managers/input/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,9 @@ void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboard> keyboard) {
},
PNEWKEYBOARD, "VKeyboard");

// TODO: this pointer pass sucks.
PNEWKEYBOARD->listeners.destroyVKeyboard = keyboard->events.destroy.registerListener([this, PNEWKEYBOARD](std::any data) { destroyKeyboard(PNEWKEYBOARD); });

disableAllKeyboards(true);

m_pActiveKeyboard = PNEWKEYBOARD;
Expand Down

0 comments on commit 7d49819

Please sign in to comment.