refactor: Use new hyprutils casts (#11377)
This commit is contained in:
parent
aa6a78f0a4
commit
beee22a95e
116 changed files with 715 additions and 696 deletions
|
|
@ -228,17 +228,17 @@ void CHyprAnimationManager::tick() {
|
|||
|
||||
switch (PAV->m_Type) {
|
||||
case AVARTYPE_FLOAT: {
|
||||
auto pTypedAV = dynamic_cast<CAnimatedVariable<float>*>(PAV.get());
|
||||
auto pTypedAV = dc<CAnimatedVariable<float>*>(PAV.get());
|
||||
RASSERT(pTypedAV, "Failed to upcast animated float");
|
||||
handleUpdate(*pTypedAV, warp);
|
||||
} break;
|
||||
case AVARTYPE_VECTOR: {
|
||||
auto pTypedAV = dynamic_cast<CAnimatedVariable<Vector2D>*>(PAV.get());
|
||||
auto pTypedAV = dc<CAnimatedVariable<Vector2D>*>(PAV.get());
|
||||
RASSERT(pTypedAV, "Failed to upcast animated Vector2D");
|
||||
handleUpdate(*pTypedAV, warp);
|
||||
} break;
|
||||
case AVARTYPE_COLOR: {
|
||||
auto pTypedAV = dynamic_cast<CAnimatedVariable<CHyprColor>*>(PAV.get());
|
||||
auto pTypedAV = dc<CAnimatedVariable<CHyprColor>*>(PAV.get());
|
||||
RASSERT(pTypedAV, "Failed to upcast animated CHyprColor");
|
||||
handleUpdate(*pTypedAV, warp);
|
||||
} break;
|
||||
|
|
@ -268,7 +268,7 @@ void CHyprAnimationManager::scheduleTick() {
|
|||
|
||||
const auto TOPRES = std::clamp(refreshDelayMs - SINCEPRES, 1.1f, 1000.f); // we can't send 0, that will disarm it
|
||||
|
||||
m_animationTimer->updateTimeout(std::chrono::milliseconds((int)std::floor(TOPRES)));
|
||||
m_animationTimer->updateTimeout(std::chrono::milliseconds(sc<int>(std::floor(TOPRES))));
|
||||
}
|
||||
|
||||
void CHyprAnimationManager::onTicked() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class CHyprAnimationManager : public Hyprutils::Animation::CAnimationManager {
|
|||
constexpr const eAnimatedVarType EAVTYPE = typeToeAnimatedVarType<VarType>;
|
||||
const auto PAV = makeShared<CAnimatedVariable<VarType>>();
|
||||
|
||||
PAV->create(EAVTYPE, static_cast<Hyprutils::Animation::CAnimationManager*>(this), PAV, v);
|
||||
PAV->create(EAVTYPE, sc<Hyprutils::Animation::CAnimationManager*>(this), PAV, v);
|
||||
PAV->setConfig(pConfig);
|
||||
PAV->m_Context.eDamagePolicy = policy;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "../helpers/Monitor.hpp"
|
||||
|
||||
static int cursorAnimTimer(SP<CEventLoopTimer> self, void* data) {
|
||||
const auto cursorMgr = reinterpret_cast<CCursorManager*>(data);
|
||||
const auto cursorMgr = sc<CCursorManager*>(data);
|
||||
cursorMgr->tickAnimatedCursor();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -22,13 +22,13 @@ static void hcLogger(enum eHyprcursorLogLevel level, char* message) {
|
|||
CCursorBuffer::CCursorBuffer(cairo_surface_t* surf, const Vector2D& size_, const Vector2D& hot_) : m_hotspot(hot_), m_stride(cairo_image_surface_get_stride(surf)) {
|
||||
size = size_;
|
||||
|
||||
m_data = std::vector<uint8_t>((uint8_t*)cairo_image_surface_get_data(surf), ((uint8_t*)cairo_image_surface_get_data(surf)) + (cairo_image_surface_get_height(surf) * m_stride));
|
||||
m_data = std::vector<uint8_t>(cairo_image_surface_get_data(surf), cairo_image_surface_get_data(surf) + (cairo_image_surface_get_height(surf) * m_stride));
|
||||
}
|
||||
|
||||
CCursorBuffer::CCursorBuffer(const uint8_t* pixelData, const Vector2D& size_, const Vector2D& hot_) : m_hotspot(hot_), m_stride(4 * size_.x) {
|
||||
size = size_;
|
||||
|
||||
m_data = std::vector<uint8_t>(pixelData, pixelData + ((int)size_.y * m_stride));
|
||||
m_data = std::vector<uint8_t>(pixelData, pixelData + (sc<int>(size_.y) * m_stride));
|
||||
}
|
||||
|
||||
Aquamarine::eBufferCapability CCursorBuffer::caps() {
|
||||
|
|
@ -167,7 +167,7 @@ void CCursorManager::setCursorFromName(const std::string& name) {
|
|||
|
||||
auto xcursor = m_xcursor->getShape(name, m_size, m_cursorScale);
|
||||
auto& icon = xcursor->images.front();
|
||||
auto buf = makeShared<CCursorBuffer>((uint8_t*)icon.pixels.data(), icon.size, icon.hotspot);
|
||||
auto buf = makeShared<CCursorBuffer>(rc<uint8_t*>(icon.pixels.data()), icon.size, icon.hotspot);
|
||||
setCursorBuffer(buf, icon.hotspot / scale, scale);
|
||||
|
||||
m_currentXcursor = xcursor;
|
||||
|
|
@ -233,18 +233,18 @@ void CCursorManager::tickAnimatedCursor() {
|
|||
if (!m_hyprcursor->valid() && m_currentXcursor->images.size() > 1) {
|
||||
m_currentAnimationFrame++;
|
||||
|
||||
if ((size_t)m_currentAnimationFrame >= m_currentXcursor->images.size())
|
||||
if (sc<size_t>(m_currentAnimationFrame) >= m_currentXcursor->images.size())
|
||||
m_currentAnimationFrame = 0;
|
||||
|
||||
float scale = std::ceil(m_cursorScale);
|
||||
auto& icon = m_currentXcursor->images.at(m_currentAnimationFrame);
|
||||
auto buf = makeShared<CCursorBuffer>((uint8_t*)icon.pixels.data(), icon.size, icon.hotspot);
|
||||
auto buf = makeShared<CCursorBuffer>(rc<uint8_t*>(icon.pixels.data()), icon.size, icon.hotspot);
|
||||
setCursorBuffer(buf, icon.hotspot / scale, scale);
|
||||
setAnimationTimer(m_currentAnimationFrame, m_currentXcursor->images[m_currentAnimationFrame].delay);
|
||||
} else if (m_currentCursorShapeData.images.size() > 1) {
|
||||
m_currentAnimationFrame++;
|
||||
|
||||
if ((size_t)m_currentAnimationFrame >= m_currentCursorShapeData.images.size())
|
||||
if (sc<size_t>(m_currentAnimationFrame) >= m_currentCursorShapeData.images.size())
|
||||
m_currentAnimationFrame = 0;
|
||||
|
||||
auto hotspot =
|
||||
|
|
@ -281,7 +281,7 @@ void CCursorManager::setXWaylandCursor() {
|
|||
auto xcursor = m_xcursor->getShape("left_ptr", m_size, 1);
|
||||
auto& icon = xcursor->images.front();
|
||||
|
||||
g_pXWayland->setCursor((uint8_t*)icon.pixels.data(), icon.size.x * 4, icon.size, icon.hotspot);
|
||||
g_pXWayland->setCursor(rc<uint8_t*>(icon.pixels.data()), icon.size.x * 4, icon.size, icon.hotspot);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ CDonationNagManager::CDonationNagManager() {
|
|||
// don't nag if the last nag was less than a month ago. This is
|
||||
// mostly for first-time nags, as other nags happen in specific time frames shorter than a month
|
||||
if (EPOCH - state.epoch < MONTH_IN_SECONDS) {
|
||||
Debug::log(LOG, "DonationNag: last nag was {} days ago, too early for a nag.", (int)std::round((EPOCH - state.epoch) / (double)DAY_IN_SECONDS));
|
||||
Debug::log(LOG, "DonationNag: last nag was {} days ago, too early for a nag.", sc<int>(std::round((EPOCH - state.epoch) / sc<double>(DAY_IN_SECONDS))));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ CEventManager::CEventManager() : m_socketFD(socket(AF_UNIX, SOCK_STREAM | SOCK_C
|
|||
|
||||
strncpy(SERVERADDRESS.sun_path, PATH.c_str(), sizeof(SERVERADDRESS.sun_path) - 1);
|
||||
|
||||
if (bind(m_socketFD.get(), (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
|
||||
if (bind(m_socketFD.get(), rc<sockaddr*>(&SERVERADDRESS), SUN_LEN(&SERVERADDRESS)) < 0) {
|
||||
Debug::log(ERR, "Couldn't bind the Hyprland Socket 2. (3) IPC will not work.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ int CEventManager::onServerEvent(int fd, uint32_t mask) {
|
|||
|
||||
sockaddr_in clientAddress;
|
||||
socklen_t clientSize = sizeof(clientAddress);
|
||||
CFileDescriptor ACCEPTEDCONNECTION{accept4(m_socketFD.get(), (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC | SOCK_NONBLOCK)};
|
||||
CFileDescriptor ACCEPTEDCONNECTION{accept4(m_socketFD.get(), rc<sockaddr*>(&clientAddress), &clientSize, SOCK_CLOEXEC | SOCK_NONBLOCK)};
|
||||
if (!ACCEPTEDCONNECTION.isValid()) {
|
||||
if (errno != EAGAIN) {
|
||||
Debug::log(ERR, "Socket2 failed receiving connection, errno: {}", errno);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
|
|||
} catch (std::exception& e) {
|
||||
// TODO: this works only once...?
|
||||
faultyHandles.push_back(cb.handle);
|
||||
Debug::log(ERR, "[hookSystem] Hook from plugin {:x} caused a SIGSEGV, queueing for unloading.", (uintptr_t)cb.handle);
|
||||
Debug::log(ERR, "[hookSystem] Hook from plugin {:x} caused a SIGSEGV, queueing for unloading.", rc<uintptr_t>(cb.handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -779,7 +779,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
|||
// call the dispatcher
|
||||
Debug::log(LOG, "Keybind triggered, calling dispatcher ({}, {}, {}, {})", modmask, key.keyName, key.keysym, DISPATCHER->first);
|
||||
|
||||
m_passPressed = (int)pressed;
|
||||
m_passPressed = sc<int>(pressed);
|
||||
|
||||
// if the dispatchers says to pass event then we will
|
||||
if (k->handler == "mouse")
|
||||
|
|
@ -942,7 +942,7 @@ uint64_t CKeybindManager::spawnWithRules(std::string args, PHLWORKSPACE pInitial
|
|||
const auto RULESLIST = CVarList(RULES, 0, ';');
|
||||
|
||||
for (auto const& r : RULESLIST) {
|
||||
g_pConfigManager->addExecRule({r, (unsigned long)PROC});
|
||||
g_pConfigManager->addExecRule({r, sc<unsigned long>(PROC)});
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Applied {} rule arguments for exec.", RULESLIST.size());
|
||||
|
|
@ -1374,8 +1374,8 @@ 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_fullscreenState.internal),
|
||||
.client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_fullscreenState.client)};
|
||||
const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? sc<eFullscreenMode>(internalMode) : PWINDOW->m_fullscreenState.internal),
|
||||
.client = (clientMode != -1 ? sc<eFullscreenMode>(clientMode) : PWINDOW->m_fullscreenState.client)};
|
||||
|
||||
if (internalMode != -1 && clientMode != -1 && PWINDOW->m_fullscreenState.internal == STATE.internal && PWINDOW->m_fullscreenState.client == STATE.client)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
|
||||
|
|
@ -1685,9 +1685,9 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) {
|
|||
const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
|
||||
static auto PGAPSCUSTOMDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:float_gaps");
|
||||
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
|
||||
auto* PGAPSOUT = (CCssGapData*)PGAPSCUSTOMDATA.ptr()->getData();
|
||||
auto* PGAPSOUT = sc<CCssGapData*>(PGAPSCUSTOMDATA.ptr()->getData());
|
||||
if (PGAPSOUT->m_left < 0 || PGAPSOUT->m_right < 0 || PGAPSOUT->m_top < 0 || PGAPSOUT->m_bottom < 0)
|
||||
PGAPSOUT = (CCssGapData*)PGAPSOUTDATA.ptr()->getData();
|
||||
PGAPSOUT = sc<CCssGapData*>(PGAPSOUTDATA.ptr()->getData());
|
||||
|
||||
switch (arg) {
|
||||
case 'l': vPosx = PMONITOR->m_reservedTopLeft.x + BORDERSIZE + PMONITOR->m_position.x + PGAPSOUT->m_left; break;
|
||||
|
|
@ -2545,7 +2545,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
return {.success = false, .error = "sendshortcut: no kb"};
|
||||
}
|
||||
|
||||
const auto KEYPAIRSTRING = std::format("{}{}", (uintptr_t)KB.get(), KEY);
|
||||
const auto KEYPAIRSTRING = std::format("{}{}", rc<uintptr_t>(KB.get()), KEY);
|
||||
|
||||
if (!g_pKeybindManager->m_keyToCodeCache.contains(KEYPAIRSTRING)) {
|
||||
xkb_keymap* km = KB->m_xkbKeymap;
|
||||
|
|
@ -2790,7 +2790,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
|
|||
|
||||
PWORKSPACE->m_lastFocusedWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS);
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", (uintptr_t)PWINDOW.get(), (int)PWINDOW->m_pinned)});
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", rc<uintptr_t>(PWINDOW.get()), sc<int>(PWINDOW->m_pinned))});
|
||||
EMIT_HOOK_EVENT("pin", PWINDOW);
|
||||
|
||||
return {};
|
||||
|
|
@ -2941,7 +2941,7 @@ void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowIn
|
|||
g_pCompositor->focusWindow(pWindow);
|
||||
pWindow->warpCursor();
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"moveintogroup", std::format("{:x}", (uintptr_t)pWindow.get())});
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"moveintogroup", std::format("{:x}", rc<uintptr_t>(pWindow.get()))});
|
||||
}
|
||||
|
||||
void CKeybindManager::moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string& dir) {
|
||||
|
|
@ -2982,7 +2982,7 @@ void CKeybindManager::moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string&
|
|||
PWINDOWPREV->warpCursor();
|
||||
}
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"moveoutofgroup", std::format("{:x}", (uintptr_t)pWindow.get())});
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"moveoutofgroup", std::format("{:x}", rc<uintptr_t>(pWindow.get()))});
|
||||
}
|
||||
|
||||
SDispatchResult CKeybindManager::moveIntoGroup(std::string args) {
|
||||
|
|
@ -3097,7 +3097,7 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) {
|
|||
}
|
||||
|
||||
SDispatchResult CKeybindManager::setIgnoreGroupLock(std::string args) {
|
||||
static auto PIGNOREGROUPLOCK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock");
|
||||
static auto PIGNOREGROUPLOCK = rc<Hyprlang::INT* const*>(g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock"));
|
||||
|
||||
if (args == "toggle")
|
||||
**PIGNOREGROUPLOCK = !**PIGNOREGROUPLOCK;
|
||||
|
|
@ -3207,17 +3207,17 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
|
|||
CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_windowData.alphaFullscreen.valueOrDefault().overridden}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "alphaoverride") {
|
||||
PWINDOW->m_windowData.alpha =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alpha.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alpha.valueOrDefault().alpha, sc<bool>(configStringToInt(VAL).value_or(0))}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "alphainactiveoverride") {
|
||||
PWINDOW->m_windowData.alphaInactive =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alphaInactive.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alphaInactive.valueOrDefault().alpha, sc<bool>(configStringToInt(VAL).value_or(0))}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "alphafullscreenoverride") {
|
||||
PWINDOW->m_windowData.alphaFullscreen =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alphaFullscreen.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alphaFullscreen.valueOrDefault().alpha, sc<bool>(configStringToInt(VAL).value_or(0))}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "activebordercolor" || PROP == "inactivebordercolor") {
|
||||
CGradientValueData colorData = {};
|
||||
if (vars.size() > 4) {
|
||||
for (int i = 3; i < static_cast<int>(vars.size()); ++i) {
|
||||
for (int i = 3; i < sc<int>(vars.size()); ++i) {
|
||||
const auto TOKEN = vars[i];
|
||||
if (TOKEN.ends_with("deg"))
|
||||
colorData.m_angle = std::stoi(TOKEN.substr(0, TOKEN.size() - 3)) * (PI / 180.0);
|
||||
|
|
@ -3246,7 +3246,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
|
|||
else if (VAL == "unset")
|
||||
pWindowDataElement->unset(PRIORITY_SET_PROP);
|
||||
else
|
||||
*pWindowDataElement = CWindowOverridableVar((bool)configStringToInt(VAL).value_or(0), PRIORITY_SET_PROP);
|
||||
*pWindowDataElement = CWindowOverridableVar(sc<bool>(configStringToInt(VAL).value_or(0)), PRIORITY_SET_PROP);
|
||||
} else if (auto search = NWindowProperties::intWindowProperties.find(PROP); search != NWindowProperties::intWindowProperties.end()) {
|
||||
if (VAL == "unset")
|
||||
search->second(PWINDOW)->unset(PRIORITY_SET_PROP);
|
||||
|
|
@ -3254,7 +3254,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
|
|||
const Hyprlang::INT V = std::stoi(VAL.substr(VAL.find(' ')));
|
||||
search->second(PWINDOW)->increment(V, PRIORITY_SET_PROP);
|
||||
} else if (const auto V = configStringToInt(VAL); V)
|
||||
*(search->second(PWINDOW)) = CWindowOverridableVar((Hyprlang::INT)*V, PRIORITY_SET_PROP);
|
||||
*(search->second(PWINDOW)) = CWindowOverridableVar(*V, PRIORITY_SET_PROP);
|
||||
} else if (auto search = NWindowProperties::floatWindowProperties.find(PROP); search != NWindowProperties::floatWindowProperties.end()) {
|
||||
if (VAL == "unset")
|
||||
search->second(PWINDOW)->unset(PRIORITY_SET_PROP);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ IHyprLayout* CLayoutManager::getCurrentLayout() {
|
|||
void CLayoutManager::switchToLayout(std::string layout) {
|
||||
for (size_t i = 0; i < m_layouts.size(); ++i) {
|
||||
if (m_layouts[i].first == layout) {
|
||||
if (i == (size_t)m_currentLayoutID)
|
||||
if (i == sc<size_t>(m_currentLayoutID))
|
||||
return;
|
||||
|
||||
getCurrentLayout()->onDisable();
|
||||
|
|
@ -31,7 +31,7 @@ bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) {
|
|||
|
||||
m_layouts.emplace_back(std::make_pair<>(name, layout));
|
||||
|
||||
Debug::log(LOG, "Added new layout {} at {:x}", name, (uintptr_t)layout);
|
||||
Debug::log(LOG, "Added new layout {} at {:x}", name, rc<uintptr_t>(layout));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ bool CLayoutManager::removeLayout(IHyprLayout* layout) {
|
|||
if (m_currentLayoutID == IT - m_layouts.begin())
|
||||
switchToLayout("dwindle");
|
||||
|
||||
Debug::log(LOG, "Removed a layout {} at {:x}", IT->first, (uintptr_t)layout);
|
||||
Debug::log(LOG, "Removed a layout {} at {:x}", IT->first, rc<uintptr_t>(layout));
|
||||
|
||||
std::erase(m_layouts, *IT);
|
||||
|
||||
|
|
|
|||
|
|
@ -502,9 +502,8 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
|
|||
const auto DMABUF = buf->dmabuf();
|
||||
auto [data, fmt, size] = buf->beginDataPtr(0);
|
||||
|
||||
auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, DMABUF.size.x, DMABUF.size.y);
|
||||
auto CAIRODATASURFACE =
|
||||
cairo_image_surface_create_for_data((unsigned char*)texData.data(), CAIRO_FORMAT_ARGB32, texture->m_size.x, texture->m_size.y, texture->m_size.x * 4);
|
||||
auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, DMABUF.size.x, DMABUF.size.y);
|
||||
auto CAIRODATASURFACE = cairo_image_surface_create_for_data(texData.data(), CAIRO_FORMAT_ARGB32, texture->m_size.x, texture->m_size.y, texture->m_size.x * 4);
|
||||
|
||||
auto CAIRO = cairo_create(CAIROSURFACE);
|
||||
|
||||
|
|
@ -525,7 +524,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
|
|||
cairo_matrix_scale(&matrixPre, SCALE.x, SCALE.y);
|
||||
|
||||
if (TR) {
|
||||
cairo_matrix_rotate(&matrixPre, M_PI_2 * (double)TR);
|
||||
cairo_matrix_rotate(&matrixPre, M_PI_2 * sc<double>(TR));
|
||||
|
||||
// FIXME: this is wrong, and doesn't work for 5, 6 and 7. (flipped + rot)
|
||||
// cba to do it rn, does anyone fucking use that??
|
||||
|
|
@ -550,7 +549,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
|
|||
|
||||
cairo_pattern_destroy(PATTERNPRE);
|
||||
|
||||
memcpy(data, cairo_image_surface_get_data(CAIROSURFACE), (size_t)cairo_image_surface_get_height(CAIROSURFACE) * cairo_image_surface_get_stride(CAIROSURFACE));
|
||||
memcpy(data, cairo_image_surface_get_data(CAIROSURFACE), sc<size_t>(cairo_image_surface_get_height(CAIROSURFACE)) * cairo_image_surface_get_stride(CAIROSURFACE));
|
||||
|
||||
cairo_destroy(CAIRO);
|
||||
cairo_surface_destroy(CAIROSURFACE);
|
||||
|
|
@ -664,7 +663,7 @@ CBox CPointerManager::getCursorBoxGlobal() {
|
|||
Vector2D CPointerManager::closestValid(const Vector2D& pos) {
|
||||
static auto PADDING = CConfigValue<Hyprlang::INT>("cursor:hotspot_padding");
|
||||
|
||||
auto CURSOR_PADDING = std::clamp((int)*PADDING, 0, 100);
|
||||
auto CURSOR_PADDING = std::clamp(sc<int>(*PADDING), 0, 100);
|
||||
CBox hotBox = {{pos.x - CURSOR_PADDING, pos.y - CURSOR_PADDING}, {2 * CURSOR_PADDING, 2 * CURSOR_PADDING}};
|
||||
|
||||
//
|
||||
|
|
@ -809,7 +808,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
|
|||
|
||||
switch (dev->getType()) {
|
||||
case HID_TYPE_TABLET: {
|
||||
CTablet* TAB = reinterpret_cast<CTablet*>(dev.get());
|
||||
CTablet* TAB = rc<CTablet*>(dev.get());
|
||||
if (!TAB->m_boundOutput.empty()) {
|
||||
mappedArea = outputMappedArea(TAB->m_boundOutput);
|
||||
mappedArea.translate(TAB->m_boundBox.pos());
|
||||
|
|
@ -826,13 +825,13 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
|
|||
break;
|
||||
}
|
||||
case HID_TYPE_TOUCH: {
|
||||
ITouch* TOUCH = reinterpret_cast<ITouch*>(dev.get());
|
||||
ITouch* TOUCH = rc<ITouch*>(dev.get());
|
||||
if (!TOUCH->m_boundOutput.empty())
|
||||
mappedArea = outputMappedArea(TOUCH->m_boundOutput);
|
||||
break;
|
||||
}
|
||||
case HID_TYPE_POINTER: {
|
||||
IPointer* POINTER = reinterpret_cast<IPointer*>(dev.get());
|
||||
IPointer* POINTER = rc<IPointer*>(dev.get());
|
||||
if (!POINTER->m_boundOutput.empty())
|
||||
mappedArea = outputMappedArea(POINTER->m_boundOutput);
|
||||
break;
|
||||
|
|
@ -1118,7 +1117,7 @@ void CPointerManager::setStoredMovement(uint64_t time, const Vector2D& delta, co
|
|||
}
|
||||
|
||||
void CPointerManager::sendStoredMovement() {
|
||||
PROTO::relativePointer->sendRelativeMotion((uint64_t)m_storedTime * 1000, m_storedDelta, m_storedUnaccel);
|
||||
PROTO::relativePointer->sendRelativeMotion(m_storedTime * 1000, m_storedDelta, m_storedUnaccel);
|
||||
m_storedTime = 0;
|
||||
m_storedDelta = Vector2D{};
|
||||
m_storedUnaccel = Vector2D{};
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@ std::string CTokenManager::getRandomUUID() {
|
|||
do {
|
||||
uuid_t uuid_;
|
||||
uuid_generate_random(uuid_);
|
||||
uuid = std::format("{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}", (uint16_t)uuid_[0], (uint16_t)uuid_[1],
|
||||
(uint16_t)uuid_[2], (uint16_t)uuid_[3], (uint16_t)uuid_[4], (uint16_t)uuid_[5], (uint16_t)uuid_[6], (uint16_t)uuid_[7], (uint16_t)uuid_[8],
|
||||
(uint16_t)uuid_[9], (uint16_t)uuid_[10], (uint16_t)uuid_[11], (uint16_t)uuid_[12], (uint16_t)uuid_[13], (uint16_t)uuid_[14], (uint16_t)uuid_[15]);
|
||||
uuid = std::format("{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}", sc<uint16_t>(uuid_[0]), sc<uint16_t>(uuid_[1]),
|
||||
sc<uint16_t>(uuid_[2]), sc<uint16_t>(uuid_[3]), sc<uint16_t>(uuid_[4]), sc<uint16_t>(uuid_[5]), sc<uint16_t>(uuid_[6]), sc<uint16_t>(uuid_[7]),
|
||||
sc<uint16_t>(uuid_[8]), sc<uint16_t>(uuid_[9]), sc<uint16_t>(uuid_[10]), sc<uint16_t>(uuid_[11]), sc<uint16_t>(uuid_[12]), sc<uint16_t>(uuid_[13]),
|
||||
sc<uint16_t>(uuid_[14]), sc<uint16_t>(uuid_[15]));
|
||||
} while (m_tokens.contains(uuid));
|
||||
|
||||
return uuid;
|
||||
|
|
|
|||
|
|
@ -185,15 +185,15 @@ SP<SXCursors> CXCursorManager::getShape(std::string const& shape, int size, floa
|
|||
|
||||
SP<SXCursors> CXCursorManager::createCursor(std::string const& shape, void* ximages) {
|
||||
auto xcursor = makeShared<SXCursors>();
|
||||
XcursorImages* xImages = (XcursorImages*)ximages;
|
||||
XcursorImages* xImages = sc<XcursorImages*>(ximages);
|
||||
|
||||
for (int i = 0; i < xImages->nimage; i++) {
|
||||
auto xImage = xImages->images[i];
|
||||
SXCursorImage image;
|
||||
image.size = {(int)xImage->width, (int)xImage->height};
|
||||
image.hotspot = {(int)xImage->xhot, (int)xImage->yhot};
|
||||
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.size = {sc<int>(xImage->width), sc<int>(xImage->height)};
|
||||
image.hotspot = {sc<int>(xImage->xhot), sc<int>(xImage->yhot)};
|
||||
image.pixels.resize(sc<size_t>(xImage->width) * xImage->height);
|
||||
std::memcpy(image.pixels.data(), xImage->pixels, sc<size_t>(xImage->width) * xImage->height * sizeof(uint32_t));
|
||||
image.delay = xImage->delay;
|
||||
|
||||
xcursor->images.emplace_back(image);
|
||||
|
|
@ -530,7 +530,7 @@ std::vector<SP<SXCursors>> CXCursorManager::loadAllFromDir(std::string const& pa
|
|||
|
||||
auto const& full = entry.path().string();
|
||||
using PcloseType = int (*)(FILE*);
|
||||
const std::unique_ptr<FILE, PcloseType> f(fopen(full.c_str(), "r"), static_cast<PcloseType>(fclose));
|
||||
const std::unique_ptr<FILE, PcloseType> f(fopen(full.c_str(), "r"), fclose);
|
||||
|
||||
if (!f)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static int timerWrite(int fd, uint32_t mask, void* data) {
|
|||
}
|
||||
|
||||
static int aquamarineFDWrite(int fd, uint32_t mask, void* data) {
|
||||
auto POLLFD = (Aquamarine::SPollFD*)data;
|
||||
auto POLLFD = sc<Aquamarine::SPollFD*>(data);
|
||||
POLLFD->onSignal();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ static int handleWaiterFD(int fd, uint32_t mask, void* data) {
|
|||
}
|
||||
|
||||
if (mask & WL_EVENT_READABLE)
|
||||
g_pEventLoopManager->onFdReadable((CEventLoopManager::SReadableWaiter*)data);
|
||||
g_pEventLoopManager->onFdReadable(sc<CEventLoopManager::SReadableWaiter*>(data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ static void timespecAddNs(timespec* pTimespec, int64_t delta) {
|
|||
|
||||
pTimespec->tv_sec += delta_s_high;
|
||||
|
||||
pTimespec->tv_nsec += (long)delta_ns_low;
|
||||
pTimespec->tv_nsec += delta_ns_low;
|
||||
if (pTimespec->tv_nsec >= TIMESPEC_NSEC_PER_SEC) {
|
||||
pTimespec->tv_nsec -= TIMESPEC_NSEC_PER_SEC;
|
||||
++pTimespec->tv_sec;
|
||||
|
|
@ -181,7 +181,7 @@ void CEventLoopManager::doLater(const std::function<void()>& fn) {
|
|||
m_idle.eventSource = wl_event_loop_add_idle(
|
||||
m_wayland.loop,
|
||||
[](void* data) {
|
||||
auto IDLE = (CEventLoopManager::SIdleData*)data;
|
||||
auto IDLE = sc<CEventLoopManager::SIdleData*>(data);
|
||||
auto cpy = IDLE->fns;
|
||||
IDLE->fns.clear();
|
||||
IDLE->eventSource = nullptr;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
|||
const auto PINHIBIT = m_idleInhibitors.emplace_back(makeUnique<SIdleInhibitor>()).get();
|
||||
PINHIBIT->inhibitor = std::any_cast<SP<CIdleInhibitor>>(inhibitor);
|
||||
|
||||
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", (uintptr_t)PINHIBIT->inhibitor->m_surface.get());
|
||||
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", rc<uintptr_t>(PINHIBIT->inhibitor->m_surface.get()));
|
||||
|
||||
PINHIBIT->inhibitor->m_listeners.destroy = PINHIBIT->inhibitor->m_resource->m_events.destroy.listen([this, PINHIBIT] {
|
||||
std::erase_if(m_idleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; });
|
||||
|
|
@ -89,7 +89,7 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
|
|||
return;
|
||||
|
||||
if (WLSurface->visible())
|
||||
*(bool*)data = true;
|
||||
*sc<bool*>(data) = true;
|
||||
},
|
||||
&isInhibiting);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ CInputManager::CInputManager() {
|
|||
if (wl_resource_get_client(event.pMgr->resource()) != g_pSeatManager->m_state.pointerFocusResource->client())
|
||||
return;
|
||||
|
||||
Debug::log(LOG, "cursorImage request: shape {} -> {}", (uint32_t)event.shape, event.shapeName);
|
||||
Debug::log(LOG, "cursorImage request: shape {} -> {}", sc<uint32_t>(event.shape), event.shapeName);
|
||||
|
||||
m_cursorSurfaceInfo.wlSurface->unassign();
|
||||
m_cursorSurfaceInfo.vHotspot = {};
|
||||
|
|
@ -113,11 +113,11 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
|
|||
const auto DELTA = *PNOACCEL == 1 ? unaccel : delta;
|
||||
|
||||
if (g_pSeatManager->m_isPointerFrameSkipped)
|
||||
g_pPointerManager->storeMovement((uint64_t)e.timeMs, DELTA, unaccel);
|
||||
g_pPointerManager->storeMovement(e.timeMs, DELTA, unaccel);
|
||||
else
|
||||
g_pPointerManager->setStoredMovement((uint64_t)e.timeMs, DELTA, unaccel);
|
||||
g_pPointerManager->setStoredMovement(e.timeMs, DELTA, unaccel);
|
||||
|
||||
PROTO::relativePointer->sendRelativeMotion((uint64_t)e.timeMs * 1000, DELTA, unaccel);
|
||||
PROTO::relativePointer->sendRelativeMotion(sc<uint64_t>(e.timeMs) * 1000, DELTA, unaccel);
|
||||
|
||||
if (e.mouse)
|
||||
recheckMouseWarpOnMouseInput();
|
||||
|
|
@ -236,13 +236,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
g_pCompositor->warpCursorTo(CLOSEST, true);
|
||||
g_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL);
|
||||
PROTO::relativePointer->sendRelativeMotion((uint64_t)time * 1000, {}, {});
|
||||
PROTO::relativePointer->sendRelativeMotion(sc<uint64_t>(time) * 1000, {}, {});
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
} else
|
||||
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", (uintptr_t)SURF.get(), (uintptr_t)CONSTRAINT.get());
|
||||
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", rc<uintptr_t>(SURF.get()), rc<uintptr_t>(CONSTRAINT.get()));
|
||||
}
|
||||
|
||||
if (PMONITOR != g_pCompositor->m_lastMonitor && (*PMOUSEFOCUSMON || refocus) && m_forcedFocus.expired())
|
||||
|
|
@ -644,7 +644,7 @@ void CInputManager::processMouseRequest(const CSeatManager::SSetCursorEvent& eve
|
|||
if (!cursorImageUnlocked())
|
||||
return;
|
||||
|
||||
Debug::log(LOG, "cursorImage request: surface {:x}", (uintptr_t)event.surf.get());
|
||||
Debug::log(LOG, "cursorImage request: surface {:x}", rc<uintptr_t>(event.surf.get()));
|
||||
|
||||
if (event.surf != m_cursorSurfaceInfo.wlSurface->resource()) {
|
||||
m_cursorSurfaceInfo.wlSurface->unassign();
|
||||
|
|
@ -937,7 +937,7 @@ void CInputManager::newKeyboard(SP<IKeyboard> keeb) {
|
|||
|
||||
setupKeyboard(PNEWKEYBOARD);
|
||||
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: {:x}", (uintptr_t)PNEWKEYBOARD.get());
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: {:x}", rc<uintptr_t>(PNEWKEYBOARD.get()));
|
||||
}
|
||||
|
||||
void CInputManager::newKeyboard(SP<Aquamarine::IKeyboard> keyboard) {
|
||||
|
|
@ -945,7 +945,7 @@ void CInputManager::newKeyboard(SP<Aquamarine::IKeyboard> keyboard) {
|
|||
|
||||
setupKeyboard(PNEWKEYBOARD);
|
||||
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: {:x} and AQ: {:x}", (uintptr_t)PNEWKEYBOARD.get(), (uintptr_t)keyboard.get());
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: {:x} and AQ: {:x}", rc<uintptr_t>(PNEWKEYBOARD.get()), rc<uintptr_t>(keyboard.get()));
|
||||
}
|
||||
|
||||
void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keyboard) {
|
||||
|
|
@ -953,7 +953,7 @@ void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keyboard)
|
|||
|
||||
setupKeyboard(PNEWKEYBOARD);
|
||||
|
||||
Debug::log(LOG, "New virtual keyboard created at {:x}", (uintptr_t)PNEWKEYBOARD.get());
|
||||
Debug::log(LOG, "New virtual keyboard created at {:x}", rc<uintptr_t>(PNEWKEYBOARD.get()));
|
||||
}
|
||||
|
||||
void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
||||
|
|
@ -974,7 +974,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||
return;
|
||||
|
||||
destroyKeyboard(PKEEB);
|
||||
Debug::log(LOG, "Destroyed keyboard {:x}", (uintptr_t)keeb);
|
||||
Debug::log(LOG, "Destroyed keyboard {:x}", rc<uintptr_t>(keeb));
|
||||
});
|
||||
|
||||
keeb->m_keyboardEvents.key.listenStatic([this, keeb = keeb.get()](const IKeyboard::SKeyEvent& event) {
|
||||
|
|
@ -1035,7 +1035,7 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) {
|
|||
|
||||
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
||||
|
||||
Debug::log(LOG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", devname, (int)HASCONFIG);
|
||||
Debug::log(LOG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", devname, sc<int>(HASCONFIG));
|
||||
|
||||
const auto REPEATRATE = g_pConfigManager->getDeviceInt(devname, "repeat_rate", "input:repeat_rate");
|
||||
const auto REPEATDELAY = g_pConfigManager->getDeviceInt(devname, "repeat_delay", "input:repeat_delay");
|
||||
|
|
@ -1119,7 +1119,7 @@ void CInputManager::newMouse(SP<Aquamarine::IPointer> mouse) {
|
|||
|
||||
setupMouse(PMOUSE);
|
||||
|
||||
Debug::log(LOG, "New mouse created, pointer AQ: {:x}", (uintptr_t)mouse.get());
|
||||
Debug::log(LOG, "New mouse created, pointer AQ: {:x}", rc<uintptr_t>(mouse.get()));
|
||||
}
|
||||
|
||||
void CInputManager::setupMouse(SP<IPointer> mauz) {
|
||||
|
|
@ -1135,8 +1135,8 @@ void CInputManager::setupMouse(SP<IPointer> mauz) {
|
|||
const auto LIBINPUTDEV = mauz->aq()->getLibinputHandle();
|
||||
|
||||
Debug::log(LOG, "New mouse has libinput sens {:.2f} ({:.2f}) with accel profile {} ({})", libinput_device_config_accel_get_speed(LIBINPUTDEV),
|
||||
libinput_device_config_accel_get_default_speed(LIBINPUTDEV), (int)libinput_device_config_accel_get_profile(LIBINPUTDEV),
|
||||
(int)libinput_device_config_accel_get_default_profile(LIBINPUTDEV));
|
||||
libinput_device_config_accel_get_default_speed(LIBINPUTDEV), sc<int>(libinput_device_config_accel_get_profile(LIBINPUTDEV)),
|
||||
sc<int>(libinput_device_config_accel_get_default_profile(LIBINPUTDEV)));
|
||||
}
|
||||
|
||||
g_pPointerManager->attachPointer(mauz);
|
||||
|
|
@ -1223,7 +1223,7 @@ void CInputManager::setPointerConfigs() {
|
|||
|
||||
const auto TAP_DRAG_LOCK = g_pConfigManager->getDeviceInt(devname, "drag_lock", "input:touchpad:drag_lock");
|
||||
if (TAP_DRAG_LOCK >= 0 && TAP_DRAG_LOCK <= 2) {
|
||||
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, static_cast<libinput_config_drag_lock_state>(TAP_DRAG_LOCK));
|
||||
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, sc<libinput_config_drag_lock_state>(TAP_DRAG_LOCK));
|
||||
}
|
||||
|
||||
if (libinput_device_config_tap_get_finger_count(LIBINPUTDEV)) // this is for tapping (like on a laptop)
|
||||
|
|
@ -1241,13 +1241,12 @@ void CInputManager::setPointerConfigs() {
|
|||
}
|
||||
|
||||
if (libinput_device_config_3fg_drag_get_finger_count(LIBINPUTDEV) >= 3) {
|
||||
const auto DRAG_3FG_STATE = static_cast<libinput_config_3fg_drag_state>(g_pConfigManager->getDeviceInt(devname, "drag_3fg", "input:touchpad:drag_3fg"));
|
||||
const auto DRAG_3FG_STATE = sc<libinput_config_3fg_drag_state>(g_pConfigManager->getDeviceInt(devname, "drag_3fg", "input:touchpad:drag_3fg"));
|
||||
libinput_device_config_3fg_drag_set_enabled(LIBINPUTDEV, DRAG_3FG_STATE);
|
||||
}
|
||||
|
||||
if (libinput_device_config_dwt_is_available(LIBINPUTDEV)) {
|
||||
const auto DWT =
|
||||
static_cast<enum libinput_config_dwt_state>(g_pConfigManager->getDeviceInt(devname, "disable_while_typing", "input:touchpad:disable_while_typing") != 0);
|
||||
const auto DWT = sc<enum libinput_config_dwt_state>(g_pConfigManager->getDeviceInt(devname, "disable_while_typing", "input:touchpad:disable_while_typing") != 0);
|
||||
libinput_device_config_dwt_set_enabled(LIBINPUTDEV, DWT);
|
||||
}
|
||||
|
||||
|
|
@ -1319,7 +1318,7 @@ static void removeFromHIDs(WP<IHID> hid) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) {
|
||||
Debug::log(LOG, "Keyboard at {:x} removed", (uintptr_t)pKeyboard.get());
|
||||
Debug::log(LOG, "Keyboard at {:x} removed", rc<uintptr_t>(pKeyboard.get()));
|
||||
|
||||
std::erase_if(m_keyboards, [pKeyboard](const auto& other) { return other == pKeyboard; });
|
||||
|
||||
|
|
@ -1343,7 +1342,7 @@ void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyPointer(SP<IPointer> mouse) {
|
||||
Debug::log(LOG, "Pointer at {:x} removed", (uintptr_t)mouse.get());
|
||||
Debug::log(LOG, "Pointer at {:x} removed", rc<uintptr_t>(mouse.get()));
|
||||
|
||||
std::erase_if(m_pointers, [mouse](const auto& other) { return other == mouse; });
|
||||
|
||||
|
|
@ -1356,7 +1355,7 @@ void CInputManager::destroyPointer(SP<IPointer> mouse) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyTouchDevice(SP<ITouch> touch) {
|
||||
Debug::log(LOG, "Touch device at {:x} removed", (uintptr_t)touch.get());
|
||||
Debug::log(LOG, "Touch device at {:x} removed", rc<uintptr_t>(touch.get()));
|
||||
|
||||
std::erase_if(m_touches, [touch](const auto& other) { return other == touch; });
|
||||
|
||||
|
|
@ -1364,7 +1363,7 @@ void CInputManager::destroyTouchDevice(SP<ITouch> touch) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyTablet(SP<CTablet> tablet) {
|
||||
Debug::log(LOG, "Tablet device at {:x} removed", (uintptr_t)tablet.get());
|
||||
Debug::log(LOG, "Tablet device at {:x} removed", rc<uintptr_t>(tablet.get()));
|
||||
|
||||
std::erase_if(m_tablets, [tablet](const auto& other) { return other == tablet; });
|
||||
|
||||
|
|
@ -1372,7 +1371,7 @@ void CInputManager::destroyTablet(SP<CTablet> tablet) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyTabletTool(SP<CTabletTool> tool) {
|
||||
Debug::log(LOG, "Tablet tool at {:x} removed", (uintptr_t)tool.get());
|
||||
Debug::log(LOG, "Tablet tool at {:x} removed", rc<uintptr_t>(tool.get()));
|
||||
|
||||
std::erase_if(m_tabletTools, [tool](const auto& other) { return other == tool; });
|
||||
|
||||
|
|
@ -1380,7 +1379,7 @@ void CInputManager::destroyTabletTool(SP<CTabletTool> tool) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyTabletPad(SP<CTabletPad> pad) {
|
||||
Debug::log(LOG, "Tablet pad at {:x} removed", (uintptr_t)pad.get());
|
||||
Debug::log(LOG, "Tablet pad at {:x} removed", rc<uintptr_t>(pad.get()));
|
||||
|
||||
std::erase_if(m_tabletPads, [pad](const auto& other) { return other == pad; });
|
||||
|
||||
|
|
@ -1674,7 +1673,7 @@ void CInputManager::newTouchDevice(SP<Aquamarine::ITouch> pDevice) {
|
|||
destroyTouchDevice(PDEV);
|
||||
});
|
||||
|
||||
Debug::log(LOG, "New touch device added at {:x}", (uintptr_t)PNEWDEV.get());
|
||||
Debug::log(LOG, "New touch device added at {:x}", rc<uintptr_t>(PNEWDEV.get()));
|
||||
}
|
||||
|
||||
void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ void CInputPopup::updateBox() {
|
|||
if (!cursorRect) {
|
||||
Vector2D coords = OWNER ? OWNER->getSurfaceBoxGlobal().value_or(CBox{0, 0, 500, 500}).pos() : Vector2D{0, 0};
|
||||
parentBox = {coords, {500, 500}};
|
||||
cursorBoxParent = {0, 0, (int)parentBox.w, (int)parentBox.h};
|
||||
cursorBoxParent = {0, 0, sc<int>(parentBox.w), sc<int>(parentBox.h)};
|
||||
}
|
||||
|
||||
Vector2D currentPopupSize = m_surface->getViewporterCorrectedSize() / m_surface->resource()->m_current.scale;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
// commit
|
||||
auto workspaceIDLeft = getWorkspaceIDNameFromString((*PSWIPEUSER ? "r-1" : "m-1")).id;
|
||||
auto workspaceIDRight = getWorkspaceIDNameFromString((*PSWIPEUSER ? "r+1" : "m+1")).id;
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, sc<int64_t>(1LL), sc<int64_t>(UINT32_MAX));
|
||||
|
||||
// If we've been swiping off the right end with PSWIPENEW enabled, there is
|
||||
// no workspace there yet, and we need to choose an ID for a new one now.
|
||||
|
|
@ -213,7 +213,7 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
|
|||
static auto PSWIPEUSER = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_use_r");
|
||||
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
||||
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, sc<int64_t>(1LL), sc<int64_t>(UINT32_MAX));
|
||||
const auto XDISTANCE = m_activeSwipe.pMonitor->m_size.x + *PWORKSPACEGAP;
|
||||
const auto YDISTANCE = m_activeSwipe.pMonitor->m_size.y + *PWORKSPACEGAP;
|
||||
const auto ANIMSTYLE = m_activeSwipe.pWorkspaceBegin->m_renderOffset->getStyle();
|
||||
|
|
@ -234,7 +234,7 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
|
|||
|
||||
m_activeSwipe.pWorkspaceBegin->m_forceRendering = true;
|
||||
|
||||
m_activeSwipe.delta = std::clamp(m_activeSwipe.delta, (double)-SWIPEDISTANCE, (double)SWIPEDISTANCE);
|
||||
m_activeSwipe.delta = std::clamp(m_activeSwipe.delta, sc<double>(-SWIPEDISTANCE), sc<double>(SWIPEDISTANCE));
|
||||
|
||||
if ((m_activeSwipe.pWorkspaceBegin->m_id == workspaceIDLeft && *PSWIPENEW && (m_activeSwipe.delta < 0)) ||
|
||||
(m_activeSwipe.delta > 0 && m_activeSwipe.pWorkspaceBegin->getWindows() == 0 && workspaceIDRight <= m_activeSwipe.pWorkspaceBegin->m_id) ||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ void CTextInput::commitStateToIME(SP<CInputMethodV2> ime) {
|
|||
ime->textChangeCause(ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
|
||||
|
||||
if (m_v1Input->m_pendingContentType.isPending)
|
||||
ime->textContentType((zwpTextInputV3ContentHint)INPUT->m_pendingContentType.hint, (zwpTextInputV3ContentPurpose)INPUT->m_pendingContentType.purpose);
|
||||
ime->textContentType(sc<zwpTextInputV3ContentHint>(INPUT->m_pendingContentType.hint), sc<zwpTextInputV3ContentPurpose>(INPUT->m_pendingContentType.purpose));
|
||||
}
|
||||
|
||||
g_pInputManager->m_relay.updateAllPopups();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
|||
|
||||
static auto PSWIPETOUCH = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch");
|
||||
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
|
||||
auto* const PGAPSOUT = (CCssGapData*)(PGAPSOUTDATA.ptr())->getData();
|
||||
auto* const PGAPSOUT = sc<CCssGapData*>((PGAPSOUTDATA.ptr())->getData());
|
||||
// TODO: WORKSPACERULE.gapsOut.value_or()
|
||||
auto gapsOut = *PGAPSOUT;
|
||||
static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size");
|
||||
|
|
@ -126,7 +126,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
|
|||
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
|
||||
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch_invert");
|
||||
static auto PSWIPEDIST = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_distance");
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, sc<int64_t>(1LL), sc<int64_t>(UINT32_MAX));
|
||||
// Handle the workspace swipe if there is one
|
||||
if (m_activeSwipe.initialDirection == -1) {
|
||||
if (*PSWIPEINVR)
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ eDynamicPermissionAllowMode CDynamicPermissionManager::clientPermissionMode(wl_c
|
|||
|
||||
const auto LOOKUP = binaryNameForWlClient(client);
|
||||
|
||||
Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: checking permission {} for client {:x} (binary {})", permissionToString(permission), (uintptr_t)client,
|
||||
Debug::log(TRACE, "CDynamicPermissionManager::clientHasPermission: checking permission {} for client {:x} (binary {})", permissionToString(permission), rc<uintptr_t>(client),
|
||||
LOOKUP.has_value() ? LOOKUP.value() : "lookup failed: " + LOOKUP.error());
|
||||
|
||||
// first, check if we have the client + perm combo in our cache.
|
||||
|
|
@ -174,7 +174,7 @@ eDynamicPermissionAllowMode CDynamicPermissionManager::clientPermissionModeWithS
|
|||
if (lookup.has_value())
|
||||
binaryName = *lookup;
|
||||
} else
|
||||
binaryName = specialPidToString((eSpecialPidTypes)pid);
|
||||
binaryName = specialPidToString(sc<eSpecialPidTypes>(pid));
|
||||
|
||||
// first, check if we have the client + perm combo in our cache.
|
||||
auto it = std::ranges::find_if(m_rules, [str, permission, pid](const auto& e) { return e->m_keyString == str && pid && pid == e->m_pid && e->m_type == permission; });
|
||||
|
|
@ -246,14 +246,14 @@ void CDynamicPermissionManager::askForPermission(wl_client* client, const std::s
|
|||
|
||||
std::string description = "";
|
||||
if (binaryPath.empty())
|
||||
description = std::format(std::runtime_format(permissionToHumanString(type)), std::format("unknown application (wayland client ID 0x{:x})", (uintptr_t)client));
|
||||
description = std::format(std::runtime_format(permissionToHumanString(type)), std::format("unknown application (wayland client ID 0x{:x})", rc<uintptr_t>(client)));
|
||||
else if (client) {
|
||||
std::string binaryName = binaryPath.contains("/") ? binaryPath.substr(binaryPath.find_last_of('/') + 1) : binaryPath;
|
||||
description = std::format(std::runtime_format(permissionToHumanString(type)), std::format("{}</b> ({})", binaryName, binaryPath));
|
||||
} else {
|
||||
std::string lookup = "";
|
||||
if (pid < 0)
|
||||
lookup = specialPidToString((eSpecialPidTypes)pid);
|
||||
lookup = specialPidToString(sc<eSpecialPidTypes>(pid));
|
||||
else {
|
||||
const auto LOOKUP = binaryNameForPid(pid);
|
||||
lookup = LOOKUP.value_or("Unknown");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue