mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 06:45:59 +01:00
parent
3b66351eeb
commit
4c7a2faf85
7 changed files with 11 additions and 32 deletions
|
@ -36,5 +36,5 @@ class IHID {
|
|||
CSignal destroy;
|
||||
} events;
|
||||
|
||||
std::string deviceName;
|
||||
std::string deviceName, hlName;
|
||||
};
|
|
@ -94,7 +94,6 @@ class IKeyboard : public IHID {
|
|||
std::array<xkb_mod_index_t, 8> modIndexes = {XKB_MOD_INVALID};
|
||||
uint32_t leds = 0;
|
||||
|
||||
std::string hlName = "";
|
||||
std::string xkbFilePath = "";
|
||||
std::string xkbKeymapString = "";
|
||||
int xkbKeymapFD = -1;
|
||||
|
|
|
@ -104,7 +104,6 @@ class IPointer : public IHID {
|
|||
CSignal holdEnd;
|
||||
} pointerEvents;
|
||||
|
||||
std::string hlName;
|
||||
bool connected = false; // means connected to the cursor
|
||||
std::string boundOutput = "";
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ class ITouch : public IHID {
|
|||
CSignal frame;
|
||||
} touchEvents;
|
||||
|
||||
std::string hlName = "";
|
||||
std::string boundOutput = "";
|
||||
|
||||
WP<ITouch> self;
|
||||
|
|
|
@ -92,7 +92,6 @@ class CTablet : public IHID {
|
|||
WP<CTablet> self;
|
||||
|
||||
bool relativeInput = false;
|
||||
std::string hlName = "";
|
||||
std::string boundOutput = "";
|
||||
CBox activeArea;
|
||||
CBox boundBox; // output-local
|
||||
|
@ -154,8 +153,6 @@ class CTabletPad : public IHID {
|
|||
WP<CTabletPad> self;
|
||||
WP<CTabletTool> parent;
|
||||
|
||||
std::string hlName;
|
||||
|
||||
private:
|
||||
CTabletPad(SP<Aquamarine::ITabletPad> pad);
|
||||
|
||||
|
@ -210,8 +207,6 @@ class CTabletTool : public IHID {
|
|||
std::vector<uint32_t> buttonsDown;
|
||||
Vector2D absolutePos; // last known absolute position.
|
||||
|
||||
std::string hlName;
|
||||
|
||||
private:
|
||||
CTabletTool(SP<Aquamarine::ITabletTool> tool);
|
||||
|
||||
|
|
|
@ -1655,31 +1655,12 @@ std::string CInputManager::getNameForNewDevice(std::string internalName) {
|
|||
auto proposedNewName = deviceNameToInternalString(internalName);
|
||||
int dupeno = 0;
|
||||
|
||||
while (std::find_if(m_vKeyboards.begin(), m_vKeyboards.end(),
|
||||
[&](const auto& other) { return other->hlName == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_vKeyboards.end())
|
||||
auto makeNewName = [&]() { return (proposedNewName.empty() ? "unknown-device" : proposedNewName) + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); };
|
||||
|
||||
while (std::find_if(m_vHIDs.begin(), m_vHIDs.end(), [&](const auto& other) { return other->hlName == makeNewName(); }) != m_vHIDs.end())
|
||||
dupeno++;
|
||||
|
||||
while (std::find_if(m_vPointers.begin(), m_vPointers.end(),
|
||||
[&](const auto& other) { return other->hlName == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_vPointers.end())
|
||||
dupeno++;
|
||||
|
||||
while (std::find_if(m_vTouches.begin(), m_vTouches.end(),
|
||||
[&](const auto& other) { return other->hlName == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_vTouches.end())
|
||||
dupeno++;
|
||||
|
||||
while (std::find_if(m_vTabletPads.begin(), m_vTabletPads.end(),
|
||||
[&](const auto& other) { return other->hlName == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_vTabletPads.end())
|
||||
dupeno++;
|
||||
|
||||
while (std::find_if(m_vTablets.begin(), m_vTablets.end(),
|
||||
[&](const auto& other) { return other->hlName == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_vTablets.end())
|
||||
dupeno++;
|
||||
|
||||
while (std::find_if(m_vTabletTools.begin(), m_vTabletTools.end(),
|
||||
[&](const auto& other) { return other->hlName == proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }) != m_vTabletTools.end())
|
||||
dupeno++;
|
||||
|
||||
return proposedNewName + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno)));
|
||||
return makeNewName();
|
||||
}
|
||||
|
||||
void CInputManager::releaseAllMouseButtons() {
|
||||
|
|
|
@ -228,6 +228,12 @@ SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletToo
|
|||
const auto PTOOL = m_vTabletTools.emplace_back(CTabletTool::create(pTool));
|
||||
m_vHIDs.push_back(PTOOL);
|
||||
|
||||
try {
|
||||
PTOOL->hlName = deviceNameToInternalString(pTool->getName());
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Tablet had no name???"); // logic error
|
||||
}
|
||||
|
||||
PTOOL->events.destroy.registerStaticListener(
|
||||
[this](void* owner, std::any d) {
|
||||
auto TOOL = ((CTabletTool*)owner)->self;
|
||||
|
|
Loading…
Reference in a new issue