don't refocus on virt ptrs

This commit is contained in:
vaxerski 2022-07-11 20:23:16 +02:00
parent ab44aabbd7
commit ad66c158ba
4 changed files with 9 additions and 3 deletions

View file

@ -151,7 +151,7 @@ void Events::listener_newVirtPtr(wl_listener* listener, void* data) {
const auto POINTER = EV->new_pointer;
const auto DEVICE = &POINTER->pointer.base;
g_pInputManager->newMouse(DEVICE);
g_pInputManager->newMouse(DEVICE, true);
}
void Events::listener_destroyMouse(void* owner, void* data) {

View file

@ -109,6 +109,8 @@ struct SMouse {
std::string name = "";
bool virt = false;
DYNLISTENER(commitConstraint);
DYNLISTENER(destroyMouse);

View file

@ -38,6 +38,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
return;
}
if (g_pCompositor->m_sSeat.mouse->virt)
return; // don't refocus on virt
Vector2D mouseCoords = getMouseCoordsInternal();
const auto MOUSECOORDSFLOORED = mouseCoords.floor();
@ -498,11 +501,12 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
Debug::log(LOG, "Set the keyboard layout to %s and variant to %s for keyboard \"%s\"", rules.layout, rules.variant, pKeyboard->keyboard->name);
}
void CInputManager::newMouse(wlr_input_device* mouse) {
void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
m_lMice.emplace_back();
const auto PMOUSE = &m_lMice.back();
PMOUSE->mouse = mouse;
PMOUSE->virt = virt;
try {
PMOUSE->name = std::string(mouse->name);
} catch(std::exception& e) {

View file

@ -21,7 +21,7 @@ public:
void onKeyboardMod(void*, SKeyboard*);
void newKeyboard(wlr_input_device*);
void newMouse(wlr_input_device*);
void newMouse(wlr_input_device*, bool virt = false);
void destroyKeyboard(SKeyboard*);
void destroyMouse(wlr_input_device*);