core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us. It's not a strict requirement to be compliant, but I tuned it to be alright.
This commit is contained in:
parent
b1e5cc66bd
commit
8bbeee1173
118 changed files with 720 additions and 679 deletions
|
|
@ -216,17 +216,17 @@ void CAnimationManager::tick() {
|
|||
|
||||
switch (av->m_Type) {
|
||||
case AVARTYPE_FLOAT: {
|
||||
auto typedAv = static_cast<CAnimatedVariable<float>*>(av);
|
||||
auto typedAv = dynamic_cast<CAnimatedVariable<float>*>(av);
|
||||
updateVariable(*typedAv);
|
||||
break;
|
||||
}
|
||||
case AVARTYPE_VECTOR: {
|
||||
auto typedAv = static_cast<CAnimatedVariable<Vector2D>*>(av);
|
||||
auto typedAv = dynamic_cast<CAnimatedVariable<Vector2D>*>(av);
|
||||
updateVariable(*typedAv);
|
||||
break;
|
||||
}
|
||||
case AVARTYPE_COLOR: {
|
||||
auto typedAv = static_cast<CAnimatedVariable<CHyprColor>*>(av);
|
||||
auto typedAv = dynamic_cast<CAnimatedVariable<CHyprColor>*>(av);
|
||||
updateColorVariable(*typedAv);
|
||||
break;
|
||||
}
|
||||
|
|
@ -495,7 +495,7 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
|
|||
else if (style.starts_with("popin")) {
|
||||
// try parsing
|
||||
float minPerc = 0.f;
|
||||
if (style.find("%") != std::string::npos) {
|
||||
if (style.find('%') != std::string::npos) {
|
||||
try {
|
||||
auto percstr = style.substr(style.find_last_of(' '));
|
||||
minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||
|
|
@ -516,7 +516,7 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
|
|||
else if (style.starts_with("slidefade")) {
|
||||
// try parsing
|
||||
float movePerc = 0.f;
|
||||
if (style.find("%") != std::string::npos) {
|
||||
if (style.find('%') != std::string::npos) {
|
||||
try {
|
||||
auto percstr = style.substr(style.find_last_of(' ') + 1);
|
||||
movePerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||
|
|
@ -541,7 +541,7 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
|
|||
else if (style.starts_with("popin")) {
|
||||
// try parsing
|
||||
float minPerc = 0.f;
|
||||
if (style.find("%") != std::string::npos) {
|
||||
if (style.find('%') != std::string::npos) {
|
||||
try {
|
||||
auto percstr = style.substr(style.find_last_of(' '));
|
||||
minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||
|
|
|
|||
|
|
@ -17,16 +17,12 @@ static void hcLogger(enum eHyprcursorLogLevel level, char* message) {
|
|||
Debug::log(NONE, "[hc] {}", message);
|
||||
}
|
||||
|
||||
CCursorBuffer::CCursorBuffer(cairo_surface_t* surf, const Vector2D& size_, const Vector2D& hot_) : hotspot(hot_) {
|
||||
surface = surf;
|
||||
size = size_;
|
||||
stride = cairo_image_surface_get_stride(surf);
|
||||
CCursorBuffer::CCursorBuffer(cairo_surface_t* surf, const Vector2D& size_, const Vector2D& hot_) : hotspot(hot_), surface(surf), stride(cairo_image_surface_get_stride(surf)) {
|
||||
size = size_;
|
||||
}
|
||||
|
||||
CCursorBuffer::CCursorBuffer(uint8_t* pixelData_, const Vector2D& size_, const Vector2D& hot_) : hotspot(hot_) {
|
||||
pixelData = pixelData_;
|
||||
size = size_;
|
||||
stride = 4 * size_.x;
|
||||
CCursorBuffer::CCursorBuffer(uint8_t* pixelData_, const Vector2D& size_, const Vector2D& hot_) : hotspot(hot_), pixelData(pixelData_), stride(4 * size_.x) {
|
||||
size = size_;
|
||||
}
|
||||
|
||||
Aquamarine::eBufferCapability CCursorBuffer::caps() {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@
|
|||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
|
||||
CEventManager::CEventManager() {
|
||||
m_iSocketFD = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
|
||||
CEventManager::CEventManager() : m_iSocketFD(socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) {
|
||||
if (m_iSocketFD < 0) {
|
||||
Debug::log(ERR, "Couldn't start the Hyprland Socket 2. (1) IPC will not work.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "../protocols/ShortcutsInhibit.hpp"
|
||||
#include "../protocols/GlobalShortcuts.hpp"
|
||||
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
||||
#include "../devices/IKeyboard.hpp"
|
||||
#include "KeybindManager.hpp"
|
||||
#include "PointerManager.hpp"
|
||||
#include "Compositor.hpp"
|
||||
|
|
@ -13,7 +12,6 @@
|
|||
#include "eventLoop/EventLoopManager.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "helpers/varlist/VarList.hpp"
|
||||
#include "eventLoop/EventLoopManager.hpp"
|
||||
|
||||
#include <optional>
|
||||
#include <iterator>
|
||||
|
|
@ -265,7 +263,7 @@ void CKeybindManager::updateXKBTranslationState() {
|
|||
|
||||
xkb_rule_names rules = {.rules = RULES.c_str(), .model = MODEL.c_str(), .layout = LAYOUT.c_str(), .variant = VARIANT.c_str(), .options = OPTIONS.c_str()};
|
||||
const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
FILE* const KEYMAPFILE = FILEPATH == "" ? NULL : fopen(absolutePath(FILEPATH, g_pConfigManager->configCurrentPath).c_str(), "r");
|
||||
FILE* const KEYMAPFILE = FILEPATH == "" ? nullptr : fopen(absolutePath(FILEPATH, g_pConfigManager->configCurrentPath).c_str(), "r");
|
||||
|
||||
auto PKEYMAP = KEYMAPFILE ? xkb_keymap_new_from_file(PCONTEXT, KEYMAPFILE, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS) :
|
||||
xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
|
|
@ -409,7 +407,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
|
|||
}
|
||||
|
||||
if (!m_pXKBTranslationState) {
|
||||
Debug::log(ERR, "BUG THIS: m_pXKBTranslationState NULL!");
|
||||
Debug::log(ERR, "BUG THIS: m_pXKBTranslationState nullptr!");
|
||||
updateXKBTranslationState();
|
||||
|
||||
if (!m_pXKBTranslationState)
|
||||
|
|
@ -734,7 +732,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
|||
if (SPECIALTRIGGERED && !pressed)
|
||||
std::erase_if(m_vPressedSpecialBinds, [&](const auto& other) { return other == k; });
|
||||
else if (SPECIALDISPATCHER && pressed)
|
||||
m_vPressedSpecialBinds.push_back(k);
|
||||
m_vPressedSpecialBinds.emplace_back(k);
|
||||
|
||||
// Should never happen, as we check in the ConfigManager, but oh well
|
||||
if (DISPATCHER == m_mDispatchers.end()) {
|
||||
|
|
@ -762,7 +760,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
|||
if (k->repeat) {
|
||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
|
||||
m_vActiveKeybinds.push_back(k);
|
||||
m_vActiveKeybinds.emplace_back(k);
|
||||
m_pRepeatKeyTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay));
|
||||
}
|
||||
|
||||
|
|
@ -827,7 +825,7 @@ void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const uint3
|
|||
|
||||
bool CKeybindManager::handleVT(xkb_keysym_t keysym) {
|
||||
// Handles the CTRL+ALT+FX TTY keybinds
|
||||
if (!(keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12))
|
||||
if (keysym < XKB_KEY_XF86Switch_VT_1 || keysym > XKB_KEY_XF86Switch_VT_12)
|
||||
return false;
|
||||
|
||||
// beyond this point, return true to not handle anything else.
|
||||
|
|
@ -942,7 +940,7 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo
|
|||
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||
sigprocmask(SIG_SETMASK, &set, nullptr);
|
||||
|
||||
grandchild = fork();
|
||||
if (grandchild == 0) {
|
||||
|
|
@ -968,7 +966,7 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo
|
|||
read(socket[0], &grandchild, sizeof(grandchild));
|
||||
close(socket[0]);
|
||||
// clear child and leave grandchild to init
|
||||
waitpid(child, NULL, 0);
|
||||
waitpid(child, nullptr, 0);
|
||||
if (grandchild < 0) {
|
||||
Debug::log(LOG, "Fail to create the second fork");
|
||||
return 0;
|
||||
|
|
@ -1248,15 +1246,15 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) {
|
|||
clientMode = std::stoi(ARGS[1]);
|
||||
} catch (std::exception& e) { clientMode = -1; }
|
||||
|
||||
const sFullscreenState STATE = sFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_sFullscreenState.internal),
|
||||
const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_sFullscreenState.internal),
|
||||
.client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_sFullscreenState.client)};
|
||||
|
||||
if (internalMode != -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal && PWINDOW->m_sFullscreenState.client == STATE.client)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
|
||||
else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_sFullscreenState.client});
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_sFullscreenState.client});
|
||||
else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.client == STATE.client)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = FSMODE_NONE});
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = FSMODE_NONE});
|
||||
else
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, STATE);
|
||||
|
||||
|
|
@ -1812,8 +1810,8 @@ SDispatchResult CKeybindManager::renameWorkspace(std::string args) {
|
|||
else
|
||||
return {.success = false, .error = "No such workspace"};
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. \"{}\": \"{}\"", args, e.what());
|
||||
return {.success = false, .error = std::format("Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. \"{}\": \"{}\"", args, e.what())};
|
||||
Debug::log(ERR, R"(Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. "{}": "{}")", args, e.what());
|
||||
return {.success = false, .error = std::format(R"(Invalid arg in renameWorkspace, expected numeric id only or a numeric id and string name. "{}": "{}")", args, e.what())};
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
@ -2286,7 +2284,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
const auto MOD = g_pKeybindManager->stringToModMask(ARGS[0]);
|
||||
const auto KEY = ARGS[1];
|
||||
uint32_t keycode = 0;
|
||||
bool isMouse = 0;
|
||||
bool isMouse = false;
|
||||
|
||||
// similar to parseKey in ConfigManager
|
||||
if (isNumber(KEY) && std::stoi(KEY) > 9)
|
||||
|
|
@ -2295,7 +2293,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
keycode = std::stoi(KEY.substr(5));
|
||||
else if (KEY.compare(0, 6, "mouse:") == 0 && isNumber(KEY.substr(6))) {
|
||||
keycode = std::stoi(KEY.substr(6));
|
||||
isMouse = 1;
|
||||
isMouse = true;
|
||||
if (keycode < 272) {
|
||||
Debug::log(ERR, "sendshortcut: invalid mouse button");
|
||||
return {.success = false, .error = "sendshortcut: invalid mouse button"};
|
||||
|
|
@ -2643,9 +2641,9 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) {
|
|||
}
|
||||
|
||||
if (POSITION == "top")
|
||||
g_pCompositor->changeWindowZOrder(PWINDOW, 1);
|
||||
g_pCompositor->changeWindowZOrder(PWINDOW, true);
|
||||
else if (POSITION == "bottom")
|
||||
g_pCompositor->changeWindowZOrder(PWINDOW, 0);
|
||||
g_pCompositor->changeWindowZOrder(PWINDOW, false);
|
||||
else {
|
||||
Debug::log(ERR, "alterZOrder: bad position: {}", POSITION);
|
||||
return {.success = false, .error = "alterZOrder: bad position: {}"};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include "../defines.hpp"
|
||||
#include <deque>
|
||||
#include <set>
|
||||
#include "../Compositor.hpp"
|
||||
#include <unordered_map>
|
||||
#include <functional>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
|
@ -15,6 +14,8 @@ class CConfigManager;
|
|||
class CPluginSystem;
|
||||
class IKeyboard;
|
||||
|
||||
enum eMouseBindMode : int8_t;
|
||||
|
||||
struct SKeybind {
|
||||
std::string key = "";
|
||||
std::set<xkb_keysym_t> sMkKeys = {};
|
||||
|
|
@ -42,7 +43,7 @@ struct SKeybind {
|
|||
bool shadowed = false;
|
||||
};
|
||||
|
||||
enum eFocusWindowMode {
|
||||
enum eFocusWindowMode : uint8_t {
|
||||
MODE_CLASS_REGEX = 0,
|
||||
MODE_INITIAL_CLASS_REGEX,
|
||||
MODE_TITLE_REGEX,
|
||||
|
|
@ -67,7 +68,7 @@ struct SParsedKey {
|
|||
bool catchAll = false;
|
||||
};
|
||||
|
||||
enum eMultiKeyCase {
|
||||
enum eMultiKeyCase : uint8_t {
|
||||
MK_NO_MATCH = 0,
|
||||
MK_PARTIAL_MATCH,
|
||||
MK_FULL_MATCH
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class CLayoutManager {
|
|||
std::vector<std::string> getAllLayoutNames();
|
||||
|
||||
private:
|
||||
enum HYPRLAYOUTS {
|
||||
enum eHyprLayouts : uint8_t {
|
||||
LAYOUT_DWINDLE = 0,
|
||||
LAYOUT_MASTER
|
||||
};
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
|
|||
bool flipRB = false;
|
||||
|
||||
if (SURFACE->current.texture) {
|
||||
Debug::log(TRACE, "Cursor CPU surface: format {}, expecting AR24", FormatUtils::drmFormatName(SURFACE->current.texture->m_iDrmFormat));
|
||||
Debug::log(TRACE, "Cursor CPU surface: format {}, expecting AR24", NFormatUtils::drmFormatName(SURFACE->current.texture->m_iDrmFormat));
|
||||
if (SURFACE->current.texture->m_iDrmFormat == DRM_FORMAT_ABGR8888) {
|
||||
Debug::log(TRACE, "Cursor CPU surface format AB24, will flip. WARNING: this will break on big endian!");
|
||||
flipRB = true;
|
||||
|
|
@ -781,7 +781,7 @@ void CPointerManager::onMonitorLayoutChange() {
|
|||
if (m->isMirror() || !m->m_bEnabled || !m->output)
|
||||
continue;
|
||||
|
||||
currentMonitorLayout.monitorBoxes.emplace_back(CBox{m->vecPosition, m->vecSize});
|
||||
currentMonitorLayout.monitorBoxes.emplace_back(m->vecPosition, m->vecSize);
|
||||
}
|
||||
|
||||
damageIfSoftware();
|
||||
|
|
@ -822,7 +822,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
detachPointer(nullptr);
|
||||
});
|
||||
|
||||
listener->motion = pointer->pointerEvents.motion.registerListener([this] (std::any e) {
|
||||
listener->motion = pointer->pointerEvents.motion.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SMotionEvent>(e);
|
||||
|
||||
g_pInputManager->onMouseMoved(E);
|
||||
|
|
@ -833,7 +833,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->motionAbsolute = pointer->pointerEvents.motionAbsolute.registerListener([this] (std::any e) {
|
||||
listener->motionAbsolute = pointer->pointerEvents.motionAbsolute.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SMotionAbsoluteEvent>(e);
|
||||
|
||||
g_pInputManager->onMouseWarp(E);
|
||||
|
|
@ -844,7 +844,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->button = pointer->pointerEvents.button.registerListener([this] (std::any e) {
|
||||
listener->button = pointer->pointerEvents.button.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SButtonEvent>(e);
|
||||
|
||||
g_pInputManager->onMouseButton(E);
|
||||
|
|
@ -852,7 +852,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->axis = pointer->pointerEvents.axis.registerListener([this] (std::any e) {
|
||||
listener->axis = pointer->pointerEvents.axis.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SAxisEvent>(e);
|
||||
|
||||
g_pInputManager->onMouseWheel(E);
|
||||
|
|
@ -860,7 +860,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->frame = pointer->pointerEvents.frame.registerListener([this] (std::any e) {
|
||||
listener->frame = pointer->pointerEvents.frame.registerListener([] (std::any e) {
|
||||
bool shouldSkip = false;
|
||||
if (!g_pSeatManager->mouse.expired() && g_pInputManager->isLocked()) {
|
||||
auto PMONITOR = g_pCompositor->m_pLastMonitor.get();
|
||||
|
|
@ -871,7 +871,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pSeatManager->sendPointerFrame();
|
||||
});
|
||||
|
||||
listener->swipeBegin = pointer->pointerEvents.swipeBegin.registerListener([this] (std::any e) {
|
||||
listener->swipeBegin = pointer->pointerEvents.swipeBegin.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SSwipeBeginEvent>(e);
|
||||
|
||||
g_pInputManager->onSwipeBegin(E);
|
||||
|
|
@ -882,7 +882,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->swipeEnd = pointer->pointerEvents.swipeEnd.registerListener([this] (std::any e) {
|
||||
listener->swipeEnd = pointer->pointerEvents.swipeEnd.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SSwipeEndEvent>(e);
|
||||
|
||||
g_pInputManager->onSwipeEnd(E);
|
||||
|
|
@ -890,7 +890,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->swipeUpdate = pointer->pointerEvents.swipeUpdate.registerListener([this] (std::any e) {
|
||||
listener->swipeUpdate = pointer->pointerEvents.swipeUpdate.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SSwipeUpdateEvent>(e);
|
||||
|
||||
g_pInputManager->onSwipeUpdate(E);
|
||||
|
|
@ -898,7 +898,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->pinchBegin = pointer->pointerEvents.pinchBegin.registerListener([this] (std::any e) {
|
||||
listener->pinchBegin = pointer->pointerEvents.pinchBegin.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SPinchBeginEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->pinchBegin(E.timeMs, E.fingers);
|
||||
|
|
@ -909,7 +909,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->pinchEnd = pointer->pointerEvents.pinchEnd.registerListener([this] (std::any e) {
|
||||
listener->pinchEnd = pointer->pointerEvents.pinchEnd.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SPinchEndEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->pinchEnd(E.timeMs, E.cancelled);
|
||||
|
|
@ -917,7 +917,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->pinchUpdate = pointer->pointerEvents.pinchUpdate.registerListener([this] (std::any e) {
|
||||
listener->pinchUpdate = pointer->pointerEvents.pinchUpdate.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SPinchUpdateEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->pinchUpdate(E.timeMs, E.delta, E.scale, E.rotation);
|
||||
|
|
@ -925,7 +925,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->holdBegin = pointer->pointerEvents.holdBegin.registerListener([this] (std::any e) {
|
||||
listener->holdBegin = pointer->pointerEvents.holdBegin.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SHoldBeginEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->holdBegin(E.timeMs, E.fingers);
|
||||
|
|
@ -933,7 +933,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->holdEnd = pointer->pointerEvents.holdEnd.registerListener([this] (std::any e) {
|
||||
listener->holdEnd = pointer->pointerEvents.holdEnd.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SHoldEndEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->holdEnd(E.timeMs, E.cancelled);
|
||||
|
|
@ -961,7 +961,7 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||
detachTouch(nullptr);
|
||||
});
|
||||
|
||||
listener->down = touch->touchEvents.down.registerListener([this] (std::any e) {
|
||||
listener->down = touch->touchEvents.down.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<ITouch::SDownEvent>(e);
|
||||
|
||||
g_pInputManager->onTouchDown(E);
|
||||
|
|
@ -972,7 +972,7 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->up = touch->touchEvents.up.registerListener([this] (std::any e) {
|
||||
listener->up = touch->touchEvents.up.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<ITouch::SUpEvent>(e);
|
||||
|
||||
g_pInputManager->onTouchUp(E);
|
||||
|
|
@ -980,7 +980,7 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->motion = touch->touchEvents.motion.registerListener([this] (std::any e) {
|
||||
listener->motion = touch->touchEvents.motion.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<ITouch::SMotionEvent>(e);
|
||||
|
||||
g_pInputManager->onTouchMove(E);
|
||||
|
|
@ -988,11 +988,11 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->cancel = touch->touchEvents.cancel.registerListener([this] (std::any e) {
|
||||
listener->cancel = touch->touchEvents.cancel.registerListener([] (std::any e) {
|
||||
//
|
||||
});
|
||||
|
||||
listener->frame = touch->touchEvents.frame.registerListener([this] (std::any e) {
|
||||
listener->frame = touch->touchEvents.frame.registerListener([] (std::any e) {
|
||||
g_pSeatManager->sendTouchFrame();
|
||||
});
|
||||
// clang-format on
|
||||
|
|
@ -1016,7 +1016,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
detachTablet(nullptr);
|
||||
});
|
||||
|
||||
listener->axis = tablet->tabletEvents.axis.registerListener([this] (std::any e) {
|
||||
listener->axis = tablet->tabletEvents.axis.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<CTablet::SAxisEvent>(e);
|
||||
|
||||
g_pInputManager->onTabletAxis(E);
|
||||
|
|
@ -1027,7 +1027,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->proximity = tablet->tabletEvents.proximity.registerListener([this] (std::any e) {
|
||||
listener->proximity = tablet->tabletEvents.proximity.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<CTablet::SProximityEvent>(e);
|
||||
|
||||
g_pInputManager->onTabletProximity(E);
|
||||
|
|
@ -1035,7 +1035,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->tip = tablet->tabletEvents.tip.registerListener([this] (std::any e) {
|
||||
listener->tip = tablet->tabletEvents.tip.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<CTablet::STipEvent>(e);
|
||||
|
||||
g_pInputManager->onTabletTip(E);
|
||||
|
|
@ -1046,7 +1046,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->button = tablet->tabletEvents.button.registerListener([this] (std::any e) {
|
||||
listener->button = tablet->tabletEvents.button.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<CTablet::SButtonEvent>(e);
|
||||
|
||||
g_pInputManager->onTabletButton(E);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "../devices/ITouch.hpp"
|
||||
#include "../devices/Tablet.hpp"
|
||||
#include "../helpers/math/Math.hpp"
|
||||
#include "../helpers/math/Math.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../helpers/sync/SyncTimeline.hpp"
|
||||
#include <tuple>
|
||||
|
|
@ -160,8 +159,8 @@ class CPointerManager {
|
|||
Vector2D storedUnaccel = {0, 0};
|
||||
|
||||
struct SMonitorPointerState {
|
||||
SMonitorPointerState(PHLMONITOR m) : monitor(m) {}
|
||||
~SMonitorPointerState() {}
|
||||
SMonitorPointerState(const PHLMONITOR& m) : monitor(m) {}
|
||||
~SMonitorPointerState() = default;
|
||||
|
||||
PHLMONITORREF monitor;
|
||||
|
||||
|
|
|
|||
|
|
@ -647,7 +647,7 @@ bool CSeatGrab::accepts(SP<CWLSurfaceResource> surf) {
|
|||
}
|
||||
|
||||
void CSeatGrab::add(SP<CWLSurfaceResource> surf) {
|
||||
surfs.push_back(surf);
|
||||
surfs.emplace_back(surf);
|
||||
}
|
||||
|
||||
void CSeatGrab::remove(SP<CWLSurfaceResource> surf) {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ int handleTimer(void* data) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
CThreadManager::CThreadManager() {
|
||||
m_esConfigTimer = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, handleTimer, this);
|
||||
|
||||
CThreadManager::CThreadManager() : m_esConfigTimer(wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, handleTimer, this)) {
|
||||
wl_event_source_timer_update(m_esConfigTimer, 1000);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include <thread>
|
||||
#include "../Compositor.hpp"
|
||||
struct wl_event_source;
|
||||
|
||||
class CThreadManager {
|
||||
public:
|
||||
CThreadManager();
|
||||
~CThreadManager();
|
||||
|
||||
wl_event_source* m_esConfigTimer;
|
||||
wl_event_source* m_esConfigTimer = nullptr;
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ SP<SXCursors> CXCursorManager::createCursor(std::string const& shape, XcursorIma
|
|||
SXCursorImage image;
|
||||
image.size = {(int)xImage->width, (int)xImage->height};
|
||||
image.hotspot = {(int)xImage->xhot, (int)xImage->yhot};
|
||||
image.pixels.resize(xImage->width * xImage->height);
|
||||
std::memcpy(image.pixels.data(), xImage->pixels, xImage->width * xImage->height * sizeof(uint32_t));
|
||||
image.pixels.resize((size_t)xImage->width * xImage->height);
|
||||
std::memcpy(image.pixels.data(), xImage->pixels, (size_t)xImage->width * xImage->height * sizeof(uint32_t));
|
||||
image.delay = xImage->delay;
|
||||
|
||||
xcursor->images.emplace_back(image);
|
||||
|
|
@ -570,7 +570,7 @@ void CXCursorManager::syncGsettings() {
|
|||
auto* gSettingsSchema = g_settings_schema_source_lookup(gSettingsSchemaSource, category.c_str(), true);
|
||||
bool hasParam = false;
|
||||
|
||||
if (gSettingsSchema != NULL) {
|
||||
if (gSettingsSchema) {
|
||||
hasParam = gSettingsSchema && g_settings_schema_has_key(gSettingsSchema, paramName.c_str());
|
||||
g_settings_schema_unref(gSettingsSchema);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <limits>
|
||||
|
||||
#include <sys/timerfd.h>
|
||||
#include <time.h>
|
||||
#include <ctime>
|
||||
|
||||
#include <aquamarine/backend/Backend.hpp>
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ void CEventLoopManager::nudgeTimers() {
|
|||
// remove timers that have gone missing
|
||||
std::erase_if(m_sTimers.timers, [](const auto& t) { return t.strongRef() <= 1; });
|
||||
|
||||
long nextTimerUs = 10 * 1000 * 1000; // 10s
|
||||
long nextTimerUs = 10L * 1000 * 1000; // 10s
|
||||
|
||||
for (auto const& t : m_sTimers.timers) {
|
||||
if (auto const& µs = t->leftUs(); µs < nextTimerUs)
|
||||
|
|
|
|||
|
|
@ -70,5 +70,4 @@ void CInputManager::recheckIdleInhibitorStatus() {
|
|||
}
|
||||
|
||||
PROTO::idle->setInhibit(false);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -868,7 +868,7 @@ void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keyboard)
|
|||
void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
||||
static auto PDPMS = CConfigValue<Hyprlang::INT>("misc:key_press_enables_dpms");
|
||||
|
||||
m_vHIDs.push_back(keeb);
|
||||
m_vHIDs.emplace_back(keeb);
|
||||
|
||||
try {
|
||||
keeb->hlName = getNameForNewDevice(keeb->deviceName);
|
||||
|
|
@ -1016,7 +1016,7 @@ void CInputManager::newMouse(SP<Aquamarine::IPointer> mouse) {
|
|||
}
|
||||
|
||||
void CInputManager::setupMouse(SP<IPointer> mauz) {
|
||||
m_vHIDs.push_back(mauz);
|
||||
m_vHIDs.emplace_back(mauz);
|
||||
|
||||
try {
|
||||
mauz->hlName = getNameForNewDevice(mauz->deviceName);
|
||||
|
|
@ -1495,7 +1495,7 @@ void CInputManager::disableAllKeyboards(bool virt) {
|
|||
|
||||
void CInputManager::newTouchDevice(SP<Aquamarine::ITouch> pDevice) {
|
||||
const auto PNEWDEV = m_vTouches.emplace_back(CTouchDevice::create(pDevice));
|
||||
m_vHIDs.push_back(PNEWDEV);
|
||||
m_vHIDs.emplace_back(PNEWDEV);
|
||||
|
||||
try {
|
||||
PNEWDEV->hlName = getNameForNewDevice(PNEWDEV->deviceName);
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ AQUAMARINE_FORWARD(ITablet);
|
|||
AQUAMARINE_FORWARD(ITabletTool);
|
||||
AQUAMARINE_FORWARD(ITabletPad);
|
||||
|
||||
enum eClickBehaviorMode {
|
||||
enum eClickBehaviorMode : uint8_t {
|
||||
CLICKMODE_DEFAULT = 0,
|
||||
CLICKMODE_KILL
|
||||
};
|
||||
|
||||
enum eMouseBindMode {
|
||||
enum eMouseBindMode : int8_t {
|
||||
MBIND_INVALID = -1,
|
||||
MBIND_MOVE = 0,
|
||||
MBIND_RESIZE = 1,
|
||||
|
|
@ -39,8 +39,8 @@ enum eMouseBindMode {
|
|||
MBIND_RESIZE_FORCE_RATIO = 3
|
||||
};
|
||||
|
||||
enum eBorderIconDirection {
|
||||
BORDERICON_NONE,
|
||||
enum eBorderIconDirection : uint8_t {
|
||||
BORDERICON_NONE = 0,
|
||||
BORDERICON_UP,
|
||||
BORDERICON_DOWN,
|
||||
BORDERICON_LEFT,
|
||||
|
|
@ -276,7 +276,7 @@ class CInputManager {
|
|||
void setCursorImageOverride(const std::string& name);
|
||||
|
||||
// cursor surface
|
||||
struct cursorSI {
|
||||
struct {
|
||||
bool hidden = false; // null surface = hidden
|
||||
SP<CWLSurface> wlSurface;
|
||||
Vector2D vHotspot;
|
||||
|
|
@ -288,8 +288,8 @@ class CInputManager {
|
|||
|
||||
// discrete scrolling emulation using v120 data
|
||||
struct {
|
||||
bool lastEventSign = 0;
|
||||
bool lastEventAxis = 0;
|
||||
bool lastEventSign = false;
|
||||
bool lastEventAxis = false;
|
||||
uint32_t lastEventTime = 0;
|
||||
uint32_t accumulatedScroll = 0;
|
||||
} m_ScrollWheelState;
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void CInputManager::onTabletProximity(CTablet::SProximityEvent e) {
|
|||
|
||||
void CInputManager::newTablet(SP<Aquamarine::ITablet> pDevice) {
|
||||
const auto PNEWTABLET = m_vTablets.emplace_back(CTablet::create(pDevice));
|
||||
m_vHIDs.push_back(PNEWTABLET);
|
||||
m_vHIDs.emplace_back(PNEWTABLET);
|
||||
|
||||
try {
|
||||
PNEWTABLET->hlName = g_pInputManager->getNameForNewDevice(pDevice->getName());
|
||||
|
|
@ -226,7 +226,7 @@ SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletToo
|
|||
}
|
||||
|
||||
const auto PTOOL = m_vTabletTools.emplace_back(CTabletTool::create(pTool));
|
||||
m_vHIDs.push_back(PTOOL);
|
||||
m_vHIDs.emplace_back(PTOOL);
|
||||
|
||||
try {
|
||||
PTOOL->hlName = g_pInputManager->getNameForNewDevice(pTool->getName());
|
||||
|
|
@ -246,7 +246,7 @@ SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletToo
|
|||
|
||||
void CInputManager::newTabletPad(SP<Aquamarine::ITabletPad> pDevice) {
|
||||
const auto PNEWPAD = m_vTabletPads.emplace_back(CTabletPad::create(pDevice));
|
||||
m_vHIDs.push_back(PNEWPAD);
|
||||
m_vHIDs.emplace_back(PNEWPAD);
|
||||
|
||||
try {
|
||||
PNEWPAD->hlName = g_pInputManager->getNameForNewDevice(pDevice->getName());
|
||||
|
|
|
|||
|
|
@ -63,11 +63,10 @@ void CTextInput::onEnabled(SP<CWLSurfaceResource> surfV1) {
|
|||
|
||||
// v1 only, map surface to PTI
|
||||
if (!isV3()) {
|
||||
SP<CWLSurfaceResource> pSurface = surfV1;
|
||||
if (g_pCompositor->m_pLastFocus != pSurface || !pV1Input->active)
|
||||
if (g_pCompositor->m_pLastFocus != surfV1 || !pV1Input->active)
|
||||
return;
|
||||
|
||||
enter(pSurface);
|
||||
enter(surfV1);
|
||||
}
|
||||
|
||||
g_pInputManager->m_sIMERelay.activateIME(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue