mirror of
https://github.com/hyprwm/Hyprland.git
synced 2026-08-24 10:04:19 -05:00
internal: fix bugs revealed by hu update
fixes invalid ptr comparisons, and explicits bool conversions
This commit is contained in:
@@ -1371,7 +1371,7 @@ ActionResult Actions::moveWindowOrGroup(Math::eDirection direction, std::optiona
|
||||
|
||||
const auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(window, direction);
|
||||
|
||||
const bool ISWINDOWGROUP = window->m_group;
|
||||
const bool ISWINDOWGROUP = !!window->m_group;
|
||||
const bool ISWINDOWGROUPLOCKED = ISWINDOWGROUP && window->m_group->locked();
|
||||
const bool ISWINDOWGROUPSINGLE = ISWINDOWGROUP && window->m_group->size() == 1;
|
||||
const bool ISWINDOWGROUPDENIED = ISWINDOWGROUP && window->m_group->denied();
|
||||
|
||||
@@ -88,11 +88,11 @@ namespace Desktop::View {
|
||||
};
|
||||
|
||||
inline bool valid(PHLLS l) {
|
||||
return l;
|
||||
return !!l;
|
||||
}
|
||||
|
||||
inline bool valid(PHLLSREF l) {
|
||||
return l;
|
||||
return !!l;
|
||||
}
|
||||
|
||||
inline bool validMapped(PHLLS l) {
|
||||
|
||||
@@ -28,7 +28,8 @@ View::CSessionLock::~CSessionLock() {
|
||||
}
|
||||
|
||||
void View::CSessionLock::init() {
|
||||
m_listeners.destroy = m_surface->m_events.destroy.listen([this] { std::erase_if(g_pCompositor->m_otherViews, [this](const auto& e) { return e == m_self; }); });
|
||||
m_listeners.destroy =
|
||||
m_surface->m_events.destroy.listen([this] { std::erase_if(g_pCompositor->m_otherViews, [this](const auto& e) { return e == dynamicPointerCast<IView>(m_self); }); });
|
||||
|
||||
m_wlSurface->assign(m_surface->surface(), m_self.lock());
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ CWLSurface::~CWLSurface() {
|
||||
}
|
||||
|
||||
bool CWLSurface::exists() const {
|
||||
return m_resource;
|
||||
return !!m_resource;
|
||||
}
|
||||
|
||||
SP<CWLSurfaceResource> CWLSurface::resource() const {
|
||||
|
||||
@@ -1491,7 +1491,7 @@ void CWindow::onX11ConfigureRequest(CBox box) {
|
||||
|
||||
g_pHyprRenderer->damageWindow(m_self.lock());
|
||||
|
||||
if (!m_isFloating || isFullscreen() || g_layoutManager->dragController()->target() == m_self || (m_suppressedEvents & Desktop::View::SUPPRESS_X11_CONFIGURE_REQUEST)) {
|
||||
if (!m_isFloating || isFullscreen() || g_layoutManager->dragController()->target() == layoutTarget() || (m_suppressedEvents & Desktop::View::SUPPRESS_X11_CONFIGURE_REQUEST)) {
|
||||
sendWindowSize(true);
|
||||
g_pInputManager->refocus();
|
||||
g_pHyprRenderer->damageWindow(m_self.lock());
|
||||
@@ -2544,7 +2544,7 @@ void CWindow::unmapWindow() {
|
||||
g_pInputManager->releaseAllMouseButtons();
|
||||
}
|
||||
|
||||
if (m_self.lock() == g_layoutManager->dragController()->target())
|
||||
if (layoutTarget() == g_layoutManager->dragController()->target())
|
||||
CKeybindManager::changeMouseBindMode(MBIND_INVALID);
|
||||
|
||||
// remove the fullscreen window status from workspace if we closed it
|
||||
@@ -2798,8 +2798,8 @@ std::optional<Vector2D> CWindow::minSize() {
|
||||
return m_ruleApplicator->minSize().value();
|
||||
|
||||
// then check if we have any proto overrides
|
||||
bool hasSizeHints = m_xwaylandSurface ? m_xwaylandSurface->m_sizeHints : false;
|
||||
bool hasTopLevel = m_xdgSurface ? m_xdgSurface->m_toplevel : false;
|
||||
bool hasSizeHints = m_xwaylandSurface ? !!m_xwaylandSurface->m_sizeHints : false;
|
||||
bool hasTopLevel = m_xdgSurface ? !!m_xdgSurface->m_toplevel : false;
|
||||
if ((m_isX11 && !hasSizeHints) || (!m_isX11 && !hasTopLevel))
|
||||
return std::nullopt;
|
||||
|
||||
@@ -2843,7 +2843,7 @@ bool CWindow::canBeGroupedInto(SP<CGroup> group) {
|
||||
return false;
|
||||
|
||||
static auto ALLOWGROUPMERGE = CConfigValue<Config::INTEGER>("group:merge_groups_on_drag");
|
||||
bool isGroup = m_group;
|
||||
bool isGroup = !!m_group;
|
||||
bool disallowDragIntoGroup = g_layoutManager->dragController()->wasDraggingWindow() && isGroup && !sc<bool>(*ALLOWGROUPMERGE);
|
||||
return !g_pKeybindManager->m_groupsLocked // global group lock disengaged
|
||||
&& ((m_groupRules & GROUP_INVADE && m_firstMap) // window ignore local group locks, or
|
||||
|
||||
@@ -51,7 +51,7 @@ CANRManager::CANRManager() {
|
||||
d->dialogSaidWait = false;
|
||||
}
|
||||
|
||||
std::erase_if(m_data, [&window](auto& w) { return w == window; });
|
||||
std::erase_if(m_data, [&window](auto& anrData) { return !anrData || anrData->fitsWindow(window); });
|
||||
});
|
||||
|
||||
m_timer->updateTimeout(TIMER_TIMEOUT);
|
||||
|
||||
@@ -621,7 +621,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
||||
m_foundSurfaceToFocus = foundSurface;
|
||||
}
|
||||
|
||||
if (g_layoutManager->dragController()->target() && pFoundWindow != g_layoutManager->dragController()->target()) {
|
||||
if (g_layoutManager->dragController()->target() && (!pFoundWindow || pFoundWindow->layoutTarget() != g_layoutManager->dragController()->target())) {
|
||||
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "InputManager.hpp"
|
||||
|
||||
bool CUnifiedWorkspaceSwipeGesture::isGestureInProgress() {
|
||||
return m_workspaceBegin;
|
||||
return !!m_workspaceBegin;
|
||||
}
|
||||
|
||||
void CUnifiedWorkspaceSwipeGesture::begin() {
|
||||
|
||||
@@ -148,7 +148,7 @@ WP<CScreenshareSession> CScreenshareManager::getManagedSession(eScreenshareType
|
||||
return;
|
||||
|
||||
const auto& session = managed->m_session;
|
||||
std::erase_if(Screenshare::mgr()->m_managedSessions, [&session](const auto& s) { return s && s->m_session == session; });
|
||||
std::erase_if(Screenshare::mgr()->m_managedSessions, [&session](const auto& s) { return s && s->m_session.get() == session.get(); });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1229,7 +1229,7 @@ bool CMonitor::enabled() const {
|
||||
}
|
||||
|
||||
bool CMonitor::hasOutput() const {
|
||||
return m_output;
|
||||
return !!m_output;
|
||||
}
|
||||
|
||||
SP<Aquamarine::IOutput> CMonitor::output() const {
|
||||
|
||||
@@ -269,11 +269,11 @@ CColorManagementSurface::CColorManagementSurface(SP<CWpColorManagementSurfaceV1>
|
||||
m_imageDescription = getDefaultImageDescription();
|
||||
|
||||
m_resource->setDestroy([this](CWpColorManagementSurfaceV1* r) {
|
||||
LOGM(Log::TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface);
|
||||
LOGM(Log::TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface.get());
|
||||
PROTO::colorManagement->destroyResource(this);
|
||||
});
|
||||
m_resource->setOnDestroy([this](CWpColorManagementSurfaceV1* r) {
|
||||
LOGM(Log::TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface);
|
||||
LOGM(Log::TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface.get());
|
||||
PROTO::colorManagement->destroyResource(this);
|
||||
});
|
||||
|
||||
@@ -370,11 +370,11 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana
|
||||
m_client = m_resource->client();
|
||||
|
||||
m_resource->setDestroy([this](CWpColorManagementSurfaceFeedbackV1* r) {
|
||||
LOGM(Log::TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface);
|
||||
LOGM(Log::TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface.get());
|
||||
PROTO::colorManagement->destroyResource(this);
|
||||
});
|
||||
m_resource->setOnDestroy([this](CWpColorManagementSurfaceFeedbackV1* r) {
|
||||
LOGM(Log::TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface);
|
||||
LOGM(Log::TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface.get());
|
||||
PROTO::colorManagement->destroyResource(this);
|
||||
});
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class CDRMSyncPointState {
|
||||
|
||||
//
|
||||
operator bool() const {
|
||||
return m_timeline;
|
||||
return !!m_timeline;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -50,7 +50,7 @@ CExtWorkspaceGroupResource::CExtWorkspaceGroupResource(WP<CExtWorkspaceManagerRe
|
||||
}
|
||||
|
||||
bool CExtWorkspaceGroupResource::good() const {
|
||||
return m_resource;
|
||||
return !!m_resource;
|
||||
}
|
||||
|
||||
WP<CExtWorkspaceGroupResource> CExtWorkspaceGroupResource::fromResource(wl_resource* resource) {
|
||||
@@ -136,7 +136,7 @@ CExtWorkspaceResource::CExtWorkspaceResource(WP<CExtWorkspaceManagerResource> ma
|
||||
}
|
||||
|
||||
bool CExtWorkspaceResource::good() const {
|
||||
return m_resource;
|
||||
return !!m_resource;
|
||||
}
|
||||
|
||||
bool CExtWorkspaceResource::isActive() const {
|
||||
@@ -248,7 +248,7 @@ void CExtWorkspaceManagerResource::init(WP<CExtWorkspaceManagerResource> self) {
|
||||
}
|
||||
|
||||
bool CExtWorkspaceManagerResource::good() const {
|
||||
return m_resource;
|
||||
return !!m_resource;
|
||||
}
|
||||
|
||||
void CExtWorkspaceManagerResource::scheduleDone() {
|
||||
|
||||
@@ -141,7 +141,7 @@ CFifoManagerResource::CFifoManagerResource(UP<CWpFifoManagerV1>&& resource_) : m
|
||||
}
|
||||
|
||||
surf->m_fifo = RESOURCE;
|
||||
LOGM(Log::DEBUG, "New fifo at {:x} for surface {:x}", (uintptr_t)RESOURCE, (uintptr_t)surf.get());
|
||||
LOGM(Log::DEBUG, "New fifo at {:x} for surface {:x}", (uintptr_t)RESOURCE.get(), (uintptr_t)surf.get());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ CLayerShellResource::CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, SP<C
|
||||
m_current = m_pending;
|
||||
m_pending.committed = 0;
|
||||
|
||||
bool attachedBuffer = m_surface->m_current.texture;
|
||||
bool attachedBuffer = !!m_surface->m_current.texture;
|
||||
|
||||
if (attachedBuffer && !m_configured) {
|
||||
m_surface->error(-1, "layerSurface was not configured, but a buffer was attached");
|
||||
|
||||
@@ -570,7 +570,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
|
||||
if (g_pInputManager->m_lastInputTouch)
|
||||
m_dnd.touchPos = g_pInputManager->m_touchData.lastTouchPos;
|
||||
|
||||
LOGM(Log::DEBUG, "initiateDrag: source {:x}, surface: {:x}, origin: {:x}", (uintptr_t)currentSource.get(), (uintptr_t)dragSurface, (uintptr_t)origin);
|
||||
LOGM(Log::DEBUG, "initiateDrag: source {:x}, surface: {:x}, origin: {:x}", (uintptr_t)currentSource.get(), (uintptr_t)dragSurface.get(), (uintptr_t)origin.get());
|
||||
|
||||
currentSource->m_used = true;
|
||||
|
||||
@@ -585,7 +585,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_dnd.dndSurface->m_current.texture <= 0 && m_dnd.dndSurface->m_mapped) {
|
||||
if (!m_dnd.dndSurface->m_current.texture && m_dnd.dndSurface->m_mapped) {
|
||||
m_dnd.dndSurface->unmap();
|
||||
return;
|
||||
}
|
||||
@@ -850,7 +850,7 @@ void CWLDataDeviceProtocol::renderDND(PHLMONITOR pMonitor, const Time::steady_tp
|
||||
}
|
||||
|
||||
bool CWLDataDeviceProtocol::dndActive() {
|
||||
return m_dnd.currentSource;
|
||||
return !!m_dnd.currentSource;
|
||||
}
|
||||
|
||||
void CWLDataDeviceProtocol::abortDndIfPresent() {
|
||||
|
||||
@@ -112,7 +112,7 @@ SP<IHLBuffer> CHLBufferReference::operator->() const {
|
||||
}
|
||||
|
||||
CHLBufferReference::operator bool() const {
|
||||
return m_buffer;
|
||||
return !!m_buffer;
|
||||
}
|
||||
|
||||
void CHLBufferReference::drop() {
|
||||
|
||||
@@ -55,7 +55,7 @@ bool CHyprGLRenderer::initRenderBuffer(SP<Aquamarine::IBuffer> buffer, uint32_t
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_currentRenderbuffer;
|
||||
return !!m_currentRenderbuffer;
|
||||
}
|
||||
|
||||
bool CHyprGLRenderer::beginFullFakeRenderInternal(PHLMONITOR pMonitor, CRegion& damage, SP<IFramebuffer> fb, bool simple) {
|
||||
|
||||
@@ -741,7 +741,7 @@ void CHyprOpenGLImpl::begin(PHLMONITOR pMonitor, const CRegion& damage_, SP<IFra
|
||||
g_pHyprRenderer->m_renderData.damage.set(damage_);
|
||||
g_pHyprRenderer->m_renderData.finalDamage.set(finalDamage.value_or(damage_));
|
||||
|
||||
m_fakeFrame = fb;
|
||||
m_fakeFrame = !!fb;
|
||||
|
||||
if (g_pHyprRenderer->m_reloadScreenShader) {
|
||||
g_pHyprRenderer->m_reloadScreenShader = false;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace State {
|
||||
virtual const std::vector<PHLWORKSPACEREF>& workspaceRefs() const override;
|
||||
virtual std::vector<SWorkspaceQueryable> queryableWorkspaces() const override;
|
||||
auto workspaces() const {
|
||||
return std::views::filter(m_workspaces, [](const auto& e) { return e; });
|
||||
return std::views::filter(m_workspaces, [](const auto& e) { return !!e; });
|
||||
}
|
||||
std::vector<PHLWORKSPACE> workspacesCopy() const;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void CXWaylandSurface::recheckSupportedProps() {
|
||||
}
|
||||
|
||||
void CXWaylandSurface::ensureListeners() {
|
||||
bool connected = m_listeners.destroySurface;
|
||||
bool connected = !!m_listeners.destroySurface;
|
||||
|
||||
if (connected && !m_surface) {
|
||||
m_listeners.destroySurface.reset();
|
||||
|
||||
Reference in New Issue
Block a user